/* ======================================================================
   Goclinicbox — design system tokens + base styles
   Fonts loaded via Google Fonts in the layout head.
   ====================================================================== */

:root {
    --color-primary:        #0D6E6E;
    --color-primary-dark:    #0A5D5D;
    --color-primary-light:  #E6F4F4;
    --color-accent:         #F59E0B;
    --color-success:        #10B981;
    --color-danger:         #E5564B;
    --color-warning:        #F59E0B;
    --color-bg:             #F2F5F8;
    --color-surface:        #FFFFFF;
    --color-border:         #E8EDF2;
    --color-border-soft:     #EEF2F5;
    --color-line:            #E7ECF1;
    --color-text:           #15212B;
    --color-heading:         #142028;
    --color-muted:          #8B99A6;
    --color-muted-soft:      #A7B4C0;

    --radius-card:  13px;
    --radius-btn:   9px;
    --radius-input: 9px;

    --shadow-sm: 0 1px 2px rgba(16,24,40,0.04);
    --shadow-md: 0 4px 10px rgba(13,110,110,0.22);

    --font-head: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;

    --transition: 160ms ease;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

[dir="rtl"] { text-align: right; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D5DEE6; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #BCC9D4; background-clip: padding-box; }

h1, h2, h3, h4 {
    font-family: var(--font-head);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.3px;
    color: var(--color-heading);
    margin: 0 0 .5em;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-accent); }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}
.brand { font-family: var(--font-head); font-weight: 800; font-size: 22px; color: var(--color-primary); }
.brand span { color: var(--color-accent); }
.topnav { display: flex; gap: 16px; align-items: center; }
.topnav > a.muted { font-weight: 500; font-size: 14px; }
.lang-switch { font-size: 12px; display: inline-flex; gap: 4px; }
.lang-switch a { color: var(--color-muted); }

.hero {
    padding: 96px 0 64px;
    text-align: center;
    background:
        radial-gradient(1100px 380px at 50% -120px, rgba(13,110,110,0.08), transparent 70%),
        var(--color-bg);
}
.hero h1 { font-size: clamp(34px, 5vw, 56px); letter-spacing: -1px; }
.hero p { font-size: 18px; color: #56697A; max-width: 640px; margin: 0 auto 28px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; }
.hero-cta .btn { padding: 13px 26px; font-size: 15px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; margin-top: 30px; color: #6B7A88; font-size: 13px; font-weight: 500; }

.badge {
    display: inline-block; padding: 5px 13px; border-radius: 999px;
    background: var(--color-primary-light); color: var(--color-primary-dark);
    font-size: 12.5px; font-weight: 600; margin-bottom: 22px; letter-spacing: .2px;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 18px;
    border-radius: var(--radius-btn); border: 1px solid transparent; cursor: pointer;
    font-family: var(--font-body); font-weight: 600; font-size: 13.5px;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.btn-primary { background: var(--color-primary); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; }
.btn-ghost { background: #fff; color: #56697A; border: 1px solid #E0E6EB; }
.btn-ghost:hover { background: #F4F7F9; color: var(--color-primary); border-color: var(--color-line); }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}
.card h3 { font-size: 15px; font-weight: 700; }
.card p { color: var(--color-muted); margin: 0; font-size: 13.5px; }

.status {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 14px;
}
.status-ok   { background: #ECFDF5; color: var(--color-success); }
.status-bad  { background: #FEF2F2; color: var(--color-danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.muted { color: var(--color-muted); }
.mono  { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13px; }

footer {
    margin-top: 64px; padding: 32px 0;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted); font-size: 14px; text-align: center;
}

/* ---------- Setup wizard --------------------------------------------- */
.setup-body {
    background: linear-gradient(160deg, var(--color-primary-light), var(--color-bg) 60%);
    min-height: 100vh;
}
.setup-shell { max-width: 560px; margin: 0 auto; padding: 48px 20px; }
.setup-head { text-align: center; margin-bottom: 24px; }
.setup-head .brand { font-size: 28px; }
.setup-head .muted { margin: 4px 0 0; }

.steps {
    list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 20px;
}
.steps li {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
    font-size: 12px; color: var(--color-muted); font-weight: 600;
}
.steps-num {
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--color-surface); border: 1px solid var(--color-border);
    font-weight: 700;
}
.steps li.is-active .steps-num { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.steps li.is-active .steps-label { color: var(--color-primary); }
.steps li.is-done .steps-num { background: var(--color-success); color: #fff; border-color: var(--color-success); }

.setup-card { padding: 32px; }
.setup-card h2 { font-size: 22px; }
.setup-foot { text-align: center; margin-top: 20px; font-size: 13px; }

.req-list { list-style: none; padding: 0; margin: 18px 0 0; }
.req-list li {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--color-border);
}
.req-list li:last-child { border-bottom: none; }
.req-icon {
    width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
    font-size: 13px; font-weight: 700; color: #fff; flex: none;
}
.req-list li.ok  .req-icon { background: var(--color-success); }
.req-list li.bad .req-icon { background: var(--color-danger); }
.req-label { flex: 1; font-weight: 500; }
.req-detail { color: var(--color-muted); }

.form { margin-top: 18px; }
.form-row { display: flex; gap: 14px; }
.form-row .field { flex: 1; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: #56697A; margin-bottom: 6px; }
.field label .req, .req-star { color: var(--color-danger); }
.field input, .field select, .field textarea { width: 100%; }

/* ===================================================================
   FORM CONTROLS — single source of truth (matches Goclinicbox.dc.html).
   Every text input and <select> is the SAME size everywhere: in forms,
   modals, tables and filter bars. Do not add per-context size overrides.
   =================================================================== */
.fc-base,
input[type="text"], input[type="search"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="url"], input[type="date"],
input[type="time"], input[type="month"], input[type="datetime-local"], input:not([type]),
select, textarea {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-text);
    background: #fff;
    border: 1px solid #E0E6EB;
    border-radius: var(--radius-input);
    box-sizing: border-box;
    outline: none;
    transition: border var(--transition), box-shadow var(--transition);
}
/* Single-line controls: identical 38px height across the whole app. */
input[type="text"], input[type="search"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="url"], input[type="date"],
input[type="time"], input[type="month"], input[type="datetime-local"], input:not([type]),
select {
    height: 38px;
    padding: 0 12px;
    line-height: normal;
}
textarea { padding: 9px 12px; line-height: 1.5; }
::placeholder { color: #A7B4C0; }

input[type="text"]:focus, input[type="search"]:focus, input[type="email"]:focus,
input[type="password"]:focus, input[type="number"]:focus, input[type="tel"]:focus,
input[type="url"]:focus, input[type="date"]:focus, input[type="time"]:focus,
input[type="month"]:focus, input[type="datetime-local"]:focus, input:not([type]):focus,
select:focus, textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Custom dropdown chevron — same on every <select>. */
select {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M7 10l5 5 5-5' stroke='%239AA8B4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}
.field .hint { display: block; margin-top: 5px; font-size: 11.5px; color: #9AA8B4; }

.setup-actions {
    display: flex; justify-content: space-between; gap: 12px;
    margin-top: 24px;
}
.setup-actions .btn-primary { margin-left: auto; }

.alert { padding: 12px 16px; border-radius: var(--radius-input); margin: 16px 0; font-size: 14px; }
.alert-bad { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-ok  { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }

.setup-success { text-align: center; margin-bottom: 16px; }
.success-mark {
    width: 56px; height: 56px; margin: 0 auto 12px;
    border-radius: 50%; background: var(--color-success); color: #fff;
    font-size: 28px; display: grid; place-items: center;
}
.summary { border: 1px solid var(--color-border); border-radius: var(--radius-input); overflow: hidden; }
.summary-row {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--color-border);
}
.summary-row:last-child { border-bottom: none; }
.summary-row span:first-child { color: var(--color-muted); font-weight: 600; font-size: 13px; }

/* ---------- Auth ----------------------------------------------------- */
.auth-shell { max-width: 400px; margin: 0 auto; padding: 64px 20px; }
.auth-card { padding: 32px; }
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand .brand { font-size: 26px; }
.auth-brand .muted { margin: 6px 0 0; }

/* ---------- App shell (admin + clinic) ------------------------------ */
.admin-body { display: flex; min-height: 100vh; background: var(--color-bg); }
.sidebar {
    width: 250px; flex: 0 0 250px; background: #FFFFFF; color: var(--color-text);
    border-right: 1px solid var(--color-line);
    padding: 18px 14px; display: flex; flex-direction: column; gap: 3px;
}
.sidebar .brand {
    color: var(--color-heading); font-family: var(--font-head); font-weight: 800;
    font-size: 18px; letter-spacing: -0.3px; padding: 4px 10px; line-height: 1.2;
}
.sidebar .brand span { color: var(--color-accent); }
.sidebar-tag {
    font-size: 10px; text-transform: uppercase; letter-spacing: .09em;
    color: var(--color-muted-soft); font-weight: 700; padding: 6px 10px 12px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 11px; border-radius: 8px; color: #5b6b7b; font-weight: 500; font-size: 13.5px;
    background: transparent;
    transition: background var(--transition), color var(--transition);
}
.sidebar-nav a:hover { background: #F4F7F9; color: var(--color-primary-dark); }
.sidebar-nav a.is-active { background: var(--color-primary-light); color: var(--color-primary-dark); font-weight: 600; }
.nav-icon { width: 20px; text-align: center; font-size: 15px; }

.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    height: 62px; padding: 0 24px; background: var(--color-surface);
    border-bottom: 1px solid var(--color-line);
}
.admin-header h1 { font-size: 17px; font-weight: 700; margin: 0; }
.admin-user { display: flex; align-items: center; gap: 14px; }
.admin-content { padding: 22px 24px 40px; }

.btn-sm { padding: 8px 13px; font-size: 12.5px; }

.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { padding: 16px; }
.stat-num { font-family: var(--font-head); font-size: 28px; font-weight: 800; color: var(--color-heading); letter-spacing: -0.5px; }
.stat-label { color: #7E8C99; font-size: 12px; font-weight: 500; margin-top: 6px; }

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.form-section { margin: 22px 0 10px; font-size: 11px; color: var(--color-muted-soft); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 13px 14px; border-bottom: 1px solid #F1F5F8; font-size: 13px; color: #33424F; vertical-align: middle; }
.table th { font-size: 11px; text-transform: none; letter-spacing: 0; color: #8B99A6; font-weight: 600; background: transparent; border-bottom: 1px solid #EAEFF3; }
/* Edge cells keep a real gutter. These used to drop to 4px, which assumed the
   table always sat inside a padded card — in the many cards that are unpadded
   (so a row can span edge to edge) the text ended up touching the border. A
   uniform gutter is right in both, and is the single fix for all of them. */
.table th:first-child, .table td:first-child { padding-left: 14px; }
.table th:last-child,  .table td:last-child  { padding-right: 14px; }
/* Opt-out for a table that really is flush to a padded container's edge. */
.table-flush th:first-child, .table-flush td:first-child { padding-left: 0; }
.table-flush th:last-child,  .table-flush td:last-child  { padding-right: 0; }
.table td strong { color: #1B2A36; font-weight: 600; }
.table tbody tr:hover { background: #FAFBFC; }
.table tr:last-child td { border-bottom: none; }

/* A wide table (10+ columns of measurements, say) must scroll inside its card
   rather than pushing the whole page sideways. */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > .table { min-width: 640px; }

/* Row actions: a tight cluster of icon buttons at the end of a table row.
   Right-aligned and non-wrapping so the column width stays predictable. */
.row-actions { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
td > .row-actions { float: right; }

/* Empty state inside a card — used where a list has nothing to show yet. */
.empty { padding: 26px 18px; text-align: center; color: var(--color-muted-soft, #8B99A6); }
.empty p { margin: 0 0 4px; font-size: 13px; }
.empty p strong { color: #1B2A36; }

/* ---- Page head ----------------------------------------------------------
   Title + description on the left, actions on the right. */
.page-head { display: flex; align-items: flex-start; justify-content: space-between;
             gap: 14px; flex-wrap: wrap; margin: 0 0 16px; }
.page-head h2 { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 800;
                font-size: 19px; color: #142028; margin: 0; letter-spacing: -.01em; }
.page-head > div:last-child { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* ---- Filter tabs --------------------------------------------------------
   Status chips above a list (Active / Draft / Completed …). Built on the same
   look as .seg, which the older screens use, so the two read as one system. */
.tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px;
       border: 1px solid #E7ECF1; border-radius: 9px; background: #fff;
       font-size: 12.5px; font-weight: 600; color: #7E8C99; text-decoration: none;
       transition: border-color .13s, color .13s, background .13s; }
.tab:hover { border-color: #CBD5DD; color: #33424F; }
.tab.is-on { background: #0D6E6E; border-color: #0D6E6E; color: #fff; }
.tab .pill { background: #F0F4F6; color: #56697A; font-size: 10.5px; padding: 1px 7px; }
.tab.is-on .pill { background: rgba(255,255,255,.22); color: #fff; }

/* ---- Inline filter form -------------------------------------------------
   A search box and its button sitting on one line above a table. */
.form-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-inline input, .form-inline select { height: 34px; padding: 0 11px; font-size: 12.5px;
    border: 1px solid #E0E6EB; border-radius: 8px; background: #fff; color: #243240; outline: none; }
.form-inline input:focus, .form-inline select:focus { border-color: #0D6E6E; }
.form-inline input[name="q"] { flex: 1; min-width: 200px; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 600; text-transform: capitalize; }
.pill-active    { background: #ECFDF5; color: #065F46; }
.pill-trial     { background: #FEF3E2; color: #B45309; }
.pill-suspended { background: #FDEEEE; color: #B91C1C; }
.pill-cancelled { background: #F1F5F9; color: #475569; }
.pill-role      { background: var(--color-primary-light); color: var(--color-primary-dark); }

.row-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }

/* Impersonation banner */
.imp-banner {
    background: var(--color-accent); color: #1A202C;
    text-align: center; padding: 9px 16px; font-size: 14px; font-weight: 600;
}
.imp-banner a { color: #1A202C; text-decoration: underline; }
.imp-banner a:hover { color: #7c2d12; }

/* Public read-only demo banner */
.demo-banner {
    background: #F59E0B; color: #3D2700;
    text-align: center; padding: 9px 16px; font-size: 14px; font-weight: 600;
}
.demo-banner a { color: #3D2700; text-decoration: underline; }
.demo-banner a:hover { color: #1A1200; }

/* ---------- Clinic panel extras ------------------------------------- */
.sidebar-clinic .brand { font-size: 16px; line-height: 1.3; }

.search-form { display: flex; align-items: center; gap: 8px; }
.search-form input { min-width: 220px; background: #F4F7F9; }
.search-form input:focus { outline: none; border-color: var(--color-primary); background: #fff; }

.btn-xs { padding: 5px 10px; font-size: 12px; }
.danger-text { color: var(--color-danger); font-weight: 600; }

dl.info { margin: 0; display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; font-size: 14px; }
dl.info dt { color: var(--color-muted); font-weight: 600; }
dl.info dd { margin: 0; }

.field small { display: block; margin-top: 4px; font-size: 12px; }

/* Appointment queue board */
.queue-board { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); align-items: start; }
@media (max-width: 900px) { .queue-board { grid-template-columns: 1fr 1fr; } }
.queue-col { background: #eef2f4; border-radius: var(--radius-card); padding: 12px; min-height: 80px; }
.queue-col-head {
    font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--color-muted); display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.queue-count { background: #fff; border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.queue-empty { text-align: center; padding: 8px 0; }
.queue-card { background: #fff; border: 1px solid var(--color-border); border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.queue-card-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.token { font-family: var(--font-head); font-weight: 800; color: var(--color-primary); }
.queue-patient { display: block; font-weight: 600; margin: 6px 0 2px; }
.queue-meta { font-size: 12px; margin-bottom: 8px; }
.queue-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.queue-actions form { margin: 0; }

/* Appointment status pills */
.pill-appt-booked      { background: #EFF6FF; color: #1D4ED8; }
.pill-appt-arrived     { background: #FFFBEB; color: #92400E; }
.pill-appt-with_doctor { background: #F5F3FF; color: #6D28D9; }
.pill-appt-done        { background: #ECFDF5; color: #065F46; }
.pill-appt-cancelled   { background: #FEF2F2; color: #991B1B; }
.pill-appt-no_show     { background: #F1F5F9; color: #475569; }

/* ---------- OPD consult --------------------------------------------- */
.opd-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; margin-top: 14px; }
@media (max-width: 960px) { .opd-grid { grid-template-columns: 1fr; } }
.opd-left { display: flex; flex-direction: column; gap: 16px; }
.opd-left .card { padding: 18px; }
.hx-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.hx-list li { padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.hx-list li:last-child { border-bottom: none; }

textarea { width: 100%; resize: vertical; }

.rx-table { width: 100%; border-collapse: collapse; }
.rx-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--color-muted); padding: 4px 6px; }
.rx-table td { padding: 3px 4px; }
.rx-table input, .rx-table select { width: 100%; }
.rx-table .qty { width: 56px; }
.rx-del { background: none; border: none; color: var(--color-danger); font-size: 18px; cursor: pointer; line-height: 1; }

/* ---------- Public booking page ------------------------------------- */
.book-shell { max-width: 540px; margin: 0 auto; padding: 40px 18px; }
.book-head { text-align: center; margin-bottom: 22px; }
.book-head h1 { font-size: 24px; margin: 0; }
.book-head .muted { margin: 4px 0 0; }
.book-logo { max-height: 56px; margin-bottom: 10px; }
.book-card { padding: 28px; }
.book-card h2 { font-size: 20px; }

.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-card {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    border: 1px solid var(--color-border); border-radius: 10px; padding: 14px;
    transition: border var(--transition), box-shadow var(--transition);
}
.doc-card:hover { border-color: var(--color-primary); }
.doc-card input { accent-color: var(--color-primary); transform: scale(1.2); }
.doc-card:has(input:checked) { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.doc-info { display: flex; flex-direction: column; flex: 1; }
.doc-name { font-weight: 600; }
.doc-fee { font-weight: 700; color: var(--color-primary); white-space: nowrap; }

.day-strip { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 2px; }
.day-pill {
    flex: none; text-align: center; border: 1px solid var(--color-border);
    border-radius: 10px; padding: 8px 12px; min-width: 56px; color: var(--color-text);
}
.day-pill.is-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.day-dow { display: block; font-size: 11px; text-transform: uppercase; opacity: .75; }
.day-num { display: block; font-weight: 700; font-size: 14px; }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin-top: 18px; }
.slot {
    text-align: center; padding: 10px 6px; border: 1px solid var(--color-border);
    border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--color-primary);
    transition: background var(--transition), color var(--transition);
}
.slot:hover { background: var(--color-primary); color: #fff; }

.book-summary {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 18px;
    background: var(--color-primary-light); border-radius: 10px; padding: 14px;
}
.book-summary span { display: block; font-size: 12px; }
.book-summary strong { font-size: 14px; }

.confirm-token { text-align: center; margin: 16px 0; }
.confirm-token .muted { display: block; font-size: 13px; }
.token-big { font-family: var(--font-head); font-size: 44px; font-weight: 800; color: var(--color-primary); }

/* ---------- Pharmacy billing ---------------------------------------- */
.bill-totals { margin-left: auto; width: 300px; margin-top: 18px; font-size: 14px; }
.bt-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; }
.bt-grand { border-top: 2px solid var(--color-text); margin-top: 6px; padding-top: 10px; font-weight: 800; font-size: 17px; color: var(--color-primary); }
.disc-input { width: 110px; text-align: right; }
.cell-line { font-weight: 600; }

/* ---------- Finance ------------------------------------------------- */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Marketing landing --------------------------------------- */
.section { padding: 64px 0; }
.section-alt { background: #fff; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.section-title { text-align: center; font-size: clamp(26px, 3.5vw, 34px); }
.section-sub { text-align: center; color: var(--color-muted); margin: -6px auto 36px; max-width: 560px; }

.feature { padding: 22px; }
.feature:hover { border-color: #D6E0E6; box-shadow: 0 6px 20px rgba(16,24,40,0.06); }
.feature-icon {
    width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
    background: var(--color-primary-light); font-size: 20px; margin-bottom: 12px;
}
.feature h3 { font-size: 15.5px; margin-bottom: 4px; }

.workflow { display: flex; align-items: stretch; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 30px; }
.wf-step { flex: 1; min-width: 180px; max-width: 230px; text-align: center; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-card); padding: 22px 16px; }
.wf-num { width: 34px; height: 34px; border-radius: 50%; background: var(--color-primary); color: #fff; font-weight: 800; font-family: var(--font-head); display: grid; place-items: center; margin: 0 auto 12px; }
.wf-step h4 { font-size: 15px; margin: 0 0 6px; }
.wf-step p { font-size: 13px; }
.wf-arrow { display: flex; align-items: center; color: var(--color-muted-soft); font-size: 22px; }
@media (max-width: 760px) { .wf-arrow { display: none; } }

.pricing { align-items: stretch; }
.plan { display: flex; flex-direction: column; padding: 26px 22px; position: relative; }
.plan-featured { border-color: var(--color-primary); box-shadow: 0 10px 30px rgba(13,110,110,0.12); }
.plan-tag { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--color-primary); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 12px; border-radius: 999px; }
.plan h3 { font-size: 17px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; margin: 6px 0 4px; }
.plan-price .amount { font-family: var(--font-head); font-size: 36px; font-weight: 800; color: var(--color-heading); letter-spacing: -1px; }
.plan-price .per { color: var(--color-muted); font-size: 14px; }
.plan-limits { font-size: 12.5px; margin: 0 0 16px; }
.plan-features { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.plan-features li { font-size: 13.5px; color: #41505D; }
.plan-features li::first-letter { color: var(--color-success); font-weight: 700; }

.section-cta { text-align: center; background: linear-gradient(135deg, #0D2E2E, #0D6E6E); }
.section-cta h2 { color: #fff; }
.section-cta .muted { color: #BCD6D6; margin-bottom: 22px; }
.section-cta .btn-primary { background: #fff; color: var(--color-primary-dark); box-shadow: 0 6px 18px rgba(0,0,0,0.18); }
.section-cta .btn-primary:hover { background: #F4F7F9; color: var(--color-primary-dark); }

.subdomain-input { display: flex; align-items: center; border: 1px solid var(--color-border); border-radius: var(--radius-input); overflow: hidden; }
.subdomain-input input { border: none; flex: 1; }
.subdomain-input input:focus { box-shadow: none; }
.subdomain-input span { padding: 0 12px; color: var(--color-muted); font-size: 13px; background: #F4F7F9; align-self: stretch; display: flex; align-items: center; border-left: 1px solid var(--color-border); }

/* ===================================================================
   App shell v2 — faithful to Goclinicbox mockup (clinic panel)
   =================================================================== */
.app-body { display: flex; height: 100vh; width: 100%; overflow: hidden; background: #F2F5F8; }

/* sidebar */
.side { width: 250px; flex: 0 0 250px; background: #fff; border-right: 1px solid #E7ECF1; display: flex; flex-direction: column; height: 100%; }
.side-logo { padding: 18px 18px 14px; display: flex; align-items: center; gap: 11px; }
.side-logo-tile { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(13,110,110,0.28); }
.side-logo-name { font-family: 'Plus Jakarta Sans'; font-weight: 800; font-size: 16px; letter-spacing: -0.3px; color: #0D2E2E; line-height: 1.05; }
.side-logo-sub { font-size: 10.5px; color: #94A4B2; font-weight: 500; }
.side-switch { margin: 0 14px 12px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; background: #F4F7F9; border: 1px solid #E7ECF1; border-radius: 9px; }
.side-switch-ini { width: 24px; height: 24px; border-radius: 6px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 10px; font-family: 'Plus Jakarta Sans'; flex: 0 0 24px; }
.side-switch-info { flex: 1; min-width: 0; }
.side-switch-name { font-size: 12.5px; font-weight: 600; color: #243240; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-switch-plan { font-size: 10px; color: #9AA8B4; text-transform: capitalize; }
.side-nav { flex: 1; overflow-y: auto; padding: 8px 12px 12px; }
/* Category labels hidden — flat menu, with a small gap between groups. */
.side-section { display: block; height: 0; padding: 0; margin: 0; font-size: 0; color: transparent; overflow: hidden; padding-top: 5px; }
.side-section:first-child { padding-top: 0; }
.side-item { display: flex; align-items: center; gap: 12px; padding: 7px 12px; border-radius: 9px; font-size: 14px; font-weight: 500; color: #5b6b7b; text-decoration: none; margin-bottom: 0; background: transparent; transition: background .14s, color .14s; }
.side-item svg { flex: 0 0 19px; width: 19px; height: 19px; }
.side-item:hover { background: #F4F7F9; color: #0A5D5D; }
.side-item.is-active { background: #E6F4F4; color: #0A5D5D; font-weight: 600; }
.side-item .side-caret { flex: 0 0 13px; color: #9AA8B4; }
/* Nested sub-navigation */
.side-sub { margin: 2px 0 6px 22px; padding-left: 10px; border-left: 1.5px solid #E6EDF1; display: flex; flex-direction: column; gap: 1px; }
.side-subitem { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 7px; font-size: 12.75px; font-weight: 500; color: #6B7A88; text-decoration: none; transition: background .14s, color .14s; }
.side-subitem .side-subdot { width: 5px; height: 5px; border-radius: 50%; background: #C4CFD8; flex: 0 0 5px; transition: background .14s; }
.side-subitem:hover { background: #F4F7F9; color: #0A5D5D; }
.side-subitem.is-active { color: #0A5D5D; font-weight: 600; }
.side-subitem.is-active .side-subdot { background: var(--color-primary); }
.side-user { padding: 12px 14px; border-top: 1px solid #EDF1F4; display: flex; align-items: center; gap: 10px; }
.side-user-ini { width: 32px; height: 32px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; font-family: 'Plus Jakarta Sans'; }
.side-user-info { flex: 1; min-width: 0; line-height: 1.2; }
.side-user-name { font-size: 12.5px; font-weight: 600; color: #243240; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { font-size: 10.5px; color: #9AA8B4; }
.side-logout { display: flex; }

/* main */
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }
.app-top { height: 62px; flex: 0 0 62px; background: #fff; border-bottom: 1px solid #E7ECF1; display: flex; align-items: center; gap: 14px; padding: 0 22px; }
.app-top-title { min-width: 0; }
.app-top-h1 { font-family: 'Plus Jakarta Sans'; font-weight: 700; font-size: 17px; letter-spacing: -0.3px; color: #142028; line-height: 1.1; }
.app-top-sub { font-size: 11.5px; color: #8B99A6; margin-top: 1px; }
.app-search { margin-left: auto; display: flex; align-items: center; gap: 8px; background: #F4F7F9; border: 1px solid #E7ECF1; border-radius: 9px; padding: 0 11px; height: 38px; width: 280px; transition: border var(--transition), background var(--transition), box-shadow var(--transition); }
.app-search:focus-within { background: #fff; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.app-search input { flex: 1; min-width: 0; border: none; background: transparent; outline: none; font-family: var(--font-body); font-size: 12.5px; color: var(--color-text); }
.app-search input::placeholder { color: #9AA8B4; }
.app-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.app-search-k { font-size: 10px; color: #B9C4CE; border: 1px solid #E0E6EB; border-radius: 5px; padding: 1px 5px; }
@media (max-width: 720px) { .app-search { display: none; } }
.app-bell { position: relative; width: 38px; height: 38px; border-radius: 9px; background: #F4F7F9; border: 1px solid #E7ECF1; display: flex; align-items: center; justify-content: center; }
.app-bell-dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: #EF4444; border: 1.5px solid #fff; }
.app-scroll { flex: 1; overflow-y: auto; background: #F2F5F8; }
.app-page { padding: 22px 24px 40px; max-width: 1320px; margin: 0 auto; }

/* dashboard pieces */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: #fff; border: 1px solid #E8EDF2; border-radius: 13px; padding: 16px; box-shadow: 0 1px 2px rgba(16,24,40,0.04); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12px; color: #7E8C99; font-weight: 500; }
.kpi-ico { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.kpi-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.kpi-num { font-family: 'Plus Jakarta Sans'; font-size: 28px; font-weight: 800; color: #152330; letter-spacing: -0.5px; }
.kpi-trend { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; margin-bottom: 5px; }
.kpi-trend.up { color: #10B981; background: #ECFDF5; }
.kpi-trend.warn { color: #E5564B; background: #FDEEEE; }
.kpi-foot { display: flex; gap: 12px; margin-top: 11px; padding-top: 11px; border-top: 1px solid #F0F3F6; }
.kpi-foot span { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #647382; }
.kpi-foot i { width: 7px; height: 7px; border-radius: 2px; }

.panel { background: #fff; border: 1px solid #E8EDF2; border-radius: 13px; box-shadow: 0 1px 2px rgba(16,24,40,0.04); }
.panel-pad { padding: 18px; }
.panel-h { font-family: 'Plus Jakarta Sans'; font-weight: 700; font-size: 14.5px; color: #1B2A36; }
.dash-2col { display: grid; grid-template-columns: 1.62fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 1000px) { .dash-2col { grid-template-columns: 1fr; } }

.sched-head, .sched-row { display: grid; grid-template-columns: 70px 1fr 130px 96px 96px; align-items: center; }
.sched-head { padding: 9px 18px; font-size: 10.5px; font-weight: 700; letter-spacing: .5px; color: #A0AEBA; background: #FAFBFC; border-top: 1px solid #F0F3F6; border-bottom: 1px solid #F0F3F6; }
.sched-row { padding: 10px 18px; border-bottom: 1px solid #F4F6F8; font-size: 12.5px; }
.av-tile { width: 28px; height: 28px; border-radius: 8px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; font-family: 'Plus Jakarta Sans'; flex: 0 0 28px; }
.tag { font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }

.legend { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.legend > div { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.bar { height: 6px; background: #F0F3F6; border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 4px; }

/* ---------- Appointments Kanban (mockup) ---------------------------- */
.apt-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.seg { display: flex; background: #fff; border: 1px solid #E7ECF1; border-radius: 9px; padding: 2px; }
.seg-on { font-size: 12px; padding: 6px 13px; background: #0D6E6E; color: #fff; font-weight: 600; border-radius: 7px; }
.seg-off { font-size: 12px; padding: 6px 13px; color: #7E8C99; font-weight: 500; }
.apt-date { display: flex; align-items: center; gap: 7px; background: #fff; border: 1px solid #E7ECF1; border-radius: 9px; padding: 6px 11px; }
.apt-date input { border: none; font: inherit; font-size: 12.5px; color: #56697A; background: transparent; }
.apt-count { font-size: 12px; color: #8B99A6; } .apt-count b { color: #41505D; }

.kb { display: grid; grid-template-columns: repeat(5, 1fr); gap: 13px; align-items: start; }
@media (max-width: 1200px) { .kb { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .kb { grid-template-columns: 1fr 1fr; } }
.kb-col { background: #EDF1F4; border: 1px solid #E4EAEF; border-radius: 13px; padding: 11px; min-height: 120px; }
.kb-col-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 11px; }
.kb-col-h i { width: 9px; height: 9px; border-radius: 3px; }
.kb-col-h span:nth-child(2) { font-size: 12.5px; font-weight: 700; color: #33424F; font-family: 'Plus Jakarta Sans'; }
.kb-count { font-size: 10.5px; font-weight: 700; color: #7E8C99; background: #fff; padding: 1px 8px; border-radius: 20px; margin-left: auto; }
.kb-cards { display: flex; flex-direction: column; gap: 9px; }
.kb-empty { text-align: center; color: #B9C4CE; font-size: 13px; padding: 6px 0; }
.kb-card { background: #fff; border: 1px solid #E8EDF2; border-radius: 10px; padding: 11px; box-shadow: 0 1px 2px rgba(16,24,40,0.05); }
.kb-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kb-token { font-size: 10px; font-weight: 700; color: #9AA8B4; letter-spacing: 0.4px; }
.kb-card-body { display: flex; align-items: center; gap: 9px; }
.kb-name { font-size: 12.5px; font-weight: 600; color: #243240; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.kb-sub { font-size: 10.5px; color: #9AA8B4; }
.kb-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; padding-top: 9px; border-top: 1px solid #F2F5F7; }
.kb-time { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: #7E8C99; }
.kb-doc { font-size: 10.5px; color: #9AA8B4; margin-top: 7px; }
.kb-actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.kb-actions form { margin: 0; }

/* ---------- OPD console (mockup) ------------------------------------ */
.opd { display: flex; height: 100%; margin: -22px -24px -40px; }
.opd-queue { width: 264px; flex: 0 0 264px; background: #fff; border-right: 1px solid #E7ECF1; display: flex; flex-direction: column; }
.opd-queue-h { padding: 14px 16px 10px; border-bottom: 1px solid #F0F3F6; }
.opd-queue-h .t { font-family: 'Plus Jakarta Sans'; font-weight: 700; font-size: 13.5px; color: #1B2A36; }
.opd-queue-h .s { font-size: 11px; color: #8B99A6; margin-top: 2px; }
.opd-queue-list { flex: 1; overflow-y: auto; padding: 10px; }
.opd-q { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; margin-bottom: 5px; border: 1px solid transparent; text-decoration: none; }
.opd-q:hover { background: #F4F7F9; }
.opd-q.is-active { background: #E9F4F4; border-color: #CDE7E7; }
.opd-q .ini { position: relative; }
.opd-q .tok { position: absolute; bottom: -2px; right: -2px; font-size: 8px; font-weight: 700; background: #fff; border: 1px solid #E7ECF1; border-radius: 5px; padding: 0 3px; color: #56697A; }
.opd-q .nm { font-size: 12.5px; font-weight: 600; color: #243240; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opd-q .mt { font-size: 10.5px; color: #9AA8B4; }
.opd-work { flex: 1; overflow-y: auto; padding: 18px 22px 36px; min-width: 0; }
.opd-phead { background: #fff; border: 1px solid #E8EDF2; border-radius: 13px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(16,24,40,0.04); }
.opd-phead-row { display: flex; align-items: center; gap: 14px; }
.opd-avatar { width: 52px; height: 52px; border-radius: 13px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 800; font-family: 'Plus Jakarta Sans'; flex: 0 0 52px; }
.opd-allergy { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 13px; background: #FDEEEE; border: 1px solid #F7D3D0; border-radius: 9px; padding: 8px 12px; font-size: 12px; }
.opd-vitals { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 13px; }
@media (max-width: 1100px) { .opd-vitals { grid-template-columns: repeat(3, 1fr); } }
.vtile { background: #FAFBFC; border: 1px solid #EEF2F5; border-radius: 10px; padding: 9px 11px; }
.vtile .k { font-size: 10px; color: #9AA8B4; font-weight: 600; }
.vtile .v { font-family: 'Plus Jakarta Sans'; font-weight: 700; font-size: 15px; color: #152330; margin-top: 2px; }
.rx-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
@media (max-width: 860px) { .rx-cards { grid-template-columns: 1fr; } }
.rx-block { background: #fff; border: 1px solid #E8EDF2; border-radius: 13px; padding: 15px 17px; }
.rx-block-h { font-size: 11px; font-weight: 700; color: #9AA8B4; letter-spacing: 0.5px; margin-bottom: 8px; }

/* ---------- Side drawer (inline same-page forms) -------------------- */
.modal { position: fixed; inset: 0; z-index: 70; visibility: hidden; }
.modal.open { visibility: visible; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16,24,40,0.45); opacity: 0; transition: opacity .2s ease; }
.modal.open .modal-backdrop { opacity: 1; }

/* the card is a right-side drawer */
.modal-card {
    position: absolute; top: 0; right: 0; height: 100%;
    width: 480px; max-width: 94vw; background: #fff;
    box-shadow: -24px 0 60px rgba(16,24,40,0.22);
    display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform .24s cubic-bezier(.22,.61,.36,1);
}
.modal.open .modal-card { transform: translateX(0); }
.modal-lg .modal-card, .modal-card.modal-lg { width: 560px; }

.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--color-border); flex: 0 0 auto; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-x { background: none; border: none; cursor: pointer; color: #9AA8B4; font-size: 24px; line-height: 1; padding: 0 4px; }
.modal-x:hover { color: #56697A; }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-body .form { margin-top: 0; }
/* drawer footer actions pinned to the bottom */
.modal-body .setup-actions { position: sticky; bottom: -22px; background: #fff; margin: 20px -22px -22px; padding: 16px 22px; border-top: 1px solid var(--color-border); }

/* Mockup animations */
@keyframes mfpulse{0%,100%{opacity:1;}50%{opacity:.35;}}
@keyframes mffloat{0%,100%{transform:translateY(0);}50%{transform:translateY(-7px);}}

/* ---- Skeleton loading (shimmer placeholders) ------------------------- */
@keyframes mfshimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.sk {
    display: block;
    background: #EDF1F4;
    background-image: linear-gradient(90deg, #EDF1F4 0px, #F6F9FB 120px, #EDF1F4 240px);
    background-size: 800px 100%;
    background-repeat: no-repeat;
    border-radius: 7px;
    animation: mfshimmer 1.25s ease-in-out infinite;
}
.sk-line { height: 12px; margin-bottom: 9px; }
.sk-line.sm { height: 10px; }
.sk-line.lg { height: 16px; }
.sk-line.w40 { width: 40%; } .sk-line.w50 { width: 50%; } .sk-line.w60 { width: 60%; }
.sk-line.w70 { width: 70%; } .sk-line.w80 { width: 80%; } .sk-line.w90 { width: 90%; }
.sk-circle { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px; }
.sk-avatar { width: 32px; height: 32px; border-radius: 8px; flex: 0 0 32px; }
.sk-btn { height: 34px; width: 96px; border-radius: 9px; }
.sk-chip { height: 20px; width: 64px; border-radius: 20px; }
.sk-card { background: #fff; border: 1px solid var(--color-border); border-radius: 13px; padding: 18px; }
.sk-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #F1F4F7; }
.sk-row:last-child { border-bottom: none; }
.sk-grow { flex: 1; min-width: 0; }
.sk-fade { animation: mfskfade .25s ease; }
@keyframes mfskfade { from { opacity: 0; } to { opacity: 1; } }

/* ---- Collapsible sidebar + fullscreen ------------------------------- */
.side-toggle { display:flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:9px; background:#F4F7F9; border:1px solid #E7ECF1; color:#56697A; cursor:pointer; flex:0 0 34px; }
.side-toggle:hover { background:#E9F4F4; color:#0A5D5D; }
.app-body.side-collapsed .side { width:68px; flex-basis:68px; }
.app-body.side-collapsed .side-logo-name,
.app-body.side-collapsed .side-logo-sub,
.app-body.side-collapsed .side-switch-info,
.app-body.side-collapsed .side-switch i,
.app-body.side-collapsed .side-switch a,
.app-body.side-collapsed .side-section,
.app-body.side-collapsed .side-item span,
.app-body.side-collapsed .side-item .side-caret,
.app-body.side-collapsed .side-sub,
.app-body.side-collapsed .side-user-info { display:none !important; }
.app-body.side-collapsed .side-logo { justify-content:center; padding:18px 0 14px; }
.app-body.side-collapsed .side-switch { justify-content:center; padding:8px; margin:0 12px 12px; }
.app-body.side-collapsed .side-nav { padding:6px 10px 14px; }
.app-body.side-collapsed .side-item { justify-content:center; padding:10px; }
.app-body.side-collapsed .side-user { justify-content:center; }
.app-body.side-fullscreen .side { display:none; }
.app-body.side-collapsed .side-user-ini { display:none; }
.app-body.side-collapsed .side-user { justify-content:center; padding:12px 0; }
.app-body.side-collapsed .side-switch-ini { margin:0 auto; }

/* ---- Clinic app: tablet & mobile responsive ------------------------- */
.side-backdrop{display:none;position:fixed;inset:0;background:rgba(13,32,32,.45);z-index:85;}
@media (max-width: 900px){
    .side{position:fixed;top:0;left:0;height:100%;z-index:90;transform:translateX(-100%);transition:transform .22s ease;box-shadow:0 0 50px rgba(0,0,0,.25);}
    .app-body.side-open .side{transform:translateX(0);}
    .app-body.side-open .side-backdrop{display:block;}
    /* off-canvas always shows full sidebar, ignore the desktop icon-rail collapse */
    .app-body.side-collapsed .side{width:250px;flex-basis:250px;}
    .app-body.side-collapsed .side-logo-name,
    .app-body.side-collapsed .side-logo-sub,
    .app-body.side-collapsed .side-switch-info,
    .app-body.side-collapsed .side-user-info,
    .app-body.side-collapsed .side-section{display:block;}
    .app-body.side-collapsed .side-item span{display:inline;}
    .app-body.side-collapsed .side-item{justify-content:flex-start;}
    .kpi-grid{grid-template-columns:repeat(2,1fr);}
    .app-page{padding:16px 14px 36px;}
}
@media (max-width: 560px){
    .kpi-grid{grid-template-columns:1fr;}
    .app-page{padding:14px 12px 32px;}
}
/* horizontal-scroll wide tables on small screens */
@media (max-width: 680px){
    .card > .table,.app-page .table{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;white-space:nowrap;}
}

/* ---- Table action cells: keep buttons/inline-forms from touching -------- */
.table td .btn, .table td form { vertical-align: middle; }
.table td form { display: inline-flex; }
.table td .btn + .btn,
.table td .btn + form,
.table td form + .btn,
.table td form + form { margin-left: 7px; }

/* ---- Payment gateway cards (settings) ------------------------------- */
.gw-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:18px;align-items:start;}
.gw-grid > .card{margin:0;width:auto;min-width:0;}
.gw-card{background:#fff;border:1px solid #E6ECF1;border-radius:14px;padding:18px;display:flex;flex-direction:column;box-shadow:0 1px 2px rgba(16,24,40,.04);}
.gw-card.is-on{border-color:#BFE3E1;}
.gw-head{display:flex;align-items:center;gap:12px;margin-bottom:15px;}
.gw-logo{width:42px;height:42px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:15px;color:#fff;font-family:'Plus Jakarta Sans',sans-serif;flex:0 0 42px;}
.gw-name{font-family:'Plus Jakarta Sans',sans-serif;font-weight:700;font-size:15px;color:#142028;line-height:1.1;}
.gw-sub{font-size:11px;color:#8FA0AB;margin-top:3px;}
.gw-badge{margin-left:auto;font-size:10px;font-weight:700;padding:4px 10px;border-radius:20px;letter-spacing:.4px;text-transform:uppercase;white-space:nowrap;}
.gw-badge.live{background:#E7F7EE;color:#0F9D6A;}
.gw-badge.test{background:#FEF3E2;color:#B9791A;}
.gw-badge.off{background:#F1F4F7;color:#8B99A6;}
.gw-field{margin-bottom:11px;}
.gw-field label{display:block;font-size:11px;font-weight:600;color:#56697A;margin-bottom:5px;}
.gw-field input{width:100%;padding:9px 11px;border:1px solid #E2E8EE;border-radius:9px;font-size:12.5px;font-family:'JetBrains Mono','SFMono-Regular',monospace;color:#243240;background:#FBFCFD;outline:none;transition:border-color .12s,box-shadow .12s;}
.gw-field input::placeholder{font-family:'Inter',sans-serif;color:#A9B4BE;}
.gw-field input:focus{border-color:#0D6E6E;background:#fff;box-shadow:0 0 0 3px rgba(13,110,110,.09);}
.gw-foot{margin-top:auto;padding-top:13px;border-top:1px solid #F0F3F6;}
.gw-switch{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px;}
.gw-switch span{font-size:12.5px;color:#33424F;font-weight:500;}
.gw-scope{font-size:10.5px;font-weight:700;letter-spacing:.4px;color:#9AA8B4;margin:4px 0 7px;}
.gw-chips{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:13px;}
.gw-chip{display:inline-flex;align-items:center;gap:7px;font-size:12px;color:#56697A;background:#F5F8F9;border:1px solid #E6ECF1;border-radius:8px;padding:7px 11px;cursor:pointer;user-select:none;}
.gw-chip input{accent-color:#0D6E6E;width:auto;margin:0;}
.gw-chip:has(input:checked){background:#E9F4F4;border-color:#BFE3E1;color:#0A5D5D;font-weight:600;}
/* generic toggle switch (shared) */
.tgl{position:relative;width:40px;height:23px;flex:0 0 40px;display:inline-block;}
.tgl input{position:absolute;opacity:0;width:100%;height:100%;margin:0;cursor:pointer;z-index:2;}
.tgl .track{position:absolute;inset:0;border-radius:20px;background:#D5DEE6;transition:background .15s;}
.tgl .knob{position:absolute;top:2px;left:2px;width:19px;height:19px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.2);transition:left .15s;}
.tgl input:checked ~ .track{background:#0D6E6E;}
.tgl input:checked ~ .knob{left:19px;}
/* The admin console sits on a dark ground, where the light track disappears. */
.tgl-dark .track{background:#2B3B45;}
.tgl-dark input:checked ~ .track{background:#13A39B;}
.tgl-dark input:disabled ~ .track{opacity:.45;}
.tgl input:disabled ~ .knob{opacity:.6;}
/* toggle row: label/description on the left, switch on the right (enable/disable) */
.tgl-row{display:flex;align-items:center;gap:12px;padding:9px 0;}
.tgl-row>.tgl-main{flex:1;}
.tgl-title{font-size:13px;font-weight:600;color:#33424F;}
.tgl-sub{font-size:11.5px;color:#9AA8B4;margin-top:1px;}

/* ---- In-app document preview (invoices / prints) -------------------- */
/* Center the preview modal (override the right-drawer default) */
.modal.doc-preview{display:flex;align-items:center;justify-content:center;padding:24px;}
.modal.doc-preview .modal-card.doc-preview-card{position:relative;top:auto;right:auto;margin:0;border-radius:14px;box-shadow:0 24px 70px rgba(16,24,40,.30);transform:scale(.96);opacity:0;transition:transform .2s ease,opacity .2s ease;}
.modal.doc-preview.open .modal-card.doc-preview-card{transform:scale(1);opacity:1;}
.doc-preview-card{width:min(880px,96vw);max-width:96vw;height:90vh;display:flex;flex-direction:column;padding:0;overflow:hidden;}
.doc-preview-head{display:flex;align-items:center;gap:9px;padding:12px 16px;border-bottom:1px solid #E8EDF2;background:#fff;}
.doc-preview-title{font-size:14px;color:#142028;}
.doc-preview-frame{flex:1;width:100%;border:0;background:#F2F5F8;}

/* ====================================================================== */
/*  GLOBAL RESPONSIVE LAYER — tablet & mobile                             */
/* ====================================================================== */

/* Never let content force a horizontal page scrollbar */
.app-main, .app-scroll, .app-page { max-width: 100%; min-width: 0; }

/* OPD console: stack the queue rail above the workspace on tablet/mobile */
@media (max-width: 880px){
    .opd { flex-direction: column; height: auto; margin: -16px -14px -36px; }
    .opd-queue { width: auto; flex: none; border-right: none; border-bottom: 1px solid #E7ECF1; max-height: 220px; }
    .opd-queue-list { max-height: 170px; }
    .opd-work { padding: 16px 14px 30px; }
}

/* Vitals tiles get tighter on small screens */
@media (max-width: 560px){ .opd-vitals { grid-template-columns: repeat(2, 1fr); } }

/* Wide tables: scroll inside their card on tablet (cells may wrap),
   hard horizontal scroll on phones so dense rows stay readable. */
@media (max-width: 1024px){
    .app-page .table, .card > .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 640px){
    .app-page .table, .card > .table { white-space: nowrap; }
}

/* Catch-all for inline repeat(N,1fr) grids (KPI strips, vitals forms,
   stat rows…) that can't be reached by a class media query. */
@media (max-width: 820px){
    [style*="repeat(5,"], [style*="repeat(5, "],
    [style*="repeat(4,"], [style*="repeat(4, "] { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 560px){
    [style*="repeat(5,"], [style*="repeat(5, "],
    [style*="repeat(4,"], [style*="repeat(4, "],
    [style*="repeat(3,"], [style*="repeat(3, "] { grid-template-columns: 1fr !important; }
    /* two-up content grids collapse */
    .form-row { flex-direction: column; }
}

/* Modals fit small screens */
@media (max-width: 560px){
    .modal-card { width: 100% !important; max-width: 100% !important; }
    .filter-bar { flex-wrap: wrap; }
}

/* ---- App topbar (header) responsiveness ----------------------------- */
@media (max-width: 1024px){
    #mfSearchWrap form { width: 200px !important; }
}
@media (max-width: 860px){
    #mfSearchWrap, #mfFullscreen { display: none !important; }
    .app-topbar .bk-text, .app-topbar .help-text { display: none; }   /* icon only */
    .app-topbar .topbar-booking, .app-topbar .topbar-help { padding: 8px 10px !important; }
}
@media (max-width: 640px){
    .app-topbar { padding: 0 13px !important; gap: 10px !important; }
    .app-topbar .na-text { display: none; }                 /* New Appointment → icon only */
    .app-topbar .topbar-newappt { padding: 9px 11px !important; }
    .app-topbar > div[style*="min-width:0"] { flex: 1 1 auto; }  /* let the title shrink */
}
@media (max-width: 520px){
    .app-topbar .topbar-booking { display: none; }          /* small: use the sidebar Website link */
}
@media (max-width: 380px){
    .app-topbar .topbar-newappt { display: none; }          /* very small: drop the button (use sidebar) */
}

/* ---- Custom confirm / alert dialogs (replace native browser popups) ---- */
.mf-dialog { position: fixed; inset: 0; z-index: 4000; display: none; align-items: center; justify-content: center; padding: 20px; }
.mf-dialog.open { display: flex; }
.mf-dialog .mf-backdrop { position: absolute; inset: 0; background: rgba(12,30,38,.45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); opacity: 0; transition: opacity .16s ease; }
.mf-dialog.open .mf-backdrop { opacity: 1; }
.mf-dialog-card { position: relative; background: #fff; border-radius: 14px; width: 100%; max-width: 410px; box-shadow: 0 22px 55px rgba(16,24,40,.24); overflow: hidden; transform: translateY(10px) scale(.97); opacity: 0; transition: transform .16s ease, opacity .16s ease; }
.mf-dialog.open .mf-dialog-card { transform: none; opacity: 1; }
.mf-dialog-body { padding: 22px 22px 16px; }
.mf-dialog-title { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 700; font-size: 16px; color: #142028; margin-bottom: 6px; }
.mf-dialog-msg { font-size: 13.5px; line-height: 1.55; color: #56697A; }
.mf-dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 4px 22px 18px; }
.mf-dialog-foot .btn { min-width: 84px; justify-content: center; }
.mf-dialog .mf-btn-danger { background: #E5564B; color: #fff; border: 1px solid #E5564B; }
.mf-dialog .mf-btn-danger:hover { background: #d4483d; }

/* ---- Icon button --------------------------------------------------------
   A 30px square action with no label, used where a row needs several actions
   without turning into a wall of text buttons. Always pair with title="…" —
   an icon alone is not an accessible name. */
.ib { display:inline-flex; align-items:center; justify-content:center;
      width:30px; height:30px; padding:0; border:1px solid #E0E6EB; border-radius:8px;
      background:#fff; color:#56697A; cursor:pointer; text-decoration:none; flex:0 0 auto;
      transition:background .13s, border-color .13s, color .13s; }
.ib:hover { background:#F2F6F8; border-color:#CBD5DD; color:#16232D; }
.ib i { font-size:13px; line-height:0; }
.ib-sm { width:26px; height:26px; border-radius:7px; }
.ib-sm i { font-size:12px; }
.ib-danger:hover { background:#FEF3F2; border-color:#FBD5D2; color:#B42318; }

/* Tick-list of options inside a form (plan add-ons, module pickers). A grid so
   long catalogues stay two columns instead of one very tall stack. */
.pick-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:6px;
  max-height:190px;overflow-y:auto;border:1px solid var(--line,#E5EAF0);border-radius:8px;padding:8px;}
.pick{display:flex;align-items:center;gap:7px;font-size:12.5px;font-weight:500;color:#33424F;
  padding:5px 7px;border-radius:6px;cursor:pointer;margin:0;}
.pick:hover{background:#F4F7FA;}
.pick input{margin:0;flex:0 0 auto;}
.pick span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.pick em{font-style:normal;color:#7E8C99;font-size:11.5px;}

/* Signup's qualification block — visually secondary to the account fields, so
   it reads as "tell us about yourself", not as four more required questions. */
.qual{border:1px solid var(--line,#E5EAF0);border-radius:10px;padding:12px 13px 4px;margin:14px 0 4px;background:#FAFBFC;}
.qual-head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;margin-bottom:9px;}
.qual-head span{font-size:12.5px;font-weight:700;color:#33424F;}
.qual-head small{font-size:11px;color:#8593A0;font-weight:400;}
.qual .field label{font-size:11.5px;color:#56697A;}

/* Amber alert — something needs attention but nothing has failed. Sits between
   .alert-ok and .alert-bad, which were the only two variants. */
.alert-warn{background:#FEF6E7;border:1px solid #F6DCB0;color:#8A5A00;}

/* Build stamp at the foot of the page. Quiet by default, legible on hover —
   it is a support detail, not something to read on the way past. */
.app-version{display:block;text-align:center;margin:26px 0 18px;font-size:10.5px;
  letter-spacing:.04em;color:#B9C4CE;text-decoration:none;}
.app-version:hover{color:var(--color-primary,#0D6E6E);}

/* Typeahead picker (assets/js/picker.js) — our own dropdown, because
   <datalist> is drawn by the browser: unstyleable, different everywhere, and
   with nowhere to put a price or a category. */
.ta{position:relative;flex:1;min-width:0;}
.ta-panel{display:none;position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:60;
  background:#fff;border:1px solid var(--color-border,#E5EAF0);border-radius:10px;
  box-shadow:0 14px 34px rgba(16,24,40,.16);max-height:264px;overflow-y:auto;padding:4px;}
.ta-panel.on{display:block;}
.ta-item{display:flex;align-items:center;gap:9px;padding:8px 10px;border-radius:7px;cursor:pointer;font-size:12.5px;color:#33424F;}
.ta-item:hover,.ta-item.on{background:#F2F9F9;}
.ta-item .ta-name{flex:1;min-width:0;font-weight:600;color:#243240;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.ta-item .ta-name b{color:var(--color-primary,#0D6E6E);font-weight:700;}
.ta-item .ta-meta{font-size:11px;color:#9AA8B4;white-space:nowrap;}
.ta-item .ta-price{font-weight:700;color:#0D2E2E;white-space:nowrap;}
.ta-empty{padding:14px 12px;text-align:center;font-size:12.5px;color:#9AA8B4;}

/* Tap-to-toggle history chip. A checkbox that reads as a pill, because these
   are the same dozen answers every consultation and a column of checkboxes is
   slower to scan than a row of chips. */
.hx-chip{display:inline-flex;align-items:center;cursor:pointer;margin:0;}
.hx-chip input{position:absolute;opacity:0;width:0;height:0;}
.hx-chip span{font-size:12px;font-weight:600;color:#56697A;background:#fff;
  border:1px solid var(--color-border,#E5EAF0);border-radius:16px;padding:5px 12px;transition:all .12s;}
.hx-chip input:checked + span{color:#0D6E6E;background:#E9F4F4;border-color:#CDE7E7;}
.hx-chip input:focus-visible + span{outline:2px solid var(--color-primary,#0D6E6E);outline-offset:2px;}

/* Consultation tabs. One form, five panes — switching hides, it never
   unmounts, so everything still posts together on Save. */
.rxtabs{display:flex;gap:4px;margin-top:14px;border-bottom:2px solid var(--color-border,#E5EAF0);
  overflow-x:auto;scrollbar-width:none;}
.rxtabs::-webkit-scrollbar{display:none;}
.rxtab{display:inline-flex;align-items:center;gap:7px;white-space:nowrap;cursor:pointer;
  background:none;border:none;border-bottom:2px solid transparent;margin-bottom:-2px;
  padding:10px 14px;font:inherit;font-size:13px;font-weight:600;color:#7E8C99;}
.rxtab i{font-size:14px;line-height:0;}
.rxtab-rx{font-family:'Plus Jakarta Sans';font-weight:800;font-size:15px;line-height:1;}
.rxtab:hover{color:#33424F;}
.rxtab.is-on{color:var(--color-primary,#0D6E6E);border-bottom-color:var(--color-primary,#0D6E6E);}
.rxtab:focus-visible{outline:2px solid var(--color-primary,#0D6E6E);outline-offset:-2px;}
.rxtab-n{min-width:18px;height:18px;border-radius:9px;background:#EEF2F5;color:#7E8C99;
  font-size:10.5px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;padding:0 5px;}
.rxtab.is-on .rxtab-n{background:var(--color-primary,#0D6E6E);color:#fff;}
.rxtab-n[data-empty="1"]{display:none;}
.rxpane{display:none;}
.rxpane.is-on{display:block;}
@media(max-width:640px){.rxtab{padding:10px 10px;font-size:12.5px;}}

/* Repeatable rows on the consultation pad (symptoms, allergies, diagnoses,
   injections). A row is a surface, not four inputs floating on the page —
   without it the pad reads as a wall of boxes.

   NOT .rx-row: the medicines table already uses that on its <tr>, and giving
   a table row display:flex collapses the whole table. */
.rxline{display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  background:#FAFBFC;border:1px solid var(--color-border,#E5EAF0);border-radius:10px;
  padding:8px 10px;margin-bottom:8px;transition:border-color .12s,background .12s;}
.rxline:hover{background:#F6F9FB;border-color:#D3DDE6;}
.rxline input,.rxline select{background:#fff;}
.rxline-warn{background:#FFF8F7;border-color:#F2DAD6;}
.rxline-warn:hover{background:#FFF3F1;border-color:#EBC8C3;}
.rxline-warn input,.rxline-warn select{border-color:#F0D2CE;}
/* The add-another button under a stack of rows. */
.rx-add{display:inline-flex;align-items:center;gap:6px;cursor:pointer;font:inherit;
  font-size:12.5px;font-weight:600;color:var(--color-primary,#0D6E6E);
  background:#E9F4F4;border:1px solid #CDE7E7;border-radius:9px;padding:8px 13px;}
.rx-add:hover{background:#DCEDED;}
.rx-add.rx-add-warn{color:#B23A30;background:#FDEEEE;border-color:#F7D3D0;}
.rx-add.rx-add-warn:hover{background:#FBE3E1;}
.rx-add i{font-size:12px;line-height:0;}
/* Small caps label above a group of rows. */
.rx-sub{font-size:11.5px;font-weight:700;color:#7E8C99;letter-spacing:.3px;margin:0 0 7px;}
.rx-sub-warn{color:#B23A30;}

/* Tap-to-add chips on the consultation pad (complaints, quick symptoms).
   These are buttons, not form controls — they carry their own look because a
   naked <button> inherits nothing. */
.cx-chip,.sym-quick{display:inline-flex;align-items:center;gap:5px;cursor:pointer;
  font:inherit;font-size:12px;font-weight:600;color:var(--color-primary,#0D6E6E);
  background:#E9F4F4;border:1px solid #CDE7E7;border-radius:16px;padding:5px 12px;
  transition:background .12s,border-color .12s,color .12s;}
.cx-chip:hover,.sym-quick:hover{background:#DCEDED;border-color:#B6DEDE;}
.cx-chip:active,.sym-quick:active{background:#CCE5E5;}
.cx-chip:focus-visible,.sym-quick:focus-visible{outline:2px solid var(--color-primary,#0D6E6E);outline-offset:2px;}
/* The quick-add variant is quieter — it sits beside a filled row, not above an
   empty field, so it should not compete with the chips it adds. */
.sym-quick{font-size:11.5px;background:#fff;font-weight:600;}
.sym-quick:hover{background:#E9F4F4;}

/* Platform logo on the auth pages. Sits on the dark panel, so it needs room
   rather than the 40px tile the placeholder used. */
.auth-logo-img{height:40px;max-width:190px;object-fit:contain;display:block;}
@media(max-width:520px){.auth-logo-img{height:34px;}}

/* Click-to-chat. WhatsApp green is the whole point of the button — it has to
   read as "this opens WhatsApp" from across the row. */
.btn-wa{display:inline-flex;align-items:center;gap:6px;background:#25D366;color:#fff;border:1px solid #1FBE5B;}
.btn-wa:hover{background:#1FBE5B;color:#fff;}
