/* ==========================================================================
   Logistics & Operations Command Center — dark dashboard theme
   ========================================================================== */

:root {
    --bg:            #070b14;
    --bg-elevated:   #0b1120;
    --surface:       #0f1726;
    --surface-sunk:  #0a1120;
    --border:        #1d2840;
    --border-soft:   #162034;

    --text:          #e9eefb;
    --text-dim:      #93a3bf;
    --text-muted:    #6b7b96;

    --blue:          #3b82f6;
    --blue-strong:   #2563eb;
    --cyan:          #22d3ee;
    --amber:         #f59e0b;
    --green:         #4ade80;
    --rose:          #fb7185;
    --violet:        #a78bfa;

    --radius:        14px;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    border: 0;
    background: none;
}

.shell { max-width: 1440px; margin: 0 auto; padding: 0 28px 48px; }

/* Accent helpers -----------------------------------------------------------
   Each block that needs a colour sets `--accent`, so the component CSS never
   has to branch per colour. */
.accent-blue   { --accent: var(--blue); }
.accent-cyan   { --accent: var(--cyan); }
.accent-amber  { --accent: var(--amber); }
.accent-green  { --accent: var(--green); }
.accent-rose   { --accent: var(--rose); }
.accent-violet { --accent: var(--violet); }

.tone-green { color: var(--green); }
.tone-blue  { color: var(--blue); }
.tone-rose  { color: var(--rose); }
.tone-amber { color: var(--amber); }

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 0 16px;
    flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand__logo {
    width: 44px;
    height: 44px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(140deg, var(--blue-strong), var(--cyan));
    font-weight: 800;
    font-size: 16px;
    letter-spacing: .02em;
    color: #fff;
    box-shadow: 0 6px 18px rgba(37, 99, 235, .35);
}

.brand__eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 3px;
}

.brand__company {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--cyan);
}

.brand__title {
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -.01em;
}

.pill-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(74, 222, 128, .35);
    background: rgba(74, 222, 128, .12);
    color: var(--green);
    font-size: 11px;
    font-weight: 700;
}

.pill-live::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, .18);
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.sync-chip {
    padding: 9px 16px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-sunk);
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
}

.btn:active { transform: translateY(1px); }

.btn--ghost {
    border: 1px solid var(--border);
    background: #121b2d;
    color: var(--text);
}

.btn--ghost:hover { background: #17233a; border-color: #2b3a58; }

.btn--primary {
    background: linear-gradient(135deg, var(--blue-strong), #4f8bf7);
    color: #fff;
    font-weight: 700;
    padding: 11px 18px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .3);
}

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

.btn .chev { transition: transform .18s ease; }
.btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* Dropdown ---------------------------------------------------------------- */

.dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 40;
    width: 262px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid #23304a;
    background: var(--bg-elevated);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}

.dropdown[hidden] { display: none; }

.dropdown__head {
    padding-bottom: 11px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-soft);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.dropdown__item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    width: 100%;
    padding: 9px 8px;
    border-radius: 9px;
    text-align: left;
    transition: background .14s ease;
}

.dropdown__item:hover { background: #16203a; }

.dropdown__dot {
    width: 7px;
    height: 7px;
    margin-top: 6px;
    flex: none;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.dropdown__title { font-size: 13px; font-weight: 700; }
.dropdown__desc  { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }

/* Submenu entries whose form is not built yet. */
.dropdown__item.is-soon { opacity: .5; cursor: default; }
.dropdown__item.is-soon:hover { background: none; }

.dropdown__soon {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 5px;
    background: #1d2840;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ==========================================================================
   Tab bar
   ========================================================================== */

.tabs {
    display: flex;
    gap: 6px;
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--border-soft);
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    display: flex;
    align-items: center;
    gap: 11px;
    flex: none;
    padding: 12px 18px;
    border-radius: 11px;
    color: var(--text-dim);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.25;
    white-space: pre-line;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.tab:hover { background: #121c2e; color: var(--text); }

.tab svg { flex: none; opacity: .85; }

.tab.is-active {
    background: linear-gradient(135deg, var(--blue-strong), #4a85f5);
    color: #fff;
    box-shadow: 0 8px 22px rgba(37, 99, 235, .35);
}

.tab.is-active svg { opacity: 1; }

/* ==========================================================================
   Stat cards
   ========================================================================== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(226px, 1fr));
    gap: 16px;
    padding: 22px 0 6px;
}

.stat {
    position: relative;
    padding: 20px 16px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    overflow: hidden;
}

/* Coloured cap along the top edge of the card. */
.stat::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--accent);
}

.stat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.stat__label {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.stat__badge {
    flex: none;
    padding: 4px 9px;
    border-radius: 7px;
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 700;
}

.stat__value {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 10px;
}

.stat__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Keep the footer on one line; the description truncates before the status does. */
.stat__foot > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat__foot strong { flex: none; font-weight: 700; }

/* ==========================================================================
   Section panel
   ========================================================================== */

.panel {
    margin-top: 18px;
    padding: 22px 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.panel__title { font-size: 18px; font-weight: 700; margin-bottom: 5px; }
.panel__sub   { font-size: 13px; color: var(--text-muted); }

/* ==========================================================================
   Vehicle cards
   ========================================================================== */

.vehicle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.vehicle {
    padding: 22px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.vehicle__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.vehicle__eyebrow {
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--accent);
}

.vehicle__status {
    flex: none;
    padding: 7px 13px;
    border-radius: 9px;
    border: 1px solid #28364f;
    background: #152133;
    font-size: 12.5px;
    font-weight: 600;
    color: #cfe0ff;
}

.vehicle__name {
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -.01em;
    margin-bottom: 4px;
}

.vehicle__meta { font-size: 13px; color: var(--text-muted); }

.cost {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 16px 0 14px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: var(--surface-sunk);
    overflow: hidden;
}

.cost__col { padding: 14px 18px; }
.cost__col + .cost__col { border-left: 1px solid var(--border-soft); }

.cost__label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }
.cost__value { font-size: 17px; font-weight: 700; }
/* Current-year figure picks up the card's own accent colour. */
.cost__value--accent { color: var(--accent); }

.vehicle__note {
    font-size: 13px;
    line-height: 1.65;
    color: #8d9db9;
}

/* ==========================================================================
   Sparepart Stock Monitoring sheet
   Mirrors the Excel template: kop surat, document meta, one table per rack,
   signature block. Dark on screen, black-on-white when printed.
   ========================================================================== */

.sheet-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.draft-banner {
    margin-top: 12px;
    padding: 11px 16px;
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, .35);
    background: rgba(245, 158, 11, .1);
    color: #f8cd7e;
    font-size: 12.5px;
}

.draft-banner[hidden] { display: none; }

/* Rows added through the form, not yet persisted anywhere. */
.sheet-table tr.is-draft > td { background: rgba(245, 158, 11, .07); }

/* The marker bar goes on the rowspanned NO cell, which already covers the
   whole group — continuation rows get the tint only. */
.sheet-table tr.is-draft.is-group-start > td:first-child {
    box-shadow: inset 2px 0 0 var(--amber);
}

.sheet {
    margin-top: 12px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

/* Rows 1-4 of the sheet: company letterhead.
   Every dimension comes from a custom property the Pengaturan page writes
   inline, so this block never has to know about the settings. */
.sheet__kop {
    display: flex;
    align-items: center;
    gap: var(--kop-gap, 12px);
    padding: var(--kop-pad, 16px) 18px;
    border-bottom: 1px solid var(--border);
}

.sheet__kop[data-divider="off"] { border-bottom: 0; }

/* Canvas mode: logo and text sit at free coordinates inside a fixed band. */
.sheet__kop[data-mode="canvas"] {
    display: block;
    position: relative;
    height: var(--kop-h, 96px);
    padding: 0;
}

.sheet__kop[data-mode="canvas"] .sheet__logo {
    position: absolute;
    left: var(--kop-logo-x, 2%);
    top: var(--kop-logo-y, 20%);
}

.sheet__kop[data-mode="canvas"] .sheet__kop-text {
    position: absolute;
    left: var(--kop-text-x, 22%);
    top: var(--kop-text-y, 24%);
    width: var(--kop-text-w, 70%);
}

.sheet__kop[data-logo="right"] { flex-direction: row-reverse; }

.sheet__kop[data-logo="center"] {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.sheet__kop[data-align="center"] .sheet__kop-text { text-align: center; }
.sheet__kop[data-align="right"]  .sheet__kop-text { text-align: right; }

/* A centred logo stacks above the text, so the text should fill the width. */
.sheet__kop[data-logo="center"] .sheet__kop-text { width: 100%; }

.sheet__logo {
    width: var(--kop-logo-size, 56px);
    height: var(--kop-logo-size, 56px);
    flex: none;
    object-fit: contain;
}

.sheet__logo[hidden] { display: none; }

.sheet__kop-text { min-width: 0; }

.sheet__company {
    font-size: var(--kop-company, 15px);
    font-weight: 800;
    letter-spacing: .01em;
    color: var(--text);
}

.sheet__address {
    font-size: var(--kop-line, 12.5px);
    line-height: 1.45;
    color: var(--text-dim);
}

/* Rows 5-9: meta column on the left, title merged across the rest. */
.sheet__doc {
    display: grid;
    grid-template-columns: minmax(230px, 0.9fr) 2fr;
    border-bottom: 1px solid var(--border);
}

.sheet__meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    margin: 0;
    padding: 14px 18px;
    border-right: 1px solid var(--border);
    font-size: 12px;
}

.sheet__meta dt { color: var(--text-dim); }
.sheet__meta dd { margin: 0; color: var(--text); }

.sheet__title {
    display: grid;
    place-items: center;
    padding: 18px;
    font-size: 23px;
    font-weight: 800;
    letter-spacing: .01em;
    text-align: center;
}

.sheet__meta--tight { align-content: start; }

/* In-place text editing ---------------------------------------------------- */

/*
 * The affordance stays quiet until the pointer is near it: these blocks are a
 * document first and a form second, and an always-on outline would make the
 * sheet look like a form.
 */
.is-editable {
    position: relative;
    border-radius: 6px;
    outline: 1px solid transparent;
    outline-offset: 3px;
    transition: outline-color .14s ease, background .14s ease;
    cursor: text;
}

.is-editable:hover { outline-color: #2b3a58; }
.is-editable:focus-visible { outline: 2px solid var(--blue); }

.is-editable.is-edit-selected,
.is-editable.is-editing {
    outline: 1px solid var(--blue);
    background: rgba(59, 130, 246, .06);
}

.edit-tools {
    position: absolute;
    top: -12px;
    right: -12px;
    z-index: 2;
}

.edit-pencil {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid #2b3a58;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .45);
}

.edit-pencil:hover { filter: brightness(1.1); }

.edit-form { display: grid; gap: 8px; text-align: left; }
.edit-row  { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 8px; }

/* Table cells ------------------------------------------------------------- */

/*
 * A cell cannot carry an outline offset like the header blocks — the table's
 * own borders are already there — so selection is an inset ring instead.
 */
.sheet-table td.is-editable-cell { position: relative; cursor: text; }

.sheet-table td.is-editable-cell:hover { background: #16203a; }
.sheet-table td.is-editable-cell:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

.sheet-table td.is-edit-selected,
.sheet-table td.is-editing {
    box-shadow: inset 0 0 0 1px var(--blue);
    background: rgba(59, 130, 246, .08);
}

/* A value that no longer matches the source workbook. */
.sheet-table td.is-edited::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--amber);
}

.sheet-table td .edit-tools { top: -10px; right: -10px; }
.sheet-table td .edit-pencil { width: 22px; height: 22px; }

.edit-form--cell { gap: 4px; }
.sheet-table td .edit-input { padding: 4px 6px; font-size: 12px; width: 100%; }

/*
 * A date input needs more room than the Tanggal column has — 110px of control
 * in an 86px cell, spilling over Qty. While a cell is being edited its form
 * floats above the table instead: the row keeps its geometry and the column
 * widths do not jump, only the editor overlaps its neighbour.
 */
.sheet-table td.is-editing { overflow: visible; }

.sheet-table td.is-editing .edit-form--cell {
    position: absolute;
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    width: calc(100% - 4px);
    min-width: 150px;
    z-index: 5;
    padding: 5px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .55);
}

.edit-form--cell .edit-error:empty { display: none; }

/* The sheet's own type is large and bold; the editor's is not. */
.edit-input {
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    text-align: left;
}

.edit-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn--xs { padding: 6px 12px; font-size: 12px; }

.edit-error { font-size: 11.5px; color: var(--rose); }

/* The sheet is a document on paper: no editing chrome survives printing. */
@media print {
    .is-editable { outline: 0 !important; background: none !important; }

    .sheet-table td.is-editable-cell,
    .sheet-table td.is-edit-selected,
    .sheet-table td.is-editing,
    .sheet-table td.is-edited {
        box-shadow: none !important;
        background: #fff !important;
    }

    .sheet-table td.is-edited::after { display: none; }
    .edit-tools { display: none !important; }
}

/* Inventory table ---------------------------------------------------------- */

.inv-table { min-width: 940px; }
.inv-table .col-left   { text-align: left; }
.inv-table .col-center { text-align: center; }
.inv-table .col-right  { text-align: right; }
.inv-table td:first-child { font-family: var(--mono); font-size: 11px; }

/* The PO sheet has a title band only — no meta column beside it. */
.sheet__doc--title-only { grid-template-columns: 1fr; }
.sheet__title--sm { font-size: 18px; padding: 14px; }

/* PO table ----------------------------------------------------------------- */

.po-table { min-width: 1280px; }

/* Dates must never wrap mid-value. */
.po-table .col-date { white-space: nowrap; }
.po-table .col-money { text-align: right; white-space: nowrap; }
.po-table .col-tel { white-space: nowrap; }

.po-table tfoot td {
    font-weight: 700;
    border-top: 2px solid var(--border);
}

.po-total td:first-child { border-left-color: transparent; }

/* The sheet is a document, not a responsive layout: it scrolls sideways
   rather than reflowing, so column alignment survives on a phone. */
.sheet-scroll { overflow-x: auto; }

.sheet-table {
    width: 100%;
    min-width: 860px;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 12px;
}

.sheet-table th,
.sheet-table td {
    padding: 6px 8px;
    border: 1px solid var(--border-soft);
    vertical-align: middle;
    overflow-wrap: break-word;
}

.sheet-table th {
    background: var(--surface-sunk);
    font-weight: 700;
    text-align: center;
    color: var(--text);
}

.sheet-table thead th {
    border-color: var(--border);
    border-width: 1px 1px 2px;
}

.sheet-table thead tr:first-child th { border-top-width: 0; }

/* Widths live in the colgroup; these classes only carry alignment. */
.col-no   { text-align: center; }
.col-date { text-align: center; }
.col-qty  { text-align: center; }
.col-rack { text-align: center; }

.sheet-table td.col-no,
.sheet-table td.col-type { background: rgba(255, 255, 255, .015); }

/* A thicker rule marks where a new NO starts. */
.sheet-table tbody tr.is-group-start > td { border-top: 1px solid var(--border); }
.sheet-table tbody tr:hover > td { background: #111b2c; }

/* Rows 111-116: signature block. */
.sheet__sign {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 220px));
    justify-content: end;
    gap: 0;
    padding: 18px;
}

.sign {
    border: 1px solid var(--border-soft);
    text-align: center;
    font-size: 12px;
}

.sign + .sign { border-left: 0; }

.sign__role  { padding: 6px; border-bottom: 1px solid var(--border-soft); }
.sign__space { height: 56px; }
.sign__name  { padding: 6px; font-weight: 700; border-top: 1px solid var(--border-soft); }
.sign__dept  { padding: 6px; border-top: 1px solid var(--border-soft); color: var(--text-dim); }

/* ==========================================================================
   Modal — Input Data Pemeliharaan Armada
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: minmax(0, 1fr); /* the tab strip must scroll, not widen the dialog */

    /*
     * Pinned to the top, not centred. These dialogs differ in height and the
     * tab strip switches between them, so centring would slide the header up
     * and down under the pointer — and only for the short ones, since a dialog
     * taller than the viewport is pushed to the top regardless. The offset is
     * a share of the viewport rather than of the content, so every dialog
     * starts at the same y.
     */
    place-items: start center;
    padding: clamp(24px, 6vh, 64px) 24px;
    overflow-y: auto;
    background: rgba(3, 6, 12, .74);
    backdrop-filter: blur(4px);
}

.modal-overlay[hidden] { display: none; }

/*
 * One width for every dialog. The entry dialogs are a set the tab strip
 * switches between, so a per-dialog width would resize the box under the
 * pointer on every switch.
 */
.modal {
    width: min(1040px, 100%);
    min-width: 0;
    border-radius: 18px;
    border: 1px solid #1f2a42;
    background: #0e1626;
    box-shadow: 0 40px 90px rgba(0, 0, 0, .6);
}

.modal__head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 26px;
    border-bottom: 1px solid var(--border-soft);
}

.modal__icon {
    width: 40px;
    height: 40px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(59, 130, 246, .22);
    color: #8ab4ff;
}

.modal__title { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.modal__sub   { font-size: 13.5px; color: var(--text-muted); margin-top: 3px; }

.modal__close {
    margin-left: auto;
    width: 36px;
    height: 36px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--text-dim);
    transition: background .15s ease, color .15s ease;
}

.modal__close:hover { background: #1a2437; color: #fff; }

.modal__tabs {
    display: flex;
    gap: 6px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-soft);
    overflow-x: auto;
    scrollbar-width: none;
}

.modal__tabs::-webkit-scrollbar { display: none; }

.modal-tab {
    flex: 1 1 0;
    min-width: 118px;
    padding: 11px 10px;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
    line-height: 1.3;
    color: var(--text-dim);
    white-space: pre-line;
    transition: background .15s ease, color .15s ease;
}

.modal-tab:hover { background: #16203a; color: var(--text); }

.modal-tab.is-active {
    background: var(--blue);
    color: #fff;
    font-weight: 700;
}

.modal__body { padding: 30px 26px; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 22px;
}

.field--full { grid-column: 1 / -1; }

.field__label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 9px;
}

.control {
    width: 100%;
    padding: 13px 15px;
    border-radius: 10px;
    border: 1px solid #22304a;
    background: #121b2c;
    color: var(--text);
    font-family: inherit;
    font-size: 14.5px;
    color-scheme: dark; /* keeps the native date picker on the dark theme */
    transition: border-color .15s ease, box-shadow .15s ease;
}

.control::placeholder { color: #5f6e88; }

.control:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

select.control {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none' stroke='%2393a3bf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.modal__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 18px 26px;
    border-top: 1px solid var(--border-soft);
}

.modal__foot-note {
    margin-right: auto;
    font-size: 12px;
    color: var(--text-muted);
}


/* Required marker and per-field help -------------------------------------- */

.req { color: var(--rose); }

.field__hint {
    margin-top: 5px;
    font-size: 11.5px;
    color: var(--text-muted);
}

.control[aria-invalid="true"] {
    border-color: var(--rose);
    box-shadow: 0 0 0 3px rgba(251, 113, 133, .15);
}

.control--short { max-width: 200px; }

.control--area {
    min-height: 76px;
    resize: vertical;
    line-height: 1.5;
}

.form-alert {
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(251, 113, 133, .4);
    background: rgba(251, 113, 133, .1);
    color: #ffc2cc;
    font-size: 12.5px;
}

.form-alert[hidden] { display: none; }
.form-alert ul { margin: 0; padding-left: 18px; }
.form-alert li + li { margin-top: 3px; }

/* Fieldsets ---------------------------------------------------------------- */

.fieldset {
    margin: 0 0 22px;
    padding: 0;
    border: 0;
}

.fieldset__legend {
    padding: 0;
    margin-bottom: 12px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.fieldset__note {
    margin: -6px 0 14px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-muted);
}

/* Repeatable detail rows --------------------------------------------------- */

.entry-row {
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-sunk);
}

.entry-row__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.entry-row__index {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.entry-row__remove {
    padding: 4px 10px;
    border-radius: 7px;
    border: 1px solid rgba(251, 113, 133, .35);
    color: var(--rose);
    font-size: 12px;
    font-weight: 600;
}

.entry-row__remove:hover { background: rgba(251, 113, 133, .12); }
.entry-row__remove[hidden] { display: none; }

.entry-row__cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 14px 0;
}

.entry-col {
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
}

.entry-col__title {
    margin-bottom: 12px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-dim);
}

.entry-col__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn--block {
    width: 100%;
    justify-content: center;
    border-style: dashed;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablets and small laptops ------------------------------------------------ */

@media (max-width: 1000px) {
    .shell { padding: 0 20px 40px; }
    .topbar { align-items: flex-start; }
    .topbar__actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
    .sync-chip { order: 3; width: 100%; text-align: center; }
    .brand__title { font-size: 20px; }
    .vehicle-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .form-grid { grid-template-columns: 1fr; }
    .modal-tab { min-width: 108px; font-size: 13px; }
}

/* Phones ------------------------------------------------------------------- */

@media (max-width: 640px) {
    .shell {
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
        padding-bottom: calc(32px + env(safe-area-inset-bottom));
    }

    /* Topbar stacks: brand, then a full-width action row. */
    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding-top: calc(16px + env(safe-area-inset-top));
    }

    .brand { gap: 12px; }
    .brand__logo { width: 38px; height: 38px; border-radius: 11px; font-size: 14px; }
    .brand__eyebrow { flex-wrap: wrap; gap: 8px; }
    .brand__company { font-size: 10.5px; letter-spacing: .05em; }
    .brand__title { font-size: 17px; line-height: 1.25; }

    .topbar__actions {
        position: static; /* the dropdown becomes a fixed sheet below */
        justify-content: flex-start;
        gap: 10px;
    }

    .sync-chip { order: -1; font-size: 10.5px; padding: 8px 12px; }

    .btn { padding: 11px 14px; min-height: 44px; } /* comfortable touch target */
    .btn--ghost { flex: none; }
    .btn--primary { flex: 1; justify-content: center; }

    /* Dropdown turns into a bottom sheet so it never runs off-screen. */
    .dropdown {
        position: fixed;
        inset: auto 10px calc(10px + env(safe-area-inset-bottom)) 10px;
        width: auto;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: 16px;
    }

    .dropdown__item { padding: 11px 10px; }

    /* Tabs scroll horizontally and snap. */
    .tabs {
        gap: 8px;
        padding: 8px 0 12px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        scroll-snap-align: start;
        padding: 10px 14px;
        font-size: 12.5px;
        min-height: 44px;
    }

    /* One KPI card per row — numbers stay readable. */
    .stat-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px 0 4px;
    }

    .stat { padding: 16px 16px 14px; }
    .stat__value { font-size: 24px; margin-bottom: 8px; }
    .stat__foot { font-size: 11px; }

    .panel { padding: 18px 16px; margin-top: 14px; }
    .panel__title { font-size: 16px; }
    .panel__sub { font-size: 12.5px; }

    .vehicle-grid { gap: 14px; margin-top: 14px; }
    .vehicle { padding: 18px 16px; }
    .vehicle__head { gap: 10px; }
    .vehicle__name { font-size: 19px; }
    .vehicle__meta { font-size: 12.5px; }
    .vehicle__note { font-size: 12.5px; }

    /* Sheet: tighter chrome; the table itself keeps scrolling sideways. */
    .sheet-actions { margin-top: 14px; }
    .sheet { margin-top: 10px; }
    .sheet__kop { padding: 12px 14px; }
    .sheet__doc { grid-template-columns: 1fr; }
    .sheet__meta { border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 14px; }
    .sheet__title { padding: 14px; font-size: 18px; }
    .sheet-table { font-size: 11px; }
    .sheet__sign { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; }
    .sheet-actions { flex-wrap: wrap; }
    .sheet-actions .btn { flex: 1; justify-content: center; }

    /* Stock form: the two movement columns stack. */
    .entry-row__cols { grid-template-columns: 1fr; gap: 12px; margin: 12px 0; }
    .entry-row { padding: 14px; }
    .control--short { max-width: none; }
    .modal__foot-note { order: -1; flex: 1 1 100%; margin: 0 0 4px; }

    .cost { grid-template-columns: 1fr; margin: 14px 0 12px; }
    .cost__col { padding: 12px 14px; }
    .cost__col + .cost__col {
        border-left: 0;
        border-top: 1px solid var(--border-soft);
    }

    /* Modal goes full-screen with its own internal scroll. */
    .modal-overlay {
        padding: 0;
        place-items: stretch;
    }

    .modal {
        width: 100%;
        min-height: 100%;
        display: flex;
        flex-direction: column;
        border: 0;
        border-radius: 0;
    }

    /* Header, tabs and footer keep their natural height; the overlay scrolls. */
    .modal__head,
    .modal__tabs,
    .modal__foot { flex: none; }

    .modal__head {
        position: sticky;
        top: 0;
        z-index: 2;
        gap: 12px;
        padding: calc(16px + env(safe-area-inset-top)) 16px 14px;
        background: #0e1626;
    }

    .modal__icon { width: 34px; height: 34px; border-radius: 10px; }
    .modal__title { font-size: 17px; }
    .modal__sub { font-size: 12.5px; }

    .modal__tabs { padding: 12px 16px; gap: 8px; }
    .modal-tab { flex: none; min-width: 104px; font-size: 12.5px; padding: 10px 12px; }

    .modal__body { flex: 1 0 auto; padding: 20px 16px; }
    .form-grid { gap: 14px; }
    .field__label { font-size: 13px; margin-bottom: 7px; }

    /* 16px keeps iOS from zooming the page when a field gets focus. */
    .control { font-size: 16px; padding: 12px 14px; }

    .modal__foot {
        position: sticky;
        bottom: 0;
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
        background: #0e1626;
    }

    .modal__foot .btn { flex: 1; justify-content: center; }
}

/* Narrow phones (360px and below) ------------------------------------------ */

@media (max-width: 380px) {
    .brand__title { font-size: 16px; }
    .sync-chip { font-size: 9.5px; padding: 7px 10px; }
    .stat__value { font-size: 22px; }
    .vehicle__name { font-size: 18px; }
    .btn { font-size: 12.5px; padding: 11px 12px; }
}

/* ==========================================================================
   Pengaturan Kop Surat
   ========================================================================== */

.btn--icon { padding: 10px; }

.page-intro {
    margin-top: 18px;
    max-width: 70ch;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-dim);
}

.flash {
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid transparent;
}

.flash ul { margin: 0; padding-left: 18px; }
.flash code { font-family: var(--mono); font-size: 12px; }

.flash--ok {
    border-color: rgba(74, 222, 128, .35);
    background: rgba(74, 222, 128, .1);
    color: #a7f3c6;
}

.flash--error {
    border-color: rgba(251, 113, 133, .4);
    background: rgba(251, 113, 133, .1);
    color: #ffc2cc;
}

.flash--warn {
    border-color: rgba(245, 158, 11, .35);
    background: rgba(245, 158, 11, .1);
    color: #f8cd7e;
}

.settings__block { margin-top: 16px; }

.settings__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 24px;
    margin-top: 18px;
}

.settings__col { min-width: 0; }

.settings__legend {
    margin-bottom: 14px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.settings__col .field + .field,
.settings__col .field + .switch,
.settings__col .switch + .field { margin-top: 16px; }

.settings__pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 14px;
    margin-top: 16px;
}

/* Side-by-side fields sit on one row; the stacking margin must not apply. */
.settings__pair .field + .field { margin-top: 0; }

.settings__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.settings__override[hidden] { display: none; }

/* Document meta editor ----------------------------------------------------- */

.meta-edit {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.meta-edit__title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.meta-edit__sub   { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }

.meta-edit__rows { display: grid; gap: 10px; margin-top: 14px; }

/* Label, value, and a remove button that keeps its width when labels wrap. */
.meta-edit__row {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr) 38px;
    gap: 10px;
    align-items: center;
}

.meta-edit__remove {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-sunk);
    color: var(--text-dim);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: background .14s ease, color .14s ease, border-color .14s ease;
}

.meta-edit__remove:hover {
    background: rgba(251, 113, 133, .12);
    border-color: rgba(251, 113, 133, .4);
    color: var(--rose);
}

.meta-edit__add { margin-top: 12px; }

.meta-edit__hint {
    margin-top: 10px;
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.6;
}

@media (max-width: 640px) {
    .meta-edit__row { grid-template-columns: minmax(0, 1fr) 38px; }
    .meta-edit__row .control:first-child { grid-column: 1 / -1; }
}

/* Toggles ------------------------------------------------------------------ */

.switch {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 14px;
    font-size: 13.5px;
    cursor: pointer;
}

.switch input { width: 16px; height: 16px; accent-color: var(--blue); }
.switch--sm { font-size: 12.5px; }

/* Segmented radio group ---------------------------------------------------- */

.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-sunk);
}

.seg { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

.seg span {
    display: block;
    padding: 7px 4px;
    border-radius: 7px;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    transition: background .14s ease, color .14s ease;
}

.seg input:checked + span { background: var(--blue); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Range sliders ------------------------------------------------------------ */

.range {
    width: 100%;
    accent-color: var(--blue);
    background: none;
}

.field__value {
    float: right;
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-dim);
}

.field__value::after { content: " " attr(data-unit); }

/* Address line list -------------------------------------------------------- */

.lines { display: grid; gap: 8px; margin-bottom: 10px; }

.lines__row { display: flex; gap: 8px; }

.lines__remove {
    flex: none;
    width: 38px;
    border-radius: 9px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
}

.lines__remove:hover { border-color: rgba(251, 113, 133, .4); color: var(--rose); }

/* Logo picker -------------------------------------------------------------- */

.logo-pick {
    display: flex;
    gap: 14px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-sunk);
}

.logo-pick__preview {
    width: 64px;
    height: 64px;
    flex: none;
    object-fit: contain;
    border-radius: 8px;
    background: #ffffff0a;
}

.logo-pick__body { min-width: 0; }

.btn--file { position: relative; overflow: hidden; cursor: pointer; }
.btn--file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Live preview ------------------------------------------------------------- */

.kop-preview { margin-top: 22px; }

.kop-preview__tag {
    display: inline-block;
    margin-bottom: 8px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.kop-preview__sheet { margin: 0; }

/* Canvas editing ----------------------------------------------------------- */

/* Only the preview is draggable — the real sheets render the same markup
   without these affordances. */
.kop-preview [data-preview][data-mode="canvas"] {
    background:
        linear-gradient(rgba(59, 130, 246, .07) 1px, transparent 1px) 0 0 / 100% 12px,
        linear-gradient(90deg, rgba(59, 130, 246, .07) 1px, transparent 1px) 0 0 / 12px 100%;
    cursor: default;
}

.kop-preview [data-preview][data-mode="canvas"] [data-drag] {
    cursor: grab;
    touch-action: none; /* let a touch drag move the element, not scroll the page */
    outline: 1px dashed transparent;
    outline-offset: 3px;
    border-radius: 3px;
}

.kop-preview [data-preview][data-mode="canvas"] [data-drag]:hover {
    outline-color: rgba(59, 130, 246, .55);
}

.kop-preview [data-preview][data-mode="canvas"] [data-drag].is-dragging {
    cursor: grabbing;
    outline-color: var(--blue);
    outline-style: solid;
}

/* Resize grips: only shown in canvas mode, pinned to their target by JS. */
.drag-handle {
    position: absolute;
    touch-action: none;
    display: none;
    z-index: 3;
    background: var(--blue);
    border: 2px solid var(--bg-elevated);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}

[data-mode="canvas"] .drag-handle { display: block; }

.drag-handle--logo {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: nwse-resize;
}

.drag-handle--text {
    width: 8px;
    height: 26px;
    border-radius: 4px;
    cursor: ew-resize;
}

/* Hide a grip whose target is hidden. */
.drag-handle[hidden] { display: none; }

/* Mode-dependent control groups. */
[data-mode-only][hidden] { display: none; }

/* Review step -------------------------------------------------------------- */

.review__intro {
    margin-bottom: 18px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-dim);
}

.review__item + .review__item { margin-top: 20px; }

.review__label {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
    font-size: 13.5px;
    font-weight: 700;
}

.review__tag {
    padding: 2px 8px;
    border-radius: 6px;
    background: #1d2840;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.review__changes {
    margin: 0 0 18px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, .3);
    background: rgba(59, 130, 246, .08);
    font-size: 12.5px;
    color: #bcd6ff;
}

.review__changes ul { margin: 6px 0 0; padding-left: 18px; }
.review__changes li + li { margin-top: 3px; }

.review__changes--none {
    border-color: var(--border);
    background: var(--surface-sunk);
    color: var(--text-muted);
}

/* ==========================================================================
   Login
   ========================================================================== */

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login { width: min(400px, 100%); }

.login__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.login__title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }

.login__card {
    padding: 26px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.login__heading { font-size: 18px; font-weight: 800; }

.login__sub {
    margin: 4px 0 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.login__card .field + .field { margin-top: 16px; }
.login__card .btn--block { margin-top: 22px; border-style: solid; }

/* ==========================================================================
   Ringkasan Eksekutif
   ========================================================================== */

.rs-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.rs-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 16px;
    align-items: start;
}

.rs-cols > .panel { margin-top: 16px; }

/* Bars ---------------------------------------------------------------------- */

.rs-bars { list-style: none; margin: 16px 0 0; padding: 0; }
.rs-bar + .rs-bar { margin-top: 13px; }

.rs-bar__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
}

.rs-bar__name {
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rs-bar__value { flex: none; font-size: 12px; font-weight: 700; color: var(--text-dim); }

.rs-bar__track {
    display: block;
    height: 7px;
    border-radius: 999px;
    background: #16203a;
    overflow: hidden;
}

.rs-bar__fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
}

.rs-bar__fill--violet { background: var(--violet); }

.rs-bar__share {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.rs-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }

.rs-chip {
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-sunk);
    font-size: 11.5px;
    color: var(--text-dim);
}

.rs-foot-note {
    margin-top: 14px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-muted);
}

/* Charts -------------------------------------------------------------------
   Marks stay thin, grid and axes recessive, text in ink tokens rather than the
   series colour. Hover is native via <title>, plus a lift on the mark itself. */

.chart {
    display: block;
    width: 100%;
    height: auto;
    margin: 16px auto 0;
    overflow: visible;
    /* The viewBox is 640 wide; letting it stretch much past that scales the
       type with it, so cap the blow-up rather than the container. */
    max-width: 720px;
}

.ch-grid { stroke: #1d2840; stroke-width: 1; }
.ch-lane { stroke: #1d2840; stroke-width: 1; stroke-dasharray: 3 4; }

.ch-axis, .ch-cat, .ch-legend, .ch-row-label, .ch-value, .ch-tile-value {
    font-family: inherit;
}

.ch-axis   { fill: #6b7b96; font-size: 10px; }
.ch-cat    { fill: #93a3bf; font-size: 10.5px; }
.ch-legend { fill: #93a3bf; font-size: 11px; }
.ch-row-label { fill: #e9eefb; font-size: 11.5px; font-weight: 600; }
.ch-value  { fill: #e9eefb; font-size: 11px; font-weight: 700; }

/* Pareto */
.ch-bar { fill: #3b82f6; transition: fill .12s ease; }
.ch-bar:hover { fill: #60a0ff; }
.ch-cum-line { fill: none; stroke: #93a3bf; stroke-width: 2; stroke-linejoin: round; }
.ch-cum-dot  { fill: #0f1726; stroke: #93a3bf; stroke-width: 2; }

/* Columns */
.ch-col { fill: #2b5fae; transition: fill .12s ease; }
.ch-col.is-peak { fill: #3b82f6; }
.ch-col:hover { fill: #60a0ff; }

/* Treemap */
.ch-tile { transition: opacity .12s ease; }
.ch-tile:hover { opacity: .82; }
.ch-tile-name  { fill: #fff; font-size: 11px; font-weight: 700; }
.ch-tile-value { fill: rgba(255,255,255,.78); font-size: 10.5px; }

/* Dumbbell: one hue, two shades — the year is an order, not an identity. */
.ch-dumb-line { stroke: #27405f; stroke-width: 3; stroke-linecap: round; }
.ch-dot-prev  { fill: #1d4f73; stroke: #0f1726; stroke-width: 2; }
.ch-dot-curr  { fill: #22d3ee; stroke: #0f1726; stroke-width: 2; }
.ch-delta { font-size: 11px; font-weight: 700; }
.ch-delta.is-down { fill: #4ade80; }
.ch-delta.is-up   { fill: #fb7185; }

/* Timeline */
.ch-ev-plan { fill: none; stroke: #0e9fd4; stroke-width: 2.5; }
.ch-ev-done { fill: #179455; stroke: #0f1726; stroke-width: 2; }

/* Small tables -------------------------------------------------------------- */

.rs-table {
    width: 100%;
    margin-top: 16px;
    border-collapse: collapse;
    font-size: 12.5px;
}

.rs-table th {
    padding: 7px 10px;
    text-align: left;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-soft);
}

.rs-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-dim);
}

.rs-table tbody tr:last-child td { border-bottom: 0; }
.rs-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.rs-table a { color: var(--blue); text-decoration: none; font-weight: 600; }
.rs-table a:hover { text-decoration: underline; }

/* Issues -------------------------------------------------------------------- */

.rs-issues {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 12px;
    margin: 16px 0 0;
    padding: 0;
}

.rs-issue {
    padding: 13px 15px;
    border-radius: 11px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    background: var(--surface-sunk);
}

.rs-issue--rose  { border-left-color: var(--rose); }
.rs-issue--amber { border-left-color: var(--amber); }

.rs-issue__judul { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.rs-issue__isi   { font-size: 12px; line-height: 1.55; color: var(--text-muted); }

.rs-issue__link {
    display: inline-block;
    margin-top: 9px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
}

.rs-issue__link:hover { text-decoration: underline; }

/* ==========================================================================
   Jadwal Perawatan AC
   ========================================================================== */

.year-switch {
    display: flex;
    gap: 4px;
    margin-right: auto;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-sunk);
}

.year-switch__item {
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-dim);
    transition: background .14s ease, color .14s ease;
}

.year-switch__item:hover { background: #16203a; color: var(--text); }
.year-switch__item.is-active { background: var(--blue); color: #fff; }

.ac-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
    gap: 20px;
    padding: 18px;
}

/* Three months per row, as the sheet lays them out. */
.ac-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.ac-month {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-sunk);
}

.ac-month__name {
    margin-bottom: 8px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-align: center;
    color: var(--text-dim);
}

.ac-cal {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 11px;
}

.ac-cal th {
    padding: 3px 0;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    color: var(--text-muted);
}

/* The source colours the S/S column letters, not the day cells. */
.ac-cal th.is-weekend { color: var(--rose); }

.ac-cal td {
    height: 22px;
    text-align: center;
    color: var(--text-dim);
    border-radius: 4px;
}

.ac-cal td.is-empty { color: transparent; }

/* A marked day: the legend colour as its background. */
.ac-cal td.mark { font-weight: 700; color: #06121f; }

.mark--jadwal { background: #00b0f0; }
.mark--done1  { background: #00b050; }
.mark--done2  { background: #a9d08e; }
.mark--lain   { background: #92d050; }

/* Editable days ------------------------------------------------------------ */

/*
 * The day itself is the button, filling its cell, so the hit target is the
 * whole square rather than the digits. The calendar is a document first: the
 * affordance only appears under the pointer.
 */
.ac-cal td.ac-day { padding: 0; }

.ac-day__btn {
    display: block;
    width: 100%;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    color: inherit;
    font: inherit;
    line-height: 22px;
    cursor: pointer;
}

.ac-day__btn:hover { box-shadow: inset 0 0 0 1px var(--blue); }
.ac-day__btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* A day whose entry carries an identity scan. */
.ac-cal td.has-id { position: relative; }

.ac-cal td.has-id::after {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--amber);
}

/* The dialog ---------------------------------------------------------------- */

.modal--narrow { width: min(620px, 100%); }

.ac-choice { display: grid; gap: 8px; }

.ac-choice__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-sunk);
    font-size: 13px;
    cursor: pointer;
}

.ac-choice__item:hover { border-color: #2b3a58; }
.ac-choice__item:focus-within { border-color: var(--blue); }

.ac-swatch--none {
    background: none;
    border: 1px dashed var(--text-muted);
    box-sizing: border-box;
}

.ac-id { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ac-id__current { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 12.5px; }
.ac-id__current[hidden] { display: none; }
.ac-id__current a { color: var(--blue); }
.ac-id__remove { display: flex; align-items: center; gap: 6px; color: var(--text-muted); cursor: pointer; }

/* Editing chrome is not part of the printed document. */
@media print {
    .ac-day__btn { box-shadow: none !important; outline: 0 !important; cursor: default; }
    .ac-cal td.has-id::after { display: none; }
}

/* Legend and notes ---------------------------------------------------------- */

.ac-side { min-width: 0; }

.ac-side__title {
    margin-bottom: 10px;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.ac-legend { margin-bottom: 22px; }

.ac-legend__row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    line-height: 1.5;
}

.ac-legend__row + .ac-legend__row { margin-top: 5px; }

.ac-swatch {
    width: 16px;
    height: 13px;
    flex: none;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, .15);
}

.ac-swatch--weekend { background: #ff0000; }
.ac-swatch--jadwal  { background: #00b0f0; }
.ac-swatch--done1   { background: #00b050; }
.ac-swatch--done2   { background: #a9d08e; }

.ac-note {
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 9px;
    background: var(--surface-sunk);
}

.ac-note__line {
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--text-dim);
}

.ac-note__line:first-child { font-weight: 700; color: var(--text); }

/* Teknisi roster ----------------------------------------------------------- */

.tek { padding: 0 18px 18px; }

.tek__head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tek__head .ac-side__title { margin-bottom: 0; }

.tek__flag {
    font-size: 11.5px;
    color: var(--amber);
}

.tek__flag code {
    font-family: var(--mono);
    font-size: 10.5px;
    color: #f8cd7e;
}

.tek__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 14px;
}

.tek-card {
    display: flex;
    flex-direction: column;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-sunk);
}

.tek-card__head { margin-bottom: 10px; }
.tek-card__name { font-size: 14.5px; font-weight: 800; }

.tek-card__alias {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-style: italic;
    color: var(--amber);
}

.tek-card__rows {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 4px 10px;
    margin: 0 0 12px;
    font-size: 11.5px;
    line-height: 1.5;
}

.tek-card__rows dt { color: var(--text-muted); }
.tek-card__rows dd { margin: 0; color: var(--text-dim); }
.tek-card__rows dd.is-num { font-family: var(--mono); font-size: 11px; }

.tek-card__jobs {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
}

.tek-card__jobs-title {
    display: block;
    margin-bottom: 6px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.tek-card__jobs ul { margin: 0; padding-left: 16px; }
.tek-card__jobs li { font-size: 11.5px; line-height: 1.55; color: var(--text-dim); }
.tek-card__jobs strong { color: var(--text); }

.tek-card__ktp {
    margin-top: 12px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    text-align: center;
    font-size: 11.5px;
    text-decoration: none;
    color: var(--text-dim);
}

a.tek-card__ktp:hover { border-color: var(--blue); color: #9cc3ff; }

.tek-card__ktp.is-off {
    border-style: dashed;
    color: var(--text-muted);
    cursor: default;
}

/* ==========================================================================
   Flowchart Stockofname
   ========================================================================== */

/* Meta | title | approval boxes across the document header. */
.fc-doc { grid-template-columns: minmax(200px, 0.9fr) 1.6fr minmax(240px, 1fr); }

.fc-approval {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-left: 1px solid var(--border);
}

.fc-approval__box { text-align: center; font-size: 11px; }
.fc-approval__box + .fc-approval__box { border-left: 1px solid var(--border-soft); }

.fc-approval__label {
    padding: 6px 4px;
    border-bottom: 1px solid var(--border-soft);
    font-weight: 700;
    color: var(--text-dim);
}

.fc-approval__space { height: 44px; }

.fc-approval__name {
    padding: 5px 4px;
    border-top: 1px solid var(--border-soft);
    font-weight: 700;
}

/* The diagram scrolls sideways rather than reflowing — it is a drawing. */
.fc-wrap {
    overflow-x: auto;
    padding: 0;
    border-bottom: 1px solid var(--border);
}

.fc {
    display: block;
    min-width: 1300px;
    width: 100%;
    height: auto;
}

.fc-lane { fill: transparent; stroke: var(--border-soft); stroke-width: 1; }
.fc-lane-head { fill: var(--surface-sunk); stroke: var(--border); stroke-width: 1; }

.fc-lane-title {
    fill: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.fc-node {
    fill: #142033;
    stroke: var(--blue);
    stroke-width: 1.4;
}

.fc-node--decision { fill: #241f12; stroke: var(--amber); }
.fc-node--term     { fill: #11261b; stroke: var(--green); }

.fc-node-text { fill: var(--text); font-size: 11.5px; }

.fc-edge {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 1.4;
    marker-end: url(#fc-arrow);
}

.fc-arrowhead { fill: var(--text-muted); }

.fc-edge-label {
    fill: var(--text-dim);
    font-size: 10.5px;
    font-style: italic;
}

.fc-step { fill: var(--blue); stroke: var(--bg-elevated); stroke-width: 2; }
.fc-step-text { fill: #fff; font-size: 11px; font-weight: 700; }

/* Bottom blocks ------------------------------------------------------------ */

.fc-foot {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding: 18px;
}

.fc-foot__col--wide { grid-column: span 2; }

.fc-foot__title {
    margin-bottom: 8px;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.fc-revisi { min-width: 0; font-size: 11.5px; }
.fc-revisi td { height: 22px; }

.fc-faktor { margin: 0; padding: 0; list-style: none; font-size: 12px; }
.fc-faktor li + li { margin-top: 4px; }

.fc-faktor__code {
    display: inline-block;
    width: 18px;
    font-family: var(--mono);
    font-weight: 700;
    color: var(--cyan);
}

.fc-foot__box {
    min-height: 72px;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--surface-sunk);
    font-size: 12px;
}

/* ==========================================================================
   Print — the sheet only, black on white, close to the Excel original
   ========================================================================== */

@page {
    size: A4 landscape;
    margin: 12mm;
}

@media print {
    /* Everything that is app chrome rather than document. */
    .topbar,
    .tabs,
    .stat-grid,
    .sheet-actions,
    .draft-banner,
    .modal-overlay { display: none !important; }

    /* Draft rows print as ordinary rows — no on-screen tint on paper. */
    .sheet-table tr.is-draft > td { box-shadow: none; }

    html, body {
        background: #fff;
        color: #000;
        font-size: 10pt;
        overflow: visible;
    }

    .shell { max-width: none; padding: 0; }

    .sheet {
        margin: 0;
        border: 1px solid #000;
        border-radius: 0;
        background: #fff;
        overflow: visible;
    }

    .sheet__kop { padding: 6pt 8pt; border-bottom: 1px solid #000; }

    .sheet__logo { width: 38pt; height: 38pt; }

    .sheet__company { color: #000; font-size: 12pt; }
    .sheet__address { color: #000; font-size: 9pt; }

    .sheet__doc { border-bottom: 1px solid #000; }
    .sheet__meta { border-right: 1px solid #000; padding: 6pt 8pt; font-size: 9pt; }
    .sheet__meta dt,
    .sheet__meta dd { color: #000; }
    .sheet__title { font-size: 18pt; padding: 8pt; }

    /* Columns must not be clipped or scrolled on paper. */
    .sheet-scroll { overflow: visible; }
    .sheet-table { min-width: 0; font-size: 8pt; }

    .sheet-table th,
    .sheet-table td {
        padding: 2pt 3pt;
        border: 1px solid #000;
        color: #000;
        background: #fff !important;
    }

    /* The source sheet draws the header block with thicker rules. */
    .sheet-table thead th { border-color: #000; border-width: 1px 1px 2px; }

    /* Keep a rack's header with at least some of its rows. */
    .sheet-table thead { display: table-header-group; }
    .sheet-table tr { page-break-inside: avoid; }

    /* Charts: keep the data fills, turn the chrome to ink. */
    .chart { max-width: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    .ch-grid, .ch-lane { stroke: #bbb; }
    .ch-axis, .ch-cat, .ch-legend { fill: #333; }
    .ch-row-label, .ch-value { fill: #000; }
    .ch-cum-line { stroke: #000; }
    .ch-cum-dot { fill: #fff; stroke: #000; }
    .ch-dot-prev, .ch-dot-curr, .ch-ev-done { stroke: #fff; }

    /* AC calendar: keep the legend colours, everything else turns to ink. */
    .year-switch { display: none !important; }
    .ac-body { padding: 8pt; gap: 10pt; }
    .ac-month { border-color: #000; background: #fff; }
    .ac-month__name, .ac-cal th { color: #000; }
    .ac-cal th.is-weekend { color: #d00; }
    .ac-cal td { color: #000; }
    .ac-cal td.mark,
    .ac-swatch { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    .ac-side__title, .ac-note__line { color: #000; }
    .ac-note { border-color: #000; background: #fff; }
    .ac-month { break-inside: avoid; }

    /* Flowchart: ink on paper, and the diagram must not scroll. */
    .fc-wrap { overflow: visible; border-bottom: 1px solid #000; }
    .fc { min-width: 0; }

    .fc-lane { stroke: #000; }
    .fc-lane-head { fill: #eee; stroke: #000; print-color-adjust: exact; }
    .fc-lane-title { fill: #000; }

    .fc-node { fill: #fff; stroke: #000; }
    .fc-node--decision,
    .fc-node--term { fill: #fff; stroke: #000; }
    .fc-node-text { fill: #000; }

    .fc-edge { stroke: #000; }
    .fc-arrowhead { fill: #000; }
    .fc-edge-label { fill: #000; }

    .fc-step { fill: #000; stroke: #fff; print-color-adjust: exact; }
    .fc-step-text { fill: #fff; }

    .fc-approval,
    .fc-approval__box + .fc-approval__box { border-color: #000; }
    .fc-approval__label,
    .fc-approval__name { border-color: #000; color: #000; }

    .fc-foot__title { color: #000; }
    .fc-faktor__code { color: #000; }
    .fc-foot__box { border-color: #000; background: #fff; }

    .sheet__sign { padding: 10pt 8pt; }
    .sign { border-color: #000; }
    .sign__role,
    .sign__name,
    .sign__dept { border-color: #000; color: #000; }
}

/* Scrollbar --------------------------------------------------------------- */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #26324a; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #32405e; }
