/* Warung Padang Sari Elok — Rencana Masak & Prediksi Penjualan (v2) */
:root {
  --primary: #6B1D1D;
  --primary-dark: #4F1313;
  --primary-light: #8C2D2D;
  --primary-soft: #FBEEEE;
  --accent: #B8860B;
  --accent-soft: #FBF4E4;
  --bg: #F6F3EF;
  --surface: #FFFFFF;
  --surface-alt: #FAF8F5;
  --border: #E5DFD7;
  --border-strong: #CFC7BD;
  --text: #1F242B;
  --text-muted: #5A616C;
  --success: #1B7A46;
  --success-bg: #E8F6EE;
  --warning: #9A4A07;
  --warning-bg: #FEF3C7;
  --danger: #B91C1C;
  --danger-bg: #FEE2E2;
  --info: #1D4ED8;
  --info-bg: #DBEAFE;
  --radius: 12px;
  --shadow: 0 1px 6px rgba(31, 36, 43, 0.06);
  --shadow-lg: 0 12px 30px rgba(31, 36, 43, 0.14);
  --tap: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
}
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid rgba(184, 134, 11, 0.6); outline-offset: 2px; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; }
.help-text { font-size: 13px; color: var(--text-muted); }
.field-error { color: var(--danger); font-size: 13px; margin-bottom: 8px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mobile-only { display: none; }

/* ---------- Login ---------- */
.login-wrapper {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #4F1313 0%, #6B1D1D 55%, #3B0E0E 100%);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: 16px; padding: 28px;
  box-shadow: var(--shadow-lg);
  border-top: 5px solid var(--accent);
}
.login-brand { text-align: center; margin-bottom: 20px; }
.login-emblem {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--primary); color: #F7E4BA;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; margin-bottom: 10px;
  border: 2px solid var(--accent);
}
.login-brand h1 { font-size: 20px; color: var(--primary); font-weight: 800; }
.login-brand p { font-size: 14px; color: var(--text-muted); }
.input-with-btn { display: flex; gap: 6px; }
.input-with-btn .form-control { flex: 1; }
.demo-box {
  background: var(--accent-soft); border: 1px solid #EBD7A7;
  border-radius: 10px; padding: 10px 14px; margin-top: 16px; font-size: 13.5px;
}
.demo-box summary { cursor: pointer; font-weight: 700; color: var(--primary); min-height: 28px; }
.demo-quick { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.demo-quick .btn { flex: 1; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; background: var(--primary-dark); color: #F7F1EB;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
}
.sidebar-header { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.sidebar-title { font-size: 18px; font-weight: 800; color: #fff; }
.sidebar-sub { font-size: 12.5px; color: #E8D5B7; }
.sidebar-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  min-height: var(--tap); padding: 10px 12px; border: none; background: transparent;
  color: rgba(255,255,255,0.86); font-size: 14.5px; font-weight: 500;
  border-radius: 8px; cursor: pointer; text-align: left; margin-bottom: 3px;
}
.nav-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-btn.active { background: var(--primary-light); color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.nav-icon { width: 22px; text-align: center; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.12); background: rgba(0,0,0,0.16); }
.user-name { font-weight: 700; font-size: 13.5px; color: #fff; }
.user-role {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: #1F1502; text-transform: uppercase;
}
.btn-sidebar { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.25); }
.btn-sidebar:hover { background: rgba(255,255,255,0.18); }

.main-area { margin-left: 236px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 25;
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 19px; font-weight: 800; color: var(--primary); line-height: 1.25; }
.topbar-sub { font-size: 13px; color: var(--text-muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.content { padding: 20px 24px 40px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--primary); }
.card-sub { font-size: 13px; color: var(--text-muted); font-weight: 400; }
.task-card {
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
}
.task-card.todo { background: var(--accent-soft); border-color: #EBD7A7; }
.task-card.done { background: var(--success-bg); border-color: #BFE3CD; }
.task-card strong { font-size: 15.5px; display: block; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.kpi-card.gold { border-left-color: var(--accent); }
.kpi-card.green { border-left-color: var(--success); }
.kpi-card.blue { border-left-color: var(--info); }
.kpi-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.kpi-value { font-size: 24px; font-weight: 800; margin: 2px 0; }
.kpi-sub { font-size: 12.5px; color: var(--text-muted); }
.grid-2 { display: grid; grid-template-columns: 1.45fr 1fr; gap: 16px; }
.grid-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Forms & Buttons ---------- */
.form-group { margin-bottom: 12px; }
.form-group.grow { flex: 1; min-width: 200px; }
.form-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
.form-control {
  width: 100%; min-height: var(--tap); padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: 15px; background: #fff; color: var(--text);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(107,29,29,0.12); outline: none; }
.form-control-sm { min-height: 38px; padding: 6px 10px; font-size: 14px; width: auto; }
.form-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--tap); padding: 9px 16px; border-radius: 8px;
  font-size: 14.5px; font-weight: 600; border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: background 0.15s, border-color 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #1E1402; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #156238; }
.btn-outline { background: #fff; border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); background: var(--surface-alt); }
.btn-ghost { background: transparent; color: var(--primary); border-color: transparent; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #FECACA; }
.btn-danger:hover:not(:disabled) { background: #FECACA; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
.btn-lg { min-height: 50px; padding: 12px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { min-width: var(--tap); padding: 0; font-size: 20px; }
.file-btn { position: relative; }

.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: #fff; flex-wrap: wrap; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; min-height: var(--tap); padding: 8px 16px; font-weight: 600; font-size: 14px; color: var(--text-muted); }
.segmented input:checked + span { background: var(--primary); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid rgba(184,134,11,0.6); outline-offset: -3px; }

/* ---------- Badges & Alerts ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-rf { background: #FDECEC; color: var(--primary); border: 1px solid #F5C2C2; }
.badge-rl { background: var(--info-bg); color: var(--info); border: 1px solid #BFDBFE; }
.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-muted { background: #ECEAE6; color: var(--text-muted); }
.badge-row { display: flex; gap: 6px; flex-wrap: wrap; }
.alert { padding: 11px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 14px; border-left: 4px solid; }
.alert-info { background: #EFF6FF; border-color: var(--info); color: #1E3A8A; }
.alert-warn { background: var(--warning-bg); border-color: var(--warning); color: #78350F; }
.alert-success { background: var(--success-bg); border-color: var(--success); color: #14532D; }
.alert-danger { background: var(--danger-bg); border-color: var(--danger); color: #7F1D1D; }

/* ---------- Catat penjualan ---------- */
.rekap-head { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.date-nav { display: flex; gap: 6px; align-items: center; }
.date-nav .form-control { width: 180px; }
.mode-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 4px 0 6px; }
.mode-row .form-label { margin: 0; }
.search-row { margin: 10px 0; max-width: 360px; }
.rekap-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.rekap-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.rekap-row:last-child { border-bottom: none; }
.rekap-row:nth-child(even) { background: var(--surface-alt); }
.rekap-row.zero .menu-name { color: var(--text-muted); }
.menu-name { font-weight: 600; }
.menu-meta { font-size: 12.5px; color: var(--text-muted); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: var(--tap); height: var(--tap); border-radius: 8px; border: 1px solid var(--border-strong);
  background: #fff; font-size: 20px; font-weight: 700; color: var(--primary); cursor: pointer;
}
.stepper button:active { background: var(--primary-soft); }
.num-input {
  width: 64px; height: var(--tap); border: 1px solid var(--border-strong); border-radius: 8px;
  text-align: center; font-size: 16px; font-weight: 700; background: #fff;
}
.num-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(107,29,29,0.12); }
.stock-grid { display: grid; grid-template-columns: repeat(4, minmax(64px, 1fr)) auto; gap: 8px; align-items: end; }
.stock-grid label { font-size: 11.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 3px; text-align: center; }
.stock-grid .num-input { width: 100%; }
.sold-out { font-size: 12px; color: var(--text-muted); text-align: center; }
.sold-out strong { display: block; font-size: 20px; color: var(--primary); }
.rekap-row.stock { grid-template-columns: 1fr; }
.more-box { margin-top: 12px; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 10px 14px; }
.more-box summary { cursor: pointer; font-weight: 600; min-height: 28px; }
.more-box .form-row { grid-template-columns: 2fr 1fr; margin-top: 8px; }
.save-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 14px -20px -18px; padding: 12px 20px;
  background: var(--surface); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
}
.save-total { font-size: 20px; font-weight: 800; color: var(--primary); display: block; }
.save-sub { font-size: 13px; color: var(--text-muted); }
.history-list { display: flex; flex-direction: column; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: none; }
.history-main { min-width: 0; }
.history-main .date { font-weight: 700; }
.history-main .note { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }
.history-actions { display: flex; gap: 6px; flex-shrink: 0; }
.search-inline { width: 240px; }
.empty-state { padding: 24px 12px; text-align: center; color: var(--text-muted); }

/* ---------- Rencana masak ---------- */
.plan-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.plan-toolbar .form-group { margin-bottom: 0; }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#forecastMetaInfo { margin-top: 10px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.plan-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); border-top: 4px solid var(--primary);
}
.plan-card .menu-name { font-size: 15.5px; }
.plan-qty { font-size: 34px; font-weight: 800; color: var(--primary); line-height: 1.1; margin: 6px 0 2px; }
.plan-qty small { font-size: 15px; font-weight: 600; color: var(--text-muted); }
.plan-range { font-size: 13.5px; color: var(--text); }
.plan-foot { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--text-muted); }
.plan-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.plan-mini-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 9px; }
.plan-mini-item strong { font-size: 18px; color: var(--primary); white-space: nowrap; }
.details-card summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; min-height: 28px; }
.details-card summary::before { content: "▸"; color: var(--primary); }
.details-card[open] summary::before { content: "▾"; }
.details-body { margin-top: 12px; }

/* ---------- Menu & harga ---------- */
.menu-list { display: flex; flex-direction: column; }
.menu-item { display: grid; grid-template-columns: 1fr 130px 130px auto; gap: 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.menu-item:last-child { border-bottom: none; }
.menu-item label { font-size: 12px; color: var(--text-muted); }
.menu-item .form-control { min-height: 40px; }
.menu-item.changed { background: var(--accent-soft); }
.holiday-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.holiday-form .btn { margin-bottom: 12px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 9px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { background: var(--primary); color: #fff; font-weight: 600; padding: 9px 10px; text-align: left; white-space: nowrap; font-size: 12.5px; }
tbody td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
tbody tr:nth-child(even) { background: var(--surface-alt); }
tbody tr:last-child td { border-bottom: none; }
.better { color: var(--success); font-weight: 700; }
.chart-box { position: relative; height: 300px; width: 100%; }
.danger-zone { border-color: #F5C2C2; }
#csvPreview { margin-top: 8px; }

/* ---------- Dialog & toast ---------- */
.dialog { border: none; border-radius: 14px; padding: 22px; max-width: 420px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); margin: auto; }
.dialog::backdrop { background: rgba(0,0,0,0.45); }
.dialog-actions { justify-content: flex-end; }
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1F242B; color: #fff; padding: 12px 16px; border-radius: 9px; font-size: 14px; box-shadow: var(--shadow-lg); border-left: 4px solid var(--accent); animation: fadeInUp 0.2s ease; max-width: 360px; }
.toast.error { border-left-color: #F87171; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; }

@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-equal { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
  body { font-size: 15px; }
  .sidebar { display: none; }
  .main-area { margin-left: 0; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 14px; }
  .topbar-title h1 { font-size: 18px; }
  .topbar-sub { display: none; }
  .mobile-only { display: inline-flex; }
  .content { padding: 12px 12px 24px; }
  .card { padding: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-card { padding: 10px 12px; }
  .kpi-value { font-size: 19px; }
  .kpi-label { font-size: 12px; }
  .form-row, .more-box .form-row { grid-template-columns: 1fr; }
  .rekap-head { gap: 4px; }
  .date-nav .form-control { flex: 1; width: auto; }
  .date-nav { width: 100%; }
  .rekap-head .form-group { width: 100%; }
  .segmented { width: 100%; }
  .segmented label { flex: 1; }
  .segmented span { justify-content: center; padding: 8px 6px; }
  .stock-grid { grid-template-columns: repeat(4, 1fr); }
  .stock-grid .sold-out { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; text-align: left; }
  .stock-grid .sold-out strong { display: inline; }
  .save-bar { margin: 12px -14px -14px; padding: 10px 14px; bottom: calc(64px + env(safe-area-inset-bottom)); }
  .plan-actions { width: 100%; }
  .plan-actions .btn { flex: 1; }
  .plan-toolbar .form-group { width: 100%; }
  .plan-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .plan-card { padding: 12px; }
  .plan-qty { font-size: 28px; }
  .plan-mini { grid-template-columns: 1fr; gap: 6px; }
  .plan-mini-item { padding: 8px 12px; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-inline { width: 100%; }
  .menu-item { grid-template-columns: 1fr 1fr; }
  .menu-item .menu-head { grid-column: 1 / -1; }
  .toast-container { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bnav-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 60px; border: none; background: none; font-size: 12px; font-weight: 600; color: var(--text-muted); cursor: pointer;
  }
  .bnav-btn span { font-size: 19px; }
  .bnav-btn.active { color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }
}



/* ---------- v3 ---------- */
.omzet-row { display: flex; gap: 24px; flex-wrap: wrap; }
.sub-title { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.check-row { display: flex; gap: 8px; align-items: center; }
.plan-foot span:first-child { font-variant-numeric: tabular-nums; }
@media (max-width: 780px) {
  .omzet-row { gap: 10px; flex-direction: column; }
}

@media (max-width: 780px) {
  .plan-card { padding: 10px 12px; }
  .plan-qty { font-size: 26px; margin: 2px 0; }
  .plan-card .menu-name { font-size: 14px; line-height: 1.3; }
}

/* ---------- v3.2: SVG icons ---------- */
.icon { display: block; flex-shrink: 0; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; }
.bnav-btn .icon { width: 22px; height: 22px; }
.btn.mobile-only { display: none; }
@media (max-width: 780px) { .btn.mobile-only { display: inline-flex; } }

/* ---------- v3.3: keterbacaan ---------- */
:root { --text: #15191F; --text-muted: #3F4650; }
body { font-size: 16px; line-height: 1.6; }
.help-text, .card-sub, .menu-meta, .kpi-sub { font-size: 14.5px; color: var(--text-muted); }
.card-title { font-size: 18px; }
.topbar-title h1 { font-size: 20px; }
.form-label { font-size: 15px; }
.menu-name { font-size: 16px; }
.plan-card .menu-name { font-size: 16px; font-weight: 700; }
.plan-qty { font-size: 36px; }
.plan-foot { font-size: 13.5px; }
.task-card strong { font-size: 17px; }
.btn { font-size: 15.5px; }
.bnav-btn { font-size: 13px; }
.badge { font-size: 13px; padding: 3px 10px; }
.history-main .date { font-size: 15.5px; }
.history-main .note { font-size: 14px; }
.save-total { font-size: 22px; }
table { font-size: 14.5px; }
thead th { font-size: 13.5px; }
.date-nav .form-control { width: 100%; max-width: 260px; }
.card { padding: 20px 22px; }
@media (max-width: 780px) {
  .card { padding: 16px; }
  .plan-qty { font-size: 32px; }
  .plan-card .menu-name { font-size: 15px; }
  .date-nav .form-control { max-width: none; }
}

/* ==========================================================================
   v3.4: tata letak panel admin (header + sidebar gelap + kotak berjudul)
   Palet tetap: marun #6B1D1D, marun tua #4F1313, emas #B8860B, krem #F6F3EF
   ========================================================================== */
:root { --header-h: 56px; --sidebar-w: 236px; --sidebar-bg: #2A1C1C; --sidebar-bg-2: #211515; }
body { background: var(--bg); }

.main-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 50;
  display: flex; align-items: center; background: var(--primary); color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.brand {
  width: var(--sidebar-w); height: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--primary-dark); font-weight: 800; font-size: 18px; letter-spacing: 1px; flex-shrink: 0;
}
.menu-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: var(--header-h); height: 100%;
  background: transparent; border: none; color: #fff; cursor: pointer;
}
.menu-toggle:hover { background: rgba(255,255,255,0.1); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 14px; padding-right: 16px; font-size: 14.5px; }
.header-date { font-style: italic; color: #F3E3C3; }
.header-user { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.btn-header { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.3); }
.btn-header:hover { background: rgba(255,255,255,0.22); }

.sidebar {
  display: flex; top: var(--header-h); width: var(--sidebar-w); background: var(--sidebar-bg); color: #EDE3DA;
  transition: transform 0.2s ease; z-index: 45;
}
.user-panel { text-align: center; padding: 18px 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.user-org { font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 12px; }
.user-avatar {
  width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #2A1C1C; font-size: 26px; font-weight: 800; border: 3px solid rgba(255,255,255,0.85);
}
.user-panel .user-name { font-size: 14.5px; color: #fff; }
.nav-label { background: var(--sidebar-bg-2); color: rgba(255,255,255,0.5); font-size: 12px; letter-spacing: 0.6px; padding: 9px 16px; margin: 0 -10px 8px; }
.sidebar-nav { padding: 0 10px 12px; }
.nav-btn { border-radius: 0; margin: 0 -10px; width: calc(100% + 20px); padding: 12px 18px; color: #D9CCC1; border-left: 3px solid transparent; }
.nav-btn:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-btn.active { background: var(--sidebar-bg-2); color: #fff; box-shadow: none; border-left-color: var(--accent); }
.sidebar-footer { background: transparent; border-top: 1px solid rgba(255,255,255,0.08); }

.main-area { margin-left: var(--sidebar-w); padding-top: var(--header-h); transition: margin-left 0.2s ease; padding-bottom: 0; }
.content { padding: 18px 22px 40px; }
.content-header h1 { font-size: 22px; font-weight: 700; color: var(--text); margin: 2px 0 14px; }

body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main-area { margin-left: 0; }
.sidebar-backdrop { display: none; }

/* Kotak berjudul */
.card { border-radius: 4px; border: 1px solid var(--border); border-top: 3px solid var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.card > .card-header:first-child {
  margin: -20px -22px 16px; padding: 11px 22px; background: var(--primary); color: #fff;
  border-radius: 0; border-bottom: none; align-items: center;
}
.card > .card-header:first-child .card-title { color: #fff; font-size: 16.5px; }
details.card > summary.card-header { cursor: pointer; list-style: none; margin-bottom: 0; }
details.card[open] > summary.card-header { margin-bottom: 16px; }
details.card > summary.card-header::-webkit-details-marker { display: none; }
details.card > summary.card-header .card-title::before { content: "+ "; }
details.card[open] > summary.card-header .card-title::before { content: "− "; }
details.card:not([open]) { padding-bottom: 0; }
details.card > summary::before { content: none !important; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .help-text { margin-left: auto; }
.table-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14.5px; }
.table-tools label { display: inline-flex; align-items: center; gap: 6px; }
.table-tools .form-control { width: auto; }
.table-tools .search .form-control { width: 200px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

.data-table thead th { background: #FAF6F1; color: var(--text); font-weight: 700; border-bottom: 2px solid var(--border); font-size: 14px; }
.data-table td { border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:nth-child(odd) { background: #FCFAF7; }
.data-table tbody tr:nth-child(even) { background: #fff; }
.data-table tbody tr:hover { background: #F6EEE4; }
.data-table tfoot td { font-weight: 700; border-top: 2px solid var(--border); padding: 9px 10px; }
.data-table tfoot .foot-note { font-weight: 400; font-size: 13.5px; color: var(--text-muted); border-top: none; }
.data-table .qty { font-size: 20px; font-weight: 800; color: var(--primary); }
.data-table .actions { white-space: nowrap; }
.table-wrap { border-radius: 2px; }

.btn-xs { min-height: 30px; padding: 3px 10px; font-size: 13px; border-radius: 4px; }
.btn-info { background: var(--accent); color: #fff; }
.btn-info:hover { background: #9C7209; }
.btn-danger.btn-xs { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-success { background: #2E7D32; }

.pager { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.pg { min-width: 40px; min-height: 36px; padding: 0 12px; border: none; border-right: 1px solid var(--border); background: #fff; color: var(--primary); font-size: 14px; cursor: pointer; }
.pg:last-child { border-right: none; }
.pg.active { background: var(--primary); color: #fff; font-weight: 700; }
.pg:disabled { color: #A9A39B; cursor: not-allowed; }
.pg-gap { padding: 0 8px; align-self: center; color: var(--text-muted); }

.task-card { border-radius: 4px; }

@media (max-width: 780px) {
  .brand { width: auto; padding: 0 14px; font-size: 16px; order: 2; background: transparent; }
  .menu-toggle { order: 1; }
  .header-right { order: 3; gap: 8px; padding-right: 10px; }
  .header-date, .header-user span { display: none; }
  .header-user { display: none; }
  .sidebar { display: flex; transform: translateX(-100%); top: var(--header-h); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,0.45); z-index: 40; }
  .main-area { margin-left: 0; padding-bottom: 0; }
  .content { padding: 12px 10px 28px; }
  .content-header h1 { font-size: 20px; margin-bottom: 10px; }
  .card > .card-header:first-child { margin: -16px -16px 14px; padding: 10px 16px; }
  .save-bar { bottom: 0; }
  .toast-container { bottom: 16px; }
  .table-tools .search, .table-tools .search .form-control { width: 100%; }
  .toolbar .help-text { margin-left: 0; width: 100%; }
}

/* Satu tombol Keluar saja, di header */
.sidebar-footer { display: none; }
.nowrap { white-space: nowrap; }
.sm-only { display: none; }
.cell-sub { font-size: 13.5px; color: var(--text-muted); font-weight: 400; }
@media (max-width: 780px) {
  .lg-only { display: none; }
  .sm-only { display: block; }
}

/* ==========================================================================
   v3.6: penyesuaian tampilan HP
   ========================================================================== */
.sm-inline { display: none; }
.lg-inline { display: inline; }
.card-header .btn:disabled { background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.75); border-color: rgba(255,255,255,0.25); opacity: 1; }
.card-header .btn-primary:not(:disabled) { background: var(--accent); color: #fff; }

@media (max-width: 780px) {
  :root { --bnav-h: 62px; }
  .sm-inline { display: inline; }
  .lg-inline { display: none; }

  /* Header: ringkas */
  .main-header { height: 52px; }
  :root { --header-h: 52px; }
  .brand { font-size: 17px; letter-spacing: 0.5px; }
  #btnLogoutTop { display: none; }
  .header-right .badge { font-size: 12px; }
  .sidebar-footer { display: block; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }

  /* Navigasi bawah */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 48;
    background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bnav-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: var(--bnav-h); border: none; background: none; color: var(--text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
  }
  .bnav-btn .icon { width: 22px; height: 22px; }
  .bnav-btn.active { color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); background: var(--primary-soft); }
  .main-area { padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom)); }
  .save-bar { bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom)); }
  .toast-container { bottom: calc(var(--bnav-h) + 12px + env(safe-area-inset-bottom)); }
  body.sidebar-open .sidebar-backdrop { bottom: 0; }

  /* Judul halaman lebih kecil, kotak lebih rapat */
  .content-header h1 { font-size: 18px; margin: 0 0 8px; }
  .card { margin-bottom: 12px; }
  .task-card { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
  .task-card .btn { width: 100%; }
  .toolbar .btn { flex: 1; }

  /* Tabel riwayat menjadi daftar bertumpuk */
  .data-table.stack thead { display: none; }
  .data-table.stack, .data-table.stack tbody { display: block; }
  .data-table.stack tr {
    display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center;
    padding: 12px 12px; border-bottom: 1px solid var(--border);
  }
  .data-table.stack td { display: block; padding: 0; border: none; }
  .data-table.stack td:nth-child(1) { display: none; }
  .data-table.stack td:nth-child(2) { font-weight: 700; font-size: 15.5px; }
  .data-table.stack td:nth-child(3) { grid-row: 1; grid-column: 2; }
  .data-table.stack td:nth-child(4) { text-align: left; font-weight: 600; }
  .data-table.stack td:nth-child(5) { grid-column: 1 / -1; font-size: 14px; }
  .data-table.stack td.no-note { display: none; }
  .data-table.stack td:nth-child(6) { grid-row: 2; grid-column: 2; text-align: right; }
  .data-table.stack td.empty-state { grid-column: 1 / -1; display: block; }
  .data-table.stack tr:has(td.empty-state) { display: block; }
  .table-wrap:has(.stack) { border: none; overflow: visible; }
  .btn-xs { min-height: 38px; padding: 6px 12px; font-size: 14px; }

  .table-tools { flex-direction: column; align-items: stretch; gap: 8px; }
  .table-tools .search { display: flex; }
  .table-tools .search .form-control { flex: 1; }
  .table-foot { flex-direction: column; align-items: stretch; text-align: center; }
  .pager { justify-content: center; align-self: center; }
  .pg { min-width: 44px; min-height: 44px; font-size: 15px; }
}
@media (max-width: 780px) {
  .bnav-btn span { font-size: 12.5px; line-height: 1.2; }
  .lg-only-flex { display: none !important; }
  .toolbar .btn { flex: 0 0 auto; }
  .data-table.stack td:nth-child(2) { font-size: 15px; }
}

/* v3.7: tombol Keluar selalu terlihat di header HP */
@media (max-width: 780px) {
  #btnLogoutTop { display: inline-flex; min-height: 36px; padding: 4px 10px; gap: 5px; font-size: 14px; }
  .sidebar-footer { display: none; }
}
@media (max-width: 360px) {
  .brand { padding: 0 8px; font-size: 15px; }
  .header-right .badge { display: none; }
}

/* ==========================================================================
   v3.8: halaman login (latar terang, kartu putih, label mengambang)
   ========================================================================== */
.login-wrapper {
  background: #F4F2EF; flex-direction: column; gap: 28px; padding: 32px 18px;
}
.login-logo { display: flex; align-items: center; gap: 10px; }
.login-logo-mark {
  width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--primary) 0 50%, var(--accent) 50% 100%); color: #fff; font-size: 13px; font-weight: 800;
}
.login-logo-name { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: 0.2px; }
.login-card {
  max-width: 400px; padding: 34px 32px 26px; border-radius: 16px; border-top: none;
  box-shadow: 0 18px 40px rgba(60, 30, 20, 0.10), 0 2px 6px rgba(60, 30, 20, 0.05);
}
.login-title { font-size: 26px; font-weight: 600; text-align: center; color: var(--text); }
.login-sub { text-align: center; color: #8A8F98; font-size: 14px; margin: 6px 0 24px; }

.float-field { position: relative; margin-bottom: 16px; }
.float-field input {
  width: 100%; height: 56px; padding: 22px 46px 6px 14px; border-radius: 10px;
  border: 1.5px solid transparent; background: #F3F1EE; font-size: 15.5px; color: var(--text);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.float-field input:focus { outline: none; background: #fff; border-color: #C9A3A3; box-shadow: 0 0 0 4px rgba(107, 29, 29, 0.10); }
.float-field label {
  position: absolute; left: 15px; top: 17px; font-size: 15px; color: #9A9EA6; pointer-events: none;
  transition: top 0.15s, font-size 0.15s, color 0.15s;
}
.float-field input:focus + label,
.float-field input:not(:placeholder-shown) + label { top: 7px; font-size: 12px; color: #8A8F98; }
.eye-btn {
  position: absolute; right: 6px; top: 6px; width: 44px; height: 44px; border: none; background: none;
  color: #A3A7AE; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 8px;
}
.eye-btn:hover { color: var(--primary); }
.eye-btn .icon-eye-off { display: none; }
.eye-btn.on .icon-eye { display: none; }
.eye-btn.on .icon-eye-off { display: block; }

.btn-login {
  width: 100%; height: 52px; margin-top: 10px; border: none; border-radius: 10px; cursor: pointer;
  background: linear-gradient(90deg, #8C2D2D 0%, #6B1D1D 100%); color: #fff; font-size: 16px; font-weight: 600;
  box-shadow: 0 10px 22px rgba(107, 29, 29, 0.28); transition: transform 0.1s, box-shadow 0.15s;
}
.btn-login:hover { box-shadow: 0 12px 26px rgba(107, 29, 29, 0.36); }
.btn-login:active { transform: translateY(1px); }
.link-btn {
  display: block; margin: 20px auto 0; background: none; border: none; color: var(--primary);
  font-size: 14.5px; font-weight: 600; cursor: pointer; min-height: 36px;
}
.link-btn:hover { text-decoration: underline; }
.login-card .demo-box { margin-top: 18px; background: #FBF7EE; }
.login-foot { color: #9A9EA6; font-size: 13px; }
.login-card .alert { margin-bottom: 14px; }
@media (max-width: 480px) {
  .login-wrapper { justify-content: flex-start; padding-top: 48px; gap: 22px; }
  .login-card { padding: 28px 20px 22px; }
}
