/* ============================================================================
   IMPAQMS — AAPMC design system  ·  v2.0
   Aurochs Aerospace Precision Manufacturing Corp.
   ----------------------------------------------------------------------------
   Colour   Deep forest green from the aurochs logo (#0c3311) + machined brass
   Type     Rajdhani (display · stamped/technical) · IBM Plex Sans (body)
            IBM Plex Mono (identifiers: WO#, part #, doc #, stamps)
   Motif    Precision drawing: hairline grids, stamped ID chips, ink stamps
   Built on Bootstrap 5.3 — no build step.
   ========================================================================== */

:root {
    --ink: #0c3311;          /* logo forest green */
    --ink-900: #061a09;
    --ink-800: #0a2a0e;
    --ink-700: #0c3311;
    --ink-600: #174a1d;
    --ink-500: #2e6b34;
    --ink-400: #4c8f52;
    --ink-300: #8fb993;
    --ink-200: #cfe2d0;
    --ink-100: #e7f0e7;
    --ink-50:  #f3f7f3;

    --brass: #b98a2e;
    --brass-600: #9a7123;
    --brass-300: #dcc28a;
    --brass-100: #f6eedb;

    --paper: #f5f7f4;
    --surface: #ffffff;
    --line: #dfe6de;
    --line-strong: #c9d4c8;
    --text: #17221a;
    --muted: #5d6a61;
    --faint: #8a968d;

    --ok: #2e7d32;      --ok-bg: #e3f1e3;
    --info: #22518b;    --info-bg: #e2ebf6;
    --warn: #8a6a10;    --warn-bg: #faf1d6;
    --high: #9a4a0f;    --high-bg: #fbe6d2;
    --bad: #a1291f;     --bad-bg: #f8e1de;
    --grey: #4f5952;    --grey-bg: #eaedea;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(6, 26, 9, .06);
    --shadow: 0 6px 20px -8px rgba(6, 26, 9, .18);
    --shadow-lg: 0 24px 60px -20px rgba(6, 26, 9, .35);
    --sidebar-w: 268px;
    --sidebar-w-collapsed: 76px;
    --topbar-h: 62px;

    --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Rajdhani', 'IBM Plex Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --bs-primary: var(--ink);
    --bs-primary-rgb: 12, 51, 17;
    --bs-link-color: var(--ink-500);
    --bs-link-color-rgb: 46, 107, 52;
    --bs-link-hover-color: var(--ink);
    --bs-body-font-family: var(--font-body);
    --bs-body-color: var(--text);
    --bs-border-color: var(--line);
    --bs-border-radius: var(--radius-sm);
    --bs-focus-ring-color: rgba(46, 107, 52, .25);
}

html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--text);
    font-size: .925rem;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .font-display { font-family: var(--font-display); font-weight: 700; letter-spacing: .01em; color: var(--ink-800); }
.mono, code, kbd { font-family: var(--font-mono); }
a { text-decoration: none; }
::selection { background: var(--brass-300); color: var(--ink-900); }
[x-cloak] { display: none !important; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn { font-weight: 600; border-radius: var(--radius-sm); letter-spacing: .01em; }
.btn-sm { font-size: .8rem; }
.btn-ink { background: var(--ink); border: 1px solid var(--ink); color: #fff; }
.btn-ink:hover, .btn-ink:focus { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }
.btn-ink:disabled { background: var(--ink-400); border-color: var(--ink-400); }
.btn-brass { background: var(--brass); border: 1px solid var(--brass); color: #fff; }
.btn-brass:hover { background: var(--brass-600); border-color: var(--brass-600); color: #fff; }
.btn-outline-ink { border: 1px solid var(--line-strong); color: var(--ink-700); background: #fff; }
.btn-outline-ink:hover { border-color: var(--ink); background: var(--ink-50); color: var(--ink); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--ink-50); color: var(--ink); }
.btn-icon { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.btn-danger-soft { background: var(--bad-bg); color: var(--bad); border: 1px solid transparent; }
.btn-danger-soft:hover { background: var(--bad); color: #fff; }

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

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(185, 138, 46, .10), transparent 60%),
        linear-gradient(180deg, var(--ink-700) 0%, var(--ink-800) 55%, var(--ink-900) 100%);
    color: #d9e7da;
    z-index: 1030;
    transition: width .22s ease, flex-basis .22s ease, transform .22s ease;
}
.sidebar::after { /* hairline blueprint grid */
    content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
    background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 28px 28px;
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.05rem 1.2rem .95rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .mark { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; background: rgba(255,255,255,.06); display: grid; place-items: center; border: 1px solid rgba(220,194,138,.35); }
.sidebar-brand .mark img, .sidebar-brand .mark svg { width: 30px; height: 30px; }
.sidebar-brand .name { font-family: var(--font-display); font-weight: 700; font-size: 1.42rem; letter-spacing: .12em; color: #fff; line-height: 1; }
.sidebar-brand .sub { font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: var(--brass-300); margin-top: .2rem; white-space: nowrap; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .6rem 0 1rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-group-label {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    font-size: .63rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(217, 231, 218, .55);
    padding: 1rem 1.25rem .35rem; background: none; border: 0; cursor: pointer;
}
.nav-group-label i { font-size: .7rem; transition: transform .2s; }
.nav-group-label.collapsed i { transform: rotate(-90deg); }
.nav-item-link {
    display: flex; align-items: center; gap: .75rem;
    margin: 1px .7rem; padding: .55rem .75rem; border-radius: 9px;
    color: #cfe0d0; font-size: .875rem; font-weight: 500; position: relative;
    transition: background .15s, color .15s;
}
.nav-item-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; color: rgba(207, 224, 208, .75); }
.nav-item-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item-link.active { background: linear-gradient(90deg, rgba(185,138,46,.24), rgba(185,138,46,.06)); color: #fff; }
.nav-item-link.active::before { content: ''; position: absolute; left: -.7rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brass); }
.nav-item-link.active i { color: var(--brass-300); }
.nav-item-link .nav-badge { margin-left: auto; font-size: .66rem; font-weight: 700; padding: .12rem .45rem; border-radius: 99px; background: rgba(185,138,46,.25); color: #f3dfb5; }
.sidebar-foot { padding: .85rem 1.2rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .7rem; color: rgba(217,231,218,.6); }
.sidebar-foot .iso-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem; border: 1px solid rgba(220,194,138,.35); border-radius: 99px; color: var(--brass-300); font-family: var(--font-mono); font-size: .65rem; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .label, body.sidebar-collapsed .sidebar .sub, body.sidebar-collapsed .sidebar .name,
body.sidebar-collapsed .nav-group-label span, body.sidebar-collapsed .nav-group-label i, body.sidebar-collapsed .nav-badge, body.sidebar-collapsed .sidebar-foot .foot-text { display: none; }
body.sidebar-collapsed .nav-item-link { justify-content: center; padding: .6rem; }
body.sidebar-collapsed .nav-group-label { padding: .6rem 0 .2rem; justify-content: center; }
body.sidebar-collapsed .nav-group-label::before { content: ''; width: 22px; height: 1px; background: rgba(255,255,255,.15); }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: .5rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: var(--topbar-h); position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
    background: rgba(255,255,255,.86); backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar .crumbs { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: .45rem; white-space: nowrap; overflow: hidden; }
.topbar .crumbs strong { color: var(--ink-700); font-weight: 600; }
.search-trigger {
    display: flex; align-items: center; gap: .6rem; min-width: 280px; max-width: 420px; flex: 1;
    padding: .45rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper);
    color: var(--faint); font-size: .85rem; cursor: pointer; transition: border-color .15s, background .15s;
}
.search-trigger:hover { border-color: var(--ink-300); background: #fff; }
.search-trigger kbd { margin-left: auto; font-size: .68rem; padding: .1rem .4rem; background: #fff; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); }
.topbar-clock { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); white-space: nowrap; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: 0 0 auto;
    background: linear-gradient(135deg, var(--ink-500), var(--ink-700)); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: .85rem; letter-spacing: .04em;
}
.avatar-sm { width: 26px; height: 26px; font-size: .68rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }
.user-menu-btn { display: flex; align-items: center; gap: .6rem; border: 0; background: transparent; padding: .25rem .4rem; border-radius: 10px; }
.user-menu-btn:hover { background: var(--ink-50); }
.user-menu-btn .who { text-align: left; line-height: 1.15; }
.user-menu-btn .who .n { font-weight: 600; font-size: .84rem; color: var(--text); }
.user-menu-btn .who .r { font-size: .7rem; color: var(--muted); }
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--brass); color: #fff; font-size: .6rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }

.content { padding: 1.5rem 1.75rem 3rem; max-width: 1680px; width: 100%; }

/* ── Page header ───────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.35rem; }
.page-head .eyebrow { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--brass-600); margin-bottom: .25rem; }
.page-head h1 { font-size: 1.85rem; margin: 0; line-height: 1.1; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: .3rem; }
.clause-chip {
    display: inline-flex; align-items: center; gap: .25rem; font-family: var(--font-mono); font-size: .66rem; font-weight: 600;
    padding: .14rem .45rem; border-radius: 5px; background: var(--ink-50); color: var(--ink-600); border: 1px solid var(--ink-200);
}
.clause-chip.new { background: var(--brass-100); color: var(--brass-600); border-color: var(--brass-300); }

/* ── Cards / panels ────────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); }
.panel-head h3, .panel-head .title { font-size: 1.05rem; margin: 0; color: var(--ink-800); display: flex; align-items: center; gap: .5rem; }
.panel-head .title i { color: var(--ink-500); }
.panel-head .hint { font-size: .75rem; color: var(--muted); }
.panel-body { padding: 1.1rem; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: .7rem 1.1rem; border-top: 1px solid var(--line); background: var(--ink-50); border-radius: 0 0 var(--radius) var(--radius); }
.card { border-color: var(--line); border-radius: var(--radius); }

/* KPI tiles */
.kpi { position: relative; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: 100%; transition: transform .15s, box-shadow .15s; }
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi .k-label { font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: .35rem; padding-right: 40px; min-height: 2.1em; line-height: 1.15; }
.kpi .k-value { font-family: var(--font-display); font-weight: 700; font-size: 2.1rem; line-height: 1.05; color: var(--ink-800); margin-top: .35rem; }
.kpi .k-value small { font-size: .95rem; color: var(--muted); font-weight: 600; margin-left: .15rem; }
.kpi .k-foot { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: .15rem .5rem; margin-top: .5rem; font-size: .72rem; color: var(--muted); }
.kpi .k-foot .mono { white-space: nowrap; }
.kpi .k-bar { height: 5px; background: var(--ink-50); border-radius: 99px; overflow: hidden; margin-top: .55rem; }
.kpi .k-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--ink-500); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.kpi.tone-ok .k-bar > span { background: var(--ok); }
.kpi.tone-warn .k-bar > span { background: #d9a520; }
.kpi.tone-bad .k-bar > span { background: var(--bad); }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line-strong); }
.kpi.tone-ok::before { background: var(--ok); }
.kpi.tone-warn::before { background: #d9a520; }
.kpi.tone-bad::before { background: var(--bad); }
.kpi.tone-ink::before { background: var(--ink); }
.kpi .k-icon { position: absolute; right: .8rem; top: .8rem; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--ink-50); color: var(--ink-500); font-size: 1.05rem; }

.metric-line { display: flex; align-items: center; justify-content: space-between; padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .86rem; }
.metric-line:last-child { border-bottom: 0; }
.metric-line .v { font-family: var(--font-mono); font-weight: 600; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table { --bs-table-bg: transparent; margin-bottom: 0; font-size: .86rem; }
.table > :not(caption) > * > * { padding: .6rem .85rem; border-color: var(--line); }
.table thead th {
    font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600;
    background: var(--ink-50); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.table-hover > tbody > tr:hover > * { background: #f7faf6; }
.table tbody tr.row-link { cursor: pointer; }
.table tbody tr.is-selected > * { background: var(--brass-100) !important; }
.table-wrap { overflow: auto; max-height: calc(100vh - 290px); border-radius: 0 0 var(--radius) var(--radius); }
.table-wrap.tall { max-height: none; }
.cell-sub { display: block; font-size: .74rem; color: var(--muted); margin-top: .1rem; }
.cell-clip { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Chips, badges, stamps ─────────────────────────────────────────────── */
.id-chip {
    display: inline-block; font-family: var(--font-mono); font-size: .76rem; font-weight: 600; letter-spacing: .03em;
    padding: .12rem .45rem; border-radius: 5px; background: var(--ink-50); color: var(--ink-700); border: 1px solid var(--ink-200); white-space: nowrap;
}
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 600; letter-spacing: .02em; padding: .2rem .55rem; border-radius: 99px; white-space: nowrap; line-height: 1.3; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill.no-dot::before { display: none; }
.tone-ok { background: var(--ok-bg); color: var(--ok); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-high { background: var(--high-bg); color: var(--high); }
.tone-bad { background: var(--bad-bg); color: var(--bad); }
.tone-grey { background: var(--grey-bg); color: var(--grey); }
.tone-ink { background: var(--ink); color: #fff; }
.tone-brass { background: var(--brass-100); color: var(--brass-600); }
.kpi.tone-ok, .kpi.tone-warn, .kpi.tone-bad, .kpi.tone-ink { background: var(--surface); color: inherit; }

.rating { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 .4rem; border-radius: 6px; font-family: var(--font-display); font-weight: 700; font-size: .95rem; }
.rating.low { background: #dcebdc; color: #1e5c24; }
.rating.medium { background: #f6ecc7; color: #7d5f0c; }
.rating.high { background: #f4d6b6; color: #8a4410; }
.rating.critical { background: #efc2bd; color: #8e1f16; }
.rating-label { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.stamp {
    display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 24px; padding: 0 .45rem;
    font-family: var(--font-mono); font-weight: 700; font-size: .74rem; letter-spacing: .06em;
    color: #1f3f86; border: 1.5px solid #1f3f86; border-radius: 4px; transform: rotate(-3deg); background: rgba(31,63,134,.04);
}
.stamp.q { color: #8e1f16; border-color: #8e1f16; background: rgba(142,31,22,.04); }
.stamp.e { color: #5a3d8a; border-color: #5a3d8a; background: rgba(90,61,138,.04); }
.stamp.a { color: var(--ink-600); border-color: var(--ink-600); background: rgba(12,51,17,.04); }
.stamp.none { color: var(--faint); border-style: dashed; border-color: var(--line-strong); transform: none; }
.min-w-0 { min-width: 0; }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; overflow-x: auto; scrollbar-width: none; }
.tabs .tab {
    position: relative; padding: .65rem .9rem; font-size: .86rem; font-weight: 600; color: var(--muted);
    background: none; border: 0; white-space: nowrap; display: inline-flex; align-items: center; gap: .45rem;
}
.tabs .tab:hover { color: var(--ink-700); }
.tabs .tab.active { color: var(--ink-800); }
.tabs .tab.active::after { content: ''; position: absolute; left: .6rem; right: .6rem; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brass); }
.tabs .tab .count { font-family: var(--font-mono); font-size: .68rem; padding: .05rem .4rem; border-radius: 99px; background: var(--ink-50); color: var(--ink-600); }
.tabs .tab.active .count { background: var(--brass-100); color: var(--brass-600); }
.segmented { display: inline-flex; padding: 3px; background: var(--ink-50); border: 1px solid var(--line); border-radius: 10px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: .3rem .7rem; font-size: .78rem; font-weight: 600; color: var(--muted); border-radius: 7px; }
.segmented button.active { background: #fff; color: var(--ink-800); box-shadow: var(--shadow-sm); }

/* ── Toolbar / filters ─────────────────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem 1.1rem; border-bottom: 1px solid var(--line); }
.toolbar .search { position: relative; flex: 1 1 240px; max-width: 360px; }
.toolbar .search i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--faint); }
.toolbar .search input { padding-left: 2rem; }
.form-control, .form-select { border-color: var(--line-strong); border-radius: var(--radius-sm); font-size: .88rem; }
.form-control:focus, .form-select:focus { border-color: var(--ink-400); box-shadow: 0 0 0 .2rem rgba(46,107,52,.15); }
.form-control-sm, .form-select-sm { font-size: .82rem; }
.form-label { font-size: .76rem; font-weight: 600; color: var(--ink-700); margin-bottom: .3rem; }
.form-text { font-size: .72rem; color: var(--faint); }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-switch .form-check-input:focus { border-color: var(--ink-300); }
.req::after { content: ' *'; color: var(--bad); }
.field-section { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--brass-600); border-bottom: 1px solid var(--line); padding-bottom: .35rem; margin: 1.1rem 0 .8rem; }
.field-section:first-child { margin-top: 0; }
.star-2026 { color: var(--brass); font-size: .8em; }

/* ── Modal & drawer (Livewire controlled) ──────────────────────────────── */
.lw-backdrop { position: fixed; inset: 0; background: rgba(6, 26, 9, .48); backdrop-filter: blur(2px); z-index: 1060; animation: fadeIn .18s ease; }
.lw-backdrop.over { z-index: 1070; }  /* a modal opened from a drawer dims the drawer */
.lw-modal { position: fixed; inset: 0; z-index: 1075; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 4.5vh 1rem; }
.lw-modal .dialog { width: 100%; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); animation: rise .22s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; max-height: 91vh; }
.lw-modal .dialog.sm { max-width: 460px; } .lw-modal .dialog.md { max-width: 640px; } .lw-modal .dialog.lg { max-width: 860px; } .lw-modal .dialog.xl { max-width: 1140px; }
.lw-modal .dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.35rem .9rem; border-bottom: 1px solid var(--line); }
.lw-modal .dialog-head h3 { font-size: 1.3rem; margin: 0; }
.lw-modal .dialog-head .sub { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.lw-modal .dialog-body { padding: 1.2rem 1.35rem; overflow-y: auto; }
.lw-modal .dialog-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .85rem 1.35rem; border-top: 1px solid var(--line); background: var(--ink-50); border-radius: 0 0 16px 16px; }
.lw-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1065; width: min(760px, 100vw); background: #fff; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slideIn .25s cubic-bezier(.2,.8,.2,1); }
.lw-drawer.wide { width: min(1040px, 100vw); }
.lw-drawer .drawer-head { padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--ink-50), #fff); }
.lw-drawer .drawer-body { flex: 1; overflow-y: auto; padding: 1.2rem 1.35rem; }
.lw-drawer .drawer-foot { padding: .8rem 1.35rem; border-top: 1px solid var(--line); background: var(--ink-50); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Definition lists / detail views ───────────────────────────────────── */
.dl { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: .45rem 1rem; font-size: .86rem; margin: 0; }
.dl dt { color: var(--muted); font-weight: 500; font-size: .78rem; }
.dl dd { margin: 0; color: var(--text); word-break: break-word; }
.detail-block { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem .95rem; background: #fff; }
.detail-block + .detail-block { margin-top: .75rem; }
.detail-block .db-label { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: .35rem; display: flex; align-items: center; gap: .35rem; }
.prose-sm { font-size: .87rem; line-height: 1.55; white-space: pre-line; }

/* Cause → Event → Consequence chain (risk statement) */
.chain { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: .5rem; align-items: stretch; }
.chain .link { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .65rem .75rem; background: #fff; font-size: .84rem; }
.chain .link .db-label { margin-bottom: .25rem; }
.chain .arrow { display: grid; place-items: center; color: var(--brass); font-size: 1.2rem; }
@media (max-width: 900px) { .chain { grid-template-columns: 1fr; } .chain .arrow { transform: rotate(90deg); } }

/* ── Heat map ──────────────────────────────────────────────────────────── */
.heatmap { display: grid; grid-template-columns: 28px repeat(5, 1fr); gap: 4px; }
.heatmap .hm-cell { aspect-ratio: 1.35; border-radius: 7px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; cursor: pointer; border: 2px solid transparent; transition: transform .12s, border-color .12s; position: relative; }
.heatmap .hm-cell:hover { transform: scale(1.04); border-color: var(--ink-700); }
.heatmap .hm-cell.active { border-color: var(--ink-900); box-shadow: 0 0 0 2px #fff inset; }
.heatmap .hm-cell.zero { color: transparent; }
.heatmap .hm-cell .sc { position: absolute; top: 3px; right: 6px; font-family: var(--font-mono); font-size: .56rem; font-weight: 500; opacity: .55; color: #000; }
.heatmap .axis { font-family: var(--font-mono); font-size: .66rem; color: var(--muted); display: grid; place-items: center; }
.hm-low { background: #dcebdc; color: #1e5c24; } .hm-medium { background: #f6ecc7; color: #7d5f0c; }
.hm-high { background: #f4d6b6; color: #8a4410; } .hm-critical { background: #efc2bd; color: #8e1f16; }

/* ── Traveller (digital F004-A) ────────────────────────────────────────── */
.traveller-steps { position: relative; }
.t-step { display: grid; grid-template-columns: 64px 1fr auto; gap: .9rem; padding: .85rem 0; border-bottom: 1px dashed var(--line); position: relative; }
.t-step:last-child { border-bottom: 0; }
.t-step .op { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--ink-700); text-align: center; line-height: 1; padding-top: .15rem; }
.t-step .op small { display: block; font-family: var(--font-mono); font-size: .58rem; letter-spacing: .12em; color: var(--muted); font-weight: 500; }
.t-step.done .op { color: var(--ok); }
.t-step.running { background: linear-gradient(90deg, rgba(185,138,46,.08), transparent); border-radius: 8px; }
.t-step .t-name { font-weight: 600; }
.t-step .t-meta { font-size: .76rem; color: var(--muted); margin-top: .15rem; display: flex; flex-wrap: wrap; gap: .25rem .9rem; }

.progress-thin { height: 6px; background: var(--ink-50); border-radius: 99px; overflow: hidden; }
.progress-thin > span { display: block; height: 100%; background: linear-gradient(90deg, var(--ink-500), var(--ink-400)); border-radius: 99px; }

/* Kanban board (work orders) */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: .9rem; overflow-x: auto; padding-bottom: .5rem; }
.board-col { background: var(--ink-50); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 280px); }
.board-col .col-head { padding: .7rem .85rem; display: flex; justify-content: space-between; align-items: center; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--ink-700); border-bottom: 1px solid var(--line); }
.board-col .col-body { padding: .6rem; overflow-y: auto; display: flex; flex-direction: column; gap: .55rem; }
.wo-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; cursor: pointer; transition: box-shadow .15s, transform .15s; border-left: 3px solid var(--ink-300); }
.wo-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.wo-card.late { border-left-color: var(--bad); }
.wo-card.soon { border-left-color: #d9a520; }
.wo-card.rush { border-left-color: var(--brass); }

/* Skills matrix */
.matrix { border-collapse: separate; border-spacing: 0; font-size: .8rem; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line); padding: .35rem .45rem; background: #fff; }
.matrix thead th { position: sticky; top: 0; background: var(--ink-50); z-index: 2; font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); vertical-align: bottom; }
.matrix thead th.rot { height: 120px; white-space: nowrap; }
.matrix thead th.rot > div { transform: rotate(-55deg); transform-origin: left bottom; width: 26px; translate: 14px -6px; }
.matrix td.sticky, .matrix th.sticky { position: sticky; left: 0; z-index: 1; }
.matrix thead th.sticky { z-index: 3; }
.lvl { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; margin: auto; cursor: pointer; }
.lvl-0 { background: #f0f2f0; color: #a0a8a2; } .lvl-1 { background: #f8e1de; color: #97291f; } .lvl-2 { background: #faf1d6; color: #8a6a10; }
.lvl-3 { background: #dcebdc; color: #1e5c24; } .lvl-4 { background: var(--ink-600); color: #fff; }
.lvl.gap { box-shadow: inset 0 0 0 2px var(--bad); }

/* Empty state */
.empty { text-align: center; padding: 2.8rem 1rem; color: var(--muted); }
.empty .e-icon { width: 58px; height: 58px; margin: 0 auto .8rem; border-radius: 16px; display: grid; place-items: center; background: var(--ink-50); color: var(--ink-400); font-size: 1.6rem; border: 1px dashed var(--ink-200); }
.empty h4 { font-size: 1.1rem; color: var(--ink-700); margin-bottom: .25rem; }
.empty p { font-size: .85rem; max-width: 420px; margin: 0 auto .9rem; }

/* Alerts / callouts */
.callout { border-radius: var(--radius-sm); padding: .75rem .95rem; border: 1px solid; font-size: .84rem; display: flex; gap: .6rem; align-items: flex-start; }
.callout i { font-size: 1.05rem; margin-top: .05rem; }
.callout.info { background: var(--info-bg); border-color: #c4d6ee; color: #1d4677; }
.callout.warn { background: var(--warn-bg); border-color: #efdca2; color: #6e5410; }
.callout.bad { background: var(--bad-bg); border-color: #efc2bd; color: #7e2018; }
.callout.ok { background: var(--ok-bg); border-color: #c3e0c4; color: #1e5c24; }
.callout.brass { background: var(--brass-100); border-color: var(--brass-300); color: #6b4f16; }

/* Command palette */
.palette { position: fixed; inset: 0; z-index: 1080; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: rgba(6,26,9,.45); backdrop-filter: blur(3px); }
.palette .box { width: min(640px, 94vw); background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .18s ease; }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 1.05rem; padding: 1rem 1.1rem 1rem 2.8rem; }
.palette input:focus { box-shadow: none; }
.palette .p-icon { position: absolute; left: 1.1rem; top: 1.05rem; color: var(--faint); font-size: 1.1rem; }
.palette .results { max-height: 52vh; overflow-y: auto; padding: .4rem; }
.palette .group-label { font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: .6rem .7rem .25rem; }
.palette .result { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 9px; color: var(--text); }
.palette .result:hover, .palette .result.active { background: var(--ink-50); }
.palette .result i { color: var(--ink-500); width: 1.2rem; text-align: center; }
.palette .result .meta { margin-left: auto; font-size: .72rem; color: var(--faint); }

/* Toasts */
.toast-stack { position: fixed; right: 1.2rem; top: 74px; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; }
.toast-item { min-width: 280px; max-width: 420px; background: var(--ink-800); color: #fff; padding: .75rem 1rem; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: .6rem; align-items: flex-start; font-size: .86rem; animation: rise .2s ease; }
.toast-item.error { background: #7e2018; } .toast-item.warning { background: #7d5f0c; }
.toast-item i { font-size: 1.1rem; color: var(--brass-300); }

/* Ring gauge */
.ring { --p: 0; --c: var(--ok); width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--ink-50) 0); position: relative; }
.ring::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: #fff; }
.ring span { position: relative; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--ink-800); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 .9rem .6rem; font-size: .84rem; }
.timeline li::before { content: ''; position: absolute; left: -1.53rem; top: .25rem; width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2px solid var(--ink-400); }
.timeline li .when { font-family: var(--font-mono); font-size: .7rem; color: var(--faint); }

.bar-track { background: var(--ink-50); border-radius: 99px; height: 8px; overflow: hidden; display: flex; }
.bar-track > span { height: 100%; }

.link-ink { color: var(--ink-600); font-weight: 600; }
.link-ink:hover { color: var(--ink); text-decoration: underline; }
.text-ink { color: var(--ink) !important; } .text-brass { color: var(--brass-600) !important; } .text-muted-2 { color: var(--muted) !important; } .text-faint { color: var(--faint) !important; }
.bg-ink { background: var(--ink) !important; } .bg-mist { background: var(--ink-50) !important; }
.fs-xs { font-size: .72rem !important; } .fs-sm { font-size: .82rem !important; }
.gap-xs { gap: .35rem !important; }
.cursor-pointer { cursor: pointer; }
.w-fit { width: fit-content; }
.hr-dash { border-top: 1px dashed var(--line); margin: 1rem 0; }
.pagination { --bs-pagination-color: var(--ink-600); --bs-pagination-active-bg: var(--ink); --bs-pagination-active-border-color: var(--ink); --bs-pagination-font-size: .8rem; margin: 0; }
.panel .pager { padding: .7rem 1.1rem; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .78rem; color: var(--muted); }
/* Livewire's bootstrap links() repeats "Showing x–y of z" — ours is already printed */
.pager nav > .d-sm-flex > div:first-child { display: none; }
.pager nav .pagination { margin: 0; }
[wire\:loading].loading-bar, .loading-bar { position: fixed; top: 0; left: 0; height: 2px; width: 100%; background: linear-gradient(90deg, transparent, var(--brass), transparent); background-size: 200% 100%; animation: slide 1s linear infinite; z-index: 2000; }
@keyframes slide { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.fade-up { animation: rise .35s cubic-bezier(.2,.8,.2,1) both; }

/* ── Auth ──────────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); background: #fff; }
.auth-art { position: relative; overflow: hidden; color: #e3eee4; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(110% 80% at 10% 0%, rgba(185,138,46,.18), transparent 55%), linear-gradient(160deg, var(--ink-700), var(--ink-900)); }
.auth-art::before { content: ''; position: absolute; inset: 0; opacity: .6;
    background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
    background-size: 36px 36px; mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 75%); }
.auth-art > * { position: relative; }
.auth-art h1 { color: #fff; font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1.02; max-width: 12ch; }
.auth-art .lede { color: #c7dbc9; max-width: 44ch; }
.auth-art .facts { display: grid; grid-template-columns: repeat(3, auto); gap: 2rem; }
.auth-art .facts .v { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: #fff; line-height: 1; }
.auth-art .facts .l { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brass-300); margin-top: .3rem; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem; }
.auth-form .box { width: 100%; max-width: 400px; }
.auth-form h2 { font-size: 1.9rem; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: .45rem; }
.pw-meter span { height: 4px; border-radius: 99px; background: var(--line); }
.pw-rules { list-style: none; padding: 0; margin: .6rem 0 0; font-size: .76rem; color: var(--muted); display: grid; grid-template-columns: 1fr 1fr; gap: .15rem .75rem; }
.pw-rules li.ok { color: var(--ok); }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ── Print (traveller / reports) ───────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .no-print, .toast-stack, .lw-backdrop { display: none !important; }
    .content { padding: 0; }
    body { background: #fff; }
    .panel { box-shadow: none; }
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .table-wrap { max-height: none; }   /* no scroll-inside-scroll on phones and tablets */
    .sidebar { position: fixed; left: 0; transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    body.sidebar-open::after { content: ''; position: fixed; inset: 0; background: rgba(6,26,9,.4); z-index: 1025; }
    .content { padding: 1.1rem .9rem 2.5rem; }
    .search-trigger { min-width: 0; }
    .search-trigger span, .search-trigger kbd { display: none; }
    .topbar-clock { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
