* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f1f5f9; color: #1e293b; line-height: 1.5; }

.topbar { background: #1e3a5f; color: #fff; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.topbar .brand { font-size: 20px; font-weight: 700; }
.topbar nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: #dbeafe; text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: #fff; text-decoration: underline; }
.topbar .who { font-size: 13px; color: #bfdbfe; background: rgba(255,255,255,.12); padding: 4px 10px; border-radius: 20px; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
.footer { text-align: center; color: #64748b; font-size: 13px; padding: 24px; }

h1 { font-size: 26px; margin-bottom: 6px; }
h2 { font-size: 20px; margin: 22px 0 12px; }
p.muted, .muted { color: #64748b; font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 18px 0; }
.card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card .num { font-size: 32px; font-weight: 700; color: #1e3a5f; }
.card .label { font-size: 14px; color: #64748b; }

.panel { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 20px; }

table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background: #f8fafc; color: #475569; font-weight: 600; }
tr:hover td { background: #f8fafc; }

.btn { display: inline-block; background: #1e3a5f; color: #fff; border: none; padding: 9px 18px; border-radius: 6px; cursor: pointer; font-size: 14px; text-decoration: none; }
.btn:hover { background: #2c5282; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.green { background: #15803d; }
.btn.green:hover { background: #166534; }
.btn.red { background: #b91c1c; }
.btn.red:hover { background: #991b1b; }
.btn.gray { background: #64748b; }

form.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 4px; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=email], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; background: #fff;
}
input:focus, select:focus { outline: 2px solid #93c5fd; border-color: #3b82f6; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

.alert { background: #dcfce7; border: 1px solid #86efac; color: #166534; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.pub { background: #dcfce7; color: #166534; }
.badge.unpub { background: #fef3c7; color: #92400e; }
.badge.fail { background: #fee2e2; color: #991b1b; }

.login-wrap { max-width: 400px; margin: 60px auto; }
.marksheet { background: #fff; border: 2px solid #1e3a5f; border-radius: 10px; padding: 28px; margin-top: 16px; }
.marksheet .school-head { text-align: center; border-bottom: 2px solid #1e3a5f; padding-bottom: 12px; margin-bottom: 16px; }
.marksheet .school-head h2 { margin: 0; color: #1e3a5f; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin: 12px 0; font-size: 14px; }
.gpa-box { text-align: center; margin-top: 16px; padding: 14px; background: #f0fdf4; border-radius: 8px; }
.gpa-box .gpa { font-size: 34px; font-weight: 700; color: #15803d; }

@media print {
  .topbar, .footer, .no-print { display: none !important; }
  .container { margin: 0; max-width: none; }
  body { background: #fff; }
}

/* ---- Board Result Archive style (public result page) ---- */
.board-page { background: #f4f4f4; min-height: 100vh; }
.board-wrap { max-width: 900px; margin: 0 auto; padding: 18px 14px 0; min-height: 100vh; display: flex; flex-direction: column; }
.board-head { display: flex; border: 1px solid #d4d4d4; border-bottom: none; background: #fff; }
.board-logo { width: 110px; min-width: 110px; display: flex; align-items: center; justify-content: center; background: #f8f8f8; border-right: 1px solid #e5e5e5; }
.board-logo span { width: 74px; height: 74px; border-radius: 50%; background: #1c7a3d; color: #fff; font-size: 34px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 3px solid #d4af37; }
.board-logo.sm { width: 70px; min-width: 70px; }
.board-logo.sm span { width: 52px; height: 52px; font-size: 24px; }
.board-banner { flex: 1; }
.board-title { background: linear-gradient(180deg, #2e9e52 0%, #1c7a3d 60%, #166534 100%); color: #fff; font-size: 22px; font-weight: 700; padding: 16px 18px; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.board-strip { background: #bfe3c9; color: #166534; font-size: 12px; text-align: right; padding: 5px 14px; }
.board-form-box { background: #fff; border: 1px solid #d4d4d4; padding: 34px 20px; margin-top: 26px; }
.board-form-box table { margin: 0 auto; border: none; }
.board-form-box table td { border: none; padding: 7px 8px; font-size: 14px; font-weight: 600; color: #333; background: none; }
.board-form-box table tr:hover td { background: none; }
.board-form-box select, .board-form-box input[type=text] { width: 240px; }
.board-btns { white-space: nowrap; }
.btnReset { background: #d61f26; color: #fff; border: none; padding: 9px 26px; border-radius: 4px; font-size: 13px; font-weight: 700; cursor: pointer; letter-spacing: 1px; }
.btnReset:hover { background: #b31217; }
.btnSubmit { background: #4caf50; color: #fff; border: none; padding: 9px 26px; border-radius: 4px; font-size: 13px; font-weight: 700; cursor: pointer; letter-spacing: 1px; margin-left: 8px; }
.btnSubmit:hover { background: #3d8b40; }
.board-error { text-align: center; color: #b91c1c; font-weight: 600; margin-top: 14px; }
.board-sheet { background: #fff; border: 1px solid #d4d4d4; padding: 26px; margin-top: 26px; }
.board-sheet-head { display: flex; gap: 16px; align-items: center; border-bottom: 2px solid #1c7a3d; padding-bottom: 14px; margin-bottom: 14px; }
.board-sheet-head h2 { margin: 0 0 4px; color: #166534; }
.board-foot { margin-top: auto; display: flex; justify-content: space-between; background: #ececec; border-top: 3px solid #1c7a3d; color: #666; font-size: 12px; padding: 12px 16px; margin-top: 30px; }
@media (max-width: 640px) {
  .board-title { font-size: 16px; }
  .board-logo { width: 70px; min-width: 70px; }
  .board-logo span { width: 52px; height: 52px; font-size: 24px; }
  .board-form-box select, .board-form-box input[type=text] { width: 180px; }
}

/* ---- Professional academic transcript ---- */
.transcript { max-width: 760px; margin: 26px auto; background: #fff; border: 1px solid #d9d9d9; box-shadow: 0 2px 16px rgba(0,0,0,.08); padding: 34px 38px; }
.tr-head { display: flex; align-items: center; justify-content: center; gap: 14px; }
.tr-logo span { width: 56px; height: 56px; border-radius: 50%; background: #166534; color: #fff; font-size: 25px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 3px solid #d4af37; flex: none; }
.tr-head h2 { margin: 0; color: #14532d; font-size: 23px; }
.tr-addr { margin: 4px 0 0; color: #666; font-size: 12.5px; }
.tr-title { text-align: center; font-size: 15px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: #14532d; border-top: 3px double #166534; border-bottom: 3px double #166534; margin: 18px 0; padding: 9px 0; }
.tr-title span { letter-spacing: .3px; text-transform: none; font-weight: 600; color: #333; }
.tr-meta { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #d9d9d9; margin-bottom: 18px; }
.tr-meta div { padding: 8px 12px; border-bottom: 1px solid #eee; display: flex; gap: 8px; font-size: 13.5px; }
.tr-meta div:nth-child(odd) { border-right: 1px solid #eee; }
.tr-meta div:nth-last-child(-n+2) { border-bottom: none; }
.tr-meta span { color: #777; min-width: 96px; flex: none; }
.tr-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tr-table th { background: #166534; color: #fff; padding: 9px 10px; border: 1px solid #166534; font-size: 12.5px; letter-spacing: .4px; }
.tr-table td { border: 1px solid #d4d4d4; padding: 8px 10px; }
.tr-table .n { text-align: right; }
.tr-table .c { text-align: center; }
.tr-table .r { text-align: right; }
.tr-table tbody tr:nth-child(even) td { background: #f8faf8; }
.tr-table .tr-total td { background: #e9f2e9; }
.tr-result { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 4px; gap: 12px; flex-wrap: wrap; }
.tr-status { font-size: 15px; font-weight: 800; letter-spacing: 3px; text-transform: uppercase; padding: 10px 26px; border: 2px solid; border-radius: 4px; }
.tr-status.pass { color: #166534; border-color: #166534; background: #f0fdf4; }
.tr-status.fail { color: #b91c1c; border-color: #b91c1c; background: #fef2f2; }
.tr-gpa { text-align: right; }
.tr-gpa span { display: block; font-size: 11px; letter-spacing: 2px; color: #777; }
.tr-gpa b { font-size: 42px; color: #14532d; line-height: 1.1; }
.tr-note { text-align: center; color: #888; font-size: 11.5px; font-style: italic; margin: 16px 0 0; }
.tr-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
@media (max-width: 640px) {
  .transcript { padding: 22px 16px; margin: 16px 8px; }
  .tr-meta { grid-template-columns: 1fr; }
  .tr-meta div:nth-child(odd) { border-right: none; }
  .tr-meta div:nth-last-child(2) { border-bottom: 1px solid #eee; }
  .tr-gpa b { font-size: 32px; }
}
@media print {
  .board-head, .board-foot { display: none !important; }
  .board-page { background: #fff; }
  .board-wrap { max-width: none; padding: 0; display: block; min-height: auto; }
  .transcript { box-shadow: none; border: none; margin: 0; max-width: none; padding: 0; }
}

/* ---- SaaS: school switcher + owner badges ---- */
.switcher { display: inline-block; margin: 0 4px; }
.switcher select { padding: 5px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.15); color: #fff; font-size: 13px; max-width: 200px; }
.switcher select option { color: #111; }
.badge.fail { background: #fee2e2; color: #991b1b; }

/* ================= App shell with sidebar (v1.1) ================= */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 252px; flex: none; background: linear-gradient(180deg, #14532d 0%, #0d3b21 100%); color: #dcefe0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40; }
.side-brand { padding: 20px 20px 16px; font-size: 19px; font-weight: 800; color: #fff; border-bottom: 1px solid rgba(255,255,255,.12); }
.side-brand small { display: block; font-size: 11px; font-weight: 400; color: #a5d6a7; margin-top: 2px; }
.side-sec { padding: 16px 22px 6px; font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: #9ccc9f; font-weight: 700; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.side-nav a { color: #d7e8d8; text-decoration: none; padding: 10px 14px; border-radius: 8px; font-size: 14.5px; display: flex; gap: 11px; align-items: center; transition: background .15s; }
.side-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.side-nav a.on { background: rgba(255,255,255,.17); color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 #ffd54f; }
.side-nav a .ico { width: 22px; text-align: center; }
.side-foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; gap: 10px; }
.side-user { display: flex; align-items: center; gap: 10px; }
.side-user .av { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; flex: none; }
.side-user .nm { font-size: 13.5px; font-weight: 700; color: #fff; line-height: 1.25; }
.side-user .rl { font-size: 11.5px; color: #a5d6a7; }
.side-foot select { width: 100%; padding: 7px 9px; border-radius: 7px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; font-size: 13px; }
.side-foot select option { color: #111; }
.side-foot .btn { text-align: center; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 12px 24px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 30; }
.app-topbar h1 { font-size: 20px; margin: 0; flex: 1; }
.burger { display: none; background: #14532d; color: #fff; border: none; border-radius: 8px; width: 40px; height: 40px; font-size: 20px; cursor: pointer; flex: none; }
.app-body { padding: 24px; flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; }
.scrim { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -264px; top: 0; transition: left .25s ease; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  body.nav-open .sidebar { left: 0; }
  .burger { display: inline-flex; align-items: center; justify-content: center; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
  .app-body { padding: 16px; }
}
/* KPI cards */
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 16px 0 22px; }
.kpi { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.07); border-top: 4px solid #14532d; }
.kpi b { font-size: 30px; color: #14532d; display: block; line-height: 1.15; }
.kpi span { font-size: 13px; color: #64748b; }
.kpi.warn { border-top-color: #b45309; } .kpi.warn b { color: #b45309; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
/* Token display (TV) */
.tv { background: #0b1f14; color: #fff; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; font-family: 'Segoe UI', Arial, sans-serif; }
.tv .now { font-size: 26px; color: #9ccc9f; letter-spacing: 2px; }
.tv .token { font-size: 130px; font-weight: 800; color: #ffd54f; line-height: 1.1; margin: 10px 0; }
.tv .pname { font-size: 44px; font-weight: 700; }
.tv .wait { margin-top: 34px; font-size: 20px; color: #c8e6c9; }
.tv .wait b { color: #fff; font-size: 30px; }
.tv .clinic { position: absolute; top: 22px; font-size: 22px; font-weight: 700; color: #e8f5e9; }
/* Prescription print */
.rx { max-width: 760px; margin: 20px auto; background: #fff; padding: 36px 40px; box-shadow: 0 2px 14px rgba(0,0,0,.1); }
.rx-head { text-align: center; border-bottom: 3px double #14532d; padding-bottom: 14px; margin-bottom: 16px; }
.rx-head h2 { color: #14532d; margin: 0; font-size: 24px; }
.rx-head p { color: #555; font-size: 13px; margin: 3px 0; }
.rx-meta { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.rx-table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 10px 0 18px; }
.rx-table th { background: #f0fdf4; color: #14532d; border: 1px solid #bbd8c0; padding: 8px; text-align: left; }
.rx-table td { border: 1px solid #d8e6dc; padding: 8px; }
.rx-qr { display: flex; gap: 18px; align-items: center; margin-top: 18px; border-top: 1px dashed #ccc; padding-top: 14px; }
.rx-qr .code { font-size: 13px; color: #555; }
.rx-sign { display: flex; justify-content: space-between; margin-top: 44px; font-size: 14px; }
@media print {
  .sidebar, .app-topbar, .footer, .no-print, .scrim { display: none !important; }
  .app { display: block; } .main { display: block; }
  .app-body { padding: 0; max-width: none; }
  body { background: #fff; }
  .rx { box-shadow: none; margin: 0; max-width: none; padding: 0; }
}

/* ---- v1.1 module helpers ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 16px 0; }
.grid .card .ico { font-size: 30px; }
.grid .card h3 { font-size: 16px; margin: 8px 0 6px; }
.grid .card p { font-size: 13.5px; color: #64748b; }
.nowrap { white-space: nowrap; }
.ok { background: #dcfce7; border: 1px solid #86efac; color: #166534; padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; }

/* ---- v1.2 autocomplete + test chips ---- */
.ac-drop { display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 50; background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 260px; overflow-y: auto; margin-top: 2px; }
.ac-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: #f0fdf4; }
.ac-item b { display: block; color: #14532d; }
.ac-item span { font-size: 12px; color: #64748b; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #e0f2fe; color: #0c4a6e; border: 1px solid #7dd3fc; border-radius: 20px; padding: 5px 12px; font-size: 13.5px; font-weight: 600; }
.chip small { font-weight: 400; color: #0369a1; }
.chip b { color: #b91c1c; }
