/* OPDesk — design system (from the Microcript STYLE_GUIDE: sky→blue, Inter, Remix Icon).
   Mobile-first, super responsive, app-like. One stylesheet, no build step. */

:root {
    /* Brand palette (sky → blue) */
    --sky: #0ea5e9; --blue: #0369a1; --blue-dark: #075985; --sky-soft: #e0f2fe;
    --teal: #0d9488; --teal-soft: #ccfbf1;
    --green: #059669; --green-soft: #d1fae5;
    --amber: #d97706; --amber-soft: #fef3c7;
    --red: #dc2626; --red-soft: #fee2e2;
    --gray-badge: #64748b; --gray-soft: #f1f5f9;

    --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --muted-2: #94a3b8;
    --line: #e2e8f0; --line-2: #cbd5e1; --bg: #f8fafc; --bg-2: #f1f5f9;

    --radius: 14px; --radius-lg: 18px; --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
    --shadow:    0 4px 12px -4px rgba(15,23,42,.12);
    --shadow-lg: 0 12px 32px -16px rgba(15,23,42,.18);
    --brand-logo: url('/assets/img/logo.svg');
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg); color: var(--ink); min-height: 100dvh; line-height: 1.5; overflow-x: hidden;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }
img, svg { max-width: 100%; height: auto; display: block; }
i[class^="ri-"], i[class*=" ri-"] { font-style: normal; line-height: 1; display: inline-flex; vertical-align: middle; }
h1,h2,h3 { letter-spacing: -.02em; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-weight: 800; font-size: 13px; color: var(--sky); }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px;
    border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 600; border: 1px solid transparent;
    cursor: pointer; transition: filter .15s, transform .05s, background .15s; font-family: inherit; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--sky), var(--blue)); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink-2); border-color: var(--line-2); }
.btn-secondary:hover { background: var(--bg-2); color: var(--ink); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-warn { background: var(--amber); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-light { background: #fff; color: var(--blue); }
.btn.sm { padding: 8px 13px; font-size: 13px; }
.btn.lg { padding: 14px 24px; font-size: 16px; }
.btn-full { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
    display: grid; place-items: center; font-size: 20px; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--bg-2); }

/* ---- Cards ---- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.card.lg { padding: 26px; border-radius: var(--radius-lg); }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }

/* ---- Badges & Pills ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; }
.badge.gray { background: var(--gray-soft); color: var(--gray-badge); }
.badge.blue { background: var(--sky-soft); color: var(--blue); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
/* triage / status helpers */
.badge.pri-normal { background: var(--sky-soft); color: var(--blue); }
.badge.pri-urgent { background: var(--amber-soft); color: var(--amber); }
.badge.pri-emergency { background: var(--red-soft); color: var(--red); }
.badge.st-waiting { background: var(--gray-soft); color: var(--gray-badge); }
.badge.st-called { background: var(--amber-soft); color: var(--amber); }
.badge.st-in_consult { background: var(--sky-soft); color: var(--blue); }
.badge.st-done { background: var(--green-soft); color: var(--green); }
.badge.st-no_show { background: var(--red-soft); color: var(--red); }

/* ---- Forms ---- */
.form-group { margin-bottom: 15px; }
.form-group label, .lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input, select, textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
    font-size: 15px; font-family: inherit; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-soft); }
textarea { resize: vertical; min-height: 84px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 520px) { .field-row, .field-row.three { grid-template-columns: 1fr; } }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ---- Messages, spinner, skeleton ---- */
.msg { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.msg.err { background: var(--red-soft); color: #b91c1c; }
.msg.ok { background: var(--green-soft); color: #047857; }
.msg.info { background: var(--sky-soft); color: var(--blue); }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.15); border-top-color: var(--blue); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
.spinner.white { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, #e9eef5 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 36px 18px; color: var(--muted); }
.empty i { font-size: 40px; color: var(--line-2); display: block; margin-bottom: 10px; }

/* ---- Stats ---- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat .meta { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.stat.accent { background: linear-gradient(135deg, var(--sky), var(--blue)); color: #fff; border: none; }
.stat.accent .label, .stat.accent .meta { color: rgba(255,255,255,.85); }

/* ---- Tables & lists ---- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }

/* ---- Layout utils ---- */
.mt-1{margin-top:6px}.mt-2{margin-top:10px}.mt-3{margin-top:16px}.mt-4{margin-top:24px}
.mb-2{margin-bottom:10px}.mb-3{margin-bottom:16px}.mb-4{margin-bottom:24px}
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.right { text-align: right; }
.split { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } }
.split.wide-left { grid-template-columns: 1fr; }
@media (min-width: 980px) { .split.wide-left { grid-template-columns: 1.6fr 1fr; } }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--sky-soft); color: var(--blue); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 22px 0 10px; }

/* ---- Admin / staff shell ---- */
.admin-layout { min-height: 100dvh; }
.admin-sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 260px; background: #fff; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 18px 14px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
.admin-sidebar.open { transform: translateX(0); }
.admin-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 16px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.admin-brand .logo { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, var(--sky), var(--blue)); color: #fff; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.admin-brand h1 { font-size: 15px; font-weight: 800; line-height: 1.2; }
.admin-brand p { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.admin-nav { list-style: none; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.admin-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 10px; color: var(--ink-2); font-size: 14.5px; font-weight: 600; }
.admin-nav a i { font-size: 20px; }
.admin-nav a:hover { background: var(--bg-2); color: var(--ink); }
.admin-nav a.active { background: var(--sky-soft); color: var(--blue); }
.admin-user-card { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.admin-user-card .name { font-size: 14px; font-weight: 700; }
.admin-user-card .role { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.admin-sidebar-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 55; display: none; }
.admin-sidebar-backdrop.show { display: block; }
.admin-main { padding: 0; min-height: 100dvh; }
.admin-mobile-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.admin-mobile-bar .logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--sky), var(--blue)); color: #fff; display: grid; place-items: center; font-size: 18px; }
.admin-header { padding: 20px 16px 8px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-header h1 { font-size: 22px; font-weight: 800; }
.admin-header p { font-size: 14px; color: var(--muted); }
.admin-content { padding: 16px; }
.demo-banner { background: linear-gradient(135deg, var(--sky), var(--blue)); color: #fff; text-align: center; font-size: 12.5px; font-weight: 600; padding: 7px 12px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr);
    background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 9px 4px 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabbar a i { font-size: 22px; }
.tabbar a.active { color: var(--blue); }

@media (min-width: 1024px) {
    body.has-sidebar { background: var(--bg-2); }
    .admin-sidebar { transform: none; }
    .admin-main { margin-left: 260px; }
    .admin-mobile-bar { display: none; }
    .admin-header { padding: 26px 32px 10px; }
    .admin-content { padding: 12px 32px 48px; }
    .admin-sidebar-backdrop { display: none !important; }
    .tabbar { display: none; }
}
@media (max-width: 1023px) { .admin-main { padding-bottom: calc(68px + env(safe-area-inset-bottom)); } }

/* ---- Public landing (ld-*) ---- */
.ld-wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.ld-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.ld-header .ld-wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.ld-brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 17px; color: var(--ink); }
.ld-brand .logo { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--sky), var(--blue)); color: #fff; display: grid; place-items: center; font-size: 22px; }
.ld-brand small { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.ld-nav-links { display: none; gap: 24px; margin-right: 10px; }
.ld-nav-links a { color: var(--ink-2); font-weight: 600; font-size: 14.5px; }
.ld-nav-links a:hover { color: var(--blue); }
@media (min-width: 860px) { .ld-nav-links { display: flex; } }
@media (max-width: 600px) { .ld-header .ld-wrap { height: 58px; padding: 0 14px; } .ld-brand small { display: none; } .ld-brand { font-size: 15px; } }
.ld-hero { background: linear-gradient(160deg, #f0f9ff 0%, #e0f2fe 55%, #ecfeff 100%); border-bottom: 1px solid var(--line); }
.ld-hero .ld-wrap { display: grid; grid-template-columns: 1fr; gap: 34px; padding: 48px 20px 52px; align-items: center; }
@media (min-width: 920px) { .ld-hero .ld-wrap { grid-template-columns: 1.05fr .95fr; padding: 72px 20px 80px; } }
.ld-pill { display: inline-flex; align-items: center; gap: 7px; background: #fff; border: 1px solid var(--sky-soft); color: var(--blue); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; box-shadow: var(--shadow-sm); }
.ld-hero h1 { font-size: 38px; line-height: 1.08; font-weight: 800; letter-spacing: -.025em; margin: 16px 0 14px; }
@media (min-width: 920px) { .ld-hero h1 { font-size: 52px; } }
.ld-hero h1 .accent { background: linear-gradient(120deg, var(--sky), var(--teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ld-hero p.lead { font-size: 17px; line-height: 1.6; color: var(--ink-2); max-width: 540px; margin-bottom: 26px; }
.ld-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.ld-trust { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 28px; }
.ld-trust .item { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.ld-trust .item i { color: var(--green); font-size: 19px; }
.ld-hero-card { background: #fff; border-radius: 22px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 18px; max-width: 380px; margin: 0 auto; }
.float { animation: f 6s ease-in-out infinite; } @keyframes f { 50% { transform: translateY(-10px); } }
.ld-section { padding: 60px 0; }
.ld-section.alt { background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ld-head { text-align: center; max-width: 620px; margin: 0 auto 40px; }
.ld-head h2 { font-size: 29px; font-weight: 800; margin: 10px 0 12px; }
.ld-head p { font-size: 16px; color: var(--muted); line-height: 1.6; }
.ld-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .ld-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .ld-grid.cols-3 { grid-template-columns: repeat(3,1fr); } .ld-grid.cols-4 { grid-template-columns: repeat(4,1fr); } }
.ld-feature { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px 20px; transition: transform .15s, box-shadow .15s; }
.ld-feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ld-feature .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; margin-bottom: 14px; background: var(--sky-soft); color: var(--blue); }
.ld-feature.teal .ic { background: var(--teal-soft); color: var(--teal); }
.ld-feature.green .ic { background: var(--green-soft); color: var(--green); }
.ld-feature.amber .ic { background: var(--amber-soft); color: var(--amber); }
.ld-feature.red .ic { background: var(--red-soft); color: var(--red); }
.ld-feature h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.ld-feature p { font-size: 14px; color: var(--muted); line-height: 1.6; }
.ld-step { text-align: center; }
.ld-step .n { width: 46px; height: 46px; border-radius: 14px; margin: 0 auto 12px; display: grid; place-items: center; font-weight: 800; font-size: 18px; background: linear-gradient(135deg, var(--sky), var(--blue)); color: #fff; }
.ld-banner { background: linear-gradient(135deg, var(--sky), var(--blue)); border-radius: 24px; padding: 46px 28px; text-align: center; color: #fff; box-shadow: 0 24px 56px -24px rgba(3,105,161,.6); }
.ld-banner h2 { font-size: 29px; font-weight: 800; margin-bottom: 10px; }
.ld-banner p { font-size: 16px; opacity: .92; margin-bottom: 22px; }
.ld-footer { background: var(--ink); color: #cbd5e1; padding: 46px 0 26px; }
.ld-footer .ld-wrap { display: grid; grid-template-columns: 1fr; gap: 28px; }
@media (min-width: 760px) { .ld-footer .ld-wrap { grid-template-columns: 1.4fr 1fr 1fr; } }
.ld-footer .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 17px; margin-bottom: 12px; }
.ld-footer .brand .logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--sky), var(--blue)); display: grid; place-items: center; font-size: 20px; color: #fff; }
.ld-footer p { font-size: 13.5px; line-height: 1.7; color: #94a3b8; }
.ld-footer h5 { color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 12px; }
.ld-footer a { color: #cbd5e1; font-size: 14px; display: flex; align-items: center; gap: 9px; padding: 5px 0; }
.ld-footer a:hover { color: #fff; }
.ld-footer-bottom { border-top: 1px solid #1e293b; margin-top: 28px; padding-top: 18px; text-align: center; font-size: 13px; color: #64748b; }

/* ---- Narrow page (login / install / status) ---- */
.page-narrow { max-width: 560px; margin: 0 auto; padding: 22px 16px 48px; }
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #f0f9ff, #e0f2fe 60%, #ecfeff); }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand .logo { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 12px; background: linear-gradient(135deg, var(--sky), var(--blue)); color: #fff; display: grid; place-items: center; font-size: 28px; }
.auth-brand h1 { font-size: 22px; font-weight: 800; }
.auth-brand p { color: var(--muted); font-size: 13.5px; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-btn { width: 100%; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); border-radius: var(--radius-sm); padding: 11px; font-weight: 600; font-size: 13.5px; cursor: pointer; display: flex; align-items: center; gap: 8px; justify-content: center; transition: .15s; }
.role-btn:hover { border-color: var(--sky); background: var(--sky-soft); color: var(--blue); }

/* Wizard step rail */
.steps { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 4px; }
.steps .s { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted-2); font-weight: 600; }
.steps .s .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #fff; border: 1px solid var(--line-2); color: var(--muted); }
.steps .s.done .dot { background: var(--green); color: #fff; border-color: var(--green); }
.steps .s.cur .dot { background: linear-gradient(135deg, var(--sky), var(--blue)); color: #fff; border-color: transparent; }
.steps .s.cur { color: var(--blue); }
.check-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.check-row:last-child { border-bottom: 0; }
.check-row .ok { color: var(--green); font-weight: 700; }
.check-row .bad { color: var(--red); font-weight: 700; }

/* ---- Bottom sheet / modal ---- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 200; display: none; align-items: flex-end; justify-content: center; }
.sheet-backdrop.show { display: flex; }
.sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 20px; max-height: 92dvh; overflow-y: auto; box-shadow: 0 -10px 40px -10px rgba(0,0,0,.3); animation: sheetUp .22s; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 14px; }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; } }

/* ---- Brand logo chip (renders --brand-logo, hides fallback glyph) ---- */
.admin-brand .logo, .admin-mobile-bar .logo, .ld-brand .logo, .ld-footer .brand .logo, .auth-brand .logo {
    background: #fff var(--brand-logo) center / 70% no-repeat; border: 1px solid var(--line); }
.admin-brand .logo i, .admin-mobile-bar .logo i, .ld-brand .logo i, .ld-footer .brand .logo i, .auth-brand .logo i { display: none; }

/* ---- Typeahead (ICD-10 / medicine) ---- */
.ta { position: relative; }
.ta-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 80; max-height: 280px; overflow-y: auto; display: none; }
.ta-menu.show { display: block; }
.ta-item { padding: 10px 13px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--bg-2); }
.ta-item:hover, .ta-item.active { background: var(--sky-soft); }
.ta-item .code { font-weight: 700; color: var(--blue); font-family: ui-monospace, monospace; margin-right: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--sky-soft); color: var(--blue); border-radius: 999px; padding: 5px 10px; font-size: 13px; font-weight: 600; }
.chip button { background: none; border: none; color: var(--blue); cursor: pointer; font-size: 15px; padding: 0; width: auto; line-height: 1; }

/* ---- Rx builder rows ---- */
.rx-row { display: grid; grid-template-columns: 1.6fr .8fr .8fr .8fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.rx-row input, .rx-row select { padding: 9px 10px; font-size: 13.5px; }
@media (max-width: 760px) { .rx-row { grid-template-columns: 1fr 1fr; } .rx-row .rx-del { grid-column: span 2; } }

/* ---- Public queue board ---- */
body.board { background: #0b1220; color: #fff; }
.board-wrap { max-width: 1280px; margin: 0 auto; padding: 24px 20px 40px; }
.board-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.board-top .brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 22px; }
.board-top .brand .logo { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--sky), var(--blue)); display: grid; place-items: center; }
.board-clock { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.board-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .board-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .board-grid { grid-template-columns: repeat(3, 1fr); } }
.board-card { background: #131c2e; border: 1px solid #1e293b; border-radius: var(--radius-lg); padding: 20px; }
.board-card .dept { font-size: 14px; font-weight: 700; color: #93c5fd; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; justify-content: space-between; }
.board-card .now-label { font-size: 12px; color: #64748b; margin-top: 14px; }
.board-card .now { font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -.03em; margin-top: 2px; }
.board-card .now.idle { color: #475569; font-size: 30px; padding: 14px 0; }
.board-card .next { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.board-card .next span { background: #1e293b; color: #cbd5e1; border-radius: 8px; padding: 5px 12px; font-weight: 700; font-size: 16px; }
.board-card .waiting { font-size: 12px; color: #64748b; margin-top: 12px; }
.board-card.emergency { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }

/* ---- Print (prescription / discharge / referral letterhead) ---- */
.print-page { max-width: 820px; margin: 0 auto; background: #fff; padding: 28px; }
.lh { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 3px solid var(--blue); padding-bottom: 14px; }
.lh .h-name { font-size: 24px; font-weight: 800; color: var(--blue); }
.lh .h-meta { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.lh .h-right { text-align: right; font-size: 12.5px; color: var(--ink-2); }
.pt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin: 16px 0; font-size: 13.5px; }
.pt-grid b { color: var(--ink); }
.rx-symbol { font-size: 34px; font-weight: 800; color: var(--blue); font-family: Georgia, serif; }
.print-actions { max-width: 820px; margin: 16px auto; display: flex; gap: 10px; justify-content: flex-end; }
.doc-sign { margin-top: 60px; text-align: right; font-size: 13px; }
.doc-sign .line { border-top: 1px solid var(--ink); width: 220px; margin-left: auto; padding-top: 6px; }
@media print {
    body { background: #fff; }
    .no-print, .tabbar, .admin-sidebar, .admin-mobile-bar, .print-actions { display: none !important; }
    .print-page { padding: 0; max-width: 100%; }
    @page { margin: 14mm; }
}

/* misc */
.kpi-charts { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .kpi-charts { grid-template-columns: 1fr 1fr; } }
/* Fixed-height box so Chart.js (maintainAspectRatio:false) can't enter a resize loop. */
.chart-box { position: relative; height: 260px; width: 100%; }
.chart-box canvas { position: absolute; inset: 0; }
.divide > * + * { border-top: 1px solid var(--line); }
