/* Aplikasi Gudang — tampilan (mobile dulu, lalu layar lebar) */
:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --line-2: #d0d5dd;
  --soft: #f9fafb;
  --primary: #1458b8;
  --primary-700: #0e4593;
  --primary-50: #ebf2fc;
  --in: #11795a;
  --in-700: #0b5c44;
  --in-50: #e6f5ee;
  --out: #c2500e;
  --out-700: #993d08;
  --out-50: #fdf0e6;
  --adj: #6941c6;
  --adj-50: #f2edfd;
  --warn: #b54708;
  --warn-50: #fff6e5;
  --danger: #c01f1f;
  --danger-50: #fdeded;
  --ok: #11795a;
  --ok-50: #e6f5ee;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, 0.2);
  --top-h: 56px;
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
a { color: var(--primary); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.ic { flex: none; display: block; }
[hidden] { display: none !important; }
.stack > * + * { margin-top: 12px; }
.stack-sm > * + * { margin-top: 8px; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .grid2.collapse { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ Kerangka */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--top-h);
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px 0 6px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 8px; }
.topbar .back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--text); }
.topbar .back:active { background: var(--soft); }
.topbar .back + h1 { padding-left: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-50); color: var(--primary);
  font-weight: 700; font-size: 14px; text-decoration: none; flex: none;
}
.page { padding: 16px 16px calc(var(--nav-h) + 28px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
.page.wide { max-width: 1100px; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: #fff;
  border-top: 1px solid var(--line);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.bottomnav a.active { color: var(--primary); }
.bottomnav a.nav-in.active { color: var(--in); }
.bottomnav a.nav-out.active { color: var(--out); }

.sidebar { display: none; }
@media (min-width: 960px) {
  .bottomnav { display: none; }
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0; width: 250px; z-index: 25;
    background: #fff; border-right: 1px solid var(--line);
    padding: 14px 12px; overflow-y: auto;
  }
  .main { margin-left: 250px; }
  .page { padding-bottom: 48px; }
  .topbar { padding-left: 16px; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand img { width: 34px; height: 34px; }
.brand b { display: block; font-size: 15px; line-height: 1.2; }
.brand span { font-size: 12px; color: var(--muted); }
.side-section { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 14px 10px 6px; }
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 14px;
}
.side-link:hover { background: var(--soft); }
.side-link.active { background: var(--primary-50); color: var(--primary); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------------ Kartu & daftar */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card + .card, .card + .list, .list + .card { margin-top: 12px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.card-title .step {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; background: var(--primary-50); color: var(--primary);
}
.card-title a, .card-title .link { margin-left: auto; font-size: 13.5px; font-weight: 600; text-decoration: none; }
.section-head { display: flex; align-items: baseline; gap: 8px; margin: 22px 2px 10px; }
.section-head h3 { font-size: 15px; }
.section-head a { margin-left: auto; font-size: 13.5px; font-weight: 600; text-decoration: none; }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  color: inherit; text-decoration: none;
  border-top: 1px solid var(--line);
  background: none; border-left: 0; border-right: 0; border-bottom: 0;
  width: 100%; text-align: left; font: inherit; cursor: pointer;
}
.row:first-child { border-top: 0; }
.row:active { background: var(--soft); }
@media (hover: hover) { .row:hover { background: var(--soft); } }
.row-main { flex: 1; min-width: 0; }
.row-main b { font-weight: 650; }
.row-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-sub { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { text-align: right; flex: none; }
.row-end b { display: block; font-size: 17px; }
.row-end small { color: var(--muted); }
.row .chev { color: var(--line-2); }
.row-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.row-icon.in { background: var(--in-50); color: var(--in); }
.row-icon.out { background: var(--out-50); color: var(--out); }
.row-icon.adj { background: var(--adj-50); color: var(--adj); }
.row.voided .row-main b { text-decoration: line-through; color: var(--muted); }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .ic { margin: 0 auto 8px; color: var(--line-2); }
.empty b { display: block; color: var(--text-2); margin-bottom: 2px; }
.empty-mini { padding: 14px; text-align: center; color: var(--muted); font-size: 14px; background: var(--soft); border: 1px dashed var(--line-2); border-radius: var(--radius-sm); }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 0; color: var(--muted); }
.spinner { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ Beranda */
.hello { margin: 2px 2px 14px; }
.hello h2 { font-size: 22px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: flex; flex-direction: column; gap: 6px;
  min-height: 118px; padding: 14px;
  border-radius: var(--radius); text-decoration: none; color: #fff;
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.12);
}
.tile b { font-size: 16.5px; margin-top: auto; }
.tile span { font-size: 12.5px; opacity: 0.92; line-height: 1.3; }
.tile:active { transform: scale(0.98); }
.tile-in { background: linear-gradient(140deg, #14936d, var(--in-700)); }
.tile-out { background: linear-gradient(140deg, #e0661d, var(--out-700)); }
.tile-photo { background: linear-gradient(140deg, #2a6fd0, var(--primary-700)); }
.tile-stock { background: #fff; color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow); }
.tile-stock .ic { color: var(--primary); }
.tile-stock span { color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat b { font-size: 24px; line-height: 1.2; }
.stat small { color: var(--muted); margin-left: 4px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

/* ------------------------------------------------------------------ Lencana & chip */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  background: var(--soft); color: var(--text-2); border: 1px solid var(--line);
}
.badge-in { background: var(--in-50); color: var(--in); border-color: transparent; }
.badge-out { background: var(--out-50); color: var(--out); border-color: transparent; }
.badge-adj { background: var(--adj-50); color: var(--adj); border-color: transparent; }
.badge-ok { background: var(--ok-50); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-50); color: var(--warn); border-color: transparent; }
.badge-danger, .badge-void { background: var(--danger-50); color: var(--danger); border-color: transparent; }
.badge-admin { background: var(--primary-50); color: var(--primary); border-color: transparent; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line-2); background: #fff; color: var(--text-2);
  font-weight: 600; font-size: 13.5px; line-height: 1.2; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.chip .count { opacity: 0.7; margin-left: 2px; }

.seg { display: inline-flex; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; font-family: inherit; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }

/* ------------------------------------------------------------------ Tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border-radius: 11px; border: 1px solid transparent;
  font-weight: 650; font-size: 15px; line-height: 1.2; font-family: inherit; text-decoration: none; cursor: pointer;
  background: var(--soft); color: var(--text); white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--primary-700); }
.btn-in { background: var(--in); color: #fff; }
.btn-in:not(:disabled):hover { background: var(--in-700); }
.btn-out { background: var(--out); color: #fff; }
.btn-out:not(:disabled):hover { background: var(--out-700); }
.btn-adj { background: var(--adj); color: #fff; }
.btn-secondary { background: #fff; border-color: var(--line-2); color: var(--text); }
.btn-secondary:not(:disabled):hover { background: var(--soft); }
.btn-ghost { background: none; color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: none; color: var(--danger); border-color: #f1c4c4; }
.btn-lg { min-height: 52px; font-size: 16px; border-radius: 13px; }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: 13.5px; border-radius: 9px; }
.btn-block { display: flex; width: 100%; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer;
}
.icon-btn:active, .icon-btn:hover { background: var(--soft); color: var(--text); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions.one { grid-template-columns: 1fr; }

/* ------------------------------------------------------------------ Isian */
.field { display: block; }
.field > span, .label { display: block; font-size: 13.5px; font-weight: 650; color: var(--text-2); margin-bottom: 5px; }
.field .hint, .hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.field .hint.ok { color: var(--ok); }
.field .hint.new { color: var(--primary); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  width: 100%; min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: 11px;
  background: #fff; color: var(--text);
  font-size: 16px; line-height: 1.3; font-family: inherit;
  outline: none;
  -webkit-appearance: none; appearance: none;
}
select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(20, 88, 184, 0.15); }
input[readonly] { background: var(--soft); }
input.invalid { border-color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.search-input { position: relative; }
.search-input .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input input { padding-left: 38px !important; }

/* Daftar saran (cari barang / pemasok) */
.combo { position: relative; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 15;
  background: #fff; border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: var(--shadow-lg); max-height: 330px; overflow-y: auto;
}
.sug {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 13px; border: 0; border-top: 1px solid var(--line);
  background: none; font: inherit; text-align: left; cursor: pointer; color: var(--text);
}
.sug:first-child { border-top: 0; }
.sug:hover, .sug.active { background: var(--primary-50); }
.sug-main { flex: 1; min-width: 0; }
.sug-main b { display: block; font-weight: 600; }
.sug-main small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-stock { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.sug-stock.zero { color: var(--danger); }
.sug-new { color: var(--primary); font-weight: 650; }

/* Baris barang di form */
.lines > * + * { margin-top: 8px; }
.line { border: 1px solid var(--line); border-radius: 12px; padding: 10px 10px 10px 12px; background: var(--soft); }
.line-head { display: flex; gap: 8px; align-items: flex-start; }
.line-head .row-main b { display: block; font-weight: 650; line-height: 1.3; }
.line-head small { color: var(--muted); font-size: 12.5px; }
.line-qty { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.line-warn { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--danger); font-weight: 600; }
.qty { display: inline-flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 11px; overflow: hidden; background: #fff; }
.qty button { width: 46px; border: 0; background: #fff; color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.qty button:active { background: var(--soft); }
.qty input { width: 84px !important; min-height: 46px; border: 0 !important; border-left: 1px solid var(--line) !important; border-right: 1px solid var(--line) !important; border-radius: 0 !important; text-align: center; font-weight: 700; font-size: 18px !important; box-shadow: none !important; }
.unit { color: var(--muted); font-weight: 600; }

.sticky-actions {
  position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); z-index: 10;
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; padding: 10px 10px 10px 16px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: 0 6px 24px rgba(16, 24, 40, 0.14);
}
.sticky-actions .sum { flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); line-height: 1.3; }
.sticky-actions .sum b { display: block; color: var(--text); font-size: 15px; }
@media (min-width: 960px) { .sticky-actions { bottom: 12px; } }

/* ------------------------------------------------------------------ Detail transaksi */
.trx-head { border-top: 5px solid var(--line-2); }
.trx-head.in { border-top-color: var(--in); }
.trx-head.out { border-top-color: var(--out); }
.trx-head.adj { border-top-color: var(--adj); }
.trx-type { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.trx-head.in .trx-type { color: var(--in); }
.trx-head.out .trx-type { color: var(--out); }
.trx-head.adj .trx-type { color: var(--adj); }
.trx-number { font-size: 26px; font-weight: 800; letter-spacing: 0.01em; margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.items-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.items-table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 650; padding: 0 6px 6px; border-bottom: 1px solid var(--line); }
.items-table td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.items-table tr:last-child td { border-bottom: 0; }
.items-table td.num, .items-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.items-table small { color: var(--muted); display: block; }
.pos { color: var(--ok); font-weight: 700; }
.neg { color: var(--danger); font-weight: 700; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.photo { position: relative; border-radius: 10px; overflow: hidden; background: var(--soft); border: 1px solid var(--line); aspect-ratio: 3 / 4; cursor: zoom-in; padding: 0; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .tag { position: absolute; left: 5px; bottom: 5px; right: 5px; font-size: 11px; font-weight: 700; background: rgba(16, 24, 40, 0.72); color: #fff; padding: 2px 6px; border-radius: 6px; text-align: left; }
.viewer { position: fixed; inset: 0; z-index: 75; background: rgba(10, 14, 22, 0.94); display: flex; flex-direction: column; }
.viewer img { flex: 1; min-height: 0; object-fit: contain; width: 100%; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: #fff; font-size: 13.5px; }
.viewer-bar .icon-btn { color: #fff; }

/* ------------------------------------------------------------------ Banner */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.banner .ic { margin-top: 1px; }
.banner > div > b:first-child { display: block; }
.banner-ok { background: var(--ok-50); color: #0b4d39; }
.banner-ok .ic { color: var(--ok); }
.banner-info { background: var(--primary-50); color: #123a75; }
.banner-info .ic { color: var(--primary); }
.banner-warn { background: var(--warn-50); color: #7a3306; }
.banner-warn .ic { color: var(--warn); }
.banner-danger { background: var(--danger-50); color: #7f1414; }
.banner-danger .ic { color: var(--danger); }
.banner .btn-sm { margin-top: 8px; }
.steps { margin: 6px 0 0; padding-left: 20px; }
.steps li + li { margin-top: 2px; }

/* ------------------------------------------------------------------ Foto struk */
.scan-hero { text-align: center; padding: 22px 16px; }
.scan-hero .qr-illu { width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.scan-hero p { color: var(--muted); margin: 6px auto 16px; max-width: 380px; }
.scan-result { display: flex; gap: 12px; align-items: flex-start; }
.scan-result .thumb { width: 74px; height: 98px; border-radius: 10px; object-fit: cover; flex: none; background: var(--soft); border: 1px solid var(--line); }

/* ------------------------------------------------------------------ Stok */
.stock-num { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stock-num.low { color: var(--warn); }
.stock-num.zero { color: var(--danger); }
.big-stock { display: flex; align-items: baseline; gap: 6px; }
.big-stock b { font-size: 34px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .search-input { flex: 1; min-width: 200px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { position: sticky; top: 0; background: var(--soft); text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--soft); }
.table tfoot td { font-weight: 700; background: var(--soft); }
.opname-input { width: 92px !important; min-height: 40px !important; text-align: right; font-weight: 700; padding: 6px 10px !important; }

/* ------------------------------------------------------------------ Masuk / daftar halaman awal */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, #e8f0fb, #f2f4f7 55%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 26px 22px; box-shadow: 0 10px 40px rgba(16, 24, 40, 0.1); border: 1px solid var(--line); }
.auth-logo { width: 58px; height: 58px; margin-bottom: 14px; }
.auth h1 { font-size: 23px; margin-bottom: 4px; }
.auth .sub { color: var(--muted); margin-bottom: 18px; }

/* ------------------------------------------------------------------ Modal & toast */
.modal-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(16, 24, 40, 0.5); display: flex; align-items: flex-end; justify-content: center; }
.modal {
  width: 100%; max-width: 520px; max-height: 92vh; overflow: hidden;
  display: flex; flex-direction: column;
  background: #fff; border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg);
  animation: up 0.18s ease-out;
  padding-bottom: var(--safe-b);
}
.modal-wide { max-width: 760px; }
@media (min-width: 640px) {
  .modal-wrap { align-items: center; padding: 20px; }
  .modal { border-radius: 18px; animation: pop 0.15s ease-out; }
}
@keyframes up { from { transform: translateY(30px); opacity: 0.5; } }
@keyframes pop { from { transform: scale(0.97); opacity: 0.5; } }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 6px 18px; }
.modal-head h3 { flex: 1; font-size: 17px; }
.modal-body { padding: 6px 18px 12px; overflow-y: auto; }
.modal-actions { display: flex; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.modal-actions .btn { flex: 1; }
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  max-width: 520px; padding: 11px 16px; border-radius: 12px;
  background: #1d2939; color: #fff; font-size: 14.5px; font-weight: 550;
  box-shadow: var(--shadow-lg); transition: opacity 0.25s, transform 0.25s; white-space: pre-line;
}
.toast-ok { background: #0b5c44; }
.toast-error { background: #a31818; }
.toast.hide { opacity: 0; transform: translateY(8px); }
@media (min-width: 960px) { #toasts { bottom: 24px; left: 250px; } }

/* ------------------------------------------------------------------ Menu */
.menu-user { display: flex; align-items: center; gap: 12px; }
.menu-user .avatar { width: 46px; height: 46px; font-size: 18px; }
.row .row-icon.plain { background: var(--soft); color: var(--text-2); }
.version { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 18px; }
.preview-table td.err { color: var(--danger); }
