/* ==========================================================================
   BUJETIN — THE MODERN RECEIPT & DELI LABEL DESIGN SYSTEM (MOBILE-FIRST APP)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* --- 1. SURFACE & PAPER PALETTE --- */
  --bg-canvas: #EAE6DC;          /* Kraft Table Backing */
  --bg-receipt: #FAF8F3;         /* Warm Receipt Paper */
  --bg-receipt-muted: #EFECE4;   /* Zebra / Footer Receipt */
  --bg-receipt-highlight: #FFFDF9;
  --bg-dark-display: #1A1917;    /* Thermal Counter Header */

  /* --- 2. THERMAL INK & TYPOGRAPHY --- */
  --ink-primary: #1A1917;        /* Charcoal Thermal Ink */
  --ink-secondary: #5C5852;      /* Carbon Copy Grey */
  --ink-muted: #8C867B;
  --ink-on-dark: #FAF8F3;

  /* --- 3. SEMANTIC ANTI-GELAP-MATA ACCENTS --- */
  --green-produce: #266838;
  --green-produce-bg: #E3F1E6;
  --amber-sticker: #E8A838;
  --amber-sticker-bg: #FDF3DC;
  --amber-sticker-ink: #1F1504;
  --red-stamp: #D63629;
  --red-stamp-bg: #FCE8E6;
  --blue-frozen: #28598A;
  --blue-frozen-bg: #E5EFF8;

  /* --- 4. BORDERS & TACTILE SHADOWS --- */
  --border-ink: 1.5px solid var(--ink-primary);
  --border-ink-heavy: 2px solid var(--ink-primary);
  --border-subtle: 1px solid #D5D0C5;
  --border-dashed: 1.5px dashed #A8A296;
  --border-double: 4px double var(--ink-primary);

  --shadow-tactile-sm: 2px 2px 0px var(--ink-primary);
  --shadow-tactile: 3px 3px 0px var(--ink-primary);
  --shadow-tactile-lg: 5px 5px 0px var(--ink-primary);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --radius-sharp: 3px;
  --target-size: 36px;
}

@media (pointer: coarse) {
  :root {
    --target-size: 44px;
  }
}

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

html {
  scroll-padding-top: calc(9.5rem + env(safe-area-inset-top, 0px));
  scroll-padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

body {
  margin: 0;
  background-color: var(--bg-canvas);
  background-image: radial-gradient(#D2CCC0 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--ink-primary);
  font-family: var(--font-sans);
  line-height: 1.45;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  padding-block-end: calc(5.25rem + env(safe-area-inset-bottom, 0px));
}

img, svg {
  max-inline-size: 100%;
  block-size: auto;
}

:where(a, code) {
  overflow-wrap: anywhere;
}

h1, h2, h3 {
  text-wrap: balance;
  margin-block: 0;
  letter-spacing: -0.02em;
}

p, li {
  text-wrap: pretty;
}

.font-mono-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

:where(button, select, textarea, input:not([type="checkbox"], [type="radio"]), [role="button"], nav a, label:has(input[type="checkbox"], input[type="radio"])) {
  min-block-size: var(--target-size);
  min-inline-size: var(--target-size);
}

:where([role="button"], nav a, label:has(input[type="checkbox"], input[type="radio"])) {
  display: inline-flex;
  align-items: center;
}

/* ==========================================================================
   LICENSE GATE OVERLAY (LAYAR KODE AKSES PIN 1000 PEMBELI)
   ========================================================================== */
.license-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: var(--bg-canvas);
  background-image: radial-gradient(#CFC8B8 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow-y: auto;
}

.license-gate[hidden] {
  display: none;
}

.license-ticket {
  background: var(--bg-receipt);
  border: var(--border-ink-heavy);
  box-shadow: 7px 7px 0px var(--ink-primary);
  max-inline-size: 460px;
  inline-size: 100%;
  padding: 1.75rem 1.5rem;
  position: relative;
  border-radius: var(--radius-sharp);
}

.license-input {
  inline-size: 100%;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.75rem;
  border: var(--border-ink-heavy);
  background: var(--bg-receipt-highlight);
  color: var(--ink-primary);
  border-radius: var(--radius-sharp);
  box-shadow: inset 2px 2px 0 rgba(26, 25, 23, 0.08);
}

.license-input:focus {
  outline: none;
  background: #FFFFFF;
  box-shadow: var(--shadow-tactile);
}

/* ==========================================================================
   STICKY APP HEADER + REAL-TIME BUDGET GUARD METER
   ========================================================================== */
.app-sticky-top {
  position: sticky;
  inset-block-start: 0;
  z-index: 60;
  padding-block-start: env(safe-area-inset-top, 0px);
  background: var(--bg-dark-display);
  color: var(--ink-on-dark);
  border-block-end: var(--border-ink-heavy);
  box-shadow: 0 4px 12px rgba(26, 25, 23, 0.18);
  transition: background-color 0.25s ease;
}

.app-sticky-top[data-state="warning"] {
  background: #2C2007;
  border-block-end-color: var(--amber-sticker);
}

.app-sticky-top[data-state="danger"] {
  background: #3B0F0B;
  border-block-end-color: var(--red-stamp);
}

.app-top-inner {
  max-inline-size: 860px;
  margin-inline: auto;
  padding: 0.65rem max(1rem, env(safe-area-inset-left, 0px));
}

.app-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-block-end: 0.45rem;
}

.app-logo-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--amber-sticker);
  color: var(--amber-sticker-ink);
  padding: 0.18rem 0.55rem;
  border: 1.5px solid #000;
  border-radius: var(--radius-sharp);
  box-shadow: 2px 2px 0 #000;
}

.budget-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.budget-main-amount {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: clamp(1.3rem, 4vw, 1.7rem);
  line-height: 1.1;
}

.budget-limit-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px dashed rgba(255, 255, 255, 0.45);
  color: var(--ink-on-dark);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sharp);
  cursor: pointer;
  min-block-size: 32px;
}

.budget-limit-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.budget-meter-bar {
  block-size: 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  margin-block: 0.45rem 0.35rem;
  overflow: hidden;
  border-radius: 1px;
}

.budget-meter-fill {
  block-size: 100%;
  background-color: #46B866;
  transition: inline-size 0.25s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0.2) 5px,
    transparent 5px,
    transparent 10px
  );
}

.app-sticky-top[data-state="warning"] .budget-meter-fill {
  background-color: var(--amber-sticker);
}

.app-sticky-top[data-state="danger"] .budget-meter-fill {
  background-color: var(--red-stamp);
}

.budget-micro-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  opacity: 0.92;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   MAIN CONTENT SHELL
   ========================================================================== */
.app-shell {
  max-inline-size: 860px;
  margin-inline: auto;
  padding: 1.15rem max(0.85rem, env(safe-area-inset-left, 0px)) 2.5rem;
}

.receipt-sheet {
  background: var(--bg-receipt);
  border: var(--border-ink-heavy);
  box-shadow: var(--shadow-tactile-lg);
  padding: 1.25rem;
  border-radius: var(--radius-sharp);
  position: relative;
}

.receipt-perforated-top {
  margin-block-start: 10px;
}

.receipt-perforated-top::before {
  content: "";
  position: absolute;
  inset-block-start: -10px;
  inset-inline: -2px;
  block-size: 10px;
  background-image: linear-gradient(135deg, transparent 48%, var(--ink-primary) 49%, var(--bg-receipt) 51%),
                    linear-gradient(225deg, transparent 48%, var(--ink-primary) 49%, var(--bg-receipt) 51%);
  background-size: 16px 10px;
  background-repeat: repeat-x;
}

.receipt-divider {
  border: 0;
  border-block-start: var(--border-dashed);
  margin-block: 1rem;
}

.receipt-divider-double {
  border: 0;
  border-block-start: var(--border-double);
  margin-block: 1rem;
}

/* ==========================================================================
   BOTTOM MOBILE NAVIGATION BAR (ONE-THUMB NATIVE APP FEEL)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 80;
  background: var(--bg-receipt);
  border-block-start: var(--border-ink-heavy);
  box-shadow: 0 -4px 12px rgba(26, 25, 23, 0.08);
  padding-block-end: env(safe-area-inset-bottom, 0px);
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
}

.bottom-nav-inner {
  max-inline-size: 860px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.bottom-tab-btn {
  position: relative;
  border: 0;
  border-inline-end: var(--border-subtle);
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.55rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  cursor: pointer;
  min-block-size: 56px;
  transition: background-color 0.12s;
}

.bottom-tab-btn:last-child {
  border-inline-end: 0;
}

.bottom-tab-btn:hover {
  background: var(--bg-receipt-muted);
  color: var(--ink-primary);
}

.bottom-tab-btn[aria-selected="true"] {
  background: var(--amber-sticker-bg);
  color: var(--ink-primary);
  font-weight: 800;
}

/* Shape indicator per Modern Web Guidance */
.bottom-tab-btn[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  border-block-start: 4px solid var(--ink-primary);
}

.tab-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.tab-badge-pill {
  position: absolute;
  inset-block-start: 4px;
  inset-inline-end: calc(50% - 26px);
  background: var(--green-produce);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--ink-primary);
}

/* ==========================================================================
   BUTTONS, BADGES & INPUTS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.86rem;
  padding: 0.55rem 0.95rem;
  border: var(--border-ink);
  border-radius: var(--radius-sharp);
  background: var(--bg-receipt);
  color: var(--ink-primary);
  box-shadow: var(--shadow-tactile);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.12s ease;
  user-select: none;
  text-decoration: none;
}

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

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px var(--ink-primary);
}

.btn-primary {
  background: var(--ink-primary);
  color: var(--bg-receipt);
}
.btn-primary:hover { background: #2D2B28; }

.btn-amber {
  background: var(--amber-sticker);
  color: var(--amber-sticker-ink);
}
.btn-amber:hover { background: #DF9E2C; }

.btn-green {
  background: var(--green-produce);
  color: #FFFFFF;
}
.btn-green:hover { background: #1E542D; }

.btn-danger {
  background: var(--red-stamp);
  color: #FFFFFF;
}
.btn-danger:hover { background: #B82B1F; }

.btn-sm {
  font-size: 0.76rem;
  padding: 0.35rem 0.65rem;
  box-shadow: var(--shadow-tactile-sm);
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.16rem 0.48rem;
  border: 1.5px solid var(--ink-primary);
  border-radius: var(--radius-sharp);
}

.badge-price-sticker {
  background: var(--amber-sticker);
  color: var(--amber-sticker-ink);
  box-shadow: 1.5px 1.5px 0 var(--ink-primary);
}

.badge-produce {
  background: var(--green-produce-bg);
  color: var(--green-produce);
  border-color: var(--green-produce);
}

.badge-frozen {
  background: var(--blue-frozen-bg);
  color: var(--blue-frozen);
  border-color: var(--blue-frozen);
}

.stamp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--red-stamp);
  background: var(--red-stamp-bg);
  border: 1.5px solid var(--red-stamp);
  padding: 0.14rem 0.45rem;
  border-radius: var(--radius-sharp);
  transform: rotate(-1deg);
}

/* Inputs */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-secondary);
}

.input-receipt {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-primary);
  background: var(--bg-receipt-highlight);
  border: var(--border-ink);
  border-radius: var(--radius-sharp);
  padding: 0.55rem 0.7rem;
  inline-size: 100%;
}

.input-receipt:focus {
  outline: none;
  background: #FFFFFF;
  box-shadow: var(--shadow-tactile-sm);
}

.input-currency-wrap {
  display: flex;
  align-items: stretch;
  border: var(--border-ink);
  border-radius: var(--radius-sharp);
  background: var(--bg-receipt-highlight);
  overflow: hidden;
}

.input-currency-wrap:focus-within {
  box-shadow: var(--shadow-tactile-sm);
  background: #FFFFFF;
}

.input-currency-prefix {
  background: var(--bg-receipt-muted);
  border-inline-end: var(--border-ink);
  padding-inline: 0.6rem;
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.82rem;
}

.input-currency-field {
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.55rem 0.65rem;
  inline-size: 100%;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

.input-currency-field:focus {
  outline: none;
}

/* ==========================================================================
   GROCERY ITEM LIST & IN-STORE ONE-THUMB ROWS
   ========================================================================== */
.grocery-list-wrap {
  container: grocerylist / inline-size;
}

.grocery-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.6rem;
  border-block-end: var(--border-dashed);
  transition: background-color 0.12s ease;
}

.grocery-row:hover {
  background: var(--bg-receipt-muted);
}

.grocery-row[data-checked="true"] {
  background: rgba(38, 104, 56, 0.06);
}

.grocery-row[data-checked="true"] .item-title-text {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  color: var(--ink-secondary);
}

.grocery-row[data-impulse="true"] {
  background: rgba(214, 54, 41, 0.05);
}

.receipt-check-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 44px;
  min-block-size: 44px;
}

.receipt-check-input {
  appearance: none;
  margin: 0;
  inline-size: 28px;
  block-size: 28px;
  border: 2px solid var(--ink-primary);
  background: var(--bg-receipt-highlight);
  box-shadow: 2px 2px 0 var(--ink-primary);
  border-radius: var(--radius-sharp);
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: all 0.1s ease;
}

.receipt-check-input::before {
  content: "✓";
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--bg-receipt);
  transform: scale(0);
  transition: transform 0.1s ease-in-out;
}

.receipt-check-input:checked {
  background: var(--green-produce);
}

.receipt-check-input:checked::before {
  transform: scale(1);
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: var(--border-ink);
  background: var(--bg-receipt);
  box-shadow: var(--shadow-tactile-sm);
  border-radius: var(--radius-sharp);
}

.qty-btn {
  border: 0;
  background: var(--bg-receipt-muted);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1rem;
  min-inline-size: 36px;
  min-block-size: 36px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:hover {
  background: var(--amber-sticker);
}

.qty-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.88rem;
  min-inline-size: 34px;
  text-align: center;
  padding-inline: 0.25rem;
  border-inline: var(--border-ink);
  font-variant-numeric: tabular-nums;
}

.item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

@container grocerylist (inline-size < 520px) {
  .grocery-row {
    grid-template-columns: auto 1fr;
  }
  .item-actions {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding-inline-start: 3.1rem;
    padding-block-start: 0.2rem;
  }
}

/* Filter Pill Scroller */
.filter-pills {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-block-end: 0.35rem;
  margin-block-end: 0.75rem;
}

.filter-pill {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border: var(--border-ink);
  background: var(--bg-receipt);
  color: var(--ink-secondary);
  border-radius: var(--radius-sharp);
  cursor: pointer;
}

.filter-pill[aria-pressed="true"] {
  background: var(--ink-primary);
  color: var(--bg-receipt);
  box-shadow: var(--shadow-tactile-sm);
}

/* ==========================================================================
   REPORT TABLE & CHARTS (CONTAINER QUERY RESPONSIVE TABLE)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 0.85rem;
  margin-block-end: 1.25rem;
}

.kpi-card {
  background: var(--bg-receipt);
  border: var(--border-ink);
  box-shadow: var(--shadow-tactile);
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sharp);
}

.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(520px, 80vh);
  container-type: inline-size;
  border: var(--border-ink);
  background: var(--bg-receipt);
  box-shadow: var(--shadow-tactile);
}

.receipt-table {
  inline-size: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
  --label-1: "Sesi / Bulan";
  --label-2: "Target Budget";
  --label-3: "Total Belanja";
  --label-4: "Bocor Impulsif";
  --label-5: "Status";
  --label-6: "Aksi";
}

.receipt-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: var(--ink-primary);
  color: var(--bg-receipt);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  text-transform: uppercase;
}

.receipt-table th,
.receipt-table td {
  padding: 0.75rem 0.85rem;
  text-align: start;
  border-block-end: var(--border-dashed);
}

.receipt-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--bg-receipt);
  font-family: var(--font-mono);
  font-weight: 700;
  border-inline-end: var(--border-subtle);
}

@container (width < 600px) {
  .receipt-table,
  .receipt-table caption,
  .receipt-table thead,
  .receipt-table tbody,
  .receipt-table tr,
  .receipt-table th,
  .receipt-table td {
    display: block;
    inline-size: 100%;
  }

  .receipt-table thead {
    display: none;
  }

  .receipt-table tr {
    margin: 0.65rem;
    border: var(--border-ink);
    background: var(--bg-receipt);
    box-shadow: var(--shadow-tactile-sm);
  }

  .receipt-table tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: var(--bg-receipt-muted);
    border-block-end: var(--border-ink);
  }

  .receipt-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }

  .receipt-table td:not([colspan]):nth-child(2)::before {
    content: var(--label-2) ": ";
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink-secondary);
  }
  .receipt-table td:not([colspan]):nth-child(3)::before {
    content: var(--label-3) ": ";
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink-secondary);
  }
  .receipt-table td:not([colspan]):nth-child(4)::before {
    content: var(--label-4) ": ";
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink-secondary);
  }
  .receipt-table td:not([colspan]):nth-child(5)::before {
    content: var(--label-5) ": ";
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink-secondary);
  }
  .receipt-table td:not([colspan]):nth-child(6)::before {
    content: var(--label-6) ": ";
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink-secondary);
  }
}

/* ==========================================================================
   MODALS & TOASTS
   ========================================================================== */
dialog.receipt-dialog {
  background: var(--bg-receipt);
  color: var(--ink-primary);
  border: var(--border-ink-heavy);
  box-shadow: 7px 7px 0px var(--ink-primary);
  padding: 0;
  max-inline-size: min(460px, 92vw);
  inline-size: 100%;
  border-radius: var(--radius-sharp);
}

dialog.receipt-dialog:modal {
  overscroll-behavior: contain;
}

dialog.receipt-dialog::backdrop {
  background-color: rgba(26, 25, 23, 0.65);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.barcode-strip {
  block-size: 32px;
  inline-size: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--ink-primary) 0px,
    var(--ink-primary) 2px,
    transparent 2px,
    transparent 5px,
    var(--ink-primary) 5px,
    var(--ink-primary) 8px,
    transparent 8px,
    transparent 11px,
    var(--ink-primary) 11px,
    var(--ink-primary) 13px,
    transparent 13px,
    transparent 16px
  );
  opacity: 0.85;
}

.receipt-toast {
  position: fixed;
  inset-block-end: calc(4.75rem + env(safe-area-inset-bottom, 0px));
  inset-inline-end: max(1rem, env(safe-area-inset-right, 0px));
  inset-inline-start: max(1rem, env(safe-area-inset-left, 0px));
  max-inline-size: 400px;
  margin-inline: auto;
  z-index: 150;
  background: var(--ink-primary);
  color: var(--bg-receipt);
  border: 2px solid var(--amber-sticker);
  box-shadow: var(--shadow-tactile);
  padding: 0.65rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(1rem);
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.18s;
}

.receipt-toast[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ==========================================================================
   TEACHING BUBBLE / INTERACTIVE ONBOARDING TOUR
   ========================================================================== */
.tour-layer {
  position: fixed;
  inset: 0;
  z-index: 190;
  pointer-events: auto;
}

.tour-layer[hidden] {
  display: none;
}

.tour-spotlight {
  position: fixed;
  z-index: 191;
  border: 2.5px solid var(--amber-sticker);
  border-radius: 4px;
  /* Spotlight cutout using massive box-shadow */
  box-shadow: 0 0 0 9999px rgba(26, 25, 23, 0.68), 0 0 0 5px rgba(232, 168, 56, 0.35);
  pointer-events: none;
  transition: top 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              left 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.teaching-bubble {
  position: fixed;
  z-index: 192;
  inline-size: min(350px, calc(100vw - 24px));
  background: var(--amber-sticker);
  color: var(--amber-sticker-ink);
  border: 2px solid var(--ink-primary);
  box-shadow: 6px 6px 0px var(--ink-primary);
  border-radius: var(--radius-sharp);
  transition: top 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              left 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Pointer Triangle Arrow */
.teaching-bubble-arrow {
  position: absolute;
  inline-size: 14px;
  block-size: 14px;
  background: var(--amber-sticker);
  transform: rotate(45deg);
}

.teaching-bubble[data-placement="bottom"] .teaching-bubble-arrow {
  inset-block-start: -8px;
  border-inline-start: 2px solid var(--ink-primary);
  border-block-start: 2px solid var(--ink-primary);
}

.teaching-bubble[data-placement="top"] .teaching-bubble-arrow {
  inset-block-end: -8px;
  border-inline-end: 2px solid var(--ink-primary);
  border-block-end: 2px solid var(--ink-primary);
}

.teaching-bubble-body {
  padding: 1.1rem 1.15rem 0.95rem;
  position: relative;
}

.teaching-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-block-end: 0.4rem;
}

.teaching-bubble-step-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--ink-primary);
  color: var(--bg-receipt);
  padding: 0.12rem 0.45rem;
  border-radius: 2px;
}

.teaching-bubble-close {
  border: 0;
  background: transparent;
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  min-inline-size: 28px;
  min-block-size: 28px;
  cursor: pointer;
  border-radius: 2px;
}

.teaching-bubble-close:hover {
  background: rgba(26, 25, 23, 0.12);
}

.teaching-bubble-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  color: var(--ink-primary);
}

.teaching-bubble-desc {
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0;
  color: #2A1F08;
  font-weight: 500;
}

.teaching-bubble-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.15rem;
  background: rgba(26, 25, 23, 0.08);
  border-block-start: 1.5px dashed rgba(26, 25, 23, 0.35);
}

.teaching-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.teaching-dot {
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: rgba(26, 25, 23, 0.28);
  border: 1px solid var(--ink-primary);
  transition: all 0.15s ease;
}

.teaching-dot[data-active="true"] {
  background: var(--ink-primary);
  inline-size: 18px;
  border-radius: 99px;
}

.teaching-nav-btns {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.teaching-nav-btn {
  border: 1.5px solid var(--ink-primary);
  background: var(--bg-receipt);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  min-block-size: 32px;
  min-inline-size: 32px;
  box-shadow: 2px 2px 0 var(--ink-primary);
  cursor: pointer;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.teaching-nav-btn:hover:not(:disabled) {
  background: var(--ink-primary);
  color: var(--bg-receipt);
}

.teaching-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.teaching-nav-btn-primary {
  background: var(--ink-primary);
  color: var(--bg-receipt);
}
.teaching-nav-btn-primary:hover:not(:disabled) {
  background: #33302C;
}
