:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #14b8a6;
    --accent: #6366f1;
    --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #134e4a 100%);
    --sidebar-width: 260px;
    --card-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
    --radius: 12px;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

[data-theme="dark"] {
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
    --card-bg: #1e293b;
    --body-bg: #0f172a;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--body-bg, #f8fafc);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
}

/* Professional scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(13, 148, 136, 0.45) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 99px;
}

*::-webkit-scrollbar-thumb {
    background: rgba(13, 148, 136, 0.35);
    border-radius: 99px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 148, 136, 0.55);
    background-clip: padding-box;
}

[data-theme="dark"] * {
    scrollbar-color: rgba(94, 234, 212, 0.4) transparent;
}

[data-theme="dark"] *::-webkit-scrollbar-thumb {
    background: rgba(94, 234, 212, 0.35);
    background-clip: padding-box;
}

[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
    background: rgba(94, 234, 212, 0.55);
    background-clip: padding-box;
}

.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}

.sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h1 {
    font-size: 1.25rem;
    margin: 0;
    font-weight: 700;
    background: linear-gradient(135deg, #5eead4, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-brand small { opacity: 0.7; font-size: 0.75rem; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.nav-section { padding: 0.5rem 1.25rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.5; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--primary-light);
}

.sidebar-nav a i { width: 20px; text-align: center; }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    background: var(--card-bg, #fff);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.page-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Contained scroll panels (activity feeds, lists) */
.scroll-panel {
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    position: relative;
}

.scroll-panel--sm { max-height: 180px; }
.scroll-panel--md { max-height: 280px; }
.scroll-panel--lg { max-height: 360px; }

.scroll-panel-wrap {
    position: relative;
}

.scroll-panel-wrap::before,
.scroll-panel-wrap::after {
    content: '';
    position: absolute;
    left: 0;
    right: 8px;
    height: 28px;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.scroll-panel-wrap::before {
    top: 0;
    background: linear-gradient(to bottom, var(--card-bg, #fff) 0%, transparent 100%);
    border-radius: var(--radius) var(--radius) 0 0;
}

.scroll-panel-wrap::after {
    bottom: 0;
    background: linear-gradient(to top, var(--card-bg, #fff) 0%, transparent 100%);
    border-radius: 0 0 var(--radius) var(--radius);
}

.scroll-panel-wrap.can-scroll-up::before { opacity: 1; }
.scroll-panel-wrap.can-scroll-down::after { opacity: 1; }

.activity-feed .activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.activity-feed .activity-item:last-child { border-bottom: none; }

.activity-feed .activity-item:hover {
    background: rgba(13, 148, 136, 0.04);
}

.activity-feed .activity-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(13, 148, 136, 0.12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.activity-feed .activity-meta {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.dashboard-page {
    animation: dashboardFadeIn 0.4s ease-out;
}

@keyframes dashboardFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.premium-card {
    background: var(--card-bg, #fff);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.premium-card:hover { box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12); }

.premium-card .card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.premium-card .card-body { padding: 1.25rem; }

.stat-card {
    padding: 1.25rem;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -20px; top: -20px;
    width: 100px; height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.stat-card.accent { background: linear-gradient(135deg, var(--accent), #4f46e5); }
.stat-card.warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card.success { background: linear-gradient(135deg, #10b981, #059669); }
.stat-card.danger { background: linear-gradient(135deg, #ef4444, #dc2626); }

.stat-card h3 { font-size: 1.75rem; margin: 0; font-weight: 700; }
.stat-card p { margin: 0.25rem 0 0; opacity: 0.9; font-size: 0.875rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.table-premium { margin: 0; }
.table-premium thead th {
    background: #f1f5f9;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    padding: 0.75rem 1rem;
}

[data-theme="dark"] .table-premium thead th { background: #334155; }

.table-premium tbody tr { transition: background 0.15s; }
.table-premium tbody tr:hover { background: rgba(13, 148, 136, 0.05); }

.lab-requests-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.lab-requests-table {
    min-width: 720px;
}

.lab-requests-table th,
.lab-requests-table td {
    vertical-align: middle;
}

.lab-requests-table .lab-status-select {
    min-width: 7.5rem;
    max-width: 9rem;
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
}

.lab-request-actions .btn {
    padding: 0.3rem 0.55rem;
}

.lab-request-actions .btn i {
    font-size: 0.95rem;
    line-height: 1;
}

.queue-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.queue-item:hover { border-color: var(--primary); background: rgba(13,148,136,0.05); }

.patient-search-item {
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    margin-bottom: 4px;
    transition: all 0.15s;
}
.patient-search-item:hover {
    background: rgba(13,148,136,0.08);
    border-color: var(--primary);
}

.pos-layout { display: grid; grid-template-columns: minmax(300px, 1.1fr) minmax(360px, 1.25fr) 280px; gap: 1rem; min-height: calc(100vh - 140px); }
@media (max-width: 1200px) { .pos-layout { grid-template-columns: 1fr; } }

.medicine-item, .test-item {
    padding: 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
    background: var(--card-bg, #fff);
    transition: all 0.15s;
}

.medicine-item:hover, .test-item:hover {
    background: rgba(13,148,136,0.08);
    border-color: var(--primary);
}

.medicine-item--pick {
    cursor: default;
}

.medicine-item--expired {
    border-color: rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.06);
}

.medicine-item--expiring {
    border-color: rgba(255, 193, 7, 0.45);
    background: rgba(255, 193, 7, 0.08);
}

.expiry-alert-item:last-child {
    border-bottom: none !important;
}

.pos-unit-picks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.pos-unit-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    min-height: 52px;
    padding: 0.4rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg, #fff);
    color: var(--text);
    font-weight: 600;
    line-height: 1.15;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.pos-unit-btn:hover {
    border-color: var(--primary);
    background: rgba(13, 148, 136, 0.08);
}

.pos-unit-btn.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.28);
}

.pos-unit-btn__name {
    font-size: 0.82rem;
    text-transform: capitalize;
}

.pos-unit-btn__price {
    font-size: 0.72rem;
    font-weight: 500;
    opacity: 0.85;
}

.cart-line {
    display: block;
    padding: 0.85rem 0;
    border-bottom: 1px dashed var(--border);
}

.cart-line__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.pos-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.55rem;
}

.pos-qty button {
    width: 36px;
    height: 36px;
    border: 0;
    background: var(--body-bg, #f8fafc);
    font-size: 1.15rem;
    line-height: 1;
    color: var(--text);
}

.pos-qty button:hover { background: rgba(13, 148, 136, 0.12); }

.pos-qty input {
    width: 52px;
    height: 36px;
    border: 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: center;
    font-weight: 700;
}

.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #134e4a 50%, #0d9488 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.print-receipt { max-width: 80mm; margin: 0 auto; font-size: 12px; font-family: monospace; }
.print-receipt h2 { text-align: center; font-size: 14px; margin: 0 0 8px; }
.print-receipt .line { border-top: 1px dashed #000; margin: 8px 0; }

/* Hospital-style consultation ticket receipt */
.print-receipt--hospital {
    max-width: 88mm;
    font-family: "Times New Roman", Times, Georgia, serif;
    font-size: 11px;
    line-height: 1.35;
    color: #000;
    background: #fff;
}

.ticket-receipt {
    text-transform: none;
}

.ticket-receipt__header {
    text-align: center;
    margin-bottom: 4px;
}

.ticket-receipt__header-brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    text-align: left;
    margin-bottom: 6px;
}

/* Circular clinic logo — uploaded images scale to fit inside the circle */
.clinic-logo-circle {
    --logo-size: 72px;
    width: var(--logo-size);
    height: var(--logo-size);
    min-width: var(--logo-size);
    min-height: var(--logo-size);
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-sizing: border-box;
}

.clinic-logo-circle--xs { --logo-size: 40px; }
.clinic-logo-circle--sm { --logo-size: 48px; }
.clinic-logo-circle--md { --logo-size: 72px; }
.clinic-logo-circle--lg { --logo-size: 96px; }

.clinic-logo-circle img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 6px;
    display: block;
    box-sizing: border-box;
}

.clinic-logo-circle--on-dark {
    background: #fff;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.clinic-logo-circle--on-light {
    background: #f8fafc;
    border: 2px solid var(--border, #e2e8f0);
}

.clinic-logo-circle--print {
    background: #fff;
    border: 1px solid #000;
}

.clinic-logo-circle--fallback {
    color: var(--primary, #0d9488);
    font-size: calc(var(--logo-size) * 0.45);
    line-height: 1;
    font-family: system-ui, sans-serif;
}

.sidebar-brand .clinic-logo-circle {
    margin-bottom: 0.75rem;
}

.logo-upload-preview {
    display: inline-flex;
}

.login-card .clinic-logo-circle {
    display: inline-flex;
    margin: 0 auto;
}

.login-card .text-center:has(.clinic-logo-circle) {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ticket-receipt__logo-wrap {
    flex-shrink: 0;
}

.ticket-receipt__header-titles {
    flex: 1;
    min-width: 0;
}

.ticket-receipt__title-main {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.ticket-receipt__title-sub {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    margin-top: 2px;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.ticket-receipt__contact {
    text-align: center;
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    line-height: 1.35;
}

.ticket-receipt__rule {
    border: none;
    border-top: 1px dashed #000;
    margin: 8px 0;
}

.ticket-receipt__rule--short {
    width: 35%;
    margin: 10px auto 8px;
}

.ticket-receipt__rule--solid {
    border-top-style: solid;
    margin-top: 0;
}

.ticket-receipt__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 4px 0;
}

.ticket-receipt__bar-title {
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

.ticket-receipt__queue-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.ticket-receipt__queue-box {
    display: inline-block;
    min-width: 1.5rem;
    text-align: center;
    padding: 2px 10px;
    border: 1px solid #000;
    font-size: 0.85rem;
    font-weight: 700;
}

.ticket-receipt__qr {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    image-rendering: pixelated;
}

.ticket-receipt__box {
    border: 1px dashed #000;
    padding: 8px 10px;
    margin-bottom: 0;
}

.ticket-receipt__box + .ticket-receipt__box {
    margin-top: 6px;
}

.ticket-receipt__meta-grid {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.ticket-receipt__meta-right {
    text-align: right;
}

.ticket-receipt__line {
    margin: 2px 0;
    font-size: 0.72rem;
}

.ticket-receipt__line--caps {
    text-transform: uppercase;
}

.ticket-receipt__line--desc {
    min-height: 1.2em;
}

.ticket-receipt__k {
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ticket-receipt__money-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.ticket-receipt__money {
    border: 1px dashed #000;
    border-collapse: collapse;
    font-size: 0.72rem;
    min-width: 11rem;
}

.ticket-receipt__money td {
    padding: 4px 10px;
    border-bottom: 1px solid #000;
}

.ticket-receipt__money tr:last-child td {
    border-bottom: none;
}

.ticket-receipt__money td:first-child {
    font-weight: 700;
    letter-spacing: 0.03em;
}

.ticket-receipt__money td:last-child {
    text-align: right;
    font-weight: 700;
}

.ticket-receipt__payment {
    margin: 8px 0 0;
    font-size: 0.68rem;
    text-align: center;
}

.ticket-receipt__sign {
    text-align: center;
    font-family: "Segoe Script", "Brush Script MT", cursive;
    font-size: 1.1rem;
    margin-top: 14px;
    padding-bottom: 2px;
}

/* Hospital-style lab request form */
.print-receipt--lab-form {
    max-width: 210mm;
    font-size: 12px;
    line-height: 1.4;
}

.lab-receipt {
    text-transform: none;
    padding: 4px 0;
}

.lab-receipt__header {
    text-align: right;
    margin-bottom: 18px;
}

.lab-receipt__hospital-name {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lab-receipt__doctor-line {
    font-style: italic;
    font-size: 0.78rem;
    margin-top: 4px;
    line-height: 1.35;
}

.lab-receipt__address,
.lab-receipt__phone {
    font-size: 0.78rem;
    margin-top: 3px;
}

.lab-receipt__patient-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    margin-bottom: 20px;
}

.lab-receipt__patient-col--right {
    text-align: left;
}

.lab-receipt__field {
    margin: 4px 0;
    font-size: 0.82rem;
}

.lab-receipt__label {
    font-weight: 400;
}

.lab-receipt__value {
    margin-left: 4px;
}

.lab-receipt__value--caps {
    font-weight: 700;
    text-transform: uppercase;
}

.lab-receipt__value--bold {
    font-weight: 700;
}

.lab-receipt__title {
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    font-style: italic;
    text-decoration: underline;
    margin: 24px 0 20px;
    border: none;
    padding: 0;
}

.lab-receipt__tests-wrap {
    border-top: 1px dashed #000;
    border-bottom: 1px dashed #000;
    padding: 10px 0;
    margin-bottom: 28px;
}

.lab-receipt__tests {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.lab-receipt__tests th {
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 4px 8px 8px 0;
    vertical-align: bottom;
}

.lab-receipt__tests th:first-child {
    width: 45%;
}

.lab-receipt__tests td {
    padding: 3px 8px 3px 0;
    text-transform: uppercase;
    vertical-align: top;
}

.lab-receipt__th-price,
.lab-receipt__td-price {
    text-align: right;
    width: 22%;
    text-transform: none;
}

.lab-receipt__tests tfoot td {
    padding-top: 10px;
    border-top: 1px solid #000;
    font-weight: 700;
}

.lab-receipt__total-row td {
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.lab-receipt__total-row--sub td {
    border-top: none;
    padding-top: 4px;
    font-weight: 600;
}

.lab-receipt__total-row--net td {
    border-top: none;
    padding-top: 4px;
    font-size: 0.95rem;
}

.lab-receipt__payment-section {
    border: 1px dashed #000;
    padding: 10px 12px;
    margin: 16px 0 20px;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.lab-receipt__payment-heading {
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-align: center;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.lab-receipt__money-wrap {
    display: block;
    text-align: right;
    margin: 0 0 8px;
}

.lab-receipt__money {
    display: inline-table;
    margin-left: auto;
}

.lab-receipt__payment-line {
    text-align: right;
    font-size: 0.82rem;
    margin: 4px 0 0;
}

.lab-receipt__payment-line--small {
    font-size: 0.75rem;
    color: #000;
}

.lab-receipt__footer {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 20px;
}

.lab-receipt__sign-label {
    font-weight: 700;
    flex-shrink: 0;
}

.lab-receipt__sign-line {
    flex: 1;
    border-bottom: 1px dashed #000;
    min-width: 12rem;
    height: 1px;
    margin-bottom: 2px;
}

@media print {
    .no-print { display: none !important; }
    .sidebar, .topbar { display: none !important; }
    .main-content { margin: 0 !important; }
    .print-receipt--hospital:not(.print-receipt--lab-form) { max-width: none; width: 88mm; }
    .print-receipt--lab-form { max-width: none; width: 100%; }
    .lab-receipt__payment-section,
    .lab-receipt__money-wrap,
    .ticket-receipt__money {
        display: block !important;
        visibility: visible !important;
    }
}

.badge-status { font-size: 0.7rem; padding: 0.25rem 0.5rem; border-radius: 6px; }

.income-statement {
    max-width: 760px;
    margin: 0 auto;
}
.income-statement__head {
    text-align: center;
    margin-bottom: 1.25rem;
}
.income-statement__head h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
}
.income-statement__head p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}
.income-statement table {
    width: 100%;
    border-collapse: collapse;
}
.income-statement th,
.income-statement td {
    padding: 0.45rem 0.6rem;
    vertical-align: middle;
}
.income-statement .is-amt {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    width: 10rem;
}
.income-statement .is-section td {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    padding-top: 0.85rem;
}
.income-statement .is-indent td:first-child { padding-left: 1.5rem; }
.income-statement .is-total td {
    font-weight: 700;
    border-top: 1px solid var(--border);
}
.income-statement .is-net td {
    font-weight: 800;
    font-size: 1.05rem;
    border-top: 2px solid var(--text);
    border-bottom: 4px double var(--text);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}
.income-statement .is-profit { color: #059669; }
.income-statement .is-loss { color: #dc2626; }
.income-statement__note {
    margin-top: 1rem;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.45;
}
.reports-tabs {
    flex-wrap: wrap;
    row-gap: 0.25rem;
}

[data-theme="dark"] .income-statement .is-net td {
    border-top-color: #e2e8f0;
    border-bottom-color: #e2e8f0;
}

/* Owner reports */
.reports-page { position: relative; }

.reports-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.15rem 1.35rem;
    margin-bottom: 1rem;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}

.reports-hero__brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.reports-hero h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.reports-hero .muted {
    margin: 0.15rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.reports-hero__meta {
    text-align: right;
    font-size: 0.82rem;
    color: var(--muted);
}

.reports-hero__meta strong {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
}

.reports-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: end;
    margin-bottom: 1rem;
}

.reports-toolbar .form-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.reports-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.reports-presets .btn {
    border-radius: 999px;
    font-size: 0.8rem;
    padding: 0.3rem 0.75rem;
}

.reports-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.65rem;
}

.reports-nav .nav-link {
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    background: var(--card-bg, #fff);
}

.reports-nav .nav-link:hover { border-color: var(--primary); color: var(--primary); }
.reports-nav .nav-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.report-kpi {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--card-shadow);
    height: 100%;
}

.report-kpi .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    font-weight: 600;
}

.report-kpi .value {
    font-size: 1.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-top: 0.2rem;
    line-height: 1.25;
}

.report-kpi .hint {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

.report-kpi--profit .value { color: #059669; }
.report-kpi--loss .value { color: #dc2626; }
.report-kpi--warn .value { color: #d97706; }

.report-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.report-section-head h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.report-alert-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.report-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--card-bg, #fff);
}

.report-chip--warn { color: #b45309; border-color: #fde68a; background: #fffbeb; }
.report-chip--danger { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.report-chip--ok { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }

.day-end-sign td,
.day-end-count td {
    height: 2.6rem;
    vertical-align: middle;
}

.day-end-count th,
.day-end-count td {
    font-variant-numeric: tabular-nums;
}

.day-end-count .day-count-input {
    max-width: 10rem;
    margin-left: auto;
}

.day-end-count .day-count-total th,
.day-end-count .day-count-total td {
    font-weight: 700;
    background: var(--table-head-bg, #f8fafc);
}

.day-diff.is-balanced { color: #059669; font-weight: 700; }
.day-diff.is-short { color: #dc2626; font-weight: 700; }
.day-diff.is-over { color: #d97706; font-weight: 700; }

.reports-loading {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.65);
    z-index: 5;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8rem;
    font-weight: 600;
    color: var(--muted);
}

.reports-page.is-loading .reports-loading { display: flex; }

[data-theme="dark"] .reports-loading {
    background: rgba(15, 23, 42, 0.7);
}
[data-theme="dark"] .report-chip--warn { background: #422006; border-color: #92400e; color: #fbbf24; }
[data-theme="dark"] .report-chip--danger { background: #450a0a; border-color: #991b1b; color: #fca5a5; }
[data-theme="dark"] .report-chip--ok { background: #064e3b; border-color: #047857; color: #6ee7b7; }

.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}
.rank-list li:last-child { border-bottom: none; }
.rank-list .muted { color: var(--muted); font-size: 0.78rem; }

@media print {
    .day-end-count .day-count-input,
    .day-end-sign .form-control {
        border: none;
        background: transparent;
        box-shadow: none;
        padding: 0;
        text-align: right;
    }
    .day-end-sign .form-control {
        text-align: left;
    }

    .reports-toolbar,
    .reports-nav,
    .reports-loading { display: none !important; }
    .tab-pane:not(.show):not(.active) { display: none !important; }
    .tab-pane.active,
    .tab-pane.show { display: block !important; }
    .reports-hero { box-shadow: none; }
    .report-kpi,
    .stat-card,
    .premium-card { box-shadow: none !important; break-inside: avoid; }
    .main-content,
    .page-content {
        height: auto !important;
        overflow: visible !important;
    }
    .dataTables_length,
    .dataTables_filter,
    .dataTables_paginate,
    .dataTables_info { display: none !important; }
}
