/* ==============================================================================
   Review My Business / G-Rating — Master Enterprise Dashboard Stylesheet
   Powered by Atelier Design System (Bold Press Architecture)
   ============================================================================== */

/* ── 1. Google Fonts Hierarchy ── */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&family=Figtree:ital,wght@0,300..900;1,300..900&family=Instrument+Sans:ital,wght@0,400..700;1,400..700&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Manrope:wght@200..800&family=Outfit:wght@100..900&family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&family=Sora:wght@100..800&family=Space+Grotesk:wght@300..700&family=Archivo:ital,wght@0,100..900;1,100..900&display=swap');

/* ── 2. Atelier Token System (Primitives, Roles, Themes, Typography, Charts, Recipes) ── */
@import url('./atelier/tokens/_primitives.css');
@import url('./atelier/tokens/_roles.css');
@import url('./atelier/tokens/_themes.css');
@import url('./atelier/tokens/_typography.css');
@import url('./atelier/tokens/_charts.css');
@import url('./atelier/tokens/_recipes.css');

/* ── 3. Atelier Base, Components, Nav, Shell, Schemes & Utilities ── */
@import url('./atelier/base.css');
@import url('./atelier/components.css');
@import url('./atelier/nav.css');
@import url('./atelier/shell.css');
@import url('./atelier/schemes.css');
@import url('./atelier/utilities.css');

/* ── 4. Token & Legacy Variable Bridge ── */
:root {
    /* Legacy Dashboard Variable Compatibility Map */
    --primary: var(--at-accent);
    --primary-dark: var(--at-accent-hover);
    --primary-light: var(--at-accent-wash);
    --primary-text: var(--at-accent-text);
    --success: var(--at-success);
    --success-light: var(--at-success-wash, #dcfce7);
    --warning: var(--at-warning);
    --warning-light: var(--at-warning-wash, #fef3c7);
    --danger: var(--at-danger);
    --danger-light: var(--at-danger-wash, #fee2e2);
    --info: var(--at-info);
    --info-light: var(--at-info-wash, #e0f2fe);
    
    --dark: var(--at-ink);
    --dark-surface: var(--at-surface-raised);
    --body-bg: var(--at-canvas);
    --card-bg: var(--at-surface);
    --border: var(--at-border);
    --border-strong: var(--at-border-strong);
    --text-primary: var(--at-text-strong);
    --text-secondary: var(--at-text);
    --text-muted: var(--at-text-muted);
    --text-subtle: var(--at-text-subtle);

    --radius-sm: var(--at-radius-sm);
    --radius-md: var(--at-radius-md);
    --radius-lg: var(--at-radius-lg);

    --shadow-sm: var(--at-shadow-2);
    --shadow-md: var(--at-shadow-3);
    --shadow-lg: var(--at-shadow-4);
    --shadow-xl: var(--at-shadow-6);
}

/* ── Global Layout Reset & Flow ── */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: var(--at-font-sans, 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif);
    font-size: var(--at-text-base, 14px);
    line-height: var(--at-leading-base, 1.5);
    background-color: var(--at-canvas, #f3ebda);
    color: var(--at-text, #3d3326);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Headings inherit display typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--at-font-display, var(--at-font-sans));
    color: var(--at-text-strong, var(--at-ink));
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* ── App Shell Structure ── */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background-color: var(--at-canvas);
}

/* ── Sidebar Component ── */
.sidebar {
    width: 265px;
    background: var(--at-surface);
    border-right: 2px solid var(--at-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
    transition: width 0.25s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Schemes */
[data-at-scheme='dark-chrome'] .sidebar,
[data-at-scheme='contrast'] .sidebar,
.sidebar.dark-sidebar {
    background: var(--at-surface-raised, #161618);
    border-right: 2px solid var(--at-border);
}

.sidebar-header {
    padding: 20px 18px;
    border-bottom: 2px solid var(--at-border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--at-surface);
}

[data-at-scheme='dark-chrome'] .sidebar-header,
[data-at-scheme='contrast'] .sidebar-header {
    background: var(--at-surface-raised);
}

.sidebar-brand-logo {
    max-height: 38px;
    max-width: 140px;
    object-fit: contain;
}

.sidebar-brand-text {
    font-size: 17px;
    font-weight: 800;
    color: var(--at-text-strong);
    letter-spacing: -0.02em;
    text-decoration: none;
    font-family: var(--at-font-display);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-badge {
    font-size: 10px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: var(--at-radius-xs);
    font-weight: 800;
    margin-left: auto;
    background: var(--at-accent-wash);
    color: var(--at-accent-text);
    border: 1.5px solid var(--at-ink);
    box-shadow: 1px 1px 0 var(--at-ink);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--at-text-muted);
    padding: 12px 10px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: var(--at-text);
    text-decoration: none;
    border-radius: var(--at-radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    border: 1.5px solid transparent;
    transition: all 0.15s ease;
}

.nav-link:hover {
    color: var(--at-text-strong);
    background: var(--at-fill-hover);
    border-color: var(--at-border);
    transform: translate(-1px, -1px);
    box-shadow: var(--at-shadow-2);
}

.nav-link.active {
    color: var(--at-on-accent);
    background: var(--at-accent);
    border: 2px solid var(--at-ink);
    box-shadow: var(--at-shadow-2);
    font-weight: 700;
}

.nav-link.active .nav-icon {
    color: var(--at-on-accent);
}

.nav-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 14px 12px;
    border-top: 2px solid var(--at-border);
    background: var(--at-surface-subtle);
}

.user-snippet {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--at-radius-sm);
    border: 1.5px solid var(--at-border);
    background: var(--at-surface);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--at-radius-sm);
    border: 1.5px solid var(--at-ink);
    background: var(--at-accent);
    color: var(--at-on-accent);
    font-weight: 800;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 1px 1px 0 var(--at-ink);
}

/* ── Main Wrapper & Topbar ── */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--at-canvas);
}

.topbar {
    height: 64px;
    min-height: 64px;
    background: var(--at-surface);
    border-bottom: 2px solid var(--at-border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 0 rgba(0,0,0,0.02);
    gap: 12px;
}

.topbar-left-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.topbar-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--at-text-strong);
    font-family: var(--at-font-display);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    background: var(--at-surface-subtle, rgba(0,0,0,0.02));
    border: 1px solid var(--at-border, #e2e8f0);
    border-radius: 8px;
    color: var(--at-text-strong);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-btn:hover {
    background: var(--at-fill-hover, #f1f5f9);
    border-color: var(--at-border-strong, #cbd5e1);
    color: var(--at-accent-text, #2563eb);
    transform: translateY(-1px);
}

.topbar-btn:active {
    transform: translateY(0);
}

.topbar-btn.active {
    background: var(--at-accent);
    color: var(--at-on-accent);
    border-color: var(--at-accent);
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    .show-mobile-only {
        display: inline-block !important;
    }
}

/* ── Content Container ── */
.content,
.content-body,
main.content-body {
    flex: 1;
    padding: 24px 28px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* ── Stat Cards & Grid (Bold Press Architecture) ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--at-surface);
    border: 1.5px solid var(--at-border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    border-color: var(--at-border-strong, #cbd5e1);
}

.stat-content h4 {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--at-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.stat-number {
    font-family: var(--at-font-display);
    font-size: 26px;
    font-weight: 800;
    color: var(--at-text-strong);
    line-height: 1.1;
}

.stat-subtext {
    font-size: 11.5px;
    color: var(--at-text-subtle);
    margin-top: 6px;
}

.stat-icon-wrapper {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon-wrapper.blue { background: var(--at-tertiary-wash, #dde3fb); color: var(--at-tertiary, #3551f0); }
.stat-icon-wrapper.green { background: var(--at-success-wash, #dcfce7); color: var(--at-success, #15803d); }
.stat-icon-wrapper.purple { background: var(--at-accent-wash, #f3e8ff); color: var(--at-accent-text, #7e22ce); }
.stat-icon-wrapper.orange { background: var(--at-secondary-wash, #fef3c7); color: var(--at-secondary, #b45309); }
.stat-icon-wrapper.red { background: var(--at-danger-wash, #fee2e2); color: var(--at-danger, #b91c1c); }

/* ── Panels & Cards ── */
.panel, .card {
    background: var(--at-surface);
    border: 2px solid var(--at-border);
    border-radius: var(--at-radius-md);
    box-shadow: var(--at-shadow-card);
    margin-bottom: 24px;
    position: relative;
}

.panel-header, .card-header {
    padding: 16px 20px;
    border-bottom: 2px solid var(--at-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--at-surface);
}

.panel-title, .card-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--at-text-strong);
    font-family: var(--at-font-display);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-body, .card-body {
    padding: 20px;
}

.panel-footer, .card-footer {
    padding: 14px 20px;
    border-top: 1.5px solid var(--at-border);
    background: var(--at-surface-subtle);
}

/* ── Data Tables & Responsive Dataset Engine ── */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
    border-radius: var(--at-radius-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--at-border) transparent;
}

.table-responsive::-webkit-scrollbar {
    height: 7px;
    width: 7px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--at-surface-subtle);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--at-border);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--at-text-muted);
}

.data-table,
.compact-ledger-table,
table.data-table,
table.table-dense,
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    text-align: left;
    background: var(--at-surface);
    line-height: 1.35;
}

.data-table thead th,
.compact-ledger-table thead th,
table thead th {
    background: var(--at-surface-subtle);
    color: var(--at-text-strong);
    font-family: var(--at-font-display);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 14px;
    border-bottom: 2px solid var(--at-border);
    white-space: nowrap;
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 5;
}

.data-table tbody td,
.compact-ledger-table tbody td,
table tbody td {
    padding: 11px 14px;
    border-bottom: 1.5px solid var(--at-border-subtle, var(--at-surface-subtle));
    color: var(--at-text);
    vertical-align: middle;
    background: var(--at-surface);
    transition: background-color 0.12s ease;
}

.data-table tbody tr:hover td,
.compact-ledger-table tbody tr:hover td,
table tbody tr:hover td {
    background-color: var(--at-fill-hover);
}

.data-table tbody tr:last-child td,
.compact-ledger-table tbody tr:last-child td,
table tbody tr:last-child td {
    border-bottom: none;
}

/* Compact / High-Density Data Tables */
.data-table-compact thead th,
.table-dense thead th,
.table-sm thead th {
    padding: 7px 10px;
    font-size: 10.5px;
}

.data-table-compact tbody td,
.table-dense tbody td,
.table-sm tbody td {
    padding: 7px 10px;
    font-size: 12px;
}

/* ── Sticky Action & Anchor Columns ── */
.table-sticky-actions th:last-child,
.table-sticky-actions td:last-child,
.sticky-col-right {
    position: sticky;
    right: 0;
    z-index: 6;
    background: var(--at-surface);
    box-shadow: -4px 0 8px -2px rgba(0, 0, 0, 0.06);
    text-align: right;
}

.table-sticky-actions th:last-child {
    background: var(--at-surface-subtle);
    z-index: 12;
}

.table-sticky-actions tr:hover td:last-child,
tr:hover .sticky-col-right {
    background: var(--at-fill-hover);
}

.table-sticky-first th:first-child,
.table-sticky-first td:first-child,
.sticky-col-left {
    position: sticky;
    left: 0;
    z-index: 6;
    background: var(--at-surface);
    box-shadow: 4px 0 8px -2px rgba(0, 0, 0, 0.06);
}

.table-sticky-first th:first-child {
    background: var(--at-surface-subtle);
    z-index: 12;
}

.table-sticky-first tr:hover td:first-child,
tr:hover .sticky-col-left {
    background: var(--at-fill-hover);
}

/* ── Cell Micro-Typography & Column Constraints ── */
.cell-primary, .cell-title, .cell-name {
    font-weight: 700;
    color: var(--at-text-strong);
    font-size: 13.5px;
    line-height: 1.25;
}

.cell-meta, .cell-sub, .text-meta {
    font-size: 11px;
    color: var(--at-text-muted);
    margin-top: 2px;
    line-height: 1.3;
    font-weight: 500;
    display: block;
}

.cell-badge-stack {
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-start;
}

.cell-pill-group {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.cell-mono {
    font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
    font-size: 11.5px;
    font-weight: 700;
}

.cell-nowrap, .col-nowrap {
    white-space: nowrap !important;
}

.cell-wrap, .col-wrap {
    white-space: normal !important;
    word-break: break-word;
    min-width: 140px;
    max-width: 320px;
}

.cell-truncate, .col-truncate {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-max-xs { max-width: 90px; }
.col-max-sm { max-width: 140px; }
.col-max-md { max-width: 200px; }
.col-max-lg { max-width: 280px; }
.col-max-xl { max-width: 360px; }

/* ── Action Buttons & Button Groups ── */
.action-btn-group, .btn-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.action-btn-group .btn,
.btn-compact,
.btn-action {
    padding: 4px 8px;
    font-size: 11.5px;
    font-weight: 700;
    height: 26px;
    line-height: 1;
    border-width: 1.5px;
    box-shadow: 1px 1px 0 var(--at-ink);
    white-space: nowrap;
}

.action-btn-group .btn:hover,
.btn-compact:hover,
.btn-action:hover {
    transform: translate(-0.5px, -0.5px);
    box-shadow: 1.5px 1.5px 0 var(--at-ink);
}

.action-btn-group .btn:active,
.btn-compact:active,
.btn-action:active {
    transform: translate(1px, 1px);
    box-shadow: none;
}

.btn-icon-only {
    width: 26px;
    height: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}


/* ── Badges & Status Pills ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--at-radius-xs);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.3px;
    border: 1.5px solid var(--at-ink);
    box-shadow: 1px 1px 0 var(--at-ink);
    line-height: 1.2;
    white-space: nowrap;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-primary { background: var(--at-accent-wash); color: var(--at-accent-text); }
.badge-gray, .badge-secondary { background: var(--at-surface-subtle); color: var(--at-text-muted); }

/* Dark mode adjustments for badges */
[data-at-theme='dark'] .badge-success { background: #14532d; color: #86efac; border-color: #86efac; }
[data-at-theme='dark'] .badge-warning { background: #78350f; color: #fde047; border-color: #fde047; }
[data-at-theme='dark'] .badge-danger { background: #7f1d1d; color: #fca5a5; border-color: #fca5a5; }
[data-at-theme='dark'] .badge-info { background: #0c4a6e; color: #7dd3fc; border-color: #7dd3fc; }

/* ── Buttons (Tactile Bold Press Mechanics) ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    font-family: var(--at-font-sans);
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.2;
    border-radius: var(--at-radius-sm);
    border: 2px solid var(--at-ink);
    box-shadow: var(--at-shadow-3);
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

.btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: var(--at-shadow-4);
}

.btn:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.btn:disabled, .btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background: var(--at-accent);
    color: var(--at-on-accent);
}

.btn-secondary {
    background: var(--at-surface);
    color: var(--at-ink-strong);
}

.btn-success {
    background: var(--at-success);
    color: var(--at-on-success);
}

.btn-danger {
    background: var(--at-danger);
    color: var(--at-on-danger);
}

.btn-warning {
    background: var(--at-warning);
    color: var(--at-on-warning);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    box-shadow: var(--at-shadow-2);
}

.btn-sm:hover {
    box-shadow: var(--at-shadow-3);
}

.btn-sm:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.btn-lg {
    padding: 13px 24px;
    font-size: 15px;
    box-shadow: var(--at-shadow-4);
}

/* ── Form Controls & Floating Elements ── */
.form-group {
    margin-bottom: 18px;
}

.form-group > label, label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--at-text-strong);
    margin-bottom: 6px;
    text-transform: none;
}

.form-control, .form-select, select.form-control, textarea.form-control {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--at-text-strong);
    background-color: var(--at-surface);
    border: 2px solid var(--at-border);
    border-radius: var(--at-radius-sm);
    box-shadow: 1px 1px 0 var(--at-border);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus, textarea:focus {
    border-color: var(--at-accent);
    box-shadow: 0 0 0 3px var(--at-accent-wash);
    outline: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

/* ── Modals & Dialogs ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeInModal 0.2s ease forwards;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--at-surface);
    border: 2.5px solid var(--at-ink);
    border-radius: var(--at-radius-lg);
    box-shadow: var(--at-shadow-6);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-header {
    padding: 18px 22px;
    border-bottom: 2px solid var(--at-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--at-surface);
}

.modal-body {
    padding: 22px;
}

.modal-footer {
    padding: 16px 22px;
    border-top: 2px solid var(--at-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: var(--at-surface-subtle);
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpModal {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Alerts & Notifications ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--at-radius-sm);
    border: 2px solid var(--at-ink);
    box-shadow: var(--at-shadow-2);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
    font-weight: 600;
}

.alert-success { background: #dcfce7; color: #166534; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-info { background: #e0f2fe; color: #0369a1; }

/* ── Interactive Theme Changer Drawer & Swatches ── */
.theme-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.theme-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.theme-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 90vw;
    background: var(--at-surface);
    border-left: 2.5px solid var(--at-ink);
    box-shadow: -6px 0 25px rgba(0,0,0,0.25);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-drawer-overlay.active .theme-drawer {
    transform: translateX(0);
}

.theme-drawer-header {
    padding: 18px 20px;
    border-bottom: 2px solid var(--at-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-drawer-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--at-text-strong);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.theme-drawer-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.theme-section-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--at-text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-mode-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.theme-mode-btn {
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 700;
    border: 2px solid var(--at-border);
    border-radius: var(--at-radius-sm);
    background: var(--at-surface);
    color: var(--at-text);
    cursor: pointer;
    box-shadow: var(--at-shadow-2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.12s ease;
}

.theme-mode-btn:hover {
    border-color: var(--at-ink);
    transform: translate(-1px, -1px);
    box-shadow: var(--at-shadow-3);
}

.theme-mode-btn.active {
    background: var(--at-accent);
    color: var(--at-on-accent);
    border-color: var(--at-ink);
    box-shadow: var(--at-shadow-3);
}

.theme-presets-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.theme-preset-card {
    padding: 10px 12px;
    border: 2px solid var(--at-border);
    border-radius: var(--at-radius-sm);
    background: var(--at-surface);
    cursor: pointer;
    box-shadow: var(--at-shadow-2);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.12s ease;
}

.theme-preset-card:hover {
    transform: translate(-1px, -1px);
    box-shadow: var(--at-shadow-3);
    border-color: var(--at-ink);
}

.theme-preset-card.active {
    border-color: var(--at-ink);
    outline: 2px solid var(--at-accent);
    outline-offset: 1px;
    background: var(--at-accent-wash);
}

.theme-preset-swatch {
    width: 22px;
    height: 22px;
    border-radius: var(--at-radius-xs);
    border: 1.5px solid var(--at-ink);
    flex-shrink: 0;
    box-shadow: 1px 1px 0 var(--at-ink);
}

.theme-preset-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--at-text-strong);
}

.theme-drawer-footer {
    padding: 16px 20px;
    border-top: 2px solid var(--at-border);
    background: var(--at-surface-subtle);
}

/* ── Mobile & Responsive Breakpoints ── */
@media (max-width: 1024px) {
    .app-layout {
        display: block;
        width: 100%;
        position: relative;
        overflow-x: hidden;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 25px rgba(0,0,0,0.3);
        overflow-y: auto;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.65);
        backdrop-filter: blur(4px);
        z-index: 9998;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-wrapper {
        width: 100%;
        min-width: 100%;
        margin: 0;
    }

    .topbar {
        height: auto;
        min-height: 60px;
        padding: 10px 16px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .panel-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .panel-body {
        padding: 14px;
    }

    /* Full-bleed table-responsive on small screens */
    .panel-body > .table-responsive {
        margin-left: -14px;
        margin-right: -14px;
        width: calc(100% + 28px);
        border-radius: 0;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .data-table thead th,
    .compact-ledger-table thead th,
    table thead th {
        padding: 8px 10px;
        font-size: 10.5px;
    }

    .data-table tbody td,
    .compact-ledger-table tbody td,
    table tbody td {
        padding: 9px 10px;
        font-size: 12px;
    }

    /* Responsive filter toolbar */
    .audit-filter-grid,
    form[method="GET"] {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* Stacked card mode when .table-mobile-cards is applied */
    .table-mobile-cards,
    .table-mobile-cards thead,
    .table-mobile-cards tbody,
    .table-mobile-cards th,
    .table-mobile-cards td,
    .table-mobile-cards tr {
        display: block;
        width: 100%;
    }

    .table-mobile-cards thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-mobile-cards tbody tr {
        background: var(--at-surface);
        border: 2px solid var(--at-border);
        border-radius: var(--at-radius-md);
        padding: 12px 14px;
        margin-bottom: 12px;
        box-shadow: var(--at-shadow-1);
    }

    .table-mobile-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 7px 0;
        border-bottom: 1px solid var(--at-border-subtle, var(--at-surface-subtle));
        border-top: none;
        white-space: normal;
        text-align: right;
    }

    .table-mobile-cards tbody td:last-child {
        border-bottom: none;
        padding-top: 10px;
        justify-content: flex-end;
    }

    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 800;
        font-size: 11px;
        color: var(--at-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        text-align: left;
        margin-right: 12px;
        flex-shrink: 0;
    }
}


/* ── Auth / Login Pages (Bold Press Modern) ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--at-canvas);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--at-surface);
    border: 2.5px solid var(--at-ink);
    border-radius: var(--at-radius-lg);
    box-shadow: var(--at-shadow-6);
    padding: 32px 28px;
    position: relative;
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-brand img {
    max-height: 52px;
    margin: 0 auto 12px;
    object-fit: contain;
}

.auth-brand h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--at-text-strong);
    font-family: var(--at-font-display);
    margin-bottom: 4px;
}

.auth-brand p {
    font-size: 13.5px;
    color: var(--at-text-muted);
}
