:root {
  --bg: #f6f3ee;
  --bg-subtle: #ede7de;
  --surface: #ffffff;
  --surface-muted: #faf8f5;
  --ink: #231d19;
  --ink-muted: #6c6259;
  --ink-light: #8d8277;
  --border: #e3dcd2;
  --border-strong: #cec4b6;
  --accent: #9a6c34;
  --accent-dark: #7a5221;
  --espresso: #231d19;
  --espresso-hover: #382f29;
  --success: #1f7a4c;
  --success-bg: #e7f6ee;
  --warning: #b85d00;
  --warning-bg: #fff1df;
  --danger: #b4232c;
  --danger-bg: #fdebec;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(35, 29, 25, 0.06);
  --shadow-md: 0 8px 24px rgba(35, 29, 25, 0.1);
  --shadow-sheet: 0 -8px 32px rgba(20, 15, 12, 0.22);
}

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

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100dvh;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ==================== HEADER & NAVIGATION ==================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(35, 29, 25, 0.96);
  backdrop-filter: blur(10px);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

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

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: #cbbba7;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
  border-radius: 12px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 40px;
  border-radius: 9px;
  color: #dfd6cb;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-tab.active {
  background: #ffffff;
  color: var(--espresso);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
}

/* Focused Guest Café Header */
.guest-header {
  background: linear-gradient(135deg, #27201b 0%, #3d2e23 100%);
  color: #fff;
  padding: 18px 16px;
  border-bottom: 3px solid var(--accent);
}

.guest-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.guest-eyebrow {
  margin: 0 0 2px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #d7b483;
}

.guest-title {
  margin: 0;
  font-size: clamp(1.15rem, 4vw, 1.5rem);
  font-weight: 800;
  line-height: 1.2;
}

.guest-footer {
  margin-top: auto;
  padding: 20px 16px 28px;
  text-align: center;
  color: var(--ink-light);
  font-size: 0.82rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.guest-footer a {
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ==================== MAIN LAYOUT & COMMON CONTROLS ==================== */
.main-content {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 14px 40px;
  flex: 1;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-title {
  margin: 0;
  font-size: clamp(1.35rem, 3.8vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.page-subtitle {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.input-control,
.select-control {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-control:focus,
.select-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(154, 108, 52, 0.18);
}

.textarea-control {
  min-height: 68px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-sm {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 0.85rem;
}

.btn-lg {
  min-height: 50px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--espresso);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--espresso-hover);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #18623d;
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: #ebc2c5;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-bg);
}

/* ==================== STATS & TOOLBAR ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  font: inherit;
  color: inherit;
}

.stat-card-btn {
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.stat-card-btn:hover {
  border-color: var(--warning);
}

.stat-card-btn.active {
  background: var(--warning-bg);
  border-color: var(--warning);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
}

.stat-card.has-alert .stat-value {
  color: var(--warning);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

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

.toolbar-controls .select-control {
  width: auto;
  min-width: 145px;
}

.chip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.chip-btn {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.chip-btn.active {
  background: var(--espresso);
  border-color: var(--espresso);
  color: #fff;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.toggle-pill input {
  width: 18px;
  height: 18px;
  accent-color: var(--espresso);
}

.toggle-pill-block {
  width: 100%;
}

/* ==================== NESPRESSO CAPSULE CARDS ==================== */
.capsule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.capsule-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--capsule-color, #4a2574);
  border-radius: var(--radius-md);
  padding: 15px 15px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.capsule-card.is-empty {
  opacity: 0.62;
  background: var(--surface-muted);
}

.capsule-card.is-clickable {
  cursor: pointer;
}

.capsule-card.is-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.capsule-card.is-clickable:active {
  transform: scale(0.99);
}

.capsule-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.capsule-info {
  min-width: 0;
  flex: 1;
}

.capsule-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.capsule-name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.decaf-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: #efe8de;
  color: #5c4b3b;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.capsule-flavor {
  margin: 3px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

/* 13-Box Intensity Scale */
.intensity-wrap {
  margin-top: 9px;
}

.intensity-bar {
  display: inline-grid;
  grid-template-columns: repeat(13, 14px);
  gap: 3px;
  max-width: 100%;
}

.intensity-box {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--capsule-color, #4a2574);
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.63rem;
  font-weight: 900;
  line-height: 1;
}

.intensity-box.filled {
  background: var(--capsule-color, #4a2574);
  color: #ffffff;
}

.intensity-box.current {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.intensity-none {
  margin-top: 9px;
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-light);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
}

/* Right side visual: Vertuo Dome + Cup Size + ml */
.capsule-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.capsule-svg {
  display: block;
}

.cup-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px 4px 5px;
}

.cup-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #777471;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cup-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.cup-name {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.cup-ml {
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--ink);
}

/* Card Footer (Lager Badges or Guest Action Cue) */
.capsule-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.stock-pill,
.mhd-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.stock-ok {
  background: #f1ece4;
  color: var(--ink);
}

.stock-low {
  background: var(--warning-bg);
  color: var(--warning);
}

.stock-out {
  background: var(--danger-bg);
  color: var(--danger);
}

.mhd-ok {
  background: var(--success-bg);
  color: var(--success);
}

.mhd-soon {
  background: var(--warning-bg);
  color: var(--warning);
}

.mhd-expired {
  background: var(--danger-bg);
  color: var(--danger);
}

.mhd-none {
  background: var(--surface-muted);
  color: var(--ink-muted);
}

.capsule-notes {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.guest-order-cue {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-dark);
}

/* ==================== GUEST ORDER TRACKER ==================== */
.order-tracker {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.order-tracker.is-done {
  border-color: var(--success);
  background: #f4fbf7;
}

.tracker-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.tracker-title {
  margin: 6px 0 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-open {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-done {
  background: var(--success-bg);
  color: var(--success);
}

.tracker-details {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==================== ADMIN LOGIN & DASHBOARD ==================== */
.login-card {
  max-width: 420px;
  margin: 24px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
}

.login-eyebrow {
  margin: 0 0 6px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

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

.password-wrap {
  display: flex;
  gap: 8px;
}

.btn-icon-inline {
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface-muted);
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.form-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 600;
}

.form-success {
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  color: var(--success);
  font-size: 0.86rem;
  font-weight: 600;
}

.subtab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
  overflow-x: auto;
}

.subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.subtab-btn.active {
  background: var(--espresso);
  border-color: var(--espresso);
  color: #fff;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-cap-search {
  min-width: 220px;
  flex: 1;
  max-width: 340px;
}

.live-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(31, 122, 76, 0.18);
}

.group-heading {
  margin: 4px 0 10px;
  font-size: 1.05rem;
  font-weight: 800;
}

.group-heading-spaced {
  margin-top: 24px;
}

.info-note {
  margin: 0 0 14px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--ink-muted);
  font-size: 0.86rem;
}

/* ==================== ORDERS LIST (ADMIN) ==================== */
.orders-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--capsule-color, #4a2574);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.order-card.order-done {
  opacity: 0.78;
  background: var(--surface-muted);
}

.order-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.order-info {
  min-width: 0;
  flex: 1;
}

.order-guest-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.order-guest {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.order-time {
  font-size: 0.8rem;
  color: var(--ink-light);
  font-weight: 600;
}

.order-coffee {
  margin: 3px 0 7px;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ink);
}

.order-coffee-meta {
  color: var(--ink-muted);
  font-weight: 600;
}

.option-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.opt-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.opt-schwarz {
  background: #2c2420;
  color: #fff;
}

.opt-milch {
  background: #e9f1fa;
  color: #1f4f82;
}

.opt-zucker {
  background: #fff1d6;
  color: #8f5300;
}

.opt-suessstoff {
  background: #e3f5f3;
  color: #0e665c;
}

.opt-none {
  background: var(--surface-muted);
  color: var(--ink-muted);
  border: 1px solid var(--border);
}

.order-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==================== ADMIN CAPSULES MANAGEMENT ==================== */
.admin-capsules-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-cap-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--capsule-color, #4a2574);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-cap-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 250px;
}

.admin-cap-meta {
  min-width: 0;
  flex: 1;
}

.admin-cap-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: 12px;
}

.qty-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.qty-btn:hover {
  background: var(--espresso);
  color: #fff;
  border-color: var(--espresso);
}

.qty-value {
  min-width: 56px;
  text-align: center;
  font-size: 0.96rem;
  font-weight: 800;
  padding: 0 4px;
}

/* ==================== SETTINGS ==================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card-heading {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 800;
}

.copy-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.copy-row .input-control {
  flex: 1 1 200px;
}

/* ==================== MODALS / BOTTOM SHEETS ==================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 12, 0.56);
  backdrop-filter: blur(2px);
}

.modal-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-sheet);
}

.modal-sheet-wide {
  max-width: 680px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.btn-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.modal-capsule-summary {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
}

/* Guest Option Checkbox Tiles */
.options-fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.options-fieldset legend {
  margin-bottom: 8px;
}

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

.option-tile {
  position: relative;
  cursor: pointer;
  display: block;
}

.option-checkbox {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.option-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-strong);
  background: #fff;
  font-weight: 700;
  font-size: 0.98rem;
  transition: all 0.14s ease;
  user-select: none;
}

.option-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #fff;
  transition: all 0.14s ease;
}

.option-checkbox:checked + .option-box {
  border-color: var(--espresso);
  background: #f5efe6;
}

.option-checkbox:checked + .option-box .option-check {
  border-color: var(--espresso);
  background: var(--espresso);
}

.option-checkbox:checked + .option-box .option-check::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.option-checkbox:focus-visible + .option-box {
  box-shadow: 0 0 0 3px rgba(154, 108, 52, 0.28);
}

/* Capsule Modal Form Grid & Preview */
.preset-picker-group {
  margin-bottom: 12px;
}

.capsule-preview-box {
  margin-bottom: 14px;
}

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

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

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 10px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}

.color-input {
  width: 36px;
  height: 32px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.color-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  color: var(--ink-muted);
}

.modal-actions {
  margin-top: 4px;
}

/* ==================== EMPTY STATES & TOASTS ==================== */
.empty-state {
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 28px 18px;
  text-align: center;
}

.empty-compact {
  padding: 18px 14px;
}

.empty-title {
  margin: 0 0 6px;
  font-weight: 800;
  font-size: 1.02rem;
}

.empty-text {
  margin: 0 0 14px;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.empty-state .empty-text:last-child {
  margin-bottom: 0;
}

.toast-container {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  background: var(--espresso);
  color: #fff;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.toast.toast-error {
  background: var(--danger);
}

.toast.toast-success {
  background: var(--success);
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */
@media (min-width: 640px) {
  .main-content {
    padding: 24px 20px 48px;
  }

  .intensity-bar {
    grid-template-columns: repeat(13, 16px);
  }

  .intensity-box {
    width: 16px;
    height: 16px;
    font-size: 0.68rem;
  }

  .modal {
    align-items: center;
    padding: 20px;
  }

  .modal-sheet {
    border-radius: 20px;
    padding: 22px 24px 24px;
  }
}

@media (max-width: 639px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    padding: 10px;
  }

  .stat-value {
    font-size: 1.15rem;
  }

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .main-nav {
    width: 100%;
    justify-content: space-between;
  }

  .nav-tab {
    flex: 1;
    justify-content: center;
    padding: 8px 8px;
  }
}

@media (max-width: 360px) {
  .capsule-top {
    flex-direction: column;
  }

  .capsule-visual {
    flex-direction: row;
    width: 100%;
    justify-content: space-between;
  }
}
