/* ==========================================================================
   ELEVATED SOFTWARE - Care management suite (white-label)
   Brand: gold #a09370, black, white. Arial typeface.
   ========================================================================== */

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { line-height: 1.5; -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
table { border-collapse: collapse; border-spacing: 0; }
img { display: block; max-width: 100%; }

/* --- DESIGN TOKENS --- */
:root {
    /* Elevated Software brand: gold + black + white */
    --primary: #a09370;
    --primary-deep: #857a5c;
    --primary-mild: #b6ac90;
    --primary-subtle: rgba(160, 147, 112, 0.14);
    --accent: #a09370;
    --accent-deep: #857a5c;
    --accent-subtle: rgba(160, 147, 112, 0.14);
    --ink: #18181b;
    --ink-soft: #27272a;

    /* Restrained functional status */
    --success: #2f7d52;
    --success-subtle: rgba(47, 125, 82, 0.12);
    --error: #b3261e;
    --error-subtle: rgba(179, 38, 30, 0.10);
    --warning: #9a6700;
    --warning-subtle: rgba(154, 103, 0, 0.12);
    --info: #857a5c;
    --info-subtle: rgba(160, 147, 112, 0.14);

    --neutral: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f4f4f5;
    --gray-150: #ededee;
    --gray-200: #e4e4e7;
    --gray-300: #d4d4d8;
    --gray-400: #a1a1aa;
    --gray-500: #71717a;
    --gray-600: #52525b;
    --gray-700: #3f3f46;
    --gray-800: #27272a;
    --gray-900: #18181b;
    --gray-950: #09090b;

    /* Legacy pastel tints kept for avatars (subtle, human warmth) */
    --sky-100: #e6eef7; --sky-200: #cdddee;
    --emerald-100: #e3efe8; --emerald-200: #c8dfd2;
    --purple-100: #efe8f5; --purple-200: #ddccea;
    --orange-100: #f6ece1; --orange-200: #ecd7c0;
    --amber-100: #f5efdd; --amber-200: #ece0bb;
    --rose-100: #f6e6e8; --rose-200: #eccdd1;
    --teal-100: #e0f1f9; --teal-200: #c2e4f3;

    --header-height: 64px;
    --side-nav-width: 256px;
    --font-sans: Arial, 'Helvetica Neue', Helvetica, sans-serif;
    --font-display: Arial, 'Helvetica Neue', Helvetica, sans-serif;
}

/* --- BODY --- */
body {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    background: var(--gray-100);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- TYPOGRAPHY --- */
h1, .h1 { font-size: 2rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; letter-spacing: -0.015em; font-family: var(--font-display); }
h2, .h2 { font-size: 1.625rem; font-weight: 700; color: var(--gray-900); line-height: 1.25; letter-spacing: -0.01em; font-family: var(--font-display); }
h3, .h3 { font-size: 1.375rem; font-weight: 700; color: var(--gray-900); line-height: 1.3; font-family: var(--font-display); }
h4, .h4 { font-size: 1.125rem; font-weight: 700; color: var(--gray-900); line-height: 1.35; font-family: var(--font-display); }
h5, .h5 { font-size: 1rem; font-weight: 700; color: var(--gray-900); line-height: 1.4; }
h6, .h6 { font-size: 0.9375rem; font-weight: 600; color: var(--gray-900); line-height: 1.5; }
.heading-text { color: var(--gray-900); }
.text-muted { color: var(--gray-400); }
.font-display { font-family: var(--font-display); }

/* ====================
   LAYOUT SHELL
   ==================== */
.app-layout { display: flex; min-height: 100vh; }

/* --- DARK SIDEBAR --- */
.side-nav {
    width: var(--side-nav-width);
    background: #000000;
    border-right: 1px solid rgba(255,255,255,0.08);
    position: fixed; top: 0; left: 0; height: 100vh;
    display: flex; flex-direction: column; flex-shrink: 0;
    z-index: 40; overflow: hidden;
}
.side-nav-logo {
    display: flex; align-items: center; justify-content: center;
    padding: 1.125rem 1.25rem; flex-shrink: 0; min-height: var(--header-height);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.side-nav-logo .logo-plate {
    background: transparent; padding: 0;
    display: flex; align-items: center; justify-content: center; width: 100%;
}
.side-nav-logo .logo-plate img { width: 100%; height: auto; max-height: 48px; object-fit: contain; }
.side-nav-content {
    flex: 1; overflow-y: auto; padding: 0.75rem 0.625rem 1rem;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.25) transparent;
}
.side-nav-content::-webkit-scrollbar { width: 4px; }
.side-nav-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 4px; }
.menu-group-label {
    font-size: 0.625rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: rgba(255,255,255,0.5);
    padding: 1.125rem 0.75rem 0.5rem;
}
.menu-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5625rem 0.75rem; border-radius: 0.5rem;
    font-weight: 500; font-size: 0.875rem; color: rgba(255,255,255,0.78);
    cursor: pointer; transition: color 0.15s, background 0.15s;
    width: 100%; text-decoration: none; margin-bottom: 1px; position: relative;
}
.menu-item:hover { color: #fff; background: rgba(255,255,255,0.08); }
.menu-item.active { color: #18181b; background: var(--primary); font-weight: 600; }
.menu-item.active:hover { background: var(--primary-deep); color: #18181b; }
.menu-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.menu-item .menu-badge {
    margin-left: auto; font-size: 0.6875rem; font-weight: 700;
    background: rgba(255,255,255,0.14); color: #fff; border-radius: 0.5rem;
    min-width: 1.375rem; height: 1.25rem; display: inline-flex;
    align-items: center; justify-content: center; padding: 0 0.4375rem;
}
.menu-item.active .menu-badge { background: rgba(0,0,0,0.2); color: #18181b; }

/* --- HEADER --- */
.header {
    height: var(--header-height); background: var(--neutral);
    display: flex; align-items: center; position: sticky; top: 0; z-index: 30;
    border-bottom: 1px solid var(--gray-200);
}
.header-wrapper { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 0 1.5rem; }
.header-left { display: flex; align-items: center; gap: 0.875rem; }
.header-right { display: flex; align-items: center; gap: 0.25rem; }
.header-search {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--gray-100); border: 1px solid var(--gray-200);
    border-radius: 0.625rem; padding: 0.4375rem 0.875rem; color: var(--gray-400); width: 300px;
}
.header-search input { border: none; background: none; outline: none; font-family: inherit; font-weight: 500; font-size: 0.8125rem; color: var(--gray-800); width: 100%; }
.header-action-item {
    display: flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem; border-radius: 9999px;
    cursor: pointer; color: var(--gray-600); transition: background 0.2s, color 0.2s;
}
.header-action-item:hover { background: var(--gray-100); color: var(--gray-900); }
.header-action-item svg { width: 19px; height: 19px; }

.main-content { flex: 1; margin-left: var(--side-nav-width); display: flex; flex-direction: column; min-width: 0; }
.page-container { padding: 2rem 2rem; flex: 1; }

/* --- FLOATING MOBILE MENU BUTTON (header removed globally) --- */
.floating-menu-btn {
    display: none;
    position: fixed; top: 0.75rem; left: 0.75rem; z-index: 38;
    width: 2.5rem; height: 2.5rem; border-radius: 0.625rem;
    align-items: center; justify-content: center;
    background: var(--neutral); color: var(--gray-800);
    border: 1px solid var(--gray-200); box-shadow: 0 2px 8px rgba(6,17,40,0.12);
}
.floating-menu-btn svg { width: 20px; height: 20px; }
.nav-backdrop { position: fixed; inset: 0; background: rgba(6,17,40,0.4); z-index: 39; display: none; }
.nav-backdrop.open { display: block; }
.footer { padding: 1.25rem 2rem; display: flex; justify-content: space-between; align-items: center; font-size: 0.8125rem; color: var(--gray-400); border-top: 1px solid var(--gray-200); flex-wrap: wrap; gap: 0.5rem; }

/* --- PAGE HEAD --- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.75rem; }
.page-head .subtitle { margin-top: 0.375rem; color: var(--gray-500); max-width: 46rem; }
.breadcrumb { display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: var(--gray-400); margin-bottom: 0.5rem; font-weight: 600; }
.breadcrumb svg { width: 13px; height: 13px; }

/* ====================
   COMPONENTS
   ==================== */
.card { background: var(--neutral); border-radius: 1rem; border: 1px solid var(--gray-200); box-shadow: 0 1px 2px rgba(6,17,40,0.04), 0 4px 16px rgba(6,17,40,0.04); }
.card-border { border: 1px solid var(--gray-200); }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 1.125rem 1.25rem; border-bottom: 1px solid var(--gray-150); }
.card-header-border { padding: 1.125rem 1.25rem; border-bottom: 1px solid var(--gray-150); }
.card-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); font-family: var(--font-display); }
.card-body { padding: 1.25rem; }
.card-footer { padding: 0.875rem 1.25rem; }
.card-footer-border { border-top: 1px solid var(--gray-150); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 0.5rem; color: var(--gray-400); transition: all 0.15s; }
.icon-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.icon-btn svg { width: 18px; height: 18px; }

/* --- STAT TRAY (re-skinned: cards float on body, no gray tray) --- */
.stat-tray { display: grid; gap: 1rem; background: transparent; border-radius: 0; padding: 0; }
.stat-tray.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stat-tray.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-tray.cols-4 { grid-template-columns: repeat(4, 1fr); }
.stat-card { padding: 1.25rem; border-radius: 1rem; text-align: left; background: var(--neutral); border: 1px solid var(--gray-200); box-shadow: 0 1px 2px rgba(6,17,40,0.04), 0 4px 16px rgba(6,17,40,0.04); transition: box-shadow 0.15s; }
.stat-card:hover { box-shadow: 0 6px 22px rgba(6,17,40,0.08); }
.stat-card-inner { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-card-label { font-size: 0.8125rem; font-weight: 600; color: var(--gray-500); margin-bottom: 0.875rem; }
.stat-card-value { font-size: 1.875rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.375rem; font-family: var(--font-display); line-height: 1.1; }
.stat-card-value span { font-family: var(--font-sans); }
.stat-card-compare { display: inline-flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; font-size: 0.75rem; font-weight: 600; }
/* bare icon, no background plate (overrides any inline pastel) */
.stat-card-icon { width: 2.75rem !important; height: 2.75rem !important; border-radius: 0 !important; display: flex; align-items: center; justify-content: center; background: transparent !important; color: var(--primary) !important; flex-shrink: 0; }
.stat-card-icon svg { width: 24px; height: 24px; }

.grow-value { color: var(--success); font-weight: 700; }
.shrink-value { color: var(--error); font-weight: 700; }

/* --- BUTTON --- */
.btn {
    font-family: var(--font-sans); font-weight: 600; font-size: 0.8125rem;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    border-radius: 0.625rem; padding: 0.5rem 1rem;
    border: 1px solid var(--gray-200); background: var(--neutral); color: var(--gray-800);
    cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.btn:hover { border-color: var(--gray-300); background: var(--gray-50); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.78125rem; border-radius: 0.5rem; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 0.6875rem 1.5rem; font-size: 0.9375rem; }
.btn-solid { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-solid:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-plain { background: transparent; border-color: transparent; color: var(--primary); padding-left: 0.5rem; padding-right: 0.5rem; }
.btn-plain:hover { color: var(--primary-deep); text-decoration: underline; }
.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger:hover { background: #97201a; border-color: #97201a; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* --- INPUT --- */
.input {
    font-family: var(--font-sans); width: 100%; padding: 0.5625rem 0.75rem;
    font-size: 0.875rem; font-weight: 500; color: var(--gray-800);
    background: var(--neutral); border: 1px solid var(--gray-300);
    border-radius: 0.625rem; outline: none; transition: all 0.15s;
}
.input::placeholder { color: var(--gray-400); font-weight: 400; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
textarea.input { min-height: 6.5rem; resize: vertical; }
.select {
    font-family: var(--font-sans); padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.8125rem; font-weight: 600; color: var(--gray-800);
    background: var(--neutral); border: 1px solid var(--gray-300);
    border-radius: 0.625rem; outline: none; appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.625rem center; transition: all 0.15s;
}
.select:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.form-item { margin-bottom: 1.25rem; }
.form-label { display: flex; align-items: center; gap: 0.375rem; font-weight: 600; margin-bottom: 0.4375rem; color: var(--gray-700); font-size: 0.8125rem; }
.form-label svg { width: 14px; height: 14px; color: var(--gray-400); }
.form-hint { font-size: 0.75rem; color: var(--gray-400); margin-top: 0.25rem; }

/* --- TABLE --- */
.table { width: 100%; }
.table thead th {
    padding: 0.75rem 1.25rem; text-align: left; font-size: 0.6875rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--gray-500); border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
.table tbody td { padding: 0.875rem 1.25rem; border-bottom: 1px solid var(--gray-150); font-weight: 500; color: var(--gray-600); }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr { cursor: pointer; transition: background 0.12s; }
.table-hover tbody tr:hover td { background: var(--gray-50); }
.table .heading-text { color: var(--gray-900); font-weight: 700; }

/* --- TAG (plain text, no pill background) --- */
.tag {
    display: inline-flex; align-items: center; gap: 0.3125rem;
    padding: 0; border-radius: 0;
    font-size: 0.71875rem; font-weight: 600; white-space: nowrap;
    background: transparent; color: var(--gray-600);
}
.tag svg { width: 12px; height: 12px; }
.tag-success { background: transparent; color: var(--success); }
.tag-error { background: transparent; color: var(--error); }
.tag-warning { background: transparent; color: var(--warning); }
.tag-primary { background: transparent; color: var(--primary); }
.tag-info { background: transparent; color: var(--accent-deep); }
.tag-accent { background: transparent; color: var(--accent-deep); }
.tag-neutral { background: transparent; color: var(--gray-600); }
.tag-purple { background: transparent; color: var(--primary); }
.tag-dark { background: transparent; color: var(--gray-900); }
.tag-outline { background: transparent; border: none; color: var(--gray-600); }

/* --- STATUS DOT --- */
.status-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 9999px; flex-shrink: 0; }
.status-dot-success { background: var(--success); }
.status-dot-warning { background: var(--warning); }
.status-dot-error { background: var(--error); }
.status-dot-primary { background: var(--primary); }
.status-dot-gray { background: var(--gray-400); }

/* --- AVATAR (consistent light tint, initials only) --- */
.avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--primary-subtle) !important; color: var(--primary-deep) !important; font-weight: 600; overflow: hidden; flex-shrink: 0; border-radius: 0.625rem; }
.avatar-xs { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.avatar-sm { width: 2rem; height: 2rem; font-size: 0.6875rem; }
.avatar-md { width: 2.5rem; height: 2.5rem; font-size: 0.8125rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 0.9375rem; }
.avatar-xl { width: 4rem; height: 4rem; font-size: 1.25rem; }
.avatar-circle { border-radius: 9999px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-group { display: inline-flex; }
.avatar-group .avatar { margin-left: -0.5rem; border: 2px solid var(--neutral); }
.avatar-group .avatar:first-child { margin-left: 0; }

/* --- TABS (underline) --- */
.tab-list { display: flex; align-items: center; gap: 0.25rem; border-bottom: 1px solid var(--gray-200); overflow-x: auto; scrollbar-width: none; }
.tab-list::-webkit-scrollbar { display: none; }
.tab-nav { font-weight: 600; font-size: 0.875rem; padding: 0.75rem 1rem; color: var(--gray-500); border-bottom: 2px solid transparent; cursor: pointer; transition: all 0.15s; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.5rem; }
.tab-nav:hover { color: var(--gray-900); }
.tab-nav.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-nav svg { width: 16px; height: 16px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.25s ease; }

/* --- SEGMENT --- */
.segment { display: inline-flex; border-radius: 0.625rem; padding: 0.25rem; background: var(--gray-150); }
.segment-item { font-weight: 600; font-size: 0.8125rem; padding: 0.375rem 0.875rem; border-radius: 0.4375rem; cursor: pointer; color: var(--gray-500); transition: all 0.1s; background: transparent; border: none; font-family: var(--font-sans); white-space: nowrap; }
.segment-item:hover:not(.active) { color: var(--gray-800); }
.segment-item.active { background: var(--neutral); color: var(--gray-900); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* --- BADGE --- */
.badge { position: relative; display: inline-flex; }
.badge-dot { position: absolute; top: -2px; right: -2px; width: 0.5rem; height: 0.5rem; border-radius: 9999px; background: var(--error); border: 2px solid var(--neutral); }
.badge-count { position: absolute; top: -6px; right: -6px; min-width: 1.125rem; height: 1.125rem; display: flex; align-items: center; justify-content: center; border-radius: 9999px; background: var(--error); color: #fff; font-size: 0.625rem; font-weight: 700; padding: 0 0.25rem; border: 2px solid var(--neutral); }

/* --- PROGRESS --- */
.progress { display: flex; align-items: center; width: 100%; gap: 0.625rem; }
.progress-track { flex: 1; height: 0.375rem; border-radius: 9999px; background: var(--gray-200); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 9999px; background: var(--primary); transition: width 0.4s; }
.progress-bar-success { background: var(--success); }
.progress-bar-warning { background: var(--warning); }
.progress-bar-error { background: var(--error); }
.progress-label { font-weight: 700; font-size: 0.75rem; white-space: nowrap; color: var(--gray-700); }

/* --- CIRCULAR PROGRESS --- */
.progress-circle { position: relative; display: inline-flex; }
.progress-circle svg { transform: rotate(-90deg); }
.progress-circle-trail { stroke: var(--gray-200); }
.progress-circle-bar { transition: stroke-dashoffset 0.5s; }
.progress-circle-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-weight: 700; font-size: 1rem; color: var(--gray-900); font-family: var(--font-display); }

/* --- ALERT --- */
.alert { padding: 0.9375rem 1.0625rem; border-radius: 0.75rem; display: flex; gap: 0.75rem; align-items: flex-start; font-weight: 500; }
.alert svg { width: 19px; height: 19px; flex-shrink: 0; margin-top: 1px; }
.alert-info { background: var(--accent-subtle); color: var(--accent-deep); }
.alert-success { background: var(--success-subtle); color: var(--success); }
.alert-warning { background: var(--warning-subtle); color: var(--warning); }
.alert-error { background: var(--error-subtle); color: var(--error); }

/* --- DIALOG --- */
.dialog-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(6,17,40,0.55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 1rem; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.dialog-overlay.open { opacity: 1; pointer-events: auto; }
.dialog-content { background: var(--neutral); border-radius: 1.25rem; box-shadow: 0 48px 64px -16px rgba(6,17,40,0.32); max-width: 80rem; width: 100%; position: relative; max-height: 90vh; overflow-y: auto; padding: 1.5rem; transform: translateY(8px) scale(0.98); transition: transform 0.2s; }
.dialog-overlay.open .dialog-content { transform: translateY(0) scale(1); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; }

/* --- DRAWER --- */
.drawer-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(6,17,40,0.45); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
/* Drawers render as centred pop-up modals (no slide-in) */
.drawer { position: fixed; top: 50%; left: 50%; width: 80rem; max-width: 94vw; max-height: 90vh; background: var(--neutral); z-index: 51; border-radius: 1.25rem; overflow: hidden; box-shadow: 0 48px 64px -16px rgba(6,17,40,0.32); transform: translate(-50%, -50%) scale(0.98); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; display: flex; flex-direction: column; }
.drawer.open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.drawer-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--gray-150); display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1.5rem; }
.drawer-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-150); display: flex; gap: 0.75rem; justify-content: flex-end; }

/* --- DROPDOWN --- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; top: 100%; margin-top: 0.375rem; border-radius: 0.875rem; background: var(--neutral); box-shadow: 0 24px 48px -12px rgba(6,17,40,0.22); border: 1px solid var(--gray-200); padding: 0.5rem; z-index: 45; min-width: 13rem; opacity: 0; pointer-events: none; transform: translateY(-4px); transition: all 0.15s; }
.dropdown-menu.right { right: 0; }
.dropdown.open .dropdown-menu { opacity: 1; pointer-events: auto; transform: translateY(0); }
.dropdown-item { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.625rem; border-radius: 0.5rem; cursor: pointer; font-weight: 500; font-size: 0.875rem; color: var(--gray-700); transition: all 0.12s; }
.dropdown-item svg { width: 16px; height: 16px; }
.dropdown-item:hover { background: var(--gray-100); color: var(--gray-900); }
.dropdown-divider { height: 1px; background: var(--gray-150); margin: 0.375rem 0; }

/* --- CHECKBOX / RADIO / SWITCH --- */
.checkbox { width: 1.125rem; height: 1.125rem; border: 1.5px solid var(--gray-400); border-radius: 0.3125rem; cursor: pointer; appearance: none; vertical-align: middle; flex-shrink: 0; transition: all 0.15s; }
.checkbox:checked { background: var(--primary); border-color: var(--primary); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; }
.checkbox-label { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: 500; color: var(--gray-700); }
.radio { width: 1.125rem; height: 1.125rem; border: 1.5px solid var(--gray-400); border-radius: 9999px; cursor: pointer; appearance: none; vertical-align: middle; flex-shrink: 0; transition: all 0.15s; }
.radio:checked { background: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 3px #fff; }
.switcher { width: 2.75rem; height: 1.5rem; display: inline-flex; align-items: center; position: relative; border-radius: 1.5rem; background: var(--gray-300); cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.switcher.checked { background: var(--primary); }
.switcher-toggle { position: absolute; left: 0.1875rem; top: 50%; transform: translateY(-50%); width: 1.125rem; height: 1.125rem; background: #fff; border-radius: 9999px; transition: left 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switcher.checked .switcher-toggle { left: calc(100% - 1.3125rem); }

/* --- CLOSE BUTTON --- */
.close-btn { width: 2rem; height: 2rem; border-radius: 9999px; display: inline-flex; align-items: center; justify-content: center; background: var(--gray-100); color: var(--gray-500); transition: all 0.15s; flex-shrink: 0; }
.close-btn:hover { background: var(--gray-200); color: var(--gray-900); }
.close-btn svg { width: 16px; height: 16px; }

/* --- TOAST (dark) --- */
.toast-stack { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 80; display: flex; flex-direction: column; gap: 0.625rem; }
.toast { background: var(--gray-900); color: #fff; border-radius: 0.75rem; padding: 0.875rem 1.125rem; display: flex; gap: 0.75rem; align-items: center; box-shadow: 0 16px 32px rgba(6,17,40,0.28); min-width: 280px; animation: slideInRight 0.3s ease; }
.toast svg { width: 19px; height: 19px; flex-shrink: 0; }
.toast-title { font-weight: 700; color: #fff; }
.toast-msg { font-size: 0.8125rem; color: rgba(255,255,255,0.72); font-weight: 500; }

/* --- LIST ROW --- */
.list-row { display: flex; align-items: center; gap: 0.875rem; padding: 0.875rem 0; border-bottom: 1px solid var(--gray-150); }
.list-row:last-child { border-bottom: none; }

/* --- TIMELINE --- */
.timeline { position: relative; padding-left: 1.75rem; }
.timeline::before { content: ''; position: absolute; left: 0.4375rem; top: 0.25rem; bottom: 0.25rem; width: 2px; background: var(--gray-200); }
.timeline-item { position: relative; padding-bottom: 1.5rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -1.75rem; top: 0.125rem; width: 1rem; height: 1rem; border-radius: 9999px; background: var(--neutral); border: 3px solid var(--primary); }
.timeline-dot.success { border-color: var(--success); }
.timeline-dot.warning { border-color: var(--warning); }
.timeline-dot.gray { border-color: var(--gray-300); }

/* --- ICON (bare, no background plate) --- */
.icon-circle { width: 2.75rem !important; height: 2.75rem !important; border-radius: 0 !important; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: transparent !important; color: var(--primary) !important; }
.icon-circle svg { width: 22px; height: 22px; }
.icon-circle-sm { width: 2.25rem !important; height: 2.25rem !important; border-radius: 0 !important; }
.icon-circle-sm svg { width: 20px; height: 20px; }

/* --- KANBAN --- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 1rem; }
.kanban-col { background: var(--gray-100); border-radius: 1rem; padding: 0.875rem; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; padding: 0 0.25rem; }
.kanban-col-head .count { font-size: 0.6875rem; font-weight: 700; background: var(--gray-200); color: var(--gray-600); border-radius: 0.5rem; padding: 0.0625rem 0.4375rem; }
.kanban-card { background: var(--neutral); border-radius: 0.75rem; padding: 0.875rem; margin-bottom: 0.625rem; box-shadow: 0 1px 2px rgba(6,17,40,0.05); border: 1px solid var(--gray-150); cursor: grab; transition: box-shadow 0.15s, transform 0.15s; }
.kanban-card:hover { box-shadow: 0 6px 18px rgba(6,17,40,0.1); transform: translateY(-1px); }
.kanban-card:last-child { margin-bottom: 0; }

/* --- ROTA --- */
.rota-grid { display: grid; grid-template-columns: 200px repeat(7, 1fr); border: 1px solid var(--gray-200); border-radius: 0.875rem; overflow: hidden; }
.rota-cell { padding: 0.5rem; border-right: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); min-height: 82px; display: flex; flex-direction: column; justify-content: center; gap: 0.25rem; }
.rota-cell:nth-child(8n) { border-right: none; }
.rota-head { background: var(--gray-100); font-weight: 700; color: var(--gray-700); text-align: center; align-items: center; padding: 0.75rem 0.5rem; min-height: auto; font-size: 0.8125rem; }
.rota-name { display: flex; flex-direction: row; align-items: center; gap: 0.625rem; font-weight: 600; color: var(--gray-900); background: var(--gray-50); }
/* Shift chips: solid, distinct, high-contrast */
.shift-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 0.5rem; padding: 0.4375rem 0.375rem; line-height: 1.15; cursor: pointer; transition: transform 0.1s, box-shadow 0.1s; }
.shift-chip:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(6,17,40,0.14); }
.shift-chip .chip-label { font-size: 0.75rem; font-weight: 700; letter-spacing: -0.01em; }
.shift-chip .chip-time { font-size: 0.625rem; font-weight: 600; opacity: 0.85; }
.shift-early { background: #d4e8fb; color: #0a4d92; }
.shift-late  { background: #fbe4c2; color: #8a5300; }
.shift-long  { background: #cfead8; color: #16683f; }
.shift-night { background: #e2d4f2; color: #491f72; }
.shift-1to1  { background: #cbe8f4; color: #0a5d73; }
.shift-day   { background: #d4e8fb; color: #0a4d92; }
.shift-off   { background: var(--gray-50); color: var(--gray-400); }
.shift-off .chip-label { font-weight: 600; }

/* --- MEAL / WEEK GRID --- */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.75rem; }
.meal-day { background: var(--neutral); border: 1px solid var(--gray-200); border-radius: 0.75rem; overflow: hidden; }
.meal-day-head { padding: 0.5rem; text-align: center; font-weight: 700; color: var(--gray-900); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); font-size: 0.8125rem; }
.meal-slot { padding: 0.625rem; border-bottom: 1px solid var(--gray-150); }
.meal-slot:last-child { border-bottom: none; }
.meal-slot .slot-label { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-400); font-weight: 700; margin-bottom: 0.25rem; }
.meal-slot .slot-meal { font-size: 0.8125rem; font-weight: 600; color: var(--gray-800); }

/* --- EMAIL --- */
.mail-layout { display: grid; grid-template-columns: 200px 340px 1fr; min-height: 620px; }
.mail-folders { border-right: 1px solid var(--gray-200); padding: 1rem 0.75rem; }
.mail-folder { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.75rem; border-radius: 0.5rem; font-weight: 600; color: var(--gray-600); cursor: pointer; transition: all 0.15s; margin-bottom: 0.125rem; }
.mail-folder svg { width: 18px; height: 18px; }
.mail-folder .count { margin-left: auto; font-size: 0.75rem; color: var(--gray-400); font-weight: 700; }
.mail-folder:hover { background: var(--gray-100); color: var(--gray-900); }
.mail-folder.active { background: var(--primary); color: #fff; }
.mail-folder.active .count { color: rgba(255,255,255,0.8); }
.mail-list { border-right: 1px solid var(--gray-200); overflow-y: auto; max-height: 620px; }
.mail-item { padding: 0.875rem 1rem; border-bottom: 1px solid var(--gray-150); cursor: pointer; transition: background 0.12s; }
.mail-item:hover { background: var(--gray-50); }
.mail-item.active { background: var(--primary-subtle); }
.mail-item.unread .mail-from { color: var(--gray-900); }
.mail-read-pane { padding: 1.5rem; overflow-y: auto; max-height: 620px; }

/* --- UTILITIES --- */
.flex { display: flex; } .inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; } .flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; } .flex-shrink-0 { flex-shrink: 0; }
.grid { display: grid; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .items-end { align-items: flex-end; }
.justify-center { justify-content: center; } .justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; } .gap-6 { gap: 1.5rem; } .gap-8 { gap: 2rem; }
.w-full { width: 100%; } .h-full { height: 100%; }
.text-xs { font-size: 0.75rem; } .text-sm { font-size: 0.875rem; } .text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; } .text-xl { font-size: 1.25rem; } .text-2xl { font-size: 1.5rem; } .text-3xl { font-size: 1.875rem; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.text-primary { color: var(--primary); } .text-success { color: var(--success); } .text-error { color: var(--error); } .text-warning { color: var(--warning); }
.text-gray-400 { color: var(--gray-400); } .text-gray-500 { color: var(--gray-500); } .text-gray-600 { color: var(--gray-600); } .text-gray-700 { color: var(--gray-700); } .text-gray-900 { color: var(--gray-900); }
.text-white { color: #fff; }
.bg-sky-100 { background: var(--sky-100); } .bg-sky-200 { background: var(--sky-200); }
.bg-emerald-100 { background: var(--emerald-100); } .bg-emerald-200 { background: var(--emerald-200); }
.bg-purple-100 { background: var(--purple-100); } .bg-purple-200 { background: var(--purple-200); }
.bg-orange-100 { background: var(--orange-100); } .bg-orange-200 { background: var(--orange-200); }
.bg-amber-100 { background: var(--amber-100); } .bg-amber-200 { background: var(--amber-200); }
.bg-rose-100 { background: var(--rose-100); } .bg-rose-200 { background: var(--rose-200); }
.bg-teal-100 { background: var(--teal-100); } .bg-teal-200 { background: var(--teal-200); }
.bg-gray-50 { background: var(--gray-50); } .bg-gray-100 { background: var(--gray-100); } .bg-gray-900 { background: var(--gray-900); }
.bg-white { background: var(--neutral); }
.rounded-lg { border-radius: 0.625rem; } .rounded-xl { border-radius: 0.875rem; } .rounded-2xl { border-radius: 1rem; } .rounded-full { border-radius: 9999px; }
.border { border: 1px solid var(--gray-200); }
.border-b { border-bottom: 1px solid var(--gray-200); }
.border-t { border-top: 1px solid var(--gray-200); }
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.shadow-md { box-shadow: 0 4px 16px rgba(6,17,40,0.08); }
.p-2 { padding: 0.5rem; } .p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-5 { padding: 1.25rem; } .p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; } .px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; } .mb-4 { margin-bottom: 1rem; } .mb-5 { margin-bottom: 1.25rem; } .mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; } .mt-4 { margin-top: 1rem; } .mt-5 { margin-top: 1.25rem; } .mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.ml-2 { margin-left: 0.5rem; } .ml-auto { margin-left: auto; }
.opacity-60 { opacity: 0.6; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; } .text-right { text-align: right; }
.uppercase { text-transform: uppercase; } .tracking-wider { letter-spacing: 0.05em; }
.cursor-pointer { cursor: pointer; } .relative { position: relative; }
.overflow-hidden { overflow: hidden; } .overflow-x-auto { overflow-x: auto; }
.hidden { display: none; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }

/* --- ANIMATIONS --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.animate-slide-up { opacity: 0; animation: slideUp 0.45s cubic-bezier(0.16,1,0.3,1) forwards; }

/* --- RESPONSIVE --- */
@media (max-width: 1280px) { .xl-row { flex-direction: column; } }
@media (max-width: 1024px) {
    .side-nav { transform: translateX(-100%); transition: transform 0.25s; z-index: 41; }
    .side-nav.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .floating-menu-btn { display: flex; }
    .page-container { padding-top: 3.75rem; }
    .page-head { padding-left: 3rem; }
    .mail-layout { grid-template-columns: 1fr; }
    .mail-folders, .mail-list { display: none; }
}
@media (max-width: 900px) {
    .header-search { display: none; }
    .kanban { grid-template-columns: 1fr; }
    .rota-grid, .week-grid { overflow-x: auto; }
}
@media (max-width: 768px) {
    .page-container { padding: 1rem; }
    .stat-tray.cols-3, .stat-tray.cols-4, .stat-tray.cols-2 { grid-template-columns: 1fr; }
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
    .col-span-2 { grid-column: span 1; }
    .page-head h1 { font-size: 1.5rem; }
    .drawer { width: 100%; }
}

/* --- STYLE GUIDE --- */
.sg-swatch { height: 64px; border-radius: 0.625rem; box-shadow: inset 0 0 0 1px rgba(6,17,40,0.06); }
