/* AMS Admin — token warna & font sama dengan microsite (web-apps/microsite/microsite-2.0/css/style.css),
   layout padat untuk admin, mobile-first. */
:root {
  --bg: #07080b;
  --bg-2: #0c0e12;
  --surface: #12151b;
  --surface-2: #181c23;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .15);
  --blue: #0879c9;
  --blue-2: #1d93e6;
  --blue-ink: #6dbcf0;
  --blue-soft: rgba(8, 121, 201, .14);
  --red: #a3122f;
  --red-ink: #ff6b83;
  --red-soft: rgba(163, 18, 47, .18);
  --green: #2fbf71;
  --green-soft: rgba(47, 191, 113, .14);
  --amber: #f0b429;
  --amber-soft: rgba(240, 180, 41, .14);
  --wa: #25d366;
  --white: #f5f7fa;
  --text: #c9ced6;
  --muted: #8b94a0;
  --r-sm: 8px;
  --r: 14px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --nav-w: 232px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { color: var(--white); letter-spacing: -.02em; line-height: 1.2; }
h1 { font-size: 1.45rem; font-weight: 800; }
h2 { font-size: 1.08rem; font-weight: 750; }
h3 { font-size: .95rem; font-weight: 700; }
:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.eyebrow-mark { display: inline-block; width: 22px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--blue) 0 64%, var(--red) 64% 100%); vertical-align: middle; margin-right: 8px; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; background: rgba(7, 8, 11, .88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar .logo img { height: 26px; width: auto; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: .8rem; color: var(--muted); }
.sidenav { display: none; }
.main { padding: 16px 14px 96px; max-width: 1180px; margin: 0 auto; }
.bottomnav { position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: rgba(12, 14, 18, .96); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: .68rem; color: var(--muted); text-decoration: none; }
.bottomnav a svg { width: 22px; height: 22px; }
.bottomnav a.on { color: var(--white); }
.bottomnav a.plus span.dot { display: grid; place-items: center; width: 40px; height: 40px; margin-top: -14px; border-radius: 50%; background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(8,121,201,.45); }

@media (min-width: 960px) {
  .sidenav { display: flex; flex-direction: column; position: fixed; top: 56px; bottom: 0; left: 0; width: var(--nav-w); padding: 14px 10px; border-right: 1px solid var(--line); background: var(--bg-2); overflow-y: auto; }
  .sidenav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: .9rem; text-decoration: none; }
  .sidenav a svg { width: 18px; height: 18px; color: var(--muted); }
  .sidenav a:hover { background: rgba(255,255,255,.04); }
  .sidenav a.on { background: var(--blue-soft); color: var(--white); }
  .sidenav a.on svg { color: var(--blue-ink); }
  .sidenav .sep { margin: 14px 12px 6px; font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
  .sidenav .cta { margin: 4px 0 12px; }
  .main { margin-left: var(--nav-w); padding: 24px 28px 48px; }
  .bottomnav { display: none; }
}

/* ---------- Page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card + .card, .stack > * + * { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } .grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.grid > .card + .card { margin-top: 0; }
.grid > *, .stack > * { min-width: 0; }

.kpi .label { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.kpi .value { font-size: 1.45rem; font-weight: 800; color: var(--white); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.pos { color: var(--green); }
.neg { color: var(--red-ink); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; text-decoration: none !important; white-space: nowrap; color: var(--white); background: rgba(255,255,255,.04); border-color: var(--line-2); }
.btn:hover { background: rgba(255,255,255,.08); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, var(--blue-2), var(--blue) 55%, #0663a5); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--blue-2), var(--blue) 55%, #0663a5); }
.btn-wa { background: #1fa855; border-color: transparent; color: #fff; }
.btn-wa:hover { background: #22b85d; }
.btn-danger { color: var(--red-ink); border-color: rgba(255,107,131,.35); background: transparent; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: .8rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--blue-ink); font: inherit; cursor: pointer; padding: 0; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } .form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .span-2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; } }
.field label, .label { display: block; font-size: .8rem; font-weight: 700; color: #a8b2bf; margin-bottom: 5px; }
.field .help, .helptext { display: block; font-size: .76rem; color: var(--muted); margin-top: 4px; }
.field .err, .errorlist { color: var(--red-ink); font-size: .8rem; margin-top: 4px; list-style: none; }
input[type=text], input[type=number], input[type=date], input[type=datetime-local], input[type=password], input[type=tel], input[type=search], input:not([type]), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg-2); color: var(--white); font: inherit; font-size: 16px; }
@media (min-width: 720px) { input, select, textarea { font-size: .92rem !important; } }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-2); box-shadow: 0 0 0 3px var(--blue-soft); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); vertical-align: middle; }
input[type=file] { width: 100%; padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--bg-2); color: var(--text); }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); cursor: pointer; }
.check:has(input:checked) { border-color: rgba(29,147,230,.5); background: var(--blue-soft); }
.checks { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .checks { grid-template-columns: 1fr 1fr; } }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.inline-form > * { flex: 1 1 140px; }
.inline-form > .btn { flex: 0 0 auto; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.t th { text-align: left; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tfoot td { border-top: 1px solid var(--line-2); font-weight: 700; color: var(--white); }
table.t tr.void td { opacity: .45; text-decoration: line-through; }
table.t .sub { display: block; color: var(--muted); font-size: .78rem; }
table.t th.num, table.t td.num { text-align: right; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; white-space: nowrap; background: rgba(255,255,255,.07); color: var(--text); }
.b-estimasi { background: rgba(255,255,255,.08); color: #d9dee5; }
.b-disetujui { background: var(--blue-soft); color: var(--blue-ink); }
.b-masuk, .b-dikerjakan { background: var(--amber-soft); color: var(--amber); }
.b-qc { background: rgba(167, 139, 250, .16); color: #c4b5fd; }
.b-selesai { background: var(--green-soft); color: var(--green); }
.b-diserahkan { background: rgba(255,255,255,.05); color: var(--muted); }
.b-batal { background: var(--red-soft); color: var(--red-ink); }
.b-ok { background: var(--green-soft); color: var(--green); }
.b-warn { background: var(--amber-soft); color: var(--amber); }
.b-bad { background: var(--red-soft); color: var(--red-ink); }

/* ---------- Messages ---------- */
.messages { list-style: none; margin-bottom: 14px; display: grid; gap: 8px; }
.messages li { padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: .9rem; }
.messages .success { border-color: rgba(47,191,113,.4); background: var(--green-soft); color: #c6f6da; }
.messages .error { border-color: rgba(255,107,131,.45); background: var(--red-soft); color: #ffd1d9; }

/* ---------- Steps ---------- */
.steps { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.steps li { list-style: none; flex: 1 0 auto; min-width: 74px; text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); padding-top: 8px; border-top: 3px solid var(--line-2); }
.steps li.done { border-top-color: var(--blue); color: var(--blue-ink); }
.steps li.now { border-top-color: var(--white); color: var(--white); }

/* ---------- Board ---------- */
.board { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .board { grid-template-columns: repeat(3, 1fr); } }
.wo-card { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); color: var(--text); text-decoration: none !important; }
.wo-card + .wo-card { margin-top: 8px; }
.wo-card:hover { border-color: var(--line-2); }
.wo-card .top { display: flex; justify-content: space-between; gap: 8px; font-size: .78rem; color: var(--muted); }
.wo-card .who { color: var(--white); font-weight: 700; margin-top: 3px; }
.wo-card .bottom { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: .84rem; }

/* ---------- Estimate editor ---------- */
.cat-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.cat-tabs button { flex: 0 0 auto; border: 1px solid var(--line-2); background: transparent; color: var(--text); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
.cat-tabs button.on { background: var(--white); color: var(--bg); border-color: var(--white); }
.item-grid { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .item-grid { grid-template-columns: 1fr 1fr; } }
.item-btn { text-align: left; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); border-radius: 12px; padding: 10px 12px; font: inherit; cursor: pointer; }
.item-btn:hover { border-color: var(--blue-2); }
.item-btn[disabled] { opacity: .4; cursor: not-allowed; }
.item-btn b { display: block; color: var(--white); font-size: .9rem; }
.item-btn .p { font-size: .82rem; color: var(--blue-ink); font-weight: 700; }
.item-btn .d { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }
.line-row { display: grid; gap: 8px; grid-template-columns: 1fr auto; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line-row .name { color: var(--white); font-weight: 700; font-size: .9rem; }
.line-row .controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.line-row .controls select, .line-row .controls input { min-height: 34px; padding: 5px 8px; width: auto; }
.line-row .controls input.qty { width: 64px; }
.line-row .controls input.price { width: 140px; }
.line-row .controls input.note { flex: 1 1 160px; }
.line-row .amt { text-align: right; font-weight: 800; color: var(--white); font-variant-numeric: tabular-nums; }
.line-row .amt .promo { display: block; font-size: .74rem; color: var(--green); font-weight: 700; }
.totals { margin-top: 12px; display: grid; gap: 4px; }
.totals div { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.totals .grand { font-size: 1.2rem; font-weight: 800; color: var(--white); padding-top: 6px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.sticky-save { position: sticky; bottom: 64px; z-index: 20; margin-top: 14px; padding: 10px; border-radius: 14px; background: rgba(18,21,27,.96); border: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
@media (min-width: 960px) { .sticky-save { bottom: 12px; } }

/* ---------- Photos ---------- */
.photos { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); }
@media (min-width: 720px) { .photos { grid-template-columns: repeat(5, 1fr); } }
.photos figure { position: relative; }
.photos img { aspect-ratio: 1; object-fit: cover; width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.photos figcaption { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.photos form { position: absolute; top: 4px; right: 4px; }
.photos form button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; }

/* ---------- Signature ---------- */
.sig-wrap { position: relative; border: 1px dashed var(--line-2); border-radius: 12px; background: #fff; touch-action: none; }
.sig-wrap canvas { display: block; width: 100%; height: 200px; border-radius: 12px; }
.sig-wrap .clear { position: absolute; right: 8px; top: 8px; }

/* ---------- Bars ---------- */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.bars span { flex: 1; background: var(--blue); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.bars span.zero { background: var(--line-2); }
.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--blue); }
.progress.ok span { background: var(--green); }

/* ---------- Detail lists ---------- */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: .9rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { color: var(--white); }
details.box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg-2); }
details.box + details.box { margin-top: 8px; }
details.box summary { cursor: pointer; font-weight: 700; color: var(--white); }
details.box[open] summary { margin-bottom: 10px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 14px; font-size: .86rem; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at top, rgba(8,121,201,.18), transparent 60%), var(--bg); }
.login .card { width: min(380px, 100%); padding: 24px; }
.login img { height: 34px; margin: 0 auto 18px; }
