/* Portal klien Juara Kargo - token warna sama dengan dashboard (Stylesheet.html). */
:root {
  --gold: #FFDF00;
  --gold-dark: #E6C800;
  --gold-soft: #FFF6BF;
  --ink: #1A1A1A;
  --muted: #666666;
  --border: #E5E5E5;
  --page: #F7F7F5;
  --surface: #FFFFFF;
  --ok: #2F9E44;
  --ok-soft: #E9F7EE;
  --warn: #7A5A00;
  --warn-soft: #FFF3CD;
  --danger: #C0392B;
  --danger-soft: #FBEAE8;
  --radius: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

.boot { padding: 48px 16px; text-align: center; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.right { text-align: right; }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 36px; height: 36px; }
.brand-name { font-weight: 700; font-size: 17px; line-height: 1.2; }
.brand-sub { color: var(--muted); font-size: 13px; }
.auth-card h1 { font-size: 20px; margin: 22px 0 4px; }
.auth-card p { margin: 0 0 18px; color: var(--muted); }
.auth-card .auth-foot { margin: 16px 0 0; }
.auth-card .actions { justify-content: space-between; align-items: center; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); outline: none;
}
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold-soft); }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.error { color: var(--danger); margin-top: 12px; min-height: 1em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 6px; border: 1px solid transparent; cursor: pointer;
  font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { background: var(--gold-dark); }
.btn-secondary { background: var(--surface); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-block { width: 100%; margin-top: 18px; padding: 11px 16px; }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: 0.6; cursor: default; }

/* ---------- kerangka ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.who { text-align: right; min-width: 0; }
.who-entity { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.who-actions { display: flex; gap: 12px; justify-content: flex-end; font-size: 13px; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); text-decoration: underline; }
.linkbtn:hover { color: var(--ink); }

.tabs {
  max-width: 1120px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto;
}
.tab {
  background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 12px; cursor: pointer;
  font-weight: 600; color: var(--muted); white-space: nowrap;
}
.tab.active { color: var(--ink); border-bottom-color: var(--gold); }

main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 48px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 22px; font-weight: 700; margin: 2px 0; }
.stat-sub { color: var(--muted); font-size: 13px; }
.stat.neg .stat-value { color: var(--danger); }
.stat.pos .stat-value { color: var(--ok); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px;
  cursor: pointer; font-size: 13px; font-weight: 600;
}
.chip.active { background: var(--gold-soft); border-color: var(--gold-dark); }
.search { flex: 1; min-width: 180px; max-width: 320px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--gold-soft); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FFFBE0; }
td.num, th.num { text-align: right; }
.empty { padding: 24px 12px; text-align: center; color: var(--muted); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #F0F0F0; color: var(--ink);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .sub { color: var(--muted); font-size: 13px; }
.list .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.inv-pick { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; }
.inv-pick label { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 6px 0; cursor: pointer; }
.inv-pick input { margin-top: 3px; }
.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.footer-note { color: var(--muted); font-size: 13px; text-align: center; margin-top: 24px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; max-width: calc(100% - 32px);
}
.toast.error { background: var(--danger); }

.linkbtn, .brand-name { white-space: nowrap; }

@media (max-width: 640px) {
  .brand-sub { display: none; }
  .brand img { width: 30px; height: 30px; }
  .who-actions .muted { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 17px; }
  main { padding-top: 16px; }
  th, td { padding: 8px 10px; }
}
