/*
 * TakarLaba v0.3 - Kawan Kuliner
 * Design Read: Alat hitung dapur & tiket hitungan kuliner hangat (terakota, hijau daun tua, kertas hangat, kunyit)
 * Dial: ENERGY 2 / RHYTHM 2 / MOTION 1
 * Palet resmi terverifikasi WCAG AA (Light & Dark)
 */

:root,
[data-theme="light"] {
  --bg: #FFF8EC;
  --surface: #FFFFFF;
  --surface-soft: #F7EFE0;
  --ink: #174C3C;
  --ink-muted: #43594F;
  --primary-bg: #174C3C;
  --primary-bg-hover: #103A2D;
  --primary-ink: #FFF8EC;
  --accent: #A33F2B;
  --accent-hover: #863120;
  --accent-soft: #FCEEEB;
  --accent-text: #8E3321;
  --warn-bg: #E9B949;
  --warn-soft: #FBF1D2;
  --warn-ink: #174C3C;
  --ok-bg: #E6F1EC;
  --ok-text: #174C3C;
  --border: #E5DAC6;
  --border-strong: #C9BBA2;
  --shadow: 0 2px 10px rgba(23, 76, 60, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --font-heading: "Plus Jakarta Sans", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #141A17;
  --surface: #1D2622;
  --surface-soft: #25312C;
  --ink: #FFF8EC;
  --ink-muted: #BDD0C6;
  --primary-bg: #78D6B4;
  --primary-bg-hover: #62C4A1;
  --primary-ink: #0E2921;
  --accent: #E27A64;
  --accent-hover: #ED8F7B;
  --accent-soft: #3B1A14;
  --accent-text: #FFB3A3;
  --warn-bg: #E9B949;
  --warn-soft: #3A311A;
  --warn-ink: #174C3C;
  --ok-bg: #133027;
  --ok-text: #8AE0C0;
  --border: #2F3E37;
  --border-strong: #465B51;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}

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

[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, .brand-name, .highlight-value {
  font-family: var(--font-heading);
  margin: 0;
  line-height: 1.25;
}

p {
  margin: 0;
}

button,
input,
select {
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
}

button,
.file-btn {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.num {
  font-variant-numeric: tabular-nums;
}

.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;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary-bg);
  color: var(--primary-ink);
  padding: 0.75rem 1rem;
  z-index: 1000;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
  border-radius: var(--radius-sm);
}

/* LAYOUT SHELL */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.brand-icon {
  border-radius: 9px;
  flex-shrink: 0;
  display: block;
}

.brand-text {
  min-width: 0;
}

.brand-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.brand-by {
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.brand-tagline {
  font-size: 0.82rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
}

.pill-warn {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-color: transparent;
}

.app-body {
  display: flex;
  flex: 1;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

/* SIDE NAV (DESKTOP) */
.side-nav {
  display: none;
  width: 224px;
  flex-shrink: 0;
  padding: 1.25rem 0.75rem;
  border-right: 1px solid var(--border);
  background: var(--bg);
  flex-direction: column;
  gap: 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  font-weight: 600;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--primary-bg);
  color: var(--primary-ink);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 1rem 1rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.notice-banner {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.notice-text {
  font-size: 0.9rem;
  color: var(--ink);
  flex: 1 1 260px;
}

.notice-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 0.25rem;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.page-subtitle {
  font-size: 0.94rem;
  color: var(--ink-muted);
  margin-top: 0.25rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* CARDS & GRIDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.card-promo {
  border-top: 3px solid var(--accent);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.sub-heading {
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 0.4rem;
}

.card-hint {
  font-size: 0.86rem;
  color: var(--ink-muted);
}

.card-header-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.recipe-switcher-bar {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
}

.switcher-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.resep-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.resep-editor-col,
.pro-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.resep-ticket-col {
  min-width: 0;
}

.two-col-equal {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

/* TICKET CARD (RINGKASAN HITUNGAN) */
.ticket-card {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ticket-top {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ticket-kicker {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  font-weight: 700;
}

.ticket-note {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.verdict-pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.92rem;
}

.verdict-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.verdict-warn {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.verdict-bad {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.ticket-cost-breakdown {
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ticket-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
}

.ticket-divider {
  border-top: 1px dashed var(--border-strong);
  margin: 0.25rem 0;
}

.ticket-row-total {
  font-size: 1rem;
  font-weight: 700;
}

.ticket-pricing-box,
.ticket-ojol-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.ticket-subtitle {
  font-size: 0.96rem;
  font-weight: 700;
}

.ticket-highlight {
  background: var(--primary-bg);
  color: var(--primary-ink);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.highlight-label {
  display: block;
  font-size: 0.78rem;
  opacity: 0.9;
}

.highlight-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.highlight-sub {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

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

.ojol-summary {
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* FORMS & CONTROLS */
.form-grid-2,
.form-grid-3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
}

.field-grow {
  flex: 1 1 200px;
}

.field-qty {
  flex: 0 1 130px;
}

.field-submit {
  justify-content: flex-end;
}

.field-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}

.input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease;
}

input.input {
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"].input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: left;
  line-height: 1.4;
}

input[type="date"].input::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
}

.input:focus {
  border-color: var(--accent);
}

.inline-add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
}

.ingredient-add-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-items: end;
}

.inline-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 0.4rem 0;
}

.checkbox-row input {
  width: 20px;
  height: 20px;
  margin-top: 0.15rem;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.range-input {
  width: 100%;
  min-height: 36px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-error {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
}

.form-success {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ok-text);
  background: var(--ok-bg);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn-compact {
  min-height: 40px;
  padding: 0.45rem 0.8rem;
  font-size: 0.86rem;
}

.btn-full {
  width: 100%;
  white-space: normal;
  text-align: center;
}

.btn-primary {
  background: var(--primary-bg);
  color: var(--primary-ink);
}

.btn-primary:hover {
  background: var(--primary-bg-hover);
}

.btn-secondary {
  background: var(--surface-soft);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-soft);
}

.btn-danger {
  background: var(--accent);
  color: #FFF8EC;
}

.btn-danger:hover {
  background: var(--accent-hover);
}

.btn-danger-ghost {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: transparent;
}

.btn-danger-ghost:hover {
  border-color: var(--accent);
}

/* SEGMENTED CONTROL */
.segmented {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.segmented-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
  min-height: 40px;
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.86rem;
}

.segmented-btn.is-active {
  background: var(--primary-bg);
  color: var(--primary-ink);
}

/* LISTS & TABLES */
.item-list,
.ingredient-list,
.shopping-menu-rows,
.impact-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.item-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.item-main {
  flex: 1 1 180px;
  min-width: 0;
}

.item-name {
  font-weight: 700;
  font-size: 0.94rem;
}

.item-meta {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.item-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.input-inline {
  width: 96px;
  min-height: 40px;
  padding: 0.35rem 0.55rem;
}

.input-price-inline {
  width: 118px;
  min-height: 40px;
  padding: 0.35rem 0.55rem;
}

.item-cost {
  font-weight: 700;
  min-width: 82px;
  text-align: right;
}

/* SUBBOXES & STATS */
.verdict-subbox {
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
}

.stat-tile {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.stat-tile span {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.stat-tile strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.summary-banner {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.95rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem;
}

/* PRESETS, PRO, GUIDES */
.preset-grid,
.guide-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.preset-card,
.guide-item {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.preset-card p,
.guide-item p {
  font-size: 0.88rem;
  color: var(--ink-muted);
  flex: 1;
}

.preset-tag {
  align-self: flex-start;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok-text);
}

.pro-toggle-box {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pro-upsell-card {
  border: 2px solid var(--warn-bg);
}

.radar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem;
}

.field-slider {
  flex: 1 1 200px;
}

.quick-pct-row {
  display: flex;
  gap: 0.4rem;
}

.impact-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.impact-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.impact-suggestion {
  font-size: 0.86rem;
  color: var(--ink);
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0.7rem;
  border-radius: 4px;
}

/* QUOTE & KITCHEN SHEET */
.quote-sheet,
.kitchen-sheet,
.shopping-output {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 0.65rem;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.sheet-table th,
.sheet-table td {
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.sheet-table th.align-right,
.sheet-table td.align-right {
  text-align: right;
}

.sheet-totals {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-top: 2px solid var(--border-strong);
  padding-top: 0.6rem;
}

.empty-card {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 2rem 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.stack-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.clean-list,
.clean-ol {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.92rem;
}

.search-wrap {
  min-width: 180px;
  flex: 0 1 240px;
}

/* FOOTER */
.app-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

/* MOBILE BOTTOM NAV */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--border-strong);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 0.25rem 0.2rem calc(0.25rem + env(safe-area-inset-bottom, 0px));
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  min-height: 52px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 8px;
}

.bottom-nav-item.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

[data-theme="dark"] .bottom-nav-item.is-active {
  color: var(--accent-text);
}

/* OPSI C: SEMBUNYIKAN TAB PRO UNTUK PAKET UTAMA (4 TAB BERSIH) */
body[data-tier="utama"] .nav-item[data-tab="pro"],
body[data-tier="utama"] .bottom-nav-item[data-tab="pro"] {
  display: none !important;
}

body[data-tier="utama"] .bottom-nav {
  grid-template-columns: repeat(4, 1fr);
}

/* DIALOGS & TOAST */
.modal-dialog {
  width: min(520px, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 1.25rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.modal-wide {
  width: min(720px, calc(100vw - 1.5rem));
}

.modal-dialog::backdrop {
  background: rgba(16, 26, 22, 0.55);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.modal-body-text {
  font-size: 0.94rem;
  margin-bottom: 1.1rem;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.gate-footnote {
  margin-top: 0.85rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 4.5rem;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--primary-bg);
  color: var(--primary-ink);
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  max-width: calc(100vw - 2rem);
  text-align: center;
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 520px) {
  #preset-badge {
    display: none;
  }
  .theme-label {
    display: none;
  }
}

@media (min-width: 640px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .field-span-2 {
    grid-column: span 2;
  }
  .preset-grid,
  .guide-grid,
  .two-col-equal {
    grid-template-columns: repeat(2, 1fr);
  }
  .ingredient-add-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 840px) {
  .form-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .ingredient-add-grid {
    grid-template-columns: 1.8fr 1fr 0.8fr 0.9fr 1.05fr auto;
  }
  .side-nav {
    display: flex;
  }
  .bottom-nav {
    display: none;
  }
  .main-content {
    padding: 1.5rem 1.75rem 2.5rem;
  }
  .resep-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  }
  .resep-ticket-col {
    position: sticky;
    top: 4.9rem;
  }
  .toast {
    bottom: 1.5rem;
  }
}

/* PRINT STYLES (DUAL MODE: PENAWARAN PDF, DAFTAR BELANJA, ATAU KARTU RESEP DAPUR TANPA HARGA) */
@media print {
  body {
    background: #FFFFFF !important;
    color: #111111 !important;
  }

  .topbar,
  .side-nav,
  .bottom-nav,
  .notice-banner,
  .app-footer,
  .toast,
  .btn,
  .segmented,
  .modal-header,
  .modal-footer,
  .field-group {
    display: none !important;
  }

  .app-shell,
  .app-body,
  .main-content {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  /* Default mode: quote */
  body[data-print-mode="quote"] .tab-panel,
  body[data-print-mode="quote"] #subpanel-daftar-belanja,
  body[data-print-mode="quote"] #subpanel-nota-pdf > .card:first-child,
  body[data-print-mode="quote"] dialog {
    display: none !important;
  }
  body[data-print-mode="quote"] #panel-belanja,
  body[data-print-mode="quote"] #subpanel-nota-pdf,
  body[data-print-mode="quote"] #subpanel-nota-pdf > .card:last-child {
    display: block !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  /* Shopping list print mode */
  body[data-print-mode="shopping"] .tab-panel,
  body[data-print-mode="shopping"] #subpanel-nota-pdf,
  body[data-print-mode="shopping"] #subpanel-daftar-belanja > .card:first-child,
  body[data-print-mode="shopping"] dialog {
    display: none !important;
  }
  body[data-print-mode="shopping"] #panel-belanja,
  body[data-print-mode="shopping"] #subpanel-daftar-belanja,
  body[data-print-mode="shopping"] #subpanel-daftar-belanja > .card:last-child {
    display: block !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  /* Kitchen recipe card print mode (ZERO RUPIAH) */
  body[data-print-mode="kitchen-card"] .app-shell {
    display: none !important;
  }
  body[data-print-mode="kitchen-card"] #kitchen-card-dialog {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #FFFFFF !important;
    color: #111111 !important;
  }
  body[data-print-mode="kitchen-card"] .kitchen-sheet {
    border: 1px solid #222222 !important;
    padding: 1rem !important;
  }
}
