/* ══════════════════════════════════════════════════
   LOMAinsights Logistics — Demo application styles
   Standalone: shares no assets with /demo/ or /cchccenters/.
   ══════════════════════════════════════════════════ */

:root {
    /* Swiss Grid tokens. Names preserved so every downstream rule keeps
       resolving; only the values changed. Must stay literal — a token
       may never reference itself. */
    --lg-bg: #ffffff;
    --lg-surface: #ffffff;
    --lg-surface-alt: #fafafa;
    --lg-ink: #000000;
    --lg-ink-soft: #333333;
    --lg-muted: #5c5c5c;
    --lg-line: #d8d8d8;
    --lg-line-soft: #ebebeb;
    --lg-line-strong: #000000;
    --lg-navy: #000000;
    --lg-navy-mid: #1a1a1a;
    --lg-teal: #d6202a;
    --lg-teal-soft: #fdf0f0;
    --lg-indigo: #000000;
    --lg-indigo-soft: #fafafa;
    --lg-amber: #8a5a00;
    --lg-amber-soft: #fafafa;
    --lg-red: #d6202a;
    --lg-red-soft: #fdf0f0;
    --lg-green: #0a7d32;
    --lg-green-soft: #fafafa;
    --lg-accent-bright: #ff5a5f;
    --lg-radius: 0;
    --lg-radius-sm: 0;
    --lg-dur: 130ms;
    --lg-ease: cubic-bezier(0.2, 0, 0, 1);
    --lg-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --lg-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}


*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--lg-bg);
    color: var(--lg-ink);
    font-family: var(--lg-font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
p { margin: 0; }
button { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }

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

.lg-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: 248px;
    padding: 20px 16px;
    background: var(--lg-navy);
    color: var(--lg-surface);
}

.lg-sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.lg-brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }

.lg-brand-mark {
    position: relative;
    width: 30px; height: 30px;
    border-radius: 0;
    background: var(--lg-ink);
    overflow: hidden;
    flex: 0 0 auto;
}
.lg-brand-mark::before {
    content: ""; position: absolute; inset: 7px 11px 7px 6px;
    border-radius: 0; background: rgba(255,255,255,0.85);
}

.lg-brand-text strong { display: block; font-size: 0.9rem; }
.lg-brand-text small { display: block; font-size: 0.7rem; color: rgba(255,255,255,0.55); letter-spacing: 0.06em; text-transform: uppercase; }

.lg-sidebar-close {
    display: none;
    border: 0; background: transparent; color: rgba(255,255,255,0.7);
    font-size: 1.5rem; line-height: 1; cursor: pointer;
}

.lg-nav { display: grid; gap: 2px; margin-top: 26px; }

.lg-nav-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 12px;
    border: 0; border-radius: 0;
    background: transparent; color: rgba(255,255,255,0.72);
    font-size: 0.86rem; font-weight: 500; text-align: left; cursor: pointer;
    transition: background 150ms, color 150ms;
}
.lg-nav-btn:hover { background: rgba(255,255,255,0.06); color: var(--lg-surface); }
.lg-nav-btn.is-active { background: rgba(13,148,136,0.22); color: var(--lg-surface); font-weight: 600; }
.lg-nav-btn span { opacity: 0.6; font-size: 0.9rem; }

.lg-nav-count {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 0;
    background: rgba(255,255,255,0.12);
    font-size: 0.7rem; font-style: normal; font-weight: 600;
}

.lg-sidebar-block { margin-top: auto; padding-top: 24px; }
.lg-sidebar-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.5); }
.lg-sidebar-note { margin-top: 6px; font-size: 0.74rem; line-height: 1.5; color: rgba(255,255,255,0.45); }

.lg-sidebar-back {
    margin-top: 16px; padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.55); font-size: 0.78rem; text-decoration: none;
}
.lg-sidebar-back:hover { color: var(--lg-surface); }

.lg-sidebar-overlay { display: none; }

.lg-main { flex: 1; min-width: 0; margin-left: 248px; }

/* ── Topbar ────────────────────────────────────── */
.lg-topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    padding: 16px 28px;
    background: rgba(246,248,250,0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--lg-line);
}
.lg-topbar-title { font-size: 1.1rem; }

.lg-badge {
    margin-left: auto;
    padding: 4px 11px;
    border-radius: 0;
    background: var(--lg-teal-soft);
    color: #065f46;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em;
}

.lg-menu-btn { display: none; flex-direction: column; gap: 4px; width: 34px; padding: 8px 6px; border: 0; border-radius: 0; background: var(--lg-surface); cursor: pointer; }
.lg-menu-btn span { height: 2px; background: var(--lg-ink); border-radius: 0; }

.lg-content { padding: 24px 28px 64px; }

.lg-view { display: none; }
.lg-view.is-active { display: block; animation: lg-fade 220ms ease; }
@keyframes lg-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── KPI cards ─────────────────────────────────── */
.lg-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.lg-kpi {
    padding: 18px 20px;
    border-radius: 0;
    background: var(--lg-surface);
    border: 1px solid var(--lg-line);
}
.lg-kpi-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lg-muted); }
.lg-kpi-value { margin-top: 8px; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; }
.lg-kpi-sub { margin-top: 4px; font-size: 0.78rem; color: var(--lg-muted); }

/* ── Panels ────────────────────────────────────── */
.lg-panel-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }

.lg-panel {
    padding: 20px 22px;
    border-radius: 0;
    background: var(--lg-surface);
    border: 1px solid var(--lg-line);
    margin-bottom: 16px;
}
.lg-panel-row .lg-panel { margin-bottom: 0; }

.lg-panel-head { margin-bottom: 16px; }
.lg-panel-head h2 { font-size: 1rem; }
.lg-panel-head p { margin-top: 4px; font-size: 0.8rem; color: var(--lg-muted); }

/* ── Worklist ──────────────────────────────────── */
.lg-worklist { display: grid; gap: 8px; }

.lg-work-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--lg-line);
    border-radius: 0;
    background: var(--lg-surface-alt);
    text-align: left; cursor: pointer;
    transition: border-color 150ms, background 150ms;
}
.lg-work-item:hover { border-color: var(--lg-teal); background: var(--lg-surface); }

.lg-work-flag {
    flex: 0 0 auto;
    padding: 3px 9px;
    border-radius: 0;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.flag-high { background: var(--lg-red-soft); color: var(--lg-red); }
.flag-med { background: var(--lg-amber-soft); color: var(--lg-amber); }
.flag-low { background: var(--lg-indigo-soft); color: var(--lg-indigo); }

.lg-work-body { min-width: 0; }
.lg-work-title { display: block; font-size: 0.86rem; font-weight: 600; }
.lg-work-note { display: block; margin-top: 3px; font-size: 0.78rem; color: var(--lg-muted); line-height: 1.45; }
.lg-work-go { margin-left: auto; color: var(--lg-muted); font-size: 1rem; }

/* ── Margin watch ──────────────────────────────── */
.lg-margin-list { display: grid; gap: 10px; }
.lg-margin-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.lg-margin-name { font-size: 0.84rem; font-weight: 600; }
.lg-margin-meta { font-size: 0.76rem; color: var(--lg-muted); }
.lg-margin-delta { font-size: 0.86rem; font-weight: 700; font-family: var(--lg-mono); }
.lg-margin-bar { grid-column: 1 / -1; height: 6px; border-radius: 0; background: var(--lg-line-soft); overflow: hidden; }
.lg-margin-fill { height: 100%; border-radius: 0; }

/* ── Mode grid ─────────────────────────────────── */
.lg-mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.lg-mode-card { padding: 16px 18px; border-radius: 0; border: 1px solid var(--lg-line); background: var(--lg-surface-alt); }
.lg-mode-card h3 { font-size: 0.9rem; }
.lg-mode-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.lg-mode-stat span { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--lg-muted); }
.lg-mode-stat strong { font-size: 0.95rem; }

/* ── Toolbar ───────────────────────────────────── */
.lg-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.lg-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; min-width: 240px; }
.lg-toolbar-note { font-size: 0.8rem; color: var(--lg-muted); }

.lg-input {
    min-width: 180px;
    padding: 9px 12px;
    border: 1px solid var(--lg-line);
    border-radius: 0;
    background: var(--lg-surface);
    font-family: inherit; font-size: 0.84rem; color: var(--lg-ink);
}
.lg-input:focus { outline: 2px solid var(--lg-teal-soft); border-color: var(--lg-teal); }
.lg-input-sm { min-width: 140px; }
.lg-input-xs { min-width: 90px; }
select.lg-input { cursor: pointer; }

/* ── Buttons ───────────────────────────────────── */
.lg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 38px; padding: 0 16px;
    border: 1px solid transparent; border-radius: 0;
    font-size: 0.83rem; font-weight: 600; cursor: pointer;
    transition: filter 150ms, background 150ms, border-color 150ms;
}
.lg-btn:hover { filter: brightness(0.96); }
.lg-btn-primary { background: var(--lg-teal); color: var(--lg-surface); }
.lg-btn-dark { background: var(--lg-navy); color: var(--lg-surface); }
.lg-btn-quiet { background: var(--lg-surface); color: var(--lg-ink); border-color: var(--lg-line); }
.lg-btn-danger { background: var(--lg-red-soft); color: var(--lg-red); }
.lg-btn-sm { min-height: 32px; padding: 0 12px; font-size: 0.78rem; }
.lg-btn-block { width: 100%; margin-top: 10px; }
.lg-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

.lg-back {
    margin-bottom: 16px; padding: 0;
    border: 0; background: transparent;
    color: var(--lg-muted); font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.lg-back:hover { color: var(--lg-ink); }

/* ── Tables ────────────────────────────────────── */
.lg-table-wrap {
    border-radius: 0;
    background: var(--lg-surface);
    border: 1px solid var(--lg-line);
    overflow-x: auto;
}
.lg-table th, .lg-table td { padding: 12px 16px; text-align: left; white-space: nowrap; }
.lg-table thead th {
    position: sticky; top: 0;
    background: var(--lg-surface-alt);
    border-bottom: 1px solid var(--lg-line);
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--lg-muted);
}
.lg-table tbody tr { border-bottom: 1px solid var(--lg-line-soft); }
.lg-table tbody tr:last-child { border-bottom: 0; }
.lg-table tbody tr:hover { background: var(--lg-surface-alt); }
.lg-table .num, .lg-table td.num { text-align: right; font-family: var(--lg-mono); font-size: 0.82rem; }
.lg-table .lg-ref { font-family: var(--lg-mono); font-size: 0.8rem; font-weight: 600; }
.lg-table .lg-sub { display: block; font-size: 0.74rem; color: var(--lg-muted); font-family: var(--lg-font); }

.lg-empty { padding: 32px 16px; text-align: center; color: var(--lg-muted); font-size: 0.85rem; }

/* ── Chips / status ────────────────────────────── */
.lg-chip {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 0;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.chip-draft { background: var(--lg-line-soft); color: var(--lg-muted); }
.chip-submitted { background: var(--lg-indigo-soft); color: var(--lg-indigo); }
.chip-won, .chip-finance_ready { background: var(--lg-green-soft); color: var(--lg-green); }
.chip-lost { background: var(--lg-red-soft); color: var(--lg-red); }
.chip-awarded { background: var(--lg-teal-soft); color: #065f46; }
.chip-in_transit { background: var(--lg-indigo-soft); color: var(--lg-indigo); }
.chip-delivered { background: var(--lg-amber-soft); color: var(--lg-amber); }
.chip-invoiced { background: var(--lg-navy); color: var(--lg-surface); }
.chip-air { background: var(--lg-indigo-soft); color: var(--lg-indigo); }
.chip-ocean { background: var(--lg-teal-soft); color: #065f46; }

.pos { color: var(--lg-green); }
.neg { color: var(--lg-red); }

/* ── Editor / detail ───────────────────────────── */
.lg-editor { display: grid; gap: 16px; }

.lg-card {
    padding: 22px;
    border-radius: 0;
    background: var(--lg-surface);
    border: 1px solid var(--lg-line);
}
.lg-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.lg-card-head h2 { font-size: 1.05rem; }
.lg-card-head p { width: 100%; font-size: 0.8rem; color: var(--lg-muted); }
.lg-card-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }

.lg-field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.lg-field { display: grid; gap: 5px; }
.lg-field label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--lg-muted); }
.lg-field .lg-input { width: 100%; min-width: 0; }
.lg-field-static { font-size: 0.9rem; font-weight: 600; }

.lg-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 4px; }
.lg-summary {
    padding: 14px 16px;
    border-radius: 0;
    background: var(--lg-surface-alt);
    border: 1px solid var(--lg-line);
}
.lg-summary span { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--lg-muted); }
.lg-summary strong { display: block; margin-top: 6px; font-size: 1.15rem; font-family: var(--lg-mono); }

.lg-line-table td { padding: 8px 10px; }
.lg-line-table .lg-input { min-width: 0; width: 100%; padding: 7px 10px; }
.lg-line-table td.num .lg-input { text-align: right; font-family: var(--lg-mono); }
.lg-line-remove {
    border: 0; background: transparent; color: var(--lg-muted);
    font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.lg-line-remove:hover { color: var(--lg-red); }

.lg-note {
    padding: 12px 14px;
    border-radius: 0;
    background: var(--lg-surface-alt);
    border-left: 3px solid var(--lg-teal);
    font-size: 0.8rem; color: var(--lg-ink-soft);
}
.lg-note strong { font-weight: 700; }
.lg-note-warn { border-left-color: var(--lg-amber); background: var(--lg-amber-soft); color: #78350f; }

.lg-timeline { display: grid; gap: 0; }
.lg-timeline-step { display: flex; gap: 12px; padding: 10px 0; }
.lg-timeline-dot {
    flex: 0 0 auto; width: 22px; height: 22px; margin-top: 2px;
    border-radius: 0; border: 2px solid var(--lg-line);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.66rem; font-weight: 700; color: var(--lg-muted); background: var(--lg-surface);
}
.lg-timeline-step.is-done .lg-timeline-dot { background: var(--lg-teal); border-color: var(--lg-teal); color: var(--lg-surface); }
.lg-timeline-step.is-current .lg-timeline-dot { border-color: var(--lg-teal); color: var(--lg-teal); }
.lg-timeline-label { font-size: 0.86rem; font-weight: 600; }
.lg-timeline-note { font-size: 0.78rem; color: var(--lg-muted); }

/* ── Drawer ────────────────────────────────────── */
.lg-drawer { position: fixed; inset: 0; z-index: 60; }
.lg-drawer-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,0.45); }
.lg-drawer-panel {
    position: absolute; inset: 0 0 0 auto;
    width: min(760px, 100%);
    display: flex; flex-direction: column;
    background: var(--lg-surface);
    box-shadow: none;
    animation: lg-slide 220ms ease;
}
@keyframes lg-slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.lg-drawer-head {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--lg-line);
}
.lg-drawer-head h2 { font-size: 1rem; }
.lg-drawer-actions { margin-left: auto; display: flex; gap: 8px; }
.lg-drawer-body { flex: 1; overflow-y: auto; padding: 28px; background: var(--lg-surface-alt); }

/* ── Printable document ────────────────────────── */
.lg-doc {
    max-width: 660px; margin: 0 auto; padding: 40px;
    background: var(--lg-surface); border: 1px solid var(--lg-line); border-radius: 0;
}
.lg-doc-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 2px solid var(--lg-navy); }
.lg-doc-brand strong { display: block; font-size: 1.1rem; }
.lg-doc-brand small { color: var(--lg-muted); font-size: 0.76rem; }
.lg-doc-meta { text-align: right; font-size: 0.78rem; color: var(--lg-muted); }
.lg-doc-meta strong { display: block; font-size: 1.2rem; color: var(--lg-ink); font-family: var(--lg-mono); }
.lg-doc h3 { margin: 24px 0 10px; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lg-muted); }
.lg-doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; font-size: 0.84rem; }
.lg-doc-grid span { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--lg-muted); }
.lg-doc table { margin-top: 6px; font-size: 0.84rem; }
.lg-doc th { padding: 8px 6px; border-bottom: 1px solid var(--lg-line); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--lg-muted); text-align: left; }
.lg-doc td { padding: 8px 6px; border-bottom: 1px solid var(--lg-line-soft); }
.lg-doc td.num, .lg-doc th.num { text-align: right; font-family: var(--lg-mono); }
.lg-doc-total { display: flex; justify-content: space-between; margin-top: 16px; padding-top: 14px; border-top: 2px solid var(--lg-navy); font-size: 1rem; font-weight: 700; }
.lg-doc-total span:last-child { font-family: var(--lg-mono); }
.lg-doc-terms { margin-top: 26px; font-size: 0.74rem; color: var(--lg-muted); line-height: 1.6; }

/* ── Toast ─────────────────────────────────────── */
.lg-toast {
    position: fixed; left: 50%; bottom: 28px; z-index: 80;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 0;
    background: var(--lg-navy); color: var(--lg-surface);
    font-size: 0.84rem; font-weight: 600;
    box-shadow: none;
    animation: lg-toast-in 200ms ease;
}
@keyframes lg-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 900px) {
    .lg-sidebar { transform: translateX(-100%); transition: transform 220ms ease; }
    .lg-sidebar.is-open { transform: none; }
    .lg-sidebar-close { display: block; }
    .lg-sidebar-overlay.is-open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15,23,42,0.4); }
    .lg-main { margin-left: 0; }
    .lg-menu-btn { display: flex; }
    .lg-content { padding: 18px 16px 56px; }
    .lg-topbar { padding: 14px 16px; }
    .lg-drawer-body { padding: 16px; }
    .lg-doc { padding: 24px; }
}

@media print {
    .lg-shell, .lg-drawer-head, .lg-drawer-backdrop, .lg-toast { display: none !important; }
    .lg-drawer, .lg-drawer-panel { position: static; box-shadow: none; width: auto; }
    .lg-drawer-body { padding: 0; background: var(--lg-surface); overflow: visible; }
    .lg-doc { border: 0; max-width: none; padding: 0; }
}


/* ============================================================
   SWISS GRID LAYER — appended last so it wins without editing
   the rules above. Mirrors /demo/app.css and site/styles.css.
   ============================================================ */

:focus-visible { outline: 2px solid var(--lg-red); outline-offset: 2px; }

.kpi-value, .kpi-label, .kpi-delta,
.hero-eyebrow, .metric-value, .metric-label,
table th, table td {
    font-family: var(--lg-mono);
    font-variant-numeric: tabular-nums;
}

.kpi-label, .hero-eyebrow, .metric-label, table th {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 11px;
    font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
