:root {
    --bg: #edf5fd;
    --bg-elevated: #f7fbff;
    --panel: #ffffff;
    --ink: #103c68;
    --muted: #5a7f9f;
    /* Minimal borders: hairline tint */
    --line: rgba(16, 60, 104, 0.11);
    --line-strong: rgba(16, 60, 104, 0.2);
    --brand: #1f8be3;
    --brand-hover: #1678c9;
    --accent: #2d6ea6;
    --accent-soft: #e7f2fe;
    --success: #1aa4a5;
    --danger: #9c2f2f;
    --print-action: #6b7d8f;
    --print-action-hover: #556575;
    /* Soft, diffuse shadows */
    --shadow-sm: 0 1px 2px rgba(16, 60, 104, 0.04), 0 8px 24px rgba(16, 60, 104, 0.07);
    --shadow-md: 0 4px 12px rgba(16, 60, 104, 0.06), 0 14px 34px rgba(16, 60, 104, 0.1);
    --shadow-lg: 0 8px 22px rgba(16, 60, 104, 0.08), 0 22px 44px rgba(16, 60, 104, 0.14);
    /* UI radius direction: 8px controls, 12px cards & shells */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 12px;
    --font-display: "Lexend", system-ui, sans-serif;
    --font-ui: "Lexend", system-ui, sans-serif;
    --space-section: 112px;
    --focus-ring: 0 0 0 3px #fff, 0 0 0 5px rgba(76, 181, 150, 0.8);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font-ui);
    font-weight: 400;
    font-size: 15px;
    line-height: 1.55;
    background-color: var(--bg);
    padding-top: 76px;
    padding-bottom: 64px;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 14px;
    z-index: 100;
    padding: 11px 16px;
    background: var(--panel);
    color: var(--ink);
    border: 2px solid var(--brand);
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 14px;
    outline: none;
}

a:not(.brand-block):not(.nav-link):not(button):not(.btn-table-action):not(.header-action-btn) {
    color: var(--ink);
    font-weight: 600;
    text-underline-offset: 3px;
}

a:not(.brand-block):not(.nav-link):not(button):not(.btn-table-action):not(.header-action-btn):hover {
    color: var(--accent);
}

.site-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 20px;
    width: 95%;
    margin: 0;
    padding: 12px clamp(14px, 3vw, 22px);
    color: var(--ink);
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(16, 60, 104, 0.04);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.brand-block:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    border: 0;
    background: linear-gradient(155deg, #3fbaf8 0%, #1e83dd 70%);
    font-family: var(--font-ui);
    font-size: 13px;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.brand-title {
    font-size: clamp(1.2rem, 2.4vw, 1.45rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.brand-tagline {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    opacity: 0.95;
    letter-spacing: 0.02em;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 600;
}

.header-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--accent);
    background: #fff;
}

.header-datetime {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.header-datetime-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--muted);
}

.header-datetime-text {
    line-height: 1.35;
    letter-spacing: 0.01em;
}

.header-chip-link {
    text-decoration: none;
}

.auth-page {
    padding: 0;
    overflow-x: hidden;
    background-color: #d9ebf9;
    background-image:
        linear-gradient(165deg, rgba(232, 244, 252, 0.78) 0%, rgba(220, 238, 250, 0.72) 45%, rgba(207, 229, 245, 0.72) 100%),
            url("../images/login-bg.png");
            background-position: center center;
            background-repeat: no-repeat;
            background-size: cover;
            background-attachment: fixed;
}

.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: clamp(16px, 2vw, 28px);
}

.auth-layout {
    width: min(560px, 100%);
    display: grid;
    grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        align-items: stretch;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: #ffffff;
    box-shadow: var(--shadow-lg);
}

.auth-layout .auth-card {
    border-top: 1px solid var(--line);
}

/* Login — match Dentara stacked card (brand top / form bottom) */
.auth-page .auth-shell {
    padding:
        clamp(14px, 3vw, 28px)
        clamp(40px, 10vw, 96px)
        clamp(14px, 3vw, 28px)
        clamp(14px, 3vw, 32px);
    justify-items: end;
    box-sizing: border-box;
}

.auth-page .auth-layout {
    width: min(400px, calc(100% - 72px));
    margin-right: clamp(20px, 4.5vw, 52px);
    border-radius: 16px;
    border-color: rgba(16, 60, 104, 0.09);
    background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(4px);
    box-shadow:
        0 16px 48px rgba(16, 60, 104, 0.11),
        0 4px 14px rgba(16, 60, 104, 0.06);
}

.auth-page .auth-brand-panel {
    padding: clamp(30px, 5.8vw, 48px) clamp(22px, 5vw, 30px) clamp(26px, 4.8vw, 42px);
    background:
        linear-gradient(97deg, #061526 0%, #0c3558 44%, #1f72b8 100%),
        url("../images/dental-emr-login-hero.svg") 88% 42% / min(200%, 820px) no-repeat;
}

.auth-page .auth-brand-panel::before {
    background-image: repeating-linear-gradient(0deg,
            rgba(255, 255, 255, 0.05),
            rgba(255, 255, 255, 0.05) 1px,
            transparent 1px,
            transparent 12px);
    background-size: 100% 12px;
    opacity: 0.55;
}

.auth-page .auth-brand-panel::after {
    background: radial-gradient(ellipse 90% 70% at 78% 28%, rgba(120, 200, 255, 0.14), transparent 55%);
}

.auth-page .auth-brand-panel .auth-kicker {
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 6px 12px;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
}

.auth-page .auth-brand-panel h1 {
    margin-bottom: 10px;
    max-width: none;
    font-size: clamp(2.5rem, 9vw, 3.15rem);
    font-weight: 700;
}

.auth-page .auth-brand-lede {
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.65;
    max-width: none;
    color: rgba(255, 255, 255, 0.9);
}

.auth-page .auth-layout .auth-card {
    padding-top: clamp(28px, 5.8vw, 46px);
    padding-bottom: clamp(28px, 5.2vw, 44px);
    padding-left: clamp(22px, 5vw, 32px);
    padding-right: clamp(32px, 7vw, 52px);
    background: #ffffff;
    border-top-color: rgba(16, 60, 104, 0.1);
}

/* .card comes later in the sheet and was re-adding margin + shadow — looked like a stacked sheet at the bottom */
.auth-page .auth-layout > .card.auth-card {
    margin-bottom: 0;
    box-shadow: none;
}

.auth-page .auth-layout .auth-card .auth-card-head {
    margin-bottom: 18px;
}

.auth-page .auth-layout .auth-card h2 {
    font-family: var(--font-ui);
    margin-top: 14px;
    margin-bottom: 14px;
    font-size: clamp(1.45rem, 4.5vw, 1.75rem);
    font-weight: 700;
    color: #103c68;
    letter-spacing: -0.02em;
}

.auth-page .auth-layout .auth-card .muted {
    margin-bottom: 1.05em;
    color: #6b879e;
    font-size: 13px;
    line-height: 1.55;
}

.auth-page .auth-layout .auth-form {
    gap: 20px;
    margin-top: 14px;
}

.auth-page .auth-layout .auth-card .auth-message {
    margin: 0 0 14px;
    padding: 11px 13px;
    font-size: 12px;
    line-height: 1.4;
}

.auth-page .auth-layout .auth-card .field-label.auth-field-label {
    gap: 9px;
}

.auth-page .auth-layout .auth-card .auth-field-label span {
    font-family: var(--font-ui);
    color: #5d7590;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.05em;
}

.auth-page .auth-layout .auth-card input[type="email"],
.auth-page .auth-layout .auth-card input[type="password"] {
    min-height: 50px;
    border-radius: 10px;
    font-weight: 500;
    background: #eef6fc;
    border-color: #c8dff0;
    box-shadow: none;
}

.auth-page .auth-layout .auth-card input[type="email"]:focus-visible,
.auth-page .auth-layout .auth-card input[type="password"]:focus-visible {
    background: #ffffff;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(31, 139, 227, 0.2);
}

.auth-page .auth-layout .auth-card .auth-submit-btn {
    width: 100%;
    margin-top: 16px;
    min-height: 50px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    background: #2188df;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(31, 139, 227, 0.32);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-page .auth-layout .auth-card .auth-submit-btn:hover {
    background: #1a7bc9;
    transform: translateY(-1px);
        box-shadow: 0 8px 20px rgba(31, 139, 227, 0.36);
    }
    
    .auth-page .auth-layout .auth-card .auth-submit-btn:active {
        transform: translateY(0);
        box-shadow: 0 3px 10px rgba(31, 139, 227, 0.28);
    }
    
    .auth-page .auth-layout .auth-card .auth-submit-btn:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92), 0 0 0 6px rgba(31, 139, 227, 0.35);
}

/* Short viewports: keep login card above the fold without scrolling */
@media (max-height: 700px) {
    .auth-page .auth-shell {
        padding: 8px 12px;
    }

    .auth-page .auth-brand-panel {
        padding: 14px 18px 12px;
    }

    .auth-page .auth-brand-panel h1 {
        margin-bottom: 6px;
        font-size: clamp(3rem, 7vw, 3.6rem);
    }

    .auth-page .auth-brand-panel .auth-kicker {
        padding: 5px 10px;
        font-size: 9px;
    }

    .auth-page .auth-layout .auth-card {
        padding: 14px 18px 14px;
    }

    .auth-page .auth-layout .auth-card h2 {
        margin-top: 2px;
        margin-bottom: 4px;
        font-size: clamp(1.3rem, 4vw, 1.55rem);
    }

    .auth-page .auth-layout .auth-card .muted {
        font-size: 12px;
        margin-bottom: 0.5em;
    }

    .auth-page .auth-layout .auth-form {
        gap: 10px;
    }
}

.auth-brand-panel {
    position: relative;
        overflow: hidden;
    padding: clamp(28px, 4vw, 52px);
    color: #ffffff;
    background:
            linear-gradient(155deg, rgba(15, 52, 88, 0.92) 0%, rgba(12, 44, 74, 0.9) 42%, rgba(24, 118, 189, 0.88) 100%),
            url("../images/dental-emr-login-hero.svg") right 42% center / min(130%, 920px) no-repeat;
    }
    
    .auth-brand-panel::before {
        content: "";
        position: absolute;
        inset: 0;
        background-image:
            linear-gradient(105deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
            linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
        background-size: 28px 28px;
        opacity: 0.45;
        pointer-events: none;
    }
    
    .auth-brand-panel::after {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at 85% 35%, rgba(94, 196, 255, 0.18), transparent 52%);
        pointer-events: none;
    }
    
    .auth-brand-heading {
        position: relative;
        z-index: 1;
        display: flex;
        align-items: flex-start;
        gap: 16px;
    }
    
    .auth-brand-logo {
        flex-shrink: 0;
        display: grid;
        place-items: center;
        width: 52px;
        height: 52px;
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, 0.28);
        background: rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 28px rgba(5, 24, 42, 0.35);
    }
    
    .auth-brand-logo svg {
        width: 40px;
        height: 40px;
    }
    
    .auth-brand-titles {
        min-width: 0;
    }
    
    .auth-brand-titles .auth-kicker {
        margin-bottom: 10px;
}

.auth-brand-panel h1 {
    margin: 0 0 14px;
    color: #ffffff;
    font-family: "Cormorant", Georgia, serif;
    font-size: clamp(2rem, 3.3vw, 3.1rem);
    line-height: 1.02;
    max-width: 14ch;
        font-weight: 700;
        letter-spacing: -0.02em;
}

.auth-brand-lede {
    position: relative;
    z-index: 1;
    margin: 0;
    max-width: 44ch;
    color: rgba(255, 255, 255, 0.92);
    font-size: 15px;
    line-height: 1.55;
}

.auth-feature-list {
    position: relative;
        z-index: 1;
    margin-top: 26px;
    display: grid;
    gap: 10px;
}

.auth-feature-item {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(2px);
}

.auth-feature-item strong,
.auth-feature-item span {
    display: block;
}

.auth-feature-item strong {
    font-size: 14px;
    letter-spacing: 0.01em;
}

.auth-feature-item span {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.84);
    font-size: 12px;
}

.auth-card {
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: clamp(26px, 3.2vw, 42px);
    display: grid;
    align-content: center;
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 28px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.auth-card h2 {
    margin-top: 12px;
    margin-bottom: 8px;
    font-size: clamp(1.5rem, 2.2vw, 2rem);
}

.auth-form {
    margin-top: 8px;
    display: grid;
    gap: 10px;
}

.auth-field-label {
    letter-spacing: 0.03em;
}

.auth-field-label span {
    text-transform: none;
    font-size: 12px;
}

.auth-submit-btn {
    margin-top: 6px;
    min-height: 46px;
}

.auth-message {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
}

.auth-message-error {
    border: 1px solid rgba(156, 47, 47, 0.35);
    color: #7d1f1f;
    background: #fdeeee;
}

.auth-message-success {
    border: 1px solid rgba(26, 164, 165, 0.3);
    color: #116d6f;
    background: #eafafa;
}

.app-shell {
    display: grid;
    grid-template-columns: minmax(0, 252px) minmax(0, 1fr);
    gap: clamp(14px, 2vw, 20px);
    width: 95%;
    margin: clamp(20px, 4vw, 36px) auto clamp(48px, 8vw, var(--space-section));
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 76px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 108px);
    padding: 12px 10px;
    background: #f5faff;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.sidebar-nav-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    margin: 0 -2px;
    padding: 0 2px;
}

.sidebar-nav-scroll::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: rgba(15, 28, 26, 0.15);
    border-radius: 999px;
}

.sidebar-nav-empty {
    margin: 8px 10px 0;
    font-size: 12px;
}

.sidebar-user {
    flex-shrink: 0;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.sidebar-user-avatar {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, #43c0f8 0%, #1d86df 85%);
    box-shadow: 0 4px 12px rgba(31, 139, 227, 0.28);
}

.sidebar-user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    margin-top: 8px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.85);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-logout-btn:hover {
    background: var(--accent-soft);
    border-color: rgba(31, 139, 227, 0.35);
    color: var(--accent);
}

.sidebar-logout-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.sidebar-logout-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-section+.nav-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.nav-label {
    margin: 0 10px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7ea0bf;
}

.nav-link {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--accent-soft);
    color: var(--ink);
}

.nav-link:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.nav-link[aria-current="page"] {
    color: #fff;
    background: linear-gradient(145deg, #43c0f8 0%, #1d86df 85%);
    box-shadow: 0 8px 20px rgba(31, 139, 227, 0.25);
}

.nav-link[aria-current="page"]:hover {
    color: #fff;
    background: var(--brand-hover);
}

.nav-group {
    margin: 0;
}

.nav-group-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
}

.nav-group-summary::-webkit-details-marker {
    display: none;
}

.nav-group-anchor {
    color: inherit;
    text-decoration: none;
    flex: 1 1 auto;
}

.nav-group-summary:hover,
.nav-group-summary:focus-visible {
    background: var(--accent-soft);
    box-shadow: none;
    color: var(--ink);
}

.nav-group-anchor:hover,
.nav-group-anchor:focus-visible {
    color: inherit;
    text-decoration: none;
    /* background: var(--accent-soft);
    box-shadow: none; */
}

.nav-group-caret {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.8;
    transition: transform 180ms ease;
    flex: 0 0 auto;
}

details[open] > .nav-group-summary .nav-group-caret {
    transform: rotate(225deg);
}

.nav-submenu {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-2px);
    transition: max-height 220ms ease, opacity 220ms ease, transform 220ms ease;
    padding-left: 10px;
    border-left: 1px solid var(--line);
    margin-left: 10px;
}

details[open] > .nav-submenu {
    max-height: 240px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 6px;
}

.nav-sublink {
    font-size: 13px;
    padding: 10px 12px;
    min-height: 38px;
}

.nav-group-summary[aria-current="page"] {
    color: inherit;
    background: transparent;
    box-shadow: none;
}

.nav-group-summary[aria-current="page"]:hover {
    background: var(--accent-soft);
    color: inherit;
    box-shadow: none;
}

/* Invoice list helpers */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.status-badge.is-paid {
    background: #e9f8ef;
    border-color: #a7e6bf;
    color: #1f6b3d;
}

.status-badge.is-partial {
    background: #fff5d6;
    border-color: #f0d59a;
    color: #7a4d00;
}

.status-badge.is-unpaid {
    background: #ffe9e9;
    border-color: #f3b2b2;
    color: #8a2626;
}

.status-badge.is-refunded {
    background: #ede9ff;
    border-color: #c4b5fd;
    color: #4c1d95;
}

.status-badge.is-pending-refund {
    background: #fff4e6;
    border-color: #fdba74;
    color: #9a3412;
}

.status-badge.is-booked {
    background: #e6f1fb;
    border-color: #b5d4f4;
    color: #185fa5;
}

.status-badge.is-followup {
    background: #faeeda;
    border-color: #e8c77a;
    color: #854f0b;
}

.status-badge.is-walkin {
    background: #eaf3de;
    border-color: #a7d68a;
    color: #3b6d11;
}

.status-badge.is-completed {
    background: #f1efe8;
    border-color: #d3d1c7;
    color: #5f5e5a;
}

.status-badge.is-cancelled {
    background: #fcebeb;
    border-color: #f09595;
    color: #a32d2d;
}

/* Appointment hub */
.appt-hub-tabs-card {
    padding-top: 12px;
    padding-bottom: 12px;
}

.appt-dt-cell {
    white-space: normal;
}

.appt-dt {
    display: block;
    line-height: 1.25;
}

.appt-dt--time {
    margin-top: 2px;
    font-weight: 400;
}

.appt-hub-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border-bottom: none;
    padding: 0;
}

.appt-hub-tab {
    padding: 10px 18px;
    font-size: 13px;
    font-family: var(--font-ui);
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    margin-bottom: 0;
    line-height: 1.3;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.appt-hub-tab:hover {
    color: var(--text);
    background: var(--bg-elevated);
}

.appt-hub-tab.is-active {
    color: var(--text);
    font-weight: 600;
    background: #fff;
    border-color: var(--line);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.appt-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 11px;
    margin-left: 5px;
    background: var(--bg-elevated);
}

.appt-hub-tab.is-active .appt-tab-count {
    background: var(--accent);
    color: #fff;
}

.appt-hub-date {
    margin: 4px 0 0;
    font-size: 13px;
}

.appt-visit-blank {
    color: var(--muted);
    font-style: italic;
}

.appt-date-group {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    background: var(--bg-elevated);
}

.appt-view-dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.appt-view-field {
    margin: 0;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.appt-view-field dt {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.appt-view-field dd {
    margin: 6px 0 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.45;
    word-break: break-word;
}

.appt-view-field--full {
    grid-column: 1 / -1;
}

.appt-view-field .status-badge {
    margin-top: 2px;
}

.appt-patient-name {
    font-weight: 600;
}

.btn-outline.btn-sm {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--accent, #2563eb);
    background: #fff;
    color: var(--accent, #2563eb);
    cursor: pointer;
    min-height: 36px;
}

.btn-outline.btn-sm:hover {
    background: var(--accent-soft, #eff6ff);
}

/* Invoice Actions menu — same list UI as doctor/patient entity combo dropdown */
.eg-entity-combo-menu--floating,
.invoice-act-popover.eg-entity-combo-menu {
    position: fixed;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    width: max-content;
    min-width: 0;
    max-width: calc(100vw - 16px);
    box-sizing: border-box;
    z-index: 1200;
}

.invoice-act-popover.eg-entity-combo-menu .eg-entity-combo-item,
.invoice-act-popover-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    white-space: nowrap;
}

.invoice-act-menu-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: inherit;
}

.invoice-act-menu-icon {
    display: block;
    width: 18px;
    height: 18px;
    color: currentColor;
}

.invoice-act-menu-label {
    flex: 1;
    min-width: 0;
}

.invoice-act-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1300;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.invoice-act-modal {
    position: relative;
    width: min(560px, 100%);
    max-height: min(90vh, 720px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
}

.invoice-act-modal:not(.invoice-act-modal--stacked) .invoice-act-modal-head {
    flex-shrink: 0;
    margin-bottom: 0;
    padding: 16px 48px 14px 20px;
    border-bottom: 1px solid var(--line, #e2e8f0);
}

.invoice-act-modal:not(.invoice-act-modal--stacked) .invoice-act-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.invoice-act-modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: 0;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}

.invoice-act-modal-body {
    padding: 20px 22px 18px;
}

/* Add-services modal: OPD-style wide layout + header / footer chrome */
.invoice-act-modal--stacked {
    display: flex;
    flex-direction: column;
    width: min(960px, 100%);
    max-height: min(92vh, 900px);
    overflow: hidden;
}

.invoice-act-modal--stacked .invoice-act-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 16px 20px 20px;
}

.invoice-act-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--line, #e2e8f0);
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
}

.invoice-act-modal--stacked .invoice-act-modal-close {
    position: static;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    margin: -6px -8px 0 0;
    border-radius: 8px;
}

.invoice-act-modal--stacked .invoice-act-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.invoice-act-modal-title {
    margin: 0 0 4px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.invoice-act-modal-lead {
    margin: 0;
    font-size: 14px;
}

.invoice-act-modal-header-main {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.invoice-svc-context-panel {
    padding: 0;
    overflow: hidden;
}

.invoice-svc-context-panel .invoice-svc-summary-wrap {
    border: 0;
    border-radius: 0;
}

.invoice-svc-summary-wrap {
    overflow: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.invoice-svc-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.invoice-svc-summary-table thead {
    background: #f1f5f9;
}

.invoice-svc-summary-table th,
.invoice-svc-summary-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.invoice-svc-summary-table thead th {
    border-bottom: 1px solid #e2e8f0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.invoice-svc-summary-table tbody tr {
    background: #fff;
}

.invoice-svc-summary-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.invoice-svc-section {
    margin-bottom: 16px;
}

.invoice-svc-section:last-child {
    margin-bottom: 0;
}

.invoice-svc-panel {
    border: 1px solid var(--line, #e2e8f0);
    border-radius: var(--radius-md, 10px);
    padding: 14px 16px 16px;
    background: #fff;
}

.invoice-svc-bill-panel {
    border: 1px solid var(--line, #e2e8f0);
    border-radius: var(--radius-md, 10px);
    padding: 14px 16px 16px;
    background: linear-gradient(180deg, #f1f5f9 0%, #fff 42%);
}

.invoice-svc-totals-head {
    margin-bottom: 12px;
}

.invoice-svc-totals-head h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.invoice-svc-totals-head .muted {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

/* Invoice modal totals: vertical stack (Add Service, Add Discount) */
.invoice-svc-totals-strip {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.invoice-svc-total-cell {
    flex: none;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    background: transparent;
}

.invoice-svc-total-cell:last-child {
    border-bottom: 0;
}

.invoice-svc-total-label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: #475569;
    line-height: 1.35;
}

.invoice-svc-total-value {
    flex: 0 0 auto;
    min-width: 12ch;
    max-width: 55%;
    font-size: 1.0625rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
    line-height: 1.35;
    text-align: right;
    word-break: break-all;
}

.invoice-svc-total-sep {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 2px 16px 2px 20px;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.2;
    color: #94a3b8;
    background: #f8fafc;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    user-select: none;
}

.invoice-svc-totals-break {
    flex: none;
    height: 0;
    margin: 6px 16px;
    border: 0;
    border-top: 1px dashed #cbd5e1;
}

.invoice-svc-total-cell.is-grand {
    margin-top: 2px;
    padding-top: 12px;
    padding-bottom: 12px;
    background: linear-gradient(180deg, rgba(31, 139, 227, 0.1) 0%, rgba(31, 139, 227, 0.04) 100%);
    border-top: 1px dashed #cbd5e1;
    border-bottom: 1px solid #e2e8f0;
}

.invoice-svc-total-cell.is-grand .invoice-svc-total-label {
    font-weight: 700;
    color: #334155;
}

.invoice-svc-total-cell.is-grand .invoice-svc-total-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--brand, #1f8be3);
}

.invoice-svc-total-cell.is-refund-due {
    background: linear-gradient(180deg, rgba(217, 119, 6, 0.12) 0%, rgba(217, 119, 6, 0.04) 100%);
    border-bottom: 0;
}

.invoice-svc-total-cell.is-refund-due .invoice-svc-total-label {
    font-weight: 700;
    color: #92400e;
}

.invoice-svc-total-cell.is-refund-due .invoice-svc-total-value {
    font-weight: 800;
    color: #b45309;
}

.invoice-svc-total-cell.is-balance {
    margin-top: 2px;
    padding-top: 12px;
    padding-bottom: 12px;
    background: linear-gradient(180deg, rgba(180, 83, 9, 0.08) 0%, rgba(180, 83, 9, 0.02) 100%);
    border-top: 2px solid #f59e0b;
    border-bottom: 0;
}

.invoice-svc-total-cell.is-balance .invoice-svc-total-label {
    font-weight: 700;
    color: #92400e;
}

.invoice-svc-total-cell.is-balance .invoice-svc-total-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: #b45309;
}

/* Add Payment / Add Refund: original horizontal equation row, full width */
.invoice-svc-totals-strip.invoice-svc-totals-strip--inline-row {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-end;
    width: 100%;
    max-width: none;
    margin: 0;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-cell {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    padding: 14px 16px;
    text-align: right;
    border: 0;
    border-left: 1px solid #e2e8f0;
    border-bottom: 0;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-cell:first-child {
    border-left: 0;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-cell:last-child {
    border-bottom: 0;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-label {
    flex: none;
    display: block;
    width: 100%;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #64748b;
    line-height: 1.2;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-value {
    flex: none;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: none;
    font-size: 1.125rem;
    line-height: 1.2;
    word-break: normal;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-sep {
    flex: 0 0 36px;
    width: auto;
    padding: 0;
    align-self: stretch;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: #f8fafc;
    border: 0;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 0;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-totals-break {
    display: none;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-cell.is-grand {
    margin-top: 0;
    padding-top: 14px;
    padding-bottom: 14px;
    border-top: 0;
    border-bottom: 0;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-cell.is-grand .invoice-svc-total-label {
    font-weight: 700;
    color: #334155;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-cell.is-grand .invoice-svc-total-value {
    font-size: 1.35rem;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-cell.is-balance {
    margin-top: 0;
    padding-top: 14px;
    padding-bottom: 14px;
    border-top: 0;
    border-left: 2px solid #f59e0b;
    border-bottom: 0;
}

.invoice-svc-totals-strip--inline-row .invoice-svc-total-cell.is-balance .invoice-svc-total-value {
    font-size: 1.3rem;
}

@media (max-width: 720px) {
    .invoice-svc-totals-strip--inline-row {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .invoice-svc-totals-strip--inline-row .invoice-svc-total-cell {
        flex: 1 0 128px;
        min-width: 128px;
    }

    .invoice-svc-totals-strip--inline-row .invoice-svc-total-sep {
        flex: 0 0 30px;
    }
}

.invoice-act-modal-footer {
    flex-shrink: 0;
    padding: 14px 20px 16px;
    border-top: 1px solid var(--line, #e2e8f0);
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
}

.invoice-act-footer-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.invoice-act-form-panel .invoice-act-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

.invoice-act-form-panel .field-label--full {
    grid-column: 1 / -1;
}

@media (max-width: 560px) {
    .invoice-act-form-panel .invoice-act-form-grid {
        grid-template-columns: 1fr;
    }
}

.invoice-act-modal--wide .opd-services-table-wrap {
    max-height: 220px;
}

.invoice-svc-readonly-table th,
.invoice-svc-readonly-table td {
    font-size: 13px;
}

.invoice-act-modal-head {
    margin-bottom: 14px;
    padding-right: 28px;
}

.invoice-act-h4 {
    margin: 14px 0 8px;
    font-size: 15px;
}

.invoice-act-table-wrap {
    overflow: auto;
    max-height: 200px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.invoice-act-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.invoice-act-table th,
.invoice-act-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.invoice-act-svc-row {
    gap: 10px;
    margin-bottom: 10px;
}

.invoice-act-dl {
    display: grid;
    gap: 8px;
    margin: 0 0 12px;
}

.invoice-act-dl > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.invoice-act-dl dt {
    color: #64748b;
    font-weight: 500;
}

.invoice-act-ul {
    margin: 0 0 12px;
    padding-left: 18px;
    font-size: 14px;
}

.invoice-act-preview {
    margin-top: 10px;
}

.invoice-act-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.field-error {
    color: #b91c1c;
    font-size: 13px;
    margin-top: 8px;
}

.app-toast-host {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1400;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.app-toast {
    pointer-events: none;
    background: #0f172a;
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-toast.is-error {
    background: #991b1b;
}

.app-toast.is-out {
    opacity: 0;
    transform: translateY(6px);
}

    background: #fff1f1;
}

main {
    min-width: 0;
}

main>*:first-child {
    margin-top: 0;
}

h1,
h2,
h3 {
    margin: 0 0 0.4em;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

h2 {
    font-size: clamp(1.75rem, 3.2vw, 2.25rem);
}

h3 {
    font-size: 1.25rem;
    font-family: var(--font-ui);
    font-weight: 700;
}

/* Primary content & list shells: soft lift, minimal hairline */
.card {
    margin-bottom: 20px;
    padding: clamp(18px, 3vw, 24px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* Reusable metric / summary tile (light surfaces) */
.dashboard-card {
    padding: 18px 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card>h2:first-child,
.card>h3:first-child {
    margin-bottom: 0.35em;
}

.muted {
    margin: 0 0 1em;
    max-width: 62ch;
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

form .grid {
    margin-top: 4px;
}

form p:last-child {
    margin-bottom: 0;
}

form.inline {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 2px rgba(15, 28, 26, 0.03);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    background: var(--panel);
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(76, 181, 150, 0.24);
}

input::placeholder,
textarea::placeholder {
    color: rgba(85, 104, 99, 0.75);
}

input[type="hidden"] {
    display: none;
}

[data-entity-select].eg-entity-select--hidden {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

[data-entity-select] + .eg-entity-combo {
    margin-top: 0;
}

.eg-entity-combo {
    position: relative;
    width: 100%;
    min-width: 0;
}

.eg-entity-combo-input {
    width: 100%;
}

.eg-entity-combo-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1200;
    max-height: 240px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 6px;
}

.eg-entity-combo-item {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    margin: 0;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    box-shadow: none;
    cursor: pointer;
}

.eg-entity-combo-item:hover,
.eg-entity-combo-item:focus-visible {
    outline: none;
    background: var(--accent-soft);
    border-color: rgba(31, 139, 227, 0.35);
}

.eg-entity-combo-empty {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

[hidden] {
    display: none !important;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-height: 0;
    accent-color: var(--brand);
}

form.inline input,
form.inline select {
    width: auto;
    min-width: 140px;
}

button,
.form-actions .button,
a.header-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: var(--brand);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(76, 181, 150, 0.2), 0 8px 20px rgba(76, 181, 150, 0.13);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

button:focus-visible,
a.header-action-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring), 0 2px 8px rgba(76, 181, 150, 0.2);
}

button:hover,
a.header-action-btn:hover {
    background: var(--brand-hover);
    box-shadow: 0 4px 12px rgba(76, 181, 150, 0.23), 0 12px 28px rgba(76, 181, 150, 0.16);
}

a.header-action-btn {
    color: #fff;
    text-decoration: none;
}

a.header-action-btn:hover,
a.header-action-btn:focus-visible {
    color: #fff;
}

button[type="submit"].btn-ghost,
a.btn-ghost {
    color: var(--brand);
    background: transparent;
    border-color: rgba(76, 181, 150, 0.45);
    box-shadow: none;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--panel);
    box-shadow: 0 1px 3px rgba(15, 28, 26, 0.04);
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--bg-elevated);
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: rgba(106, 203, 220, 0.2);
}

/* Services table should not use the global blue hover row background. */
.opd-services-table tbody tr:hover td {
    background: transparent;
}

.vista-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(145deg, #f6fbff 0%, #eef7ff 100%);
}

.vista-hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.opd-walkin-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #fff !important;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.02em;
    text-decoration: none;
    border: 1px solid var(--brand);
    box-shadow: 0 6px 18px rgba(31, 139, 227, 0.25);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.opd-walkin-cta:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(31, 139, 227, 0.3);
}

.opd-walkin-cta:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring), 0 6px 18px rgba(31, 139, 227, 0.25);
}

.opd-walkin-cta-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    font-weight: 700;
    line-height: 1;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.kpi-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.kpi-label {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: #7394b2;
    text-transform: uppercase;
}

.kpi-value {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--accent);
}

.kpi-meta {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

.chart-card {
    margin-bottom: 0;
    grid-column: span 4;
}

.chart-card-wide {
    grid-column: span 8;
}

.chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.chart-head h3 {
    margin: 0;
}

.chart-note {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.bar-chart {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
    min-height: 180px;
    padding-top: 10px;
}

.bar-col {
    display: grid;
    justify-items: center;
    gap: 8px;
}

.bar-col--out .bar {
    background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
}

.bar {
    display: block;
    width: min(42px, 100%);
    border-radius: 999px 999px 8px 8px;
    background: linear-gradient(180deg, #58c6fd 0%, #1f8be3 100%);
}

.bar-label {
    font-size: 11px;
    color: #7394b2;
    text-align: center;
}

.ring-chart {
    --progress: 50;
    position: relative;
    width: 144px;
    height: 144px;
    margin: 10px auto 0;
    border-radius: 50%;
    background: conic-gradient(#1f8be3 calc(var(--progress) * 1%), #dcebfb 0);
    display: grid;
    place-items: center;
}

.ring-chart::before {
    content: "";
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: #fff;
}

.ring-chart span {
    position: absolute;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}

.ring-chart-soft {
    background: conic-gradient(#45c9d3 calc(var(--progress) * 1%), #dff5f6 0);
}

.mini-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.mini-metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 48px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #f9fcff;
    font-size: 12px;
    color: var(--muted);
}

.mini-metric strong {
    font-size: 17px;
    color: var(--accent);
}

.page-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-card-header h2 {
    margin-bottom: 0;
}

.filters-heading {
    margin-top: 0;
}

.eg-filters--patients,
.eg-filters--visits {
    align-items: end;
}

.eg-filters--visits {
    grid-template-columns: minmax(11rem, 16rem) minmax(8rem, 10.5rem) minmax(9rem, 11.5rem) auto;
}

.eg-filters--visits .eg-filter-field--search {
    max-width: 16rem;
}

.eg-filters--visits .eg-filter-field--doctor {
    max-width: 10.5rem;
}

.eg-filters--visits .eg-filter-field--date {
    max-width: 11.5rem;
    width: 11.5rem;
}

.eg-filters--visits .eg-filter-field--date input,
.eg-filters--visits .eg-filter-field--date select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.eg-filters--visits:has(#visits-custom-dates:not([hidden])) {
    grid-template-columns:
        minmax(10rem, 14rem)
        minmax(7.5rem, 10.5rem)
        repeat(3, 11.5rem)
        auto;
}

.eg-filters--visits .eg-visits-custom-dates {
    display: contents;
}

.eg-filters--visits .eg-filter-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    min-height: 44px;
    white-space: nowrap;
}

.visits-intro,
.visits-filter-hint,
.prescriptions-filter-hint {
    margin-top: 0;
}

.eg-filters--prescriptions {
    align-items: end;
    grid-template-columns: minmax(11rem, 16rem) minmax(9rem, 11.5rem) auto;
}

.eg-filters--prescriptions .eg-filter-field--search {
    max-width: 16rem;
}

.eg-filters--prescriptions .eg-filter-field--date {
    max-width: 11.5rem;
    width: 11.5rem;
}

.eg-filters--prescriptions .eg-filter-field--date input,
.eg-filters--prescriptions .eg-filter-field--date select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.eg-filters--prescriptions:has(#prescriptions-custom-dates:not([hidden])) {
    grid-template-columns:
        minmax(10rem, 14rem)
        minmax(9rem, 11.5rem)
        repeat(2, 11.5rem)
        auto;
}

.eg-filters--prescriptions .eg-prescriptions-custom-dates {
    display: contents;
}

.eg-filters--prescriptions .eg-filter-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    min-height: 44px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .eg-filters--prescriptions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .eg-filters--prescriptions .eg-filter-field--search,
    .eg-filters--prescriptions .eg-filter-field--date {
        max-width: none;
        width: auto;
    }

    .eg-filters--prescriptions .eg-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .eg-filters--prescriptions {
        grid-template-columns: 1fr;
    }
}

.eg-filters--appointments {
    align-items: end;
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(5, minmax(0, 1fr)) max-content;
}

.eg-filters--appointments .eg-filter-field--search,
.eg-filters--appointments .eg-filter-field--status,
.eg-filters--appointments .eg-filter-field--doctor,
.eg-filters--appointments .eg-filter-field--date {
    max-width: 100%;
    width: 100%;
    min-width: 0;
}

.eg-filters--appointments .eg-filter-field input,
.eg-filters--appointments .eg-filter-field select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.eg-filters--appointments .eg-filter-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    min-height: 44px;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 1200px) {
    .eg-filters--appointments {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .eg-filters--appointments .eg-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .eg-filters--appointments {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .eg-filters--visits {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .eg-filters--visits .eg-filter-field--search,
    .eg-filters--visits .eg-filter-field--doctor,
    .eg-filters--visits .eg-filter-field--date {
        max-width: none;
        width: auto;
    }

    .eg-filters--visits .eg-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .eg-filters--visits {
        grid-template-columns: 1fr;
    }
}

.eg-filters--patients .eg-filter-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    min-height: 44px;
}

@media (max-width: 640px) {
    .eg-filters--patients .eg-filter-field--grow {
        grid-column: span 1;
    }
}

.field-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.field-label > span {
    display: block;
}

.perm-toolbar {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.permission-header {
    align-items: flex-start;
    margin-bottom: 14px;
}

.perm-toolbar-main {
    justify-content: flex-end;
}

.permission-lede {
    margin: 6px 0 0;
}

.permission-guide {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 16px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #f5faff;
}

.permission-guide div {
    min-width: 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: #ffffff;
    border: 1px solid rgba(16, 60, 104, 0.08);
}

.permission-guide strong,
.permission-guide span {
    display: block;
}

.permission-guide strong {
    margin-bottom: 3px;
    font-size: 12px;
    color: var(--ink);
}

.permission-guide span {
    font-size: 12px;
    line-height: 1.45;
    color: var(--muted);
}

.permission-status {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid rgba(26, 164, 165, 0.28);
    border-radius: var(--radius-sm);
    color: #116d6f;
    background: #eafafa;
    font-size: 13px;
    font-weight: 700;
}

.permission-controls-row {
    display: grid;
    grid-template-columns: minmax(220px, 0.85fr) minmax(360px, 1.35fr);
    align-items: start;
    gap: 14px;
    margin: 0 0 16px;
}

.permission-search-wrap {
    min-width: 0;
}

.permission-search-row {
    display: block;
}

.permission-search-control {
    min-width: 0;
}

.permission-search-label {
    min-width: 0;
}

.permission-search-input-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 6px;
}

.permission-clear-search {
    min-height: 44px;
    padding: 10px 14px;
    color: var(--accent);
    background: #ffffff;
    border-color: var(--line-strong);
    box-shadow: none;
}

.permission-clear-search:hover {
    color: var(--ink);
    background: #f5faff;
    box-shadow: none;
}

.permission-clear-search:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.permission-search-count {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.permission-empty-search {
    margin: 16px 0 0;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
    background: #ffffff;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.permission-save-btn {
    min-height: 40px;
    padding: 9px 14px;
}

.permission-save-btn:disabled,
.permission-bulk-btn:disabled,
.btn-link:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    box-shadow: none;
}

.permission-bulk-btn {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    background: #e9f4ff;
    border: 1px solid #b8d9f7;
    border-radius: var(--radius-sm);
    box-shadow: none;
}

.permission-bulk-btn:hover {
    background: #dbecff;
    color: var(--accent);
    box-shadow: none;
}

.permission-bulk-btn-off {
    color: #7f2f2f;
    background: #fdeeee;
    border-color: #f0c9c9;
}

.permission-bulk-btn-off:hover {
    background: #fae2e2;
    color: #6c2424;
}

.permission-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.permission-section {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #f7fbff;
    box-shadow: var(--shadow-sm);
}

.permission-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 12px;
}

.permission-section-head h3 {
    margin: 0;
    font-size: 1.05rem;
}

.permission-section-head p {
    margin: 4px 0 0;
    max-width: 42ch;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.permission-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
}

.permission-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
    flex: 0 0 auto;
}

.permission-item span,
.permission-item strong,
.permission-item small {
    display: block;
}

.permission-item strong {
    font-size: 13px;
    line-height: 1.35;
}

.permission-item small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.permission-item:has(input:checked) {
    border-color: #8fc1ec;
    background: #edf6ff;
}

.permission-section[hidden],
.permission-item[hidden],
.permission-empty-search[hidden] {
    display: none;
}

.permission-submit-wrap {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}

.btn-patient-add {
    flex-shrink: 0;
}

.th-actions,
.td-actions {
    text-align: right;
    white-space: nowrap;
}

.td-actions-inner {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.td-actions .btn-table-action-icon {
    display: block;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.td-actions .btn-table-action--edit,
.td-actions .btn-table-action--delete,
.td-actions .btn-table-action--reschedule,
.td-actions .btn-table-action--prescription,
.td-actions a.btn-table-action--print,
.td-actions button.btn-table-action--reschedule,
.td-actions a.btn-table-action--prescription,
.td-actions span.btn-table-action--prescription-done,
.td-actions .btn-table-action:has(.btn-table-action-icon) {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
    flex: 0 0 32px;
}

.td-actions .btn-table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 14px;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: none;
    transform: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.td-actions .btn-table-action--edit {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(31, 139, 227, 0.22);
}

.td-actions .btn-table-action--edit:hover {
    color: #fff;
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    box-shadow: 0 4px 12px rgba(31, 139, 227, 0.28);
    transform: none;
}

.td-actions .btn-table-action--delete {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.td-actions .btn-table-action--delete:hover {
    color: #fff;
    background: #7a2424;
    border-color: #7a2424;
    box-shadow: 0 4px 12px rgba(156, 47, 47, 0.2);
    transform: none;
}

.td-actions a.btn-table-action--print {
    color: #fff;
    background: var(--print-action);
    border-color: var(--print-action);
    text-decoration: none;
}

.td-actions a.btn-table-action--print:hover {
    color: #fff;
    background: var(--print-action-hover);
    border-color: var(--print-action-hover);
    box-shadow: 0 4px 12px rgba(85, 101, 117, 0.22);
    transform: none;
}

.td-actions .btn-table-action--reschedule {
    color: #fff;
    background: #b45309;
    border-color: #b45309;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.22);
}

.td-actions .btn-table-action--reschedule:hover {
    color: #fff;
    background: #92400e;
    border-color: #92400e;
    box-shadow: 0 4px 12px rgba(146, 64, 14, 0.24);
    transform: none;
}

.td-actions a.btn-table-action--prescription {
    color: #fff;
    background: #0d9488;
    border-color: #0d9488;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.22);
}

.td-actions a.btn-table-action--prescription:hover {
    color: #fff;
    background: #0f766e;
    border-color: #0f766e;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.24);
    transform: none;
}

.td-actions .btn-table-action--prescription-done,
.td-actions span.btn-table-action--prescription-done {
    color: #f8fafc;
    background: #475569;
    border-color: #475569;
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.92;
}

.td-actions .btn-table-action--prescription-done:hover,
.td-actions .btn-table-action--prescription-done:focus-visible {
    color: #f8fafc;
    background: #334155;
    border-color: #334155;
    box-shadow: none;
    transform: none;
}

.td-actions a.btn-table-action--prescription-done {
    cursor: pointer;
    text-decoration: none;
}

.td-actions a.btn-table-action--prescription-done:hover {
    color: #f8fafc;
    background: #334155;
    border-color: #334155;
}

.td-actions .btn-table-action--prescription-expired,
.td-actions span.btn-table-action--prescription-expired {
    color: #f8fafc;
    background: #94a3b8;
    border-color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.92;
}

.td-actions .btn-table-action:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.td-actions .btn-table-action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.td-actions .btn-link + .btn-table-action,
.td-actions .btn-table-action + .btn-link,
.td-actions .btn-table-action + .btn-table-action,
.td-actions .btn-link + .btn-link,
.td-actions .btn-outline + .btn-table-action,
.td-actions .btn-table-action + .btn-outline {
    margin: 0;
}

.btn-link {
    display: inline;
    min-height: 0;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--brand);
    background: none;
    border: 0;
    box-shadow: none;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.btn-link:hover {
    color: var(--accent);
    transform: none;
    box-shadow: none;
}

.invoice-link {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.invoice-link:hover,
.invoice-link:focus-visible {
    color: var(--brand);
}

.btn-link:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 3px;
}

.btn-link-danger {
    color: var(--danger);
}

.btn-link-danger:hover {
    color: #7a2424;
}

.action-sep {
    color: var(--muted);
    font-weight: 400;
    text-decoration: none;
}

.patient-table-wrap {
    overflow-x: auto;
}

/* AjaxEntityGrid: table pagination footer */
.eg-table-footer {
    margin-top: 0;
    border-top: 1px solid var(--line);
    background: #fff;
}

.eg-table-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    padding: 1rem 1.5rem;
}

.eg-table-footer-range {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #4b5563;
}

.eg-table-footer-range .eg-tfn {
    font-variant-numeric: tabular-nums;
}

.eg-pager-nav {
    flex-shrink: 0;
}

.eg-pager-btns {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.eg-pager-btn {
    box-sizing: border-box;
    min-width: 40px;
    min-height: 40px;
    padding: 0 10px;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: #374151;
    cursor: pointer;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    touch-action: manipulation;
}

.eg-pager-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #d1d5db;
}

.eg-pager-btn:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

.eg-pager-btn.is-active {
    color: #fff;
    cursor: default;
    background: #111827;
    border-color: #111827;
}

.eg-pager-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.eg-pager-btn.eg-pager-step {
    min-width: 44px;
    padding: 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: #4b5563;
}

.eg-pager-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    padding: 0 2px;
    font-size: 14px;
    font-weight: 500;
    color: #9ca3af;
    user-select: none;
}

.eg-page-feedback {
    margin: 8px 1.5rem 0;
    min-height: 1.2em;
    font-size: 14px;
}

.patient-loading-row td,
.patient-empty-row td {
    text-align: center;
    color: var(--muted);
    padding: 20px 14px;
}

.patient-page-feedback {
    margin: 12px 0 0;
    min-height: 1.2em;
    font-size: 14px;
    font-weight: 600;
    color: var(--danger);
}

.patient-dialog {
    width: min(520px, calc(100vw - 40px));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.patient-dialog::backdrop {
    background: rgba(15, 28, 26, 0.45);
}

.patient-dialog form {
    padding: clamp(18px, 4vw, 24px);
}

.patient-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.patient-dialog-head h3 {
    margin: 0;
}

.btn-dialog-close {
    min-height: 36px;
    min-width: 36px;
    padding: 0;
    margin: -8px -8px 0 0;
    font-size: 22px;
    line-height: 1;
    color: var(--muted);
    background: transparent;
    border: 0;
    box-shadow: none;
    cursor: pointer;
}

.btn-dialog-close:hover {
    color: var(--ink);
    background: transparent;
    transform: none;
    box-shadow: none;
}

.patient-form-feedback,
.eg-form-feedback {
    margin: 0 0 12px;
    min-height: 1.2em;
    font-size: 14px;
    font-weight: 600;
    color: var(--danger);
}

.patient-form-feedback.is-error,
.eg-form-feedback.is-error {
    color: var(--danger);
}

.patient-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

/* Entity-grid dialogs (Patients, Doctors, …) — same header/body/footer chrome as Book appointment */
.patient-dialog.eg-dialog:not(.rx-dialog) {
    padding: 0;
    overflow: hidden;
}

.patient-dialog.eg-dialog:not(.rx-dialog)[open] {
    display: flex;
    flex-direction: column;
}

.patient-dialog.eg-dialog:not(.rx-dialog) form.eg-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    max-height: min(90dvh, calc(100vh - 32px));
    overflow: hidden;
    padding: 0;
}

.patient-dialog.eg-dialog:not(.rx-dialog) .patient-dialog-head,
.patient-dialog.eg-dialog:not(.rx-dialog) .patient-dialog-head--divided {
    flex-shrink: 0;
    margin-bottom: 0;
    padding: clamp(16px, 4vw, 20px) clamp(18px, 4vw, 24px);
    border-bottom: 1px solid var(--line);
}

.patient-dialog.eg-dialog:not(.rx-dialog) .patient-dialog-head .eg-dialog-title {
    margin: 0;
}

.patient-dialog.eg-dialog:not(.rx-dialog) .patient-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: clamp(16px, 4vw, 22px) clamp(18px, 4vw, 24px);
}

.patient-dialog.eg-dialog:not(.rx-dialog) .patient-dialog-body .eg-form-feedback,
.patient-dialog.eg-dialog:not(.rx-dialog) .patient-dialog-body .patient-form-feedback {
    margin-top: 0;
}

.patient-dialog.eg-dialog:not(.rx-dialog) .patient-dialog-body .eg-form-feedback:empty,
.patient-dialog.eg-dialog:not(.rx-dialog) .patient-dialog-body .patient-form-feedback:empty {
    display: none;
    margin: 0;
    min-height: 0;
}

.patient-dialog.eg-dialog:not(.rx-dialog) .patient-dialog-actions,
.patient-dialog.eg-dialog:not(.rx-dialog) .patient-dialog-actions--divided {
    flex-shrink: 0;
    margin-top: 0;
    padding: clamp(14px, 3vw, 18px) clamp(18px, 4vw, 24px);
    border-top: 1px solid var(--line);
    background: var(--bg-elevated);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.patient-dialog.appt-book-dialog {
    width: min(680px, calc(100vw - 32px));
    max-height: min(90dvh, calc(100vh - 32px));
    overflow: hidden;
}

.patient-dialog.appt-book-dialog[open] {
    display: flex;
    flex-direction: column;
}

.patient-dialog.appt-book-dialog .appt-book-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    max-height: min(90dvh, calc(100vh - 32px));
    overflow: hidden;
    padding: 0;
}

.patient-dialog-head--divided {
    flex-shrink: 0;
    margin-bottom: 0;
    padding: clamp(16px, 4vw, 20px) clamp(18px, 4vw, 24px);
    border-bottom: 1px solid var(--line);
}

.patient-dialog-head--divided .eg-dialog-title {
    margin: 0 0 4px;
}

.appt-book-subtitle {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

.patient-dialog.appt-book-dialog .patient-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: clamp(16px, 4vw, 22px) clamp(18px, 4vw, 24px);
}

.patient-dialog-actions--divided {
    flex-shrink: 0;
    margin-top: 0;
    padding: clamp(14px, 3vw, 18px) clamp(18px, 4vw, 24px);
    border-top: 1px solid var(--line);
    background: var(--bg-elevated);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.appt-book-section {
    margin-bottom: 22px;
}

.appt-book-section:last-child {
    margin-bottom: 0;
}

.appt-book-section-head {
    margin-bottom: 12px;
}

.appt-book-section-head h4 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
}

.appt-book-section-head .muted {
    margin: 0;
    font-size: 13px;
}

.appt-book-patient-type {
    margin-bottom: 12px;
}

.appt-book-notes {
    grid-column: 1 / -1;
}

.appt-book-form .eg-form-feedback {
    margin-top: 0;
}

.appt-book-form .eg-form-feedback:empty {
    display: none;
    margin: 0;
    min-height: 0;
}

.patient-dialog.appt-view-dialog,
.patient-dialog.appt-reschedule-dialog,
.patient-dialog.appt-hub-dialog.appt-view-dialog,
.patient-dialog.appt-hub-dialog.appt-reschedule-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: min(90dvh, calc(100vh - 32px));
    padding: 0;
    overflow: hidden;
}

.patient-dialog.appt-view-dialog[open],
.patient-dialog.appt-reschedule-dialog[open],
.patient-dialog.appt-hub-dialog.appt-view-dialog[open],
.patient-dialog.appt-hub-dialog.appt-reschedule-dialog[open] {
    display: flex;
    flex-direction: column;
}

.patient-dialog.appt-view-dialog .patient-dialog-body,
.patient-dialog.appt-reschedule-dialog .patient-dialog-body,
.patient-dialog.appt-hub-dialog.appt-view-dialog .patient-dialog-body,
.patient-dialog.appt-hub-dialog.appt-reschedule-dialog .patient-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: clamp(16px, 4vw, 22px) clamp(18px, 4vw, 24px);
}

.patient-dialog.appt-reschedule-dialog .appt-reschedule-form,
.patient-dialog.appt-hub-dialog.appt-reschedule-dialog .appt-reschedule-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    max-height: min(90dvh, calc(100vh - 32px));
    overflow: hidden;
    padding: 0;
}

.appt-dialog-subtitle {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

.appt-reschedule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.appt-reschedule-reason {
    grid-column: 1 / -1;
}

.appt-reschedule-form .eg-form-feedback {
    margin-top: 0;
}

.appt-reschedule-form .eg-form-feedback:empty {
    display: none;
    margin: 0;
    min-height: 0;
}

@media (max-width: 520px) {
    .appt-view-dl,
    .appt-reschedule-grid {
        grid-template-columns: 1fr;
    }

    .appt-view-field--full {
        grid-column: auto;
    }
}

@media screen and (max-width: 900px) {
    .auth-page {
            background-attachment: scroll;
    }

        .auth-page .auth-shell {
            justify-items: center;
            padding: clamp(12px, 2.5vw, 24px) clamp(16px, 4vw, 28px);
        }

        .auth-page .auth-layout {
            margin-right: 0;
        }

        .auth-page .auth-brand-panel {
            padding: clamp(16px, 4vw, 22px) clamp(18px, 4vw, 24px) clamp(12px, 3vw, 18px);
            background:
                linear-gradient(97deg, #061526 0%, #0c3558 44%, #1f72b8 100%),
                url("../images/dental-emr-login-hero.svg") 70% 32% / 210% no-repeat;
    }

        .auth-page .auth-brand-panel h1 {
            font-size: clamp(2.1rem, 8vw, 2.85rem);
    }

        .auth-brand-heading {
            flex-wrap: wrap;
        }
    
        .auth-page .auth-layout .auth-card {
            padding-top: clamp(18px, 4.2vw, 26px);
            padding-bottom: clamp(16px, 3.8vw, 24px);
            padding-left: clamp(18px, 4vw, 24px);
            padding-right: clamp(26px, 6vw, 36px);
    }

    .app-shell {
        grid-template-columns: 1fr;
        width: min(100% - 24px, 720px);
    }

    .sidebar {
        position: static;
        max-height: none;
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0;
        padding: 12px;
        overflow: visible;
    }

    .sidebar-nav-scroll {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 8px;
        overflow: visible;
        margin: 0;
        padding: 0;
    }

    .sidebar-user {
        width: 100%;
        order: 999;
        margin-top: 14px;
    }

    .nav-section {
        width: 100%;
    }

    .nav-section+.nav-section {
        margin-top: 12px;
        padding-top: 12px;
    }

    .nav-link {
        flex: 1 1 auto;
        min-width: calc(50% - 8px);
        justify-content: center;
        text-align: center;
        font-size: 12px;
    }

    .nav-submenu {
        padding-left: 0;
        margin-left: 0;
        border-left: 0;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-card,
    .chart-card-wide {
        grid-column: 1 / -1;
    }

    .permission-guide {
        grid-template-columns: 1fr;
    }

    .permission-controls-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .permission-search-input-wrap {
        grid-template-columns: 1fr;
    }

    .perm-toolbar-main {
        justify-content: flex-start;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* OPD Walk-in page */
.opd-walkin-page {
    display: block;
}

.opd-page-header {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.opd-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    text-decoration: none;
}

.opd-required-star {
    display: inline-block;
    margin-left: 6px;
    color: var(--danger);
    font-weight: 900;
}

.opd-inline-label {
    position: relative;
    display: block;
    width: 100%;
    padding-right: 88px;
}

.opd-inline-toggle {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: flex-start;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--danger);
    cursor: pointer;
    user-select: none;
    line-height: 1.2;
    text-align: right;
}

.opd-inline-toggle:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 8px;
    padding: 2px 6px;
    margin: -2px -6px;
}

.opd-form-feedback {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--line);
}

.opd-form-feedback.is-error {
    background: #fdecec;
    color: var(--danger);
    border-color: rgba(156, 47, 47, 0.25);
}

.opd-form-feedback.is-success {
    background: #e2f7f3;
    color: var(--success);
    border-color: rgba(26, 164, 165, 0.3);
}

.opd-section {
    margin-bottom: 18px;
}

.opd-section-head {
    margin-bottom: 14px;
}

.opd-section-head h3 {
    margin: 0 0 4px;
    font-size: 18px;
    color: var(--ink);
}

.opd-section-head .muted {
    margin: 0;
}

.opd-patient-type {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.opd-radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-elevated);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.opd-radio:hover {
    border-color: var(--brand);
}

.opd-radio input[type="radio"] {
    accent-color: var(--brand);
}

.opd-search-label {
    margin-bottom: 8px;
}

.opd-search-results {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.opd-search-results:empty {
    display: none;
}

.opd-result-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "name mrn"
        "meta meta";
    gap: 4px 12px;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    text-align: left;
    cursor: pointer;
    color: var(--ink);
    box-shadow: none;
}

.opd-result-item:hover {
    background: var(--accent-soft);
    border-color: var(--brand);
    color: var(--ink);
    transform: none;
    box-shadow: none;
}

.opd-result-name {
    grid-area: name;
    font-weight: 700;
    font-size: 14px;
}

.opd-result-mrn {
    grid-area: mrn;
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}

.opd-result-meta {
    grid-area: meta;
    font-size: 12px;
    color: var(--muted);
}

.opd-search-empty {
    margin: 0;
    padding: 10px 12px;
    color: var(--muted);
    font-size: 13px;
    font-style: italic;
}

.opd-selected-patient {
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}

.opd-selected-patient-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.opd-selected-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px 16px;
    margin: 0;
}

.opd-selected-grid > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.opd-selected-grid dt {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0;
}

.opd-selected-grid dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.opd-notes-field {
    grid-column: 1 / -1;
}

.opd-existing-block[hidden],
.opd-new-block[hidden] {
    display: none !important;
}
.opd-services-table-wrap {
    overflow-x: auto;
    margin-bottom: 12px;
}

.opd-services-table {
    width: 100%;
    table-layout: fixed;
}

/* Remove sticky seam shadow/divider in Services table. */
.opd-services-table th:nth-child(5),
.opd-services-table td:nth-child(5),
.opd-services-table th:nth-child(6),
.opd-services-table td:nth-child(6) {
    box-shadow: none !important;
    border-left: 0 !important;
}

.opd-services-table th,
.opd-services-table td {
    vertical-align: middle;
}

.opd-services-table .opd-col-num {
    width: 100px;
    text-align: right;
}

.opd-services-table td:nth-child(4) input[type="number"] {
    text-align: left;
}

.opd-services-table td:nth-child(3) input[type="number"] {
    text-align: center;
}

.opd-services-table .opd-col-action {
    width: 52px;
    text-align: center;
}

.opd-services-table input[type="number"],
.opd-services-table select {
    width: 100%;
    min-width: 0;
}

.opd-services-table select {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.opd-row-amount {
    display: block;
    width: 100%;
    text-align: right;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.opd-add-row {
    margin: 0;
}

.opd-trash-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    color: var(--danger);
}

.opd-trash-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.opd-trash-btn:hover,
.opd-trash-btn:focus-visible {
    background: transparent;
    color: #b42318;
    box-shadow: none;
}

.opd-totals {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.opd-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--ink);
}

.opd-total-row strong {
    font-size: 15px;
    font-weight: 700;
}

.opd-total-row input[type="number"] {
    width: 140px;
    text-align: right;
}

.opd-discount-label {
    font-weight: 600;
}

.opd-total-row-grand {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px dashed var(--line-strong);
    font-size: 16px;
}

.opd-total-row-grand strong {
    font-size: 18px;
    color: var(--accent);
}

.opd-payment-grid {
    margin-top: 8px;
}

.opd-payment-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.opd-payment-row .opd-payment-grid {
    flex: 1 1 520px;
    margin-top: 0;
    display: grid;
    grid-template-columns: 260px 260px;
    gap: 14px;
}

.opd-payment-row .opd-payment-grid input,
.opd-payment-row .opd-payment-grid select {
    max-width: 260px;
}

.opd-actions.opd-actions-inline {
    flex: 0 0 auto;
    margin-bottom: 0;
    align-self: flex-end;
}

.opd-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 30px;
}

.opd-submit {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .opd-services-table .opd-col-num {
        width: auto;
    }

    .opd-total-row input[type="number"] {
        width: 100px;
    }

    .opd-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .opd-payment-row .opd-payment-grid {
        grid-template-columns: 1fr;
    }

    .opd-payment-row .opd-payment-grid input,
    .opd-payment-row .opd-payment-grid select {
        max-width: 100%;
    }
}

/* —— Invoice printable view (modules/invoices/print.php)
   Corporate section-band layout aligned with Dentara admin theme (--ink / --brand) —— */
.invoice-print-page {
    margin: 0;
    padding: clamp(16px, 2.5vw, 28px);
    min-height: 100vh;
    font-family: var(--font-ui);
    color: var(--ink);
    background: var(--bg);
}

.invoice-print-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    max-width: 920px;
    margin: 0 auto 14px;
}

.invoice-print-action {
    box-shadow: 0 2px 10px rgba(31, 139, 227, 0.22);
}

.invoice-print-sheet {
    max-width: 920px;
    margin: 0 auto;
    padding: clamp(24px, 4vw, 42px);
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.invoice-print-doc-head {
    text-align: center;
    margin-bottom: 10px;
}

.invoice-print-doc-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 4px;
}

.invoice-print-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.06em;
    background: linear-gradient(155deg, #3fbaf8 0%, #1e83dd 70%);
}

.invoice-print-doc-titles {
    text-align: center;
}

.invoice-print-clinic-name {
    margin: 0;
    font-family: var(--font-ui);
    font-size: clamp(1.05rem, 2.4vw, 1.45rem);
    font-weight: 800;
    letter-spacing: 0.14em;
    color: #021018;
    line-height: 1.15;
}

.invoice-print-doc-kind {
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

.invoice-print-order-id {
    margin: 14px 0 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.invoice-print-order-id strong {
    font-weight: 800;
}

.invoice-print-created {
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.invoice-print-rule {
    margin: 8px 0 0;
    border: 0;
    border-top: 1px solid var(--line-strong);
}

.invoice-print-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 14px;
    margin: 0 0 6px;
    padding: 4px 0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.02em;
    color: #031525;
}

.invoice-print-meta-kind,
.invoice-print-meta-inv,
.invoice-print-meta-created {
    color: #031525;
}

.invoice-print-meta-inv strong {
    font-weight: 800;
    color: #021018;
}

.invoice-print-meta-sep {
    display: inline-block;
    width: 1px;
    height: 14px;
    background: #0a2540;
    opacity: 0.35;
    flex-shrink: 0;
}

.invoice-print-kv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 14px;
    border: 1px solid var(--line);
}

.invoice-print-kv {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
}

.invoice-print-kv:nth-child(2n) {
    border-right: 0;
}

.invoice-print-kv-wide {
    grid-column: 1 / -1;
}

.invoice-print-kv-label {
    display: block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7394b2;
}

.invoice-print-kv-value {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.invoice-print-block {
    margin-bottom: 20px;
    border: 1px solid var(--line);
    overflow: hidden;
}

.invoice-print-band {
    margin: 0;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #ffffff;
    background: var(--ink);
}

.invoice-print-block-body {
    background: var(--panel);
}

.invoice-print-body-flush {
    padding: 0;
}

.invoice-print-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    border: 0;
    box-shadow: none;
    margin: 0;
}

.invoice-print-matrix thead th {
    padding: 8px 11px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    color: #5f7fab;
    background: var(--accent-soft);
    border-bottom: 1px solid var(--line-strong);
}

.invoice-print-matrix .col-n {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.invoice-print-matrix tbody td {
    padding: 9px 11px;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}

.invoice-print-matrix tbody tr:nth-child(even) td {
    background: rgba(231, 242, 254, 0.45);
}

.invoice-print-matrix .col-item {
    font-weight: 600;
}

.invoice-print-empty-msg {
    text-align: center;
    color: var(--muted);
    font-style: italic;
    padding: 18px 12px !important;
}

.invoice-print-empty-pad {
    padding: 18px 14px !important;
    margin: 0 !important;
    border-bottom: none !important;
}

.invoice-print-muted {
    color: var(--muted);
}

/* Invoice totals / money rows: see assets/css/invoice-print.css (dl layout) */

.invoice-print-footer {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    text-align: center;
}

.invoice-print-footer-thanks {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.invoice-print-note {
    margin: 0 auto;
    max-width: 56ch;
    font-size: 11px !important;
    font-weight: 500;
    line-height: 1.45;
    color: var(--muted);
}

@media (max-width: 840px) {
    .invoice-print-kv-wide {
        grid-column: 1 / -1;
    }

    .invoice-print-doc-brand {
        flex-direction: column;
        text-align: center;
    }

    .invoice-print-doc-titles {
        text-align: center;
    }
}

@media (max-width: 520px) {
    .invoice-print-kv {
        padding: 6px 8px;
    }

    .invoice-print-meta-row {
        font-size: 11px;
        gap: 6px 10px;
    }

    .invoice-print-totals-body {
        max-width: none;
        margin-left: 0;
    }
}

@media print {
    @page {
        margin: 10mm;
        size: A4 portrait;
    }

    .invoice-print-page {
        padding: 0;
        background: #fff !important;
    }

    .no-print {
        display: none !important;
    }

    .invoice-print-sheet {
        max-width: none;
        margin: 0;
        padding: 10mm;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .invoice-print-band {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .invoice-print-matrix thead th {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: #eaf4fb !important;
    }

    .invoice-print-matrix tbody tr:nth-child(even) td {
        background: #f9fcfe !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
