:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e4e6eb;
  --text: #1d2330;
  --muted: #6b7280;
  --primary: #2f5bd3;
  --primary-soft: #e9effc;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --danger: #c62828;
  --danger-soft: #fdeaea;
  --tr: #6d28d9;
  --tr-soft: #f1eafd;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.r { text-align: right; }
.neg { color: var(--danger); font-weight: 600; }
.pos { color: var(--ok); font-weight: 600; }

/* layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 290px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 12px;
  display: flex; flex-direction: column;
}
.sidebar-foot { margin-top: auto; padding: 14px 8px 2px; border-top: 1px solid var(--border); font-size: 11px; line-height: 1.5; color: var(--muted); }
.sidebar-foot b { display: block; color: var(--text); font-size: 11.5px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.brand-logo { width: 38px; height: 38px; flex-shrink: 0; }
.brand-logo svg { display: block; }
.brand b { display: block; }
.brand small { color: var(--muted); }
#nav a {
  display: flex; gap: 12px; padding: 11px 10px; border-radius: 10px; color: var(--text); margin-bottom: 2px;
  border: 1px solid transparent;
}
#nav a:hover { background: #f3f4f6; }
#nav a.active { background: var(--primary-soft); border-color: #cdd9f7; }
#nav a.active .ico { color: var(--primary); }
#nav .ico { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; color: #374151; }
#nav b { display: block; font-weight: 600; font-size: 14px; }
#nav small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.35; }
.ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.crumb { font-weight: 600; flex: 1; }
.topbar-date { color: var(--muted); font-size: 13px; }
.menu-btn { display: none; font-size: 20px; }
.view { padding: 24px; max-width: 1400px; width: 100%; }
.backdrop { display: none; }

/* page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }
.card h4 { font-size: 14px; margin: 18px 0 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 24px; font-weight: 700; margin: 6px 0 4px; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.kpi.warn { border-color: #f5d29b; background: var(--warn-soft); }
.kpi.warn .value { color: var(--warn); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

/* buttons & forms */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 18px; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: #f3f4f6; color: var(--text); }
input, select, textarea {
  font: inherit; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
  width: 100%; min-width: 0;
}
textarea { height: auto; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d5f8; border-color: var(--primary); }
input.invalid { border-color: var(--danger); background: var(--danger-soft); }
input[type=checkbox] { width: auto; height: auto; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.form-grid .span2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.filters label { min-width: 160px; }
.filters label.grow { flex: 1; min-width: 200px; }
.filters label.wide { min-width: 300px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.search { width: 240px; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.tbl th { background: #f9fafb; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tbl th.r, .tbl td.r { text-align: right; white-space: nowrap; }
.tbl td.mono, .tbl td .mono { white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl.click tbody tr { cursor: pointer; }
.tbl.click tbody tr:hover { background: #f8faff; }
.tbl tfoot td { background: #f9fafb; font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; }
.tbl tr.sub td { background: #fbfbfc; font-weight: 600; }
.tbl tr.hidden { display: none; }
.tbl.lines td { padding: 6px 8px; }
.tbl.lines input { height: 32px; }
.tbl.lines input[type=number] { min-width: 100px; }
.tbl.lines input[list] { min-width: 240px; }
.tbl .actions-cell { white-space: nowrap; text-align: right; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.t-GR { background: var(--ok-soft); color: var(--ok); }
.t-GI { background: var(--danger-soft); color: var(--danger); }
.t-TR { background: var(--tr-soft); color: var(--tr); }
.t-OP { background: var(--warn-soft); color: var(--warn); }
.s-OK { background: var(--ok-soft); color: var(--ok); }
.s-LOW { background: var(--warn-soft); color: var(--warn); }
.s-HABIS { background: var(--danger-soft); color: var(--danger); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
/* bayangan pudar di tepi bila masih ada tab yang tersembunyi (geser ke samping) */
.tabs.more-right { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
.tabs.more-left { -webkit-mask-image: linear-gradient(to left, #000 82%, transparent); mask-image: linear-gradient(to left, #000 82%, transparent); }
.tabs.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 15%, #000 85%, transparent); mask-image: linear-gradient(to right, transparent, #000 15%, #000 85%, transparent); }
/* tombol kembali ke atas (HP) */
.to-top { position: fixed; right: 16px; bottom: 76px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--primary);
  color: #fff; font-size: 20px; box-shadow: 0 6px 18px rgba(37, 99, 235, .35); z-index: 35; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .2s; }
.to-top.show { opacity: .92; pointer-events: auto; }
/* area tabel / daftar kartu yang scroll sendiri; tinggi diatur oleh fitScrollAreas() di app.js */
.table-wrap.scroll-area { overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (min-width: 641px) {
  .to-top { display: none; }
  .scroll-area .tbl thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--border); }
}

/* notifications */
.notif { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.notif li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.notif li:last-child { border-bottom: 0; }
.notif small { color: var(--muted); display: block; }

/* trend bars */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; }
.bar-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; gap: 3px; width: 100%; justify-content: center; }
.bar { width: 40%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.in { background: #22a35a; }
.bar.out { background: #e0574f; }
.bar-day small { color: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* detail */
.info { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 24px; margin-bottom: 16px; }
.info div small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.info div b { font-weight: 600; }
.summary { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); }
.summary b { color: var(--text); }
.report-meta { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; color: var(--muted); }
.report-meta b { color: var(--text); }
.print-title { display: none; }

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 14px; width: 520px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .2); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; }
.toast { background: #1f2937; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 420px; }
.toast.error { background: var(--danger); }
.alert { padding: 12px 14px; border-radius: 10px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.loading { color: var(--muted); padding: 24px 0; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: -300px; z-index: 40; transition: left .2s; }
  .sidebar.open { left: 0; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 30; }
  .menu-btn { display: inline-block; }
  .view { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-date { display: none; }
  .form-grid .span2 { grid-column: auto; }
  .kpis { grid-template-columns: 1fr 1fr; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .filters, .tabs, .page-head .actions, .form-actions, .backdrop, .toasts { display: none !important; }
  .view { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .table-wrap { border: 0; overflow: visible; }
  .tbl th, .tbl td { padding: 5px 6px; font-size: 11px; }
  .print-title { display: block; margin-bottom: 8px; }
}

/* ===== user menu ===== */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 4px 10px 4px 4px; cursor: pointer; font: inherit; color: var(--text); }
.user-btn:hover { background: #f8f9fb; }
.avatar { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #4f46e5, #0ea5e9); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-txt { text-align: left; line-height: 1.2; }
.user-txt b { display: block; font-size: 13px; }
.user-txt small { color: var(--muted); font-size: 11px; }
.caret { color: var(--muted); font-size: 11px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); width: 250px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: 6px; z-index: 20; }
.dropdown .dd-head { padding: 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown .dd-head small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.dropdown button, .dropdown a { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: none; font: inherit; color: var(--text); border-radius: 8px; cursor: pointer; }
.dropdown button:hover, .dropdown a:hover { background: #f3f4f6; }
.dropdown .danger { color: var(--danger); }

/* ===== login (SIMS) ===== */
.auth {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px;
  background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 448px; background: #fff; border-radius: 18px; padding: 28px 26px; border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .05);
}
/* isian otomatis browser (autofill) senada dengan kolom isian */
.auth-form input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #eef3fd inset; -webkit-text-fill-color: var(--text); }
.auth-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.auth-brand { display: flex; align-items: center; gap: 16px; }
.auth-brand .sims-logo { flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(79, 70, 229, .25)); }
.auth-vr { width: 1px; align-self: stretch; background: #e3e6ee; }
.sims-title {
  font-size: 34px; font-weight: 800; letter-spacing: .5px; line-height: 1;
  background: linear-gradient(90deg, #4f46e5, #3b82f6); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sims-sub { font-size: 11.5px; font-weight: 600; letter-spacing: 1px; color: #6b7280; margin-top: 6px; }
.sims-tag { font-size: 10px; font-weight: 600; letter-spacing: 1.2px; color: #4f46e5; margin-top: 4px; }
.lang { display: inline-flex; border: 1px solid #d9dce5; border-radius: 9px; overflow: hidden; flex-shrink: 0; background: #fff; }
.lang button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 13px; color: #4b5563; padding: 8px 11px; cursor: pointer; }
.lang button.on { background: #4f46e5; color: #fff; }
.auth-h { font-size: 15px; font-weight: 600; color: #1f2937; margin: 0; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 4px; }
.auth-row .lang button { padding: 5px 9px; font-size: 12px; }
.auth-row + .auth-p { margin-top: 10px; }
.auth-hr { border: 0; border-top: 1px solid #e5e7eb; margin: 16px 0; }
.auth-p { color: #6b7280; margin: 4px 0 18px; font-size: 13.5px; }
.hotel-card {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; padding: 14px 16px; margin-bottom: 10px;
  border: 1px solid #e3e6ee; border-radius: 10px; background: #fff; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s;
}
.hotel-card:hover, .hotel-card:focus-visible { border-color: #a5b4fc; box-shadow: 0 0 0 3px #eef0ff; outline: none; }
.hotel-card b { display: block; font-size: 15px; font-weight: 600; color: #1f2937; }
.hotel-card small { display: block; color: #6b7280; font-size: 13px; margin-top: 3px; }
.hotel-mono img { display: block; width: 48px; height: auto; margin: 0 auto; }
.hotel-mono { width: 52px; flex-shrink: 0; text-align: center; font-family: "Segoe Script", "Brush Script MT", cursive; font-size: 30px; color: #555; line-height: 1; }
.hotel-wordmark { display: flex; flex-direction: column; align-items: center; color: #1f2937; line-height: 1.2; padding-top: 2px; }
.hotel-wordmark b { font-size: 14px; font-weight: 500; letter-spacing: 2.6px; }
.hotel-wordmark span { font-size: 7.5px; letter-spacing: 2.2px; margin-top: 3px; }
.hotel-wordmark small { font-size: 5.5px; letter-spacing: 1.4px; margin-top: 5px; color: #374151; }
.auth-link { color: #4f46e5; font-size: 14px; }
.auth-link:hover { text-decoration: underline; }
.auth-hotel { font-size: 18px; font-weight: 600; color: #1f2937; margin-top: 20px; }
.auth-form { display: grid; gap: 16px; }
.auth-form label { color: #374151; font-weight: 600; font-size: 14px; gap: 8px; }
.auth-form input, .auth-form select { font-weight: 400; height: 38px; background: #eef3fd; border-color: #cfd8e8; }
.auth-form input:focus, .auth-form select:focus { background: #fff; }
.auth-btn {
  height: 36px; border: 0; border-radius: 8px; background: #4f46e5; color: #fff; font: inherit; font-weight: 600; cursor: pointer; margin-top: 2px;
}
.auth-btn:hover { background: #4338ca; }
.auth-btn:disabled { opacity: .6; cursor: wait; }
.auth-center { text-align: center; margin-top: 20px; }
.auth-err { background: var(--danger-soft); color: var(--danger); padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.auth-info { background: #eef0ff; color: #3730a3; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-top: 12px; text-align: center; }
.auth-foot { margin-top: 18px; font-size: 12px; color: #6b7280; }
@media (max-width: 480px) {
  .auth-card { padding: 22px 18px; }
  .auth-top { flex-direction: column-reverse; }
  .auth-top .lang { align-self: flex-end; }
  .sims-title { font-size: 28px; }
  .sims-sub { font-size: 10px; }
  .user-txt { display: none; }
}

/* ===== keamanan: aturan password & peringatan idle ===== */
.pw-rules { list-style: none; margin: -6px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12.5px; color: #9ca3af; }
.pw-rules li::before { content: "\25CB"; margin-right: 6px; }
.pw-rules li.ok { color: #15803d; }
.pw-rules li.ok::before { content: "\2713"; }
.idle-card { width: 400px; }
.idle-card h3 { font-size: 17px; }
.idle-card p { margin: 0; color: var(--muted); }
.idle-card #idle-left { color: var(--danger); font-size: 18px; }

/* ===== pilihan bahasa di topbar ===== */
.lang-switch .lang button { padding: 6px 10px; font-size: 12px; }

/* import master data */
.import-cols { font-size: 13px; line-height: 1.8; }
.import-cols code { background: #eef2ff; color: #3730a3; padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* ===== tampilan HP (<= 640px): tabel jadi kartu, form & tombol penuh lebar ===== */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .view { padding: 12px; }
  .topbar { padding: 0 10px; gap: 8px; }
  .crumb { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .card { padding: 14px; border-radius: 12px; }
  .page-head { margin-bottom: 12px; gap: 10px; }
  .page-head h2 { font-size: 19px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .row-between > .search, .row-between > input { width: 100%; }
  .row-between > .actions { width: 100%; }
  .row-between > .actions .btn { flex: 1; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters label, .filters label.grow, .filters label.wide { min-width: 0; width: 100%; }
  .filters .btn { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .kpis { gap: 10px; }
  input, select, textarea { font-size: 16px; } /* cegah auto-zoom iOS */

  /* tabel → kartu (label kolom diisi otomatis dari header lewat data-label) */
  .table-wrap { border: 0; overflow: visible; border-radius: 0; }
  .tbl, .tbl tbody, .tbl tfoot, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; }
  .tbl tr.hidden { display: none; }
  .tbl.click tbody tr:active { background: #f8faff; }
  .tbl td, .tbl.lines td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 3px 0; border: 0;
    text-align: right; white-space: normal; overflow-wrap: anywhere; min-height: 26px; }
  .tbl td.r, .tbl td.mono { white-space: normal; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .03em; text-align: left; flex-shrink: 0; max-width: 45%; }
  .tbl td:not([data-label])::before, .tbl td[data-label=""]::before { display: none; }
  .tbl td:not([data-label]), .tbl td[data-label=""] { justify-content: flex-end; }
  /* kolom pertama (kode / no. dokumen) jadi judul kartu tanpa label */
  .tbl tbody td:first-child { justify-content: flex-start; font-weight: 700; color: var(--primary); padding-bottom: 4px;
    border-bottom: 1px dashed var(--border); margin-bottom: 2px; }
  .tbl tbody td:first-child::before { display: none; }
  .tbl.lines tbody td:first-child { color: var(--muted); }
  .info { grid-template-columns: 1fr 1fr; gap: 10px 14px; }
  .info div { min-width: 0; overflow-wrap: anywhere; }
  .tbl td.m-zero { display: none; } /* stok per lokasi yang 0 tidak perlu tampil di kartu */
  .tbl td.empty { display: block; text-align: center; }
  .tbl td.empty::before { display: none; }
  .tbl tbody tr:last-child td { border-bottom: 0; }
  .tbl .actions-cell { justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--border) !important; margin-top: 4px; padding-top: 10px !important; }
  .tbl .actions-cell::before { display: none; }
  .tbl tfoot tr { background: #f9fafb; }
  .tbl tfoot td { background: none; border: 0; }
  .tbl tr.sub { background: #fbfbfc; }
  .tbl tr.sub td { background: none; }
  /* baris input (form dokumen & opname) */
  .tbl.lines input, .tbl.lines select { min-width: 0 !important; width: 100%; flex: 1; max-width: 65%; height: 40px; }
  .tbl.lines td.line-item { flex-direction: column; align-items: stretch; text-align: left; }
  .tbl.lines td.line-item::before { max-width: none; }
  .tbl.lines td.line-item input { max-width: none; }

  .modal { padding: 0; place-items: end stretch; }
  .modal-card { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-foot .btn { flex: 1; }
  .dropdown { width: min(280px, calc(100vw - 20px)); }
  .lang-switch .lang button { padding: 5px 8px; }
  .toasts { left: 10px; right: 10px; }
  .toast { max-width: none; }
}
