/* ==========================================================================
   MARTABAK ALDAN — ADMIN DASHBOARD, POS CASHIER & THERMAL PRINT STYLESHEET
   ========================================================================== */

:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --adm-bg: #0f0e0d;
  --adm-sidebar: #151311;
  --adm-surface: #1b1815;
  --adm-elevated: #23201c;
  --adm-input: #13110f;
  --adm-border: rgba(245, 176, 65, 0.14);
  --adm-border-strong: rgba(245, 176, 65, 0.38);

  --adm-gold: #f5b041;
  --adm-gold-bright: #f7c35f;
  --adm-gold-bg: rgba(245, 176, 65, 0.14);
  --adm-gold-solid: #f5b041;
  --adm-gold-solid-hover: #f7c35f;
  --adm-on-gold: #14110e;
  --adm-text: #faf7f2;
  --adm-muted: #9e9488;
  --adm-sub: #cfc7bd;

  --adm-green: #10b981;
  --adm-green-bg: rgba(16, 185, 129, 0.15);
  --adm-amber: #f59e0b;
  --adm-amber-bg: rgba(245, 158, 11, 0.16);
  --adm-red: #ef4444;
  --adm-red-bg: rgba(239, 68, 68, 0.15);
  --adm-red-text: #f87171;
  --adm-blue: #38bdf8;
  --adm-blue-bg: rgba(56, 189, 248, 0.14);

  --adm-shadow: rgba(0, 0, 0, 0.65);
  --adm-backdrop: rgba(5, 4, 4, 0.75);
  --adm-row-hover: rgba(245, 176, 65, 0.04);

  --font-display: "Playfair Display", Georgia, serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --adm-bg: #f5f1e8;
  --adm-sidebar: #fffdf8;
  --adm-surface: #ffffff;
  --adm-elevated: #f3ede0;
  --adm-input: #ffffff;
  --adm-border: rgba(110, 72, 12, 0.16);
  --adm-border-strong: rgba(168, 86, 10, 0.42);

  --adm-gold: #a8560a;
  --adm-gold-bright: #8a4508;
  --adm-gold-bg: rgba(245, 176, 65, 0.22);
  --adm-gold-solid: #f5b041;
  --adm-gold-solid-hover: #eea32a;
  --adm-on-gold: #2a1a04;
  --adm-text: #2a2118;
  --adm-muted: #6b5f52;
  --adm-sub: #4a3f33;

  --adm-green: #047857;
  --adm-green-bg: rgba(16, 185, 129, 0.15);
  --adm-amber: #b45309;
  --adm-amber-bg: rgba(245, 158, 11, 0.18);
  --adm-red: #dc2626;
  --adm-red-bg: rgba(239, 68, 68, 0.11);
  --adm-red-text: #b91c1c;
  --adm-blue: #0369a1;
  --adm-blue-bg: rgba(14, 165, 233, 0.13);

  --adm-shadow: rgba(70, 45, 10, 0.2);
  --adm-backdrop: rgba(40, 28, 12, 0.45);
  --adm-row-hover: rgba(168, 86, 10, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--adm-bg);
  color: var(--adm-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

option {
  background: var(--adm-input);
  color: var(--adm-text);
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   LOGIN GATE
   ========================================================================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 15%, rgba(245, 176, 65, 0.14), transparent 52%), var(--adm-bg);
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border-strong);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px var(--adm-shadow);
}

.credential-hint {
  margin: 14px 0 20px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--adm-gold-bg);
  border: 1px solid var(--adm-border-strong);
  font-size: 0.8rem;
  color: var(--adm-sub);
}

.credential-hint code {
  color: var(--adm-gold-bright);
  font-weight: 800;
}

.theme-fab {
  position: absolute;
  top: 16px;
  right: 16px;
}

.login-screen {
  position: relative;
}

/* ==========================================================================
   THEME TOGGLE (Light / Dark) — sinkron dengan website pelanggan
   ========================================================================== */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 16px;
  height: 16px;
}

html[data-theme="dark"] .theme-toggle .icon-moon,
html[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

.sidebar-user {
  display: block;
  color: var(--adm-gold);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-management {
  margin-top: 18px;
}

.account-create-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--adm-border);
}

.account-create-form label {
  min-width: 0;
}

.account-create-submit {
  min-height: 38px;
}

.account-users-table {
  margin-top: 16px;
}

.account-row-password {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 270px;
}

.account-row-password .input {
  min-width: 140px;
}

.tx-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ==========================================================================
   APP SHELL & SIDEBAR
   ========================================================================== */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--adm-sidebar);
  border-right: 1px solid var(--adm-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 18px 20px;
  border-bottom: 1px solid var(--adm-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-crest {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f7c35f, #d97706);
  color: #14110e;
  font-family: var(--font-display);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 14px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--adm-sub);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--adm-elevated);
  color: var(--adm-text);
}

.nav-item.active {
  background: var(--adm-gold-solid);
  color: var(--adm-on-gold);
  font-weight: 800;
}

.nav-badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  background: var(--adm-amber-bg);
  color: var(--adm-amber);
}

.nav-item.active .nav-badge {
  background: #14110e;
  color: #f7c35f;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--adm-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 62px;
  padding: 0 24px;
  border-bottom: 1px solid var(--adm-border);
  background: var(--adm-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.mobile-sidebar-btn {
  display: none;
}

.content-wrap {
  padding: 26px 28px;
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

/* ==========================================================================
   COMMON UI CONTROLS, CARDS & TABLES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 0.83rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-gold {
  background: var(--adm-gold-solid);
  color: var(--adm-on-gold);
}

.btn-gold:hover:not(:disabled) {
  background: var(--adm-gold-solid-hover);
}

.btn-outline {
  background: var(--adm-elevated);
  border-color: var(--adm-border);
  color: var(--adm-text);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--adm-gold);
}

.btn-danger {
  background: var(--adm-red-bg);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--adm-red-text);
}

.btn-wa {
  background: #128c7e;
  color: #ffffff;
}

.btn-wa-outline {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.38);
  color: var(--adm-green);
}

.btn-wa-outline:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.22);
  border-color: var(--adm-green);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.75rem;
  border-radius: 8px;
}

.card {
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  padding: 20px;
}

.input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--adm-border);
  background: var(--adm-input);
  color: var(--adm-text);
  font-size: 0.85rem;
}

.input:focus {
  outline: none;
  border-color: var(--adm-gold);
}

.label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--adm-muted);
  margin-bottom: 5px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  margin: 0;
}

.page-head p {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: var(--adm-muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-grid.kpi-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-card {
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  padding: 16px 18px;
}

.kpi-card small {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--adm-muted);
}

.kpi-card strong {
  display: block;
  font-size: 1.38rem;
  font-weight: 800;
  margin-top: 6px;
  color: var(--adm-text);
  font-variant-numeric: tabular-nums;
}

.kpi-card span {
  display: block;
  font-size: 0.73rem;
  color: var(--adm-muted);
  margin-top: 4px;
}

/* ==========================================================================
   DASHBOARD COMPACT STOCK SUMMARY STRIP (CLEAN & RINGKAS)
   ========================================================================== */
.dash-stock-strip {
  margin-bottom: 20px;
  padding: 18px 20px;
}

.dash-stock-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.dash-stock-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dash-stock-strip-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.dash-stock-strip-head p {
  margin: 3px 0 0;
  font-size: 0.77rem;
  color: var(--adm-muted);
}

.dash-stock-mini-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.dash-mini-stat {
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--adm-border);
  background: var(--adm-elevated);
  min-width: 0;
}

.dash-mini-stat.is-safe {
  border-color: rgba(16, 185, 129, 0.32);
}

.dash-mini-stat.is-caution {
  border-color: rgba(245, 158, 11, 0.45);
  background: var(--adm-amber-bg);
}

.dash-mini-stat.is-warning {
  border-color: rgba(239, 68, 68, 0.45);
  background: var(--adm-red-bg);
}

.dash-mini-stat small {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--adm-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-mini-stat strong {
  display: block;
  margin: 4px 0 2px;
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dash-mini-stat.is-safe strong {
  color: var(--adm-green);
}

.dash-mini-stat.is-caution strong {
  color: var(--adm-amber);
}

.dash-mini-stat.is-warning strong {
  color: var(--adm-red-text);
}

.dash-mini-stat span {
  display: block;
  font-size: 0.7rem;
  color: var(--adm-muted);
  line-height: 1.35;
}

/* ==========================================================================
   DEDICATED VIEW: PEMBUKUAN PRODUKSI & STOK BAHAN BAKU (#view-inventory)
   Enterprise ERP Layout — Simetris, Bersih & Selaras
   ========================================================================== */
.inv-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--adm-border);
}

.inv-eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--adm-gold);
  margin-bottom: 4px;
}

.inv-title-block h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.2;
}

.inv-subtitle-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--adm-muted);
}

.inv-dot-sep {
  opacity: 0.45;
}

.inv-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--adm-sub);
}

.inv-sync-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--adm-blue);
  display: inline-block;
}

.inv-sync-pill.is-saved {
  color: var(--adm-green);
}

.inv-sync-pill.is-saved::before {
  background: var(--adm-green);
}

.inv-sync-pill.is-saving {
  color: var(--adm-amber);
}

.inv-sync-pill.is-saving::before {
  background: var(--adm-amber);
}

.inv-sync-pill.is-error {
  color: var(--adm-red-text);
}

.inv-sync-pill.is-error::before {
  background: var(--adm-red);
}

.inv-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.inv-date-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--adm-border);
  background: var(--adm-surface);
}

.inv-date-icon {
  width: 14px;
  height: 14px;
  color: var(--adm-gold);
  flex-shrink: 0;
}

.inv-date-input {
  border: none;
  background: transparent;
  color: var(--adm-text);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.inv-today-chip {
  border: 1px solid var(--adm-border-strong);
  background: var(--adm-gold-bg);
  color: var(--adm-gold-bright);
  font-size: 0.69rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.inv-btn-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inv-btn-cluster .btn-sm {
  height: 36px;
  padding: 0 13px;
}

/* 3 x 2 Symmetric Executive Bento Summary Grid */
.inv-bento-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.inv-bento-card {
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  transition: border-color 0.16s ease;
}

.inv-bento-card.tone-safe {
  border-color: rgba(16, 185, 129, 0.28);
}

.inv-bento-card.tone-caution {
  border-color: rgba(245, 158, 11, 0.45);
}

.inv-bento-card.tone-danger {
  border-color: rgba(239, 68, 68, 0.48);
}

.inv-bento-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inv-bento-label {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--adm-muted);
  letter-spacing: 0.01em;
}

.inv-bento-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--adm-elevated);
  color: var(--adm-sub);
  white-space: nowrap;
}

.inv-bento-status.is-safe {
  background: var(--adm-green-bg);
  color: var(--adm-green);
}

.inv-bento-status.is-caution {
  background: var(--adm-amber-bg);
  color: var(--adm-amber);
}

.inv-bento-status.is-danger {
  background: var(--adm-red-bg);
  color: var(--adm-red-text);
}

.inv-bento-status.is-gold {
  background: var(--adm-gold-bg);
  color: var(--adm-gold-bright);
}

.inv-bento-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 10px 0 10px;
}

.inv-bento-value {
  font-size: 1.48rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--adm-text);
  font-variant-numeric: tabular-nums;
}

.inv-bento-card.tone-safe .inv-bento-value {
  color: var(--adm-green);
}

.inv-bento-card.tone-caution .inv-bento-value {
  color: var(--adm-amber);
}

.inv-bento-card.tone-danger .inv-bento-value {
  color: var(--adm-red-text);
}

.inv-bento-unit {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--adm-muted);
}

.inv-bento-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--adm-elevated);
  overflow: hidden;
  margin-bottom: 10px;
}

.inv-bento-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--adm-gold);
  transition: width 0.25s ease;
}

.inv-bento-card.tone-safe .inv-bento-bar-fill {
  background: var(--adm-green);
}

.inv-bento-card.tone-caution .inv-bento-bar-fill {
  background: var(--adm-amber);
}

.inv-bento-card.tone-danger .inv-bento-bar-fill {
  background: var(--adm-red);
}

.inv-bento-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--adm-muted);
  font-variant-numeric: tabular-nums;
}

.inv-bento-foot strong {
  color: var(--adm-sub);
  font-weight: 700;
}

.inv-bento-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--adm-gold-bright);
  cursor: pointer;
}

.inv-bento-link-btn:hover {
  text-decoration: underline;
}

/* Alert Bahan Menipis Drawer (hanya muncul bila ada item menipis/habis) */
.inv-alert-drawer {
  margin-bottom: 18px;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.42);
  background: var(--adm-amber-bg);
}

.inv-alert-drawer.has-danger {
  border-color: rgba(239, 68, 68, 0.45);
  background: var(--adm-red-bg);
}

.inv-alert-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.inv-alert-drawer-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.81rem;
  font-weight: 800;
}

.inv-alert-drawer-hint {
  font-size: 0.73rem;
  color: var(--adm-muted);
}

.low-stock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.low-stock-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--adm-border-strong);
  background: var(--adm-surface);
  color: var(--adm-text);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.low-stock-chip:hover {
  border-color: var(--adm-gold);
  transform: translateY(-1px);
}

.low-stock-chip.is-danger {
  border-color: rgba(239, 68, 68, 0.5);
  color: var(--adm-red-text);
}

.low-stock-chip.is-warning {
  border-color: rgba(245, 158, 11, 0.5);
  color: var(--adm-amber);
}

/* Section Cards (Kartu 1 Produksi & Kartu 2 Buku Stok) */
.inv-section-card {
  padding: 20px 22px;
  margin-bottom: 18px;
}

.inv-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--adm-border);
}

.inv-section-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.inv-section-head p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--adm-muted);
}

.inv-count-chip {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--adm-elevated);
  border: 1px solid var(--adm-border);
  color: var(--adm-sub);
  font-variant-numeric: tabular-nums;
}

/* Production Input Grid + Unit-Suffixed Controls */
.inv-production-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.inv-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.inv-field .label {
  margin-bottom: 6px;
}

.inv-unit-input {
  display: flex;
  align-items: stretch;
  border-radius: 10px;
  border: 1px solid var(--adm-border);
  background: var(--adm-input);
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.inv-unit-input:focus-within {
  border-color: var(--adm-gold);
  box-shadow: 0 0 0 3px var(--adm-gold-bg);
}

.inv-unit-input.is-linked {
  border-color: var(--adm-border-strong);
}

.inv-unit-control {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--adm-text);
  padding: 10px 12px;
  font-size: 1.02rem;
  font-weight: 800;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.inv-unit-input.is-compact .inv-unit-control {
  padding: 8px 10px;
  font-size: 0.86rem;
}

.inv-unit-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--adm-muted);
  background: var(--adm-elevated);
  border-left: 1px solid var(--adm-border);
  white-space: nowrap;
}

.inv-unit-input.is-linked .inv-unit-suffix {
  color: var(--adm-gold-bright);
  background: var(--adm-gold-bg);
}

.inv-field-note {
  display: block;
  margin-top: 6px;
  font-size: 0.71rem;
  color: var(--adm-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-field-note.is-gold {
  color: var(--adm-gold-bright);
  font-weight: 600;
}

/* Collapsible Rates & Sak Settings Drawer */
.inv-rates-details {
  margin-top: 16px;
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  background: var(--adm-elevated);
  overflow: hidden;
}

.inv-rates-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--adm-sub);
}

.inv-rates-summary::-webkit-details-marker {
  display: none;
}

.inv-rates-summary-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--adm-gold-bright);
}

.inv-rates-summary-meta {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--adm-muted);
  font-variant-numeric: tabular-nums;
}

.inv-rates-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--adm-border);
  background: var(--adm-surface);
}

/* ==========================================================================
   KARTU 2: BUKU STOK 32 BAHAN BAKU (TAB BAR + 5-COLUMN FIXED LEDGER)
   ========================================================================== */
.inv-materials-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.materials-search-wrap {
  position: relative;
  width: 240px;
}

.materials-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--adm-muted);
  pointer-events: none;
}

.materials-search-input {
  height: 36px;
  padding: 0 11px 0 32px;
  font-size: 0.8rem;
}

.inv-materials-head-right .btn-sm {
  height: 36px;
}

.inv-tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--adm-border);
  scrollbar-width: thin;
}

.inv-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--adm-muted);
  font-size: 0.77rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inv-tab-btn:hover {
  background: var(--adm-elevated);
  color: var(--adm-text);
}

.inv-tab-btn.active {
  background: var(--adm-gold-bg);
  border-color: var(--adm-border-strong);
  color: var(--adm-gold-bright);
}

.inv-tab-count {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--adm-elevated);
  color: var(--adm-muted);
  font-variant-numeric: tabular-nums;
}

.inv-tab-btn.active .inv-tab-count {
  background: var(--adm-gold-solid);
  color: var(--adm-on-gold);
}

.inv-tab-btn.has-low .inv-tab-count {
  background: var(--adm-amber-bg);
  color: var(--adm-amber);
}

.materials-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mat-accordion {
  border: 1px solid var(--adm-border);
  border-radius: 12px;
  background: var(--adm-surface);
  overflow: hidden;
  transition: border-color 0.16s ease;
}

.mat-accordion.is-open {
  border-color: var(--adm-border-strong);
}

.mat-accordion-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--adm-elevated);
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.mat-accordion-head:hover {
  background: var(--adm-row-hover);
}

.mat-acc-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mat-acc-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--adm-gold-bg);
  color: var(--adm-gold-bright);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mat-acc-icon svg {
  width: 14px;
  height: 14px;
}

.mat-acc-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--adm-text);
}

.mat-acc-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mat-acc-meta {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--adm-muted);
}

.mat-acc-chevron {
  width: 16px;
  height: 16px;
  color: var(--adm-muted);
  transition: transform 0.18s ease;
}

.mat-accordion.is-open .mat-acc-chevron {
  transform: rotate(180deg);
  color: var(--adm-gold-bright);
}

.mat-accordion-body {
  display: none;
  border-top: 1px solid var(--adm-border);
}

.mat-accordion.is-open .mat-accordion-body {
  display: block;
}

/* Fixed 5-Column Ledger Table (Mathematically Aligned Across All 5 Categories) */
.mat-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
}

.mat-table th {
  font-size: 0.67rem;
  padding: 9px 14px;
  background: transparent;
  color: var(--adm-muted);
  border-bottom: 1px solid var(--adm-border);
}

.mat-table th.col-name { width: 35%; text-align: left; }
.mat-table th.col-unit { width: 14%; text-align: left; }
.mat-table th.col-init { width: 19%; text-align: right; }
.mat-table th.col-used { width: 15%; text-align: right; }
.mat-table th.col-rem  { width: 17%; text-align: right; }

.mat-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--adm-border);
  vertical-align: middle;
}

.mat-table tbody tr:last-child td {
  border-bottom: none;
}

.mat-table tr.mat-row-auto td {
  background: rgba(245, 176, 65, 0.035);
}

.mat-table tr.mat-row-highlight td {
  animation: matRowPulse 1.6s ease;
}

@keyframes matRowPulse {
  0% { background: rgba(245, 176, 65, 0.28); }
  100% { background: transparent; }
}

.mat-item-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  color: var(--adm-text);
  line-height: 1.3;
}

.mat-auto-tag {
  font-size: 0.63rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--adm-gold-bg);
  color: var(--adm-gold-bright);
  flex-shrink: 0;
}

.mat-item-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  color: var(--adm-muted);
}

.mat-unit-text {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--adm-muted);
}

.mat-input-cell {
  text-align: right;
}

.mat-init-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
}

.mat-add-sak-btn {
  padding: 0 8px;
  height: 32px;
  font-size: 0.69rem;
  font-weight: 800;
  border-radius: 7px;
  border: 1px solid var(--adm-border-strong);
  background: var(--adm-gold-bg);
  color: var(--adm-gold-bright);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.mat-add-sak-btn:hover {
  background: var(--adm-gold-solid);
  color: var(--adm-on-gold);
}

.mat-num-input {
  width: 96px;
  height: 32px;
  padding: 0 9px;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
  border-radius: 7px;
  font-variant-numeric: tabular-nums;
}

.mat-num-input.is-auto-locked {
  border-color: var(--adm-border-strong);
  background: var(--adm-gold-bg);
  color: var(--adm-gold-bright);
  cursor: not-allowed;
}

.mat-remaining-cell {
  text-align: right;
  white-space: nowrap;
}

.mat-rem-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.mat-rem-num {
  font-weight: 800;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.mat-rem-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.67rem;
  font-weight: 700;
}

.mat-rem-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.mat-rem-stack.status-safe .mat-rem-num,
.mat-rem-stack.status-safe .mat-rem-status {
  color: var(--adm-green);
}
.mat-rem-stack.status-safe .mat-rem-status::before {
  background: var(--adm-green);
}

.mat-rem-stack.status-warning .mat-rem-num,
.mat-rem-stack.status-warning .mat-rem-status {
  color: var(--adm-amber);
}
.mat-rem-stack.status-warning .mat-rem-status::before {
  background: var(--adm-amber);
}

.mat-rem-stack.status-danger .mat-rem-num,
.mat-rem-stack.status-danger .mat-rem-status {
  color: var(--adm-red-text);
}
.mat-rem-stack.status-danger .mat-rem-status::before {
  background: var(--adm-red);
}

.mat-rem-stack.status-unset .mat-rem-num {
  color: var(--adm-muted);
  font-weight: 600;
}
.mat-rem-stack.status-unset .mat-rem-status {
  color: var(--adm-muted);
  opacity: 0.7;
}
.mat-rem-stack.status-unset .mat-rem-status::before {
  background: var(--adm-muted);
}

.mat-empty-search {
  text-align: center;
  padding: 28px 16px;
  color: var(--adm-muted);
  font-size: 0.83rem;
  border: 1px dashed var(--adm-border);
  border-radius: 12px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.charts-grid > .card {
  min-width: 0;
}

.charts-grid canvas {
  max-width: 100%;
}

.pill-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--adm-border);
  background: var(--adm-surface);
  color: var(--adm-sub);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.pill.active {
  background: var(--adm-gold-solid);
  border-color: var(--adm-gold-solid);
  color: var(--adm-on-gold);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th {
  text-align: left;
  padding: 11px 12px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--adm-muted);
  background: var(--adm-elevated);
  border-bottom: 1px solid var(--adm-border);
  white-space: nowrap;
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--adm-border);
  vertical-align: middle;
}

tr:hover td {
  background: var(--adm-row-hover);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge-green { background: var(--adm-green-bg); color: var(--adm-green); }
.badge-amber { background: var(--adm-amber-bg); color: var(--adm-amber); }
.badge-red   { background: var(--adm-red-bg);   color: var(--adm-red-text); }
.badge-blue  { background: var(--adm-blue-bg);  color: var(--adm-blue); }
.badge-gold  { background: var(--adm-gold-bg);  color: var(--adm-gold-bright); }

/* ==========================================================================
   SPLIT-SCREEN POS CASHIER TERMINAL
   ========================================================================== */
.pos-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 18px;
  align-items: start;
}

.pos-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.pos-prod-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--adm-border);
  background: var(--adm-surface);
  text-align: left;
  cursor: pointer;
  min-height: 98px;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.pos-prod-btn:hover:not(:disabled) {
  border-color: var(--adm-gold);
  background: var(--adm-elevated);
}

.pos-prod-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pos-terminal {
  position: sticky;
  top: 78px;
}

.quick-cash-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.quick-cash-btn {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--adm-border);
  background: var(--adm-surface);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.quick-cash-btn:hover {
  border-color: var(--adm-gold);
  color: var(--adm-gold-bright);
}

/* ==========================================================================
   MODALS & TOASTS
   ========================================================================== */
.adm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--adm-backdrop);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.adm-backdrop.open {
  display: flex;
}

.adm-modal {
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border-strong);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px var(--adm-shadow);
}

.adm-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--adm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.adm-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

.adm-modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--adm-border);
  background: var(--adm-sidebar);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.adm-toast-box {
  position: fixed;
  top: 74px;
  right: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adm-toast {
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--adm-elevated);
  border: 1px solid var(--adm-gold);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 10px 26px var(--adm-shadow);
}

/* ==========================================================================
   THERMAL RECEIPT PREVIEW & DEDICATED @media print (58mm & 80mm)
   ========================================================================== */
.receipt-paper {
  margin: 0 auto;
  background: #ffffff;
  color: #000000;
  padding: 16px 14px;
  border-radius: 6px;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  line-height: 1.38;
}

.receipt-paper.paper-58 {
  width: 240px;
  font-size: 11px;
}

.receipt-paper.paper-80 {
  width: 320px;
  font-size: 12px;
}

.receipt-divider {
  border-top: 1px dashed #333333;
  margin: 8px 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

@media (max-width: 1240px) {
  .dash-stock-mini-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .inv-production-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .inv-rates-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .content-wrap {
    padding: 20px 18px;
  }
  .kpi-grid.kpi-grid-3,
  .inv-bento-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .charts-grid,
  .pos-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -280px;
    z-index: 80;
    transition: left 0.22s ease;
  }
  .sidebar.mobile-open {
    left: 0;
  }
  .mobile-sidebar-btn {
    display: inline-flex;
  }
  .account-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mat-table {
    table-layout: auto;
  }
}

@media (max-width: 640px) {
  .theme-toggle .theme-label {
    display: none;
  }
  .kpi-grid.kpi-grid-3,
  .dash-stock-mini-grid,
  .inv-bento-grid,
  .inv-production-grid,
  .inv-rates-grid {
    grid-template-columns: 1fr;
  }
  .inv-toolbar-actions,
  .inv-btn-cluster,
  .inv-materials-head-right,
  .materials-search-wrap {
    width: 100%;
  }
  .mat-num-input {
    width: 82px;
  }
  .account-create-form {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    margin: 0;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  body * {
    visibility: hidden;
  }
  body.printing-receipt #receiptPrintTarget,
  body.printing-receipt #receiptPrintTarget * {
    visibility: visible;
  }
  body.printing-receipt #receiptPrintTarget {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    padding: 3mm;
    border-radius: 0;
    box-shadow: none;
  }
  body.printing-receipt #receiptPrintTarget.paper-58 {
    width: 54mm !important;
    max-width: 54mm !important;
    font-size: 10px !important;
  }
  body.printing-receipt #receiptPrintTarget.paper-80 {
    width: 74mm !important;
    max-width: 74mm !important;
    font-size: 11.5px !important;
  }

  body.printing-pnl #pnlPrintableCard,
  body.printing-pnl #pnlPrintableCard * {
    visibility: visible;
  }
  body.printing-pnl #pnlPrintableCard {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #ffffff !important;
    color: #000000 !important;
    border: none !important;
    padding: 12mm !important;
  }
}
