/* ===== LAPAK SERBA 10K — design tokens ===== */
/* Ganti 3 var brand di bawah untuk ganti tema (merah/hijau/biru dst):
   --brand, --brand-2, --brand-soft + gradient login di .login-wrap */
:root {
  --bg: #f6f4f4;
  --surface: #ffffff;
  --ink: #1f1a1c;
  --ink-2: #6b5c60;
  --line: #e9e3e4;
  --brand: #e11d48;
  --brand-2: #be123c;
  --brand-soft: #fde8ec;
  --accent: #d97706;      /* harga / aksi penting */
  --danger: #d13b3b;
  --tag-green: #e3f3ec;
  --tag-green-ink: #0e7a5f;
  --tag-yellow: #fdf3d8;
  --tag-yellow-ink: #92600a;
  --tag-red: #fdeaea;
  --tag-red-ink: #c33535;
  --tag-gray: #eef0ec;
  --tag-gray-ink: #5c6b62;
  --tag-blue: #e4eefb;
  --tag-blue-ink: #2a5da8;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16,24,20,.06), 0 8px 24px -12px rgba(16,24,20,.12);
  --font: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.45;
}

/* ---------- Header ---------- */
header {
  background: var(--brand);
  color: #fff;
  padding: 14px 20px 16px;
  position: sticky; top: 0; z-index: 50;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 8px 20px -16px rgba(8,60,45,.5);
}
header h1 { font-size: 17px; font-weight: 800; letter-spacing: .2px; display:flex; align-items:center; gap:8px; }
header .sub { font-size: 12px; opacity: .82; margin-top: 3px; }
.brand-dot { width: 22px; height: 22px; border-radius: 7px; background: #fff; color: var(--brand); display:inline-flex; align-items:center; justify-content:center; font-size:12px; font-weight:900; }

/* ---------- Nav (bottom tabs) ---------- */
nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 20px -12px rgba(16,24,20,.15);
}
nav button {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; color: var(--ink-2); font-size: 10.5px; font-weight: 600;
  border-radius: 10px;
}
nav button .nav-ic { font-size: 18px; line-height: 1; display:inline-flex; }
nav button.active { color: var(--brand); background: var(--brand-soft); }
nav button.active .nav-ic { transform: translateY(-1px); }

/* Tombol keluar di header */
.logout-btn {
  position: absolute; right: 14px; top: 12px;
  background: rgba(255,255,255,.14); color: #fff; border: none;
  border-radius: 9px; padding: 6px 11px; font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: var(--font); display: inline-flex; align-items: center; gap: 5px;
}
.logout-btn:active { background: rgba(255,255,255,.25); }
header { position: sticky; top: 0; z-index: 50; }

/* ---------- Main ---------- */
main { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 15px 16px; margin-bottom: 12px; box-shadow: var(--shadow); border: 1px solid rgba(16,24,20,.03); }
.card h3 { font-size: 14.5px; font-weight: 800; margin-bottom: 8px; }
.muted { color: var(--ink-2); font-size: 12.5px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.owner { background: var(--tag-yellow); color: var(--tag-yellow-ink); }
.badge.admin { background: var(--tag-blue); color: var(--tag-blue-ink); }
.badge.utama { background: var(--tag-green); color: var(--tag-green-ink); }
.badge.cabang { background: var(--tag-gray); color: var(--tag-gray-ink); }
.badge.on { background: var(--tag-green); color: var(--tag-green-ink); }
.badge.off { background: var(--tag-red); color: var(--tag-red-ink); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 18px; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 700; cursor: pointer; font-family: var(--font); transition: transform .08s, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px -6px rgba(14,122,95,.5); }
.btn.secondary { background: #f1f3ef; color: var(--ink); }
.btn.small { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn.danger { background: var(--tag-red); color: var(--danger); }
.btn:disabled { opacity: .5; transform: none; }
.btn .ic { display: inline-flex; align-items: center; }

/* ---------- Form ---------- */
input, select, textarea { width: 100%; padding: 12px 13px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font-size: 15px; background: var(--surface); color: var(--ink); margin-bottom: 12px; font-family: var(--font); outline: none; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; letter-spacing: .2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search { padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; width: 100%; font-size: 15px; margin-bottom: 12px; background: var(--surface); outline: none; font-family: var(--font); }
.search:focus { border-color: var(--brand); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(170deg, #e11d48, #881337 65%); }
.login-card { background: #fff; border-radius: 20px; padding: 30px 26px; width: 100%; max-width: 380px; box-shadow: 0 24px 60px -20px rgba(90,10,30,.55); }
.login-card h1 { font-size: 21px; font-weight: 800; margin-bottom: 4px; display:flex; align-items:center; gap:9px; }
.login-card .sub { color: var(--ink-2); font-size: 13px; margin-bottom: 22px; }

/* ---------- Misc ---------- */
.error { background: var(--tag-red); color: var(--danger); padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; display: none; font-weight: 600; }
.flash { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%); background: #16201b; color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 13px; font-weight: 600; z-index: 100; opacity: 0; transition: opacity .25s; pointer-events: none; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); }
.flash.show { opacity: 1; }
.modal-bg { position: fixed; inset: 0; background: rgba(10,20,15,.5); display: none; align-items: flex-end; justify-content: center; z-index: 90; }
.modal-bg.show { display: flex; }
.modal { background: var(--surface); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; animation: slideUp .22s ease; }
.modal h2 { font-size: 17px; font-weight: 800; margin-bottom: 16px; }
.modal-close { position: absolute; top: 14px; right: 16px; font-size: 20px; border: none; background: none; cursor: pointer; color: var(--ink-2); }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border: 1px solid rgba(16,24,20,.03); }
.stat .num { font-size: 21px; font-weight: 800; font-family: var(--mono); letter-spacing: -.3px; }
.stat .lbl { font-size: 11px; color: var(--ink-2); margin-top: 2px; font-weight: 600; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--ink-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 8px; border-bottom: 1px solid #f2f4f0; vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--ink-2); padding: 34px 0; font-size: 14px; font-weight: 500; }

/* ---------- Settings (sub menu) ---------- */
.settings-group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(16,24,20,.03); overflow: hidden; }
.setting-item { display: flex; align-items: center; gap: 13px; width: 100%; padding: 15px 16px; border: none; background: none; cursor: pointer; text-align: left; border-bottom: 1px solid var(--line); font-family: var(--font); }
.setting-item:last-child { border-bottom: none; }
.setting-item:active { background: var(--brand-soft); }
.setting-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.setting-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.setting-txt strong { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.setting-arrow { color: var(--ink-2); font-size: 20px; font-weight: 300; }

/* ---------- Command palette (Beranda) ---------- */
.command-search { position: relative; margin-bottom: 14px; }
.cmd-input { padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; width: 100%; font-size: 15px; background: var(--surface); outline: none; font-family: var(--font); box-shadow: var(--shadow); }
.cmd-input:focus { border-color: var(--brand); }
.cmd-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border-radius: 14px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.25); border: 1px solid var(--line); z-index: 70; overflow: hidden; }
.cmd-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 13px 16px; border: none; background: none; cursor: pointer; text-align: left; font-family: var(--font); font-size: 14px; border-bottom: 1px solid var(--line); }
.cmd-item:last-child { border-bottom: none; }
.cmd-item:active { background: var(--brand-soft); }
.cmd-label { font-weight: 600; color: var(--ink); }
.cmd-arrow { color: var(--ink-2); font-size: 18px; }
.cmd-empty { padding: 16px; color: var(--ink-2); font-size: 13px; text-align: center; }

/* ---------- Tabel ala Excel (Operasional) ---------- */
.ops-table {
  display: grid;
  grid-template-columns: var(--cols, 110px 1fr 80px);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  max-height: 60vh;
  overflow-y: auto;
}
.ops-th {
  background: #f1f3ef;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--ink-2);
  padding: 9px 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
}
.ops-td {
  padding: 7px 10px;
  font-size: 13px;
  border-bottom: 1px solid #f2f4f0;
  display: flex;
  align-items: center;
  min-width: 0;
}
.ops-td.sup { color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ops-td:last-child { justify-content: center; }
.ops-table > .ops-td:nth-last-child(-n+3) { border-bottom: none; }