:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --border: #e8eaef;
    --text: #1a1d26;
    --muted: #6b7280;
    --accent: #111827;
    --primary: #111827;
    --sidebar-w: 248px;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
}

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-top { margin-bottom: 4px; }

.workspace-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafbfc;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: var(--text);
    transition: background .15s, border-color .15s;
}
.workspace-switch:hover {
    background: #f4f5f8;
    border-color: #dce0e8;
}
.workspace-switch-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 11px; letter-spacing: .02em;
    flex-shrink: 0;
}
.workspace-switch-text { flex: 1; min-width: 0; }
.workspace-switch-text strong {
    display: block; font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.workspace-switch-text small { color: var(--muted); font-size: 11px; }
.workspace-switch-chevron {
    color: var(--muted); flex-shrink: 0; display: flex; opacity: .85;
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.sidebar-search:focus-within {
    border-color: #c5cad6;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}
.sidebar-search-icon {
    color: var(--muted);
    display: flex;
    flex-shrink: 0;
}
.sidebar-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 10px 8px 10px 0;
    font-size: 13px;
    outline: none;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 4px 12px;
    margin: 0 -4px;
    scrollbar-width: thin;
}

.nav-label {
    margin: 16px 0 6px; padding: 0 10px;
    font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); font-weight: 600;
}
.nav-label:first-child { margin-top: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    color: #374151;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    position: relative;
    transition: background .12s, color .12s;
}
.nav-item:hover {
    background: #f4f5f8;
    color: var(--text);
}
.nav-item.active {
    background: #eef0f4;
    color: var(--text);
    font-weight: 600;
}
.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0;
    background: var(--primary);
}
.nav-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-icon svg { width: 18px; height: 18px; }
.nav-item.active .nav-icon { color: var(--text); }
.nav-item-label { flex: 1; min-width: 0; }

.sidebar-footer {
    flex-shrink: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar-user {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 10px;
    border-radius: 12px;
    background: #fafbfc;
    border: 1px solid transparent;
    transition: border-color .15s, background .15s;
}
.sidebar-user:hover {
    background: #f4f5f8;
    border-color: var(--border);
}
.sidebar-user-meta { flex: 1; min-width: 0; }
.sidebar-user-meta strong { display: block; font-size: 13px; }
.sidebar-user-meta small { color: var(--muted); font-size: 11px; }
.sidebar-user-settings {
    color: var(--muted);
    padding: 6px;
    border-radius: 8px;
    display: flex;
    flex-shrink: 0;
    transition: background .12s, color .12s;
}
.sidebar-user-settings:hover {
    background: #e8eaef;
    color: var(--text);
}

.page-title {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.page-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.stats-grid--dashboard {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-section { margin-bottom: 28px; }
.dashboard-section-title {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.dashboard-section-foot {
    margin: 12px 0 0;
    font-size: 14px;
}
.dashboard-section-foot a { color: var(--primary); font-weight: 500; }

.stat-card--wide { grid-column: span 2; }
.category-bars {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.category-bars li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(80px, 2fr) auto;
    gap: 8px;
    align-items: center;
    font-size: 12px;
}
.category-bars-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}
.category-bars-track {
    height: 6px;
    background: #eef0f4;
    border-radius: 3px;
    overflow: hidden;
}
.category-bars-track span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #334155, #0f172a);
    border-radius: 3px;
}
.category-bars-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.dashboard-recent { margin-top: 16px; }
.dashboard-recent-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
}
.dashboard-recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.dashboard-recent-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.dashboard-recent-item:hover {
    border-color: #cfd4de;
    box-shadow: var(--shadow);
}
.dashboard-recent-item strong { font-size: 14px; grid-column: 1; }
.dashboard-recent-item > span { font-size: 13px; color: var(--muted); }
.dashboard-recent-item small {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--muted);
}

.empty-panel {
    margin-top: 20px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.55;
}
.empty-panel--large {
    text-align: center;
    padding: 48px 32px;
    max-width: 480px;
}
.empty-panel-icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    border-radius: 14px;
    background: #f1f3f6;
    color: var(--muted);
    display: grid;
    place-items: center;
}
.empty-panel-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}
.empty-panel-text { margin: 0; max-width: 360px; margin-inline: auto; }

.cards-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 18px 0 10px;
}

.dataset-list-panel .cards-header {
    padding: 14px 16px 0;
    margin: 0;
}
.dataset-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 0 16px 14px;
    border-bottom: 1px solid var(--border);
}
.dataset-list-search {
    flex: 1 1 220px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafbfc;
}
.dataset-list-search input {
    flex: 1;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 14px;
    outline: none;
    min-width: 0;
}
.dataset-list-filter select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}
.card-modified {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}
.chip--category {
    background: #eef2ff;
    color: #3730a3;
    border-color: #c7d2fe;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.dataset-list-results {
    margin: 0 16px 16px;
    min-height: 48px;
    transition: opacity .15s;
}
.dataset-list-results.is-loading {
    opacity: .55;
    pointer-events: none;
}
.dataset-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 12px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.dataset-page-btn,
.dataset-page-num {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 6px 12px;
    font: inherit;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.dataset-page-btn:hover:not(:disabled),
.dataset-page-num:hover:not(.is-active) {
    background: #f4f5f8;
    border-color: #cfd4de;
}
.dataset-page-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}
.dataset-page-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.dataset-page-num {
    min-width: 36px;
    text-align: center;
    padding-inline: 8px;
}
.dataset-page-num.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}
.dataset-page-ellipsis {
    color: var(--muted);
    font-size: 13px;
    padding: 0 4px;
}
.dataset-page-meta {
    font-size: 12px;
    color: var(--muted);
    width: 100%;
    text-align: center;
}
@media (min-width: 640px) {
    .dataset-page-meta {
        width: auto;
        margin-left: 4px;
    }
}
.btn-link {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
}
.cards-title { font-size: 13px; }
.cards-subtitle { font-size: 13px; color: var(--muted); }
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.card {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: transform .12s, box-shadow .12s, border-color .12s;
}
.card:hover {
    transform: translateY(-1px);
    border-color: #dce0e8;
    box-shadow: 0 2px 4px rgba(16, 24, 40, 0.08), 0 10px 28px rgba(16, 24, 40, 0.08);
}
.card-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #f1f3f6;
    display: grid;
    place-items: center;
    color: #64748b;
    flex-shrink: 0;
}
.card-icon svg { width: 20px; height: 20px; }
.card-body { flex: 1; min-width: 0; }
.card-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 10px;
}
.card-foot .card-modified { margin-left: auto; }
.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    background: #f3f4f6;
    color: #4b5563;
    max-width: 70%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-open { font-size: 12px; color: var(--muted); font-weight: 600; }

.main { flex: 1; padding: 28px 32px 80px; min-width: 0; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.page-header-left {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    flex: 1;
}
.page-heading { min-width: 0; }
.tabs { display: flex; gap: 8px; background: #eceef2; padding: 4px; border-radius: 12px; }
.tab {
    border: 0; background: transparent; padding: 8px 14px;
    border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }

.btn {
    border: 0; border-radius: 10px; padding: 10px 16px;
    font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.page-actions { display: flex; gap: 10px; align-items: center; }

.flash {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    margin: 0 0 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: var(--shadow);
}
.flash-title { display: block; font-size: 13px; margin-bottom: 2px; }
.flash-message { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.flash-close {
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    padding: 6px;
    border-radius: 10px;
}
.flash-close:hover { background: #f1f3f6; color: var(--text); }
.flash-success { border-color: rgba(5, 150, 105, 0.25); background: rgba(5, 150, 105, 0.06); }
.flash-info { border-color: rgba(37, 99, 235, 0.25); background: rgba(37, 99, 235, 0.06); }
.flash-danger { border-color: rgba(220, 38, 38, 0.25); background: rgba(220, 38, 38, 0.06); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { display: block; font-size: 28px; margin: 6px 0; letter-spacing: -0.02em; }
.stat-hint { font-size: 12px; color: var(--muted); }
.trend-up { color: #059669; }
.sparkline {
    position: absolute; right: 12px; bottom: 12px;
    width: 72px; height: 28px; border-radius: 6px;
    background: linear-gradient(180deg, rgba(17,24,39,.08), transparent);
}
.sparkline.warm { background: linear-gradient(180deg, rgba(5,150,105,.15), transparent); }
.sparkline.cool { background: linear-gradient(180deg, rgba(37,99,235,.15), transparent); }
.sparkline.gold { background: linear-gradient(180deg, rgba(217,119,6,.18), transparent); }
.progress-bar {
    margin-top: 10px; height: 6px; background: #eef0f4; border-radius: 999px; overflow: hidden;
}
.progress-bar span { display: block; height: 100%; background: #111827; border-radius: 999px; }

.table-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.table-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--border); gap: 12px;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-wrap {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--border); border-radius: 10px; padding: 0 12px;
    background: #fafbfc; min-width: 240px;
}
.search-wrap input {
    border: 0; background: transparent; padding: 10px 0; width: 200px; outline: none;
}
.filter-drawer {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: end;
    padding: 12px; background: #fafbfc; border: 1px solid var(--border); border-radius: 12px;
}
.filter-drawer label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.filter-drawer select {
    min-width: 160px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
}

.table-wrap { padding: 0 8px 12px; }
table.dataTable { border-collapse: separate !important; border-spacing: 0; width: 100% !important; }
table.dataTable thead th {
    border-bottom: 1px solid var(--border) !important;
    font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); padding: 14px 12px !important; background: #fff;
}
table.dataTable tbody td {
    padding: 14px 12px !important; border-bottom: 1px solid #f1f3f6 !important;
    font-size: 14px; vertical-align: middle;
}
table.dataTable tbody tr:hover td { background: #fafbfc !important; }
.col-check { width: 42px; text-align: center; }

.item-cell { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: #e8edf5; color: #334155;
    display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.avatar.sm { width: 32px; height: 32px; font-size: 11px; }
.item-name { display: block; font-weight: 600; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { display: block; font-size: 12px; color: var(--muted); }

.badge {
    display: inline-flex; padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
}
.badge-active { background: #dcfce7; color: #166534; }
.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-in_procurement { background: #fef3c7; color: #92400e; }
.badge-priority { background: #fef9c3; color: #854d0e; }
.badge-non_targeted { background: #f3f4f6; color: #4b5563; }

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    padding: 12px 16px; font-size: 13px; color: var(--muted);
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 8px !important; border: 1px solid var(--border) !important;
    margin-left: 4px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important; color: #fff !important; border-color: var(--primary) !important;
}

.bulk-bar {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: 24px; background: #111827; color: #fff;
    padding: 12px 18px; border-radius: 999px;
    display: flex; align-items: center; gap: 18px;
    box-shadow: 0 12px 40px rgba(0,0,0,.22); z-index: 50;
}
.bulk-actions { display: flex; gap: 8px; }
.icon-btn {
    width: 36px; height: 36px; border-radius: 50%; border: 0;
    background: rgba(255,255,255,.12); color: #fff; cursor: pointer;
}
.icon-btn.danger:hover { background: #dc2626; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.35);
    backdrop-filter: blur(2px);
    z-index: 80;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 90;
    padding: 24px;
}

.modal-card {
    width: min(560px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0,0,0,.25);
    overflow: hidden;
}

.modal-card--wide {
    width: min(960px, 100%);
    max-height: min(90vh, 820px);
    display: flex;
    flex-direction: column;
}

.sheet-picker-body {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    min-height: 320px;
    max-height: 52vh;
    overflow: hidden;
}

.sheet-list {
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fafbfc;
}

.sheet-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    line-height: 1.35;
    word-break: break-word;
}

.sheet-item:hover {
    background: #fff;
    border-color: var(--border);
}

.sheet-item.is-active {
    background: #fff;
    border-color: #111827;
    font-weight: 600;
}

.sheet-preview-wrap {
    overflow: auto;
    padding: 12px 14px;
    min-height: 200px;
}

.sheet-preview-empty {
    color: var(--muted);
    font-size: 13px;
    padding: 24px 8px;
}

.sheet-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.sheet-preview-table th,
.sheet-preview-table td {
    border: 1px solid var(--border);
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sheet-preview-table th {
    background: #f4f5f8;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sheet-preview-table tbody tr:nth-child(even) td {
    background: #fafbfc;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
}
.modal-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.modal-subtitle { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.modal-close {
    border: 0;
    background: #f1f3f6;
    color: var(--text);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
}
.modal-close:hover { background: #e8eaef; }

.modal-body { padding: 16px; display: grid; gap: 12px; }
.form-field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form-field input[type="file"] {
    padding: 10px 10px;
    border-radius: 12px;
    border: 1px dashed #cfd5e2;
    background: #fafbfc;
    color: var(--text);
}
.form-check { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--text); }
.form-check input { width: 16px; height: 16px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }

.progress { display: grid; gap: 10px; }
.progress-bar {
    height: 10px;
    background: #eef0f4;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.progress-fill {
    height: 100%;
    background: #111827;
    border-radius: 999px;
    width: 0%;
    transition: width .2s ease;
}
.progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
}
.progress-meta strong { color: var(--text); }
.hint {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
}
.hint code {
    background: #f1f3f6;
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 8px;
}

.import-activity-panel {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.import-activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.import-activity-panel.is-collapsed .import-activity-header {
    border-bottom: 0;
}

.import-activity-panel.is-collapsed .import-activity-body {
    display: none;
}

.import-activity-header-text {
    min-width: 0;
    flex: 1;
}

.import-activity-summary {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.import-activity-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.import-activity-body {
    max-height: min(280px, 40vh);
    overflow-y: auto;
}

.import-activity-list {
    display: grid;
    gap: 0;
}

.import-activity-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: grid;
    gap: 8px;
}

.import-activity-item:last-child { border-bottom: 0; }

.import-activity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 13px;
    color: var(--muted);
}

.import-activity-meta strong { color: var(--text); }

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.status-pill.running { background: #dbeafe; color: #1d4ed8; }
.status-pill.queued { background: #fef3c7; color: #b45309; }
.status-pill.awaiting_sheet { background: #f3f4f6; color: #374151; }
.status-pill.done { background: #dcfce7; color: #15803d; }
.status-pill.failed { background: #fee2e2; color: #b91c1c; }

.import-log-console {
    background: #0f172a;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.45;
    padding: 10px 12px;
    border-radius: 10px;
    max-height: 160px;
    overflow-y: auto;
    margin: 0;
}

.import-log-console .log-warn { color: #fbbf24; }
.import-log-console .log-error { color: #f87171; }

.modal-card--progress {
    width: min(640px, 100%);
}

.view-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.view-tab {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    color: var(--muted);
}

.view-tab.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.filter-bar label {
    display: grid;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

.filter-bar select,
.filter-bar input {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    min-width: 140px;
}

.chart-panel {
    padding: 16px;
    display: grid;
    gap: 14px;
}

.chart-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.chart-wrap {
    max-height: 380px;
    position: relative;
}

.chart-empty {
    color: var(--muted);
    font-size: 13px;
    padding: 24px;
    text-align: center;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--bg);
    padding: 24px;
}

.auth-card {
    width: min(400px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.auth-title { margin: 0 0 6px; font-size: 22px; }
.auth-subtitle { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.auth-form { display: grid; gap: 14px; }

.workspace-switch-details { position: relative; }
.workspace-switch-details summary { list-style: none; }
.workspace-switch-details summary::-webkit-details-marker { display: none; }

.workspace-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    z-index: 40;
    padding: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.workspace-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}

.workspace-menu-item small {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.workspace-menu-item:hover,
.workspace-menu-item.is-active {
    background: #f4f5f8;
}

.workspace-menu-link {
    text-decoration: none;
    color: var(--muted);
    margin-top: 4px;
    border-top: 1px solid var(--border);
    border-radius: 0;
    padding-top: 10px;
}

.card-form { display: block; }
.card-button {
    display: flex;
    gap: 12px;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid--dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-card--wide { grid-column: span 2; }
    .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card--wide { grid-column: span 1; }
    .cards-grid { grid-template-columns: 1fr; }
}
