:root {
    --ink: #17243d;
    --muted: #748198;
    --line: #e7ebf1;
    --surface: #ffffff;
    --canvas: #f5f7fa;
    --navy: #13233e;
    --brand: #1666df;
    --brand-dark: #0b4eb4;
    --green: #1e9c71;
    --amber: #e19a25;
    --red: #dc5a5a;
    --violet: #7256d9;
    font-family: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, a { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px 20px; color: #dce5f4; background: var(--navy); }
.brand { display: flex; gap: 12px; align-items: center; margin: 0 10px 35px; color: white; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; font: 800 22px "Manrope"; background: linear-gradient(145deg, #3b8cff, #1358bf); box-shadow: 0 8px 24px #06102280; }
.brand strong, .brand small { display: block; }
.brand strong { font: 700 19px "Manrope"; letter-spacing: -.4px; }
.brand small { margin-top: 2px; color: #91a1ba; font-size: 10px; text-transform: uppercase; letter-spacing: .7px; }
.nav { display: grid; gap: 5px; }
.nav-link { min-height: 44px; padding: 0 12px; display: flex; gap: 13px; align-items: center; border-radius: 9px; color: #aebbd0; text-decoration: none; font-size: 14px; font-weight: 600; }
.nav-link span { width: 18px; text-align: center; color: #8293af; font-size: 18px; }
.nav-link em { margin-left: auto; padding: 2px 7px; border-radius: 10px; color: #dbe9ff; background: #ffffff15; font-size: 10px; font-style: normal; }
.nav-link em.alert { color: #ffd9d9; background: #df5c5c35; }
.nav-link:hover, .nav-link.active { color: white; background: #ffffff12; }
.nav-link.active span { color: #66a4ff; }
.sidebar-footer { margin-top: auto; }
.clinic-chip { display: flex; align-items: center; gap: 10px; padding: 13px 10px; margin-bottom: 10px; border-block: 1px solid #ffffff12; }
.clinic-chip .avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: #9fc3fa; background: #3973c52e; font-weight: 700; font-size: 11px; }
.clinic-chip strong, .clinic-chip small { display: block; }
.clinic-chip strong { color: #e7edf6; font-size: 11px; }
.clinic-chip small { margin-top: 3px; color: #8190a9; font-size: 10px; }
.main { min-width: 0; }
.topbar { height: 76px; padding: 0 34px; display: flex; align-items: center; border-bottom: 1px solid var(--line); background: #ffffffd9; backdrop-filter: blur(12px); }
.topbar-copy { display: grid; gap: 3px; }
.topbar-copy small { color: var(--muted); font-size: 11px; }
.topbar-copy strong { font: 700 14px "Manrope"; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #a6b0c0; background: transparent; }
.doctor-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: #285eaa; font-weight: 700; font-size: 12px; }
.logout-avatar { border: 0; }
.menu-button { display: none; border: 0; background: transparent; font-size: 22px; }
.content { max-width: 1450px; margin: auto; padding: 34px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 5px !important; color: var(--brand) !important; font-size: 10px !important; font-weight: 700; letter-spacing: 1.1px; }
.page-heading h1 { margin: 0; font: 700 28px "Manrope"; letter-spacing: -.8px; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; gap: 10px; }
.doctor-filter { height: 39px; max-width: 280px; padding: 0 32px 0 12px; border: 1px solid #dfe4eb; border-radius: 8px; color: #536075; background: white; font: 600 11px "DM Sans"; }
.data-alert { margin: -8px 0 18px; padding: 11px 14px; border: 1px solid #f0d7ad; border-radius: 9px; color: #8a641d; background: #fffaf0; font-size: 11px; }
.button { min-height: 39px; padding: 0 17px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.button.primary { border: 1px solid var(--brand); color: white; background: var(--brand); box-shadow: 0 5px 14px #1666df25; }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { border: 1px solid #dfe4eb; color: #536075; background: white; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 17px; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 2px 8px #18233a08; }
.metric-card { position: relative; padding: 19px 20px; overflow: hidden; }
.metric-card p { margin: 0 0 10px; color: var(--muted); font-size: 11px; font-weight: 600; }
.metric-card strong { display: block; font: 700 25px "Manrope"; }
.metric-card small { display: block; margin-top: 8px; color: #8591a3; font-size: 10px; }
.metric-icon { position: absolute; right: 18px; top: 18px; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 6px currentColor; opacity: .13; }
.metric-icon.blue { color: var(--brand); }.metric-icon.amber { color: var(--amber); }.metric-icon.green { color: var(--green); }.metric-icon.violet { color: var(--violet); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 17px; }
.panel { padding: 21px; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 14px; margin-bottom: 19px; }
.panel-heading h2 { margin: 0; font: 700 15px "Manrope"; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.panel-heading a { color: var(--brand); text-decoration: none; font-size: 10px; font-weight: 700; }
.current-patient { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 15px; border: 1px solid #d8e6fb; border-radius: 10px; background: #f5f9ff; }
.current-patient > div { display: flex; align-items: center; gap: 14px; }
.current-patient span span, .current-patient small, .current-patient strong, .current-patient em { display: block; }
.token-large { width: 47px; height: 47px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--brand); font: 700 19px "Manrope"; }
.current-patient small { color: var(--brand); font-size: 8px; font-weight: 700; letter-spacing: .8px; }
.current-patient strong { margin: 3px 0; font-size: 13px; }
.current-patient em { color: var(--muted); font-size: 9px; font-style: normal; }
.queue-list { margin-top: 9px; }
.empty-state { padding: 32px 12px; color: var(--muted); text-align: center; font-size: 11px; }
.queue-row { min-height: 59px; display: grid; grid-template-columns: 36px 1fr auto 28px; align-items: center; gap: 11px; border-bottom: 1px solid #edf0f4; }
.queue-row:last-child { border: 0; }
.token { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: #66758b; background: #f1f3f7; font-size: 11px; font-weight: 700; }
.patient strong, .patient small { display: block; }
.patient strong { font-size: 11px; }.patient small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.status { padding: 4px 8px; border-radius: 10px; font-size: 9px; font-weight: 700; }
.status.ready { color: #157858; background: #e8f7f1; }.status.waiting { color: #98701d; background: #fff6df; }
.more { border: 0; color: #9ba5b4; background: transparent; }
.stack { display: grid; align-content: start; gap: 17px; }
.count-alert { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; color: #bd4040; background: #fff0f0; font-size: 11px; font-weight: 700; }
.recovery-item { padding: 11px 0; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); color: #68758a; font-size: 10px; }
.recovery-item strong { color: var(--ink); }
.recovery-button { width: 100%; margin-top: 15px; border: 1px solid #f0d0d0; color: #b94848; background: #fff8f8; }
.collection-total strong, .collection-total small { display: block; }
.collection-total strong { font: 700 25px "Manrope"; }.collection-total small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.bar { height: 7px; margin: 18px 0 14px; overflow: hidden; border-radius: 5px; background: #e9edf3; }
.bar span { display: block; width: 63%; height: 100%; background: var(--brand); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.legend span { color: var(--muted); font-size: 9px; }.legend strong { display: block; margin: 4px 0 0 11px; color: var(--ink); font-size: 11px; }
.legend i { width: 6px; height: 6px; display: inline-block; margin-right: 5px; border-radius: 50%; }.legend i.online { background: var(--brand); }.legend i.cash { background: #c8d0dc; }
.login-body { min-height: 100vh; background: #f4f7fb; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(330px, .9fr) minmax(480px, 1.1fr); }
.login-story { min-height: 100vh; padding: 54px clamp(35px, 6vw, 90px); display: flex; flex-direction: column; justify-content: space-between; color: white; background: radial-gradient(circle at 20% 15%, #245692 0, transparent 34%), linear-gradient(145deg, #142844, #0d1b31 70%); }
.login-brand { margin: 0; }
.login-story h1 { max-width: 520px; margin: 15px 0; font: 800 clamp(36px, 5vw, 62px)/1.08 "Manrope"; letter-spacing: -2px; }
.login-story p:not(.eyebrow) { max-width: 480px; color: #b9c7da; line-height: 1.7; }
.login-story > small { color: #7f91ab; }
.login-panel { padding: 35px; display: grid; place-items: center; }
.login-card { width: min(100%, 440px); padding: 42px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 25px 70px #22375a15; }
.login-heading h2 { margin: 8px 0; font: 700 27px "Manrope"; }
.login-heading > p:last-child { margin: 0 0 30px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field span { font-size: 11px; font-weight: 700; }
.field input { width: 100%; height: 45px; padding: 0 13px; border: 1px solid #dce2ea; border-radius: 9px; outline: none; color: var(--ink); background: #fbfcfe; font: inherit; }
.field input:focus { border-color: #6ca3ef; box-shadow: 0 0 0 3px #1666df16; background: white; }
.form-error { margin-bottom: 18px; padding: 11px 13px; border: 1px solid #f0cccc; border-radius: 8px; color: #a63e3e; background: #fff7f7; font-size: 11px; }
.login-button { width: 100%; height: 45px; margin-top: 5px; }
.login-help { margin: 20px 0 0; color: #929cac; text-align: center; font-size: 10px; }
.admin-grid { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(400px, 1.25fr); gap: 17px; align-items: start; }
.field select { width: 100%; height: 45px; padding: 0 13px; border: 1px solid #dce2ea; border-radius: 9px; color: var(--ink); background: #fbfcfe; font: inherit; }
.credential-notice { margin-bottom: 18px; padding: 17px 19px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border: 1px solid #bfe3d5; border-radius: 11px; background: #f1fbf7; }
.credential-notice strong { font-size: 12px; }.credential-notice p { margin: 4px 0 0; color: #648175; font-size: 10px; }
.credential-notice code { padding: 10px 13px; border-radius: 7px; color: #176149; background: #dff4eb; font-size: 12px; }
.admin-error { margin-bottom: 18px; }
.account-row { min-height: 61px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.account-row:last-child { border: 0; }
.account-row strong, .account-row small { display: block; }
.account-row strong { font-size: 11px; }.account-row small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.account-row em { padding: 4px 8px; border-radius: 10px; color: #177052; background: #e9f7f1; font-size: 9px; font-style: normal; font-weight: 700; }

@media (max-width: 1050px) {
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .stack { grid-template-columns: repeat(2, 1fr); }
    .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: fixed; z-index: 20; left: -270px; width: 250px; transition: left .2s ease; box-shadow: 15px 0 40px #0b142b40; }
    .sidebar.open { left: 0; }
    .menu-button { display: block; margin-right: 12px; }
    .topbar { height: 66px; padding: 0 16px; }
    .content { padding: 23px 16px; }
    .page-heading { align-items: start; flex-direction: column; }
    .heading-actions { width: 100%; }.heading-actions .button { flex: 1; }
    .current-patient { align-items: stretch; flex-direction: column; }
    .login-layout { display: block; }
    .login-story { min-height: auto; padding: 25px 22px; }
    .login-story > div, .login-story > small { display: none; }
    .login-panel { min-height: calc(100vh - 90px); padding: 22px; }
    .login-card { padding: 28px 23px; }
}
@media (max-width: 520px) {
    .metrics, .stack { grid-template-columns: 1fr; }
    .page-heading h1 { font-size: 23px; }
    .topbar-copy small { display: none; }
    .queue-row { grid-template-columns: 36px 1fr auto; }
    .queue-row .status { display: none; }
}
