/* ═══════════════════════════════════════════════
   Enterprise Design System — Warm Minimal
   ═══════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
    /* Layout reference */
    --ref: 2216;

    /* Brand — Deep Trust Green system */
    --accent: #004D40;
    --accent-hover: #003D32;
    --accent-light: #E0F2F1;
    --accent-bg: rgba(0, 77, 64, 0.04);
    --brand-orange: #D4960A;
    --active-gold: #D4960A;
    /* Color scheme aliases */
    --terra: #004D40;
    --sand: #EEF0EC;
    --sage: #008978;
    --amber: #D4960A;

    /* Neutral palette (sage-neutral grays) */
    --gray-950: #111816;
    --gray-900: #1C2621;
    --gray-800: #2E3B36;
    --gray-700: #44524C;
    --gray-600: #5C6B64;
    --gray-500: #788680;
    --gray-400: #95A19B;
    --gray-300: #B3BCB8;
    --gray-200: #CDD4D1;
    --gray-150: #DDE2DF;
    --gray-100: #E8ECE9;
    --gray-50: #F0F3F1;
    --gray-25: #F5F7F4;

    /* Semantic */
    --bg-page: #EEF0EC;
    --bg-card: #ffffff;
    --bg-hover: #F5F7F4;
    --bg-active: #E0F2F1;
    --bg-input: #ffffff;

    --border-default: #E8ECE9;
    --border-light: #F0F3F1;
    --border-focus: #004D40;

    --text-primary: #111816;
    --text-secondary: #44524C;
    --text-muted: #788680;
    --text-placeholder: #95A19B;
    --text-inverse: #ffffff;

    /* Status */
    --success: #008978;
    --success-bg: #E0F5F2;
    --warning: #D4960A;
    --warning-bg: #FFF8E7;
    --danger: #C44B4B;
    --danger-bg: #FAEAEA;
    --info: #4A7FB5;
    --info-bg: #EDF2F8;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(17, 24, 22, 0.04);
    --shadow-sm: 0 1px 3px rgba(17, 24, 22, 0.06), 0 1px 2px rgba(17, 24, 22, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(17, 24, 22, 0.06), 0 2px 4px -1px rgba(17, 24, 22, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(17, 24, 22, 0.06), 0 4px 6px -2px rgba(17, 24, 22, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(17, 24, 22, 0.08), 0 10px 10px -5px rgba(17, 24, 22, 0.02);
    --shadow-focus: 0 0 0 3px rgba(0, 77, 64, 0.15);

    /* Radius */
    --radius-sm: 0;
    --radius-md: 0;
    --radius-lg: 0;
    --radius-xl: 0;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --space-9: 48px;
    --space-10: 64px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;

    --text-xs: 11px;
    --text-sm: 12px;
    --text-base: 13px;
    --text-md: 14px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 20px;
    --text-3xl: 24px;
    --text-4xl: 30px;

    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* Transitions */
    --transition-fast: 0.1s ease;
    --transition-base: 0.15s ease;
    --transition-slow: 0.25s ease;

    /* Legacy compat */
    --figma-primary: #004D40;
    --figma-black: #111816;
    --figma-white: #ffffff;
    --figma-font-primary: var(--font-sans);
}

/* ── Reset & Base ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg-page);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p {
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* ── Form Elements ── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
    font-family: var(--font-sans);
    font-size: var(--text-md);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    width: 100%;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-placeholder);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23788680' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

/* ── Buttons ── */
button, .btn {
    font-family: var(--font-sans);
    font-size: var(--text-md);
    font-weight: 500;
    line-height: 1;
    border: none;
    border-radius: var(--radius-md);
    padding: 8px 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
    box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
    box-shadow: var(--shadow-xs);
}

.btn-danger:hover {
    background: #A33A3A;
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    font-size: var(--text-sm);
    padding: 6px 12px;
}

.btn-lg {
    font-size: var(--text-lg);
    padding: 12px 24px;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: var(--space-6);
}

/* ── Tables ── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-md);
}

thead th {
    background: var(--gray-25);
    padding: 10px 16px;
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
    position: relative;
}

thead th:first-child {
    border-top-left-radius: var(--radius-lg);
}

thead th:last-child {
    border-top-right-radius: var(--radius-lg);
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

tbody tr {
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
}

tbody tr:hover {
    background: var(--gray-25);
}

tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--accent);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Row action buttons - hidden until row hover */
.row-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

tbody tr:hover .row-actions {
    opacity: 1;
}

.row-action-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
}

.row-action-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.row-action-btn svg {
    width: 14px;
    height: 14px;
}

/* Three-dot context menu button */
.row-menu-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-placeholder);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
}

.row-menu-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

/* Table cell with monospace number formatting */
td.cell-number,
.cell-number {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

td.cell-right,
th.cell-right,
.cell-right {
    text-align: right;
}

td.cell-center,
th.cell-center,
.cell-center {
    text-align: center;
}

/* Numeric column: right-aligned with tabular figures — use for ALL money/count/% columns */
td.num,
th.num,
.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* KPI / stat values: tabular figures for consistent digit width */
.kpi-value,
.stat-value {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Sortable column header */
th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    color: var(--text-primary);
    background: var(--gray-50);
}

th.sortable::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    vertical-align: middle;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 4px solid var(--gray-300);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

th.sortable:hover::after {
    opacity: 1;
}

th.sorted-asc::after,
th.sorted-desc::after {
    opacity: 1;
    border-top-color: var(--accent);
}

th.sorted-desc::after {
    border-top: none;
    border-bottom: 4px solid var(--accent);
}

/* ── Badges / Status Pills ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px 2px 8px;
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: 100px;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

/* Status dot before badge text */
.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-success::before { background: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-warning::before { background: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-danger::before { background: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-info::before { background: var(--info); }
.badge-neutral { background: var(--gray-50); color: var(--gray-600); }
.badge-neutral::before { background: var(--gray-400); }
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-accent::before { background: var(--accent); }

/* Badge without dot */
.badge-plain::before { display: none; }

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-default);
    margin-bottom: var(--space-6);
}

.tab {
    padding: 10px 16px;
    font-size: var(--text-md);
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── KPI / Stat Cards ── */
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    box-shadow: var(--shadow-sm);
}

.kpi-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
}

.kpi-value {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.kpi-change {
    font-size: var(--text-xs);
    font-weight: 500;
    margin-top: var(--space-1);
}

.kpi-change.positive { color: var(--success); }
.kpi-change.negative { color: var(--danger); }

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.45);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-slow);
    pointer-events: none;
}

.modal-overlay.open,
.modal-overlay[style*="display: flex"] {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(8px);
    transition: transform var(--transition-slow);
}

.modal-overlay.open .modal-container {
    transform: translateY(0);
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2,
.modal-header h3 {
    font-size: var(--text-xl);
    font-weight: 600;
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ── Tooltips ── */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--gray-950);
    color: var(--text-inverse);
    font-size: var(--text-xs);
    line-height: 1.4;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 10000;
}

/* ── Empty States ── */
.empty-state {
    text-align: center;
    padding: var(--space-9) var(--space-6);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.3;
}

.empty-state-text {
    font-size: var(--text-md);
    color: var(--text-muted);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-200);
    border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-300);
}

/* ── Chat Bubble ── */
.chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 77, 64, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    transition: all var(--transition-base);
    z-index: 999;
}

.chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 77, 64, 0.45);
}

/* ── Utility ── */
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-accent { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }

.text-sm { font-size: var(--text-sm) !important; }
.text-xs { font-size: var(--text-xs) !important; }
.text-base { font-size: var(--text-base) !important; }
.text-md { font-size: var(--text-md) !important; }
.text-lg { font-size: var(--text-lg) !important; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    pointer-events: auto;
    animation: toastIn 0.3s ease forwards;
    max-width: 360px;
    min-width: 280px;
}

.toast.toast-removing {
    animation: toastOut 0.25s ease forwards;
}

.toast-success { }
.toast-error { }
.toast-warning { }
.toast-info { }

.toast-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

.toast-message { flex: 1; line-height: 1.4; }

.toast-close {
    background: none;
    border: none;
    color: var(--text-placeholder);
    cursor: pointer;
    padding: 2px;
    font-size: 16px;
    line-height: 1;
    transition: color 0.15s;
}

.toast-close:hover { color: var(--text-primary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

/* Confirm Modal */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.45);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: confirmFadeIn 0.2s ease;
}

.confirm-box {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 400px;
    padding: 24px;
    animation: confirmSlideIn 0.25s ease;
}

.confirm-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-message {
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.confirm-btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-default);
    transition: all 0.15s;
}

.confirm-btn-cancel {
    background: var(--bg-card);
    color: var(--text-secondary);
}

.confirm-btn-cancel:hover {
    background: var(--bg-hover);
}

.confirm-btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
    border-color: var(--danger);
}

.confirm-btn-danger:hover {
    background: #A33A3A;
}

.confirm-btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}

.confirm-btn-primary:hover {
    background: var(--accent-hover);
}

@keyframes confirmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes confirmSlideIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Command-K Search */
.cmdk-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.45);
    backdrop-filter: blur(2px);
    z-index: 10002;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
    animation: confirmFadeIn 0.2s ease;
}

.cmdk-box {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 560px;
    overflow: hidden;
    animation: confirmSlideIn 0.25s ease;
}

.cmdk-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.cmdk-input-wrap svg {
    width: 18px;
    height: 18px;
    color: var(--text-placeholder);
    flex-shrink: 0;
}

.cmdk-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: var(--text-lg);
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: transparent;
    padding: 0;
    width: 100%;
}

.cmdk-input::placeholder {
    color: var(--text-placeholder);
}

.cmdk-results {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px;
}

.cmdk-section-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 12px 4px;
}

.cmdk-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.1s;
    text-decoration: none;
    color: var(--text-primary);
}

.cmdk-item:hover, .cmdk-item.active {
    background: var(--bg-hover);
}

.cmdk-item-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--gray-50);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cmdk-item-icon svg {
    width: 16px;
    height: 16px;
}

.cmdk-item-text {
    flex: 1;
    min-width: 0;
}

.cmdk-item-title {
    font-size: var(--text-md);
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cmdk-item-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmdk-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 16px;
    font-size: var(--text-xs);
    color: var(--text-placeholder);
}

.cmdk-footer kbd {
    background: var(--gray-50);
    border: 1px solid var(--border-default);
    padding: 1px 5px;
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 10px;
}

.cmdk-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-placeholder);
    font-size: var(--text-md);
}

.cmdk-type-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 0;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.cmdk-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: cmdkSpin 0.6s linear infinite;
    flex-shrink: 0;
}

@keyframes cmdkSpin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════
   Contextual Icon Backgrounds
   (For KPI cards, list items, detail headers)
   ═══════════════════════════════════════════════ */
.icon-bg {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-bg svg {
    width: 17px;
    height: 17px;
}

.icon-bg-neutral { background: var(--gray-50); }
.icon-bg-neutral svg { color: var(--gray-600); }

.icon-bg-accent { background: rgba(0, 77, 64, 0.08); }
.icon-bg-accent svg { color: var(--accent); }

.icon-bg-success { background: rgba(14, 167, 112, 0.08); }
.icon-bg-success svg { color: var(--success); }

.icon-bg-warning { background: rgba(230, 126, 34, 0.08); }
.icon-bg-warning svg { color: var(--warning); }

.icon-bg-danger { background: rgba(223, 27, 65, 0.08); }
.icon-bg-danger svg { color: var(--danger); }

.icon-bg-info { background: rgba(5, 112, 222, 0.08); }
.icon-bg-info svg { color: var(--info); }

/* Large icon backgrounds (for hero/detail sections) */
.icon-bg-lg {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xl);
}

.icon-bg-lg svg {
    width: 22px;
    height: 22px;
}

/* ═══════════════════════════════════════════════
   Status-Aware Inline Status Badges
   (Matches common page status patterns)
   ═══════════════════════════════════════════════ */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.status-dot-success { background: var(--success); }
.status-dot-warning { background: var(--warning); }
.status-dot-danger { background: var(--danger); }
.status-dot-info { background: var(--info); }
.status-dot-neutral { background: var(--gray-400); }

/* Pulsing dot for "live" or "active" states */
.status-dot-live {
    background: var(--success);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(14, 167, 112, 0.4); }
    50% { opacity: 0.85; box-shadow: 0 0 0 4px rgba(14, 167, 112, 0); }
}

/* ═══════════════════════════════════════════════
   Progress Bars & Gauges
   ═══════════════════════════════════════════════ */
.progress-bar {
    height: 6px;
    background: var(--gray-100);
    border-radius: 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 0;
    background: var(--accent);
    transition: width 0.6s ease;
}

.progress-fill-success { background: var(--success); }
.progress-fill-warning { background: var(--warning); }
.progress-fill-danger { background: var(--danger); }

/* Capacity bar that shifts from green → yellow → red */
.capacity-bar {
    height: 4px;
    background: var(--gray-100);
    border-radius: 0;
    overflow: hidden;
}

.capacity-fill {
    height: 100%;
    border-radius: 0;
    transition: width 0.4s ease, background 0.3s ease;
}

.capacity-fill[data-pct] { background: var(--success); }

/* ═══════════════════════════════════════════════
   Inline Metric / KPI Number Formatting
   ═══════════════════════════════════════════════ */
.metric-positive {
    color: var(--success);
    font-weight: 600;
}

.metric-negative {
    color: var(--danger);
    font-weight: 600;
}

.metric-positive::before {
    content: '\2191 ';
    font-size: 0.85em;
}

.metric-negative::before {
    content: '\2193 ';
    font-size: 0.85em;
}

/* Currency formatting */
.mono-number {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════════════
   Additional Utility Classes
   ═══════════════════════════════════════════════ */
.bg-success-subtle { background: var(--success-bg); }
.bg-warning-subtle { background: var(--warning-bg); }
.bg-danger-subtle { background: var(--danger-bg); }
.bg-info-subtle { background: var(--info-bg); }
.bg-accent-subtle { background: var(--accent-light); }

.border-l-accent { }
.border-l-success { }
.border-l-warning { }
.border-l-danger { }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.overflow-hidden { overflow: hidden; }

.whitespace-nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }

.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }

.opacity-50 { opacity: 0.5; }
.opacity-70 { opacity: 0.7; }

/* Divider */
.divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-4) 0;
}

/* Inline link with underline on hover */
.link-underline {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
}

.link-underline:hover {
    border-bottom-color: var(--accent);
}

/* Subtle "View All" text link */
.link-muted {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.link-muted:hover {
    color: var(--accent);
}

/* Chip / Tag */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--gray-50);
    border-radius: 100px;
    border: 1px solid var(--border-light);
}

.chip-active {
    background: var(--accent-light);
    color: var(--accent);
    border-color: rgba(0, 77, 64, 0.2);
}

/* Avatar */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    color: var(--text-inverse);
    flex-shrink: 0;
    text-transform: uppercase;
}

.avatar-sm {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

.avatar-md {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.avatar-lg {
    width: 40px;
    height: 40px;
    font-size: 14px;
}

.avatar-purple { background: var(--accent); }
.avatar-green { background: var(--success); }
.avatar-orange { background: var(--warning); }
.avatar-blue { background: var(--info); }
.avatar-red { background: var(--danger); }
.avatar-gray { background: var(--gray-400); }

/* ═══════════════════════════════════════════════
   Page Load Animation System
   Staggered fade-in-up for premium page feel
   ═══════════════════════════════════════════════ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-in {
    animation: fadeInUp 0.4s ease both;
}

.animate-fade {
    animation: fadeIn 0.3s ease both;
}

.animate-scale {
    animation: scaleIn 0.3s ease both;
}

/* Stagger delays for sequential card/section animation */
.stagger-1 { animation-delay: 0.03s; }
.stagger-2 { animation-delay: 0.06s; }
.stagger-3 { animation-delay: 0.09s; }
.stagger-4 { animation-delay: 0.12s; }
.stagger-5 { animation-delay: 0.15s; }
.stagger-6 { animation-delay: 0.18s; }
.stagger-7 { animation-delay: 0.21s; }
.stagger-8 { animation-delay: 0.24s; }

/* ═══════════════════════════════════════════════
   Enhanced Card Interactions
   Premium hover lift with layered shadows
   ═══════════════════════════════════════════════ */
.card-interactive {
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.card-interactive:hover {
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 0, 0, 0.02);
    transform: translateY(-1px);
    border-color: var(--gray-150);
}

.card-interactive:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Clickable card that acts as a link */
.card-link {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.card-link:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--gray-150);
}

.card-link:active {
    transform: translateY(0);
    box-shadow: var(--shadow-xs);
}

/* ═══════════════════════════════════════════════
   Enhanced Button Interactions
   Tactile press + focus ring
   ═══════════════════════════════════════════════ */
.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-xs), inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-secondary:active {
    background: var(--gray-50);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: var(--shadow-xs), inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Focus-visible ring for keyboard navigation */
button:focus-visible,
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Remove default outline when using mouse */
button:focus:not(:focus-visible),
.btn:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* Loading state for buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════
   Skeleton Loading Placeholders
   Animated shimmer for content loading states
   ═══════════════════════════════════════════════ */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-50) 25%,
        var(--gray-25) 50%,
        var(--gray-50) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
    color: transparent !important;
    user-select: none;
}

.skeleton * { visibility: hidden; }

.skeleton-text {
    height: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.skeleton-text-sm {
    height: 11px;
    width: 60%;
    border-radius: var(--radius-sm);
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════
   Enhanced Form Groups
   Better field layout and label treatment
   ═══════════════════════════════════════════════ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.form-required::after {
    content: '*';
    color: var(--danger);
    font-size: 12px;
    margin-left: 2px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-placeholder);
    margin-top: 4px;
}

.form-error-msg {
    font-size: var(--text-xs);
    color: var(--danger);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

input.is-error,
select.is-error,
textarea.is-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(223, 27, 65, 0.1);
}

input.is-success,
select.is-success {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(14, 167, 112, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

/* Input with icon prefix */
.input-with-icon {
    position: relative;
}

.input-with-icon input {
    padding-left: 36px;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-placeholder);
    pointer-events: none;
}

/* ═══════════════════════════════════════════════
   Data List / Detail Pairs
   For key-value display in detail pages
   ═══════════════════════════════════════════════ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

.detail-pair {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-value {
    font-size: var(--text-md);
    font-weight: 500;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════
   Timeline Component
   For activity feeds and history logs
   ═══════════════════════════════════════════════ */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border-light);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-5);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--gray-300);
    z-index: 1;
}

.timeline-item.timeline-success::before { border-color: var(--success); background: var(--success-bg); }
.timeline-item.timeline-info::before { border-color: var(--info); background: var(--info-bg); }
.timeline-item.timeline-warning::before { border-color: var(--warning); background: var(--warning-bg); }
.timeline-item.timeline-danger::before { border-color: var(--danger); background: var(--danger-bg); }

.timeline-time {
    font-size: var(--text-xs);
    color: var(--text-placeholder);
    margin-bottom: 2px;
}

.timeline-content {
    font-size: var(--text-md);
    color: var(--text-primary);
}

.timeline-content-secondary {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   Notification Badge (Count Pill)
   For sidebar/header notification indicators
   ═══════════════════════════════════════════════ */
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-inverse);
    background: var(--danger);
    border-radius: 100px;
    line-height: 1;
}

.count-badge-sm {
    min-width: 8px;
    height: 8px;
    padding: 0;
    font-size: 0;
}

/* ═══════════════════════════════════════════════
   Smooth Transitions for Color/Theme
   Applied globally for consistent feel
   ═══════════════════════════════════════════════ */
::selection {
    background: rgba(0, 77, 64, 0.15);
    color: var(--text-primary);
}

/* Smooth scroll for in-page navigation */
html {
    scroll-behavior: smooth;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}

/* ═══════════════════════════════════════════════
   Print Styles
   ═══════════════════════════════════════════════ */
@media print {
    .sidebar, .logo-box, .search-bar, .header-line,
    .top-icons, .divider-line, .plus-button, .profile-icon,
    .chat-bubble, .toast-container, .cmdk-overlay { display: none !important; }

    body { background: white; }

    .card, .section-card, .kpi-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}
