/* ==========================================================================
   StokKu — Sistem Inventaris
   Tema: bersih & profesional (putih–biru), sesuai pilihan pemilik proyek.
   Permukaan datar, garis tepi tipis, aksen biru. Tanpa glassmorphism.
   ========================================================================== */

:root {
  /* Biru */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --violet-600: #7c3aed;

  /* Netral */
  --navy: #0f2744;
  --ink: #16233a;
  --ink-soft: #3f4f68;
  --muted: #6b7c93;
  --border: #e4eaf2;
  --border-strong: #d2dbe8;
  --bg: #f5f8fc;
  --surface: #ffffff;
  --surface-soft: #fafcff;

  /* Status */
  --green: #0f7a56;
  --green-bg: #e7f7f0;
  --red: #c02626;
  --red-bg: #fdeceb;
  --amber: #a25c00;
  --amber-bg: #fdf3e3;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 39, 68, .06);
  --shadow: 0 6px 20px rgba(16, 39, 68, .07);
  --shadow-lg: 0 24px 50px rgba(16, 39, 68, .12);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14.5px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; color: var(--navy); letter-spacing: -.012em; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.02rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 .6rem; }

.ico { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- Tata letak ---------- */
.layout { display: flex; min-height: 100vh; min-width: 0; }

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 22px; }

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--blue-600);
  color: #fff;
  display: grid; place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 4px 10px rgba(37, 99, 235, .25);
}
.brand-mark .ico { width: 21px; height: 21px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 1.02rem; color: var(--navy); }
.brand-text small { font-size: .74rem; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 550;
  font-size: .89rem;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--blue-50); color: var(--blue-700); text-decoration: none; }
.nav-link.is-active { background: var(--blue-600); color: #fff; }
.nav-link.is-active:hover { background: var(--blue-700); color: #fff; }
.nav-link .ico { width: 17px; height: 17px; }

.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px; min-width: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue-100); color: var(--blue-700);
  display: grid; place-items: center;
  font-weight: 700; font-size: .85rem; flex: 0 0 auto;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.user-meta strong { font-size: .84rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { font-size: .72rem; color: var(--muted); }

.logout-link {
  display: flex; align-items: center; gap: 9px;
  margin-top: 6px; padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted); font-size: .86rem; font-weight: 550;
}
.logout-link:hover { background: var(--red-bg); color: var(--red); text-decoration: none; }

.main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 28px 32px 56px;
  max-width: 1240px;
}

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-sub { color: var(--muted); font-size: .88rem; margin: 6px 0 0; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Kartu ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  min-width: 0;
}
.card + .card { margin-top: 20px; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.card-title { font-size: 1rem; font-weight: 650; color: var(--navy); }
.card-sub { font-size: .82rem; color: var(--muted); margin: 4px 0 0; }

.stack-20 > * + * { margin-top: 20px; }

/* ---------- Kartu statistik ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  min-width: 0;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 11px;
  display: grid; place-items: center; flex: 0 0 auto;
  background: var(--blue-50); color: var(--blue-700);
}
.stat-icon .ico { width: 21px; height: 21px; }
.stat-icon.is-green { background: var(--green-bg); color: var(--green); }
.stat-icon.is-amber { background: var(--amber-bg); color: var(--amber); }
.stat-icon.is-red { background: var(--red-bg); color: var(--red); }
.stat > span:last-child { min-width: 0; }
.stat-label {
  display: block;
  font-size: .76rem; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .045em;
}
.stat-value { display: block; font-size: 1.32rem; font-weight: 700; color: var(--navy); line-height: 1.3; }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px -20px; padding: 0 22px 20px; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th {
  text-align: left;
  font-size: .71rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td { padding: 12px; border-bottom: 1px solid #eef2f8; vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-soft); }
table.data td.num { font-variant-numeric: tabular-nums; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: .78rem; color: var(--muted); font-weight: 400; }

/* ---------- Label status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 650;
  background: #eef2f8; color: var(--ink-soft);
  white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-50); color: var(--blue-700); }
.badge-violet { background: #f1edfe; color: var(--violet-600); }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--blue-600);
  color: #fff;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { background: var(--blue-700); color: #fff; text-decoration: none; }
.btn .ico { width: 16px; height: 16px; }
.btn-ghost { background: var(--surface); color: var(--ink-soft); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-200); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #a51f1f; }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; }
.btn-link {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--blue-700); font: inherit; font-size: .82rem; font-weight: 600;
  cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--red); }

/* ---------- Formulir ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }

label, .label { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="search"], input[type="email"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: #fff;
  font-family: inherit;
  font-size: .89rem;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .16);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%236b7c93' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 5l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}
textarea { min-height: 76px; resize: vertical; }

.hint { font-size: .76rem; color: var(--muted); font-weight: 400; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filter-bar input, .filter-bar select { width: auto; min-width: 150px; }
.filter-bar .grow { flex: 1 1 220px; min-width: 180px; }

/* ---------- Notifikasi ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .87rem;
  font-weight: 550;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-success { background: var(--green-bg); color: #0b6247; border-color: #bfe8d7; }
.alert-error { background: var(--red-bg); color: #a01f1f; border-color: #f5cfcf; }
.alert-info { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-200); }

/* ---------- Kondisi kosong ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon {
  width: 52px; height: 52px; border-radius: 13px; margin: 0 auto 14px;
  background: var(--blue-50); color: var(--blue-600);
  display: grid; place-items: center;
}
.empty-icon .ico { width: 24px; height: 24px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: .86rem; margin-bottom: 16px; }

/* ---------- Paginasi ---------- */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.pagination a, .pagination span {
  padding: 6px 11px; border-radius: 8px;
  border: 1px solid var(--border);
  font-size: .82rem; color: var(--ink-soft); background: #fff;
}
.pagination a:hover { border-color: var(--blue-200); color: var(--blue-700); text-decoration: none; }
.pagination .is-current { background: var(--blue-600); border-color: var(--blue-600); color: #fff; font-weight: 600; }

/* ---------- Dua kolom (form + daftar) ---------- */
.split {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 22px;
  align-items: start;
}
.split > * { min-width: 0; }

/* ---------- Halaman masuk ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(760px 420px at 15% 0%, #e6efff 0%, transparent 65%),
    radial-gradient(680px 420px at 90% 100%, #eaf2ff 0%, transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 408px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 32px 30px 28px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-brand .brand-mark { width: 44px; height: 44px; }
.auth-card h1 { font-size: 1.28rem; margin-bottom: 6px; }
.auth-card .page-sub { margin-bottom: 22px; }
.auth-card .field + .field { margin-top: 14px; }
.auth-card .btn { width: 100%; margin-top: 22px; padding: 11px 16px; }
.auth-note {
  margin-top: 20px; padding: 12px 14px;
  background: var(--blue-50);
  border: 1px solid var(--blue-200);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  color: var(--blue-700);
  font-weight: 450;
}
.auth-note strong { font-weight: 700; }

/* ---------- Utilitas ---------- */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

.progress { height: 6px; border-radius: 999px; background: #eef2f8; overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--blue-600); }
.progress.is-warn > span { background: #f59e0b; }
.progress.is-danger > span { background: #ef4444; }

/* ---------- Responsif ---------- */
@media (max-width: 1040px) {
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    padding: 14px 16px;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0 2px 12px; }
  .nav {
    flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto; gap: 6px; padding-bottom: 4px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { white-space: nowrap; padding: 8px 12px; font-size: .84rem; }
  .sidebar-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 10px; padding-top: 10px;
  }
  .logout-link { margin-top: 0; }
  .main { padding: 20px 16px 44px; }
  h1 { font-size: 1.24rem; }
  .card { padding: 16px 16px; }
  .card + .card { margin-top: 16px; }
  .table-wrap { margin: 0 -16px -16px; padding: 0 16px 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 14px; gap: 11px; }
  .stat-icon { width: 38px; height: 38px; }
  .stat-value { font-size: 1.1rem; }
  .filter-bar input, .filter-bar select { min-width: 0; flex: 1 1 140px; }
}

/* ==========================================================================
   WAREHOUSE FG — komponen tambahan
   ========================================================================== */

.nav-group-title {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 12px 6px;
}
.nav-group-title:first-child { padding-top: 2px; }

.app-foot {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;
  margin-top: 28px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: .76rem; color: var(--muted);
}

.brand-mark.lg { width: 52px; height: 52px; border-radius: 14px; }

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.kpi-grid .stat { padding: 15px 16px; gap: 12px; align-items: flex-start; }
.kpi-grid .stat-icon { width: 38px; height: 38px; border-radius: 10px; }
.kpi-grid .stat-value { font-size: 1.12rem; }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat.tone-is-green { border-color: #cdeee1; }
.stat.tone-is-amber { border-color: #f6e3c4; }
.stat.tone-is-red { border-color: #f6d5d5; }

.text-red { color: var(--red); }
.text-green { color: var(--green); }

/* Grafik */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.chart-card.span-2 { grid-column: span 2; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #eef2f8; stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: .78rem; color: var(--ink-soft); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart-legend.legend-col { flex-direction: column; align-items: flex-start; gap: 6px; }
.chart-empty {
  padding: 34px 16px; text-align: center; color: var(--muted);
  font-size: .85rem; background: var(--surface-soft);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
}
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 168px; max-width: 46%; height: auto; flex: 0 0 auto; }
.donut-total { font-size: 18px; font-weight: 700; fill: var(--navy); font-family: var(--font); }
.donut-sub { font-size: 9px; fill: var(--muted); font-family: var(--font); }
.rank-list { display: flex; flex-direction: column; gap: 12px; }
.rank-row { display: grid; grid-template-columns: minmax(90px, 1.4fr) 2fr auto; gap: 10px; align-items: center; font-size: .82rem; }
.rank-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }
.rank-bar { height: 8px; border-radius: 999px; background: #eef2f8; overflow: hidden; }
.rank-bar > span { display: block; height: 100%; background: var(--blue-600); border-radius: 999px; }
.rank-value { font-weight: 650; color: var(--navy); }

/* Tab / filter */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: .82rem; font-weight: 600; color: var(--ink-soft);
}
.tab:hover { border-color: var(--blue-200); color: var(--blue-700); text-decoration: none; }
.tab.is-active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.tab-count {
  background: rgba(255, 255, 255, .28); border-radius: 999px;
  padding: 0 6px; font-size: .72rem;
}
.tab:not(.is-active) .tab-count { background: #eef2f8; color: var(--ink-soft); }

.period-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: .8rem; font-weight: 600; color: var(--ink-soft);
}
.chip:hover { border-color: var(--blue-200); color: var(--blue-700); text-decoration: none; }
.chip.is-active { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); }
.period-custom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-custom input[type="date"] { width: auto; }

/* Badge tambahan */
.badge-dark { background: #111827; color: #fff; }
.badge-orange { background: #fff1e6; color: #c2410c; }

/* Form baris dinamis */
.line-table { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.line-table th { background: var(--surface-soft); }
.line-table td { padding: 8px; vertical-align: middle; }
.line-table input, .line-table select { font-size: .84rem; padding: 7px 9px; }
.line-table .w-40 { width: 40px; }
.line-table .w-110 { width: 110px; }
.line-table .w-130 { width: 130px; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  cursor: pointer; padding: 0;
}
.icon-btn:hover { color: var(--red); border-color: #f5cfcf; background: var(--red-bg); }
.line-diff { font-size: .82rem; }

/* Detail dokumen */
.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.meta-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.meta-value { font-size: .88rem; color: var(--ink); font-weight: 550; }
.note { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .85rem; }
.sub-head { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 10px; }
.summary-bar {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border); font-size: .85rem; color: var(--ink-soft);
}
.flow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.flow-step {
  font-size: .75rem; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: #f1f5fb; color: var(--muted); border: 1px solid var(--border);
}
.flow-step.is-done { background: var(--green-bg); color: var(--green); border-color: #cdeee1; }
.flow-step.is-current { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 8px; }
.detail-head { display: flex; gap: 16px; align-items: flex-start; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: block; border: 1px solid var(--border); }
.thumb.placeholder { display: grid; place-items: center; background: var(--surface-soft); color: var(--muted); }
.thumb-lg { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; border: 1px solid var(--border); flex: 0 0 auto; }
.thumb-lg.placeholder { display: grid; place-items: center; background: var(--surface-soft); color: var(--muted); }
table.data.compact td, table.data.compact th { padding: 8px 10px; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.role-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.role-card p { font-size: .82rem; color: var(--ink-soft); margin: 8px 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.check-item {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: .86rem; font-weight: 550; cursor: pointer;
}
.check-item input { width: auto; margin: 0; }

/* Login dua kolom */
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; align-items: stretch; padding: 0; place-items: stretch; }
.auth-side {
  background: linear-gradient(160deg, #1e40af 0%, #2563eb 52%, #3b82f6 100%);
  color: #fff; display: flex; align-items: center; justify-content: center; padding: 48px 40px;
}
.auth-side-inner { max-width: 400px; }
.auth-side .brand-mark { background: rgba(255, 255, 255, .18); box-shadow: none; margin-bottom: 18px; }
.auth-side h2 { color: #fff; font-size: 1.9rem; letter-spacing: -.02em; }
.auth-company { font-size: .95rem; opacity: .92; margin: 4px 0 10px; }
.auth-tagline { font-size: .88rem; opacity: .85; margin-bottom: 22px; }
.auth-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: .86rem; }
.auth-list li { display: flex; gap: 10px; align-items: flex-start; opacity: .95; }
.auth-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #bfdbfe; margin-top: 8px; flex: 0 0 auto; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-panel .auth-card { box-shadow: none; border: none; padding: 8px; max-width: 360px; }
.auth-foot { margin-top: 24px; font-size: .78rem; color: var(--muted); line-height: 1.6; }

/* Label barcode */
.label-page { background: #eef2f8; padding: 20px; }
.label-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.label-sheet { display: flex; flex-wrap: wrap; gap: 10px; }
.label-card {
  width: 62mm; background: #fff; border: 1px dashed #94a3b8; border-radius: 4px;
  padding: 8px 9px; font-family: var(--font);
}
.label-brand { font-size: 7pt; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
.label-model { font-size: 11pt; font-weight: 700; color: #0f172a; line-height: 1.2; margin-top: 2px; }
.label-variant { font-size: 8pt; color: #475569; }
.label-barcode { margin: 6px 0 2px; }
.label-barcode svg { max-width: 100%; height: auto; }
.label-code { font-size: 8pt; letter-spacing: .06em; text-align: center; }
.label-foot { display: flex; justify-content: space-between; font-size: 7pt; color: #64748b; margin-top: 3px; }

/* Cetak */
.print-head { display: none; }
.print-foot { display: none; }
@media print {
  body { background: #fff; }
  .sidebar, .page-head .page-actions, .tabs, .period-bar, .app-foot, .filter-bar, .no-print, .pagination { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; max-width: none; }
  .card { border: none; box-shadow: none; padding: 0; }
  .table-wrap { margin: 0; padding: 0; overflow: visible; }
  table.data th, table.data td { border-bottom: 1px solid #cbd5e1; font-size: 9.5pt; }
  table.data th { background: #f1f5f9; }
  .print-head { display: block; margin-bottom: 14px; }
  .print-head h2 { font-size: 14pt; }
  .print-head p { font-size: 9pt; color: #475569; }
  .print-foot { display: block; margin-top: 12px; font-size: 8pt; color: #64748b; }
  .label-sheet { gap: 4mm; }
  .label-card { break-inside: avoid; border: 1px solid #cbd5e1; }
}

/* Responsif tambahan */
@media (max-width: 1100px) {
  .chart-card.span-2 { grid-column: span 1; }
}
@media (max-width: 980px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-panel { min-height: 100vh; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-grid .stat { padding: 12px; gap: 9px; }
  .kpi-grid .stat-icon { width: 32px; height: 32px; }
  .kpi-grid .stat-value { font-size: .98rem; }
  .kpi-grid .stat-label { font-size: .66rem; }
  .chart-grid { grid-template-columns: 1fr; gap: 14px; }
  .detail-head { flex-direction: column; }
  .rank-row { grid-template-columns: minmax(80px, 1.2fr) 1.4fr auto; font-size: .78rem; }
  .nav-group-title { display: none; }
  .flow-step { font-size: .7rem; }
  .line-table { font-size: .82rem; }
  .label-sheet { justify-content: center; }
}
.inner-card { background: var(--surface-soft); margin-top: 18px; box-shadow: none; }

/* ---------- Kontrol data: badge owner, notifikasi menu, checklist ---------- */
.badge-owner { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #ef4444; color: #fff;
  font-size: .68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.nav-link.is-active .nav-badge { background: rgba(255,255,255,.28); }
.check-list { margin: 0 0 16px; padding-left: 18px; font-size: .87rem; color: var(--ink-soft); }
.check-list li { margin-bottom: 6px; }
button[disabled] { opacity: .55; cursor: not-allowed; }
.stat-value.text-sm { font-size: 1rem; }

/* ---------- Valuasi stok ---------- */
.line-summary {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  margin-top: 12px; padding: 10px 14px;
  background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .84rem; color: var(--ink-soft);
}
.line-summary strong { color: var(--navy); }
.badge-finance { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.kpi-grid .stat.tone-value { border-color: #cfe3fb; background: linear-gradient(180deg, #fbfdff, #fff); }
.valuation-table td.num, .valuation-table th.num { font-variant-numeric: tabular-nums; }
.valuation-total-row td { font-weight: 700; background: var(--surface-soft); border-top: 2px solid var(--border-strong); }
.money-strong { font-weight: 700; color: var(--navy); }
.margin-pos { color: var(--green); }
.margin-neg { color: var(--red); }
.hpp-lock { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }

/* ---------- Koreksi HPP ---------- */
.hpp-box { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-soft); }
.hpp-box > summary { cursor: pointer; font-weight: 650; font-size: .88rem; color: var(--navy); }
.hpp-box[open] > summary { margin-bottom: 6px; }

/* Editor baris (HPP/keluar/transfer) harus bisa digeser sendiri di layar kecil,
   jangan sampai membuat seluruh halaman melebar. */
.line-editor { overflow-x: auto; max-width: 100%; }
.line-editor .line-table { min-width: 660px; }
@media (max-width: 860px) {
  .line-editor .line-table { min-width: 720px; }
}

/* ==========================================================================
   FLORAL PRODUCTION FLOW — komponen tambahan
   ========================================================================== */

.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-link { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.stat-link:hover { text-decoration: none; border-color: var(--blue-200); box-shadow: 0 6px 16px rgba(37, 99, 235, .10); }
.stat-sub { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.stat-value.text-sm { font-size: 1rem; }
.stat-value .unit { font-size: .78rem; font-weight: 600; color: var(--muted); margin-left: 3px; }

.foot-links { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.foot-links a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  font-size: .83rem; font-weight: 550; color: var(--muted);
}
.foot-links a:hover { background: var(--blue-50); color: var(--blue-700); text-decoration: none; }
.foot-links a.logout-link { margin-top: 0; color: var(--muted); background: none; }
.foot-links a.logout-link:hover { background: var(--red-bg); color: var(--red); }

/* Kelompok kartu dashboard */
.stage-block { margin-bottom: 26px; }
.stage-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.stage-head h2 { font-size: .95rem; color: var(--navy); }
.stage-head .stage-sub { font-size: .78rem; color: var(--muted); }
.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; }

/* Grafik alur sederhana */
.flow-bars { display: flex; flex-direction: column; gap: 14px; }
.flow-bar-row { display: grid; grid-template-columns: 168px 1fr 88px; gap: 12px; align-items: center; font-size: .85rem; }
.flow-bar-label { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-bar-track { height: 22px; border-radius: 8px; background: #eef2f8; overflow: hidden; }
.flow-bar-track > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-500), var(--blue-600)); border-radius: 8px; min-width: 2px; }
.flow-bar-value { text-align: right; font-weight: 650; color: var(--navy); font-variant-numeric: tabular-nums; }

/* Tabel SLA */
tr.row-late td { background: #fff7f7; }
tr.row-today td { background: #fffaf0; }
.badge-orange { background: #fff1e6; color: #c2410c; }
.badge-owner { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Form baris dinamis */
.line-editor { overflow-x: auto; max-width: 100%; }
.line-table { min-width: 620px; }
.line-table tfoot td { background: var(--surface-soft); font-weight: 650; }
.line-calc { font-variant-numeric: tabular-nums; font-size: .86rem; color: var(--ink); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Total bar */
.total-bar {
  display: flex; flex-wrap: wrap; gap: 20px; align-items: center;
  margin-top: 14px; padding: 12px 16px;
  background: var(--blue-50); border: 1px solid var(--blue-200); border-radius: var(--radius-sm);
  font-size: .86rem; color: var(--blue-700);
}
.total-bar strong { color: var(--navy); font-size: 1rem; }
.total-bar .spacer { flex: 1 1 auto; }

/* Detail dokumen */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 0 0 18px; }
.kv .meta-value { font-size: .92rem; }
.doc-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.doc-title h2 { font-size: 1.1rem; }

/* Posisi barang per tahap di detail cutting */
.trace { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 18px; }
.trace-step {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: #f1f5fb; color: var(--muted); border: 1px solid var(--border);
}
.trace-step b { color: var(--navy); }
.trace-step.is-done { background: var(--green-bg); color: var(--green); border-color: #cdeee1; }
.trace-step.is-current { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-200); }
.trace-arrow { color: var(--border-strong); }

/* Pilihan bahan cepat */
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.quick-chip {
  border: 1px solid var(--border-strong); background: #fff; border-radius: 999px;
  padding: 4px 10px; font-size: .76rem; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.quick-chip:hover { border-color: var(--blue-300, #93c5fd); color: var(--blue-700); background: var(--blue-50); }

/* Login */
.auth-panel .auth-card { max-width: 372px; }
.auth-hint { margin-top: 18px; font-size: .78rem; color: var(--muted); line-height: 1.6; }
.auth-hint code { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; color: var(--ink-soft); }

@media (max-width: 860px) {
  .foot-links { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .stage-grid { gap: 12px; }
  .flow-bar-row { grid-template-columns: 96px 1fr 64px; gap: 8px; font-size: .78rem; }
}

@media print {
  .no-print, .filter-bar, .tabs, .stage-head .btn { display: none !important; }
}

/* ==========================================================================
   Delivery Order (DO) — pratinjau A4 portrait, hitam-putih, hemat tinta
   ========================================================================== */

.do-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 18px;
}
.do-toolbar .spacer { flex: 1 1 auto; }

.do-sheet-wrap { overflow-x: auto; max-width: 100%; padding-bottom: 4px; }

.do-sheet {
  width: 210mm;
  min-width: 720px;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  color: #000;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 14mm 15mm 12mm;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 10.5px;
  line-height: 1.45;
}

.do-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.do-company { font-size: 20px; font-weight: 800; letter-spacing: .06em; color: #000; }
.do-company-sub { font-size: 9px; color: #333; margin-top: 1px; }
.do-head-right { text-align: right; }
.do-stamp { font-size: 8px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #000; }
.do-no { font-size: 13px; font-weight: 800; margin-top: 2px; }
.do-rule { border-top: 2px solid #000; border-bottom: 1px solid #000; height: 3px; margin: 8px 0 12px; }

.do-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.do-title { font-size: 15px; font-weight: 800; letter-spacing: .02em; }
.do-title-sub { font-size: 9px; color: #333; margin-top: 2px; }
.do-void { font-size: 12px; font-weight: 800; letter-spacing: .1em; border: 1.5px solid #000; padding: 3px 8px; }

.do-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 18px;
  margin-bottom: 14px;
}
.do-info > div { display: flex; gap: 8px; align-items: baseline; }
.do-info span { flex: 0 0 42%; font-size: 9px; color: #222; }
.do-info b { flex: 1 1 auto; font-size: 10px; font-weight: 700; color: #000; word-break: break-word; }

.do-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.do-table th, .do-table td { border: 1px solid #000; padding: 5px 6px; vertical-align: top; }
.do-table thead th {
  background: #ececec;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  text-align: left;
  font-weight: 700;
}
.do-table .c-no { width: 26px; text-align: center; }
.do-table .c-sku { width: 92px; }
.do-table .c-warna { width: 72px; }
.do-table .c-qty { width: 66px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.do-table .c-ket { width: 112px; font-size: 9px; }
.do-table tfoot td { background: #ececec; font-weight: 800; }
.do-total-label { text-align: right; letter-spacing: .06em; }

.do-note-block { margin-top: 14px; }
.do-note-title { font-size: 8.5px; font-weight: 800; letter-spacing: .06em; margin-bottom: 4px; }
.do-note-row { display: flex; gap: 8px; font-size: 9.5px; margin-bottom: 2px; }
.do-note-row span { flex: 0 0 22%; color: #222; }
.do-note-row b { flex: 1 1 auto; font-weight: 600; color: #000; }

.do-sign { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 18px; }
.do-sign-box { border: 1px solid #000; min-height: 82px; padding: 6px 6px 4px; display: flex; flex-direction: column; justify-content: space-between; }
.do-sign-box + .do-sign-box { border-left: none; }
.do-sign-label { font-size: 8.5px; font-weight: 700; text-align: center; }
.do-sign-line { border-bottom: 1px solid #000; height: 34px; margin: 0 4px; }
.do-sign-name { font-size: 8px; text-align: center; color: #111; min-height: 11px; }

.do-foot { margin-top: 10px; padding-top: 5px; border-top: 1px solid #999; font-size: 7.5px; color: #333; text-align: right; }

/* Telusur DO */
.trace-list { display: flex; flex-direction: column; gap: 0; }
.trace-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.trace-item:last-child { border-bottom: none; }
.trace-dot {
  width: 11px; height: 11px; border-radius: 50%; margin-top: 4px;
  background: #fff; border: 2.5px solid var(--blue-600); flex: 0 0 auto;
}
.trace-item.is-selesai .trace-dot { border-color: var(--green); background: var(--green); }
.trace-item.is-batal .trace-dot { border-color: var(--red); background: var(--red); }
.trace-body { min-width: 0; flex: 1 1 auto; }
.trace-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .88rem; }
.trace-head strong { color: var(--navy); }
.trace-doc { font-size: .82rem; font-weight: 650; color: var(--blue-700); }

/* Layar kecil saja — saat dicetak A4, tata letak tetap 2 kolom & 4 tanda tangan. */
@media screen and (max-width: 900px) {
  .do-sheet { padding: 10mm 8mm; font-size: 10px; }
  .do-info { grid-template-columns: 1fr; }
  .do-sign { grid-template-columns: 1fr 1fr; }
  .do-sign-box:nth-child(3) { border-left: 1px solid #000; }
  .do-sign-box:nth-child(n+3) { border-top: none; }
}

/* ---------- Cetak: hanya lembar DO ---------- */
@page { size: A4 portrait; margin: 12mm; }

@media print {
  html, body { background: #fff !important; }
  .sidebar, .app-foot, .do-toolbar, .no-print, .page-actions, .tabs, .filter-bar, .alert { display: none !important; }
  .layout { display: block !important; }
  .main { padding: 0 !important; max-width: none !important; }
  .page-head { margin-bottom: 0 !important; }
  .page-head h1, .page-head .page-sub { display: none !important; }
  .do-sheet-wrap { overflow: visible !important; padding: 0 !important; }
  .do-sheet {
    width: auto; max-width: none; min-width: 0; margin: 0; padding: 0;
    border: none; border-radius: 0; box-shadow: none;
    font-size: 10px;
  }
  .do-table thead th, .do-table tfoot td { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .do-table tr, .do-sign-box { break-inside: avoid; }
  .card { border: none !important; box-shadow: none !important; padding: 0 !important; }
}
