/* UI polish pass: visual refresh only, no behavior changes */

/* Import Material Symbols font (backup) */
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

/* ==========================================================================
   THEME SYSTEM — two modes: dark (default) / light, toggled via
   body[data-theme="dark"|"light"] (set by the sidebar palette popover,
   see pick_chat_theme clientside callback in app_dash.py). Every color that
   needs to differ between modes lives in a custom property here. Derived
   vars (anything defined as `var(--other-var)`) MUST be redeclared with a
   literal value inside the [data-theme="light"] block too — a var only
   referenced once at :root resolves using :root's cascade, not the
   overriding element's, and does NOT follow a later override on `body`
   (bit us building this — see CSS custom-property gotcha, confirmed by
   testing: custom properties are inherited as already-resolved computed
   values, so an unredeclared var freezes at its :root resolution).

   Card/panel surfaces are intentionally a distinct step lighter (dark mode)
   or a crisp white with a hairline border (light mode) from the page
   backdrop — previously panels used almost the same navy as the page
   background, so nothing but accents/borders looked "themed". */
:root {
    /* Page backdrop (body gradient + the opaque #react-entry-point > div fill
       in sidebar_style.css that sits on top of it, see --bg-main note there) */
    --page-bg-1: #060a10;
    --page-bg-2: #080e17;
    --page-bg-3: #05080d;
    --bg-main: #080e17;
    --sidebar-bg-1: #070b12;
    --sidebar-bg-2: #0a0f19;

    /* Card/panel surface — deliberately lighter than the page backdrop above
       so cards read as an elevated layer, not a blend into the background. */
    --surface-1-rgb: 26, 32, 44;
    --surface-2-rgb: 20, 25, 35;
    --surface-border: rgba(255, 255, 255, 0.07);
    --insight-rgb-1: 10, 44, 46;
    --insight-rgb-2: 13, 36, 46;

    --bg-panel: rgba(var(--surface-1-rgb), 0.92);
    --bg-panel-strong: rgba(var(--surface-1-rgb), 0.97);
    --line-soft: rgba(120, 220, 255, 0.14);
    --line-strong: rgba(120, 220, 255, 0.24);

    /* Text tiers — every `color: #hex` literal in this file was bucketed by
       luminance into one of these three (see CLAUDE.md theme switcher notes) */
    --text-primary: #eaf7ff;
    --text-secondary: #9fb9ca;
    --text-muted: #7692a6;

    /* Site-wide accent (cool) + primary (brand green) */
    --site-accent-rgb: 89, 216, 255;
    --site-accent: #59d8ff;
    --site-primary-rgb: 29, 226, 164;
    --site-primary: #1de2a4;
    --primary: var(--site-primary);
    --secondary: var(--site-accent);

    /* Status colors (critical/warning/success) — used for badges, bottleneck
       severities, progress fills. Same hue family across modes, just tuned
       per mode for contrast against the surface color. */
    --status-critical: #ff4757;
    --status-warning: #ffb800;
    --status-success: #00ff85;

    /* Chat widget (mirrors site accent/primary in dark mode) */
    --chat-accent-rgb: 89, 216, 255;
    --chat-user-rgb: 30, 199, 134;
    --chat-user-rgb2: 24, 186, 124;
    --chat-send-grad1: #1fc786;
    --chat-send-grad2: #18ba7c;
    --chat-fab-grad1: #18ba7c;
    --chat-fab-grad2: #59d8ff;
    --chat-fab-shadow-rgb: 17, 156, 158;

    /* Plotly chart chrome (read by app_dash.py via a clientside-set CSS var
       is not possible for server-rendered SVG, so chart callbacks read the
       theme-store value directly — these vars exist for CSS-only chart
       wrapper elements, e.g. legend text rendered outside the SVG) */
    --chart-text: #e0e0e0;
    --chart-grid: rgba(255, 255, 255, 0.1);

    /* Shadow tiers — dark mode can carry heavy black shadows since they read
       as depth against a near-black page; the same shadow on a light page
       just looks like a harsh smudge, so light mode gets much softer,
       neutral-tinted versions (see [data-theme="light"] below). */
    --shadow-color: rgba(0, 0, 0, 0.28);
    --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 16px 34px rgba(0, 0, 0, 0.36);
    --shadow-lg: 0 20px 45px rgba(0, 0, 0, 0.45);

    /* --bg-card/--bg-card-hover/--border-color are also declared (fixed,
       theme-independent) in sidebar_style.css's own :root block, used by
       inline styles in the legacy Progress-tab card renderer
       (create_progress_card in app_dash.py, style={"backgroundColor":
       "var(--bg-card)", ...}) — that :root block is never touched by the
       light/dark toggle, so those cards stayed dark navy no matter what
       mode was picked. Redeclaring here (this file loads after
       sidebar_style.css, and gets overridden per-mode below) fixes it. */
    --bg-card: rgba(20, 28, 35, 0.7);
    --bg-card-hover: rgba(25, 33, 40, 0.9);
    --border-color: rgba(var(--site-primary-rgb), 0.08);
}

body[data-theme="light"] {
    --page-bg-1: #eef1f6;
    --page-bg-2: #e6eaf0;
    --page-bg-3: #f4f6f9;
    --bg-main: #eef1f6;
    --sidebar-bg-1: #ffffff;
    --sidebar-bg-2: #f3f5f9;

    --surface-1-rgb: 255, 255, 255;
    --surface-2-rgb: 247, 249, 251;
    --surface-border: rgba(15, 23, 42, 0.08);
    --insight-rgb-1: 224, 247, 241;
    --insight-rgb-2: 214, 242, 235;

    --bg-panel: rgba(var(--surface-1-rgb), 0.96);
    --bg-panel-strong: rgba(var(--surface-1-rgb), 1);
    --line-soft: rgba(2, 132, 199, 0.14);
    --line-strong: rgba(2, 132, 199, 0.26);

    --text-primary: #16202e;
    --text-secondary: #51606f;
    --text-muted: #7d8a97;

    --site-accent-rgb: 2, 132, 199;
    --site-accent: #0284c7;
    --site-primary-rgb: 5, 150, 105;
    --site-primary: #059669;
    --primary: var(--site-primary);
    --secondary: var(--site-accent);

    --status-critical: #dc2626;
    --status-warning: #d97706;
    --status-success: #16a34a;

    --chat-accent-rgb: 2, 132, 199;
    --chat-user-rgb: 5, 150, 105;
    --chat-user-rgb2: 4, 120, 87;
    --chat-send-grad1: #059669;
    --chat-send-grad2: #047857;
    --chat-fab-grad1: #0284c7;
    --chat-fab-grad2: #059669;
    --chat-fab-shadow-rgb: 2, 132, 199;

    --chart-text: #33404d;
    --chart-grid: rgba(15, 23, 42, 0.08);

    --shadow-color: rgba(15, 23, 42, 0.1);
    --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 16px 32px rgba(15, 23, 42, 0.12);

    --bg-card: #ffffff;
    --bg-card-hover: #f7f9fb;
    --border-color: rgba(15, 23, 42, 0.1);
}

body {
    background:
        radial-gradient(900px 550px at -10% -20%, rgba(var(--site-accent-rgb), 0.12), transparent 65%),
        radial-gradient(800px 500px at 110% -10%, rgba(var(--site-primary-rgb), 0.1), transparent 70%),
        linear-gradient(160deg, var(--page-bg-1) 0%, var(--page-bg-2) 46%, var(--page-bg-3) 100%) !important;
    color: var(--text-primary) !important;
}

/* Light mode is meant to read as a flat, neutral dashboard surface (industry
   standard for light UIs — Notion/Linear/GitHub-style), not a dark theme with
   the colors inverted — the ambient accent/primary "glow" blobs above look
   like depth on a near-black page but read as a colored stain on white, so
   light mode gets a plain two-stop gradient instead. */
body[data-theme="light"] {
    background: linear-gradient(160deg, var(--page-bg-1) 0%, var(--page-bg-3) 100%) !important;
    color: var(--text-primary) !important;
}

.app-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(350px 260px at 14% 8%, rgba(24, 205, 255, 0.07), transparent 75%),
        radial-gradient(320px 260px at 88% 14%, rgba(var(--site-primary-rgb), 0.08), transparent 75%);
    z-index: 0;
}

body[data-theme="light"] .app-shell::before {
    background: none;
}

#sidebar,
.sidebar {
    width: 72px !important;
    background: linear-gradient(180deg, var(--sidebar-bg-1) 0%, var(--sidebar-bg-2) 100%) !important;
    backdrop-filter: blur(16px) saturate(130%);
    -webkit-backdrop-filter: blur(16px) saturate(130%);
    border-right: none !important;
    box-shadow: 8px 0 24px var(--shadow-color) !important;
}

#sidebar > div {
    background: transparent !important;
}

/* Kill gray rail caused by old generic rule div[class*="-menu"] */
#sidebar .sidebar-menu {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 100%;
    padding: 0 4px;
    gap: 10px !important;
}

#sidebar::after {
    display: none !important;
}

.sidebar-menu-item {
    width: 46px !important;
    height: 46px !important;
    border: none !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    overflow: hidden;
    border-radius: 12px;
}

/* Hide nav text in collapsed sidebar */
.sidebar .nav-text,
#sidebar .nav-text {
    display: none !important;
}

/* Show nav text when sidebar is expanded */
.sidebar.expanded .nav-text,
#sidebar.expanded .nav-text {
    display: inline !important;
}

.sidebar-menu-item:hover {
    background: rgba(var(--site-accent-rgb), 0.16) !important;
    box-shadow: none !important;
    color: var(--text-primary)!important;
}

.sidebar-menu-item.active {
    background: linear-gradient(145deg, rgba(var(--site-primary-rgb), 0.42), rgba(var(--site-accent-rgb), 0.24)) !important;
    box-shadow: 0 10px 24px rgba(4, 20, 34, 0.36) !important;
    color: var(--text-primary)!important;
}

.main-content {
    margin-left: 72px !important;
    padding: 30px 34px 32px 34px !important;
    position: relative;
    z-index: 1;
}

.main-content.expanded {
    margin-left: 220px !important;
}

.content-hero {
    background: transparent !important;
    border: none !important;
    border-radius: 0;
    padding: 0;
    box-shadow: none !important;
}

.content-title {
    letter-spacing: 0.01em;
    font-weight: 400 !important;
}

.sidebar-logo-icon {
    width: 50px !important;
    height: 50px !important;
    background: rgba(var(--site-accent-rgb), 0.1) !important;
    border: none !important;
    border-radius: 14px !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-company-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
    filter: brightness(1.8) contrast(1.4) saturate(1.25) drop-shadow(0 0 8px rgba(95, 227, 255, 0.45));
}

.sidebar-brand-text,
.nav-text {
    display: none;
    white-space: nowrap;
}

.sidebar-toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none !important;
    background: rgba(var(--site-accent-rgb), 0.1);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 10px;
}

.sidebar-toggle-btn:hover {
    background: rgba(var(--site-accent-rgb), 0.2);
}

#sidebar.expanded {
    width: 208px !important;
}

#sidebar.expanded .sidebar-inner {
    align-items: stretch !important;
    padding: 16px 10px !important;
}

#sidebar.expanded .sidebar-logo-icon {
    width: 100% !important;
    justify-content: center !important;
    padding: 10px 0;
    height: 72px !important;
}

#sidebar.expanded .sidebar-brand-text {
    display: none !important;
}

#sidebar.expanded .sidebar-company-logo {
    width: 48px;
    height: 48px;
}

#sidebar.expanded .sidebar-menu-item {
    width: 100% !important;
    justify-content: flex-start !important;
    padding: 10px 12px;
}

#sidebar.expanded .sidebar-menu-item .nav-text {
    display: inline;
    font-size: 0.85rem;
    font-weight: 520;
    color: var(--text-primary);
}

.sidebar-logout-btn {
    background: rgba(var(--site-accent-rgb), 0.1) !important;
    border: none !important;
    color: var(--text-secondary)!important;
}

#sidebar.expanded .sidebar-logout-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
    gap: 10px;
}

#sidebar.expanded .sidebar-logout-btn .nav-text {
    display: inline;
    font-size: 0.85rem;
    font-weight: 500;
}

.sidebar-logout-btn:hover {
    background: rgba(239, 68, 68, 0.18) !important;
}

.content-subtitle {
    color: var(--text-secondary) !important;
}

.status-badge {
    border-radius: 999px !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.filters-container,
.metric-card,
.chart-container,
.glass-panel,
.recent-logistics-card,
.progress-card-glass {
    background: linear-gradient(160deg, rgba(var(--surface-1-rgb), 0.8), rgba(var(--surface-2-rgb), 0.66)) !important;
    border: 1px solid var(--surface-border) !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Force filter area to same blue-teal theme (override older gray CSS) */
.filters-container {
    background: linear-gradient(160deg, rgba(var(--surface-1-rgb), 0.9), rgba(var(--surface-2-rgb), 0.86)) !important;
    border: 1px solid var(--surface-border) !important;
}

.filters-container .filters-title,
.filters-container .text-muted,
.filters-container small {
    color: var(--text-secondary)!important;
}

.filters-container .btn-reset {
    background: rgba(var(--site-accent-rgb), 0.12) !important;
    border-color: rgba(var(--site-accent-rgb), 0.35) !important;
    color: var(--text-primary)!important;
}

.filters-container .btn-reset:hover {
    background: rgba(var(--site-primary-rgb), 0.22) !important;
    border-color: rgba(var(--site-primary-rgb), 0.55) !important;
    color: var(--text-primary)!important;
}

/* Progress tracker specific theme (fix gray controls) */
.progress-tab .progress-filter-card {
    background: linear-gradient(160deg, rgba(var(--surface-1-rgb), 0.92), rgba(var(--surface-2-rgb), 0.9)) !important;
    border: 1px solid var(--surface-border) !important;
}

.progress-tab .progress-filter-card small,
.progress-tab #progress-status {
    color: var(--text-secondary)!important;
}

.progress-tab #progress-search.form-control,
.progress-tab #progress-search {
    background: rgba(var(--surface-2-rgb), 0.95) !important;
    border: 1px solid rgba(var(--site-accent-rgb), 0.22) !important;
    color: var(--text-primary)!important;
}

.progress-tab #progress-search::placeholder {
    color: var(--text-muted)!important;
}

.progress-tab #btn-refresh-progress.btn,
.progress-tab #btn-refresh-progress {
    background: rgba(var(--site-accent-rgb), 0.12) !important;
    border: 1px solid rgba(var(--site-accent-rgb), 0.35) !important;
    color: var(--text-primary)!important;
    box-shadow: none !important;
}

.progress-tab #btn-refresh-progress:hover {
    background: rgba(var(--site-primary-rgb), 0.22) !important;
    border-color: rgba(var(--site-primary-rgb), 0.55) !important;
    color: var(--text-primary)!important;
}

.progress-tab .progress-action-group {
    display: flex;
    gap: 8px;
    width: 100%;
}

.progress-tab .progress-action-group .progress-action-btn {
    flex: 1 1 0;
    min-width: 0;
    height: 31px;
    border-radius: 8px !important;
    font-size: 0.78rem;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-tab #btn-reset-progress.btn,
.progress-tab #btn-reset-progress {
    background: rgba(var(--site-accent-rgb), 0.12) !important;
    border: 1px solid rgba(var(--site-accent-rgb), 0.35) !important;
    color: var(--text-primary)!important;
}

.progress-tab #btn-reset-progress:hover {
    background: rgba(var(--site-primary-rgb), 0.22) !important;
    border-color: rgba(var(--site-primary-rgb), 0.55) !important;
    color: var(--text-primary)!important;
}

.progress-tab #progress-filter .Select-control,
.progress-tab #progress-type-filter .Select-control,
.progress-tab #progress-cargo-filter .Select-control,
.progress-tab #progress-sort .Select-control,
.progress-tab #progress-filter div[class*="-control"],
.progress-tab #progress-type-filter div[class*="-control"],
.progress-tab #progress-cargo-filter div[class*="-control"],
.progress-tab #progress-sort div[class*="-control"] {
    background: rgba(var(--surface-2-rgb), 0.95) !important;
    border: 1px solid rgba(var(--site-accent-rgb), 0.22) !important;
    color: var(--text-primary)!important;
}

/* Progress cards (summary + rows) force same panel theme, not gray */
.progress-tab #card-complete,
.progress-tab #card-inprogress,
.progress-tab #card-warnings,
.progress-tab #card-critical {
    background: linear-gradient(160deg, rgba(var(--surface-1-rgb), 0.86), rgba(var(--surface-2-rgb), 0.78)) !important;
    border: 1px solid var(--surface-border) !important;
}

.progress-tab #progress-list-container > div {
    background: linear-gradient(160deg, rgba(var(--surface-1-rgb), 0.88), rgba(var(--surface-2-rgb), 0.82)) !important;
    border: 1px solid var(--surface-border) !important;
    border-left: 3px solid rgba(var(--site-accent-rgb), 0.24) !important;
}

.metric-card {
    border-radius: 14px !important;
    min-height: 124px;
}

.metric-card-label,
.kpi-title {
    color: var(--text-secondary) !important;
    letter-spacing: 0.08em;
    font-size: 0.76rem !important;
    font-weight: 500 !important;
}

.metric-card-value,
.kpi-value,
.section-title,
.chart-title,
.card-title,
.vessel-name {
    color: var(--text-primary) !important;
}

.metric-card-value,
.kpi-value {
    font-size: 2rem !important;
    font-weight: 600 !important;
}

.metric-card .kpi-unit,
.kpi-unit {
    font-size: 0.88rem !important;
}

.overview-title {
    font-size: 1.7rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.01em;
}

.subsection-title {
    font-size: 1.08rem !important;
    font-weight: 500 !important;
    color: var(--text-secondary)!important;
}

.chart-subtitle,
.card-subtitle,
.card-message,
.alert-message,
.section-subtitle {
    color: var(--text-secondary) !important;
}

.chart-container {
    border-radius: 16px !important;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chart-container:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong) !important;
    box-shadow: var(--shadow-md) !important;
}

/* Prevent qty card from being stretched by inherited flex rules */
.qty-comparison-card {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
}

.qty-comparison-card .chart-header,
.qty-comparison-card #loading-chart-qty,
.qty-comparison-card #chart-qty-legend {
    display: block !important;
}

.Select-control,
div[class*="-control"] {
    min-height: 42px !important;
    background: rgba(var(--surface-2-rgb), 0.95) !important;
    border: 1px solid rgba(var(--site-accent-rgb), 0.18) !important;
    border-radius: 10px !important;
}

.Select-control:hover,
div[class*="-control"]:hover {
    border-color: rgba(var(--site-accent-rgb), 0.38) !important;
}

.is-focused .Select-control,
div[class*="-control"][class*="is-focused"] {
    box-shadow: 0 0 0 3px rgba(var(--site-accent-rgb), 0.15) !important;
    border-color: rgba(var(--site-accent-rgb), 0.45) !important;
}

/* override old style.css blanket gray dropdown rule */
.dash-dropdown,
.dash-dropdown *,
.Select-control,
.Select-menu-outer,
.Select-menu,
.Select-option,
.Select-value,
.Select-input,
.Select-placeholder,
.Select-noresults {
    background-color: rgba(var(--surface-2-rgb), 0.95) !important;
    color: var(--text-primary)!important;
    border-color: rgba(var(--site-accent-rgb), 0.2) !important;
}

.Select-option:hover,
.Select-option.is-focused,
div[class*="-option"]:hover {
    background-color: rgba(var(--site-accent-rgb), 0.16) !important;
    color: var(--text-primary)!important;
}

.section-title {
    font-size: 1.08rem !important;
    font-weight: 650 !important;
}

#chat-window {
    background: rgba(var(--surface-2-rgb), 0.92) !important;
    border: 1px solid var(--line-soft) !important;
}

/* Chat Theme */
#chat-window {
    background: linear-gradient(180deg, rgba(var(--surface-2-rgb), 0.96), rgba(var(--surface-1-rgb), 0.94)) !important;
    border: none !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}

.chat-header {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(var(--chat-accent-rgb), 0.14);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(var(--chat-accent-rgb), 0.05);
}

.chat-title {
    font-size: 0.95rem;
    font-weight: 620;
    color: var(--text-primary);
}

.chat-expand-btn {
    height: 30px;
    border-radius: 8px;
    border: none;
    background: rgba(var(--chat-accent-rgb), 0.14);
    color: var(--text-primary);
    padding: 0 10px;
    font-size: 0.76rem;
    cursor: pointer;
}

.chat-expand-btn:hover {
    background: rgba(var(--chat-accent-rgb), 0.24);
    color: var(--text-primary);
}

.chat-messages {
    padding: 10px !important;
    background: transparent;
}

.chat-system-msg {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 4px 0 10px 0;
}

.chat-bubble {
    max-width: 84%;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 12px;
    font-size: 0.86rem;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}

.chat-user {
    margin-left: auto;
    text-align: right;
    color: var(--text-primary);
    background: linear-gradient(180deg, rgba(var(--chat-user-rgb), 0.26), rgba(var(--chat-user-rgb2), 0.22));
}

.chat-bot {
    margin-right: auto;
    color: var(--text-primary);
    background: rgba(var(--chat-accent-rgb), 0.1);
}

.chat-input-row {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(var(--chat-accent-rgb), 0.14);
    background: rgb(var(--surface-1-rgb));
}

.chat-input {
    flex: 1;
}

/* Opaque surface color, not a low-alpha accent tint over the row background —
   dbc.themes.DARKLY is loaded globally as an external stylesheet and gives
   .form-control a dark background; a translucent tint here let that dark
   value bleed through in light mode instead of showing the light surface. */
.chat-input.form-control {
    height: 34px !important;
    border-radius: 9px !important;
    border: 1px solid var(--surface-border) !important;
    background: rgb(var(--surface-2-rgb)) !important;
    color: var(--text-primary)!important;
    font-size: 0.82rem !important;
}

.chat-input.form-control::placeholder {
    color: var(--text-muted)!important;
}

.chat-send-btn {
    height: 34px;
    border-radius: 9px;
    border: none;
    background: linear-gradient(180deg, var(--chat-send-grad1), var(--chat-send-grad2));
    color: #ffffff;
    padding: 0 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.chat-send-btn:hover {
    filter: brightness(1.07);
}

.chat-fab {
    background: linear-gradient(135deg, var(--chat-fab-grad1) 0%, var(--chat-fab-grad2) 100%) !important;
    color: var(--text-primary)!important;
    border: 1px solid rgba(var(--chat-accent-rgb), 0.45) !important;
    box-shadow: 0 10px 26px rgba(var(--chat-fab-shadow-rgb), 0.35) !important;
}

.chat-fab i {
    color: var(--text-primary)!important;
}

/* Chat theme picker (sidebar popover)
   position:fixed (viewport-relative, not nested-relative) so it escapes the
   #sidebar / .sidebar-inner `overflow: hidden` clip (see rules ~line 1750) —
   an absolutely-positioned child cannot render outside a clipping ancestor.
   left/top are set inline by the toggle callback from the button's real
   on-screen position; these are just a harmless fallback before that runs. */
.theme-popover {
    position: fixed;
    left: 84px;
    top: 8px;
    width: 190px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(var(--surface-2-rgb), 0.98), rgba(var(--surface-1-rgb), 0.97));
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 9998;
}

.theme-popover-label {
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Data Year pill + its open menu — style.css hardcodes these as a dark navy
   pill with mint accents (#0b1a2c/#dff7ee/#20c997) and never varies them, so
   light mode showed a dark chip. Re-declared here with the same selectors
   (this file loads after style.css, so it wins the specificity tie) using
   theme surface vars instead of literals. */
body[data-theme="light"] #data-year-selector.year-select-themed {
    background-color: rgb(var(--surface-2-rgb)) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--surface-border) !important;
}

body[data-theme="light"] #data-year-selector.year-select-themed:hover {
    background-color: rgb(var(--surface-1-rgb)) !important;
}

body[data-theme="light"] #data-year-selector.year-select-themed option {
    background: rgb(var(--surface-2-rgb)) !important;
    color: var(--text-primary) !important;
}

body[data-theme="light"] #dashboard-year-controls .year-dropdown-flat .Select-menu-outer,
body[data-theme="light"] #dashboard-year-controls .year-dropdown-flat .Select-menu,
body[data-theme="light"] #dashboard-year-controls .year-dropdown-flat div[class*="-menu"],
body[data-theme="light"] #dashboard-year-controls .year-dropdown-flat div[class*="-option"] {
    background-color: rgb(var(--surface-2-rgb)) !important;
    border: 1px solid var(--surface-border) !important;
}

.theme-mode-row {
    display: flex;
    gap: 8px;
}

.theme-mode-btn {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--surface-border);
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: rgba(var(--surface-2-rgb), 0.6);
}

.theme-mode-btn:hover {
    border-color: rgba(var(--site-accent-rgb), 0.4);
    color: var(--text-primary);
}

body[data-theme="dark"] .theme-mode-btn-dark,
body:not([data-theme]) .theme-mode-btn-dark,
body[data-theme="light"] .theme-mode-btn-light {
    border-color: rgba(var(--site-accent-rgb), 0.55);
    color: var(--text-primary);
    background: rgba(var(--site-accent-rgb), 0.14);
}

/* Right panel: divider + neural insight block */
.right-ops-divider {
    width: 100%;
    height: 1px;
    margin: 22px 0 18px 0;
    background: linear-gradient(90deg, rgba(var(--site-accent-rgb), 0.0), rgba(var(--site-accent-rgb), 0.2), rgba(var(--site-accent-rgb), 0.0));
}

.neural-insight-card {
    width: 100%;
    border-radius: 24px;
    padding: 22px 20px;
    background: linear-gradient(145deg, rgba(var(--insight-rgb-1), 0.85), rgba(var(--insight-rgb-2), 0.82));
    box-shadow: inset 0 0 0 1px rgba(var(--site-primary-rgb), 0.18), var(--shadow-sm);
}

.neural-insight-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.neural-insight-title {
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--text-primary);
}

.neural-insight-text {
    margin: 0;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text-secondary);
    white-space: normal;
    word-break: break-word;
}

.bottleneck-card {
    padding: 20px 18px !important;
}

.bottleneck-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bottleneck-summary {
    margin: 0 0 10px 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.bottleneck-summary.sev-critical { color: var(--status-critical); }
.bottleneck-summary.sev-warning { color: var(--status-warning); }
.bottleneck-summary.sev-active { color: var(--status-success); }

.bottleneck-caption {
    margin: -4px 0 10px 0;
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.bottleneck-row {
    display: grid;
    grid-template-columns: 82px 1fr 62px;
    align-items: center;
    gap: 10px;
}
.bottleneck-row.sev-critical .bottleneck-stage-count { color: var(--status-critical); }
.bottleneck-row.sev-warning .bottleneck-stage-count { color: var(--status-warning); }
.bottleneck-row.sev-active .bottleneck-stage-count { color: var(--status-success); }

.bottleneck-row.is-max .bottleneck-stage-label {
    color: var(--text-primary);
}

.bottleneck-row.is-max .bottleneck-bar-track {
    box-shadow: inset 0 0 0 1px rgba(var(--site-primary-rgb), 0.35);
}

.bottleneck-row.is-max .bottleneck-stage-count {
    color: var(--text-secondary);
}

.bottleneck-stage-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    font-weight: 600;
}

.bottleneck-bar-track {
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(62, 92, 116, 0.36), rgba(23, 49, 67, 0.34));
    box-shadow: inset 0 0 0 1px rgba(var(--site-accent-rgb), 0.12);
    overflow: hidden;
}

.bottleneck-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(var(--site-primary-rgb), 0.9), rgba(var(--site-accent-rgb), 0.92));
    box-shadow: 0 0 10px rgba(var(--site-primary-rgb), 0.35);
}
.bottleneck-bar-fill.sev-critical {
    background: linear-gradient(90deg, rgba(255, 71, 87, 0.95), rgba(255, 130, 142, 0.9));
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.4);
}
.bottleneck-bar-fill.sev-warning {
    background: linear-gradient(90deg, rgba(255, 184, 0, 0.95), rgba(255, 214, 102, 0.9));
    box-shadow: 0 0 10px rgba(255, 184, 0, 0.35);
}
.bottleneck-bar-fill.sev-active {
    background: linear-gradient(90deg, rgba(0, 255, 133, 0.95), rgba(var(--site-accent-rgb), 0.92));
    box-shadow: 0 0 10px rgba(0, 255, 133, 0.35);
}

.bottleneck-stage-count {
    text-align: right;
    font-size: 0.7rem;
    color: var(--text-primary);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Make mini timeline line clearer in Live Operations cards */
.recent-logistics-card .progress-track {
    height: 4px !important;
    background: rgba(120, 153, 180, 0.35) !important;
    box-shadow: inset 0 0 0 1px rgba(105, 140, 166, 0.2);
}

.recent-logistics-card .progress-fill {
    height: 4px !important;
    background: linear-gradient(90deg, rgba(var(--site-primary-rgb), 1), rgba(73, 241, 210, 0.95)) !important;
    box-shadow: 0 0 10px rgba(31, 199, 134, 0.35);
}

.recent-logistics-card .stage-dot {
    width: 11px !important;
    height: 11px !important;
    border: 2px solid rgba(123, 151, 176, 0.5) !important;
}

.recent-logistics-card .stage-dot.complete {
    border-color: rgba(var(--site-primary-rgb), 0.75) !important;
    box-shadow: 0 0 10px rgba(var(--site-primary-rgb), 0.35) !important;
}

/* Make live operation cards a bit taller to fill right-panel gap better */
.recent-logistics-card {
    padding: 20px !important;
    margin-bottom: 14px !important;
    min-height: 200px !important;
}

.recent-logistics-card .progress-timeline {
    margin: 18px 0 !important;
}

/* Header controls (reference-inspired top search/action cluster) */
.content-actions {
    gap: 10px !important;
}

.top-quick-search {
    width: 280px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(var(--site-accent-rgb), 0.2) !important;
    background: rgba(var(--surface-1-rgb), 0.82) !important;
    color: var(--text-primary)!important;
    padding: 0 14px;
    font-size: 0.82rem;
    outline: none !important;
}

.top-quick-search::placeholder {
    color: var(--text-muted)!important;
}

.top-quick-search:focus {
    border-color: rgba(var(--site-accent-rgb), 0.4) !important;
    box-shadow: 0 0 0 3px rgba(var(--site-accent-rgb), 0.12) !important;
}

.top-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(var(--site-accent-rgb), 0.14);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.top-icon-btn:hover {
    background: rgba(var(--site-accent-rgb), 0.24);
    color: var(--text-primary);
}

.top-avatar-chip {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(180deg, #1fc786, #18ba7c);
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(24, 186, 124, 0.25);
}

/* ========================================================================== */
/* Sidebar v2 - match new light reference */
/* ========================================================================== */
#sidebar {
    width: 92px !important;
    background: transparent !important;
    box-shadow: none !important;
}

#sidebar.expanded {
    width: 270px !important;
}

#sidebar::after {
    display: none !important;
}

#sidebar > .sidebar-inner {
    background: transparent !important;
    border: none !important;
    border-radius: 16px !important;
    margin: 12px !important;
    padding: 10px 8px !important;
    box-shadow: none !important;
}

.main-content {
    margin-left: 96px !important;
}

.main-content.expanded {
    margin-left: 274px !important;
}

.sidebar-toggle-btn {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    border: none !important;
    background: transparent !important;
    color: var(--text-secondary)!important;
    margin: 2px auto 8px auto !important;
}

.sidebar-logo-icon {
    width: 62px !important;
    height: 62px !important;
    margin: 0 auto 10px auto !important;
    border-radius: 14px !important;
    background: transparent !important;
    border: none !important;
}

.sidebar-company-logo {
    width: 46px !important;
    height: 46px !important;
    filter: brightness(1.7) contrast(1.35) saturate(1.25) drop-shadow(0 0 8px rgba(95, 227, 255, 0.42)) !important;
}

#sidebar.expanded .sidebar-logo-icon {
    width: 108px !important;
    height: 108px !important;
    margin-bottom: 12px !important;
}

#sidebar.expanded .sidebar-company-logo {
    width: 74px !important;
    height: 74px !important;
}

.sidebar-search-wrap,
.sidebar-section-label,
.nav-text,
.sidebar-profile {
    display: none !important;
}

#sidebar.expanded .sidebar-search-wrap {
    display: flex !important;
    align-items: center;
    gap: 8px;
    background: transparent !important;
    border: none !important;
    border-radius: 10px !important;
    height: 36px;
    padding: 0 10px;
    margin: 0 6px 10px 6px;
    color: var(--text-secondary)!important;
}

#sidebar.expanded .sidebar-search-input {
    width: 100%;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    color: var(--text-primary)!important;
    font-size: 0.83rem;
}

#sidebar.expanded .sidebar-section-label {
    display: block !important;
    margin: 4px 10px 8px 10px;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: var(--text-muted)!important;
    text-transform: uppercase;
    font-weight: 600;
}

.sidebar-menu-item {
    border: none !important;
    background: transparent !important;
    color: var(--text-muted)!important;
    border-radius: 10px !important;
}

.sidebar-menu-item:hover {
    background: rgba(var(--site-accent-rgb), 0.14) !important;
    color: var(--text-primary)!important;
}

.sidebar-menu-item.active {
    background: linear-gradient(180deg, #1fc786, #18ba7c) !important;
    color: #ffffff!important;
    box-shadow: 0 8px 16px rgba(24, 186, 124, 0.28) !important;
}

#sidebar.expanded .sidebar-menu-item {
    width: calc(100% - 12px) !important;
    margin: 0 6px !important;
    justify-content: flex-start !important;
    padding: 10px 12px !important;
}

#sidebar.expanded .sidebar-menu-item .nav-text {
    display: inline !important;
    font-size: 0.86rem;
    font-weight: 520;
}

.sidebar-logout-btn {
    width: 46px !important;
    height: 46px !important;
    border: none !important;
    background: transparent !important;
    color: var(--text-secondary)!important;
}

.sidebar-logout-btn:hover {
    background: rgba(var(--site-accent-rgb), 0.2) !important;
    color: var(--text-primary)!important;
}

#sidebar.expanded .sidebar-logout-btn {
    width: calc(100% - 12px) !important;
    margin: 0 6px !important;
    justify-content: flex-start !important;
    gap: 10px;
    padding: 10px 12px !important;
}

#sidebar.expanded .sidebar-logout-btn .nav-text {
    display: inline !important;
    color: var(--text-secondary)!important;
}

#sidebar.expanded .sidebar-profile {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 10px 10px 4px 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: transparent;
    border: none;
}

.sidebar-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(180deg, #22c98a, #16b87c);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-profile-name {
    font-size: 0.76rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.1;
}

.sidebar-profile-email {
    font-size: 0.67rem;
    color: var(--text-muted);
    line-height: 1.1;
}

/* ========================================================================== */
/* MOBILE RESPONSIVE STYLES */
/* ========================================================================== */

/* Mobile overlay - covers content when sidebar is open on mobile */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9998;
    cursor: pointer;
}

/* Mobile hamburger menu button - HIDDEN on desktop (>1024px) */
@media (min-width: 1025px) {
    .mobile-menu-btn,
    #mobile-menu-btn {
        display: none !important;
    }
}

.mobile-menu-btn:hover {
    background: rgba(var(--site-accent-rgb), 0.25) !important;
    border-color: rgba(var(--site-accent-rgb), 0.5) !important;
}

/* Tablet (1024px and below) */
@media (max-width: 1024px) {
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex !important;
    }

    #sidebar {
        transform: translateX(-100%);
        position: fixed !important;
        z-index: 9999 !important;
        transition: transform 0.3s ease;
        width: 260px !important;
        background: rgba(var(--surface-2-rgb), 0.98) !important;
    }

    #sidebar > .sidebar-inner {
        width: 100% !important;
        padding: 16px !important;
    }

    #sidebar .sidebar-menu-item {
        width: 100% !important;
        justify-content: flex-start !important;
        padding: 12px 14px !important;
    }

    #sidebar .sidebar-menu-item .nav-text {
        display: inline !important;
        margin-left: 10px;
    }

    #sidebar .sidebar-logout-btn {
        width: 100% !important;
        justify-content: flex-start !important;
        padding: 12px 14px !important;
    }

    #sidebar .sidebar-logout-btn .nav-text {
        display: inline !important;
        margin-left: 10px;
    }

    #sidebar.mobile-open {
        transform: translateX(0);
    }

    /* Show overlay when sidebar is open */
    #sidebar.mobile-open ~ .mobile-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 20px !important;
    }

    /* Two column layout - stack on tablet */
    .row > .col-lg-7,
    .row > .col-lg-5,
    .row > .col-xl-7,
    .row > .col-xl-5 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
    .top-quick-search,
    .top-icon-btn,
    .top-avatar-chip {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 70px 12px 20px 12px !important;  /* Top padding for mobile menu button */
    }

    .content-hero {
        padding: 8px 10px;
        margin-bottom: 10px !important;
    }

    .content-branding {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .content-title {
        font-size: 1.1rem !important;
    }

    /* Year selector compact on mobile */
    #dashboard-year-controls {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    #data-year-selector {
        width: 80px !important;
        font-size: 0.8rem !important;
    }

    /* KPI Cards - 2 per row on mobile */
    .metric-card {
        min-height: 80px;
        padding: 14px 12px !important;
    }

    .metric-card-label,
    .kpi-title {
        font-size: 0.65rem !important;
        margin-bottom: 4px !important;
    }

    .metric-card-value,
    .kpi-value {
        font-size: 1.3rem !important;
    }

    .kpi-unit {
        font-size: 0.75rem !important;
    }

    /* Section titles */
    .section-title,
    .overview-title {
        font-size: 1.2rem !important;
    }

    .subsection-title {
        font-size: 0.9rem !important;
    }

    /* Charts - full width and shorter */
    .chart-container {
        padding: 12px !important;
        margin-bottom: 12px !important;
    }

    .chart-title {
        font-size: 0.9rem !important;
    }

    .chart-subtitle {
        font-size: 0.75rem !important;
    }

    /* Charts responsive sizing on mobile */
    .chart-container {
        overflow: hidden !important;
    }

    .chart-container .js-plotly-plot,
    .chart-container .plotly,
    .chart-container .plot-container,
    .chart-container .svg-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Plotly chart specific mobile fixes */
    .js-plotly-plot .plotly .main-svg {
        width: 100% !important;
    }

    /* Chart heights - smaller on mobile */
    .dash-graph,
    .js-plotly-plot {
        height: 200px !important;
        min-height: 180px !important;
    }

    .chart-container .dash-graph,
    .chart-container .js-plotly-plot {
        width: 100% !important;
        overflow: hidden !important;
    }

    /* Keep Qty Muat vs Bongkar card compact on mobile */
    .qty-comparison-card {
        padding: 10px !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        display: block !important;
    }

    .qty-comparison-card .dash-graph,
    .qty-comparison-card .js-plotly-plot {
        height: 180px !important;
        min-height: 170px !important;
    }

    .qty-comparison-card #chart-qty,
    .qty-comparison-card #chart-qty .js-plotly-plot,
    .qty-comparison-card #chart-qty .plotly,
    .qty-comparison-card #chart-qty .plot-container,
    .qty-comparison-card #chart-qty .svg-container {
        height: 180px !important;
        min-height: 180px !important;
        max-height: 180px !important;
    }

    .qty-comparison-card #loading-chart-qty {
        display: block !important;
        height: 180px !important;
        min-height: 180px !important;
        max-height: 180px !important;
    }

    #chart-qty-legend {
        margin-top: 6px !important;
        font-size: 0.72rem !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Force plotly to respect container */
    .plot-container.plotly {
        height: 100% !important;
        width: 100% !important;
    }

    /* Filters - more compact */
    .filters-container {
        padding: 10px 12px !important;
        margin-bottom: 12px !important;
    }

    .filters-container .row {
        flex-direction: column;
    }

    .filters-container .col-3,
    .filters-container [class*="col-"] {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 8px;
    }

    /* Bootstrap grid - make columns stack */
    .row > .col-6,
    .row > .col-md-6,
    .row > .col-lg-6 {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .row > .col-3,
    .row > .col-md-3,
    .row > .col-lg-3 {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    /* KPI rows - 2 columns */
    .g-2, .g-3 {
        flex-wrap: wrap !important;
        overflow-x: visible !important;
    }

    .g-2 > .col-3,
    .g-3 > .col-3 {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
        min-width: unset !important;
    }

    /* Recent logistics cards */
    .recent-logistics-card {
        padding: 14px !important;
        min-height: 160px !important;
        margin-bottom: 10px !important;
    }

    .vessel-name {
        font-size: 0.85rem !important;
    }

    .progress-badge {
        font-size: 0.9rem !important;
    }

    .stage-label {
        font-size: 0.6rem !important;
    }

    /* Neural insight card */
    .neural-insight-card {
        padding: 14px !important;
        border-radius: 16px !important;
    }

    .neural-insight-text {
        font-size: 0.85rem !important;
    }

    /* Bottleneck card */
    .bottleneck-card {
        padding: 14px !important;
    }

    .bottleneck-row {
        grid-template-columns: 70px 1fr 50px !important;
        gap: 6px !important;
    }

    .bottleneck-stage-label {
        font-size: 0.65rem !important;
    }

    /* Chat window */
    #chat-window {
        width: calc(100% - 20px) !important;
        right: 10px !important;
        left: 10px !important;
        bottom: 70px !important;
        max-height: 60vh !important;
    }

    .chat-fab {
        width: 50px !important;
        height: 50px !important;
        right: 16px !important;
        bottom: 16px !important;
    }

    /* Tables */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.7rem !important;
    }

    table th,
    table td {
        padding: 6px 4px !important;
        white-space: nowrap;
    }

    /* Login page */
    .login-container {
        padding: 20px !important;
        max-width: 100% !important;
        margin: 10px !important;
    }

    /* Mobile menu button */
    .mobile-menu-btn {
        display: flex !important;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 9998;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: rgba(var(--site-accent-rgb), 0.15);
        border: none;
        color: var(--text-primary);
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    /* Overlay for mobile menu */
    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
    }

    .mobile-overlay.active {
        display: block;
    }
}

/* Small mobile (480px and below) */
@media (max-width: 480px) {
    .main-content {
        padding: 10px 8px 16px 8px !important;
    }

    .content-title {
        font-size: 1rem !important;
    }

    /* All columns full width */
    .row > .col-6,
    .row > .col-md-6,
    .row > .col-3,
    .row > .col-md-3,
    .g-2 > .col-3,
    .g-3 > .col-3,
    .g-2 > [class*="col"],
    .g-3 > [class*="col"] {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        min-width: unset !important;
    }

    .metric-card {
        min-height: 70px;
        padding: 12px 10px !important;
    }

    .metric-card-value,
    .kpi-value {
        font-size: 1.2rem !important;
    }

    .section-title,
    .overview-title {
        font-size: 1rem !important;
    }

    .chart-container {
        padding: 10px !important;
    }

    /* Charts even shorter on very small screens */
    .chart-container .js-plotly-plot,
    .chart-container [id*="chart-"] {
        height: 200px !important;
        min-height: 200px !important;
    }

    .qty-comparison-card .dash-graph,
    .qty-comparison-card .js-plotly-plot,
    .qty-comparison-card [id*="chart-"] {
        height: 165px !important;
        min-height: 160px !important;
    }

    .qty-comparison-card #chart-qty,
    .qty-comparison-card #chart-qty .js-plotly-plot,
    .qty-comparison-card #chart-qty .plotly,
    .qty-comparison-card #chart-qty .plot-container,
    .qty-comparison-card #chart-qty .svg-container {
        height: 160px !important;
        min-height: 160px !important;
        max-height: 160px !important;
    }

    .qty-comparison-card #loading-chart-qty {
        display: block !important;
        height: 160px !important;
        min-height: 160px !important;
        max-height: 160px !important;
    }

    .filters-container {
        padding: 8px 10px !important;
    }

    /* Dropdowns */
    .Select-control,
    div[class*="-control"] {
        min-height: 36px !important;
        font-size: 0.8rem !important;
    }

    /* Recent logistics cards */
    .recent-logistics-card {
        padding: 12px !important;
        min-height: 140px !important;
    }

    .progress-timeline {
        margin: 12px 0 !important;
    }

    .stage-dot {
        width: 8px !important;
        height: 8px !important;
    }

    /* Chat */
    #chat-window {
        max-height: 50vh !important;
    }

    .chat-bubble {
        max-width: 90% !important;
        font-size: 0.8rem !important;
        padding: 8px 10px !important;
    }

    .chat-input.form-control {
        font-size: 0.78rem !important;
    }
}

/* ========================================================================== */
/* Sidebar final override: no cards, no gray, bigger logo */
/* ========================================================================== */
#sidebar {
    background: transparent !important;
    border-right: none !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

#sidebar > .sidebar-inner {
    background: rgba(var(--surface-2-rgb), 0.96) !important;
    border: none !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

#sidebar .sidebar-toggle-btn,
#sidebar .sidebar-menu-item,
#sidebar .sidebar-logout-btn,
#sidebar .sidebar-search-wrap,
#sidebar .sidebar-profile {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#sidebar .sidebar-section-label,
#sidebar .sidebar-search-wrap,
#sidebar .sidebar-profile {
    display: none !important;
}

#sidebar .sidebar-menu-item {
    border-radius: 8px !important;
    color: var(--text-muted)!important;
    box-shadow: none !important;
    border-left: 3px solid transparent !important;
    position: relative !important;
}

#sidebar .sidebar-menu-item .material-symbols-outlined {
    color: var(--text-muted)!important;
    font-family: 'Material Symbols Outlined' !important;
    font-size: 24px !important;
    font-weight: normal !important;
    font-style: normal !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    display: inline-block !important;
    white-space: nowrap !important;
    word-wrap: normal !important;
    direction: ltr !important;
    -webkit-font-feature-settings: 'liga' !important;
    -webkit-font-smoothing: antialiased !important;
}

#sidebar .sidebar-menu-item:hover {
    background: rgba(var(--site-primary-rgb), 0.12) !important;
    color: var(--text-primary)!important;
}

#sidebar .sidebar-menu-item:hover .material-symbols-outlined {
    color: var(--text-primary)!important;
}

#sidebar .sidebar-menu-item.active {
    background: transparent !important;
    color: var(--site-primary) !important;
    box-shadow: none !important;
    border-left-color: var(--site-primary) !important;
}

#sidebar .sidebar-menu-item.active .material-symbols-outlined {
    color: var(--site-primary) !important;
}

/* Kill legacy active markers that can leave green pixel artifacts */
#sidebar .sidebar-menu-item::before,
#sidebar .sidebar-menu-item::after,
#sidebar .sidebar-menu-item.active::before,
#sidebar .sidebar-menu-item.active::after {
    display: none !important;
    content: none !important;
}

#sidebar .sidebar-logo-icon {
    width: 64px !important;
    height: 64px !important;
    background: transparent !important;
    margin-bottom: 12px !important;
}

#sidebar .sidebar-company-logo {
    width: 52px !important;
    height: 52px !important;
    filter: brightness(2.2) contrast(1.6) saturate(1.35) drop-shadow(0 0 16px rgba(95, 227, 255, 0.65)) !important;
}

#sidebar.expanded .sidebar-logo-icon {
    width: 212px !important;
    height: 212px !important;
    margin-bottom: 20px !important;
}

#sidebar.expanded .sidebar-company-logo {
    width: 176px !important;
    height: 176px !important;
}

/* Remove any legacy vertical indicator/line artifacts */
#sidebar::before,
#sidebar::after,
#sidebar .sidebar-inner::before,
#sidebar .sidebar-inner::after {
    display: none !important;
    content: none !important;
}
