:root {
    color-scheme: light;
    
    /* Modern Clinical Palette */
    --primary: #0284c7;           /* Vibrant medical cyan/blue */
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --primary-glow: rgba(2, 132, 199, 0.15);

    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50:  #f8fafc;
    
    --bg-app: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --border-subtle: #f1f5f9;

    --ink: #0f172a;
    --muted: #64748b;
    
    /* Status indicators */
    --danger: #ef4444;
    --danger-dark: #b91c1c;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;

    --ok: #10b981;
    --ok-dark: #047857;
    --ok-bg: #ecfdf5;
    --ok-border: #a7f3d0;

    --warn: #f59e0b;
    --warn-dark: #b45309;
    --warn-bg: #fffbeb;
    --warn-border: #fde68a;

    --sidebar-bg: #0b1329;
    --sidebar-surface: #131f3d;
    --sidebar-border: #1e293b;
    --sidebar-text: #e2e8f0;
    --sidebar-muted: #8492a6;

    /* Subtle shadows & radius */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --heading-font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg-app);
    font-size: 0.8125rem;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { 
    color: var(--primary); 
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--primary-hover);
}

h1, h2, h3, h4, h5, h6 { 
    font-family: var(--heading-font); 
    font-weight: 700; 
    line-height: 1.25; 
    letter-spacing: -0.02em;
    color: var(--slate-900);
    margin: 0; 
}
h1 { font-size: 1.25rem; font-weight: 700; }
h2 { font-size: 0.95rem; }
h3 { font-size: 0.875rem; }
p { margin: 0; }

button, input, select, textarea { 
    font: inherit; 
    color: inherit; 
}

:focus-visible { 
    outline: 2px solid var(--primary); 
    outline-offset: 2px; 
}

/* Shell & Layout */
.shell { 
    display: flex; 
    min-height: 100vh; 
}

.sidebar {
    width: 216px;
    flex: none;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 12px 10px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand { 
    display: flex; 
    gap: 12px; 
    align-items: center; 
    color: inherit; 
    text-decoration: none; 
    padding: 2px 4px 12px; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
}
.brand strong {
    display: block;
    font-size: 0.9rem;
    font-family: var(--heading-font);
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}
.brand small { 
    display: block; 
    color: var(--sidebar-muted); 
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 2px;
}
.brand-mark {
    width: 30px; 
    height: 30px; 
    border-radius: 7px;
    display: grid; 
    place-items: center;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); 
    color: #ffffff;
    font-family: var(--heading-font); 
    font-size: 0.95rem;
    font-weight: 800;
    flex: none;
}

.nav { 
    display: flex; 
    flex-direction: column; 
    gap: 1px; 
}
.nav-label {
    margin: 12px 8px 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sidebar-muted);
}
.nav a {
    display: flex; 
    align-items: center; 
    gap: 12px;
    color: #cbd5e1; 
    text-decoration: none;
    padding: 6px 10px; 
    border-radius: var(--radius-sm); 
    font-size: 0.8125rem;
    font-weight: 600;
    transition: var(--transition);
}
.nav a svg { 
    width: 16px; 
    height: 16px; 
    fill: none; 
    stroke: currentColor; 
    stroke-width: 2; 
    stroke-linecap: round; 
    stroke-linejoin: round; 
    opacity: 0.85;
    transition: var(--transition);
}
.nav a:hover { 
    background: rgba(255, 255, 255, 0.06); 
    color: #ffffff; 
}
.nav a:hover svg {
    opacity: 1;
    transform: scale(1.05);
}
.nav a.is-active { 
    background: rgba(2, 132, 199, 0.18); 
    color: #38bdf8; 
    font-weight: 700;
    border-left: 3px solid #38bdf8;
    padding-left: 11px;
}
.nav a.is-active svg {
    stroke: #38bdf8;
    opacity: 1;
}

.sidebar-user { 
    margin-top: auto; 
    padding: 8px 8px; 
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex; 
    align-items: center;
    justify-content: space-between;
    gap: 10px; 
}
.sidebar-user strong { 
    display: block; 
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
}
.sidebar-user span { 
    display: block; 
    color: var(--sidebar-muted); 
    font-size: 0.78rem; 
    margin-top: 1px;
}
.sidebar .btn-quiet { 
    color: var(--sidebar-text); 
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    min-height: 32px;
}
.sidebar .btn-quiet:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.workspace { 
    flex: 1; 
    min-width: 0; 
}
.main-inner { 
    width: 100%;
    max-width: none; 
    margin: 0; 
    padding: 12px 16px 28px; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}
.menu-toggle, .backdrop { display: none; }

/* Page Header */
.page-head { 
    display: flex; 
    justify-content: space-between; 
    gap: 12px; 
    align-items: center; 
    padding-bottom: 0;
}
.page-head h1 {
    font-size: 1.25rem;
}
.page-head p, .muted, .lede { 
    color: var(--muted); 
    font-size: 0.8125rem;
    margin-top: 2px;
}
.page-actions, .form-actions, .row-actions { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    align-items: center; 
}
.eyebrow { 
    color: var(--primary); 
    font-weight: 700; 
    letter-spacing: 0.06em; 
    text-transform: uppercase; 
    font-size: 0.72rem; 
    margin-bottom: 6px; 
}

/* Cards & Surfaces */
.card, .stat, .login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.card { 
    padding: 12px 14px; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
}

.section-head { 
    display: flex; 
    justify-content: space-between; 
    gap: 16px; 
    align-items: center; 
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
    margin-bottom: 0;
}
.section-head h2 {
    font-size: 0.95rem;
}
.section-head a {
    font-size: 0.875rem;
    font-weight: 600;
}

/* Stats Cards */
.stats { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); 
    gap: 8px; 
}
.stat { 
    padding: 10px 12px; 
    text-decoration: none; 
    color: inherit; 
    display: flex; 
    flex-direction: column; 
    gap: 2px; 
    background: #ffffff;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.stat::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0.85;
}
.stat:hover {
    border-color: var(--slate-300);
    box-shadow: var(--shadow-sm);
}
.stat span { 
    color: var(--muted); 
    font-size: 0.7rem; 
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.stat strong { 
    font-family: var(--heading-font); 
    font-size: 1.2rem; 
    font-weight: 700;
    color: var(--slate-900);
    line-height: 1.1;
}
.stat small { 
    color: var(--slate-500); 
    font-size: 0.8125rem; 
    font-weight: 500;
}
.stat-warn { 
    background: #fffdf5; 
    border-color: var(--warn-border);
}
.stat-warn::before {
    background: var(--warn);
}
.stat-warn strong {
    color: var(--warn-dark);
}

.split { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 10px; 
}
.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
}
.role-grid, .check-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    gap: 10px; 
}
.role-grid { align-items: stretch; }
.check-grid { align-items: start; }
.role-card { height: 100%; }
.role-card > p { flex: 1; }
.role-card > .btn { margin-top: auto; align-self: flex-start; }
.form-grid .span-2 { grid-column: span 2; }
.stack { 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}

/* Buttons */
.btn {
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    min-height: 30px; 
    padding: 4px 10px; 
    border-radius: var(--radius-sm);
    border: 1px solid transparent; 
    text-decoration: none; 
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer; 
    background: transparent; 
    color: var(--slate-700);
    transition: var(--transition);
}
.btn-primary { 
    background: var(--primary); 
    color: #ffffff; 
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn-primary:hover { 
    background: var(--primary-hover); 
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(2, 132, 199, 0.25);
}
.btn-secondary { 
    background: #ffffff; 
    border-color: var(--border); 
    color: var(--slate-700);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { 
    background: var(--slate-50); 
    border-color: var(--slate-300);
    color: var(--slate-900);
}
.btn-danger { 
    background: var(--danger); 
    color: #ffffff; 
    box-shadow: 0 1px 2px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover { 
    background: var(--danger-dark); 
    color: #ffffff;
}
.btn-quiet { 
    color: var(--slate-600); 
    background: transparent;
}
.btn-quiet:hover {
    color: var(--slate-900);
    background: var(--slate-100);
}
.btn-small { 
    min-height: 26px; 
    padding: 2px 8px; 
    font-size: 0.75rem; 
}
.btn-block { width: 100%; }
.btn:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
}

/* Alerts */
.alert { 
    padding: 8px 12px; 
    border-radius: var(--radius-sm); 
    border: 1px solid; 
    font-size: 0.9rem;
    line-height: 1.45;
}
.alert ul { 
    margin: 8px 0 0; 
    padding-left: 20px; 
}
.alert-success { 
    background: var(--ok-bg); 
    border-color: var(--ok-border); 
    color: var(--ok-dark); 
}
.alert-error { 
    background: var(--danger-bg); 
    border-color: var(--danger-border); 
    color: var(--danger-dark); 
}
.callout { 
    background: #f0f9ff; 
    border: 1px solid #bae6fd; 
    border-radius: var(--radius-sm); 
    padding: 8px 12px; 
    display: flex; 
    justify-content: space-between; 
    gap: 14px; 
    align-items: center; 
    color: #0369a1;
    font-size: 0.9rem;
}
.callout a {
    font-weight: 700;
}

/* Forms & Inputs */
.filters { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    align-items: flex-end; 
    background: #ffffff;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}
.field { 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    min-width: 140px; 
}
.field.grow, .field.wide { 
    flex: 1; 
    min-width: 180px; 
}
.field > span, .picker-add label { 
    font-weight: 600; 
    font-size: 0.75rem;
    color: var(--slate-700);
}
.field small { 
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
}
.field .field-error { 
    color: var(--danger); 
    font-size: 0.8rem;
    font-weight: 600;
}
abbr { 
    text-decoration: none; 
    color: var(--danger); 
}
.form-grid { 
    display: grid; 
    grid-template-columns: repeat(3, minmax(0, 1fr)); 
    gap: 10px 12px; 
}
.form-grid .wide { 
    grid-column: 1 / -1; 
}
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    width: 100%; 
    min-height: 32px; 
    border: 1px solid var(--border); 
    border-radius: var(--radius-sm);
    padding: 4px 8px; 
    background: #ffffff;
    color: var(--slate-800);
    font-size: 0.8125rem;
    transition: var(--transition);
}
input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover,
textarea:hover {
    border-color: var(--slate-300);
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
}
textarea { 
    min-height: 64px; 
    resize: vertical; 
}
.is-invalid, input.is-over { 
    border-color: var(--danger) !important; 
    background: #fffafa; 
}
.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.input-prefix { 
    display: flex; 
    align-items: center; 
    border: 1px solid var(--border); 
    border-radius: var(--radius-sm); 
    background: #ffffff; 
    transition: var(--transition);
}
.input-prefix:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.input-prefix span { 
    padding-left: 14px; 
    color: var(--slate-400); 
    font-weight: 600;
}
.input-prefix input { 
    border: 0; 
    min-height: 30px; 
    box-shadow: none !important;
}

.password-row { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
}
.password-row input { flex: 1; }

.check { 
    display: inline-flex; 
    gap: 8px; 
    align-items: center; 
    font-weight: 500; 
    cursor: pointer;
    font-size: 0.8125rem;
    line-height: 1.3;
    color: var(--slate-700);
    margin: 0;
}
.check span {
    font-weight: 500;
    font-size: 0.8125rem;
    line-height: 1.3;
    color: var(--slate-800);
}
.check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    min-height: 15px;
    margin: 0;
    padding: 0;
    flex: 0 0 15px;
    border: 1.5px solid var(--slate-300);
    border-radius: 4px;
    background: #ffffff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: none;
}
.check input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}
.check input[type="checkbox"]:checked::after {
    content: "";
    width: 8px;
    height: 4px;
    border-left: 1.5px solid #ffffff;
    border-bottom: 1.5px solid #ffffff;
    transform: translateY(-1px) rotate(-45deg);
}
.check input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.check-card {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--slate-50);
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.check-card legend {
    padding: 0 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--slate-500);
}
.check-card .check {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
}

/* Filter Chips & Tabs */
.chips, .tabs { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
}
.chip, .tab {
    border: 1px solid var(--border); 
    background: #ffffff; 
    color: var(--slate-600);
    border-radius: var(--radius-full); 
    padding: 4px 10px; 
    text-decoration: none; 
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}
.chip:hover, .tab:hover {
    border-color: var(--slate-300);
    background: var(--slate-50);
    color: var(--slate-900);
}
.chip.is-on, .tab.is-on { 
    background: var(--primary); 
    color: #ffffff; 
    border-color: var(--primary); 
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

/* Tables */
.table-wrap { 
    overflow-x: auto; 
    border: 1px solid var(--border); 
    border-radius: var(--radius-md); 
    background: #ffffff; 
    box-shadow: var(--shadow-xs);
}
table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 0.8125rem;
}
th { 
    text-align: left; 
    font-size: 0.68rem; 
    font-weight: 700;
    letter-spacing: 0.04em; 
    text-transform: uppercase; 
    color: var(--slate-500); 
    padding: 6px 10px; 
    background: #f8fafc; 
    border-bottom: 1px solid var(--border);
}
td { 
    padding: 6px 10px; 
    border-top: 1px solid var(--border-subtle); 
    vertical-align: middle; 
    color: var(--slate-700);
}
td strong {
    color: var(--slate-900);
}
td small { 
    display: block; 
    color: var(--slate-400); 
    font-size: 0.8rem;
    margin-top: 2px;
}
tr:hover td { 
    background: #f8fafc; 
}
td input { 
    min-height: 28px; 
    padding: 3px 8px;
}

/* Status Pills */
.pill { 
    display: inline-flex; 
    align-items: center; 
    border-radius: var(--radius-full); 
    padding: 3px 11px; 
    font-size: 0.775rem; 
    font-weight: 700; 
    letter-spacing: 0.01em;
    white-space: nowrap; 
}
.pill-ok { 
    background: var(--ok-bg); 
    color: var(--ok-dark); 
    border: 1px solid var(--ok-border);
}
.pill-warn { 
    background: var(--warn-bg); 
    color: var(--warn-dark); 
    border: 1px solid var(--warn-border);
}
.pill-danger { 
    background: var(--danger-bg); 
    color: var(--danger-dark); 
    border: 1px solid var(--danger-border);
}
.pill-muted { 
    background: var(--slate-100); 
    color: var(--slate-600); 
    border: 1px solid var(--slate-200);
}

.plain-list { 
    list-style: none; 
    margin: 0; 
    padding: 0; 
    display: flex; 
    flex-direction: column; 
}
.plain-list li { 
    border-top: 1px solid var(--border-subtle); 
}
.plain-list a, .plain-list li { 
    display: flex; 
    flex-direction: column; 
    padding: 7px 4px; 
    text-decoration: none; 
    color: inherit; 
    transition: var(--transition);
}
.plain-list a:hover {
    background: var(--slate-50);
    padding-left: 10px;
    border-radius: var(--radius-sm);
}
.plain-list span { 
    color: var(--muted); 
    font-size: 0.84rem;
    margin-top: 2px;
}
.result-count { 
    color: var(--muted); 
    font-size: 0.875rem; 
}

/* Pager */
.pager { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
}
.pager-link { 
    padding: 7px 14px; 
    border-radius: var(--radius-sm); 
    background: #ffffff; 
    border: 1px solid var(--border); 
    text-decoration: none; 
    font-weight: 600; 
    font-size: 0.875rem;
    color: var(--slate-700);
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}
.pager-link:hover:not(.is-disabled) {
    border-color: var(--slate-300);
    background: var(--slate-50);
    color: var(--slate-900);
}
.pager-link.is-disabled { 
    color: var(--slate-300); 
    border-color: var(--border-subtle);
    background: var(--slate-50);
}
.pager-status {
    color: var(--muted);
    font-size: 0.85rem;
    padding: 0 4px;
}

.empty { 
    text-align: center; 
    padding: 28px 16px; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    align-items: center; 
}
.empty h2 {
    font-size: 1.25rem;
    color: var(--slate-800);
}
.empty p {
    color: var(--muted);
    max-width: 48ch;
}
.welcome-card p { max-width: 62ch; }

/* Interactive Medicine Picker in Billing/Stock */
.picker { 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px;
}
.picker-results { 
    border: 1px solid var(--border); 
    border-radius: var(--radius-sm); 
    overflow: hidden; 
    background: #ffffff; 
    box-shadow: var(--shadow-md);
}
.picker-results button { 
    width: 100%; 
    text-align: left; 
    background: #ffffff; 
    border: 0; 
    border-bottom: 1px solid var(--border-subtle); 
    padding: 10px 14px; 
    cursor: pointer; 
    transition: var(--transition);
}
.picker-results button:hover { 
    background: #f0f9ff; 
}
.picker-results strong, .picker-results small { display: block; }
.picker-results small { color: var(--muted); font-size: 0.8rem; }
.picker-selected { 
    display: flex; 
    gap: 12px; 
    align-items: center; 
    background: #e0f2fe; 
    border: 1px solid #bae6fd;
    border-radius: var(--radius-sm); 
    padding: 10px 14px; 
    color: #0369a1;
}
.picker-selected span { 
    color: #0284c7; 
    margin-right: auto; 
    font-size: 0.875rem;
}
.picker-add { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 12px; 
    align-items: flex-end; 
}
.picker-add label { 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
    min-width: 130px; 
}
.picker-note:empty { display: none; }
.picker-note { 
    color: var(--primary-hover); 
    font-weight: 600; 
    font-size: 0.85rem;
}

/* Total Bar */
.total-bar {
    display: flex; 
    flex-wrap: wrap; 
    gap: 16px; 
    align-items: center;
    background: var(--slate-900); 
    color: #ffffff; 
    border-radius: var(--radius-md); 
    padding: 8px 12px;
    margin-top: 0;
    box-shadow: var(--shadow-md);
}
.total-bar span { 
    display: block; 
    color: var(--slate-400); 
    font-size: 0.75rem; 
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}
.total-bar strong { 
    font-size: 1rem; 
    font-family: var(--heading-font);
    font-weight: 700;
}
.total-bar .btn { 
    margin-left: auto; 
    padding: 10px 22px;
}

/* Bill / Invoices */
.sheet { 
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}
.bill-top {
    border-bottom: 2px solid var(--slate-900);
    padding-bottom: 16px;
}
.bill-top, .bill-meta, .totals { 
    display: flex; 
    justify-content: space-between; 
    gap: 16px; 
    flex-wrap: wrap; 
}
.bill-meta {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    border: 1px solid var(--border);
}
.bill-meta div, .totals div { 
    display: flex; 
    flex-direction: column; 
    gap: 3px; 
}
.bill-meta span, .totals span {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.bill-meta strong {
    color: var(--slate-900);
    font-size: 0.95rem;
}
.bill-number {
    text-align: right;
}
.bill-number span {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.bill-number strong {
    font-family: var(--heading-font); 
    font-size: 1.15rem; 
    color: var(--slate-900);
}
.totals {
    margin-top: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    align-items: center;
}
.totals .grand strong { 
    font-family: var(--heading-font); 
    font-size: 1.15rem; 
    color: var(--primary-hover);
}
.bill-thanks { 
    margin-top: 12px; 
    color: var(--muted);
    font-weight: 500;
    text-align: center;
}
.sheet { break-inside: avoid; }
.print-only { display: none; }

/* Guest / Login Layout */
.guest-body { 
    min-height: 100vh; 
    display: grid; 
    place-items: center; 
    padding: 24px; 
    background: radial-gradient(circle at 50% 20%, #f0f9ff 0%, #e2e8f0 100%);
}
.login-wrap { 
    width: min(440px, 100%); 
}
.login-card { 
    padding: 22px 20px; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-lg);
    background: #ffffff;
}
.login-card h1 { 
    font-size: 1.35rem; 
}

/* Responsiveness */
@media (max-width: 1100px) {
    .form-grid { grid-template-columns: 1fr 1fr; }
    .dash-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
    .stats, .split, .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .wide, .form-grid .span-2 { grid-column: auto; }
}
@media (max-width: 860px) {
    .menu-toggle { 
        display: inline-flex; 
        align-items: center;
        justify-content: center;
        position: fixed;
        z-index: 40;
        top: 10px;
        left: 12px;
        width: 34px;
        height: 34px;
        margin: 0;
        padding: 0;
        color: var(--slate-800);
        background: #ffffff;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        cursor: pointer;
        box-shadow: var(--shadow-xs);
    }
    .shell.is-open .menu-toggle {
        left: 228px;
    }
    .menu-toggle svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    .menu-toggle .icon-close { display: none; }
    .shell.is-open .menu-toggle .icon-menu { display: none; }
    .shell.is-open .menu-toggle .icon-close { display: block; }
    .sidebar { 
        position: fixed; 
        z-index: 30; 
        transform: translateX(-105%); 
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); 
    }
    .shell.is-open .sidebar { 
        transform: none; 
    }
    .backdrop { 
        position: fixed; 
        inset: 0; 
        background: rgba(15, 23, 42, 0.5); 
        backdrop-filter: blur(2px);
        z-index: 20; 
    }
    .shell.is-open .backdrop { 
        display: block; 
    }
    .main-inner { 
        padding: 52px 12px 24px; 
    }
    .page-head { 
        flex-direction: column; 
        align-items: flex-start;
    }
}

.filters .check {
    min-height: 32px;
    padding-bottom: 1px;
}
input.date-alt {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    padding-right: 28px;
}
.flatpickr-calendar {
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-family: var(--font);
    overflow: hidden;
}
.flatpickr-months .flatpickr-month {
    color: var(--slate-800);
    fill: var(--slate-800);
    height: 36px;
}
.flatpickr-current-month {
    font-size: 0.85rem;
    font-weight: 700;
    padding-top: 8px;
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: var(--primary);
}
.flatpickr-weekdays {
    background: var(--slate-50);
}
span.flatpickr-weekday {
    color: var(--slate-500);
    font-size: 0.7rem;
    font-weight: 700;
}
.flatpickr-day {
    border-radius: 6px;
    color: var(--slate-800);
}
.flatpickr-day.today {
    border-color: var(--primary);
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}
.flatpickr-day:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

/* Print Optimization */
@media print {
    .sidebar, .menu-toggle, .backdrop, .no-print, .alert, .total-bar, .flatpickr-calendar { 
        display: none !important; 
    }
    .shell, .workspace, .main-inner { 
        display: block; 
        max-width: none; 
        padding: 0; 
    }
    body { 
        background: #ffffff; 
    }
    .card, .sheet { 
        box-shadow: none; 
        border: 0; 
        padding: 0;
    }
    .print-only { 
        display: block; 
        margin-bottom: 16px; 
    }
}
