/* ==========================================================================
   HealthCorex — application styles
   Loaded after Bootstrap. Only override Bootstrap deliberately; never
   re-style bare element selectors (button, input, form) — that fights the
   framework and leaks into every page.
   ========================================================================== */

:root {
    /* Brand */
    --hc-primary: #1687a7;
    --hc-primary-600: #12768f;
    --hc-primary-700: #0e6076;
    --hc-primary-soft: #e7f4f8;

    /* Sidebar */
    --hc-sidebar: #0e2a35;
    --hc-sidebar-hover: #173d4b;
    --hc-sidebar-text: #a9c2cc;
    --hc-sidebar-width: 256px;

    /* Surfaces */
    --hc-bg: #f4f7fa;
    --hc-surface: #ffffff;
    --hc-border: #e4e9ef;

    /* Text */
    --hc-text: #16232b;
    --hc-muted: #6b7f8a;

    --hc-radius: 10px;
    --hc-shadow: 0 1px 2px rgba(16, 40, 52, .04), 0 4px 16px rgba(16, 40, 52, .06);
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--hc-bg);
    color: var(--hc-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: .925rem;
    -webkit-font-smoothing: antialiased;
}

/* ============================ App shell ============================ */

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--hc-sidebar-width);
    background: var(--hc-sidebar);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .2s ease;
}

.app-main {
    margin-left: var(--hc-sidebar-width);
    min-width: 0;
    transition: margin-left .2s ease;
}

body.sidebar-hidden .sidebar {
    transform: translateX(-100%);
}

body.sidebar-hidden .app-main {
    margin-left: 0;
}

/* ---- Brand ----
   Rendered as vector + live text rather than the PNG: the supplied logo files are
   1024x1024 canvases with a small, low-contrast wordmark and a glow halo, so they
   turn to mush at sidebar size. See docs/DEVELOPMENT.md (Brand assets). */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.05rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    text-decoration: none;
}

    .sidebar-brand:hover {
        text-decoration: none;
    }

    .sidebar-brand svg {
        flex: 0 0 auto;
    }

.brand-word {
    color: #fff;
    font-weight: 650;
    font-size: 1.06rem;
    letter-spacing: -.01em;
    line-height: 1;
}

    .brand-word b {
        font-weight: 650;
        color: #5fd0e8;
    }

/* ---- Nav ---- */
.sidebar-nav {
    padding: .875rem .75rem;
    flex: 1;
}

.nav-section {
    color: #64828f;
    font-size: .655rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    padding: .875rem .75rem .375rem;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: var(--hc-sidebar-text);
    font-weight: 500;
    font-size: .89rem;
    padding: .58rem .75rem;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: background-color .15s, color .15s;
}

    .sidebar .nav-link i {
        font-size: 1.02rem;
        width: 1.15rem;
        text-align: center;
        flex: 0 0 auto;
    }

    .sidebar .nav-link:hover {
        background: var(--hc-sidebar-hover);
        color: #fff;
        text-decoration: none;
    }

    .sidebar .nav-link.active {
        background: var(--hc-primary);
        color: #fff;
        box-shadow: 0 2px 8px rgba(22, 135, 167, .35);
    }

/* ---- Sidebar footer ---- */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, .07);
    padding: .75rem;
}

    .sidebar-footer .nav-link {
        color: #8fa8b3;
    }

/* ============================ Topbar ============================ */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 60px;
    padding: 0 1.25rem;
    background: var(--hc-surface);
    border-bottom: 1px solid var(--hc-border);
}

.topbar-toggle {
    border: 0;
    background: transparent;
    color: var(--hc-muted);
    font-size: 1.25rem;
    line-height: 1;
    padding: .35rem .5rem;
    border-radius: 8px;
}

    .topbar-toggle:hover {
        background: var(--hc-bg);
        color: var(--hc-text);
    }

/* Organization (hospital) name — always visible so you know whose data you're in. */
.org-name {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 650;
    font-size: .92rem;
    color: var(--hc-text);
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .org-name i {
        color: var(--hc-primary);
        font-size: 1rem;
    }

.topbar-search {
    position: relative;
    max-width: 340px;
    flex: 1;
}

@media (max-width: 768px) {
    .org-name span {
        display: none;
    }
}

    .topbar-search i {
        position: absolute;
        left: .7rem;
        top: 50%;
        transform: translateY(-50%);
        color: #9aacb6;
        font-size: .9rem;
    }

    .topbar-search input {
        padding-left: 2.1rem;
        background: var(--hc-bg);
        border-color: transparent;
        height: 38px;
    }

        .topbar-search input:focus {
            background: #fff;
        }

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.icon-btn {
    border: 0;
    background: transparent;
    color: var(--hc-muted);
    font-size: 1.05rem;
    padding: .4rem .5rem;
    border-radius: 8px;
}

    .icon-btn:hover {
        background: var(--hc-bg);
        color: var(--hc-text);
    }

.user-menu {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem .5rem .25rem .25rem;
    border-radius: 999px;
    color: var(--hc-text);
    font-weight: 500;
    font-size: .875rem;
}

    .user-menu:hover {
        background: var(--hc-bg);
        text-decoration: none;
        color: var(--hc-text);
    }

    .user-menu img {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        object-fit: cover;
    }

/* ============================ Content ============================ */

.app-content {
    padding: 1.5rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

    .page-header h3 {
        font-size: 1.35rem;
        font-weight: 650;
        margin: 0;
    }

.page-subtitle {
    color: var(--hc-muted);
    font-size: .85rem;
}

/* ============================ Components ============================ */

.card {
    background: var(--hc-surface);
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius);
    box-shadow: var(--hc-shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--hc-border);
    padding: .8rem 1rem;
    font-size: .9rem;
}

/* KPI tiles */
.kpi {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1.1rem;
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    flex: 0 0 auto;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 650;
    line-height: 1.1;
}

.kpi-label {
    color: var(--hc-muted);
    font-size: .8rem;
}

/* ==========================================================================
   Scheduler — provider rail + time-axis calendar
   ========================================================================== */
.sched-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.sched-rail .provider-list {
    max-height: 320px;
    overflow-y: auto;
    margin: 0 -.25rem;
    padding: 0 .25rem;
}

.provider-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .32rem .35rem;
    border-radius: 6px;
    font-size: .84rem;
    cursor: pointer;
}

    .provider-item:hover {
        background: var(--hc-bg);
    }

    .provider-item .name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .provider-item .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--hc-primary);
        flex: 0 0 auto;
    }

/* Toolbar */
.sched-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .85rem;
    border-bottom: 1px solid var(--hc-border);
    flex-wrap: wrap;
}

.sched-heading {
    font-weight: 650;
    font-size: .95rem;
}

.sched-toolbar .btn-group .btn {
    text-transform: capitalize;
}

/* Time grid */
.grid-scroll {
    overflow: auto;
    max-height: 68vh;
}

.cal-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

    .cal-grid thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background: #fafbfd;
        border-bottom: 1px solid var(--hc-border);
        border-left: 1px solid var(--hc-border);
        padding: .45rem .5rem;
        text-align: left;
    }

    .cal-grid .col-title {
        font-size: .8rem;
        font-weight: 650;
        color: var(--hc-text);
    }

    .cal-grid .col-sub {
        font-size: .68rem;
        color: var(--hc-muted);
    }

    .cal-grid .time-col {
        width: 58px;
        min-width: 58px;
        color: var(--hc-muted);
        font-size: .7rem;
        text-align: right;
        padding: 0 .45rem;
        vertical-align: top;
        transform: translateY(-.4em);
        border-right: 1px solid var(--hc-border);
        white-space: nowrap;
    }

    .cal-grid td.slot {
        height: 30px;
        border-bottom: 1px dashed #eef1f5;
        border-left: 1px solid var(--hc-border);
        vertical-align: top;
        padding: 1px;
    }

    .cal-grid tr:nth-child(2n) td.slot {
        border-bottom: 1px solid var(--hc-border);
    }

    .cal-grid td.closed {
        background: repeating-linear-gradient(45deg, #f6f8fa, #f6f8fa 6px, #f1f4f7 6px, #f1f4f7 12px);
    }

    .cal-grid td.open {
        background: #fff;
    }

    .cal-grid td.has-ev {
        border-left: 1px solid var(--hc-border);
        padding: 1px;
    }

/* Free slot affordance */
.free {
    display: grid;
    place-items: center;
    height: 100%;
    min-height: 26px;
    color: transparent;
    border-radius: 4px;
    transition: background-color .12s, color .12s;
}

    .free:hover {
        background: var(--hc-primary-soft);
        color: var(--hc-primary-700);
        text-decoration: none;
    }

/* Event blocks */
.ev {
    height: 100%;
    border-radius: 5px;
    padding: .25rem .4rem;
    font-size: .72rem;
    line-height: 1.25;
    overflow: hidden;
    border-left: 3px solid transparent;
    position: relative;
}

.ev-time {
    font-weight: 700;
    font-size: .68rem;
    opacity: .85;
}

.ev-status {
    font-weight: 600;
    opacity: .7;
    text-transform: uppercase;
    font-size: .6rem;
    margin-left: .15rem;
}

.ev-name {
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ev-sub {
    opacity: .75;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ev-mini {
    height: auto;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .ev-mini .t {
        font-weight: 700;
    }

.ev-actions {
    position: absolute;
    top: 2px;
    right: 2px;
    display: none;
    gap: 2px;
}

.ev:hover .ev-actions {
    display: flex;
}

.ev-btn {
    border: 0;
    background: rgba(255, 255, 255, .75);
    border-radius: 4px;
    width: 18px;
    height: 18px;
    line-height: 1;
    font-size: .68rem;
    color: #333;
    padding: 0;
}

    .ev-btn:hover {
        background: #fff;
    }

/* Status colours — paired with a text label, never colour alone */
.ev-booked    { background: #e4eefb; border-left-color: #2a78d6; color: #17427a; }
.ev-completed { background: #e4f5ee; border-left-color: #1baf7a; color: #12603f; }
.ev-cancelled { background: #eef1f5; border-left-color: #98a6b3; color: #55636f; }
.ev-noshow    { background: #fdf1e0; border-left-color: #eda100; color: #7a5410; }

/* Legend */
.sched-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .55rem .85rem;
    border-top: 1px solid var(--hc-border);
    font-size: .76rem;
    color: var(--hc-text);
}

.leg {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.leg-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    border: 0;
}

    .leg-dot.ev-booked { background: #2a78d6; }
    .leg-dot.ev-completed { background: #1baf7a; }
    .leg-dot.ev-cancelled { background: #98a6b3; }
    .leg-dot.ev-noshow { background: #eda100; }

/* Month grid */
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-head {
    background: #fafbfd;
    border-bottom: 1px solid var(--hc-border);
    border-left: 1px solid var(--hc-border);
    padding: .4rem .5rem;
    font-size: .7rem;
    font-weight: 700;
    color: var(--hc-muted);
    text-transform: uppercase;
}

.month-cell {
    min-height: 104px;
    border-bottom: 1px solid var(--hc-border);
    border-left: 1px solid var(--hc-border);
    padding: .3rem;
}

    .month-cell.out {
        background: #fafbfc;
    }

    .month-cell.today {
        background: var(--hc-primary-soft);
    }

.month-daynum {
    display: inline-block;
    font-size: .74rem;
    font-weight: 650;
    color: var(--hc-muted);
    margin-bottom: .2rem;
}

.month-cell.out .month-daynum {
    opacity: .45;
}

.month-ev {
    border-radius: 4px;
    padding: .1rem .3rem;
    font-size: .68rem;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid transparent;
}

    .month-ev .t {
        font-weight: 700;
    }

.month-more {
    font-size: .66rem;
    color: var(--hc-muted);
    padding-left: .3rem;
}

@media (max-width: 1100px) {
    .sched-layout {
        grid-template-columns: 1fr;
    }
}

/* ---- Patient record workspace ----
   Identity banner stays on screen wherever you are in the record. */
.patient-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--hc-sidebar);
    border-radius: var(--hc-radius);
    padding: .95rem 1.15rem;
    margin-bottom: 1rem;
}

.patient-avatar {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: var(--hc-primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.15rem;
    flex: 0 0 auto;
}

.patient-ident h4 {
    color: #fff;
    font-weight: 650;
    font-size: 1.2rem;
    margin: 0 0 .15rem;
}

.patient-meta {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
    color: #9db6c1;
    font-size: .82rem;
}

    .patient-meta .sep {
        color: #4d6975;
    }

.patient-chips {
    margin-left: auto;
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: rgba(255, 255, 255, .09);
    color: #cfe0e7;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 999px;
    padding: .22rem .6rem;
    font-size: .74rem;
    font-weight: 600;
}

.chip-warn { background: rgba(250, 178, 25, .16); color: #fac95f; border-color: rgba(250, 178, 25, .3); }
.chip-ok   { background: rgba(27, 175, 122, .16); color: #6fd6ab; border-color: rgba(27, 175, 122, .3); }

/* Record tabs */
.record-tabs {
    border-bottom: 1px solid var(--hc-border);
    gap: .15rem;
}

    .record-tabs .nav-link {
        border: 0;
        border-bottom: 2px solid transparent;
        background: transparent;
        color: var(--hc-muted);
        font-weight: 600;
        font-size: .85rem;
        padding: .55rem .85rem;
        border-radius: 0;
    }

        .record-tabs .nav-link:hover {
            color: var(--hc-text);
        }

        .record-tabs .nav-link.active {
            color: var(--hc-primary-700);
            border-bottom-color: var(--hc-primary);
            background: transparent;
        }

.tab-count {
    display: inline-block;
    background: var(--hc-bg);
    border: 1px solid var(--hc-border);
    color: var(--hc-muted);
    border-radius: 999px;
    font-size: .68rem;
    padding: 0 .38rem;
    margin-left: .25rem;
}

/* Definition lists inside record cards */
.record-dl {
    display: grid;
    grid-template-columns: 40% 60%;
    row-gap: .5rem;
    margin: 0;
    font-size: .85rem;
}

    .record-dl dt {
        color: var(--hc-muted);
        font-weight: 500;
    }

    .record-dl dd {
        margin: 0;
        color: var(--hc-text);
    }

/* Alert tiles (right rail) */
.alert-tile {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    border-radius: 8px;
    padding: .6rem .7rem;
    font-size: .82rem;
    border: 1px solid transparent;
}

    .alert-tile i {
        font-size: 1rem;
        line-height: 1.2;
    }

.alert-warn { background: #fdf6e7; border-color: #f6e2b3; color: #7a5410; }
.alert-info { background: var(--hc-primary-soft); border-color: #cfe7ee; color: var(--hc-primary-700); }

/* Money columns line up */
.num {
    font-variant-numeric: tabular-nums;
}

/* ---- Charting (EHR) ---- */
.icd {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    background: var(--hc-primary-soft);
    color: var(--hc-primary-700);
    border: 1px solid #cfe7ee;
    border-radius: 6px;
    padding: .12rem .4rem;
    font-size: .72rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.icd-x {
    border: 0;
    background: transparent;
    color: var(--hc-primary-700);
    opacity: .55;
    padding: 0 0 0 .1rem;
    line-height: 1;
    font-size: .85rem;
}

    .icd-x:hover {
        opacity: 1;
    }

.soap dt {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--hc-muted);
    margin-top: .8rem;
}

.soap dd {
    margin: .2rem 0 0;
    white-space: pre-wrap;
}

.note-timeline {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.note-item {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
}

.note-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    font-size: .8rem;
    margin-top: .4rem;
}

    .note-dot.signed { background: #e4f5ee; color: #12603f; }
    .note-dot.draft  { background: #fdf1e0; color: #7a5410; }

.note-snippet {
    font-size: .85rem;
    color: var(--hc-text);
}

    .note-snippet .lbl {
        font-size: .66rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--hc-muted);
        margin-right: .3rem;
    }

/* ---- Charts ----
   Titles/subtitles per card, one filter row above them, fixed-height plot boxes.
   Ink + chrome come from the validated dataviz palette; text never wears a series colour. */
.viz-title {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #0b0b0b;
}

.viz-subtitle {
    font-size: .78rem;
    color: #898781;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    margin-top: .1rem;
}

.viz-filter {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.chart-box {
    position: relative;
    height: 240px;
}

.kpi-value {
    font-variant-numeric: proportional-nums;
}

/* Report hero figures — large standalone numbers keep proportional figures. */
.stat-hero {
    font-size: 2rem;
    font-weight: 650;
    line-height: 1.1;
    color: var(--hc-text);
    margin-bottom: .15rem;
}

.tint-primary { background: var(--hc-primary-soft); color: var(--hc-primary-700); }
.tint-green   { background: #e6f6ee; color: #1b7a4b; }
.tint-amber   { background: #fdf1e0; color: #9a6212; }
.tint-slate   { background: #eef1f5; color: #4a5b68; }

/* Tables */
.table {
    margin: 0;
    font-size: .875rem;
}

    .table > thead > tr > th {
        background: #fafbfd;
        color: var(--hc-muted);
        font-weight: 600;
        font-size: .74rem;
        letter-spacing: .05em;
        text-transform: uppercase;
        border-bottom: 1px solid var(--hc-border);
        padding: .7rem .9rem;
        white-space: nowrap;
    }

    .table > tbody > tr > td {
        padding: .75rem .9rem;
        border-bottom: 1px solid #f0f3f7;
        vertical-align: middle;
    }

    .table > tbody > tr:last-child > td {
        border-bottom: 0;
    }

.table-hover > tbody > tr:hover > td {
    background: #f8fbfc;
}

/* Buttons — keep Bootstrap's sizing; only restyle colour. */
.btn {
    font-weight: 500;
    font-size: .875rem;
    border-radius: 8px;
    padding: .45rem .9rem;
}

.btn-primary {
    background-color: var(--hc-primary);
    border-color: var(--hc-primary);
}

    .btn-primary:hover,
    .btn-primary:focus,
    .btn-primary:active {
        background-color: var(--hc-primary-600) !important;
        border-color: var(--hc-primary-600) !important;
    }

.btn-outline-primary {
    color: var(--hc-primary-700);
    border-color: #bcdbe4;
}

    .btn-outline-primary:hover {
        background-color: var(--hc-primary);
        border-color: var(--hc-primary);
    }

.btn-outline-secondary {
    color: #55697a;
    border-color: var(--hc-border);
    background: #fff;
}

    .btn-outline-secondary:hover {
        background: var(--hc-bg);
        color: var(--hc-text);
        border-color: #d3dae3;
    }

/* Forms */
.form-label {
    font-size: .8rem;
    font-weight: 600;
    color: #465a67;
    margin-bottom: .3rem;
}

.form-control,
.form-select {
    border-color: #dbe2ea;
    border-radius: 8px;
    font-size: .875rem;
    padding: .45rem .7rem;
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--hc-primary);
        box-shadow: 0 0 0 .18rem rgba(22, 135, 167, .16);
    }

/* Badges */
.badge {
    font-weight: 600;
    font-size: .7rem;
    padding: .34em .6em;
    border-radius: 6px;
}

.bg-light.text-dark {
    background: var(--hc-bg) !important;
    border: 1px solid var(--hc-border);
    color: #47606d !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Empty state rows */
.table .text-muted.text-center {
    padding: 2rem 0 !important;
}

/* Alerts */
.alert {
    border: 1px solid transparent;
    border-radius: var(--hc-radius);
    font-size: .875rem;
}

.alert-info {
    background: var(--hc-primary-soft);
    border-color: #cfe7ee;
    color: var(--hc-primary-700);
}

/* Toasts sit above everything */
.toast-container {
    z-index: 1100;
}

/* ============================ Responsive ============================ */

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .app-main {
        margin-left: 0;
    }

    body.sidebar-shown .sidebar {
        transform: translateX(0);
    }

    .topbar-search {
        display: none;
    }
}

/* ==========================================================================
   Login page (standalone _AuthLayout)
   ========================================================================== */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--hc-bg);
}

.login-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 940px;
    min-height: 460px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(14, 42, 53, .12);
}

.logo-section {
    background: linear-gradient(160deg, var(--hc-sidebar) 0%, var(--hc-primary-700) 100%);
    padding: 2rem;
}

/* Login hero brand — horizontal lockup matching the sidebar, crisp inline SVG (no bitmap). */
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    color: #fff;
}

.auth-brand-lockup {
    display: flex;
    align-items: center;
    gap: .7rem;
}

    .auth-brand-lockup svg {
        flex: 0 0 auto;
        filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .28));
    }

.auth-brand-word {
    font-size: 2.05rem;
    font-weight: 650;
    letter-spacing: -.01em;
    line-height: 1;
    color: #fff;
}

    /* Two-tone wordmark, same as the sidebar: "Health" white, "Corex" cyan. */
    .auth-brand-word b {
        font-weight: 650;
        color: #5fd0e8;
    }

.auth-tagline {
    font-size: .84rem;
    font-weight: 400;
    opacity: .8;
    letter-spacing: .02em;
}

.login-form-section {
    padding: 2.5rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

    .login-form-section h4 {
        font-weight: 650;
        margin-bottom: 1.5rem;
    }

.forgot-password-link {
    font-size: .82rem;
    color: var(--hc-primary-700);
    text-decoration: none;
}

    .forgot-password-link:hover {
        text-decoration: underline;
    }

@media (max-width: 768px) {
    .login-box {
        grid-template-columns: 1fr;
        max-width: 420px;
    }

    .logo-section {
        padding: 1.75rem;
    }

    .auth-brand-lockup svg {
        width: 44px;
        height: 44px;
    }

    .auth-brand-word {
        font-size: 1.7rem;
    }
}

/* ============================================================
   Front Desk — reception patient-flow board
   ============================================================ */
.fd-datebar {
    display: flex;
    flex-direction: row; /* override Bootstrap .card's column direction */
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .6rem .9rem;
}

.fd-date {
    font-weight: 600;
    margin-left: .5rem;
}

.fd-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .fd-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .fd-board {
        grid-template-columns: 1fr;
    }
}

.fd-col {
    background: var(--hc-surface-2, #f1f5f9);
    border: 1px solid var(--hc-border, #e2e8f0);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.fd-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem .85rem;
    font-weight: 650;
    font-size: .9rem;
    color: #0f2a35;
    border-bottom: 2px solid transparent;
    background: #fff;
}

.fd-col.fd-await .fd-col-head { border-bottom-color: #94a3b8; }
.fd-col.fd-in .fd-col-head { border-bottom-color: #2a78d6; }
.fd-col.fd-ready .fd-col-head { border-bottom-color: #f0a020; }
.fd-col.fd-out .fd-col-head { border-bottom-color: #1baf7a; }

.fd-count {
    min-width: 1.5rem;
    text-align: center;
    background: #eef2f7;
    border-radius: 999px;
    padding: .05rem .5rem;
    font-size: .8rem;
    color: #475569;
}

.fd-col-body {
    padding: .7rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.fd-empty {
    text-align: center;
    color: #94a3b8;
    padding: .75rem 0;
}

.fd-card {
    background: #fff;
    border: 1px solid var(--hc-border, #e2e8f0);
    border-radius: 10px;
    padding: .65rem .7rem;
    box-shadow: 0 1px 2px rgba(15, 42, 53, .04);
}

.fd-card-top {
    display: flex;
    gap: .6rem;
    align-items: center;
}

.fd-avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #2a78d6, #31d2ef);
    color: #fff;
    font-weight: 650;
    font-size: .78rem;
}

.fd-who {
    min-width: 0;
}

.fd-name {
    font-weight: 620;
    color: #0f2a35;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .fd-name:hover {
        text-decoration: underline;
    }

.fd-meta {
    font-size: .78rem;
    color: #64748b;
}

.fd-dot {
    margin: 0 .25rem;
}

.fd-reason {
    margin-top: .5rem;
    font-size: .8rem;
    color: #475569;
    background: #f8fafc;
    border-radius: 6px;
    padding: .3rem .5rem;
}

.fd-stamp {
    margin-top: .5rem;
    font-size: .76rem;
    color: #1baf7a;
    font-weight: 550;
}

.fd-actions {
    display: flex;
    gap: .4rem;
    margin-top: .6rem;
    flex-wrap: wrap;
}

    .fd-actions form {
        margin: 0;
    }

.fd-exceptions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.fd-exception {
    font-size: .8rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    display: inline-flex;
    align-items: center;
}

    .fd-exception.is-noshow {
        background: #fef2f2;
        color: #b42318;
    }

    .fd-exception.is-cancelled {
        background: #f3f4f6;
        color: #6b7280;
        text-decoration: line-through;
    }
