:root {
  --hki: #1A5276;
  --kln: #1E8449;
  --nt: #B7770D;
  --primary: #766df4;
  --primary-dark: #5b52d9;
  --primary-tint: #f0eefe;
  --dark: #37384e;
  --bg: #f7f7fc;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6c757d;
  --border: #dee2e6;
  --confirmed: #16c995;
  --pending: #856404;
  --warning: #f74f78;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, 'Helvetica Neue', Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* Matches biz.searchsmart.hk's navbar color (white, subtle bottom shadow)
   instead of a standalone gradient banner. */
.page-header { background: #fff; border-bottom: 1px solid var(--border); box-shadow: 0 0.125rem 0.625rem -0.1875rem rgba(0,0,0,0.06); padding: 16px 24px; }
.page-header .header-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1100px; margin: 0 auto; }
.page-header h1 { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.page-header .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.page-header .zoe-badge { display: inline-block; margin-top: 8px; background: var(--primary-tint); color: var(--primary-dark); font-weight: 600; border-radius: 20px; padding: 4px 14px; font-size: 12px; }

.auth-widget { font-size: 12px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.auth-widget .signout-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-widget .signout-link:hover { text-decoration: underline; }
.btn-login { display: inline-block; padding: 7px 16px; border-radius: 20px; background: var(--primary); color: #fff; font-weight: 600; font-size: 12px; text-decoration: none; }
.btn-login:hover { background: var(--primary-dark); }

/* Language toggle: which language shows is set by applyLang() in app.js,
   based on the /en or /zh-hk URL prefix. */
body.lang-en .zh { display: none; }
body.lang-zh .en { display: none; }
.lang-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; padding: 0; flex-shrink: 0; }
.lang-btn:hover { border-color: var(--primary); color: var(--primary); }

.tabs { display: flex; background: white; border-bottom: 1px solid var(--border); padding: 0 16px; overflow-x: auto; }
.tab { padding: 12px 16px; font-size: 13px; font-weight: 500; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; color: var(--muted); transition: all 0.2s; text-decoration: none; }
.tab.active { border-bottom-color: var(--primary); color: var(--text); font-weight: 600; }
.tab:hover { color: var(--primary); }

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }
.section { display: none; }
.section.active { display: block; }

.district-header { padding: 10px 14px; border-radius: 12px 12px 0 0; color: white; font-weight: 600; font-size: 13px; margin-top: 24px; }
.district-hki { background: var(--hki); }
.district-kln { background: var(--kln); }
.district-nt { background: var(--nt); }

.school-table { width: 100%; border-collapse: collapse; background: white; border-radius: 0 0 12px 12px; overflow: hidden; box-shadow: 0 4px 12px rgba(55,56,78,0.06); margin-bottom: 4px; }
.school-table th { font-size: 11px; font-weight: 600; text-align: left; padding: 8px 12px; background: #f1f3f4; color: var(--muted); border-bottom: 1px solid var(--border); }
.school-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: top; }
.school-table tr:last-child td { border-bottom: none; }
.school-table tr:hover td { background: #fafbfc; }

/* Both zh and en versions of a name/ranking are equally "primary" now that
   only one shows at a time (see the /en, /zh-hk toggle) - .school-caption
   is the one deliberately-secondary/muted style, for things like the
   region tag under a name, not for the translated name itself. */
.school-name { font-weight: 600; font-size: 13px; color: var(--text); }
.school-caption { color: var(--muted); font-size: 11px; margin-top: 1px; }
.school-address { color: var(--muted); font-size: 11px; margin-top: 2px; }

.badge { display: inline-block; font-size: 10px; padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.badge-full { background: #d5f5e3; color: #1e8449; }
.badge-half { background: #e8f4fc; color: #1a5276; }
.badge-confirmed { background: #d5f5e3; color: var(--confirmed); }
.badge-pending { background: #fff3cd; color: var(--pending); }
.badge-tbc { background: #f1f3f4; color: var(--muted); }

.rank-main { font-size: 12px; font-weight: 500; color: var(--text); }
.rank-source { font-size: 10px; color: var(--muted); margin-top: 2px; }

.tracker-date { font-weight: 500; color: var(--confirmed); }
.tracker-note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tracker-tbc { color: var(--pending); font-style: italic; font-size: 11px; }
.tracker-hint { margin-top: 5px; font-size: 10px; color: var(--warning); background: #fdf2f0; border: 1px solid #f5c6cb; border-radius: 4px; padding: 4px 6px; line-height: 1.45; }
.tracker-hint b { color: var(--warning); }
.tracker-hint .hint-line { color: #7a4b46; margin-top: 1px; }

.track-group-head { font-size: 14px; font-weight: 600; margin: 8px 0 10px; color: var(--text); }
.cal-btn { font-size: 11px; padding: 3px 10px; margin: 1px 2px 1px 0; border: 1px solid var(--border); background: #fff; border-radius: 20px; cursor: pointer; color: var(--primary); white-space: nowrap; }
.cal-btn:hover { background: var(--primary-tint); border-color: var(--primary); }
.cal-none { color: var(--muted); font-size: 11px; }
.region-filter { display: block; font-size: 12px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); margin-bottom: 14px; font-family: inherit; }
.add-btn { font-size: 11px; padding: 4px 12px; border: 1px solid var(--primary); background: var(--primary); color: #fff; border-radius: 20px; cursor: pointer; white-space: nowrap; font-weight: 600; }
.add-btn:hover { background: var(--primary-dark); }
.add-btn:disabled, .add-btn.added { background: #d9f7ec; border-color: var(--confirmed); color: #0e9973; cursor: default; opacity: 1; }
.prog-summary { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; font-size: 12px; margin-bottom: 14px; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; box-shadow: 0 4px 12px rgba(55,56,78,0.06); }
.prog-summary b { color: var(--text); font-size: 13px; }
.prog-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 4px 12px rgba(55,56,78,0.06); }
.prog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.prog-site { text-decoration: none; font-size: 15px; }
.prog-rows { display: flex; flex-direction: column; gap: 7px; }
.prog-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prog-label { font-size: 12px; font-weight: 600; min-width: 96px; }
.prog-date { font-size: 11px; color: var(--muted); min-width: 56px; }
.prog-date.prog-manual { color: var(--primary-dark); font-weight: 600; }
.prog-edit { font-size: 11px; padding: 2px 6px; border: 1px solid var(--border); background: #fff; border-radius: 12px; cursor: pointer; line-height: 1; }
.prog-edit:hover { background: var(--primary-tint); border-color: var(--primary); }
.prog-editwrap { display: inline-flex; gap: 4px; align-items: center; }
.prog-dateinput { font-size: 11px; padding: 2px 6px; border: 1px solid var(--primary); border-radius: 6px; }
.prog-clear, .prog-cancel { font-size: 11px; padding: 2px 6px; border: 1px solid var(--border); background: #fff; border-radius: 12px; cursor: pointer; line-height: 1; }
.dob-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; background: var(--primary-tint); border: 1px solid #ddd8fb; border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; font-size: 12px; }
.dob-bar input[type=date] { font-size: 12px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; }
.dob-info { color: var(--primary-dark); font-weight: 600; }
.prog-card.prog-inelig { opacity: 0.5; }
.inelig-badge { font-size: 10px; background: #fdf0d5; color: #8a6d3b; border: 1px solid #e6cf9c; border-radius: 10px; padding: 2px 8px; align-self: center; white-space: nowrap; }
.prog-toggle, .prog-result { font-size: 11px; padding: 4px 11px; border: 1px solid var(--border); background: #fff; border-radius: 20px; cursor: pointer; color: var(--muted); }
.prog-toggle.on { background: #d9f7ec; border-color: var(--confirmed); color: #0e9973; font-weight: 600; }
.prog-result.on[data-val="offer"] { background: #d9f7ec; border-color: var(--confirmed); color: #0e9973; font-weight: 600; }
.prog-result.on[data-val="rejected"] { background: #fde8ec; border-color: var(--warning); color: var(--warning); font-weight: 600; }
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 20px; }
.tl-item::before { content: ''; position: absolute; left: -21px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid white; box-shadow: 0 0 0 2px var(--primary); }
.tl-date { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.tl-body { background: white; border-radius: 12px; padding: 10px 14px; border: 1px solid var(--border); font-size: 12px; line-height: 1.6; box-shadow: 0 4px 12px rgba(55,56,78,0.06); }
.tl-zh { margin-bottom: 4px; }
.tl-en { color: var(--muted); }

.notes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.note-card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: 0 4px 12px rgba(55,56,78,0.06); }
.note-card h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.note-card p { font-size: 13px; line-height: 1.6; }

.last-updated { font-size: 11px; color: var(--muted); text-align: right; margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--border); }

@media (max-width: 700px) {
  .school-table thead { display: none; }
  .school-table tr { display: block; padding: 12px; border-bottom: 1px solid var(--border); }
  .school-table td { display: block; padding: 2px 0; border: none; }
  .school-table td::before { content: attr(data-label); font-weight: 600; font-size: 10px; color: var(--muted); display: block; margin-bottom: 2px; text-transform: uppercase; }
}
