/* Manifest — Design System
   Maritime trade intelligence platform
   Stack: Inter + Chart.js + Leaflet (where used)
*/

/* ── Color tokens ───────────────────────────────────────────── */
:root {
    --background: #ffffff;
    --foreground: #09090b;
    --card: #ffffff;
    --card-foreground: #09090b;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --border: #e4e4e7;
    --input: #e4e4e7;
    --ring: #0e7490;
    --primary: #0e7490;
    --primary-foreground: #f0fdfa;
    --secondary: #f4f4f5;
    --secondary-foreground: #18181b;
    --accent: #f0fdfa;
    --accent-foreground: #0e7490;
    --sidebar: #fafafa;
    --sidebar-foreground: #09090b;
    --sidebar-border: #e4e4e7;
    --sidebar-accent: #e6f7f9;
    --sidebar-accent-foreground: #0e7490;
    --sidebar-primary: #0e7490;
    --sidebar-primary-foreground: #f0fdfa;
    --sidebar-width: 16rem;
    --sidebar-width-icon: 3.5rem;
    --chart-1: #2563eb;
    --chart-2: #16a34a;
    --chart-3: #d97706;
    --chart-4: #dc2626;
    --chart-5: #6366f1;
    --chart-6: #0891b2;
    --radius: 0.75rem;
}

/* ── Dark mode tokens ───────────────────────────────────────── */
html[data-theme="dark"] {
    --background: #09090b;
    --foreground: #fafafa;
    --card: #18181b;
    --card-foreground: #fafafa;
    --muted: #27272a;
    --muted-foreground: #a1a1aa;
    --border: #3f3f46;
    --input: #3f3f46;
    --ring: #22d3ee;
    --primary: #0e9ab5;
    --primary-foreground: #f0fdfa;
    --secondary: #27272a;
    --secondary-foreground: #fafafa;
    --accent: #0c3b4a;
    --accent-foreground: #67e8f9;
    --sidebar: #111113;
    --sidebar-foreground: #fafafa;
    --sidebar-border: #27272a;
    --sidebar-accent: #0c3b4a;
    --sidebar-accent-foreground: #67e8f9;
    --sidebar-primary: #0e9ab5;
    --sidebar-primary-foreground: #f0fdfa;
}

/* Dark badge overrides (hardcoded bg → inverted dark palette) */
html[data-theme="dark"] .badge-prospect {
    background: #1e3a5f;
    border-color: #1d4ed8;
    color: #93c5fd;
}
html[data-theme="dark"] .badge-contacted {
    background: #14532d;
    border-color: #166534;
    color: #86efac;
}
html[data-theme="dark"] .badge-negotiating {
    background: #431407;
    border-color: #9a3412;
    color: #fdba74;
}
html[data-theme="dark"] .badge-approved {
    background: #0c4a6e;
    border-color: #0369a1;
    color: #7dd3fc;
}
html[data-theme="dark"] .badge-vendor {
    background: #3b0764;
    border-color: #7c3aed;
    color: #c4b5fd;
}
html[data-theme="dark"] .badge-do-not-contact {
    background: #450a0a;
    border-color: #991b1b;
    color: #fca5a5;
}
html[data-theme="dark"] .badge-in-production {
    background: #422006;
    border-color: #92400e;
    color: #fcd34d;
}
html[data-theme="dark"] .badge-in-transit {
    background: #1e3a5f;
    border-color: #1d4ed8;
    color: #93c5fd;
}
html[data-theme="dark"] .badge-delayed {
    background: #450a0a;
    border-color: #991b1b;
    color: #fca5a5;
}
html[data-theme="dark"] .badge-arrived {
    background: #14532d;
    border-color: #166534;
    color: #86efac;
}
html[data-theme="dark"] .badge-completed {
    background: #14532d;
    border-color: #166534;
    color: #86efac;
}
html[data-theme="dark"] .badge-sent {
    background: #0c4a6e;
    border-color: #0369a1;
    color: #7dd3fc;
}
html[data-theme="dark"] .badge-confirmed {
    background: #3b0764;
    border-color: #7c3aed;
    color: #c4b5fd;
}
html[data-theme="dark"] .badge-shipped {
    background: #1e3a5f;
    border-color: #1d4ed8;
    color: #93c5fd;
}
html[data-theme="dark"] .geo-pill {
    background: #27272a;
    color: #a1a1aa;
    border-color: #3f3f46;
}
/* Dark scrollbar — solid visible track + thumb */
html[data-theme="dark"] #sup-rail-items::-webkit-scrollbar-track,
html[data-theme="dark"] .split-pane-content > div::-webkit-scrollbar-track,
html[data-theme="dark"] .split-pane-nav::-webkit-scrollbar-track {
    background: #27272a;
    border-radius: 99px;
}
html[data-theme="dark"] #sup-rail-items::-webkit-scrollbar-thumb,
html[data-theme="dark"] .split-pane-content > div::-webkit-scrollbar-thumb,
html[data-theme="dark"] .split-pane-nav::-webkit-scrollbar-thumb {
    background: #52525b;
    border-radius: 99px;
}
html[data-theme="dark"] #sup-rail-items::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"]
    .split-pane-content
    > div::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .split-pane-nav::-webkit-scrollbar-thumb:hover {
    background: #a1a1aa;
}
html[data-theme="dark"] #sup-rail-items,
html[data-theme="dark"] .split-pane-content > div,
html[data-theme="dark"] .split-pane-nav {
    scrollbar-color: #52525b #27272a;
}

/* ── Viewing-as banner (sidebar, virtual account) ───────────── */
.viewing-as-banner {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    border: 1px solid #fbbf24;
    background: #fffbeb;
    border-radius: 0.375rem;
    padding: 0.375rem 0.5rem;
    margin-bottom: 0.375rem;
}
.viewing-as-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: #92400e;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.viewing-as-clear {
    border: none;
    background: none;
    cursor: pointer;
    color: #92400e;
    padding: 0;
    line-height: 1;
}
html[data-theme="dark"] .viewing-as-banner {
    background: #1c1008;
    border-color: #78350f;
}
html[data-theme="dark"] .viewing-as-name,
html[data-theme="dark"] .viewing-as-clear {
    color: #fcd34d;
}

/* ── Product pills ──────────────────────────────────────────── */
.product-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.4;
}
.geo-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    background: #f4f4f5;
    color: #52525b;
    border: 1px solid #e4e4e7;
}

/* ── Volume histogram popover ───────────────────────────────── */
.vol-popover {
    position: absolute;
    top: calc(100% + 0.375rem);
    left: 0;
    z-index: 80;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    width: 22rem;
    padding: 1rem;
}
.vol-popover-backdrop {
    position: fixed;
    inset: 0;
    z-index: 79;
}

/* ── Base ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family:
        "Inter",
        system-ui,
        -apple-system,
        sans-serif;
    background: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a {
    color: inherit;
    text-decoration: none;
}

/* ── App shell ──────────────────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow: hidden;
    transition: width 0.2s ease-linear;
    z-index: 50;
}
.sidebar.collapsed {
    width: var(--sidebar-width-icon);
}
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 3.75rem;
}
.sidebar-logo {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-logo img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    border-radius: 0.375rem;
}
.sidebar-logo .logo-dark {
    display: none;
}
html[data-theme="dark"] .sidebar-logo .logo-light {
    display: none;
}
html[data-theme="dark"] .sidebar-logo .logo-dark {
    display: block;
}
.sidebar-brand {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s;
}
.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    width: 0;
}
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}
.sidebar-group-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.5rem 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s;
}
.sidebar.collapsed .sidebar-group-label {
    opacity: 0;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 0.375rem;
    color: var(--sidebar-foreground);
    font-size: 0.875rem;
    transition:
        background 0.15s,
        color 0.15s;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
}
.nav-item:hover,
.nav-item.active {
    background: var(--sidebar-accent);
    color: var(--sidebar-accent-foreground);
}
.nav-item.active {
    font-weight: 500;
}
.nav-item svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.nav-item span {
    overflow: hidden;
    transition:
        opacity 0.15s,
        width 0.15s;
}
.sidebar.collapsed .nav-item span {
    opacity: 0;
    width: 0;
}
.sidebar.collapsed .nav-item {
    justify-content: center;
    gap: 0;
}
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--sidebar-border);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem;
    border-radius: 0.375rem;
}
.sidebar-user:hover {
    background: var(--sidebar-accent);
}
.sidebar-user .avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: var(--primary);
    color: var(--primary-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user .user-info {
    overflow: hidden;
    transition: opacity 0.15s;
}
.sidebar-user .user-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user .user-email {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar.collapsed .sidebar-user .user-info {
    opacity: 0;
    width: 0;
}
.sidebar.collapsed .sidebar-user {
    justify-content: center;
    gap: 0;
}
.sidebar.collapsed .sidebar-user:hover {
    background: transparent;
}
.sidebar.collapsed #sidebar-footer-account {
    display: none;
}
.sidebar.collapsed #avatar-area {
    cursor: pointer;
}

/* ── Main content ───────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.2s ease-linear;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-width-icon);
}

/* ── Header ─────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    height: 2.5rem;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.5rem;
}
.topbar-toggle {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted-foreground);
    border: none;
    background: none;
}
.topbar-toggle:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}
.topbar-sep {
    width: 1px;
    height: 1rem;
    background: var(--border);
    margin: 0 0.25rem;
}
.topbar-search {
    position: relative;
}
body.beta-mode .topbar-search {
    display: none;
}
.topbar-search input {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    height: 2rem;
    padding: 0 0.75rem 0 2.1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    width: 18rem;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
    outline: none;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}
.topbar-search input::placeholder {
    color: var(--muted-foreground);
    font-weight: 400;
    letter-spacing: 0;
    opacity: 0.75;
    text-transform: none;
}
.topbar-search input:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px color-mix(in srgb, #0891b2 18%, transparent);
}
.topbar-search-icon {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    width: 0.8rem;
    height: 0.8rem;
    pointer-events: none;
    transition: color 0.15s;
}
.topbar-search:focus-within .topbar-search-icon {
    color: #0891b2;
}
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
/* Live clock */
.topbar {
    position: relative;
}
.topbar-clock {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    pointer-events: none;
    white-space: nowrap;
}
.clk-main {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--foreground);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.clk-colon {
    display: inline-block;
}
@keyframes clk-pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.15;
        transform: scale(0.85);
    }
}
.clk-colon-pulse {
    animation: clk-pulse 1s ease-in-out infinite;
    display: inline-block;
    transform-origin: center;
}
.clk-secondary {
    font-size: 0.73rem;
    font-weight: 400;
    color: var(--muted-foreground);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    margin-right: 0.5rem;
}
.clk-day-badge {
    font-size: 0.55rem;
    font-weight: 700;
    color: #dc2626;
    vertical-align: super;
    line-height: 1;
    margin-left: 0.05rem;
}

/* ── Page content ───────────────────────────────────────────── */
.page {
    padding: 1rem;
}
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}
.page-subtitle {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-top: 0.125rem;
}
.page-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.card-header {
    padding: 1.25rem 1.5rem 0;
}
.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.card-desc {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-top: 0.125rem;
}
.card-body {
    padding: 1rem 1.5rem 1.5rem;
}
.card-body.pt0 {
    padding-top: 0;
}

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.5rem;
}
.stat-card-label {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    font-weight: 500;
}
.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary);
    border-radius: 9999px;
    padding: 0.375rem;
}
.stat-icon svg {
    width: 1rem;
    height: 1rem;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    padding: 0 1.25rem 0.25rem;
}
.stat-trend {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0 1.25rem 0.75rem;
}
.stat-trend.up {
    color: #16a34a;
}
.stat-trend.down {
    color: #dc2626;
}
.stat-trend svg {
    width: 1rem;
    height: 1rem;
}

/* ── Stat card — interactive variant ────────────────────────── */
.stat-card-action {
    cursor: pointer;
    transition:
        box-shadow 0.18s,
        border-color 0.18s;
}
.stat-card-action:hover {
    box-shadow: 0 4px 18px rgba(8, 145, 178, 0.13);
    border-color: #0891b2;
}

/* ── Track timeline ──────────────────────────────────────────── */
.track-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.track-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem 0.875rem;
}
.track-carrier-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}
.track-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--card);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.track-dot.done {
    background: var(--primary);
    border-color: var(--primary);
}
.track-dot.current {
    background: #0891b2;
    border-color: #0891b2;
    box-shadow: 0 0 0 3px color-mix(in srgb, #0891b2 18%, transparent);
}
.track-dot.current::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid #0891b2;
    animation: trackPulse 1.8s ease-out infinite;
    opacity: 0;
}
@keyframes trackPulse {
    0% {
        transform: scale(0.7);
        opacity: 0.7;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}
.track-milestone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}
.track-ms-label {
    font-size: 0.68rem;
    color: var(--muted-foreground);
    white-space: nowrap;
}
.track-ms-label.active {
    color: #0891b2;
    font-weight: 600;
}
.track-ms-date {
    font-size: 0.68rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    font-weight: 500;
}
.track-ms-date.active {
    color: #0891b2;
}
.track-placeholder-notice {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--muted-foreground);
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
}

/* ── Inception badge ─────────────────────────────────────────── */
.inception-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border-radius: 4px;
    padding: 1px 6px;
    letter-spacing: 0.01em;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0 1rem;
    height: 2.25rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition:
        background 0.15s,
        color 0.15s,
        opacity 0.15s;
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}
.btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-primary:hover {
    background: color-mix(in srgb, var(--primary) 90%, transparent);
}
.btn-outline {
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.btn-outline:hover {
    background: var(--accent);
}
.btn-ghost {
    background: none;
    color: var(--foreground);
}
.btn-ghost:hover {
    background: var(--accent);
}
.btn-sm {
    height: 1.75rem;
    padding: 0 0.625rem;
    font-size: 0.8125rem;
}
.btn-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
}
.btn-icon.sm {
    width: 1.75rem;
    height: 1.75rem;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge-prospect {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}
.badge-contacted {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}
.badge-negotiating {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #c2410c;
}
.badge-approved {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0369a1;
}
.badge-vendor {
    background: #faf5ff;
    border-color: #e9d5ff;
    color: #7c3aed;
}
.badge-do-not-contact {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}
.badge-default {
    background: var(--muted);
    border-color: var(--border);
    color: var(--muted-foreground);
}
/* shipment status */
.badge-draft {
    background: var(--muted);
    border-color: var(--border);
    color: var(--muted-foreground);
}
.badge-in-production {
    background: #fef9c3;
    border-color: #fde68a;
    color: #92400e;
}
.badge-in-transit {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}
.badge-delayed {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}
.badge-arrived {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}
.badge-completed {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}
.badge-sent {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0369a1;
}
.badge-confirmed {
    background: #faf5ff;
    border-color: #e9d5ff;
    color: #6d28d9;
}
.badge-shipped {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
}
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
table.data-table th {
    color: var(--muted-foreground);
    font-weight: 500;
    text-align: left;
    padding: 0.5rem;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
table.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}
table.data-table th.sortable:hover {
    color: var(--foreground);
}
table.data-table td {
    padding: 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
table.data-table tr:last-child td {
    border-bottom: none;
}
table.data-table tbody tr:hover td {
    background: color-mix(in srgb, var(--muted) 50%, transparent);
}
.company-initials {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--muted-foreground);
    flex-shrink: 0;
}

/* ── Trend indicators ───────────────────────────────────────── */
.trend {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    font-weight: 500;
}
.trend.up {
    color: #16a34a;
}
.trend.down {
    color: #dc2626;
}
.trend.flat {
    color: var(--muted-foreground);
}
.trend svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* ── Loading skeletons ──────────────────────────────────────── */
.skel {
    background: var(--muted);
    border-radius: 0.25rem;
    display: inline-block;
    position: relative;
    overflow: hidden;
}
.skel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--foreground) 4%, transparent),
        transparent
    );
    animation: skel-shimmer 1.4s ease-in-out infinite;
}
@keyframes skel-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}
.skel-text {
    height: 0.75rem;
    width: 6rem;
}
.skel-text-sm {
    height: 0.625rem;
    width: 4rem;
}
.skel-text-lg {
    height: 0.875rem;
    width: 10rem;
}
.skel-circle {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
}
.skel-card {
    height: 3.5rem;
    width: 100%;
    border-radius: var(--radius);
}
.skel-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}
.skel-table-row {
    display: flex;
    gap: 1rem;
    padding: 0.625rem 0.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.skel-table-row .skel {
    flex-shrink: 0;
}

/* Loading overlay for cards/sections */
.loading-overlay {
    position: relative;
}
.loading-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 5;
    background: color-mix(in srgb, var(--background) 60%, transparent);
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.loading-overlay.is-loading::before {
    opacity: 1;
    pointer-events: auto;
}

/* Fade-in for content replacing skeletons */
.fade-in {
    animation: fade-in 0.25s ease;
}
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.tab-list {
    display: flex;
    gap: 0.125rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.tab-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    transition: color 0.15s;
}
.tab-trigger:hover {
    color: var(--foreground);
}
.tab-trigger.active {
    color: var(--foreground);
    border-bottom-color: var(--primary);
}
.tab-trigger svg {
    width: 0.875rem;
    height: 0.875rem;
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* ── Filters bar ────────────────────────────────────────────── */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.filter-input {
    border: 1px solid var(--input);
    background: var(--background);
    height: 2rem;
    padding: 0 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: var(--foreground);
    outline: none;
}
.filter-input:focus {
    border-color: var(--ring);
}
.filter-select {
    border: 1px solid var(--input);
    background: var(--background);
    height: 2rem;
    padding: 0 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: var(--foreground);
    outline: none;
    cursor: pointer;
}
.filter-select:focus {
    border-color: var(--ring);
}

/* ── Modals ─────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 36rem;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-lg {
    max-width: 52rem;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.modal-title {
    font-size: 1rem;
    font-weight: 600;
}
.modal-body {
    padding: 1.5rem;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1rem;
}
.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}
.form-control {
    width: 100%;
    border: 1px solid var(--input);
    background: var(--background);
    height: 2.25rem;
    padding: 0 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
    transition: border-color 0.15s;
}
.form-control:focus {
    border-color: var(--ring);
}
textarea.form-control {
    height: auto;
    padding: 0.5rem 0.75rem;
    resize: vertical;
    min-height: 5rem;
}
select.form-control {
    cursor: pointer;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    background: var(--foreground);
    color: var(--background);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    max-width: 20rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: all;
    animation: slideUp 0.2s ease;
}
.toast.success {
    background: #166534;
}
.toast.error {
    background: #b91c1c;
}
.toast-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.9;
    margin-left: 0.25rem;
    white-space: nowrap;
    cursor: pointer;
    pointer-events: all;
}
.toast-link:hover {
    opacity: 1;
    text-decoration-thickness: 2px;
}
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(0.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.page-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--foreground);
}
.page-btn:hover {
    background: var(--accent);
}
.page-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}
.page-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ── Charts ─────────────────────────────────────────────────── */
.chart-container {
    position: relative;
    width: 100%;
}

/* ── Sparkline ──────────────────────────────────────────────── */
.sparkline {
    display: inline-block;
}

/* ── Pin / watch icons ──────────────────────────────────────── */
.pinned-icon {
    color: #d97706;
}
.watch-icon {
    color: var(--chart-1);
}

/* ── Dropdown ───────────────────────────────────────────────── */
.dropdown {
    position: relative;
}
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    min-width: 10rem;
    z-index: 60;
    overflow: hidden;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--foreground);
}
.dropdown-item:hover {
    background: var(--accent);
}
.dropdown-item.danger {
    color: #b91c1c;
}
.dropdown-item.danger:hover {
    background: #fef2f2;
}
.dropdown-sep {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

/* ── Chat ────────────────────────────────────────────────────── */
.chat-layout {
    display: grid;
    grid-template-columns: 1fr 24rem;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}
.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    min-height: 0;
}
.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 85%;
}
.chat-msg.user {
    align-self: flex-end;
    align-items: flex-end;
}
.chat-msg.assistant {
    align-self: flex-start;
    align-items: flex-start;
}
.chat-bubble {
    padding: 0.625rem 0.875rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.6;
}
.chat-msg.user .chat-bubble {
    background: var(--primary);
    color: var(--primary-foreground);
}
.chat-msg.assistant .chat-bubble {
    background: var(--muted);
    color: var(--foreground);
}
.chat-input-row {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}
.chat-input {
    width: 100%;
    border: 1px solid var(--input);
    background: var(--background);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    outline: none;
    resize: none;
    min-height: 4.5rem;
    max-height: 16rem;
    font-family: inherit;
}
.chat-input:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 12%, transparent);
}
.chat-sidebar {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.artifact-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
}
.artifact-header {
    padding: 0.625rem 0.875rem;
    background: var(--muted);
    font-size: 0.8125rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
/* ── Chat composer actions row ───── */
.chat-composer-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
/* Dataset selector */
.chat-ds-wrap {
    position: relative;
    flex-shrink: 0;
}
.chat-ds-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.55rem;
    border-radius: 9999px;
    border: 1.5px solid var(--border);
    background: var(--background);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--foreground);
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s;
    white-space: nowrap;
    line-height: 1;
}
.chat-ds-btn:hover {
    border-color: var(--ring);
    background: var(--accent);
}
.chat-ds-btn.open {
    border-color: var(--ring);
    background: var(--accent);
}
.chat-ds-flag {
    font-size: 0.95rem;
    line-height: 1;
    flex-shrink: 0;
}
.chat-ds-name {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}
.chat-ds-panel {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 14rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    z-index: 60;
    overflow: hidden;
}
html[data-theme="dark"] .chat-ds-panel {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.chat-ds-hdr {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted-foreground);
    padding: 0.55rem 0.75rem 0.3rem;
    border-bottom: 1px solid var(--border);
}
.chat-ds-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    font-size: 0.8125rem;
    color: var(--foreground);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
    gap: 0.5rem;
}
.chat-ds-opt:hover {
    background: var(--accent);
}
.chat-ds-opt.active {
    color: var(--primary);
    font-weight: 600;
}
.chat-ds-check {
    opacity: 0;
    color: var(--primary);
    flex-shrink: 0;
}
.chat-ds-opt.active .chat-ds-check {
    opacity: 1;
}
/* Report / Track toggle */
.chat-mode-toggle {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: 9999px;
    overflow: hidden;
    background: var(--background);
    flex-shrink: 0;
}
.chat-mode-btn {
    padding: 0.28rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    transition:
        background 0.15s,
        color 0.15s;
    line-height: 1;
    white-space: nowrap;
}
.chat-mode-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
}
.chat-mode-btn:not(.active):hover {
    background: var(--accent);
    color: var(--foreground);
}
/* Chat markdown tables */
.chat-table-wrap {
    overflow-x: auto;
    margin: 0.5rem 0;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}
.chat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.chat-table th {
    background: var(--muted);
    color: var(--muted-foreground);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.chat-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
    vertical-align: top;
}
.chat-table tbody tr:last-child td {
    border-bottom: none;
}
.chat-table tbody tr:hover td {
    background: color-mix(in srgb, var(--muted) 50%, transparent);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
    }
    .chat-layout {
        grid-template-columns: 1fr;
    }
    .chat-sidebar {
        display: none;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Heatmap tile ───────────────────────────────────────────── */
.heatmap-cell {
    rx: 2px;
    ry: 2px;
    cursor: pointer;
    transition: opacity 0.1s;
}
.heatmap-cell:hover {
    opacity: 0.75;
}
.heatmap-tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--foreground);
    color: var(--background);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    z-index: 10;
    transform: translate(-50%, -110%);
}

/* ── Supplier-grouped table ─────────────────────────────────── */
tr.supplier-row {
    cursor: pointer;
    background: color-mix(in srgb, var(--muted) 30%, transparent);
}
tr.supplier-row:hover td {
    background: color-mix(in srgb, var(--muted) 60%, transparent);
}
tr.supplier-row td:first-child {
    font-weight: 600;
}
tr.child-row td {
    background: color-mix(in srgb, var(--background) 80%, transparent);
    padding-left: 1.5rem;
    font-size: 0.8rem;
}
tr.child-row.hidden {
    display: none;
}
tr.child-row:last-child td {
    border-bottom: 2px solid var(--border);
}

/* ── Shipment Focus — centered modal ─────────────────────────── */
.focus-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.15s ease;
}
.focus-panel {
    width: min(1120px, 96vw);
    max-height: 88vh;
    background: var(--card);
    display: flex;
    flex-direction: column;
    border-radius: 0.875rem;
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.08),
        0 24px 64px rgba(0, 0, 0, 0.22),
        0 0 0 1px rgba(0, 0, 0, 0.06);
    animation: scaleIn 0.18s ease;
    overflow: hidden;
}
.focus-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.focus-panel-body {
    flex: 1;
    overflow: hidden;
    min-height: 0;
    display: grid;
    grid-template-columns: 210px 1fr 325px;
}
.focus-route-col {
    border-right: 1px solid var(--border);
    padding: 1rem 1rem 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    background: var(--sidebar);
    overflow-y: auto;
}
.focus-doc-col {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    overflow-y: auto;
}
.focus-intel-col {
    padding: 1.05rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    background: color-mix(
        in srgb,
        var(--sidebar-accent-foreground) 5%,
        var(--card)
    );
    border-radius: 0.75rem;
    box-shadow:
        -6px 0 28px rgba(0, 0, 0, 0.09),
        0 4px 16px rgba(0, 0, 0, 0.07);
    position: relative;
    z-index: 2;
    border-left: 1px solid var(--border);
    margin: 10px;
}
.route-step {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    position: relative;
}
.route-step:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 0.5rem;
    top: 1.25rem;
    width: 2px;
    height: calc(100% + 0.5rem);
    background: var(--border);
}
.route-dot {
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 9999px;
    border: 2px solid var(--primary);
    background: var(--background);
    flex-shrink: 0;
    margin-top: 0.1rem;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.route-dot.filled {
    background: var(--primary);
}
.invoice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
}
.invoice-field label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    display: block;
    margin-bottom: 0.1rem;
}
.invoice-field span {
    font-size: 0.875rem;
    font-weight: 500;
}
.ifield-editable label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.ifield-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--muted-foreground);
    opacity: 0;
    transition: opacity 0.12s;
    border-radius: 2px;
    padding: 0;
}
.ifield-editable:hover .ifield-edit-btn {
    opacity: 1;
}
.ifield-edit-btn:hover {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.ifield-undo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--muted-foreground);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.05rem 0.35rem;
    cursor: pointer;
    margin-left: 0.375rem;
    vertical-align: middle;
    transition:
        color 0.12s,
        border-color 0.12s;
}
.ifield-undo-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}
.focus-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ── Intelligence panel cards ────────────────────────────────── */
.intel-label {
    margin-bottom: 0.4rem;
    flex-shrink: 0;
}
.intel-card {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.intel-card-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
}
.intel-discover-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--foreground);
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    padding: 0.3rem 0.65rem;
    pointer-events: none;
    user-select: none;
}
.intel-discover-badge svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}
.intel-discover-badge .disc-dot {
    width: 6px;
    height: 6px;
    background: #dc2626;
    border-radius: 50%;
    display: inline-block;
    animation: live-pulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
}
.intel-card-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.2;
}
.intel-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
    transition: border-bottom-style 0.1s;
}
.intel-link:hover {
    border-bottom-style: solid;
}
/* Proportional position bar */
.position-bar {
    display: flex;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    gap: 1px;
}
.position-bar-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
    color: #fff;
    transition: opacity 0.15s;
    min-width: 2px;
    overflow: hidden;
    white-space: nowrap;
    padding: 0 2px;
}
.position-bar-seg:hover {
    opacity: 0.85;
}
.position-bar-seg.you {
    background: var(--primary);
}
.position-bar-seg.other {
    background: var(--muted-foreground);
    opacity: 0.5;
}
.position-bar-seg.other2 {
    background: #6366f1;
    opacity: 0.6;
}
.position-bar-seg.other3 {
    background: #0891b2;
    opacity: 0.6;
}
.position-bar-seg.rest {
    background: var(--border);
    opacity: 0.8;
}
.intel-stat {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}
.intel-stat strong {
    color: var(--primary);
    font-weight: 700;
}
/* Skeleton loader */
.intel-skeleton {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        var(--muted) 25%,
        var(--border) 50%,
        var(--muted) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    margin-bottom: 0.375rem;
}
@keyframes shimmer {
    from {
        background-position: 200% 0;
    }
    to {
        background-position: -200% 0;
    }
}
/* Explore chips */
.explore-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid var(--primary);
    color: var(--primary);
    background: var(--accent);
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.12s,
        color 0.12s;
    white-space: nowrap;
}
.explore-chip:hover {
    background: var(--primary);
    color: var(--primary-foreground);
}
.explore-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

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

/* Sankey panel kept for backward compat but hidden */
.sankey-panel {
    border-top: 1px solid var(--border);
    padding-top: 0.875rem;
    margin-top: 0.5rem;
    animation: fadeIn 0.2s ease;
}
.sankey-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.625rem;
}
.sankey-panel-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
}
.sankey-stat {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.375rem;
    font-style: italic;
}
.sankey-stat strong {
    color: var(--primary);
}

/* ── Vault page — fills viewport below topbar ────────────────── */
/* Cap the root shell so vault fills exactly the viewport */
.main-content:has(.vault-page) {
    height: 100vh;
    overflow: hidden;
}
/* Strip padding from main.page when vault-page is a direct child */
.page:has(> .vault-page) {
    padding: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.vault-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem;
    gap: 0.75rem;
}
.vault-page > .card.vault-split-card {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
/* Pagination bar inside the split card */
.vault-pager {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

/* ── Split-pane pattern (reusable) ──────────────────────────── */
.split-pane {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.split-pane-nav {
    width: 13rem;
    flex-shrink: 0;
    overflow-y: scroll;
    border-right: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: #c0c0c8 #f0f0f0;
}
.split-pane-nav::-webkit-scrollbar {
    width: 5px;
}
.split-pane-nav::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 99px;
}
.split-pane-nav::-webkit-scrollbar-thumb {
    background: #c0c0c8;
    border-radius: 99px;
}
.split-pane-nav::-webkit-scrollbar-thumb:hover {
    background: #71717a;
}
.split-pane-content {
    flex: 1;
    overflow: hidden;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Supplier rail items ─────────────────────────────────────── */
.sup-rail-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
    transition: background 0.1s;
}
.sup-rail-item:hover {
    background: var(--accent);
}
.sup-rail-item.active {
    background: var(--sidebar-accent);
    border-left: 2px solid var(--primary);
    padding-left: calc(0.75rem - 2px);
}
.sup-rail-name {
    font-weight: 600;
    font-size: 0.8125rem;
    line-height: 1.3;
}
.sup-rail-meta {
    font-size: 0.7rem;
    color: var(--muted-foreground);
    margin-top: 0.1rem;
}
/* Clickable text cells — only the text element is interactive */
.vault-cell-link {
    cursor: pointer;
    transition:
        color 0.15s,
        opacity 0.15s;
}
.vault-cell-link:hover {
    color: var(--primary);
    opacity: 0.85;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Column-level filter bar — matches rail search bar height/feel */
.col-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    margin-top: 0.35rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    padding: 0.25rem 0.4rem;
}
.col-filter-bar input {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 400;
    border: none;
    background: transparent;
    color: var(--foreground);
    outline: none;
}
.col-filter-bar:focus-within {
    border-color: var(--primary);
    background: var(--background);
}
.col-filter-clear {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.1rem 0.25rem;
    border-radius: 0.2rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    line-height: 1;
}
.col-filter-clear:hover {
    background: var(--accent);
    color: var(--foreground);
}
/* Sticky thead */
#vault-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--card);
}
/* Always-visible minimal scrollbars — rail and table pane */
#sup-rail-items,
.split-pane-content > div {
    scrollbar-width: thin;
    scrollbar-color: #c0c0c8 #f0f0f0;
    overflow-y: scroll;
}
#sup-rail-items::-webkit-scrollbar,
.split-pane-content > div::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
#sup-rail-items::-webkit-scrollbar-track,
.split-pane-content > div::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 99px;
}
#sup-rail-items::-webkit-scrollbar-thumb,
.split-pane-content > div::-webkit-scrollbar-thumb {
    background: #c0c0c8;
    border-radius: 99px;
}
#sup-rail-items::-webkit-scrollbar-thumb:hover,
.split-pane-content > div::-webkit-scrollbar-thumb:hover {
    background: #71717a;
}

/* Supplier rail search bar (sticky header inside the nav pane) */
.sup-rail-search-bar {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--background);
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.sup-rail-search-bar input {
    flex: 1;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    padding: 0.25rem 0.4rem;
    background: var(--muted);
    color: var(--foreground);
    outline: none;
    min-width: 0;
}
.sup-rail-search-bar input:focus {
    border-color: var(--primary);
    background: var(--background);
}
.sup-rail-clear-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 0.25rem;
    color: var(--muted-foreground);
    font-size: 1rem;
    line-height: 1;
}
.sup-rail-clear-btn:hover {
    background: var(--accent);
    color: var(--foreground);
}

/* ── Flat supplier table (legacy, kept for other uses) ───────── */
.same-supplier-cell {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    opacity: 0.6;
}
tr.supplier-first-row td {
    border-top: 2px solid color-mix(in srgb, var(--border) 80%, transparent);
    padding-top: 0.625rem;
}

/* ── Sankey panel ────────────────────────────────────────────── */
.sankey-panel {
    border-top: 1px solid var(--border);
    padding-top: 0.875rem;
    margin-top: 0.5rem;
    animation: fadeIn 0.2s ease;
}
.sankey-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.625rem;
}
.sankey-panel-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
}
.sankey-stat {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.375rem;
    font-style: italic;
}
.sankey-stat strong {
    color: var(--primary);
}

/* ── Monthly heatmap strip ───────────────────────────────────── */
.month-cell {
    cursor: default;
}
.month-cell:hover {
    opacity: 0.75;
}
.month-label {
    font-size: 9px;
    fill: var(--muted-foreground);
    text-anchor: middle;
}

/* ── Discover Profile View ───────────────────────────────────── */
.profile-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0;
    border: none;
    background: none;
    transition: color 0.15s;
    margin-bottom: 1rem;
}
.profile-back:hover {
    color: var(--foreground);
}
.profile-stats-bar {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.875rem 1.25rem;
    background: var(--card);
    border-radius: 0.625rem;
    border: 1px solid var(--border);
}
.profile-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.profile-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
}
.profile-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--foreground);
}
.profile-stat-value.accent {
    color: var(--primary);
}
.profile-network {
    display: grid;
    grid-template-columns: 1fr 180px 1fr;
    gap: 0;
    align-items: start;
}
.profile-node-col {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0 1rem;
}
.profile-col-label {
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted-foreground);
    margin-bottom: 0.35rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.profile-center-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 1.25rem 0.875rem 1rem;
    background: color-mix(in srgb, var(--primary) 8%, var(--card));
    border: 2px solid color-mix(in srgb, var(--primary) 28%, transparent);
    border-radius: 0.75rem;
    text-align: center;
}
.profile-center-type {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--primary);
}
.profile-center-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.3;
    word-break: break-word;
}
.profile-center-total {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-top: 0.375rem;
}
.profile-center-sub {
    font-size: 0.7rem;
    color: var(--muted-foreground);
}
.profile-arrows {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    font-size: 1rem;
    padding: 0 0.5rem;
}
.profile-node-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    padding: 0.55rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    transition:
        border-color 0.12s,
        box-shadow 0.12s;
}
.profile-node-card:hover {
    border-color: color-mix(in srgb, var(--primary) 50%, transparent);
}
.profile-node-card.is-user {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, var(--card));
}
.profile-node-name {
    font-size: 0.785rem;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.3;
    word-break: break-word;
}
.profile-node-meta {
    font-size: 0.71rem;
    color: var(--muted-foreground);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.profile-node-bar-wrap {
    height: 3px;
    background: var(--muted);
    border-radius: 99px;
    overflow: hidden;
}
.profile-node-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    opacity: 0.5;
    transition: width 0.3s ease;
}
.profile-node-bar.is-user {
    opacity: 1;
}
.profile-you-badge {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    padding: 0.1rem 0.35rem;
    border-radius: 99px;
    flex-shrink: 0;
}
.profile-network-wrap {
    padding: 0.5rem 0;
}
.profile-network-grid {
    display: grid;
    grid-template-columns: 1fr 24px 180px 24px 1fr;
    gap: 0;
    align-items: center;
}
.profile-arrow-col {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--muted-foreground);
}
.sup-name-link {
    cursor: pointer;
    color: var(--foreground);
    font-weight: 600;
    font-size: 0.875rem;
    transition: color 0.12s;
}
.sup-name-link:hover {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Discover Column Navigator ───────────────────────────────── */
/* Constrain disc page to viewport (same pattern as vault-page) */
.main-content:has(.disc-nav-shell) {
    height: 100vh;
    overflow: hidden;
}
.page:has(> .disc-page-wrap) {
    padding: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Explore page — globe fills full content area */
.page:has(> .explore-wrap) {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.main-content:has(.explore-wrap) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
}
.main-content:has(.explore-wrap) .page {
    flex: 1;
    min-height: 0;
}
.disc-page-wrap {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.disc-page-wrap .page-header {
    margin-bottom: 0;
    padding: 0.75rem 1rem 0;
}

.disc-nav-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 1rem 1rem;
    gap: 0;
    min-height: 0;
}
.disc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.disc-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    flex-wrap: wrap;
    flex-shrink: 0;
    padding: 0.5rem 0.75rem;
    min-height: 0;
}
.disc-breadcrumb:empty {
    display: none;
}
.disc-breadcrumb:not(:empty) {
    border-bottom: 1px solid var(--border);
}
.disc-crumb {
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.12s;
}
.disc-crumb:hover {
    opacity: 0.75;
}
.disc-crumb-sep {
    color: var(--muted-foreground);
    padding: 0 0.15rem;
}
.disc-crumb.current {
    color: var(--foreground);
    font-weight: 600;
    cursor: default;
}
.disc-columns-wrap {
    flex: 1;
    overflow: hidden;
    min-height: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    display: flex;
    flex-direction: column;
    margin-top: 0.625rem;
}
.disc-columns {
    display: flex;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #c0c0c8 #f0f0f0;
}
.dark .disc-columns {
    scrollbar-color: #52525b #27272a;
}
.disc-col {
    width: 260px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    overflow-y: scroll;
    display: flex;
    flex-direction: column;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: #c0c0c8 #f0f0f0;
}
.dark .disc-col {
    scrollbar-color: #52525b #27272a;
}
.disc-col:last-child {
    border-right: none;
}
.disc-col-head {
    padding: 0.625rem 0.75rem 0.5rem;
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted-foreground);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 1;
}
.disc-col-section-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
    padding: 0.6rem 0.75rem 0.25rem;
    opacity: 0.7;
}
.disc-col-body {
    padding: 0.375rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}
.disc-col-loading {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted-foreground);
    font-size: 0.8rem;
}
.disc-node-card {
    padding: 0.45rem 0.55rem;
    border-radius: 0.375rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition:
        border-color 0.1s,
        background 0.1s;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.disc-node-card:hover {
    background: var(--accent);
}
.disc-node-card.active {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, var(--card));
}
.disc-node-card.is-user {
    border-color: var(--primary);
}
.disc-node-name {
    font-size: 0.785rem;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.3;
    word-break: break-word;
}
.disc-node-meta {
    font-size: 0.7rem;
    color: var(--muted-foreground);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.disc-node-bar-wrap {
    height: 3px;
    background: var(--muted);
    border-radius: 99px;
    overflow: hidden;
}
.disc-node-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    opacity: 0.45;
}
.disc-node-bar.is-user {
    opacity: 1;
}
.disc-you-badge {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    padding: 0.1rem 0.3rem;
    border-radius: 99px;
    flex-shrink: 0;
}
.disc-star-badge {
    font-size: 0.6rem;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
    border-radius: 99px;
    padding: 0.05rem 0.35rem;
    flex-shrink: 0;
}
.disc-hs-desc {
    font-size: 0.67rem;
    color: var(--muted-foreground);
    margin-top: 0.15rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.disc-terminal-badge {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    background: var(--muted);
    border-radius: 99px;
    padding: 0.1rem 0.45rem;
}
.disc-info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.35rem;
    background: var(--muted);
    margin-bottom: 0.3rem;
}
.disc-hs-pill {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: monospace;
    padding: 0.15rem 0.4rem;
    border-radius: 0.3rem;
    letter-spacing: 0.02em;
}
.disc-search-toggle {
    font-size: 0.775rem;
    color: var(--muted-foreground);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.3rem 0.65rem;
    background: var(--secondary);
    transition: color 0.12s;
}
.disc-search-toggle:hover {
    color: var(--foreground);
}
.disc-empty {
    padding: 1.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--muted-foreground);
    text-align: center;
}

/* ── Utility overrides ──────────────────────────────────────── */
.text-muted {
    color: var(--muted-foreground);
}
.text-sm {
    font-size: 0.875rem;
}
.text-xs {
    font-size: 0.75rem;
}
.font-semibold {
    font-weight: 600;
}
.font-bold {
    font-weight: 700;
}
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.flex {
    display: flex;
}
.items-center {
    align-items: center;
}
.gap-2 {
    gap: 0.5rem;
}
.gap-1 {
    gap: 0.25rem;
}
.mt-1 {
    margin-top: 0.25rem;
}
.mt-2 {
    margin-top: 0.5rem;
}
.mt-4 {
    margin-top: 1rem;
}
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}
@media (max-width: 1280px) {
    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 1024px) {
    .grid-5,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .grid-5,
    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }
}
.grid-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}
@media (max-width: 1400px) {
    .grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 1024px) {
    .grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .grid-6 {
        grid-template-columns: 1fr;
    }
}
.w-full {
    width: 100%;
}
.hidden {
    display: none !important;
}

/* ── Bug Report Modal ───────────────────────────────────────── */
.bug-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    line-height: 21px;
    background: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
}
.bug-modal-overlay.open {
    display: flex;
}
.bug-modal {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    width: min(480px, calc(100vw - 2rem));
    padding: 1.25rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.bug-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    user-select: none;
}
.bug-modal-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--foreground);
}
.bug-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition:
        color 0.1s,
        background 0.1s;
}
.bug-modal-close:hover {
    color: var(--foreground);
    background: var(--accent);
}
.bug-modal-desc {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    line-height: 1.5;
    margin: 0;
}
.bug-modal-textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 100px;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--foreground);
    font-family: inherit;
    font-size: 0.8125rem;
    line-height: 1.5;
    padding: 0.5rem 0.625rem;
    outline: none;
    transition: border-color 0.15s;
}
.bug-modal-textarea:focus {
    border-color: var(--primary);
}
.bug-modal-textarea::placeholder {
    color: var(--muted-foreground);
}
.bug-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
.bug-modal-cancel {
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--muted-foreground);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.4rem 0.875rem;
    transition:
        background 0.1s,
        color 0.1s;
}
.bug-modal-cancel:hover {
    background: var(--accent);
    color: var(--foreground);
}
.bug-modal-submit {
    background: var(--primary);
    border: none;
    border-radius: 0.375rem;
    color: #fff;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.428rem 0.875rem;
    transition: opacity 0.15s;
}
.bug-modal-submit:hover:not(:disabled) {
    opacity: 0.88;
}
.bug-modal-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Loading skeletons ──────────────────────────────────────── */
.skel {
    background: var(--muted);
    border-radius: 0.25rem;
    display: inline-block;
    position: relative;
    overflow: hidden;
}
.skel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--foreground) 4%, transparent),
        transparent
    );
    animation: skel-shimmer 1.4s ease-in-out infinite;
}
@keyframes skel-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}
.skel-text {
    height: 0.75rem;
    width: 6rem;
}
.skel-text-sm {
    height: 0.625rem;
    width: 4rem;
}
.skel-text-lg {
    height: 0.875rem;
    width: 10rem;
}
.skel-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}
.skel-table-row {
    display: flex;
    gap: 1rem;
    padding: 0.625rem 0.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.fade-in {
    animation: fade-in 0.25s ease;
}
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
