:root {
  --bg: #f5f2ea;
  --surface: #fffdf8;
  --surface-2: #f8f4eb;
  --text: #26332b;
  --muted: #758078;
  --line: #e2ded2;
  --primary: #355f4a;
  --primary-dark: #274737;
  --primary-soft: #e7efe9;
  --accent: #d79b3e;
  --danger: #b74c4c;
  --danger-soft: #f9e9e7;
  --warning: #b97d1f;
  --warning-soft: #fff4d9;
  --success: #3d7b57;
  --success-soft: #e9f4ec;
  --shadow: 0 16px 40px rgba(34, 48, 39, 0.08);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #203d30;
  color: #fff;
  padding: 26px 18px;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #f7efe2;
  color: #9a6234;
  font-family: "Playfair Display", serif;
  font-size: 23px;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 24px;
  line-height: 1;
}

.brand p {
  margin: 6px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  text-align: left;
  transition: 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

.nav-icon {
  width: 24px;
  font-size: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.save-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8cd3a7;
  box-shadow: 0 0 0 5px rgba(140, 211, 167, 0.12);
}

.save-status strong,
.save-status small {
  display: block;
}

.save-status strong {
  font-size: 12px;
}

.save-status small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
}

.main-content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 32px;
  background: rgba(245, 242, 234, 0.92);
  border-bottom: 1px solid rgba(226, 222, 210, 0.85);
  backdrop-filter: blur(12px);
}

.topbar h2 {
  margin: 2px 0 0;
  font-family: "Playfair Display", serif;
  font-size: 27px;
}

.eyebrow,
.section-kicker,
.hero-kicker {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  font-weight: 700;
}

.topbar-actions,
.toolbar-actions,
.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-button {
  display: none !important;
}

.content-area {
  padding: 28px 32px 50px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 34px;
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(circle at 88% 15%, rgba(255, 255, 255, 0.18), transparent 28%),
    linear-gradient(135deg, #2c5541 0%, #3d755a 100%);
  box-shadow: var(--shadow);
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  right: -50px;
  bottom: -120px;
}

.hero-card h3 {
  max-width: 700px;
  margin: 9px 0 12px;
  font-family: "Playfair Display", serif;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
}

.hero-card p {
  max-width: 700px;
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.7;
}

.hero-kicker {
  color: #e9c98f;
}

.button,
.icon-button,
.text-button,
.action-button {
  border: 0;
  transition: 0.2s ease;
}

.button {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 13px;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(53, 95, 74, 0.18);
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}

.button.light {
  color: var(--primary-dark);
  background: #fff;
}

.button.ghost-light {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.button.danger-outline {
  color: var(--danger);
  background: transparent;
  border: 1px solid #e8bebe;
}

.button.small {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 12px;
}

.button.full-width,
.full-width {
  width: 100%;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  font-size: 21px;
}

.icon-button:hover {
  background: var(--surface-2);
}

.text-button {
  padding: 4px 0;
  color: var(--primary);
  background: transparent;
  font-weight: 700;
}

.stat-grid,
.grid-3,
.grid-2 {
  display: grid;
  gap: 18px;
}

.stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 22px 0;
}

.grid-2 {
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
}

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

.stat-card,
.mini-stat {
  padding: 22px;
  border: 1px solid rgba(226, 222, 210, 0.9);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(34, 48, 39, 0.045);
}

.stat-card .stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 19px;
}

.stat-card p,
.mini-stat p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong,
.mini-stat strong {
  display: block;
  margin-top: 11px;
  font-size: 25px;
}

.stat-card small,
.mini-stat small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.panel {
  overflow: hidden;
  border: 1px solid rgba(226, 222, 210, 0.9);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(34, 48, 39, 0.045);
}

.panel-header {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.panel-header.compact {
  min-height: 76px;
}

.panel-header h3,
.section-title {
  margin: 5px 0 0;
  font-family: "Playfair Display", serif;
  font-size: 22px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #7a837d;
  background: #fbfaf6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
}

td {
  font-size: 13px;
}

tbody tr:hover {
  background: #fcfbf8;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.wide-table table {
  min-width: 1030px;
}

.align-right {
  text-align: right;
}

.record-count {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge.success {
  color: var(--success);
  background: var(--success-soft);
}

.badge.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.neutral {
  color: #68736b;
  background: #eef0eb;
}

.action-group {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.action-button {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border-radius: 9px;
  color: var(--text);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
}

.action-button:hover {
  background: #ece7dc;
}

.action-button.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.insight-list {
  display: grid;
}

.insight-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.insight-item:last-child {
  border-bottom: 0;
}

.insight-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
}

.insight-item strong,
.insight-item small {
  display: block;
}

.insight-item strong {
  font-size: 13px;
}

.insight-item small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.search-field {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

select,
input,
textarea {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefb;
  outline: none;
}

select,
input {
  min-height: 42px;
  padding: 9px 11px;
}

textarea {
  resize: vertical;
  padding: 11px;
}

select:focus,
input:focus,
textarea:focus {
  border-color: #79a089;
  box-shadow: 0 0 0 3px rgba(53, 95, 74, 0.09);
}

.filter-group > select {
  width: auto;
  min-width: 165px;
  background: var(--surface);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.menu-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(34, 48, 39, 0.05);
}

.menu-card-top {
  position: relative;
  min-height: 130px;
  padding: 22px;
  color: #fff;
  background: linear-gradient(135deg, #315c47, #6a9a79);
}

.menu-card:nth-child(5n + 2) .menu-card-top {
  background: linear-gradient(135deg, #884752, #c3737d);
}

.menu-card:nth-child(5n + 3) .menu-card-top {
  background: linear-gradient(135deg, #9c681f, #d6a247);
}

.menu-card:nth-child(5n + 4) .menu-card-top {
  background: linear-gradient(135deg, #a17038, #d1a874);
}

.menu-card:nth-child(5n + 5) .menu-card-top {
  background: linear-gradient(135deg, #a6761e, #e0b653);
}

.menu-card-top p,
.menu-card-top h3 {
  position: relative;
  z-index: 1;
}

.menu-card-top p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.menu-card-top h3 {
  margin: 7px 0 0;
  font-family: "Playfair Display", serif;
  font-size: 26px;
}

.menu-card-top::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -26px;
  bottom: -55px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.menu-card-body {
  padding: 20px;
}

.menu-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-box {
  padding: 12px;
  border-radius: 11px;
  background: var(--surface-2);
}

.metric-box span,
.metric-box strong {
  display: block;
}

.metric-box span {
  color: var(--muted);
  font-size: 10px;
}

.metric-box strong {
  margin-top: 4px;
  font-size: 14px;
}

.menu-status-row,
.menu-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.menu-status-row {
  margin-top: 16px;
}

.menu-card-actions {
  margin-top: 17px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.shrink-summary {
  margin-bottom: 18px;
}

.simulation-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
}

.simulation-form-panel {
  align-self: start;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid.single-column {
  grid-template-columns: 1fr;
  padding: 22px;
}

.form-grid.four-columns {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
}

.field.full-span,
.full-span {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex;
  align-items: flex-end;
}

.checkbox-field label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
}

.simulation-result {
  min-height: 510px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.14), transparent 30%),
    linear-gradient(135deg, #2a513f, #487b60);
  box-shadow: var(--shadow);
}

.sim-result-header {
  padding: 28px 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.sim-result-header h3 {
  margin: 7px 0 0;
  font-family: "Playfair Display", serif;
  font-size: 30px;
}

.sim-result-body {
  padding: 28px 30px;
}

.price-recommendation {
  margin-bottom: 24px;
  padding: 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
}

.price-recommendation span,
.price-recommendation strong,
.price-recommendation small {
  display: block;
}

.price-recommendation span,
.price-recommendation small {
  color: rgba(255, 255, 255, 0.72);
}

.price-recommendation strong {
  margin: 7px 0;
  font-size: 38px;
}

.sim-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.sim-metric {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
}

.sim-metric span,
.sim-metric strong {
  display: block;
}

.sim-metric span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
}

.sim-metric strong {
  margin-top: 6px;
  font-size: 17px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.settings-grid .panel > form,
.settings-grid .stacked-actions,
.settings-grid .helper-text,
.settings-grid .storage-summary {
  margin: 22px;
}

.stacked-actions {
  display: grid;
  gap: 10px;
}

.file-button {
  display: grid;
  place-items: center;
}

.helper-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.storage-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.storage-item {
  padding: 16px;
  border-radius: 12px;
  background: var(--surface-2);
}

.storage-item span,
.storage-item strong {
  display: block;
}

.storage-item span {
  color: var(--muted);
  font-size: 11px;
}

.storage-item strong {
  margin-top: 6px;
  font-size: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(18, 30, 23, 0.58);
  backdrop-filter: blur(3px);
}

.modal {
  position: fixed;
  z-index: 90;
  top: 50%;
  left: 50%;
  width: min(680px, calc(100vw - 30px));
  max-height: calc(100vh - 34px);
  overflow: auto;
  transform: translate(-50%, -50%);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(15, 29, 21, 0.28);
}

.large-modal {
  width: min(1050px, calc(100vw - 30px));
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(8px);
}

.modal-header h3 {
  margin: 5px 0 0;
  font-family: "Playfair Display", serif;
  font-size: 23px;
}

.modal-body {
  padding: 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.calculation-preview,
.menu-calculation-preview {
  margin-top: 18px;
  padding: 16px;
  border-radius: 13px;
  border: 1px solid #d8e4da;
  background: var(--primary-soft);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.preview-item span,
.preview-item strong {
  display: block;
}

.preview-item span {
  color: var(--muted);
  font-size: 10px;
}

.preview-item strong {
  margin-top: 4px;
  font-size: 14px;
}

.subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 24px 0 12px;
}

.subsection-header h4 {
  margin: 4px 0 0;
  font-family: "Playfair Display", serif;
  font-size: 18px;
}

.costs-heading {
  margin-top: 28px;
}

.composition-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.composition-table {
  min-width: 820px;
}

.composition-table td,
.composition-table th {
  padding: 10px;
}

.composition-table input,
.composition-table select {
  min-height: 38px;
}

.composition-unit,
.composition-cost,
.composition-subtotal {
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  padding: 46px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.toast-container {
  position: fixed;
  z-index: 120;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  color: #fff;
  background: #263c31;
  box-shadow: 0 15px 40px rgba(15, 29, 21, 0.2);
  animation: toastIn 0.22s ease;
}

.toast.error {
  background: #8c3e3e;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

  .form-grid.four-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 270px;
    transform: translateX(-100%);
    transition: 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(14, 27, 20, 0.22);
  }

  .mobile-menu-button {
    display: inline-grid !important;
  }

  .topbar {
    padding-inline: 20px;
  }

  .content-area {
    padding: 22px 20px 42px;
  }

  .grid-2,
  .simulation-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .storage-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    display: none;
  }

  .hero-card,
  .section-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions,
  .toolbar-actions {
    flex-wrap: wrap;
  }

  .stat-grid,
  .grid-3,
  .menu-grid,
  .form-grid,
  .form-grid.four-columns {
    grid-template-columns: 1fr;
  }

  .filter-group,
  .search-field,
  .filter-group > select {
    width: 100%;
    min-width: 0;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .sim-metric-grid {
    grid-template-columns: 1fr;
  }

  .storage-summary {
    grid-template-columns: 1fr;
  }

  .modal-body,
  .modal-header {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (max-width: 460px) {
  .content-area {
    padding-inline: 14px;
  }

  .topbar {
    padding-inline: 14px;
  }

  .hero-card {
    padding: 25px 22px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Riwayat order dan sumber master file
   ========================================================= */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

#page-orders .panel + .panel,
.order-stat-grid {
  margin-top: 18px;
}

.order-filter-panel {
  padding: 18px 20px;
}

.order-filters {
  align-items: flex-end;
}

.compact-field {
  min-width: 170px;
}

.compact-field label {
  margin-bottom: 5px;
}

.order-search-field {
  flex: 1;
  min-width: 250px;
}

.extra-wide-table table {
  min-width: 1320px;
}

.order-item-list {
  max-width: 250px;
  white-space: normal;
  line-height: 1.6;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.text-danger {
  color: var(--danger);
  font-weight: 700;
}

.order-items-table {
  min-width: 980px;
}

.order-items-table th:nth-child(1),
.order-items-table td:nth-child(1) {
  min-width: 190px;
}

.order-items-table th:nth-child(2),
.order-items-table td:nth-child(2) {
  width: 95px;
}

.order-items-table th:nth-child(3),
.order-items-table td:nth-child(3),
.order-items-table th:nth-child(4),
.order-items-table td:nth-child(4) {
  width: 145px;
}

.order-items-table input[readonly] {
  color: var(--muted);
  background: #f3f1eb;
  cursor: not-allowed;
}

.order-item-revenue,
.order-item-profit {
  font-size: 12px;
  font-weight: 700;
}

.order-calculation-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.order-calculation-preview > div {
  padding: 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.62);
}

.order-calculation-preview span,
.order-calculation-preview strong {
  display: block;
}

.order-calculation-preview span {
  color: var(--muted);
  font-size: 10px;
}

.order-calculation-preview strong {
  margin-top: 5px;
  font-size: 14px;
}

.preview-success {
  color: var(--success);
}

.preview-warning {
  color: var(--warning);
}

.preview-danger {
  color: var(--danger);
}

.field-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.master-source-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.5fr);
  gap: 24px;
  padding: 22px;
}

.master-source-layout .helper-text,
.master-source-layout .storage-summary,
.master-source-layout .stacked-actions {
  margin: 0;
}

.master-source-layout .storage-summary {
  margin-top: 15px;
}

.master-helper code {
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-size: 11px;
}

.master-actions {
  align-content: start;
}

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

@media (max-width: 920px) {
  .master-source-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .grid-4,
  .order-calculation-preview {
    grid-template-columns: 1fr;
  }

  .order-filters,
  .order-filters .compact-field,
  .order-search-field,
  .order-filters .button {
    width: 100%;
    min-width: 0;
  }
}

.startup-error {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: #f7f2e8;
}

.startup-error .panel {
  width: min(620px, 100%);
}

.startup-error pre {
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: 12px;
  background: #173a2b;
  color: #fff;
}

.sidebar-logout {
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  text-align: center;
}

.sidebar-logout:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(215, 155, 62, 0.15), transparent 34%),
    radial-gradient(circle at bottom right, rgba(53, 95, 74, 0.16), transparent 38%),
    var(--bg);
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 24px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.login-brand h1 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 27px;
}

.login-brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.login-card h2 {
  margin: 6px 0 8px;
  font-family: "Playfair Display", serif;
  font-size: 30px;
}

.login-form {
  display: grid;
  gap: 15px;
}

.login-form .field {
  display: grid;
  gap: 7px;
}

.login-form .field > span {
  font-size: 12px;
  font-weight: 700;
}

.login-error {
  min-height: 18px;
  margin: -2px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.login-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

/* =========================================================
   Ringkasan topbar dan kebutuhan belanja
   ========================================================= */
.section-description {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.topbar-summary {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.topbar-date,
.topbar-kpi {
  min-width: 112px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.78);
}

.topbar-date {
  min-width: 126px;
}

.topbar-date span,
.topbar-kpi span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-date strong,
.topbar-kpi strong {
  font-size: 12px;
  white-space: nowrap;
}

#page-shopping .panel + .panel,
.shopping-stat-grid,
.shopping-source-panel,
.shopping-note {
  margin-top: 18px;
}

.shopping-filter-panel {
  padding: 18px 20px;
}

.shopping-filter-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 0.8fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 14px;
}

.shopping-filter-action {
  display: flex;
  align-items: flex-end;
  padding-bottom: 1px;
}

.shopping-menu-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px;
}

.shopping-menu-chip {
  min-width: 170px;
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.shopping-menu-chip.has-warning {
  border-color: #ebcf9d;
  background: var(--warning-soft);
}

.shopping-menu-chip span,
.shopping-menu-chip small {
  color: var(--muted);
  font-size: 10px;
}

.shopping-menu-chip strong {
  font-size: 15px;
}

.shopping-warning {
  flex-basis: 100%;
  padding: 12px 14px;
  border: 1px solid #ebcf9d;
  border-radius: 11px;
  color: #7a561b;
  background: var(--warning-soft);
  font-size: 11px;
  line-height: 1.55;
}

.shopping-formula-note {
  margin: 0 20px 14px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-size: 11px;
  line-height: 1.55;
}

.shopping-pack-cell {
  min-width: 165px;
}

.shopping-pack-cell strong,
.shopping-pack-cell small {
  display: block;
}

.shopping-pack-cell small {
  margin-top: 3px;
}

.shopping-note {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 18px 20px;
}

.shopping-note p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.shopping-empty {
  width: 100%;
  padding: 20px;
}

.shopping-empty .button {
  margin-top: 12px;
}

@media (max-width: 1180px) {
  .topbar-date {
    display: none;
  }

  .shopping-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .topbar-summary {
    margin-left: auto;
  }

  .topbar-kpi {
    min-width: 94px;
    padding-inline: 9px;
  }

  .topbar-kpi span {
    font-size: 8px;
  }

  .shopping-filter-grid {
    grid-template-columns: 1fr;
  }

  .shopping-filter-action,
  .shopping-filter-action .button {
    width: 100%;
  }

  .shopping-menu-chip {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .topbar-summary .topbar-kpi:last-child {
    display: none;
  }
}

@media print {
  body.printing-shopping {
    background: #fff;
  }

  body.printing-shopping .sidebar,
  body.printing-shopping .topbar,
  body.printing-shopping .shopping-toolbar .toolbar-actions,
  body.printing-shopping .shopping-filter-panel,
  body.printing-shopping .shopping-note,
  body.printing-shopping .toast-container {
    display: none !important;
  }

  body.printing-shopping .app-shell {
    display: block;
  }

  body.printing-shopping .content-area {
    padding: 0;
  }

  body.printing-shopping .page {
    display: none !important;
  }

  body.printing-shopping #page-shopping {
    display: block !important;
  }

  body.printing-shopping #page-shopping .panel,
  body.printing-shopping #page-shopping .mini-stat {
    break-inside: avoid;
    box-shadow: none;
  }

  body.printing-shopping .table-wrap {
    overflow: visible;
  }

  body.printing-shopping .extra-wide-table table {
    min-width: 0;
    width: 100%;
    font-size: 9px;
  }

  body.printing-shopping .shopping-formula-note {
    margin-inline: 0;
  }
}
