/* =========================================================
   Hamasa WMS — stylesheet (tanpa build step)
   Dioptimalkan untuk layar PC (≥ 1280px)
   ========================================================= */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e3e7e5;
  --border-strong: #cdd3d0;
  --text: #17201c;
  --text-2: #4b5752;
  --muted: #7a8680;
  --primary: #0f766e;
  --primary-600: #0d6660;
  --primary-50: #e8f4f2;
  --sidebar: #0f1f1c;
  --sidebar-2: #162a26;
  --sidebar-text: #b9c8c3;
  --green: #15803d;  --green-50: #e9f7ee;
  --amber: #b45309;  --amber-50: #fdf3e2;
  --red: #b91c1c;    --red-50: #fdecec;
  --blue: #1d4ed8;   --blue-50: #e9effd;
  --purple: #7e22ce; --purple-50: #f4eafc;
  --gray: #52525b;   --gray-50: #f1f2f3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 1px 3px rgba(16, 24, 20, .06);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.mono { font-family: var(--mono); font-size: .92em; font-variant-numeric: tabular-nums; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: linear-gradient(90deg, var(--sidebar) 0 248px, var(--bg) 248px); }
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--primary);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
}
.brand-name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: #7f948e; }
.nav { padding: 10px 10px 24px; flex: 1; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; color: #6b807a; padding: 16px 12px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px; color: var(--sidebar-text);
  font-weight: 500; font-size: 13.5px; text-decoration: none;
}
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .9; }
.nav .count { margin-left: auto; background: #d97706; color: #fff; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11.5px; color: #6b807a; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-search { display: flex; align-items: center; gap: 8px; }
.topbar-search input { width: 320px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-chip .who { line-height: 1.2; }
.user-chip .who b { display: block; font-size: 13px; }
.content { padding: 24px 28px 48px; max-width: 1560px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14.5px; font-weight: 700; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > .card { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) 360px; }

.kpi { padding: 16px 18px; position: relative; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.kpi a.stretched::after { content: ""; position: absolute; inset: 0; }
.kpi.kpi-warn { border-color: #f2c98d; background: linear-gradient(180deg, #fffaf1, #fff); }
.kpi.kpi-danger { border-color: #f1b3b3; background: linear-gradient(180deg, #fff6f6, #fff); }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: var(--surface-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
.table tbody tr:hover { background: #fbfcfb; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { background: var(--surface-2); font-weight: 700; }
.table th.num, .table td.num { text-align: right; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table.compact th, .table.compact td { padding: 7px 12px; }
.table td.mono, .table .tag, .table td .mono { white-space: nowrap; }
.table td .sub { display: block; font-size: 12px; color: var(--muted); }
.row-warn { background: #fffbf3; }
.row-error { background: #fff5f5; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 36px; height: 36px; opacity: .45; margin-bottom: 6px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 14px 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: 1 / -1; }
.field label, .label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.req::after { content: " *"; color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: #fff; border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 11px; min-height: 38px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .14); }
input[readonly] { background: var(--surface-2); }
input.is-invalid, select.is-invalid { border-color: var(--red); }
.invalid { color: var(--red); font-size: 12px; margin-top: 4px; }
input[type=number] { text-align: right; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { min-width: 150px; }
.filters .field.wide { min-width: 260px; }
.filters input, .filters select { min-height: 36px; padding: 6px 10px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 18px; }
.tabs a { padding: 12px 12px; color: var(--text-2); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a .n { background: var(--gray-50); color: var(--text-2); border-radius: 99px; padding: 0 7px; font-size: 11px; margin-left: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; font-size: 13.5px;
  padding: 8px 15px; min-height: 38px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  text-decoration: none !important; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(.95); background: var(--green); }
.btn-danger { background: #fff; border-color: #efb4b4; color: var(--red); }
.btn-danger:hover { background: var(--red-50); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-sm { padding: 5px 10px; min-height: 30px; font-size: 12.5px; }
.btn-icon { padding: 6px; min-height: 32px; width: 32px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------- Badges / alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-50); color: var(--green); }
.badge-amber { background: var(--amber-50); color: var(--amber); }
.badge-red { background: var(--red-50); color: var(--red); }
.badge-blue { background: var(--blue-50); color: var(--blue); }
.badge-purple { background: var(--purple-50); color: var(--purple); }
.badge-gray { background: var(--gray-50); color: var(--gray); }
.tag { display: inline-block; background: var(--gray-50); color: var(--text-2); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 500; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert-success { background: var(--green-50); border-color: #b9e3c7; color: #14532d; }
.alert-error { background: var(--red-50); border-color: #f1bcbc; color: #7f1d1d; }
.alert-info { background: var(--blue-50); border-color: #c3d3f7; color: #1e3a8a; }
.alert-warn { background: var(--amber-50); border-color: #f1d3a3; color: #78350f; }

.progress { height: 8px; background: var(--gray-50); border-radius: 99px; overflow: hidden; min-width: 80px; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.progress.amber > span { background: #d97706; }
.progress.red > span { background: var(--red); }

/* ---------- Line items ---------- */
.lines td { vertical-align: top; }
.lines .ts-wrapper { min-width: 320px; }
.lines input[type=number] { width: 130px; }
.avail { font-size: 12px; color: var(--muted); margin-top: 3px; }
.avail.low { color: var(--red); font-weight: 600; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 8.5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .t { font-size: 12px; color: var(--muted); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pagination .pages { display: flex; gap: 4px; }
.pagination a, .pagination span.cur, .pagination span.dis { min-width: 32px; height: 32px; padding: 0 9px; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid var(--border); background: #fff; color: var(--text); text-decoration: none; }
.pagination span.cur { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.pagination span.dis { opacity: .45; }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: 12px; padding: 0; width: 460px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 20, 18, .45); }
dialog .card-head { border-radius: 12px 12px 0 0; }
dialog .dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--sidebar); color: #d7e3df; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h2 { color: #fff; font-size: 30px; line-height: 1.25; max-width: 460px; }
.login-art ul { padding: 0; list-style: none; margin: 28px 0 0; display: grid; gap: 12px; }
.login-art li { display: flex; gap: 10px; align-items: center; }
.login-art li span { width: 26px; height: 26px; border-radius: 7px; background: rgba(15,118,110,.35); display: grid; place-items: center; color: #7fe0d4; font-size: 13px; font-weight: 700; }
.login-art .pattern { position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(15,118,110,.18); }
.login-form { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.login-form .box { width: 100%; max-width: 380px; }
.login-form h1 { font-size: 24px; margin-bottom: 6px; }

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .no-print, .actions { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; }
}

/* ---------- Tom Select tweaks ---------- */
.ts-control { border-radius: 8px !important; min-height: 38px; border-color: var(--border-strong) !important; padding: 7px 10px !important; font-size: 14px !important; }
.ts-wrapper.focus .ts-control { border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(15, 118, 110, .14) !important; }
.ts-dropdown { font-size: 13.5px; border-radius: 8px; }
.ts-dropdown .active { background: var(--primary-50) !important; color: var(--text) !important; }

@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-side { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Riwayat versi ---------- */
.prose { max-width: 860px; line-height: 1.7; }
.prose h1 { display: none; }
.prose h2 { font-size: 18px; margin: 28px 0 8px; padding-top: 20px; border-top: 1px solid var(--border); }
.prose h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 12px; }
.prose h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--primary); margin: 14px 0 4px; }
.prose ul { margin: 4px 0 8px; padding-left: 20px; }
.prose code { background: var(--gray-50); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* ---------- Matriks hak akses ---------- */
.perm-matrix th.center, .perm-matrix td.center { text-align: center; width: 120px; }
.perm-matrix input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.perm-matrix input.chk-approve { accent-color: #b45309; }
.perm-matrix .group-row td { background: var(--primary-50); font-weight: 700; color: var(--primary); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
