:root {
  --red: #ec1c24;
  --red-d: #c1121a;
  --ink: #2b2f36;
  --muted: #7a8290;
  --line: #e6e9ee;
  --bg: #eef1f5;
  --card: #fff;
  --sidebar: #ffffff;
  --ok: #1a9c4a;
  --err: #dc2626;
  --warn: #d97706;
  --radius: 10px;
  --side-w: 244px;
  --head-h: 60px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 14px;
}
a { color: inherit; }

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

.sidebar {
  width: var(--side-w); flex-shrink: 0; background: var(--sidebar);
  border-right: 1px solid var(--line); position: fixed; top: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column; z-index: 20;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.side-brand .logo {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--red), var(--red-d));
  color: #fff; font-weight: 800; font-size: 15px; display: grid; place-items: center; letter-spacing: .5px;
  text-decoration: none;
}
.side-brand b { font-size: 15px; display: block; }
.side-brand small { color: var(--muted); font-size: 11px; }

.side-nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav-sec { font-size: 10px; font-weight: 700; color: #aab1bd; text-transform: uppercase; letter-spacing: .6px; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 8px;
  color: #4b5563; text-decoration: none; font-weight: 600; font-size: 13.5px; margin-bottom: 2px;
  border-left: 3px solid transparent; transition: background .12s, color .12s;
}
.nav-item:hover { background: #f5f6f8; color: var(--ink); }
.nav-item.active { background: #fdeaea; color: var(--red); border-left-color: var(--red); }
.nav-item .ni-ico { font-size: 16px; width: 20px; text-align: center; }

.main-wrap { flex: 1; margin-left: var(--side-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--head-h); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  position: sticky; top: 0; z-index: 15;
}
.tb-left { font-weight: 700; color: var(--muted); font-size: 13px; }
.tb-right { display: flex; align-items: center; gap: 14px; }
.tb-lang { font-size: 12px; color: var(--muted); font-weight: 700; }
.tb-lang b { color: var(--red); }
.tb-user {
  display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600;
}
.tb-user .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #eef1f5; color: var(--muted);
  display: grid; place-items: center; font-weight: 700;
}
.tb-logout {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px;
  padding: 7px 13px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.tb-logout:hover { border-color: var(--red); color: var(--red); }

.content { padding: 24px 28px; flex: 1; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; display: inline-block; }
.page-head h1::after { content: ""; display: block; width: 56px; height: 3px; background: var(--red); border-radius: 2px; margin-top: 8px; }
.page-head p { color: var(--muted); margin: 8px 0 0; font-size: 13px; }

/* ───────── Cards ───────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(16,24,40,.04); max-width: 920px;
}
.card-head { display: flex; align-items: center; gap: 8px; background: #f7f8fa; margin: -22px -22px 18px; padding: 13px 22px; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; font-weight: 700; font-size: 14px; }

h2 { font-size: 16px; margin: 0 0 4px; }
.muted { color: var(--muted); font-size: 13px; }

/* ───────── Forms ───────── */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
input, select {
  width: 100%; margin-top: 6px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; outline: none; transition: border .15s; background: #fff; color: var(--ink);
}
textarea {
  width: 100%; margin-top: 6px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: ui-monospace, "Cascadia Code", monospace;
  outline: none; resize: vertical; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--red); }

.btn, .btn-ghost {
  border: 0; border-radius: 8px; padding: 11px 20px; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn { background: var(--red); color: #fff; }
.btn:hover { background: var(--red-d); }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-ghost { background: #f1f3f6; color: var(--ink); }
.btn-ghost:hover { background: #e7eaef; }

.row { display: flex; gap: 10px; }
.filters { display: flex; gap: 10px; margin-bottom: 14px; max-width: 560px; }
.filters input { margin-top: 0; flex: 1; }
.filters select { margin-top: 0; width: auto; min-width: 150px; }
.filters .btn { white-space: nowrap; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.chk input { width: auto; margin: 0; }

.msg { margin-top: 16px; padding: 12px 14px; border-radius: 8px; font-size: 13px; }
.msg.ok { background: #eafaf0; color: #15803d; border: 1px solid #bbf7d0; }
.msg.err { background: #fef2f2; color: var(--err); border: 1px solid #fecaca; }
.msg.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.out {
  margin-top: 14px; background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px;
  font-size: 12px; overflow-x: auto; max-height: 360px; white-space: pre-wrap; word-break: break-word;
}
.hidden { display: none !important; }
.loading { color: var(--muted); font-size: 13px; padding: 16px; text-align: center; }

.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; vertical-align: -2px; margin-right: 8px; }
.spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── DSC-style result grid ("Hasil Pencarian") ───────── */
.result-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 16px; }
.result-card .rc-head { background: #f7f8fa; padding: 12px 18px; font-weight: 700; font-size: 13.5px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.result-grid .rg-cell { padding: 14px 18px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.result-grid .rg-cell small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; margin-bottom: 3px; }
.result-grid .rg-cell b { font-size: 14px; font-weight: 600; word-break: break-word; }

/* key/value table */
.kv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kv td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv td:first-child { color: var(--muted); font-weight: 600; width: 38%; word-break: break-word; }
.kv td:last-child { word-break: break-word; }

.sec-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 18px 0 8px; }
.raw { margin-top: 12px; }
.raw summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; }

/* badges */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; }
.badge.ok { background: #eafaf0; color: #15803d; }
.badge.err { background: #fef2f2; color: var(--err); }
.badge.info { background: #eff6ff; color: #1d4ed8; }

/* packets (MSISDN status kuota) */
.pkt { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.pkt-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pkt-top span { font-size: 13px; color: var(--red); font-weight: 700; }
.pkt-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ───────── Stepper (E-Form wizard) ───────── */
.steps { display: flex; list-style: none; padding: 0; margin: 0 0 24px; gap: 4px; }
.steps li { flex: 1; text-align: center; font-weight: 700; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; }
.steps li::before { content: ""; width: 30px; height: 30px; border-radius: 50%; background: #e8ebf0; color: #fff; display: grid; place-items: center; font-size: 0; }
.steps li span { font-weight: 600; font-size: 11px; }
.steps li.active { color: var(--red); }
.steps li.active::before { background: var(--red); }
.steps li.done::before { background: var(--ok); }
.step { max-width: 560px; }

/* uploader */
.uploader { margin-bottom: 14px; max-width: 560px; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; border: 2px dashed var(--line); border-radius: 10px; padding: 24px; text-align: center; color: var(--muted); font-size: 14px; font-weight: 600; transition: border .15s; }
.drop:hover { border-color: var(--red); }
.preview { max-width: 100%; max-height: 220px; border-radius: 8px; object-fit: contain; }
.fields { margin-top: 6px; max-width: 560px; }
.ocr-note { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.dummy-note { font-size: 11px; color: var(--muted); margin: -4px 0 4px; }

/* history list */
.list { display: flex; flex-direction: column; gap: 8px; min-height: 60px; max-width: 920px; }
.list-row { display: flex; align-items: center; gap: 12px; cursor: pointer; border: 1px solid var(--line); border-radius: 9px; padding: 13px 16px; transition: border .15s, background .12s; background: #fff; }
.list-row:hover { border-color: var(--red); background: #fffafa; }
.lr-main { flex: 1; min-width: 0; }
.lr-top { display: flex; align-items: center; gap: 10px; }
.lr-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.lr-id { color: #9ca3af; font-size: 11px; margin-top: 2px; word-break: break-all; }
.lr-chev { color: var(--muted); font-size: 22px; }

.summary-bar { display: flex; gap: 10px; margin-bottom: 16px; max-width: 920px; }
.sm-cell { flex: 1; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 12px 6px; }
.sm-cell b { display: block; font-size: 19px; }
.sm-cell small { font-size: 10.5px; color: var(--muted); }
.sm-cell.ok b { color: var(--ok); }
.sm-cell.err b { color: var(--err); }
.sm-cell.info b { color: #1d4ed8; }

.pager { display: flex; align-items: center; justify-content: flex-start; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.pager .btn-ghost { padding: 9px 16px; }
.page-info { font-size: 13px; color: var(--muted); font-weight: 600; }
.pager-goto { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pager-goto input { width: 70px; margin: 0; padding: 8px 10px; }
.pager-goto .btn-ghost { padding: 9px 14px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { background: #fff; width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto; border-radius: 12px; padding: 22px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-x { border: 0; background: #f1f3f6; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.detail-status { display: inline-block; margin-bottom: 12px; font-size: 13px; }

/* order box / done */
.order-box { background: #f7f8fa; border: 1px solid var(--line); border-radius: 10px; padding: 16px; text-align: center; max-width: 420px; }
.order-box small { color: var(--muted); font-size: 12px; display: block; }
.order-box b { font-size: 24px; letter-spacing: .5px; }
.done-badge { width: 56px; height: 56px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 28px; margin: 0 auto 12px; }
#stepDone { text-align: center; max-width: 560px; }
#stepDone .out { text-align: left; }
.imei-card { margin-top: 14px; max-width: 560px; }

/* dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; max-width: 920px; }
.tile { display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; transition: border .15s, transform .05s; }
.tile:hover { border-color: var(--red); transform: translateY(-1px); }
.tile .t-ico { font-size: 24px; }
.tile b { display: block; font-size: 14px; }
.tile small { color: var(--muted); font-size: 12px; }

.wallet { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, #2b2f36, #1a1d21); color: #fff; border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; max-width: 420px; }
.wallet small { color: #aab1bd; font-size: 12px; display: block; }
.wallet b { font-size: 22px; }
.wallet .btn-ghost { background: rgba(255,255,255,.12); color: #fff; }

/* ───────── Login (no sidebar) ───────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, #f5f6f8, #e9edf2); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px; width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(16,24,40,.08); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .logo { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--red), var(--red-d)); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 17px; }
.login-brand h1 { font-size: 18px; margin: 0; }
.login-brand small { color: var(--muted); font-size: 12px; }
.login-card .btn { width: 100%; }
.login-card .row .btn-ghost { width: 38%; }
.login-card .row .btn { width: 62%; }

/* responsive: collapse sidebar to icons on narrow screens */
@media (max-width: 860px) {
  :root { --side-w: 60px; }
  .side-brand b, .side-brand small, .nav-item span:not(.ni-ico), .nav-sec { display: none; }
  .side-brand { justify-content: center; padding: 16px 0; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .result-grid { grid-template-columns: 1fr; }
  .content { padding: 18px 14px; }
}
