:root {
    --hs-navy: #0c3142;
    --hs-navy-deep: #082530;
    --hs-teal: #128c8c;
    --hs-teal-dark: #0c6b6b;
    --hs-mint: #e7f6f4;
    --hs-sky: #eef4f8;
    --hs-paper: #ffffff;
    --hs-ink: #16323f;
    --hs-muted: #5b7380;
    --hs-line: #d8e4ec;
    --hs-amber: #d9922a;
    --hs-rose: #c45c5c;
    --hs-green: #2a9b73;
    --hs-gold: #c6a15b;
    --hs-shadow: 0 18px 40px rgba(12, 49, 66, 0.08);
    --hs-radius: 18px;
    --sidebar-width: 272px;
    --app-header-offset: 88px;
    --font: "Inter", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--hs-ink);
    background: var(--hs-sky);
}

img {
    max-width: 100%;
}

a {
    color: var(--hs-teal-dark);
    text-decoration: none;
}

h1,
h2,
h3,
strong {
    letter-spacing: -0.03em;
}

/* Auth */
.auth-body {
    min-height: 100vh;
    background: var(--hs-navy-deep);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
}

.auth-hero {
    position: relative;
    overflow: hidden;
    padding: 64px;
    color: #f4fbfb;
    background:
        radial-gradient(circle at 20% 20%, rgba(18, 140, 140, 0.35), transparent 32%),
        linear-gradient(160deg, #0b3a4c 0%, #0a2a38 55%, #0c5d5d 140%);
}

.auth-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 540px;
}

.brand-row,
.sidebar-brand {
    display: flex;
    gap: 14px;
    align-items: center;
}

.brand-logo,
.sidebar-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    object-position: center;
    flex-shrink: 0;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--hs-ink);
    text-decoration: none;
    font-weight: 700;
}

.navbar-brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    object-position: center;
    flex-shrink: 0;
}

.navbar-brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
}

.brand-row strong,
.sidebar-brand strong {
    display: block;
    font-size: 1.05rem;
}

.brand-row span,
.sidebar-brand span {
    display: block;
    font-size: 0.78rem;
    opacity: 0.72;
}

.auth-hero h1 {
    margin: 48px 0 16px;
    font-size: clamp(2rem, 3vw, 2.8rem);
    line-height: 1.15;
    font-weight: 750;
}

.auth-hero p {
    margin: 0 0 28px;
    font-size: 1.05rem;
    color: rgba(244, 251, 251, 0.78);
}

.hero-points {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hero-points li {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    color: #d7f1ef;
}

.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(8px);
}

.orb-a {
    width: 280px;
    height: 280px;
    right: -60px;
    bottom: -40px;
    background: rgba(46, 196, 182, 0.18);
}

.orb-b {
    width: 180px;
    height: 180px;
    right: 18%;
    top: 12%;
    background: rgba(255, 255, 255, 0.08);
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background:
        linear-gradient(180deg, #f7fbfc 0%, #eef4f7 100%);
}

.auth-card {
    width: min(460px, 100%);
    background: var(--hs-paper);
    border-radius: 28px;
    padding: 36px;
    box-shadow: var(--hs-shadow);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--hs-teal);
}

.auth-card h2,
.page-heading h1 {
    margin: 8px 0;
    font-weight: 750;
}

.muted,
.page-subtitle {
    color: var(--hs-muted);
}

.auth-form {
    margin-top: 24px;
}

.form-floating-group,
.auth-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.86rem;
    font-weight: 600;
}

.form-floating-group {
    margin-bottom: 16px;
}

.input-icon,
.hs-input,
.form-control.hs-input {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon input,
.hs-input,
.form-control.hs-input {
    width: 100%;
    border: 1px solid var(--hs-line);
    background: #f8fbfc;
    border-radius: 14px;
    padding: 13px 14px 13px 42px;
    font: inherit;
    color: var(--hs-ink);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hs-input,
.form-control.hs-input {
    padding-left: 14px;
    min-height: 48px;
}

.input-icon i {
    position: absolute;
    left: 14px;
    color: var(--hs-muted);
}

.input-icon input:focus,
.hs-input:focus,
.form-control.hs-input:focus {
    border-color: var(--hs-teal);
    box-shadow: 0 0 0 4px rgba(18, 140, 140, 0.12);
    background: #fff;
}

.toggle-password {
    position: absolute;
    right: 10px;
    border: 0;
    background: transparent;
    color: var(--hs-muted);
}

.auth-form .input-icon:has(.toggle-password) {
    position: relative;
}

.auth-form .input-icon:has(.toggle-password) input {
    padding-right: 48px;
}

.auth-form .toggle-password {
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    margin: 0;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.btn-hospital {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    background: linear-gradient(180deg, #16a0a0 0%, #0e7d7d 100%);
    color: #fff;
    font-weight: 700;
    border-radius: 14px;
    padding: 13px 18px;
    box-shadow: 0 10px 20px rgba(14, 125, 125, 0.25);
}

.btn-hospital:hover {
    color: #fff;
    filter: brightness(1.05);
}

.alert-soft-danger,
.alert-soft-success {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 0;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 0.92rem;
}

.alert-soft-danger {
    background: #fdeeee;
    color: #8a3030;
}

.alert-soft-success {
    background: #e8f7f0;
    color: #21664c;
}

.dev-hint {
    margin-top: 22px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--hs-mint);
    color: var(--hs-navy);
    display: grid;
    gap: 4px;
    font-size: 0.88rem;
}

.dev-hint code {
    background: #fff;
    padding: 1px 6px;
    border-radius: 6px;
}

.form-divider {
    border: 0;
    border-top: 1px solid var(--hs-line);
    margin: 4px 0;
}

.field-help {
    display: block;
    margin-top: 6px;
    color: var(--hs-muted);
    font-size: 0.8rem;
}

.setup-optional {
    border: 1px solid var(--hs-line);
    border-radius: 14px;
    padding: 12px 14px;
    background: #f8fbfc;
}

.setup-optional summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--hs-navy);
}

.setup-optional p {
    margin: 10px 0 12px;
    font-size: 0.88rem;
}

.setup-section {
    border: 1px solid var(--hs-line);
    border-radius: 16px;
    padding: 16px 16px 18px;
    margin: 18px 0 0;
    background: #f8fbfc;
}

.setup-section legend {
    float: none;
    width: auto;
    font-size: 0.92rem;
    font-weight: 750;
    color: var(--hs-navy);
    padding: 0 6px;
}

.setup-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 600;
    color: var(--hs-ink);
}

.setup-check input {
    margin-top: 4px;
}

.setup-steps {
    margin: 18px 0 0;
    padding-left: 20px;
    color: var(--hs-ink);
}

.setup-steps li {
    margin-bottom: 10px;
    line-height: 1.45;
}

.setup-steps code {
    background: var(--hs-mint);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.86rem;
}

/* App shell */
.app-body {
    background:
        radial-gradient(circle at top right, rgba(18, 140, 140, 0.08), transparent 28%),
        var(--hs-sky);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--hs-navy) 0%, var(--hs-navy-deep) 100%);
    color: #e7f2f4;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 6px 10px 22px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: auto;
    flex: 1;
}

.sidebar-label {
    margin: 18px 12px 8px;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8aa6b3;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #d5e6ec;
    padding: 11px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.94rem;
}

.sidebar-link i {
    width: 20px;
    font-size: 1.05rem;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-link.active {
    background: #149a94;
    color: #fff;
}

.sidebar-link.is-core span {
    font-weight: 750;
}

.soon-pill {
    margin-left: auto;
    font-style: normal;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.08);
    color: #b9d0d8;
    border-radius: 999px;
    padding: 3px 7px;
}

.sidebar-user {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 10px 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 16px;
}

.sidebar-user span,
.sidebar-user strong {
    display: block;
}

.sidebar-user span {
    font-size: 0.78rem;
    color: #9db6c0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #1a6f78;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-avatar.sm {
    width: 34px;
    height: 34px;
    font-size: 0.75rem;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-navbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 12px 16px 4px;
    padding: 10px 14px;
    border-radius: 18px;
    background: linear-gradient(90deg, #087F8C 0%, #075985 46%, #123B63 100%);
    box-shadow: 0 10px 24px rgba(18, 59, 99, 0.18);
    color: #fff;
}

.sidebar-toggle {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border: 0;
    background: rgba(255, 255, 255, 0.16);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    box-shadow: none;
    color: #fff;
    cursor: pointer;
}

@media (min-width: 993px) {
    body.is-sidebar-collapsed .app-sidebar {
        width: 0;
        padding: 0;
        overflow: hidden;
        border: 0;
    }
}

.navbar-search {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--hs-line);
    border-radius: 999px;
    padding: 10px 16px;
    color: var(--hs-muted);
}

.navbar-search input {
    border: 0;
    outline: 0;
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    background: transparent;
    font: inherit;
}

.search-hint {
    font-size: 0.72rem;
    background: var(--hs-mint);
    color: var(--hs-teal-dark);
    border-radius: 999px;
    padding: 3px 8px;
    font-weight: 700;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-date {
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 600;
    font-size: 0.84rem;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.navbar-date-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.navbar-date-text small {
    font-size: 0.72rem;
    font-weight: 500;
    opacity: 0.82;
}

.app-navbar .navbar-brand {
    color: #fff;
}

.app-navbar .navbar-search {
    border-color: transparent;
    color: #5d7482;
}

.app-navbar .navbar-notifications {
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.app-navbar .navbar-icon-btn {
    background: rgba(255, 255, 255, 0.14);
    border-color: transparent;
    color: #fff;
}

.lang-flag-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 12px 0 10px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #123B63;
}

.lang-flag {
    display: inline-flex;
    line-height: 0;
}

.lang-flag-svg {
    display: block;
    width: 22px;
    height: 15px;
    border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(18, 59, 99, 0.18);
}

.lang-flag-btn.dropdown-toggle::after {
    margin-left: 2px;
    border-top-color: #123B63;
}

.language-switcher .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    border-radius: 999px;
    padding: 4px 2px 4px 4px;
    font-weight: 700;
    box-shadow: none;
    color: #fff;
}

.app-navbar .user-avatar.sm {
    background: #14b8a6;
    color: #fff;
}

.user-chip.dropdown-toggle::after {
    margin-left: 2px;
    border-top-color: #fff;
}

@media (max-width: 576px) {
    .app-navbar {
        margin-inline: 8px;
        gap: 8px;
        padding-inline: 8px;
    }

    .navbar-actions {
        gap: 8px;
    }

    .app-navbar .navbar-notifications {
        padding-left: 0;
        border-left: 0;
    }
}

.app-content {
    padding: 12px 28px 28px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 22px;
}

.page-heading h1 {
    font-size: 1.85rem;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    box-shadow: var(--hs-shadow);
}

.status-chip.live {
    color: var(--hs-green);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}

.stat-card,
.panel {
    background: var(--hs-paper);
    border-radius: var(--hs-radius);
    box-shadow: var(--hs-shadow);
    border: 1px solid rgba(220, 230, 236, 0.7);
}

.stat-card {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 18px 20px;
}

.stat-card span {
    display: block;
    color: var(--hs-muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.stat-card strong {
    font-size: 1.55rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    color: #fff;
}

.stat-icon.teal { background: #128c8c; }
.stat-icon.navy { background: #1c4d63; }
.stat-icon.amber { background: #d9922a; }
.stat-icon.green { background: #2a9b73; }
.stat-icon.rose { background: #c45c5c; }
.stat-icon.gold { background: #c6a15b; }

.content-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 16px;
    margin-bottom: 16px;
}

.panel {
    padding: 20px 22px 8px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.panel-head h2 {
    margin: 0;
    font-size: 1.12rem;
}

.panel-head p {
    margin: 4px 0 0;
    color: var(--hs-muted);
    font-size: 0.88rem;
}

.badge-soft {
    background: var(--hs-mint);
    color: var(--hs-teal-dark);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-soft.lab {
    background: #eef4fb;
    color: #1c4d63;
}

.empty-state {
    text-align: center;
    padding: 28px 16px 36px;
    color: var(--hs-muted);
}

.empty-state.large {
    padding: 64px 20px;
}

.empty-state i {
    font-size: 1.8rem;
    color: var(--hs-teal);
}

.empty-state h3 {
    margin: 12px 0 6px;
    color: var(--hs-ink);
}

.activity-list {
    list-style: none;
    padding: 8px 0 18px;
    margin: 0;
}

.activity-list li {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--hs-line);
}

.activity-list li:last-child {
    border-bottom: 0;
}

.activity-list strong,
.activity-list span {
    display: block;
}

.activity-list span {
    color: var(--hs-muted);
    font-size: 0.82rem;
}

.activity-dot {
    width: 10px;
    height: 10px;
    margin-top: 8px;
    border-radius: 50%;
    background: var(--hs-teal);
    box-shadow: 0 0 0 4px rgba(18, 140, 140, 0.12);
}

.app-footer {
    margin-top: auto;
    padding: 16px 28px 22px;
    color: var(--hs-muted);
    font-size: 0.85rem;
    line-height: 1.45;
    text-align: center;
    background: transparent;
}

.app-footer p {
    margin: 0;
}

.coming-panel {
    min-height: 360px;
}

.dropdown-menu {
    border: 0;
    border-radius: 14px;
    padding: 8px;
}

.dropdown-item {
    border-radius: 10px;
    font-weight: 600;
}

@media (max-width: 1200px) {
    .stat-grid,
    .content-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 992px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        min-height: 280px;
        padding: 36px;
    }

    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1040;
        width: var(--sidebar-width);
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        transform: translate3d(-100%, 0, 0);
        transition: transform 0.2s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        pointer-events: none;
    }

    .app-sidebar.open {
        transform: translate3d(0, 0, 0);
        pointer-events: auto;
    }

    .app-main {
        position: relative;
        z-index: 1;
    }

    .sidebar-toggle {
        display: grid;
        place-items: center;
        position: relative;
        z-index: 1060;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .app-navbar {
        position: relative;
        z-index: 1050;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .stat-grid,
    .content-grid,
    .page-heading,
    .app-footer,
    .navbar-date {
        display: block;
    }

    .stat-grid,
    .content-grid {
        display: grid;
        grid-template-columns: 1fr;
    }

    .app-navbar,
    .app-content,
    .app-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1035;
    pointer-events: none;
}

.sidebar-backdrop.is-visible {
    display: block;
    pointer-events: auto;
}

@media (max-width: 992px) {
    .sidebar-backdrop.is-visible {
        display: block;
    }
}

/* Phase 2: Patients */
.patient-list-panel .panel-head {
    flex-wrap: wrap;
    gap: 16px;
}

.patient-search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    min-width: min(100%, 420px);
}

.patient-search-form .input-icon {
    flex: 1;
}

.patient-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.patient-table th,
.patient-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--hs-line);
    vertical-align: middle;
}

.patient-table th {
    color: var(--hs-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.patient-table th a {
    color: inherit;
}

.patient-thumb {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: cover;
    display: inline-grid;
    place-items: center;
    background: var(--hs-mint);
    color: var(--hs-teal-dark);
    font-weight: 700;
}

.patient-thumb.placeholder {
    font-size: 0.78rem;
}

.patient-id {
    color: var(--hs-teal-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.table-actions {
    display: flex;
    gap: 10px;
}

.table-actions a {
    color: var(--hs-muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-pill.status-active {
    background: #e7f8f1;
    color: var(--hs-green);
}

.status-pill.status-inactive {
    background: #f3f5f7;
    color: var(--hs-muted);
}

.status-pill.status-deceased {
    background: #fdeeee;
    color: var(--hs-rose);
}

.patient-pagination {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    padding: 16px 0 8px;
    overflow-x: hidden;
}

.patient-pagination .pagination-numbers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
}

.patient-pagination a,
.patient-pagination .pagination-page,
.patient-pagination .pagination-nav,
.patient-pagination .pagination-ellipsis {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--hs-line);
    color: var(--hs-ink);
    font-weight: 700;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.patient-pagination a:hover:not(.is-disabled) {
    border-color: var(--hs-teal);
    color: var(--hs-teal);
}

.patient-pagination a.active,
.patient-pagination .pagination-page.is-active {
    background: var(--hs-teal);
    border-color: var(--hs-teal);
    color: #fff;
}

.patient-pagination .pagination-nav.is-disabled,
.patient-pagination span.pagination-nav.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    background: #f4f7fb;
}

.patient-pagination .pagination-ellipsis {
    min-width: 24px;
    padding: 0 4px;
    background: transparent;
    border: 0;
    color: var(--hs-muted, #64748b);
    font-weight: 700;
    letter-spacing: 0.08em;
}

.pagination-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    padding: 16px 0 8px;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .patient-pagination,
    .pagination-bar {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 6px;
        overflow-x: hidden;
    }

    .patient-pagination .pagination-numbers {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 6px;
        width: auto;
        flex: 0 1 auto;
        min-width: 0;
    }

    .patient-pagination a,
    .patient-pagination .pagination-page,
    .patient-pagination .pagination-nav,
    .patient-pagination .pagination-ellipsis {
        flex: 0 0 auto;
        width: auto;
        max-width: none;
        display: inline-flex;
    }

    .patient-pagination .pagination-nav {
        min-width: auto;
        padding: 0 12px;
        font-size: 0.875rem;
    }

    .patient-pagination .pagination-page,
    .patient-pagination a.pagination-page {
        min-width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .patient-pagination,
    .pagination-bar {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 6px;
        overflow-x: hidden;
    }

    .patient-pagination .pagination-numbers {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 6px;
        width: auto;
        flex: 0 1 auto;
        min-width: 0;
    }

    .patient-pagination .pagination-nav {
        min-width: auto;
        width: auto;
        padding: 0 10px;
        height: 32px;
        font-size: 0.8125rem;
    }

    .patient-pagination .pagination-page,
    .patient-pagination a.pagination-page,
    .patient-pagination .pagination-ellipsis {
        min-width: 30px;
        height: 30px;
        padding: 0 8px;
        font-size: 0.8125rem;
    }
}

.patient-form-panel,
.patient-scan-panel,
.patient-tab-panel {
    padding: 24px;
}

.form-section + .form-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--hs-line);
}

.form-section-head h3 {
    margin: 0 0 4px;
}

.form-section-head p {
    margin: 0 0 16px;
    color: var(--hs-muted);
}

.photo-upload-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 20px;
    align-items: start;
}

.photo-preview-box,
.patient-hero-photo,
.badge-photo {
    width: 160px;
    height: 160px;
    border-radius: 18px;
    overflow: hidden;
    background: var(--hs-mint);
    border: 1px solid var(--hs-line);
}

.photo-preview-box img,
.patient-hero-photo img,
.badge-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder,
.patient-hero-placeholder,
.badge-photo-placeholder {
    height: 100%;
    display: grid;
    place-content: center;
    text-align: center;
    color: var(--hs-muted);
    gap: 8px;
}

.photo-placeholder i,
.patient-hero-placeholder {
    font-size: 2.4rem;
    font-weight: 700;
}

.patient-id-note {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-top: 24px;
    padding: 16px 18px;
    border-radius: 14px;
    background: var(--hs-mint);
    color: var(--hs-teal-dark);
}

.patient-id-note.locked {
    background: #eef4fb;
    color: var(--hs-navy);
}

.patient-id-note strong,
.patient-id-note span {
    display: block;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
}

.patient-hero {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 24px;
    padding: 24px;
    margin-bottom: 16px;
}

.patient-id-banner {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--hs-navy);
    color: #fff;
    margin-bottom: 18px;
}

.patient-id-banner strong {
    font-size: 1.35rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.patient-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.patient-meta-grid span,
.detail-grid span {
    display: block;
    color: var(--hs-muted);
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding-bottom: 16px;
}

.patient-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    scroll-margin-top: var(--app-header-offset);
}

.patient-tab-panel {
    scroll-margin-top: var(--app-header-offset);
}

.patient-tabs a {
    padding: 10px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--hs-line);
    color: var(--hs-muted);
    font-weight: 700;
    font-size: 0.88rem;
}

.patient-tabs a.active {
    background: var(--hs-teal);
    border-color: var(--hs-teal);
    color: #fff;
}

.patient-mini-list {
    list-style: none;
    margin: 0;
    padding: 8px 0 18px;
}

.patient-mini-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--hs-line);
}

.patient-mini-list li:last-child {
    border-bottom: 0;
}

.patient-mini-list strong,
.patient-mini-list span {
    display: block;
}

.patient-mini-list span {
    color: var(--hs-muted);
    font-size: 0.82rem;
}

.scan-form {
    max-width: 560px;
}

.scan-input-wrap {
    position: relative;
    margin: 8px 0 12px;
}

.scan-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--hs-teal);
}

.scan-input {
    padding-left: 42px !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.03em;
}

.badge-page-wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 0 12px;
}

.badge-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.patient-badge-card {
    box-sizing: border-box;
    width: 3.375in;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #111;
    border-radius: 12px;
    overflow: hidden;
}

.badge-header {
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: var(--hs-navy, #1e3a5f);
    color: #fff;
    flex-shrink: 0;
    min-width: 0;
}

.badge-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    object-fit: contain;
    object-position: center;
    background: #fff;
    border-radius: 6px;
    padding: 2px;
}

.patient-id-card-brand {
    min-width: 0;
    flex: 1 1 auto;
}

.badge-header .patient-id-card-brand strong {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 0.72rem;
    line-height: 1.2;
    font-weight: 700;
    word-break: break-word;
}

.badge-header .patient-id-card-brand > span {
    display: none;
}

.badge-body {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
    align-items: start;
    min-width: 0;
    flex: 1 1 auto;
}

.badge-photo {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
}

.badge-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.badge-photo-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--hs-teal-dark, #0e7490);
    background: rgba(14, 116, 144, 0.1);
}

.badge-details {
    min-width: 0;
    overflow: hidden;
}

.badge-details h2 {
    margin: 0 0 4px;
    font-size: 0.82rem;
    line-height: 1.25;
    font-weight: 700;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.badge-id-label {
    margin: 0 0 6px;
    font-size: 0.68rem;
    line-height: 1.2;
    word-break: break-word;
}

.badge-id-label strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 800;
    color: var(--hs-teal-dark, #0e7490);
}

.badge-details ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 3px;
}

.badge-details li {
    display: grid;
    grid-template-columns: minmax(52px, 38%) minmax(0, 1fr);
    gap: 4px;
    align-items: baseline;
    font-size: 0.66rem;
    line-height: 1.25;
    min-width: 0;
}

.badge-details li span {
    color: var(--hs-muted, #64748b);
    min-width: 0;
}

.badge-details li strong {
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-weight: 600;
}

.badge-barcode {
    box-sizing: border-box;
    padding: 6px 10px 8px;
    text-align: center;
    border-top: 1px dashed var(--hs-line, #dbe3ea);
    flex-shrink: 0;
    min-width: 0;
    overflow: hidden;
}

.badge-barcode svg {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.badge-barcode span {
    display: block;
    margin-top: 3px;
    font-size: 0.66rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    word-break: break-all;
}

.badge-print-body {
    background: #fff;
    margin: 0;
}

@media print {
    .no-print,
    .app-sidebar,
    .app-navbar,
    .app-footer,
    .badge-toolbar {
        display: none !important;
    }

    .badge-page-wrap {
        max-width: none;
        padding: 0;
        margin: 0;
    }

    .patient-badge-card {
        width: 3.375in !important;
        max-width: 3.375in !important;
        margin: 0 auto !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .app-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    body,
    .app-body,
    .app-main,
    .badge-print-body {
        background: #fff !important;
    }
}

.status-pill.status-waiting {
    background: #fff7e8;
    color: var(--hs-amber);
}

.status-pill.status-in-progress {
    background: #eef4fb;
    color: var(--hs-navy);
}

.visit-id-banner {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    padding: 18px 22px;
    margin-bottom: 16px;
}

.visit-id-banner span,
.visit-id-banner strong {
    display: block;
}

.symptom-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.symptom-card {
    border: 1px solid var(--hs-line);
    border-radius: 14px;
    padding: 12px;
    display: grid;
    gap: 8px;
}

.visit-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.visit-summary-grid .visit-total strong {
    color: var(--hs-teal-dark);
    font-size: 1.2rem;
}

.visit-history-list {
    display: grid;
    gap: 16px;
    padding-bottom: 16px;
}

.visit-history-card {
    border: 1px solid var(--hs-line);
    border-radius: 16px;
    padding: 16px 18px;
    background: #fcfeff;
}

.visit-history-card header,
.visit-history-card footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.visit-history-card header strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--hs-teal-dark);
}

.visit-history-card p {
    margin: 10px 0 0;
}

.visit-history-card footer {
    margin-top: 12px;
    color: var(--hs-muted);
    font-size: 0.88rem;
}

.visit-section {
    margin-bottom: 16px;
    padding: 20px 22px;
}

.visit-add-service {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--hs-line);
}

.billing-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.billing-summary-grid .amount-due strong {
    color: var(--hs-rose);
    font-size: 1.15rem;
}

.receipt-card {
    max-width: 760px;
}

.receipt-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--hs-line);
}

.receipt-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.language-switcher select {
    border: 1px solid var(--hs-line);
    border-radius: 999px;
    padding: 6px 12px;
    background: #fff;
}

@media print {
    .app-sidebar,
    .app-navbar,
    .receipt-heading .heading-actions,
    .alert {
        display: none !important;
    }

    .receipt-print-body,
    .app-main {
        background: #fff !important;
    }
}

@media (max-width: 992px) {
    .billing-summary-grid,
    .symptom-grid,
    .visit-summary-grid {
        grid-template-columns: 1fr;
    }

    .patient-hero,
    .photo-upload-grid,
    .patient-meta-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.table-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.table-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--hospital-teal-soft, #e8f6f4);
    color: var(--hospital-navy, #1a365d);
    font-size: 0.75rem;
    font-weight: 700;
}

.appointment-calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.calendar-day {
    border: 1px solid var(--border-soft, #e2e8f0);
    border-radius: 0.75rem;
    padding: 0.5rem;
    min-height: 100px;
    background: #fff;
}

.calendar-day.is-today {
    border-color: var(--hospital-teal, #0d9488);
    box-shadow: 0 0 0 1px var(--hospital-teal, #0d9488);
}

.calendar-event {
    display: block;
    font-size: 0.75rem;
    padding: 0.25rem 0.35rem;
    margin-top: 0.25rem;
    border-radius: 0.35rem;
    background: var(--hospital-teal-soft, #e8f6f4);
    color: inherit;
    text-decoration: none;
}

.now-serving-banner {
    text-align: center;
    padding: 2rem 1rem;
}

.queue-number-display {
    font-size: 3rem;
    color: var(--hospital-teal, #0d9488);
    display: block;
}
