:root {
  --ink: #17202a; --muted: #6b7684; --line: #e3e7ec; --bg: #f5f6f8; --card: #fff;
  --brand: #2a4178; --brand-2: #0290d6; --accent: #c8102e;
  --green: #1f7a4d; --amber: #b26a00; --red: #b42318; --blue: #1d4f86;
  --radius: 10px; --side: 210px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .4rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; }
.late { color: var(--red); font-weight: 600; }
.soon { color: var(--amber); font-weight: 600; }
.ok-text { color: var(--green); font-weight: 600; }
.mt { margin-top: 1rem; }

/* Header + nav */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: .55rem 1rem; background: var(--brand); color: #fff; }
.top a { color: #fff; }
.brand { font-weight: 700; letter-spacing: .2px; white-space: nowrap; display: flex; align-items: center; gap: .45rem; }
.brand img { width: 26px; height: 26px; background: #fff; border-radius: 6px; padding: 2px; }
.login-logo { width: 72px; height: 72px; display: block; margin-bottom: .6rem; }
.me { margin-left: auto; font-size: .9rem; display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.me .muted { color: #b9c6d6; }
.me .link { color: #fff; }
.menu summary { list-style: none; cursor: pointer; font-size: 1.3rem; padding: 0 .2rem; }
.menu summary::-webkit-details-marker { display: none; }
.menu nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--brand); padding: .5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.menu nav a, .side nav a { display: block; padding: .6rem .8rem; border-radius: 8px; color: #fff; }
.menu nav a.on, .side nav a.on { background: rgba(255,255,255,.16); font-weight: 600; }
.side { display: none; }
main { padding: 1rem; max-width: 1200px; }
main.plain { margin: 0 auto; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; }

@media (min-width: 900px) {
  .menu { display: none; }
  .side { display: block; position: fixed; top: 46px; bottom: 0; left: 0; width: var(--side); background: var(--brand); padding: .6rem; overflow-y: auto; }
  .side nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
  main.with-side { margin-left: var(--side); padding: 1.25rem 1.75rem; }
  main.wide { max-width: none; }
}

/* Cards, layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card.approve { border-color: #f1c98b; background: #fffaf1; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem; }
.head > div:last-child { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; gap: .1rem 1rem; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.quick { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.kv { display: grid; gap: .6rem 1.2rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.kv span { display: block; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.kv .full { grid-column: 1 / -1; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; color: var(--ink); }
a.stat:hover { border-color: var(--brand-2); text-decoration: none; }
.stat span { display: block; font-size: .8rem; color: var(--muted); }
.stat b { display: block; font-size: 1.25rem; margin-top: .15rem; }
.stat small { display: block; color: var(--muted); margin-top: .15rem; }

/* Forms */
label { display: block; margin: .45rem 0; font-size: .88rem; color: #3b4652; }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .6rem .65rem; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfd6de; border-radius: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9ec1ea; border-color: var(--brand-2); }
input[type=checkbox] { display: inline; width: auto; margin: 0 .35rem 0 0; transform: scale(1.15); }
input.xs { display: inline; width: 4.5rem; margin-left: .4rem; }
label.check { display: flex; align-items: center; gap: .2rem; }
small { font-size: .8rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; display: flex; flex-wrap: wrap; gap: .2rem 1rem; }
fieldset label { margin: .2rem 0; }
.btn { display: inline-block; padding: .55rem .95rem; font: inherit; font-weight: 600; font-size: .9rem; color: var(--brand); background: #fff; border: 1px solid #c4cfdb; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f0f4f9; text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--red); border-color: #f0b7b1; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: .3rem .6rem; font-size: .82rem; }
.btn.block { display: block; width: 100%; margin-top: .75rem; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-2); cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; align-items: center; }
.search { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.search input, .search select { width: auto; min-width: 160px; flex: 1 1 160px; }
.search label { margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: flex-end; }
.inline-form label { flex: 1 1 150px; margin: .3rem 0; }
.inline-form label.sm { flex: 0 1 100px; }
.inline-form label.wide, .inline-form fieldset.wide { flex: 1 1 100%; }
.inline-form > .btn { margin: .3rem 0; }

.item-row { display: flex; flex-wrap: wrap; gap: 0 .6rem; align-items: flex-end; padding: .5rem; margin-bottom: .5rem; border: 1px dashed #d4dbe3; border-radius: 8px; background: #fbfcfd; }
.item-row label { flex: 1 1 130px; margin: .25rem 0; }
.item-row label.wide { flex: 2 1 220px; }
.item-row label.sm { flex: 0 1 90px; }
.item-row .btn { margin-bottom: .3rem; }
.live-total { font-weight: 600; text-align: right; }

/* Tables */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); background: #fafbfc; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #fafcff; }
.empty { color: var(--muted); padding: .5rem 0; }
.report td { border-bottom: 1px solid #f0f2f4; }
.report tr.strong td { font-weight: 700; border-top: 1px solid var(--line); }
.totals { margin: .75rem 0 0 auto; max-width: 340px; }
.totals div { display: flex; justify-content: space-between; padding: .2rem 0; }
.totals .grand { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--line); margin-top: .2rem; padding-top: .4rem; }

/* Pills, bars */
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; text-transform: capitalize; white-space: nowrap; }
.pill.grey { background: #eef0f3; color: #4b5563; }
.pill.blue { background: #e3edf9; color: var(--blue); }
.pill.amber { background: #fdf0d8; color: var(--amber); }
.pill.green { background: #def3e6; color: var(--green); }
.pill.red { background: #fde3e0; color: var(--red); }
.bar { display: inline-block; vertical-align: middle; width: 90px; height: 7px; border-radius: 4px; background: #e8ecf0; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); }
.stat .bar { width: 100%; margin-top: .4rem; }

/* Flash */
.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: #def3e6; color: #135c37; }
.flash.err { background: #fde3e0; color: #8a1c12; }
.flash.info { background: #e3edf9; color: #153e6a; }

/* Login */
.login { max-width: 380px; margin: 12vh auto 0; }

/* Board */
.board { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .75rem; align-items: flex-start; }
.col { flex: 0 0 240px; background: #eceff3; border-radius: var(--radius); padding: .6rem; min-height: 120px; }
.col h3 { margin: 0 0 .5rem; font-size: .9rem; }
.kcard { display: block; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand-2); border-radius: 8px; padding: .55rem .65rem; margin-bottom: .5rem; color: var(--ink); font-size: .88rem; }
.kcard:hover { text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.kcard.late { border-left-color: var(--red); }
.kcard.soon { border-left-color: var(--amber); }
.kcard .row { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin: .25rem 0; }
.kcard .bar { width: 100%; }

/* SPK stages */
.stages { list-style: none; padding: 0; margin: 0; }
.stage { border: 1px solid var(--line); border-left: 4px solid #cbd3dc; border-radius: 8px; padding: .6rem .75rem; margin-bottom: .5rem; }
.stage.proses { border-left-color: var(--amber); background: #fffbf3; }
.stage.selesai { border-left-color: var(--green); }
.stage.skip { opacity: .6; }
.stage-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.stage details { margin-top: .4rem; }
.stage summary { cursor: pointer; color: var(--brand-2); font-weight: 600; font-size: .88rem; }
.stages-pick { display: grid; gap: .4rem; }
.stage-pick { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 8px; }
.stage-pick input.sm { width: auto; flex: 1 1 160px; margin: 0; }
.stage-pick label { margin: 0; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
details > summary { cursor: pointer; }

.timeline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.timeline li { padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: .3rem; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .5rem .8rem; border-radius: 8px 8px 0 0; color: var(--muted); }
.tabs a.on { color: var(--brand); font-weight: 700; border-bottom: 2px solid var(--brand); }
.steps { padding-left: 1.2rem; }

@media print {
  .top, .side, .noprint, .menu, .quick, form .btn { display: none !important; }
  main.with-side { margin: 0; padding: 0; }
  body { background: #fff; }
  .card, .stat { border: 0; padding: .3rem 0; }
}

/* Form data teknis SPK */
fieldset.tech { display: block; margin: .75rem 0; padding: .4rem .8rem .6rem; }
fieldset.tech legend { font-weight: 700; color: var(--brand); padding: 0 .3rem; }
.grid3 { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.row-cb { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; align-items: center; margin: .3rem 0; }
.row-cb > span { font-size: .88rem; color: #3b4652; min-width: 3rem; }
.row-cb label { margin: .15rem 0; }
.calc { min-height: 1.2rem; }
.calc .warn { color: var(--red); font-weight: 600; }
