/* ==========================================================
   Frigo • Design System
   Refined, Human-Crafted Mobile & Desktop Architecture
   ========================================================== */

:root {
  --bg-app: #080c14;
  --bg-surface: #0f1626;
  --bg-surface-raised: #151e32;
  --bg-element: #1a253c;
  --bg-element-hover: #222f4c;
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-accent: rgba(16, 185, 129, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-disabled: #475569;

  --accent: #10b981;
  --accent-hover: #059669;
  --accent-muted: rgba(16, 185, 129, 0.12);
  --accent-border: rgba(16, 185, 129, 0.3);

  --danger: #ef4444;
  --danger-muted: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.28);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Space Grotesk', ui-monospace, SFMono-Regular, monospace;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-sheet: 0 20px 48px rgba(0, 0, 0, 0.6);

  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-app: #f6f8fb;
  --bg-surface: #ffffff;
  --bg-surface-raised: #f1f5f9;
  --bg-element: #e9eff6;
  --bg-element-hover: #dbe4ef;
  
  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.14);
  --border-accent: rgba(16, 185, 129, 0.5);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-disabled: #cbd5e1;

  --accent-muted: rgba(16, 185, 129, 0.1);
  --danger-muted: rgba(239, 68, 68, 0.08);

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.07);
  --shadow-sheet: 0 20px 48px rgba(15, 23, 42, 0.15);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  position: relative;
}

.container {
  width: 100%;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 18px;
  padding-right: 18px;
}

/* ==========================================================
   Header Navbar
   ========================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 12, 20, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 0;
  transition: background var(--ease-in-out) 0.2s;
}

[data-theme="light"] .navbar {
  background: rgba(246, 248, 251, 0.88);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-badge-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: opacity 0.15s ease;
}

.brand-badge-btn:hover {
  opacity: 0.85;
}

.logo-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.logo-svg {
  width: 20px;
  height: 20px;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-label {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.chevron-sm {
  width: 12px;
  height: 12px;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}

.ping-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--accent);
  position: relative;
}

.ping-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: var(--radius-full);
  background: var(--accent);
  opacity: 0.4;
  animation: pingPulse 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes pingPulse {
  0% { transform: scale(0.8); opacity: 0.8; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

.live-caption {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.nav-btn:active {
  transform: scale(0.97);
}

.nav-btn-nfc {
  background: var(--accent-muted);
  border-color: var(--accent-border);
  color: var(--accent);
}

.nav-btn-nfc:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.nav-btn-square {
  padding: 8px;
}

.nav-icon {
  width: 16px;
  height: 16px;
}

/* Theme switch icons */
.theme-sun { display: none; }
.theme-moon { display: block; }
[data-theme="light"] .theme-sun { display: block; }
[data-theme="light"] .theme-moon { display: none; }

/* ==========================================================
   Main Shell
   ========================================================== */
.app-shell {
  padding-top: 18px;
  padding-bottom: 60px;
}

/* Overview Panel */
.overview-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.overview-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.overview-headline {
  display: flex;
  flex-direction: column;
}

.overview-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.overview-status {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.overview-counter {
  text-align: right;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.counter-number {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.counter-sub {
  font-size: 0.76rem;
  color: var(--text-tertiary);
}

.meter-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-element);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  margin-bottom: 14px;
}

.meter-value {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.35s var(--ease-spring);
}

/* Segmented controls */
.segment-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented-pills {
  display: inline-flex;
  background: var(--bg-element);
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.pill:hover {
  color: var(--text-primary);
}

.pill.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.pill-badge {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.8;
}

.group-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.group-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.group-btn.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: var(--accent-border);
}

.group-icon {
  width: 14px;
  height: 14px;
}

/* ==========================================================
   Composer Card (Add Item)
   ========================================================== */
.composer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}

.composer-primary-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-field-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-entry-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.composer-input {
  width: 100%;
  background: var(--bg-element);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 40px 11px 36px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  outline: none;
  transition: all 0.15s ease;
}

.composer-input:focus {
  border-color: var(--accent);
  background: var(--bg-surface-raised);
}

.composer-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

.mic-trigger {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mic-trigger:hover {
  color: var(--accent);
}

.mic-trigger.listening {
  color: #ffffff;
  background: var(--danger);
  animation: micBreathe 1s infinite alternate ease-in-out;
}

@keyframes micBreathe {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}

.mic-icon {
  width: 15px;
  height: 15px;
}

/* Stepper */
.stepper-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-element);
  border-radius: var(--radius-sm);
  height: 44px;
}

.stepper-btn {
  width: 32px;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s ease;
}

.stepper-btn:hover {
  background: var(--bg-element-hover);
  color: var(--text-primary);
}

.stepper-icon {
  width: 12px;
  height: 12px;
}

.stepper-display {
  width: 48px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.composer-submit {
  height: 44px;
  padding: 0 16px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.composer-submit:hover {
  background: var(--accent-hover);
}

.composer-submit:active {
  transform: scale(0.97);
}

.submit-svg {
  width: 15px;
  height: 15px;
}

/* Sub row */
.composer-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.category-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.custom-select-box {
  position: relative;
}

.select-elem {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-element);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 26px 5px 10px;
  border-radius: var(--radius-xs);
  outline: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.quick-units-group {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
}

.unit-tag {
  background: var(--bg-element);
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.12s ease;
}

.unit-tag:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Frequent items scroll */
.frequent-pills-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.frequent-caption {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.frequent-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.frequent-scroll::-webkit-scrollbar {
  display: none;
}

.frequent-pill {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.frequent-pill:hover {
  background: var(--bg-element);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ==========================================================
   Items Deck & Card Architecture
   ========================================================== */
.items-deck {
  margin-bottom: 24px;
}

.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.deck-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.deck-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.deck-badge {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.badge-green {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: var(--accent-border);
}

.items-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-shelf-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-top: 14px;
  margin-bottom: 4px;
  padding-left: 6px;
}

/* Item Card */
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.item-row:hover {
  background: var(--bg-surface-raised);
  border-color: var(--border-strong);
}

.item-row:active {
  transform: scale(0.99);
}

.item-tap-zone {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

/* Checkbox */
.item-check-pill {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-element);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s var(--ease-spring);
}

.item-check-pill svg {
  width: 14px;
  height: 14px;
  color: #ffffff;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.18s var(--ease-spring);
}

.item-row.is-done .item-check-pill {
  background: var(--accent);
  border-color: var(--accent);
}

.item-row.is-done .item-check-pill svg {
  opacity: 1;
  transform: scale(1);
}

.item-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.item-line-primary {
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.item-qty-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-element);
  color: var(--text-secondary);
}

.item-line-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.item-category-caption {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.item-time-caption {
  font-size: 0.68rem;
  color: var(--text-disabled);
}

/* Completed Row State */
.item-row.is-done {
  opacity: 0.55;
  background: rgba(15, 22, 38, 0.4);
}

[data-theme="light"] .item-row.is-done {
  background: rgba(241, 245, 249, 0.6);
}

.item-row.is-done .item-title {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.item-action-zone {
  display: flex;
  align-items: center;
}

.item-del-btn {
  background: transparent;
  border: none;
  color: var(--text-disabled);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.item-del-btn:hover {
  background: var(--danger-muted);
  color: var(--danger);
}

.del-svg {
  width: 15px;
  height: 15px;
}

/* Empty State */
.state-empty {
  text-align: center;
  padding: 36px 16px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
}

.empty-glyph {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  color: var(--text-disabled);
}

.empty-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.empty-desc {
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

/* ==========================================================
   Completed Deck Accordion
   ========================================================== */
.completed-deck {
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
}

.deck-header-interactive {
  cursor: pointer;
  user-select: none;
}

.accordion-arrow {
  width: 12px;
  height: 12px;
  color: var(--text-tertiary);
  transition: transform 0.2s var(--ease-spring);
}

.deck-header-interactive.collapsed .accordion-arrow {
  transform: rotate(-90deg);
}

.btn-clean-tray {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--danger-muted);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-clean-tray:hover {
  background: var(--danger);
  color: #ffffff;
}

.clean-icon {
  width: 13px;
  height: 13px;
}

.completed-stack.collapsed {
  display: none;
}

/* ==========================================================
   Modals / Sheets
   ========================================================== */
.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s var(--ease-in-out);
}

.sheet-scrim.active {
  opacity: 1;
  visibility: visible;
}

.sheet-panel {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sheet);
  display: flex;
  flex-direction: column;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s var(--ease-spring);
}

.sheet-scrim.active .sheet-panel {
  transform: scale(1) translateY(0);
}

.sheet-panel-compact {
  max-width: 420px;
}

.sheet-topbar {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.sheet-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.sheet-close-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sheet-close-btn:hover {
  background: var(--bg-element);
  color: var(--text-primary);
}

.sheet-close-btn svg {
  width: 18px;
  height: 18px;
}

.sheet-content {
  padding: 18px;
}

/* Pill Tabs inside modal */
.pill-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-element);
  padding: 3px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}

.pill-tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: 7px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-tab:hover {
  color: var(--text-primary);
}

.pill-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.tab-view {
  display: none;
}

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

/* QR Code presentation */
.qr-canvas-holder {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-frame {
  background: #ffffff;
  padding: 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin-bottom: 14px;
}

.qr-asset {
  width: 200px;
  height: 200px;
  display: block;
  image-rendering: crisp-edges;
}

.qr-caption-block h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.qr-caption-block p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.network-route-box {
  width: 100%;
  margin-top: 14px;
  background: var(--bg-element);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
}

.route-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.route-dropdown {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  outline: none;
  font-size: 0.82rem;
}

.sheet-actions-cluster {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
}

.sheet-actions-cluster .btn-firm {
  flex: 1;
}

/* Buttons */
.btn-firm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-firm-primary {
  background: var(--accent);
  color: #ffffff;
}

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

.btn-firm-primary:active {
  transform: scale(0.98);
}

.btn-firm-ghost {
  background: var(--bg-element);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.btn-firm-ghost:hover {
  background: var(--bg-element-hover);
}

.btn-firm-whatsapp {
  background: #25d366;
  color: #ffffff;
  width: 100%;
}

.btn-firm-whatsapp:hover {
  background: #20ba59;
}

.btn-icon-inside {
  width: 15px;
  height: 15px;
}

/* Guide Container */
.guide-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-lead {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-step-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--bg-element);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-body {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
  flex: 1;
}

.step-body strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.clip-field {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.clip-field input {
  flex: 1;
  background: var(--bg-element);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  outline: none;
}

.clip-btn {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 0 12px;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.clip-btn:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.share-box-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.share-label {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.share-channel-btn {
  margin-top: 6px;
}

/* History Modal */
.history-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.history-records-tally {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.clean-history-trigger {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
}

.clean-history-trigger:hover {
  text-decoration: underline;
}

.history-scroll-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
}

.history-item-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-element);
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.history-item-entry:hover {
  border-color: var(--border-strong);
}

.history-entry-meta {
  display: flex;
  flex-direction: column;
}

.history-entry-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.history-entry-sub {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.history-restore-action {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-restore-action:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Decision Cards (Clear modal) */
.decision-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.decision-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-element);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.decision-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.decision-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.decision-icon svg {
  width: 18px;
  height: 18px;
}

.decision-card-save .decision-icon {
  background: var(--accent-muted);
  color: var(--accent);
}

.decision-card-trash .decision-icon {
  background: var(--danger-muted);
  color: var(--danger);
}

.decision-text {
  display: flex;
  flex-direction: column;
}

.decision-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.decision-explain {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Config Modal */
.config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.config-input {
  background: var(--bg-element);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
}

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

.config-hint {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.config-footer-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ==========================================================
   Toast / Snackbar with Undo Action
   ========================================================== */
.toast-shelf {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast-pill {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sheet);
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: toastPop 0.25s var(--ease-spring) forwards;
  pointer-events: auto;
}

.toast-text {
  flex: 1;
  margin-right: 8px;
}

.toast-undo-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: opacity 0.15s ease;
}

.toast-undo-btn:hover {
  opacity: 0.8;
}

@keyframes toastPop {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================
   Print Sheet Layout
   ========================================================== */
.print-sheet {
  display: none;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .navbar,
  .app-shell,
  .sheet-scrim,
  .toast-shelf {
    display: none !important;
  }

  .print-sheet {
    display: block !important;
    padding: 30px;
    max-width: 440px;
    margin: 0 auto;
  }

  .print-border-wrap {
    border: 2px solid #000000;
    border-radius: 12px;
    padding: 28px 24px;
    text-align: center;
  }

  .print-brand-heading h2 {
    font-size: 13px;
    letter-spacing: 0.1em;
    color: #555555;
    margin-bottom: 4px;
  }

  .print-brand-heading h3 {
    font-size: 22px;
    color: #000000;
    margin-bottom: 20px;
  }

  .print-qr-target img {
    width: 220px;
    height: 220px;
    margin: 0 auto;
    display: block;
  }

  .print-instructions-block {
    margin-top: 20px;
  }

  .print-guide-line {
    font-size: 13px;
    line-height: 1.4;
    color: #222222;
  }

  .print-url-caption {
    margin-top: 10px;
    font-family: monospace;
    font-size: 10px;
    color: #666666;
    word-break: break-all;
  }
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  .sheet-scrim {
    align-items: flex-end;
    padding: 0;
  }

  .sheet-panel {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    transform: translateY(100%);
  }

  .sheet-scrim.active .sheet-panel {
    transform: translateY(0);
  }

  .toast-shelf {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: 94%;
  }

  .item-row {
    padding: 12px 14px;
    min-height: 52px;
  }
}

@media (max-width: 480px) {
  .nav-btn .nav-label {
    display: none;
  }

  .nav-btn {
    padding: 8px 10px;
  }

  .composer-primary-row {
    flex-wrap: wrap;
  }

  .input-field-wrap {
    width: 100%;
    flex: none;
  }

  .stepper-wrap {
    flex: 1;
    height: 46px;
  }

  .stepper-btn {
    width: 36px;
  }

  .composer-submit {
    flex: 1.5;
    height: 46px;
  }

  .segment-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .segmented-pills {
    display: flex;
    width: 100%;
  }

  .pill {
    flex: 1;
    justify-content: center;
    padding: 8px 6px;
  }

  .group-btn {
    justify-content: center;
    padding: 8px 12px;
  }
}
