/* ============================================================
   MenuOS — Shared Stylesheet
   All views import this file. No logic here, pure presentation.
   ============================================================ */

/* ── RESET ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── TOKENS ── */
:root {
  /* Backgrounds */
  --bg:             #f7f7f5;
  --surface:        #ffffff;

  /* Borders */
  --border:         #e8e6e1;
  --border-strong:  #d0cec9;

  /* Text */
  --text-1:         #111111;
  --text-2:         #555550;
  --text-3:         #999993;

  /* Accent (warm amber) */
  --accent:         #c07840;
  --accent-light:   #fdf3eb;
  --accent-muted:   #e8c4a0;

  /* Semantic */
  --green:          #2d9e6b;
  --green-light:    #edf7f2;
  --green-border:   #b6e5cf;
  --amber:          #d4900a;
  --amber-light:    #fef8e6;
  --amber-border:   #f0d98a;
  --red:            #d94f4f;
  --red-light:      #fdf0f0;
  --red-border:     #f5c8c8;

  /* Layout */
  --topbar-h:       56px;
  --sidebar-w:      220px;
  --radius:         10px;

  /* Typography */
  --font-heading:   'Instrument Serif', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;
  --font-mono:      'DM Mono', monospace;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:      0 16px 48px rgba(0,0,0,0.14), 0 4px 12px rgba(0,0,0,0.06);
}

/* ── BASE ── */
html, body {
  height: 100%;
  /* Never let stray off-screen chrome (drawers, transforms) widen the
     pannable page on phones. clip ≠ hidden: it doesn't create a scroll
     container, so sticky/fixed descendants keep working. Wide content
     must scroll inside its own overflow-x:auto container instead. */
  overflow-x: clip;
}
body {
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-logo {
  font-family: var(--font-heading);
  font-size: 20px;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text-1);
}
.topbar-logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}
.topbar-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-2);
}
.topbar-crumb-sep { color: var(--text-3); }
.topbar-crumb-current { font-weight: 500; color: var(--text-1); }
.topbar-spacer { flex: 1; }
.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 1.5px solid var(--accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  flex-shrink: 0;
}
.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 8px 4px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  text-decoration: none;
  font-family: var(--font-body);
}
.sidebar-item:hover { background: var(--bg); color: var(--text-1); }
.sidebar-item.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }
.sidebar-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--text-1);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: #333; }
.btn-primary:disabled {
  background: var(--border-strong);
  color: var(--text-3);
  cursor: not-allowed;
  box-shadow: none;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text-1);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg); color: var(--text-1); }
.btn-danger {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.btn-danger:hover { background: #fae0e0; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }

/* ── FORM ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.form-input {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--surface);
  color: var(--text-1);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input:focus {
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 2px rgba(192,120,64,0.12);
}
.form-textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.form-select {
  padding: 8px 28px 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--surface);
  color: var(--text-1);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  width: 100%;
}
.form-select:focus {
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 2px rgba(192,120,64,0.12);
}

/* ── TOGGLE ── */
.toggle {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--green); }
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(16px); }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.toggle-label { font-size: 14px; color: var(--text-2); }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 16px; }

/* ── PANEL ── */
.panel {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.panel-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-style: italic;
  color: var(--text-1);
}
.panel-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 3px;
}
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-tab {
  flex: 1;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: var(--font-body);
}
.panel-tab.active { color: var(--text-1); border-bottom-color: var(--accent); }
.panel-tab:hover:not(.active) { color: var(--text-2); }

/* ── BADGES / CHIPS ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-accent   { color: var(--accent);  background: var(--accent-light);  border: 1px solid var(--accent-muted); }
.badge-green    { color: var(--green);   background: var(--green-light);   border: 1px solid var(--green-border); }
.badge-amber    { color: var(--amber);   background: var(--amber-light);   border: 1px solid var(--amber-border); }
.badge-red      { color: var(--red);     background: var(--red-light);     border: 1px solid var(--red-border); }
.badge-neutral  { color: var(--text-3);  background: var(--bg);            border: 1px solid var(--border); }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
  background: var(--bg);
  transition: all 0.2s;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent-muted);
  background: var(--accent-light);
}
.upload-zone.has-file {
  border-style: solid;
  border-color: var(--green-border);
  background: var(--green-light);
  padding: 12px 20px;
}
.upload-zone-icon { font-size: 28px; }
.upload-zone-title { font-size: 15px; font-weight: 500; color: var(--text-1); }
.upload-zone-sub { font-size: 13px; color: var(--text-3); }

/* ── IMAGE PLACEHOLDER ── */
.img-placeholder {
  background: repeating-linear-gradient(
    45deg,
    #eee 0, #eee 2px,
    #f5f5f5 2px, #f5f5f5 8px
  );
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
}

/* ── STAT CARD ── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-style: italic;
  color: var(--text-1);
  margin-top: 4px;
  line-height: 1;
}
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stat-up   { color: var(--green); }
.stat-down { color: var(--red); }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-style: italic;
  color: var(--text-1);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-3);
  margin-top: 3px;
}
.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── ICON BUTTON ── */
.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-3);
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text-1); }
.icon-btn.danger:hover { background: var(--red-light); color: var(--red); }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-1);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow-md);
  z-index: 99;
  /* Cap to the viewport so long messages (e.g. the quota notice) wrap instead of
     overflowing off the side of a phone. Short toasts stay content-sized. */
  max-width: min(92vw, 480px);
  overflow-wrap: break-word;
  text-align: center;
  animation: toastIn 0.2s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── MODAL OVERLAY ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 380px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── DRAWER ── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.28);
  z-index: 40;
  backdrop-filter: blur(2px);
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 41;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.drawer-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-style: italic;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── BOTTOM SHEET (mobile) ── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  backdrop-filter: blur(2px);
}
.sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  max-height: 82%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.sheet-body {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: none;
}
.sheet-body::-webkit-scrollbar { display: none; }

/* ── PHONE FRAME ── */
.phone-frame {
  width: 340px;
  height: 720px;
  background: var(--surface);
  border-radius: 44px;
  border: 2px solid #2e2e2e;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 6px #1c1c1c, 0 40px 80px rgba(0,0,0,0.6);
  flex-shrink: 0;
}
.phone-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 4px;
  flex-shrink: 0;
  background: var(--surface);
}
.phone-time { font-size: 12px; font-weight: 600; }
.phone-screen {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.phone-home-bar {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  flex-shrink: 0;
}
.phone-home-pill {
  width: 120px;
  height: 4px;
  background: #ccc;
  border-radius: 2px;
}

/* ── STEP BADGE ── */
.step-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text-1);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-badge.done { background: var(--green); }

/* ── EMPTY STATE ── */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-3);
  text-align: center;
  padding: 48px 24px;
}
.empty-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-style: italic;
  color: var(--text-2);
}
.empty-sub {
  font-size: 14px;
  max-width: 260px;
  line-height: 1.6;
}

/* ── SPINNER ── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-dark {
  border-color: rgba(0,0,0,0.12);
  border-top-color: var(--text-1);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── COLOR SWATCH / PICKER ── */
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid var(--border-strong);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
  position: relative;
  overflow: hidden;
}
.color-swatch:hover { transform: scale(1.06); }
.color-swatch input[type="color"] {
  position: absolute;
  inset: -4px;
  opacity: 0;
  cursor: pointer;
  width: 200%;
  height: 200%;
}

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}
.group-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 2px;
}
.group-divider-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.group-divider-line { flex: 1; height: 1px; background: var(--border); }

/* ── DISCOUNT PRICE CELL ── */
.item-price-cell { display: flex; flex-direction: column; gap: 1px; }
.item-price-original { font-size: 12px; color: var(--text-3); text-decoration: line-through; }

/* ── TAG PICKER (drawer) ── */
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.tag-pick-btn {
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--font-body);
  transition: all 0.15s;
  opacity: 0.55;
}
.tag-pick-btn.tag-active { opacity: 1; }
.tag-pick-btn:not(.tag-active):hover { opacity: 0.85; }

/* ── TAG ICONS (table row) ── */
.tag-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
}
.tag-icon {
  font-size: 16px;
  line-height: 1;
  cursor: default;
}

/* ── IMAGE UPLOAD PREVIEW ── */
.img-preview {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.img-preview-thumb {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
/* Logos are usually wide wordmarks: cropping one to the square item-photo thumb
   hides most of the mark, so show it whole against the panel background. */
.img-preview-thumb--contain {
  width: 132px;
  object-fit: contain;
  background: var(--surface);
}
.img-preview-actions { display: flex; flex-direction: column; gap: 6px; }
.img-upload-zone {
  height: 120px;
  border: 2px dashed var(--border-strong);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-3);
  font-size: 13px;
  transition: all 0.15s;
}
.img-upload-zone:hover { border-color: var(--accent-muted); color: var(--accent); background: var(--accent-light); }
.img-upload-zone.uploading { opacity: 0.6; cursor: default; }
.upload-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── DRAG HANDLE ── */
.drag-handle {
  color: var(--text-3);
  cursor: grab;
  font-size: 15px;
  display: flex;
  align-items: center;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }
.item-row.dragging  { opacity: 0.4; }
.item-row.drag-over { border-top: 2px solid var(--accent); }

/* ── LINK BOX ── */
.link-box {
  display: flex;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
}
.link-box-url {
  flex: 1;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg);
  border: none;
  outline: none;
  min-width: 0;
}
.link-box-copy {
  padding: 8px 14px;
  background: var(--surface);
  border: none;
  border-left: 1px solid var(--border-strong);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font-body);
}
.link-box-copy:hover { background: var(--bg); color: var(--text-1); }
.link-box-copy.copied { color: var(--green); background: var(--green-light); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── MOBILE SIDEBAR DRAWER ── */
.sidebar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
  font-size: 20px;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg); }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.45);
  z-index: 40;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .sidebar-toggle { display: inline-flex; }

  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-divider { display: none; }
  .topbar-crumb { font-size: 13px; }
  .topbar-restaurant span:last-child {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Compact topbar buttons: keep them tappable but lose padding-heavy labels */
  .topbar .btn-sm {
    padding: 6px 10px;
    font-size: 13px;
  }

  /* The topbar can't fit every action on a phone, and its flex children
     don't shrink — anything that doesn't fit widens the page beyond the
     viewport (page loads slightly zoomed-in / pannable). Drop actions that
     are reachable elsewhere: the QR link duplicates the sidebar entry. */
  .topbar-hide-sm { display: none !important; }

  /* iOS Safari zooms the whole page when a focused control is under 16px —
     keep form controls at 16px on phones (also easier to read while typing). */
  .form-input,
  .form-select {
    font-size: 16px;
  }

  .app {
    grid-template-columns: 1fr !important;
  }

  .sidebar {
    position: fixed !important;
    top: var(--topbar-h) !important;
    left: 0 !important;
    height: calc(100vh - var(--topbar-h)) !important;
    width: 260px !important;
    max-width: 80vw !important;
    z-index: 50 !important;
    transform: translateX(-100%);
    /* visibility:hidden once the slide-out ends: a drawer parked past the
       viewport edge otherwise extends the pannable page area on mobile
       (page loads "zoomed in", drawer edge peeks in when panning — worst
       under RTL where it parks past the right edge). */
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0s linear 0.22s;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  }
  .app.sidebar-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.22s ease;
  }
  .app.sidebar-open .sidebar-overlay { display: block; }
}

@media (max-width: 480px) {
  /* On very small screens, keep only logo + language + auth in the topbar.
     Preview stays reachable from the QR page's link box. */
  .topbar-restaurant { display: none; }
  .topbar-hide-xs { display: none !important; }
}
