/* Line Mapping: neo brutalism sama kayak Info Stok + FC Plan.
   Kertas #FFFDF4, garis hitam tebal, hard shadow, radius 0, kuning #FFC700 di momen kunci. */
:root {
  color-scheme: light;
  --bg: #fffdf4; --surface: #ffffff; --surface-2: #fff1b8;
  --line: #111111; --text: #111111; --muted: #555555;
  --amber: #ffc700; --amber-dim: #ffe98a;
  --red: #d92d20; --red-dim: #ffdcd8; --red-ink: #b42318;
  --green: #0e7a37; --green-dim: #d2f0dc; --green-ink: #0b6b30;
  --orange-dim: #ffe2c2; --orange-ink: #8a4b00;
  --grey-dim: #ecebe4; --line-soft: #e9e2cb;
  --shadow: 4px 4px 0 #111111;
  --font-head: 'Archivo', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}
* { box-sizing: border-box; }
html, body { max-width: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font-body); min-height: 100vh; -webkit-text-size-adjust: 100%; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--amber); border: 3px solid var(--line); padding: .5rem .8rem; z-index: 90; color: var(--text); font-weight: 700; }
.skip-link:focus { left: .5rem; top: .5rem; }
:focus-visible { outline: 3px solid var(--line); outline-offset: 2px; }
.muted { color: var(--muted); }
h2 { font: 800 1.1rem var(--font-head); margin: 0 0 .4rem; letter-spacing: .02em; }
h3 { font: 700 .95rem var(--font-head); margin: 1.1rem 0 .4rem; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem 1rem;
  padding: .7rem 1.5rem; background: var(--surface); border-bottom: 3px solid var(--line); }
.brand { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.brand-logo { width: 64px; height: auto; flex: none; }
.brand h1 { margin: 0; font: 800 1.2rem var(--font-head); letter-spacing: .04em; display: inline; }
.brand p { margin: .15rem 0 0; color: var(--muted); font-size: .8rem; }
.tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.tab { min-height: 44px; padding: .4rem .85rem; background: transparent; border: 2px solid transparent; color: var(--text); font: 600 .88rem var(--font-body); cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s; }
.tab:hover { border-color: var(--line); }
.tab.active { background: var(--amber); border-color: var(--line); box-shadow: 3px 3px 0 var(--line); transform: translate(-1px, -1px); }

main { padding: 1.4rem 1.5rem 2rem; max-width: 1400px; margin: 0 auto; }
.panel { display: none; animation: rise .28s ease-out; }
.panel.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel, .tab, .btn, .chip { animation: none; transition: none; } }

.card, .empty-card { background: var(--surface); border: 3px solid var(--line); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1.2rem; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card { margin-top: 1.2rem; }

/* Model chips */
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip { min-height: 44px; padding: .45rem .9rem; background: var(--surface); border: 2px solid var(--line); font: 700 .88rem var(--font-head); cursor: pointer; color: var(--text); transition: transform .12s, box-shadow .12s; }
.chip:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--line); }
.chip[aria-selected="true"] { background: var(--amber); box-shadow: 3px 3px 0 var(--line); }
.chip small { font: 600 .75rem var(--font-mono); margin-left: .35rem; padding: 0 .3rem; border: 1.5px solid var(--line); }
.chip small.bad { background: var(--red-dim); color: var(--red-ink); }
.chip small.good { background: var(--green-dim); color: var(--green-ink); }

.filters { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters label, .form-row label { display: flex; flex-direction: column; gap: .25rem; font: 600 .8rem var(--font-body); color: var(--text); }
select, input[type=number], input[type=password], input[type=text] { min-height: 44px; border: 2px solid var(--line); background: var(--surface); color: var(--text); font: 500 .95rem var(--font-body); padding: .35rem .6rem; border-radius: 0; }
select { min-width: 190px; }
.form-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.form-row input { width: 170px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 3px solid var(--line); padding: .7rem .85rem; box-shadow: 3px 3px 0 var(--line); min-width: 0; }
.stat b { display: block; font: 800 1.35rem var(--font-head); }
.stat span { font-size: .8rem; color: var(--muted); }
.stat.warn { background: var(--red-dim); } .stat.warn span { color: var(--red-ink); }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.btn { min-height: 44px; padding: .5rem 1rem; border: 2px solid var(--line); background: var(--surface); color: var(--text); font: 700 .9rem var(--font-body); cursor: pointer; box-shadow: 3px 3px 0 var(--line); transition: transform .1s, box-shadow .1s; }
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }
.btn.primary { background: var(--amber); }
.btn.ghost { box-shadow: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.save-note { font-size: .85rem; color: var(--muted); }
.save-note.ok { color: var(--green-ink); font-weight: 600; }
.save-note.err, .err { color: var(--red-ink); font-weight: 600; }

/* Tabel: scroll di dalam kotaknya sendiri, halaman gak ikut geser */
.table-wrap { max-width: 100%; overflow-x: auto; border: 3px solid var(--line); background: var(--surface); margin-bottom: .8rem; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; font-size: .85rem; }
th, td { border: 1px solid var(--line-soft); padding: .35rem .5rem; text-align: right; white-space: nowrap; font-family: var(--font-mono); }
thead th { background: var(--surface-2); font: 700 .78rem var(--font-body); text-align: center; border-bottom: 2px solid var(--line); }
thead th small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }
th.rowh, td.rowh { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; font: 700 .8rem var(--font-body); border-right: 2px solid var(--line); min-width: 112px; }
thead th.rowh { background: var(--surface-2); z-index: 3; }
tr.r-dem td { font-weight: 600; }
tr.r-stock td.neg { color: var(--red-ink); font-weight: 700; }
td input.prod { width: 78px; min-height: 44px; text-align: right; font: 600 .85rem var(--font-mono); padding: .2rem .35rem; }
td input.prod.dirty { background: var(--amber-dim); }
.dos { display: inline-block; min-width: 46px; padding: .1rem .35rem; border: 1.5px solid var(--line); font: 700 .8rem var(--font-mono); text-align: center; }
.dos.ok { background: var(--green-dim); color: var(--green-ink); }
.dos.low { background: var(--red-dim); color: var(--red-ink); }
.dos.high { background: var(--orange-dim); color: var(--orange-ink); }
.dos.na { background: var(--grey-dim); color: var(--muted); }
.load { font: 700 .8rem var(--font-mono); padding: .1rem .3rem; }
.load.over, .load.group { background: var(--red-dim); color: var(--red-ink); }
.load.ot { background: var(--orange-dim); color: var(--orange-ink); }
.load.ok { color: var(--green-ink); }
.assume { font-style: italic; color: var(--muted); }
.legend { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .8rem; margin: 0 0 1rem; }

.adv-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.adv-list li { border: 2px solid var(--line); padding: .5rem .7rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: baseline; }
.adv-list li b { font-family: var(--font-mono); min-width: 74px; }
.adv-list li.group, .adv-list li.over { background: var(--red-dim); }
.adv-list li.ot { background: var(--orange-dim); }

.drop { display: block; border: 3px dashed var(--line); padding: 1.2rem; text-align: center; cursor: pointer; background: var(--bg); font-weight: 600; margin: .6rem 0; }
.drop:hover { background: var(--surface-2); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid var(--line); outline-offset: 2px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px solid var(--line-soft); padding: .45rem 0; display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; font-size: .88rem; }
.list li span { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; min-width: 0; }
table.mini td input { width: 96px; min-height: 40px; }
table.mini td, table.mini th { font-size: .8rem; }
.tag { display: inline-block; padding: 0 .35rem; border: 1.5px solid var(--line); font: 700 .75rem var(--font-mono); }
.tag.yes { background: var(--green-dim); color: var(--green-ink); }
.tag.train { background: var(--orange-dim); color: var(--orange-ink); }
.tag.no { background: var(--grey-dim); color: var(--muted); }
td.up { color: var(--red-ink); font-weight: 700; } td.down { color: var(--green-ink); font-weight: 700; }
.cmp-tap { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; min-height: 44px; }
td.tap { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.info-dlg { max-width: min(94vw, 560px); width: 100%; }
#info-body { max-height: 70vh; overflow: auto; }
#info-body h3 { font: 800 1rem var(--font-head); margin: 1rem 0 .4rem; }
#info-body table { width: 100%; }
.cmp-head { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; align-items: baseline; }

.footer { text-align: center; padding: 1.2rem; border-top: 3px solid var(--line); font: 700 .85rem var(--font-head); background: var(--surface); }
dialog { border: 3px solid var(--line); box-shadow: 6px 6px 0 var(--line); padding: 1.2rem; max-width: min(92vw, 380px); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(17, 17, 17, .45); }
dialog input { width: 100%; font-size: 1.2rem; letter-spacing: .3em; }

@media (max-width: 899px) {
  .topbar { padding: .6rem .9rem; }
  .brand-logo { width: 48px; }
  .brand h1 { font-size: 1.05rem; }
  .tabs { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; }
  .tab { padding: .3rem .2rem; font-size: .78rem; }
  main { padding: 1rem .8rem 1.5rem; }
  .grid2 { grid-template-columns: 1fr; }
  .grid2 > .card { margin-bottom: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label { flex: 1 1 140px; }
  select { min-width: 0; width: 100%; }
  .form-row label { flex: 1 1 140px; }
  .form-row input { width: 100%; }
  .card { padding: .9rem; }
  th.rowh, td.rowh { min-width: 92px; }
}

/* Group & Kapasitas */
.stamp { font: 600 .82rem var(--font-mono); margin: 0 0 .8rem; padding: .3rem .6rem; border: 2px solid var(--line); background: var(--surface-2); display: inline-block; }
table.grid td { vertical-align: top; text-align: left; padding: .4rem; }
table.grid th small { font-weight: 500; }
.cell { display: grid; gap: .25rem; min-width: 112px; }
.cell select { min-width: 0; width: 100%; font-size: .8rem; font-weight: 700; padding: .2rem .3rem; }
.cell select.s-BISA { background: var(--green-dim); color: var(--green-ink); }
.cell select.s-TRAINING { background: var(--orange-dim); color: var(--orange-ink); }
.cell select.s-X { background: var(--grey-dim); color: var(--muted); }
.cell label { display: flex; align-items: center; gap: .25rem; font: 500 .75rem var(--font-body); color: var(--muted); }
.cell input { width: 70px; min-height: 40px; font: 600 .8rem var(--font-mono); padding: .2rem .3rem; }
.cell .need { font: 700 .75rem var(--font-body); color: var(--orange-ink); white-space: normal; }
td.rowh input.ops { width: 64px; min-height: 40px; }
.del { min-height: 32px; padding: .1rem .4rem; border: 1.5px solid var(--line); background: var(--surface); color: var(--red-ink); font: 700 .75rem var(--font-body); cursor: pointer; margin-top: .25rem; }
.add-row { align-items: flex-end; margin: .4rem 0 .8rem; }
.add-row input { width: 150px; }
@media (max-width: 899px) {
  .tabs { grid-template-columns: repeat(5, 1fr); }
  .tab { font-size: .75rem; padding: .25rem .05rem; line-height: 1.2; letter-spacing: -.01em; }
  .tabs { gap: .15rem; }
  .add-row label { flex: 1 1 140px; }
  .add-row .btn { flex: 1 1 140px; }
}
