/* ============================================================
   legacy-pages.css — QUARANTINED LEGACY. Page-specific, one-off
   styles for ~20 individual pages (patient/visit heroes, appointment
   board, invoice, prescription, permissions, reports, lab, login,
   print, system selector, etc.), moved verbatim and IN ORIGINAL
   ORDER out of the former monolithic site.css.

   Several class names are intentionally redefined 2-3 times in this
   file for different pages and rely on source-order cascade to pick
   a winner (e.g. .pt-header, .card-body, .Row2/3/4 vs .row-2/3/4,
   .flag-H/HH/L/LL) — DO NOT reorder any rule in this file, it will
   silently change which page's styling wins.

   Do not add new rules here. New page-specific styles get their own
   file; existing blocks here get decomposed into proper per-page
   files and reconciled with the shared component set incrementally,
   one page at a time, verified visually as each page is migrated.
   ============================================================ */

.pt-header {
    /* LTR: black at the start (left), fading to a faint gray at the end
       (right). Flipped for RTL below so it always reads "black at the
       reading start" regardless of language — same treatment as .visit-hero. */
    background: linear-gradient(to right, var(--primary) 0%, rgba(var(--muted-rgb),.15) 100%), var(--primary);
    border-radius: var(--radius);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

html[dir="rtl"] .pt-header {
    background: linear-gradient(to left, var(--primary) 0%, rgba(var(--muted-rgb),.15) 100%), var(--primary);
}

.pt-header::after {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,.03);
    pointer-events: none;
}

.pt-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    border: 3px solid rgba(255,255,255,.15);
}

.pt-info {
    flex: 1;
    min-width: 0;
}

.pt-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.pt-meta {
    font-size: .8rem;
    color: rgba(255,255,255,.6);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pt-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pt-actions {
    display: flex;
    gap: 8px;
}

.pt-stat-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.pt-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-align: center;
}

.pt-stat-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
}

.pt-stat-lbl {
    font-size: .72rem;
    color: var(--muted);
    margin-top: 2px;
}

.pt-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
    overflow-x: auto;
}

.pt-tab {
    padding: 10px 18px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all .15s;
    margin-bottom: -2px;
    text-decoration: none;
}

.pt-tab.active,
.pt-tab:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
    text-decoration: none;
}

.pt-panel {
    display: none;
}

.pt-panel.active {
    display: block;
}

.flow-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.flow-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .2s;
}

.flow-card:hover {
    box-shadow: var(--shadow-md);
}

.flow-card.done {
    border-color: var(--success);
}

.flow-card.active-step,
.flow-card.active {
    border-color: var(--primary);
}

.flow-card.active .step-num {
    background: var(--primary);
    color: #fff;
}

.flow-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.flow-card-head .step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.flow-card.done .step-num {
    background: var(--success);
    color: #fff;
}

.flow-card.active-step .step-num {
    background: var(--primary);
    color: #fff;
}

.flow-card-head .step-title {
    font-weight: 700;
    font-size: .88rem;
    color: var(--text1);
}

.flow-card-head .step-sub {
    font-size: .72rem;
    color: var(--muted);
    margin-top: 1px;
}

.flow-card-body {
    padding: 14px 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
    font-size: .81rem;
}

.info-row:last-child {
    border: none;
}

.info-row .lbl {
    color: var(--muted);
}

.info-row .val {
    font-weight: 600;
    color: var(--text1);
}

.flow-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 9px;
    border-radius: 7px;
    border: none;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
    text-decoration: none;
    margin-top: 10px;
    font-family: inherit;
}

.flow-btn:hover {
    opacity: .88;
    text-decoration: none;
}

.flow-btn.flex-1 { width: auto; flex: 1; margin-top: 0; }
.flow-btn-row { margin-top: 12px; display: flex; gap: 8px; }
.flow-btn-compact { width: auto; padding: 7px 16px; margin-top: 0; }
.val-truncate { max-width: 180px; text-align: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-card-hint { color: var(--muted); font-size: .82rem; margin: 0 0 14px; }

.flow-btn-primary {
    background: var(--primary);
    color: #fff;
}

.flow-btn-success {
    background: var(--success);
    color: #fff;
}

.flow-btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.flow-btn-secondary {
    background: var(--bg);
    color: var(--text1);
    border: 1.5px solid var(--border);
}

.rx-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.rx-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 12px;
    font-size: .81rem;
}

.rx-item-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.ins-report-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.ins-kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}

.ins-kpi-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.ins-kpi-lbl {
    font-size: .75rem;
    color: var(--muted);
    margin-top: 3px;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.login-brand {
    flex: 1;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 60%, var(--primary-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.login-brand-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.login-brand-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(3,3,3,.18) 0%, rgba(17,17,17,.1) 60%, rgba(3,3,3,.2) 100%);
    pointer-events: none;
}

.login-brand::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    pointer-events: none;
}

.login-brand::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: rgba(255,255,255,.04);
    pointer-events: none;
}

.login-brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    position: relative;
}

.login-brand-logo img {
    width: 100%;
    max-width: 230px;
    height: auto;
    display: block;
}

.login-brand-title {
    font-size: 3.2rem;
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 8px;
    position: relative;
    text-align: center;
}

.login-brand-sub {
    font-size: .95rem;
    opacity: .75;
    text-align: center;
    line-height: 1.5;
    position: relative;
    max-width: 280px;
}

.login-form-wrap {
    width: 440px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px;
    background: #fff;
    flex-shrink: 0;
    position: relative;
}
.brand-content { position:relative; z-index:1; text-align:center; color:#fff; max-width:320px; }
.login-animate { width:100%; max-width:380px; }
.login-inp { width:100%; height:42px; padding:0 12px; border:1px solid var(--border-2); border-radius:var(--radius-sm); font-size:.88rem; color:var(--text1); outline:none; transition:all .15s; font-family:inherit; }

.login-header {
    margin-bottom: 32px;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text1);
    margin-bottom: 4px;
}

.login-sub {
    font-size: .84rem;
    color: var(--muted);
}

.login-field {
    margin-bottom: 18px;
}

.login-field label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    font-size: .88rem;
    color: var(--text1);
    outline: none;
    transition: all .15s;
    font-family: inherit;
    background: #fff;
}

.login-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,148,136,.1);
}

.login-btn {
    width: 100%;
    height: 44px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    margin-top: 8px;
}

.login-btn:hover {
    background: var(--primary-dark);
}

.login-err {
    background: var(--danger-bg);
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .82rem;
    color: #991b1b;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-lang {
    margin-top: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .8rem;
    color: var(--muted);
}

.login-lang a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.login-register-cta {
    margin-top: 18px;
    text-align: center;
    font-size: .83rem;
    color: var(--muted);
}

.login-register-cta a {
    margin-inline-start: 6px;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.vh-bar {
    background: linear-gradient(to right, var(--primary) 0%, rgba(var(--muted-rgb),.15) 100%), var(--primary);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}

html[dir="rtl"] .vh-bar {
    background: linear-gradient(to left, var(--primary) 0%, rgba(var(--muted-rgb),.15) 100%), var(--primary);
}

.vh-patient {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vh-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.15);
}

.vh-patient-name {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
}

.vh-patient-meta {
    font-size: .75rem;
    color: rgba(255,255,255,.6);
    margin-top: 2px;
}

.vh-actions {
    display: flex;
    gap: 8px;
}

.vh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    background: rgba(255,255,255,.1);
    color: rgba(255,255,255,.9);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 7px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    font-family: inherit;
}

.vh-btn:hover {
    background: rgba(255,255,255,.18);
    color: #fff;
    text-decoration: none;
}

.vh-btn svg {
    width: 13px;
    height: 13px;
}

.vh-alerts {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.25);
    border-radius: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.vh-alerts-label {
    font-size: .75rem;
    font-weight: 700;
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.vh-alert-chip {
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.2);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: .72rem;
    color: #b91c1c;
    font-weight: 600;
}

.vh-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.vh-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 12px 14px;
    text-align: center;
}

.vh-stat-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

.vh-stat-lbl {
    font-size: .68rem;
    color: var(--muted);
    margin-top: 2px;
}

.vh-layout {
    display: grid;
    /* minmax(0, 1fr), not a bare 1fr — a bare 1fr track still respects the
       main column's own min-content width and can force the page wider
       than the viewport instead of shrinking. */
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 14px;
    align-items: start;
}

.vh-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.vh-sidebar-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.vh-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
}

.vh-tab {
    padding: 9px 16px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .15s;
    margin-bottom: -2px;
    white-space: nowrap;
}

.vh-tab.active,
.vh-tab:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.rx-table-wrap {
    overflow-x: auto;
}

.rx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}

.rx-table th {
    padding: 9px 10px;
    text-align: start;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    background: var(--bg);
}

.rx-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.rx-table tbody tr:last-child td {
    border: none;
}

.rx-rm-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}

.rx-rm-btn:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

.lab-priority-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-2);
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
    color: var(--text2);
    transition: all .15s;
    font-family: inherit;
}

.lab-priority-btn.active-routine {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.lab-priority-btn.active-urgent {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
}

.lab-priority-btn.active-stat {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.vitals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.vital-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}

.vital-lbl {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin-bottom: 5px;
}

.pt-sidebar-section {
    margin-bottom: 14px;
}

.pt-sidebar-title {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.pt-sidebar-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: .8rem;
    border-bottom: 1px solid var(--border);
}

.pt-sidebar-row:last-child {
    border: none;
}

.pt-sidebar-lbl {
    color: var(--muted);
}

.pt-sidebar-val {
    font-weight: 600;
    color: var(--text1);
    max-width: 60%;
    text-align: end;
}

[dir=rtl] .pt-sidebar-val {
    text-align: start;
}

.inv-layout {
    display: grid;
    /* minmax(0, 1fr), not a bare 1fr — see .vh-layout above. */
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 14px;
    align-items: start;
}

.inv-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}

.inv-items-table th {
    padding: 9px 10px;
    text-align: start;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    background: var(--bg);
    border-bottom: 2px solid var(--border);
}

.inv-items-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.inv-items-table tbody tr:last-child td {
    border: none;
}

.inv-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    font-size: .83rem;
    border-bottom: 1px solid var(--border);
}

.inv-totals-row:last-child {
    border: none;
}

.inv-total-final {
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: .9rem;
    margin-top: 8px;
}

.ins-breakdown {
    background: var(--info-bg);
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 12px;
    font-size: .81rem;
}

.ins-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.spec-edit-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.report-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.report-card-title {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    margin-bottom: 12px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 14px;
}

.perm-module {
    margin-bottom: 16px;
}

.perm-module-title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text1);
    margin-bottom: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.perm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: .82rem;
}

.perm-row:last-child {
    border: none;
}

.perm-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.perm-toggle input {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}

.d-flex {
    display: flex;
}

.justify-center { justify-content:center; }
.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-4 { gap:4px; }
.gap-6 { gap:6px; }
.gap-8 { gap:8px; }
.gap-10 { gap:10px; }
.gap-12 { gap:12px; }
.gap-14 { gap:14px; }
.gap-16 { gap:16px; }
.mt-0 { margin-top:0; }
.mt-4 { margin-top:4px; }
.mt-6 { margin-top:6px; }
.mt-8 { margin-top:8px; }
.mt-12 { margin-top:12px; }
.mt-14 { margin-top:14px; }
.mt-16 { margin-top:16px; }
.mt-18 { margin-top:18px; }
.mt-20 { margin-top:20px; }
.mb-0 { margin-bottom:0; }
.mb-4 { margin-bottom:4px; }
.mb-6 { margin-bottom:6px; }
.mb-8 { margin-bottom:8px; }
.mb-10 { margin-bottom:10px; }
.mb-12 { margin-bottom:12px; }
.mb-14 { margin-bottom:14px; }
.mb-16 { margin-bottom:16px; }
.mb-20 { margin-bottom:20px; }
.mb-24 { margin-bottom:24px; }
.p-0 { padding:0; }
.d-flex { display:flex; }
.d-grid { display:grid; }
.flex-col { flex-direction:column; }
.align-start { align-items:flex-start; }
.align-end { align-items:flex-end; }
.justify-end { justify-content:flex-end; }
.justify-between { justify-content:space-between; }
.flex-wrap { flex-wrap:wrap; }
.flex-1 { flex:1; }
.gap-2 { gap:2px; }
.gap-20 { gap:20px; }
.mb-18 { margin-bottom:18px; }
.sticky-top { position:sticky; top:20px; }
.pt-8 { padding-top:8px; }
.pt-10 { padding-top:10px; }
.tr-clickable { cursor:pointer; }
.icon-14 { width:14px; height:14px; flex-shrink:0; }
.icon-lg-block { display:block; margin:0 auto 10px; }
.py-20 { padding-top:20px; padding-bottom:20px; }
.align-self-center { align-self:center; }
.display-contents { display:contents; }
.p-10 { padding:10px; }
.p-16 { padding:16px; }
.p-18 { padding:14px 18px; }
.p-20 { padding:20px; }
.ch-220 { height:220px; }
.ch-200 { height:200px; }
.fin-ins { font-size:.85rem; line-height:2; }

.text-muted {
    color: var(--muted);
}

.text-sm {
    font-size: .8rem;
}

.text-xs {
    font-size: .72rem;
}

.font-bold {
    font-weight: 700;
}

.w-full {
    width: 100%;
}

.text-end {
    text-align: end;
}

.text-center {
    text-align: center;
}

.section-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: 12px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.val-summary {
    background: var(--danger-bg);
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 10px 14px;
    color: #991b1b;
    font-size: .82rem;
    margin-bottom: 14px;
}

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.form-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text1);
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.lbl {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text2);
}

.inp {
    width: 100%;
    height: 47px;
    padding: 0 10px;
    margin:0px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    font-size: .84rem;
    color: var(--text1);
    background: #fff;
    outline: none;
    transition: all .15s;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.inp:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.18);
}

textarea.inp {
    height: auto;
    padding: 8px 10px;
}

.btn-save {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}

.btn-save:hover {
    background: var(--primary-dark);
}

.btn-cancel {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    background: #fff;
    color: var(--text2);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    font-size: .84rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    font-family: inherit;
}

.btn-cancel:hover {
    background: var(--bg);
    color: var(--text1);
    border-color: var(--primary);
    text-decoration: none;
}

.chk-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chk-row input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}
.chk-group { display:flex; gap:24px; flex-wrap:wrap; }
.chk-lbl { display:flex; align-items:center; gap:8px; cursor:pointer; font-size:.88rem; color:var(--text2); }
.chk-lbl input[type=checkbox] { width:15px; height:15px; accent-color:var(--primary); }
.gap-24 { gap:24px; }

.field-err {
    font-size: .72rem;
    color: var(--danger);
    margin-top: 2px;
}

.Row2 {
    grid-column: span 4;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}

.Row3 {
    grid-column: span 4;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 20px;
}

.Row4 {
    grid-column: span 4;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px 20px;
}

.field.span4 {
    grid-column: span 4;
}

.field.span2 {
    grid-column: span 2;
}

.sec-sep {
    grid-column: span 4;
    border: none;
    border-top: 1px solid var(--border);
    margin: 8px 0 16px;
    width: 100%;
}

.visit-alerts {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.2);
    border-radius: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.visit-alerts-label {
    font-size: .75rem;
    font-weight: 700;
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 5px;
}

.visit-alert-chip {
    background: rgba(239,68,68,.07);
    border: 1px solid rgba(239,68,68,.18);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: .72rem;
    color: #b91c1c;
    font-weight: 600;
}

.dx-widget,
.dx-datagrid,
.dx-texteditor-input,
.dx-button-text,
.dx-list-item-content {
    font-family: inherit !important;
   
}
.dx-datagrid {
    background-color: white;
}
.dx-button {
    border-radius: var(--radius-sm) !important;
    font-size: .83rem !important;
}

/*.dx-button-normal .dx-button-content {
    padding: 7px 14px !important;
}*/

.dx-button-default {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.dx-button-default:hover {
    background-color: var(--primary-dark) !important;
}

.dx-overlay-content {
    border-radius: var(--radius) !important;
}

.dx-popup-title {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border) !important;
    font-size: .9rem !important;
    font-weight: 700 !important;
    color: var(--text1) !important;
}

.dx-toolbar-button .dx-button {
    background: var(--primary) !important;
    color: var(--accent) !important;
    border: none !important;
}

.dx-toolbar-button .dx-button .dx-icon {
    color: var(--accent) !important;
}

.dx-toolbar-button .dx-button:hover,
.dx-toolbar-button .dx-button.dx-state-hover {
    background: var(--accent) !important;
    color: var(--primary) !important;
}

.dx-toolbar-button .dx-button:hover .dx-icon,
.dx-toolbar-button .dx-button.dx-state-hover .dx-icon {
    color: var(--primary) !important;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

@media (max-width: 1200px) {
    .vh-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .vh-sidebar-col {
        display: none;
    }

    .inv-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .charts-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .flow-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .pt-stat-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .Row3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .Row4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ins-report-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .report-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .settings-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .vitals-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .vh-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .login-brand {
        display: none;
    }

    .login-form-wrap {
        width: 100%;
        padding: 32px 24px;
    }

    .Row2,
    .Row3,
    .Row4 {
        grid-template-columns: 1fr;
    }

    .page-body {
        padding: 16px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .pt-tabs {
        overflow-x: auto;
    }
}

/* ══════════════════════════════════════════════════════════════
   LEGACY CLASS ALIASES — keep backward compat while views migrate
══════════════════════════════════════════════════════════════ */

/* Dashboard stats */
.stats-row { display:grid; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:14px; margin-bottom:18px; }
.stat-card  { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px; display:flex; align-items:center; gap:14px; box-shadow:var(--shadow-xs); transition:box-shadow .2s,transform .15s; }
.stat-card:hover { box-shadow:var(--shadow-md); transform:translateY(-1px); }
.stat-ic { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.stat-ic svg { width:19px; height:19px; }
.stat-ic.green, .stat-ic.teal { background:rgba(var(--accent-rgb),.14); color:var(--accent-hover); }
.stat-ic.blue  { background:var(--blue-light); color:var(--blue-dark); }
.stat-ic.orange{ background:#EEEEEE; color:#5A5A5A; }
.stat-ic.red   { background:var(--danger-bg); color:#b91c1c; }
.stat-ic.purple{ background:#EEEEEE; color:#5A5A5A; }
.stat-val { font-size:1.5rem; font-weight:800; color:var(--text1); line-height:1; }
.stat-lbl { font-size:.71rem; color:var(--muted); margin-top:3px; }

/* Index toolbar */
.page-actions { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; flex-wrap:wrap; gap:10px; }
.btn-add { display:inline-flex; align-items:center; gap:7px; padding:8px 18px; background:var(--primary); color:var(--accent); border:none; border-radius:var(--radius-sm); font-size:.84rem; font-weight:600; cursor:pointer; text-decoration:none; transition:all .15s; font-family:inherit; }
.btn-add:hover, .btn-add:focus-visible { background:var(--accent); color:var(--primary); text-decoration:none; }
.btn-add svg { width:15px; height:15px; }

/* Grid wrapper */
.grid-wrap { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-xs); overflow:hidden; }

/* Section heading */
.sec-hd { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); margin:16px 0 10px; }

/* Toast */
.toast-success { background:var(--primary); color:#fff; padding:10px 18px; border-radius:8px; margin-bottom:14px; font-size:.84rem; font-weight:600; display:inline-flex; align-items:center; gap:8px; }
.toast-err     { background:var(--danger);  color:#fff; padding:10px 18px; border-radius:8px; margin-bottom:14px; font-size:.84rem; font-weight:600; }

/* Old primary vars compatibility */
--primary2: var(--primary);
--primary3: var(--primary-light);

/* Topbar extras */
.topbar-right { display:flex; align-items:center; gap:10px; }
.topbar-left  { display:flex; flex-direction:column; gap:2px; }

/* breadcrumb sep */
.breadcrumb .sep    { font-size:.65rem; color:var(--muted); }
.breadcrumb .current { color:var(--text2); font-weight:500; }

/* btn-icon variants (legacy from old site.css) */
.btn-icon { display:inline-flex; align-items:center; gap:6px; padding:7px 14px; border:none; border-radius:var(--radius-sm); font-size:.82rem; font-weight:600; cursor:pointer; text-decoration:none; transition:all .15s; font-family:inherit; }
.btn-icon:hover { text-decoration:none; }
.btn-icon-primary  { background:var(--primary); color:var(--accent); }
.btn-icon-primary:hover, .btn-icon-primary:focus-visible  { background:var(--accent); color:var(--primary); }
.btn-icon-success  { background:var(--success); color:#fff; }
.btn-icon-outline  { background:transparent; color:var(--primary); border:1.5px solid var(--primary); }
.btn-icon-outline:hover { background:var(--primary-light); }
.btn-icon-ghost    { background:transparent; color:var(--text2); border:1px solid var(--border-2); }
.btn-icon-ghost:hover { background:var(--bg); color:var(--primary); }
.btn-icon-danger   { background:transparent; color:var(--danger); border:1px solid var(--danger); }
.btn-icon-danger:hover { background:var(--danger-bg); }
.btn-icon svg { width:14px; height:14px; flex-shrink:0; }

/* card body */
.card-body { padding:20px; }
.card-footer { padding:12px 20px; border-top:1px solid var(--border); background:var(--bg); }

/* Insurance index */
.ins-edit-row { display:flex; align-items:center; gap:10px; background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:10px 14px; margin-bottom:8px; }

/* Lifecycle bar (appointment flow indicator) */
.lifecycle-bar { display:flex; align-items:center; gap:0; margin-bottom:14px; overflow-x:auto; }
.lc-step { display:flex; align-items:center; gap:6px; padding:7px 14px; font-size:.78rem; font-weight:600; color:var(--muted); white-space:nowrap; }
.lc-step.done    { color:var(--success); }
.lc-step.current { color:var(--primary); }
.lc-step-dot { width:8px; height:8px; border-radius:50%; background:currentColor; }
.lc-arrow { color:var(--border-2); font-size:.7rem; }

/* ══════════════════════════════════════════
   INVOICE INDEX — SUMMARY BAR + FILTER
══════════════════════════════════════════ */
.filter-bar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.summary-bar { display:none; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.summary-bar.show { display:flex; }
.sum-item  { background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:10px 16px; flex:1; min-width:140px; }
.sum-label { font-size:.68rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.sum-val   { font-size:1.2rem; font-weight:700; color:var(--text1); margin-top:3px; }
.sum-val.green { color:var(--success); }
.sum-val.red   { color:var(--danger); }

/* ══════════════════════════════════════════
   MASTER-DETAIL TABLE (in JS templates)
══════════════════════════════════════════ */
.detail-wrap { display:grid; grid-template-columns:1fr 1fr; gap:14px; padding:12px 16px; }
.detail-section-head { font-size:.68rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; margin-bottom:8px; }
.detail-table { width:100%; border-collapse:collapse; font-size:.82rem; }
.detail-table th, .detail-table-th { padding:7px 12px; text-align:start; color:var(--muted); font-size:.68rem; text-transform:uppercase; background:var(--bg); border-bottom:2px solid var(--border); }
.detail-table td, .detail-table-td { padding:6px 12px; border-bottom:1px solid var(--border); }
.detail-table tr:last-child td { border:none; }
.text-success { color:var(--success); font-weight:600; }
.text-danger  { color:var(--danger);  font-weight:600; }
.text-muted2  { color:var(--muted); font-size:.83rem; }

/* ══════════════════════════════════════════
   USER INDEX — PAGE HEADER
══════════════════════════════════════════ */
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.page-header h1, .page-header .ph-title { font-size:.95rem; font-weight:700; color:var(--text1); display:flex; align-items:center; gap:8px; }
.btn-del { background:none; border:none; color:var(--muted); cursor:pointer; padding:5px; border-radius:4px; display:inline-flex; align-items:center; transition:all .15s; }
.btn-del:hover { color:var(--danger); background:var(--danger-bg); }

/* ══════════════════════════════════════════
   CLINIC INFO TABLE
══════════════════════════════════════════ */
/* ══════════════════════════════════════════
   INSURANCE PAGE
══════════════════════════════════════════ */
.ins-tabs { display:flex; gap:4px; margin-bottom:20px; border-bottom:2px solid var(--border); }
.ins-tab  { padding:10px 20px; font-size:.85rem; font-weight:600; color:var(--text2); cursor:pointer; border:none; background:none; border-bottom:2px solid transparent; margin-bottom:-2px; font-family:inherit; transition:all .15s; }
.ins-tab.active { color:var(--primary); border-bottom-color:var(--primary); }
.tab-panel { display:none; }
.tab-panel.active { display:block; }
.stat-cards { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
.stat-card  { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 20px; display:flex; flex-direction:column; gap:4px; box-shadow:var(--shadow-xs); }
.stat-label { font-size:.75rem; color:var(--muted); font-weight:600; text-transform:uppercase; }
.claim-badge { padding:2px 10px; border-radius:20px; font-size:.72rem; font-weight:700; display:inline-block; }
.claim-Pending          { background:#fef3c7; color:#92400e; }
.claim-Submitted        { background:#dbeafe; color:#1e40af; }
.claim-Approved         { background:#d1fae5; color:#065f46; }
.claim-PartiallyApproved{ background:#ede9fe; color:#5b21b6; }
.claim-Rejected         { background:#fee2e2; color:#991b1b; }
.claim-Paid             { background:#d1fae5; color:#065f46; }

/* ══════════════════════════════════════════
   INSURANCE REPORT
══════════════════════════════════════════ */
.rpt-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:24px; }
.rpt-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px 22px; box-shadow:var(--shadow-xs); }
.rpt-lbl  { font-size:.75rem; color:var(--muted); font-weight:700; text-transform:uppercase; margin-bottom:6px; }
.rpt-val  { font-size:1.7rem; font-weight:800; color:var(--primary); }
.rpt-sub  { font-size:.8rem; color:var(--muted); margin-top:2px; }
.rpt-status-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:24px; }
.rpt-status-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 18px; }
.rpt-status-lbl { font-size:.75rem; color:var(--muted); font-weight:700; }
.rpt-status-val { font-size:1.5rem; font-weight:800; }
.rpt-status-pending  { border-top:3px solid #f59e0b; }
.rpt-status-approved { border-top:3px solid #10b981; }
.rpt-status-rejected { border-top:3px solid #ef4444; }
.rpt-status-paid     { border-top:3px solid #0e8476; }
.rpt-status-val.pending  { color:#f59e0b; }
.rpt-status-val.approved { color:#10b981; }
.rpt-status-val.rejected { color:#ef4444; }
.rpt-status-val.paid     { color:#0e8476; }
.rpt-by-company { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; margin-bottom:16px; }
.rpt-company-head { padding:14px 20px; border-bottom:1px solid var(--border); font-weight:700; font-size:.9rem; }
.rpt-company-table { width:100%; border-collapse:collapse; }
.rpt-company-thead tr { background:var(--bg); }
.rpt-company-thead th { padding:10px 16px; font-size:.8rem; color:var(--muted); font-weight:600; }
.rpt-company-table td { padding:12px 16px; border-top:1px solid var(--border); }
.rpt-company-table td.fw-600 { font-weight:600; }
.progress-bar-wrap { display:flex; align-items:center; gap:8px; justify-content:center; }
.progress-bar-track { width:80px; height:6px; background:var(--border); border-radius:3px; overflow:hidden; }
.progress-bar-fill  { height:100%; background:#10b981; border-radius:3px; }
.progress-bar-pct   { font-size:.8rem; font-weight:700; }

/* ══════════════════════════════════════════
   PATIENT DETAILS — CARD LAYOUT
══════════════════════════════════════════ */
.pt-header { background: linear-gradient(to right, var(--primary) 0%, rgba(var(--muted-rgb),.15) 100%), var(--primary); border-radius:var(--radius); padding:28px 32px; display:flex; align-items:center; gap:24px; margin-bottom:20px; position:relative; overflow:hidden; }
.pt-header::after { content:''; position:absolute; right:-40px; top:-40px; width:200px; height:200px; border-radius:50%; background:rgba(255,255,255,.04); pointer-events:none; }
.pt-avatar { width:72px; height:72px; border-radius:50%; background:linear-gradient(135deg,var(--primary),var(--blue)); display:flex; align-items:center; justify-content:center; font-size:1.8rem; font-weight:700; color:#fff; flex-shrink:0; box-shadow:0 4px 18px rgba(15,169,137,.35); border:3px solid rgba(255,255,255,.18); }
.pt-info  { flex:1; }
.pt-name  { font-size:1.35rem; font-weight:800; color:#fff; margin-bottom:6px; }
.pt-sub   { font-size:.85rem; color:rgba(255,255,255,.7); display:flex; flex-wrap:wrap; gap:14px; }
.pt-sub span { display:flex; align-items:center; gap:5px; }
.pt-header-end { display:flex; flex-direction:column; gap:8px; align-items:flex-end; }
.pt-badge { background:rgba(255,255,255,.14); border:1px solid rgba(255,255,255,.2); border-radius:20px; padding:5px 16px; font-size:.8rem; font-weight:700; color:#fff; }
.pt-actions { display:flex; gap:10px; flex-wrap:wrap; }
.pt-action-btn { display:flex; align-items:center; gap:7px; padding:9px 18px; border-radius:10px; font-size:.85rem; font-weight:700; cursor:pointer; text-decoration:none; border:none; font-family:inherit; transition:opacity .15s; }
.pt-action-btn:hover { opacity:.85; text-decoration:none; }
.pt-btn-primary   { background:var(--primary); color:var(--accent); }
.pt-btn-primary:hover, .pt-btn-primary:focus-visible { background:var(--accent); color:var(--primary); }
.pt-btn-secondary { background:rgba(255,255,255,.14); color:#fff; border:1px solid rgba(255,255,255,.25); }
.pt-stats { display:grid; grid-template-columns:repeat(5,1fr); gap:14px; margin-bottom:20px; }
.pt-stat  { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px; display:flex; align-items:center; gap:14px; box-shadow:var(--shadow); transition:box-shadow .2s,transform .2s; }
.pt-stat:hover { box-shadow:0 8px 24px rgba(0,0,0,.08); transform:translateY(-2px); }
.pt-stat-ic { width:44px; height:44px; border-radius:12px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.pt-stat-ic svg { width:22px; height:22px; }
.ic-green  { background:var(--primary-light); color:var(--primary); }
.ic-blue   { background:var(--blue-light); color:var(--blue); }
.ic-amber  { background:#fef3c7; color:#d97706; }
.ic-red    { background:#fde8e8; color:#dc2626; }
.ic-purple { background:#f3e8ff; color:#7c3aed; }
.pt-stat-val { font-size:1.5rem; font-weight:800; color:var(--blue-dark); line-height:1.1; }
.pt-stat-lbl { font-size:.75rem; color:var(--text2); font-weight:600; margin-top:3px; }
.pt-tabs { display:flex; gap:0; border-bottom:2px solid var(--border); margin-bottom:20px; overflow-x:auto; }
.pt-tab  { display:flex; align-items:center; gap:7px; padding:11px 22px; font-size:.9rem; font-weight:600; color:var(--muted); cursor:pointer; border-bottom:3px solid transparent; margin-bottom:-2px; white-space:nowrap; transition:all .18s; background:none; border-top:none; border-left:none; border-right:none; font-family:inherit; }
.pt-tab:hover:not(.active) { color:var(--text1); }
.pt-tab.active { color:var(--primary); border-bottom-color:var(--primary); font-weight:700; }
.pt-tab .tab-count { background:var(--primary-light); color:var(--primary); border-radius:20px; padding:1px 8px; font-size:.72rem; font-weight:700; }
.pt-tab.active .tab-count { background:var(--primary); color:#fff; }
.pt-panel { display:none; }
.pt-panel.active { display:block; }
.pt-card-body { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.pt-card-head { padding:14px 18px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; background:var(--bg); }
.pt-card-head-title { font-size:.8rem; font-weight:700; color:var(--blue-dark); text-transform:uppercase; letter-spacing:.05em; }
.pt-card-head-title.danger { color:var(--danger); }
.appt-row { display:flex; align-items:center; padding:14px 18px; border-bottom:1px solid var(--border); gap:14px; transition:background .15s; }
.appt-row:hover { background:var(--primary-light); }
.appt-row:last-child { border-bottom:none; }
.appt-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.appt-time { font-size:.8rem; color:var(--muted); width:130px; flex-shrink:0; }
.appt-time .fw-700 { font-weight:700; }
.appt-info { flex:1; }
.appt-info-name { font-weight:600; font-size:.88rem; }
.appt-doc  { font-size:.8rem; color:var(--text2); margin-top:2px; }
.appt-actions { display:flex; gap:8px; }
.appt-link { display:flex; align-items:center; gap:5px; padding:5px 12px; border-radius:7px; font-size:.78rem; font-weight:700; text-decoration:none; transition:opacity .15s; }
.appt-link:hover { opacity:.8; text-decoration:none; }
.appt-link.primary   { background:var(--primary-light); color:var(--primary); }
.appt-link.secondary { background:var(--bg); color:var(--text2); border:1px solid var(--border); }
.appt-link.sm { font-size:.75rem; }
.visit-row { display:grid; grid-template-columns:120px 1fr 110px 90px 100px; align-items:center; padding:13px 18px; border-bottom:1px solid var(--border); font-size:.85rem; gap:12px; transition:background .15s; }
.visit-row:hover { background:var(--primary-light); }
.visit-row:last-child { border-bottom:none; }
.visit-row.head { font-size:.72rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; background:var(--bg); border-radius:8px 8px 0 0; }
.visit-row.head:hover { background:var(--bg); }
.visit-row-date { font-size:.8rem; color:var(--muted); }
.visit-row-complaint { font-weight:600; font-size:.87rem; }
.visit-row-diagnosis { font-size:.78rem; color:var(--text2); }
.visit-row-amount { font-weight:700; color:var(--primary); }
.visit-row-actions { display:flex; gap:6px; }
.rx-row    { display:flex; align-items:center; gap:14px; padding:13px 18px; border-bottom:1px solid var(--border); transition:background .15s; }
.rx-row:hover { background:var(--primary-light); }
.rx-row:last-child { border-bottom:none; }
.rx-row-meta { min-width:115px; }
.rx-row-meta-id   { font-weight:700; font-size:.85rem; }
.rx-row-meta-date { font-size:.75rem; color:var(--muted); }
.rx-row-meta-doc  { font-size:.75rem; color:var(--text2); }
.rx-meds   { display:flex; flex-wrap:wrap; gap:6px; flex:1; }
.rx-med-tag { background:var(--blue-light); color:var(--blue); border-radius:6px; padding:3px 10px; font-size:.75rem; font-weight:600; }
.rx-row-end { display:flex; flex-direction:column; align-items:flex-end; gap:6px; min-width:100px; }
.diag-row  { display:grid; grid-template-columns:120px 1fr 100px 130px; align-items:start; padding:13px 18px; border-bottom:1px solid var(--border); font-size:.85rem; gap:12px; }
.diag-row:last-child { border-bottom:none; }
.diag-row.head { font-size:.72rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; background:var(--bg); border-radius:8px 8px 0 0; }
.diag-row-date  { color:var(--muted); }
.diag-row-diag  { font-weight:600; }
.diag-row-doc   { color:var(--text2); }
.pt-form-grid   { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.pt-form-grid .span2 { grid-column:span 2; }
.info-field     { display:flex; flex-direction:column; gap:4px; }
.info-field .lbl2 { font-size:.75rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.info-field .val2 { font-size:.92rem; color:var(--text1); font-weight:500; }
.info-field-allergy { background:#fde8e8; border-radius:8px; padding:12px; }
.info-field-allergy .lbl2 { color:var(--danger); }
.info-field-allergy .val2 { color:#dc2626; font-weight:700; }
.new-appt-form  { background:var(--bg); border:1.5px dashed var(--border); border-radius:var(--radius); padding:20px; margin-top:16px; }
.new-appt-title { font-size:.8rem; font-weight:700; color:var(--primary); text-transform:uppercase; letter-spacing:.05em; margin-bottom:14px; }
.new-appt-form .fg2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.new-appt-actions { display:flex; gap:10px; margin-top:14px; }
.alert-warn { background:#fef3c7; border:1px solid #f59e0b; border-radius:10px; padding:12px 18px; font-size:.85rem; color:#92400e; display:flex; align-items:center; gap:10px; margin-bottom:14px; }
.alert-warn a { color:#92400e; font-weight:700; }
.empty-state { text-align:center; padding:40px 20px; color:var(--muted); font-size:.9rem; }
.empty-state svg { opacity:.3; margin-bottom:10px; }
.ins-policy-grid { display:grid; grid-template-columns:2fr 1fr 1fr 1fr auto; gap:10px; align-items:center; padding:14px 0; border-bottom:1px solid var(--border); }
.ins-policy-name { font-weight:700; font-size:.9rem; }
.ins-policy-num  { font-size:.8rem; color:var(--muted); }
.ins-policy-primary { font-size:.7rem; color:var(--primary); font-weight:700; }
.ins-policy-meta { font-size:.82rem; }
.ins-policy-meta-lbl { color:var(--muted); }
.ins-active-badge   { background:#d1fae5; color:#065f46; padding:2px 10px; border-radius:20px; font-size:.72rem; font-weight:700; display:inline-block; }
.ins-inactive-badge { background:#fee2e2; color:#991b1b; padding:2px 10px; border-radius:20px; font-size:.72rem; font-weight:700; display:inline-block; }
.ins-policy-actions { display:flex; gap:6px; }

@media(max-width:1100px){ .pt-stats { grid-template-columns:repeat(3,1fr); } }
@media(max-width:700px)  { .pt-stats { grid-template-columns:repeat(2,1fr); } .pt-form-grid { grid-template-columns:1fr; } .pt-form-grid .span2 { grid-column:span 1; } .new-appt-form .fg2 { grid-template-columns:1fr; } }

/* ══════════════════════════════════════════
   LAB RESULTS TABLE
══════════════════════════════════════════ */
.result-table { width:100%; border-collapse:collapse; font-size:.87rem; }
.result-table th { padding:10px 14px; background:var(--bg); color:var(--muted); font-size:.68rem; font-weight:700; text-transform:uppercase; border-bottom:2px solid var(--border); }
.result-table td { padding:10px 14px; border-bottom:1px solid var(--border); vertical-align:middle; }
.flag-badge { display:inline-flex; padding:3px 8px; border-radius:12px; font-size:.72rem; font-weight:700; }
.flag-badge.flag-H  { background:#fee2e2; color:#991b1b; }
.flag-badge.flag-L  { background:#dbeafe; color:#1e40af; }
.flag-badge.flag-HH { background:#7f1d1d; color:#fff; }
.flag-badge.flag-LL { background:#1e3a5f; color:#fff; }
.flag-badge.flag-N, .flag-badge.flag-Normal { background:#d1fae5; color:#065f46; }
.abnormal-chk { accent-color:var(--danger); width:16px; height:16px; cursor:pointer; }

/* ══════════════════════════════════════════
   LAB TABS
══════════════════════════════════════════ */
.lab-tabs { display:flex; gap:0; margin-bottom:14px; border-bottom:2px solid var(--border); }
.lab-tab  { padding:8px 20px; font-size:.83rem; font-weight:600; color:var(--muted); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-2px; transition:all .15s; }
.lab-tab.active { color:var(--primary); border-bottom-color:var(--primary); }

@media(max-width:900px){
    .stat-cards, .rpt-grid, .rpt-status-grid { grid-template-columns:1fr 1fr; }
}

.info-table { width:100%; border-collapse:collapse; font-size:.88rem; }
.info-table td { padding:9px 4px; border-bottom:1px solid var(--border); }
.info-table tr:last-child td { border:none; }
.info-table .itd-lbl { color:var(--muted); width:160px; }
.info-table .itd-val { font-weight:600; color:var(--text1); }

/* ══════════════════════════════════════════
   REPORT PAGE
══════════════════════════════════════════ */
.filter-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 20px; margin-bottom:16px; box-shadow:var(--shadow-xs); }
.filter-row  { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; }
.filter-field { display:flex; flex-direction:column; gap:5px; }
.filter-field label { font-size:.75rem; font-weight:600; color:var(--text2); }

/* ══════════════════════════════════════════
   SETTINGS / PERMISSIONS
══════════════════════════════════════════ */
.perm-table { width:100%; border-collapse:collapse; font-size:.84rem; }
.perm-table th { padding:9px 12px; text-align:start; background:var(--bg); color:var(--muted); font-size:.7rem; text-transform:uppercase; letter-spacing:.06em; border-bottom:2px solid var(--border); }
.perm-table td { padding:9px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
.perm-table tr:last-child td { border:none; }
.perm-table input[type=checkbox] { width:15px; height:15px; accent-color:var(--primary); cursor:pointer; }

/* ══════════════════════════════════════════
   LABORATORY
══════════════════════════════════════════ */
.lab-panel { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; margin-bottom:14px; box-shadow:var(--shadow-xs); }
.lab-panel-head { padding:12px 16px; background:var(--bg); border-bottom:1px solid var(--border); font-size:.82rem; font-weight:700; color:var(--text1); display:flex; align-items:center; justify-content:space-between; }
.lab-panel-body { padding:16px; }
.lab-result-row { display:grid; grid-template-columns:1fr 1fr 1fr auto; gap:10px; align-items:end; padding:8px 0; border-bottom:1px solid var(--border); }
.lab-result-row:last-child { border:none; }
.lab-result-lbl { font-size:.78rem; font-weight:600; color:var(--text2); margin-bottom:4px; }

/* ══════════════════════════════════════════
   VISIT INDEX
══════════════════════════════════════════ */
.visit-status-open     { color:var(--primary); font-weight:600; }
.visit-status-closed   { color:var(--muted); }
.visit-status-inprogress { color:var(--warning); font-weight:600; }

/* ══════════════════════════════════════════
   MISC HELPERS
══════════════════════════════════════════ */
.color-success { color:var(--success); }
.color-danger  { color:var(--danger); }
.color-warning { color:var(--warning); }
.color-muted   { color:var(--muted); }
.fw-700 { font-weight:700; }
.fw-600 { font-weight:600; }
.fs-sm  { font-size:.82rem; }
.hidden { display:none !important; }

/* ══════════════════════════════════════════
   REPORT PAGE
══════════════════════════════════════════ */
.rep-tabs  { display:flex; gap:0; margin-bottom:18px; border-bottom:2px solid var(--border); flex-wrap:wrap; }
.rep-tab   { padding:9px 18px; font-size:.83rem; font-weight:600; color:var(--muted); cursor:pointer; border:none; background:none; border-bottom:2px solid transparent; margin-bottom:-2px; transition:all .15s; font-family:inherit; white-space:nowrap; }
.rep-tab.active { color:var(--primary); border-bottom-color:var(--primary); }
.rep-panel { display:none; }
.rep-panel.active { display:block; }
.chart-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:14px; }
.chart-grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:14px; margin-bottom:14px; }
.chart-box  { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px; box-shadow:var(--shadow-xs); }
.chart-ttl  { font-size:.74rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.07em; margin-bottom:12px; }
.kpi-row    { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:16px; }
.kpi        { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 18px; box-shadow:var(--shadow-xs); }
.kpi-lbl    { font-size:.72rem; color:var(--muted); font-weight:700; text-transform:uppercase; margin-bottom:4px; }
.kpi-val    { font-size:1.55rem; font-weight:800; color:var(--primary); }
.kpi-sub    { font-size:.75rem; color:var(--muted); margin-top:2px; }
.low-stock  { color:#ef4444 !important; }
.ok-stock   { color:#10b981 !important; }
.flag-H,.flag-HH { color:#ef4444; font-weight:700; }
.flag-L,.flag-LL { color:#3b82f6; font-weight:700; }
.flag-Normal     { color:#10b981; }

/* ══════════════════════════════════════════
   PERMISSIONS / SETTINGS PAGE
══════════════════════════════════════════ */
.perm-hdr  { display:flex; align-items:center; gap:12px; margin-bottom:20px; flex-wrap:wrap; }
.save-perms { padding:8px 22px; background:var(--primary); color:#fff; border:none; border-radius:8px; font-size:.85rem; font-weight:600; cursor:pointer; font-family:inherit; display:inline-flex; align-items:center; gap:6px; transition:background .15s; }
.save-perms:hover { background:var(--primary-dark); }
.save-perms.muted  { background:var(--muted); }
.save-perms.danger { background:var(--danger); }
.save-perms.muted:hover  { background:#64748b; }
.save-perms.danger:hover { background:#dc2626; }
.text-primary { color:var(--primary); }
.text-warning { color:var(--warning); }
.hint { color:var(--muted); font-size:.9rem; grid-column:1/-1; text-align:center; padding:40px 0; }
.group-btns { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; padding:14px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); }
.group-btn { padding:7px 16px; border-radius:8px; font-size:.82rem; font-weight:600; cursor:pointer; border:2px solid var(--border); background:var(--bg); color:var(--text2); font-family:inherit; transition:all .15s; display:inline-flex; align-items:center; gap:6px; }
.group-btn:hover { border-color:var(--primary); color:var(--primary); background:var(--primary-light); }
.group-btn.active { border-color:var(--primary); background:var(--primary); color:#fff; }
.user-info {
/*    background:var(--primary-light); 
    border:1px solid var(--primary); */
    border-radius:8px; padding:10px 16px; font-size:.84rem; margin-bottom:16px; }

@media (max-width:900px) {
    .chart-grid-2, .chart-grid-3 { grid-template-columns:1fr; }
    .kpi-row { grid-template-columns:1fr 1fr; }
}

/* ── Master-detail expand table (Prescription/Index, etc.) ── */
.detail-tbl { width:100%; border-collapse:collapse; font-size:.83rem; }
.detail-tbl thead tr { background:var(--bg); }
.detail-tbl th { padding:8px 14px; color:var(--muted); font-size:.68rem; text-transform:uppercase; font-weight:700; text-align:start; }
.detail-tbl td { padding:8px 14px; border-bottom:1px solid var(--border); }
.detail-empty { padding:12px; color:var(--muted); }

/* ── Prescription Edit ── */
.rx-builder { display:grid; grid-template-columns:1.4fr .9fr; gap:20px; align-items:start; }
.rx-items-table { width:100%; border-collapse:collapse; font-size:.85rem; margin-top:10px; }
.rx-items-table th { padding:12px 14px; background:var(--bg); color:var(--text2); font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; border-bottom:2px solid var(--border); }
.rx-items-table td { padding:12px 14px; border-bottom:1px solid var(--border); vertical-align:middle; }
.rx-items-table tr:hover td { background:rgba(15,123,108,.03); }
.add-item-row { display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; padding:16px; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); margin-top:12px; }
.add-item-row > div { flex:1; min-width:100px; }
.add-item-row > div:first-child { flex:2.2; min-width:180px; }
.add-item-action-div { flex:0 0 auto !important; min-width:auto !important; display:flex; align-items:center; justify-content:center; }
.remove-btn { background:none; border:none; color:var(--danger); cursor:pointer; padding:6px; border-radius:6px; display:inline-flex; align-items:center; justify-content:center; transition:all .15s; width:28px; height:28px; }
.remove-btn:hover { background:#fee2e2; }
.med-info-table { width:100%; font-size:.85rem; border-collapse:collapse; }
.med-info-table tr { border-bottom:1px dashed #f1f5f9; }
.med-info-table tr:last-child { border:none; }
.med-info-table td { padding:10px 0; }
.med-info-table .td-lbl { color:var(--muted); width:110px; }
.med-info-table .td-val { font-weight:600; color:var(--text1); }
.med-cat-badge { background:#e0f2fe; color:#0369a1; padding:2px 8px; border-radius:4px; font-size:.75rem; font-weight:600; }
.align-self-start { align-self:start; }
.mt-24 { margin-top:24px; }
@media(max-width:900px) { .rx-builder { grid-template-columns:1fr; } }

/* ── Invoice Edit ── */
.inv-wrap { display:grid; grid-template-columns:minmax(0, 1fr) 580px; gap:20px; align-items:start; } /* minmax(0, 1fr) not bare 1fr — see .vh-layout above */
.inv-fields { display:grid; grid-template-columns:1fr 1fr; gap:12px 16px; }
.inv-fields .f-full { grid-column:span 2; }
.ins-breakdown { background:linear-gradient(135deg,#e8f7f4,#d1f0ea); border:1px solid #a8ddd3; border-radius:10px; padding:12px 16px; margin-top:8px; font-size:.84rem; display:none; }
.ins-breakdown-title { font-size:.75rem; font-weight:700; color:var(--primary); text-transform:uppercase; margin-bottom:8px; }
.ins-row { display:flex; justify-content:space-between; padding:4px 0; border-bottom:1px dashed #a8ddd3; }
.ins-row:last-child { border:none; font-weight:700; color:var(--primary); font-size:.9rem; }
.items-tbl { width:100%; border-collapse:collapse; font-size:.87rem; margin-top:10px; }
.items-tbl th { padding:12px; background:var(--bg); color:var(--muted); font-size:.75rem; font-weight:700; text-transform:uppercase; border-bottom:2px solid var(--border); white-space:nowrap; }
.items-tbl td { padding:12px; border-bottom:1px solid var(--border); vertical-align:middle; }
.items-tbl .td-center { text-align:center; }
.items-tbl .td-center-fw { text-align:center; font-weight:600; }
.items-del-btn { background:none; border:none; color:var(--danger); cursor:pointer; padding:4px; display:inline-flex; }
.tot-row { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid var(--border); font-size:.87rem; }
.tot-row:last-child { border:none; font-size:1.1rem; font-weight:700; color:var(--primary); padding-top:12px; }
.add-svc { display:grid; grid-template-columns:2.5fr 1fr .8fr .7fr auto; gap:10px; align-items:end; }
.inv-summary-card { position:sticky; top:20px; }
.inv-save-btn { width:100%; margin-top:16px; justify-content:center; }
.inv-print-btn { width:100%; margin-top:8px; justify-content:center; display:flex; }
.inv-cancel-btn { display:block; text-align:center; margin-top:8px; }
@media(max-width:1100px) { .inv-wrap { grid-template-columns:minmax(0, 1fr); } }
@media(max-width:700px) { .inv-fields { grid-template-columns:1fr; } .inv-fields .f-full { grid-column:1; } .add-svc { grid-template-columns:1fr 1fr; gap:8px; } .add-svc > div:first-child { grid-column:span 2; } }

@media print {
    .sidebar,
    .topbar,
    .print-hide,
    .btn-save,
    .btn-cancel,
    .form-actions,
    .btn-group,
    .vh-btn,
    .flow-btn {
        display: none !important;
    }

    .main-wrap {
        margin: 0 !important;
    }

    .page-body {
        padding: 0 !important;
    }

    body {
        background: #fff !important;
        font-size: 12px !important;
    }

    .dx-fieldset, .dx-fieldset * {
        box-sizing: border-box;
        BACKGROUND-COLOR: WHITE !important;
    }
}

/* ══════════════════════════════════════════════════════════════
   GLOBAL ADDITIONS — ERP REFACTOR
══════════════════════════════════════════════════════════════ */

/* Dashboard chart body */
.chart-body { height: 200px; }

/* Utility */
.m-0 { margin: 0; }
.p-0 { padding: 0 !important; }

/* RTL body font */
html[dir=rtl] body {
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

/* DevExtreme widget RTL font override */
html[dir=rtl] .dx-widget,
html[dir=rtl] .dx-datagrid,
html[dir=rtl] .dx-texteditor-input,
html[dir=rtl] .dx-scheduler-header-panel-cell,
html[dir=rtl] .dx-scheduler-date-table-cell {
    font-family: 'Cairo', 'Tajawal', sans-serif !important;
}

/* DevExtreme datagrid RTL header padding */
.dx-rtl .dx-datagrid-headers .dx-header-row > td .dx-datagrid-text-content {
    padding-left: 24px !important;
    padding-right: 4px !important;
}

/* Tab panel container (Insurance, Settings) */
.tab-panel-container {
    background: var(--surface);
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    margin-bottom: 16px;
}

.tab-panel-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

/* ── Login page: non-RTL-dependent styles ── */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
.login-animate { animation: slideUp .4s cubic-bezier(.22,1,.36,1) both; }
.inp-wrap { position: relative; }
.inp-ico {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 12px;
    color: var(--muted);
    display: flex;
    pointer-events: none;
    transition: color .15s;
}
html[dir=rtl] .inp-ico { left: auto; right: 12px; }
.inp-wrap input { padding-left: 38px; }
html[dir=rtl] .inp-wrap input { padding-left: 12px; padding-right: 38px; }
.inp-wrap:focus-within .inp-ico { color: var(--primary); }
input.input-validation-error { border-color: var(--danger) !important; }
.login-remember { display: flex; align-items: center; gap: 7px; margin-bottom: 20px; }
html[dir=rtl] .login-remember { flex-direction: row-reverse; }
.login-remember input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.login-remember label { font-size: .83rem; color: var(--muted); cursor: pointer; }
.brand-stats { display: flex; gap: 28px; justify-content: center; margin-top: 28px; }
.brand-stat-n { display: block; font-size: 1.5rem; font-weight: 700; color: #6ee7b7; letter-spacing: -.02em; }
.brand-stat-l { font-size: .65rem; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .1em; margin-top: 2px; }
.brand-sep { width: 32px; height: 2px; background: rgba(255,255,255,.2); border-radius: 2px; margin: 0 auto 24px; }
.brand-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.07); }
.brand-ring-1 { width: 380px; height: 380px; top: -80px; right: -100px; }
.brand-ring-2 { width: 250px; height: 250px; bottom: -60px; left: -60px; }
.brand-dots { position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px); background-size: 24px 24px; }
.login-form-tag { width: 30px; height: 3px; background: var(--primary); border-radius: 3px; margin-bottom: 16px; }
.login-lang-sw { position: absolute; top: 20px; right: 20px; }
html[dir=rtl] .login-lang-sw { right: auto; left: 20px; }

/* ── Report / Patient History template classes ── */
.ph-header-card {
    background: linear-gradient(135deg, var(--primary) 0%, #0a6b5e 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
    display: flex;
    gap: 20px;
    align-items: center;
}
.ph-avatar {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,.18);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}
.ph-info { flex: 1; }
.ph-name { font-size: 1.1rem; font-weight: 700; }
.ph-meta { font-size: .82rem; opacity: .85; }
.ph-allergy { font-size: .78rem; background: rgba(239,68,68,.2); border-radius: 4px; padding: 2px 8px; margin-top: 4px; display: inline-block; }
.ph-count { text-align: center; }
.ph-count-n { font-size: 1.8rem; font-weight: 800; }
.ph-count-l { font-size: .75rem; opacity: .8; }
.ph-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.ph-scroll { max-height: 280px; overflow-y: auto; }
.ph-scroll-sm { max-height: 240px; overflow-y: auto; }
.ph-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.ph-item:last-child { border-bottom: none; }
.ph-item-row { display: flex; justify-content: space-between; align-items: center; }
.ph-item-row-top { display: flex; justify-content: space-between; }
.ph-date { font-size: .8rem; font-weight: 700; }
.ph-doc { font-size: .78rem; color: var(--muted); }
.ph-diag { font-size: .75rem; color: var(--text2); margin-top: 2px; }
.ph-med { font-size: .75rem; color: var(--text2); padding: 1px 0; }
.ph-lab-item { font-size: .75rem; padding: 1px 0; }
.ph-status-sm { font-size: .7rem; color: var(--muted); }
.ph-empty { color: var(--muted); padding: 20px 0; text-align: center; }
.ph-inv-row { display: flex; justify-content: space-between; align-items: center; }
.ph-inv-no { font-size: .8rem; font-weight: 700; }
.ph-inv-date { font-size: .72rem; color: var(--muted); }
.ph-inv-amt { font-weight: 700; text-align: end; }
.ph-inv-balance { font-size: .72rem; color: var(--warning); }
.ph-inv-paid { font-size: .72rem; color: var(--success); }

/* Report insurance summary grid */
.fin-ins-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fin-ins-item .lbl { color: var(--muted); }
.fin-ins-item .val { font-weight: 700; }

/* ══════════════════════════════════════════
   Post-login system selector
   ══════════════════════════════════════════ */
.selector-intro {
    text-align: center;
    max-width: 640px;
    margin: 24px auto 32px;
}

.selector-intro h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text1);
    margin-bottom: 6px;
}

.selector-intro p {
    font-size: .9rem;
    color: var(--text3);
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
}

.system-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow .2s, transform .15s, border-color .15s;
}

.system-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.system-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.system-card-icon svg {
    width: 26px;
    height: 26px;
}

.system-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text1);
}

.system-card-desc {
    font-size: .8rem;
    color: var(--text3);
    line-height: 1.5;
    flex: 1;
    margin-bottom: 14px;
}

.system-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
    align-self: stretch;
    justify-content: center;
}

.system-card-btn svg {
    width: 15px;
    height: 15px;
}

.system-card-btn:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
}

/* ── Registration Wizard ─────────────────────────────────────────────────── */
.wizard-page {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 32px 16px;
    box-sizing: border-box;
}

.wizard-card {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    box-sizing: border-box;
}

.wizard-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    font-weight: 800;
    color: var(--text1);
    font-size: 1.05rem;
}

.wizard-steps {
    display: flex;
    align-items: flex-start;
    margin-bottom: 32px;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

.wizard-step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    background: var(--border-2);
    color: var(--muted);
    transition: all .15s;
}

.wizard-step.active .wizard-step-dot { background: var(--primary); color: #fff; }
.wizard-step.done .wizard-step-dot { background: var(--primary-dark); color: #fff; }

.wizard-step-label {
    font-size: .72rem;
    color: var(--muted);
    margin-top: 6px;
    text-align: center;
    max-width: 90px;
}

.wizard-step.active .wizard-step-label { color: var(--text1); font-weight: 600; }

.wizard-step-line {
    flex: 1;
    height: 2px;
    background: var(--border-2);
    margin: 15px 6px 0;
}

.wizard-step-line.done { background: var(--primary-dark); }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

.wizard-panel-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text1);
    margin-bottom: 4px;
}

.wizard-panel-sub {
    font-size: .84rem;
    color: var(--muted);
    margin-bottom: 24px;
}

.wizard-row { display: flex; gap: 16px; }
.wizard-row .login-field { flex: 1; }

.wizard-hint { font-size: .75rem; color: var(--muted); margin-top: 5px; }
.wizard-hint.ok { color: var(--success, #16a34a); }
.wizard-hint.bad { color: var(--danger, #dc2626); }

.wizard-systems-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.wizard-system-card {
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    transition: all .15s;
}

.wizard-system-card.selected { border-color: var(--primary); background: rgba(13,148,136,.05); }
.wizard-system-card input { margin-top: 3px; accent-color: var(--primary); cursor: pointer; }
.wizard-system-name { font-weight: 700; font-size: .85rem; color: var(--text1); }
.wizard-system-desc { font-size: .74rem; color: var(--muted); margin-top: 2px; }

.wizard-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border-2);
    font-size: .85rem;
}

.wizard-summary-row dt { color: var(--muted); }
.wizard-summary-row dd { color: var(--text1); font-weight: 600; text-align: end; }

.wizard-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 28px;
}

.wizard-btn {
    height: 42px;
    padding: 0 22px;
    border-radius: var(--radius-sm);
    font-size: .87rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: var(--primary);
    color: #fff;
    transition: all .15s;
}

.wizard-btn:hover { background: var(--primary-dark); }
.wizard-btn:disabled { opacity: .5; cursor: not-allowed; }

.wizard-btn-secondary {
    background: #fff;
    color: var(--text2);
    border: 1px solid var(--border-2);
}

.wizard-btn-secondary:hover { background: var(--bg); }

.wizard-success {
    text-align: center;
    padding: 20px 0;
}

.wizard-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(13,148,136,.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
}
