/* ================================================================
   Datum Research — Main Stylesheet
   Based on atom_dark.css theme variables
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --sidebar-width: 240px;
    --topnav-height: 52px;
    --transition: 0.2s ease;
}

/* Apply atom-dark palette globally */
.theme-atom-dark,
body {
    --bg: rgb(19, 22, 27);
    --surface: rgb(32, 36, 43);
    --surface-2: rgb(39, 43, 52);
    --surface-3: rgb(45, 49, 57);
    --border: rgb(66, 73, 88);
    --border-light: rgb(51, 55, 64);
    --text: rgb(220, 221, 222);
    --text-secondary: rgb(171, 178, 191);
    --text-muted: rgb(128, 128, 128);
    --primary: rgb(97, 175, 239);
    --primary-dark: rgb(76, 137, 186);
    --primary-darker: rgb(55, 99, 134);
    --accent: rgb(152, 195, 121);
    --accent-dark: rgb(122, 156, 97);
    --sidenav-bg: rgb(24, 28, 35);
    --sidenav-hover: rgb(45, 49, 57);
    --sidenav-active: rgb(59, 63, 71);
    --sidenav-text: rgb(171, 178, 191);
    --sidenav-text-a: rgb(255, 255, 255);
    --topnav-bg: rgb(32, 36, 43);
    --card-bg: rgb(32, 36, 43);
    --card-border: rgb(66, 73, 88);
    --table-header: rgb(39, 43, 52);
    --table-stripe: rgb(35, 39, 46);
    --table-hover: rgb(45, 49, 57);
    --red: rgb(224, 108, 117);
    --yellow: rgb(229, 192, 123);
    --green: rgb(152, 195, 121);
    --blue: rgb(97, 175, 239);
    --purple: rgb(198, 120, 221);
}

/* ================================================================
   Reset & Base
   ================================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* ================================================================
   Layout Shell
   ================================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ----------------------------------------------------------------
   Left Sidebar
   ---------------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidenav-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-logo {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo .brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo .brand-icon svg {
    width: 18px;
    height: 18px;
    fill: rgb(19, 22, 27);
}

.sidebar-logo .brand-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sidenav-text-a);
    letter-spacing: 0.01em;
}

.sidebar-logo .brand-sub {
    font-size: 0.7rem;
    color: var(--sidenav-text);
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 12px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--sidenav-text);
    font-size: 0.825rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--sidenav-hover);
    color: var(--sidenav-text-a);
}

.nav-item.active {
    background: var(--sidenav-active);
    color: var(--sidenav-text-a);
}

.nav-item.active .nav-icon {
    color: var(--primary);
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.75;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-footer .updated {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ----------------------------------------------------------------
   Main Content Area
   ---------------------------------------------------------------- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* ----------------------------------------------------------------
   Top Navbar (secondary)
   ---------------------------------------------------------------- */
.topnav {
    height: var(--topnav-height);
    background: var(--topnav-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topnav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.breadcrumb .sep {
    opacity: 0.4;
}

.breadcrumb .current {
    color: var(--text);
    font-weight: 500;
}

.topnav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.topnav-badge {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Hamburger (mobile) */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text);
}

.hamburger svg {
    width: 22px;
    height: 22px;
}

/* Page content well */
.page-content {
    flex: 1;
    padding: 28px 28px 48px;
    max-width: 1600px;
    min-width: 0;
    width: 100%;
}

/* ================================================================
   Page Headers
   ================================================================ */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* ================================================================
   Cards
   ================================================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.card-body {
    padding: 18px;
}

/* ================================================================
   Stats Grid
   ================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ================================================================
   Tables
   ================================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

thead th {
    background: var(--table-header);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:nth-child(even) {
    background: var(--table-stripe);
}

tbody tr:hover {
    background: var(--table-hover);
}

tbody td {
    padding: 10px 14px;
    color: var(--text);
    vertical-align: top;
}

/* ================================================================
   Comparison Matrix (Table) - Hybrid Responsive
   ================================================================ */
.matrix-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    margin-top: 16px;
    width: 100%;
}

.comparison-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    white-space: nowrap;
}

.comparison-matrix thead th {
    background: var(--table-header);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Make the first column sticky on desktop */
.comparison-matrix thead th:first-child,
.comparison-matrix tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 20;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.comparison-matrix thead th:first-child {
    background: var(--table-header);
    z-index: 30;
    /* Above regular header AND sticky col */
}

/* Subtle shadow to show scrolling under sticky column */
.comparison-matrix th:first-child::after,
.comparison-matrix td:first-child::after {
    content: '';
    position: absolute;
    top: 0;
    right: -5px;
    bottom: 0;
    width: 5px;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.1) 0px, transparent 100%);
    pointer-events: none;
}

.comparison-matrix tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.comparison-matrix tbody tr:hover td {
    background: var(--table-hover);
}

/* Hover background fix for the sticky column */
.comparison-matrix tbody tr:hover td:first-child {
    background: var(--table-hover);
}

.comparison-matrix tbody td {
    padding: 12px 16px;
    color: var(--text);
    vertical-align: middle;
}

.comparison-matrix td.wrap-text {
    white-space: normal;
    min-width: 200px;
    max-width: 320px;
    line-height: 1.4;
}

/* Distinctive styling for DatumHub Row */
.comparison-matrix tr.datum-row td {
    background: rgba(97, 175, 239, 0.06);
}

.comparison-matrix tr.datum-row td:first-child {
    border-left: 3px solid var(--primary);
    background: rgba(97, 175, 239, 0.08);
    /* slightly darker for the sticky cell to blend */
}

.comparison-matrix tr.datum-row:hover td {
    background: rgba(97, 175, 239, 0.12);
}

/* ----------------------------------------------------------------
   Mobile Hybrid Matrix (Accordion/Cards fallback)
   ---------------------------------------------------------------- */
@media screen and (max-width: 768px) {
    .matrix-wrapper {
        border: none;
        background: transparent;
        overflow-x: hidden;
    }

    .comparison-matrix,
    .comparison-matrix tbody,
    .comparison-matrix tr,
    .comparison-matrix td {
        display: block;
        width: 100%;
    }

    /* Hide table headers entirely */
    .comparison-matrix thead {
        display: none;
    }

    /* Transform rows into cards */
    .comparison-matrix tbody tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 16px;
        padding: 8px 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .comparison-matrix tbody tr:hover td {
        background: transparent;
        /* Disable background hover on mobile columns */
    }

    .comparison-matrix tr.datum-row {
        border-color: rgba(97, 175, 239, 0.4);
        background: linear-gradient(180deg, rgba(32, 36, 43, 1) 0%, rgba(97, 175, 239, 0.05) 100%);
    }

    .comparison-matrix tr.datum-row td:first-child {
        border-left: none;
        background: transparent;
    }

    /* Reset sticky values for mobile */
    .comparison-matrix tbody td:first-child {
        position: static;
        z-index: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        padding: 16px;
        font-size: 1.15rem;
        background: transparent;
    }

    .comparison-matrix td:first-child::after {
        display: none;
    }

    /* Setup internal data points */
    .comparison-matrix tbody td {
        padding: 10px 16px;
        text-align: right;
        /* Values line up on the right */
        border-bottom: 1px solid var(--border-light);
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 16px;
        white-space: normal;
    }

    .comparison-matrix tbody td.wrap-text {
        text-align: right;
    }

    .comparison-matrix tbody td:last-child {
        border-bottom: none;
    }

    /* Inject the header labels via CSS for mobile */
    .comparison-matrix tbody td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        font-weight: 600;
        text-align: left;
        flex-shrink: 0;
        padding-top: 2px;
    }

    /* Prevent first child (Company Name) from getting a pseudo label */
    .comparison-matrix tbody td:first-child::before {
        display: none;
    }

    .comparison-matrix tbody td:first-child {
        justify-content: flex-start;
        align-items: center;
        gap: 8px;
    }
}

/* ================================================================
   Badges / Pills
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.67rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-blue {
    background: rgba(97, 175, 239, 0.15);
    color: var(--blue);
    border: 1px solid rgba(97, 175, 239, 0.3);
}

.badge-green {
    background: rgba(152, 195, 121, 0.15);
    color: var(--green);
    border: 1px solid rgba(152, 195, 121, 0.3);
}

.badge-yellow {
    background: rgba(229, 192, 123, 0.15);
    color: var(--yellow);
    border: 1px solid rgba(229, 192, 123, 0.3);
}

.badge-red {
    background: rgba(224, 108, 117, 0.15);
    color: var(--red);
    border: 1px solid rgba(224, 108, 117, 0.3);
}

.badge-purple {
    background: rgba(198, 120, 221, 0.15);
    color: var(--purple);
    border: 1px solid rgba(198, 120, 221, 0.3);
}

.badge-muted {
    background: rgba(128, 128, 128, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(128, 128, 128, 0.2);
}

/* Threat level badges */
.threat-HIGH {
    background: rgba(224, 108, 117, 0.2);
    color: var(--red);
    border: 1px solid rgba(224, 108, 117, 0.4);
}

.threat-MEDIUM-HIGH {
    background: rgba(229, 150, 80, 0.2);
    color: #e59650;
    border: 1px solid rgba(229, 150, 80, 0.4);
}

.threat-MEDIUM {
    background: rgba(229, 192, 123, 0.2);
    color: var(--yellow);
    border: 1px solid rgba(229, 192, 123, 0.4);
}

.threat-MEDIUM-LOW {
    background: rgba(100, 180, 100, 0.2);
    color: #86c97b;
    border: 1px solid rgba(100, 180, 100, 0.4);
}

.threat-LOW {
    background: rgba(152, 195, 121, 0.2);
    color: var(--green);
    border: 1px solid rgba(152, 195, 121, 0.4);
}

/* Category color map */
.cat-erp {
    background: rgba(97, 175, 239, 0.15);
    color: var(--blue);
    border: 1px solid rgba(97, 175, 239, 0.25);
}

.cat-procurement {
    background: rgba(198, 120, 221, 0.15);
    color: var(--purple);
    border: 1px solid rgba(198, 120, 221, 0.25);
}

.cat-inventory {
    background: rgba(152, 195, 121, 0.15);
    color: var(--green);
    border: 1px solid rgba(152, 195, 121, 0.25);
}

.cat-construction {
    background: rgba(229, 192, 123, 0.15);
    color: var(--yellow);
    border: 1px solid rgba(229, 192, 123, 0.25);
}

.cat-finance {
    background: rgba(224, 108, 117, 0.15);
    color: var(--red);
    border: 1px solid rgba(224, 108, 117, 0.25);
}

.cat-mrp {
    background: rgba(97, 175, 239, 0.1);
    color: #7ec8e3;
    border: 1px solid rgba(97, 175, 239, 0.2);
}

/* ================================================================
   Feature Matrix Cells
   ================================================================ */
.matrix-wrapper {
    overflow: auto;
    max-height: 72vh;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.matrix-table {
    border-collapse: collapse;
    font-size: 0.72rem;
    white-space: nowrap;
}

.matrix-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--table-header);
    padding: 8px 10px;
    text-align: center;
    border-right: 1px solid var(--border);
    min-width: 80px;
    font-size: 0.65rem;
}

.matrix-table thead th.feat-col {
    text-align: left;
    min-width: 200px;
    position: sticky;
    left: 0;
    z-index: 20;
    background: var(--table-header);
}

.matrix-table thead th.datum-col {
    background: rgba(97, 175, 239, 0.15);
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.matrix-table tbody td {
    padding: 6px 10px;
    text-align: center;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.matrix-table tbody td.feat-name {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 5;
    font-weight: 500;
    color: var(--text);
    min-width: 200px;
    max-width: 220px;
    white-space: normal;
}

.matrix-table tbody td.datum-val {
    background: rgba(97, 175, 239, 0.06);
}

.matrix-table tbody tr.section-row td {
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 5px 10px;
    text-align: left;
    position: sticky;
    left: 0;
}

.cell-full {
    color: var(--green);
    font-size: 1rem;
}

.cell-basic {
    color: var(--yellow);
    font-size: 1rem;
}

.cell-planned {
    color: var(--blue);
    font-size: 1rem;
}

.cell-none {
    color: var(--border);
    font-size: 1rem;
}

/* ================================================================
   Pricing Page — price bars
   ================================================================ */
.price-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.price-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--primary);
    transition: width 0.4s ease;
    min-width: 2px;
}

.price-label {
    font-size: 0.78rem;
    color: var(--text);
    white-space: nowrap;
}

/* ================================================================
   Market Categories — card grid
   ================================================================ */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
}

.category-card:hover {
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

.category-card-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.category-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.category-companies {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.category-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cat-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 3px;
}

.cat-section-label.green {
    color: var(--green);
}

.cat-section-label.blue {
    color: var(--primary);
}

.cat-section-label.red {
    color: var(--red);
}

.cat-section-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ================================================================
   TAM — Metric Cards
   ================================================================ */
.tam-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 20px 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.tam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.tam-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 18px;
}

.tam-metric {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.tam-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
    margin-bottom: 4px;
}

.tam-source {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ================================================================
   Search / Filter Bar
   ================================================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.search-input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 12px;
    color: var(--text);
    font-size: 0.8rem;
    font-family: inherit;
    min-width: 200px;
    flex: 1;
    max-width: 320px;
    transition: border-color var(--transition);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    color: var(--text);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-select option {
    background: var(--surface);
}

.result-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* ================================================================
   Scrollbar
   ================================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ================================================================
   Responsive — Mobile Sidebar Overlay
   ================================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 240px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger {
        display: flex;
    }

    .page-content {
        padding: 16px 14px 40px;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tam-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tam-grid {
        grid-template-columns: 1fr;
    }

    .topnav {
        padding: 0 14px;
    }

    .topnav-right .topnav-badge {
        display: none;
    }
}

/* ================================================================
   Misc Utilities
   ================================================================ */
.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.mt-4 {
    margin-top: 1rem;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.85rem;
}

/* Sortable column headers */
th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    color: var(--text);
}

th.sortable::after {
    content: ' ⇅';
    opacity: 0.4;
    font-size: 0.7rem;
}

th.sort-asc::after {
    content: ' ↑';
    opacity: 0.8;
    color: var(--primary);
}

th.sort-desc::after {
    content: ' ↓';
    opacity: 0.8;
    color: var(--primary);
}