:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #f6f8fc;
  --border: #d4dbe6;
  --text: #1c2533;
  --muted: #5a687c;
  --accent: #165dd6;
  --accent-soft: #e8f0ff;
  --success: #17844d;
  --success-soft: #eafaf2;
  --danger: #ba2f2f;
  --danger-soft: #fdf0f0;
  --warning: #b85c00;
  --warning-soft: #fff6e8;
  --shadow: 0 10px 24px rgba(18,28,44,.08);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100dvh; }
body { font-family: "Segoe UI","Trebuchet MS",sans-serif; color: var(--text); background: linear-gradient(160deg,#edf3ff,#f8fafc 42%,#eef9f2); }

/* Layout */
.shell { max-width: 1200px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }
.center-shell { max-width: 440px; margin: 0 auto; padding: 40px 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card + .card { margin-top: 16px; }

/* Typography */
h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 8px; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 0 0 16px; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 12px; }
p { margin: 0 0 12px; line-height: 1.6; }
a { color: var(--accent); }

/* Forms */
.field { margin-bottom: 16px; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 1rem; font-family: inherit;
  background: var(--surface); color: var(--text); transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border: none; border-radius: 8px; font-size: 1rem;
  font-family: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: opacity .15s, transform .1s; min-height: 48px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: .9; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-google { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .85rem; min-height: 36px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; font-size: .9rem; margin-bottom: 16px; }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #f5c0c0; }
.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid #b3e6cc; }
.alert-info { background: var(--accent-soft); color: var(--accent); border: 1px solid #c0d4f5; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border: 1px solid #f5d9b3; }

/* Progress bar */
.progress-bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.progress-red { background: #e53e3e; }
.progress-orange { background: #dd6b20; }
.progress-yellow { background: #d69e2e; }
.progress-green { background: var(--success); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.badge-confirmed { background: var(--success-soft); color: var(--success); }
.badge-unapproved { background: var(--warning-soft); color: var(--warning); }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-active { background: var(--accent-soft); color: var(--accent); }

/* Nav / tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 16px; border: none; background: none; cursor: pointer; font: 600 .9rem/1 inherit; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Table */
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; padding: 10px 12px; color: var(--muted); font-size: .8rem; font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:hover td { background: var(--surface-muted); }
.tbl-wrap { overflow-x: auto; }

/* Dashboard cards */
.asgn-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.asgn-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.asgn-title { font-weight: 600; font-size: 1rem; }
.asgn-due { font-size: .8rem; color: var(--muted); }
.remaining-text { font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* Medal */
.medal { display: inline-flex; align-items: center; gap: 6px; background: #fffbe8; border: 1px solid #f5e59a; border-radius: 20px; padding: 4px 12px; font-size: .85rem; font-weight: 600; color: #7a5c00; margin: 4px; }

/* Utils */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--muted); font-size: .85rem; }
.text-center { text-align: center; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* Divider */
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.divider span { color: var(--muted); font-size: .85rem; }

/* Mobile */
@media (max-width: 480px) {
  .center-shell { padding: 20px 12px; }
  .card { padding: 16px; }
  h1 { font-size: 1.3rem; }
  .btn { font-size: .95rem; }
}

/* Tooltips — use data-tip="hint text" on any element */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22,30,44,.92);
  color: #fff;
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: normal;
  max-width: 200px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s .1s;
  z-index: 9999;
}
[data-tip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(22,30,44,.92);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s .1s;
  z-index: 9999;
}
[data-tip]:hover::after, [data-tip]:hover::before { opacity: 1; }
/* tip-bottom: show below element */
[data-tip].tip-bottom::after { top: calc(100% + 8px); bottom: auto; }
[data-tip].tip-bottom::before { top: calc(100% + 4px); bottom: auto; border-top-color: transparent; border-bottom-color: rgba(22,30,44,.92); }

/* Sub-tabs inside a tab */
.sub-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.sub-tab { padding: 8px 14px; border: none; background: none; cursor: pointer; font: 600 .85rem/1 inherit; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; border-radius: 4px 4px 0 0; }
.sub-tab:hover { background: var(--surface-muted); color: var(--text); }
.sub-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-soft); }
.sub-tab-content { display: none; }
.sub-tab-content.active { display: block; }
