/* ─── Design tokens ───────────────────────────────────────────────────── */
:root {
  --brand:        #06C167;
  --brand-dark:   #049A51;
  --brand-dim:    rgba(6,193,103,.12);
  --brand-glow:   rgba(6,193,103,.25);
  --surface-0:    #0F0F0F;
  --surface-1:    #1A1A1A;
  --surface-2:    #242424;
  --surface-3:    #2E2E2E;
  --surface-4:    #383838;
  --text-primary: #F7F7F7;
  --text-muted:   #8A8A8A;
  --text-dim:     #555;
  --border:       #2A2A2A;
  --border-light: #333;
  --red:          #FF4D4F;
  --amber:        #FAAD14;
  --blue:         #1890FF;
  --purple:       #722ED1;
  --radius-sm:    6px;
  --radius-md:    12px;
  --radius-lg:    18px;
  --radius-xl:    24px;
  --shadow-card:  0 2px 16px rgba(0,0,0,.5);
  --shadow-hover: 0 4px 24px rgba(0,0,0,.7);
}

/* ─── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* ─── App shell: sidebar + main ──────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-mark {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -.3px;
}

.sidebar-brand-sub {
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section {
  padding: 12px 8px 4px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text-muted);
  transition: background .12s, color .12s;
  position: relative;
}

.sidebar-link:hover { background: var(--surface-3); color: var(--text-primary); }

.sidebar-link.active {
  background: var(--brand-dim);
  color: var(--brand);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

.sidebar-icon { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }

.sidebar-badge {
  margin-left: auto;
  background: var(--amber);
  color: #000;
  font-size: .65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
}

.sidebar-badge.green { background: var(--brand); }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.sidebar-avatar {
  width: 30px; height: 30px;
  background: var(--surface-3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name  { font-size: .82rem; font-weight: 600; truncate: overflow; }
.sidebar-user-email { font-size: .72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Main ────────────────────────────────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.topbar-title {
  font-weight: 700;
  font-size: 1rem;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content {
  padding: 32px;
  flex: 1;
}

/* ─── Page header ─────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.4px; }
.page-subtitle { font-size: .82rem; color: var(--text-muted); margin-top: 3px; }

/* ─── Onboarding steps (wizard) ──────────────────────────────────────── */
.onboarding-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.onboarding-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  position: relative;
  border-right: 1px solid var(--border);
}

.onboarding-step:last-child { border-right: none; }

.onboarding-step.done { background: var(--brand-dim); }
.onboarding-step.active { background: var(--surface-2); }

.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem;
  font-weight: 800;
  flex-shrink: 0;
  background: var(--surface-3);
  color: var(--text-muted);
}

.onboarding-step.done .step-num {
  background: var(--brand);
  color: #000;
}

.onboarding-step.active .step-num {
  background: var(--blue);
  color: #fff;
}

.step-info {}
.step-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.step-name  { font-size: .88rem; font-weight: 600; color: var(--text-primary); }
.onboarding-step.done .step-name { color: var(--brand); }

/* ─── Stat cards ──────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
  transition: border-color .15s;
}

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

.stat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 1.8rem; font-weight: 800; letter-spacing: -.5px; line-height: 1; }
.stat-value.green  { color: var(--brand); }
.stat-value.amber  { color: var(--amber); }
.stat-value.blue   { color: var(--blue);  }
.stat-value.purple { color: var(--purple); }
.stat-sub { font-size: .74rem; color: var(--text-muted); margin-top: 4px; }

/* ─── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}

.card-body { padding: 20px; }

/* ─── Entity cards (store / user / device) ────────────────────────────── */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.entity-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}

.entity-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.entity-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.entity-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.entity-icon.green  { background: var(--brand-dim); }
.entity-icon.blue   { background: rgba(24,144,255,.12); }
.entity-icon.amber  { background: rgba(250,173,20,.12); }
.entity-icon.purple { background: rgba(114,46,209,.12); }

.entity-name  { font-weight: 700; font-size: .95rem; }
.entity-meta  { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }

.entity-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ─── Add new card ────────────────────────────────────────────────────── */
.add-card {
  background: transparent;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  min-height: 110px;
}

.add-card:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-dim);
}

.add-card-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px dashed currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

/* ─── Table ───────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

.data-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child { border-bottom: none; }

.data-table td {
  padding: 12px 16px;
  vertical-align: middle;
}

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .12s, transform .1s;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary   { background: var(--brand); color: #000; }
.btn-secondary { background: var(--surface-3); color: var(--text-primary); border-color: var(--border); }
.btn-danger    { background: rgba(255,77,79,.15); color: var(--red); border-color: rgba(255,77,79,.3); }
.btn-ghost     { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text-primary); background: var(--surface-2); }

.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-xs { padding: 4px 10px; font-size: .74rem; }
.btn-lg { padding: 11px 22px; font-size: .9rem; }

/* ─── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.badge-success { background: rgba(6,193,103,.15);  color: var(--brand); }
.badge-warning { background: rgba(250,173,20,.15); color: var(--amber); }
.badge-danger  { background: rgba(255,77,79,.15);  color: var(--red);   }
.badge-info    { background: rgba(24,144,255,.15);  color: var(--blue);  }
.badge-muted   { background: var(--surface-3);     color: var(--text-muted); }

/* ─── Order ID chip ───────────────────────────────────────────────────── */
.order-id {
  font-family: "SF Mono","Fira Code",monospace;
  font-size: .8rem;
  font-weight: 700;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  color: var(--brand);
}

/* ─── Forms ───────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.form-hint  { font-size: .73rem; color: var(--text-dim); margin-top: 2px; }

.form-input,
input[type="text"],
input[type="email"],
input[type="password"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: .88rem;
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.form-input:focus, input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
}

.form-section {
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.form-section-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ─── Detail layout ───────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

.detail-section {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.detail-section-header {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-section-body { padding: 20px; }

/* ─── Info list ───────────────────────────────────────────────────────── */
.info-list { display: flex; flex-direction: column; gap: 12px; }
.info-row  { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.info-value { font-size: .88rem; }

/* ─── Line items ──────────────────────────────────────────────────────── */
.line-items { width: 100%; border-collapse: collapse; font-size: .84rem; }
.line-items th {
  text-align: left; font-size: .7rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0 0 10px; border-bottom: 1px solid var(--border);
}
.line-items td { padding: 10px 0; border-bottom: 1px solid var(--border); }
.line-items tr:last-child td { border-bottom: none; }

.totals-row { display: flex; justify-content: space-between; font-size: .84rem; padding: 4px 0; color: var(--text-muted); }
.totals-row.total { font-size: 1rem; font-weight: 800; color: var(--text-primary); padding-top: 10px; border-top: 1px solid var(--border); margin-top: 4px; }

/* ─── Flash ───────────────────────────────────────────────────────────── */
.flash { padding: 12px 20px; font-size: .84rem; font-weight: 500; text-align: center; }
.flash-notice { background: var(--brand-dim); color: var(--brand); }
.flash-alert  { background: rgba(255,77,79,.12); color: var(--red); }

/* ─── Empty state ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 32px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .4; }
.empty-state-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--text-primary); }
.empty-state-sub   { font-size: .84rem; margin-bottom: 20px; }

/* ─── Pagination ──────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; padding: 16px; font-size: .82rem; }
.pagination a, .pagination span { padding: 5px 10px; border-radius: var(--radius-sm); color: var(--text-muted); border: 1px solid var(--border); background: var(--surface-2); }
.pagination a:hover { background: var(--surface-3); color: var(--text-primary); }
.pagination .current { background: var(--brand); color: #000; border-color: var(--brand); font-weight: 700; }

/* ─── Login ───────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--surface-0); }
.login-box { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 44px; width: 100%; max-width: 400px; box-shadow: 0 8px 48px rgba(0,0,0,.6); }
.login-mark { width: 52px; height: 52px; background: var(--brand); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin: 0 auto 16px; }
.login-title { font-size: 1.4rem; font-weight: 800; text-align: center; margin-bottom: 4px; }
.login-sub   { font-size: .82rem; color: var(--text-muted); text-align: center; margin-bottom: 28px; }

/* ─── Code block ──────────────────────────────────────────────────────── */
.code-block {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: "SF Mono","Fira Code",monospace;
  font-size: .78rem;
  color: var(--brand);
  word-break: break-all;
}

/* ─── Utilities ───────────────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-green   { color: var(--brand); }
.text-amber   { color: var(--amber); }
.text-red     { color: var(--red); }
.text-blue    { color: var(--blue); }
.font-mono    { font-family: "SF Mono","Fira Code",monospace; }
.fw-700       { font-weight: 700; }
.fw-800       { font-weight: 800; }
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-5  { gap: 20px; }
.mb-2   { margin-bottom: 8px; }
.mb-4   { margin-bottom: 16px; }
.mb-5   { margin-bottom: 20px; }
.mb-6   { margin-bottom: 24px; }
.mt-1   { margin-top: 4px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile first, then tablet, then desktop
   Breakpoints:
     sm:  640px  (large phones landscape / small tablets)
     md:  768px  (tablets portrait — iPad mini, iPad)
     lg: 1024px  (tablets landscape / small laptops)
     xl: 1280px  (desktop)
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Mobile hamburger toggle ─────────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.sidebar-toggle:hover { background: var(--surface-3); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}

/* ─── < 768px  (phones) ───────────────────────────────────────────────── */
@media (max-width: 767px) {
  html { font-size: 14px; }

  /* Shell: single column, sidebar slides in */
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  /* Sidebar becomes a drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 100;
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay.open { display: block; }

  /* Main fills full width */
  .main { grid-column: 1; }

  /* Topbar shows on mobile */
  .topbar {
    display: flex;
    padding: 0 16px;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .topbar-brand-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: .95rem;
  }

  .topbar-brand-mobile .sidebar-brand-mark {
    width: 28px; height: 28px;
    border-radius: 8px;
    font-size: .85rem;
  }

  .sidebar-toggle { display: flex; align-items: center; }

  /* Content padding */
  .content { padding: 16px; }

  /* Page header stacks */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }

  .page-title { font-size: 1.2rem; }

  /* Stats: 2 columns on phone */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 1.5rem; }

  /* Dashboard flex layout stacks */
  .flex.gap-5 { flex-direction: column !important; }
  [style*="width:300px"] { width: 100% !important; }
  [style*="width:280px"] { width: 100% !important; }

  /* Entity grid: 1 column */
  .entity-grid { grid-template-columns: 1fr; }

  /* Detail grid: single column */
  .detail-grid { grid-template-columns: 1fr; }

  /* Onboarding steps: compact */
  .onboarding-steps { flex-direction: column; }
  .onboarding-step { border-right: none; border-bottom: 1px solid var(--border); }
  .onboarding-step:last-child { border-bottom: none; }

  /* Tables: horizontal scroll */
  .card { overflow-x: auto; }
  .data-table { min-width: 600px; }

  /* Orders show: stack */
  .detail-grid > * + * { margin-top: 0; }

  /* Login box */
  .login-box { padding: 28px 20px; margin: 16px; }

  /* Sidebar form max-width override */
  [style*="max-width:520px"],
  [style*="max-width:480px"] { max-width: 100% !important; }
}

/* ─── 768px – 1023px  (tablets portrait) ────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Narrower sidebar */
  .app-shell { grid-template-columns: 64px 1fr; }

  /* Sidebar icon-only mode */
  .sidebar { width: 64px; overflow: visible; }
  .sidebar-brand-name,
  .sidebar-brand-sub,
  .sidebar-section,
  .sidebar-link span:not(.sidebar-icon),
  .sidebar-badge,
  .sidebar-user-info,
  .sidebar-footer .btn { display: none; }

  .sidebar-header { padding: 14px 10px; justify-content: center; }
  .sidebar-brand   { justify-content: center; }
  .sidebar-nav     { padding: 8px 6px; align-items: center; }
  .sidebar-link    { justify-content: center; padding: 10px; border-radius: var(--radius-sm); }
  .sidebar-link.active::before { display: none; }
  .sidebar-icon    { width: auto; font-size: 1.1rem; }
  .sidebar-footer  { padding: 8px 6px; }
  .sidebar-user    { justify-content: center; padding: 8px; }
  .sidebar-avatar  { margin: 0; }

  /* Tooltip on hover via title */
  .sidebar-link { position: relative; }

  .content { padding: 24px; }

  /* Stats: 3 columns */
  .stats-grid { grid-template-columns: repeat(3, 1fr); }

  /* Onboarding steps: all inline but compact */
  .onboarding-step { padding: 12px 14px; }
  .step-name { font-size: .82rem; }

  /* Detail grid: still 2 col but narrower sidebar */
  .detail-grid { grid-template-columns: 1fr 260px; }

  /* Entity grid: 2 col */
  .entity-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── 1024px – 1279px  (tablets landscape / laptops) ────────────────── */
@media (min-width: 1024px) and (max-width: 1279px) {
  .app-shell { grid-template-columns: 200px 1fr; }
  .sidebar { width: 200px; }
  .sidebar-brand-name { font-size: .9rem; }
  .content { padding: 24px 28px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .entity-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr 280px; }
}

/* ─── ≥ 1280px  (desktop) ────────────────────────────────────────────── */
@media (min-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(5, 1fr); }
  .entity-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

/* ─── Touch targets: min 44px on mobile ──────────────────────────────── */
@media (max-width: 767px) {
  .btn { min-height: 40px; padding: 10px 16px; }
  .btn-sm { min-height: 36px; }
  .btn-xs { min-height: 32px; }
  .sidebar-link { min-height: 44px; }
  .data-table td { padding: 14px 12px; }
}

/* ─── Tablet tooltip (icon-only sidebar) ─────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar-link[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    background: var(--surface-3);
    color: var(--text-primary);
    font-size: .78rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
    z-index: 200;
  }
  .sidebar-link[data-tip]:hover::after { opacity: 1; }
}

/* ─── Mobile topbar: hidden on desktop, shown on mobile via CSS ─────── */
.topbar { display: none; }
@media (max-width: 767px) { .topbar { display: flex; } }



/* ─── Orders table — 5-column tablet-optimised ───────────────────────── */

/* Tablet-first: comfortable touch targets, large readable text */
.new-order-table,
.ready-orders-table {
  font-size: 1.1rem;       /* ~2x the base 0.84rem */
  line-height: 1.5;
}

.new-order-table thead th,
.ready-orders-table thead th {
  font-size: .75rem;
  padding: 12px 16px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}

.ready-orders-table .order-row,
.closed-orders-table .order-row {
  opacity: .65;
}

/* Closed orders table: enforce monochrome gray */
.ready-orders-table,
.ready-orders-table *,
.closed-orders-table,
.closed-orders-table * {
  color: #a1a1a1 !important;
}

.ready-orders-table .badge,
.ready-orders-table .badge-success,
.ready-orders-table .badge-warning,
.ready-orders-table .badge-danger,
.closed-orders-table .badge,
.closed-orders-table .badge-success,
.closed-orders-table .badge-warning,
.closed-orders-table .badge-danger {
  background: #3a3a3a !important;
  color: #c9c9c9 !important;
  border: 1px solid #555 !important;
}

.ready-orders-table .btn,
.ready-orders-table .btn-ghost,
.ready-orders-table .btn-secondary,
.ready-orders-table .btn-primary,
.closed-orders-table .btn,
.closed-orders-table .btn-ghost,
.closed-orders-table .btn-secondary,
.closed-orders-table .btn-primary {
  background: #2f2f2f !important;
  border-color: #555 !important;
  color: #bdbdbd !important;
  opacity: 1;
}

/* Column widths */
.orders-col-customer { width: 25%; }
.orders-col-order    { width: 20%; }
.orders-col-printed  { width: 15%; text-align: left; }
.orders-col-ready    { width: 25%; text-align: left; }
.orders-col-view     { width: 10%; text-align: left; }

/* Row height — tall enough for 2 lines of content */
.order-row { height: 90px; }

.order-row-cell {
  padding: 14px 16px !important;
  vertical-align: middle;
}

/* Column 1: Customer */
.order-customer-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.2;
}

.order-customer-phone {
  font-size: .95rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.order-customer-email {
  font-size: .82rem;
  color: var(--text-dim);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Column 2: Order */
.order-number {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.order-total {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.order-note {
  font-size: .82rem;
  color: var(--amber);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.order-timestamp {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Column 3: Printed — badge + time */
.orders-col-printed .badge {
  font-size: .85rem;
  padding: 5px 12px;
}

/* Column 4: Ready button */
.orders-btn-ready {
  font-size: 1rem !important;
  padding: 10px 20px !important;
  background: var(--brand) !important;
  color: #000 !important;
  min-width: 130px;
}

.orders-btn-locked {
  font-size: .9rem !important;
  padding: 8px 14px !important;
  opacity: .45;
  cursor: not-allowed !important;
  min-width: 130px;
}

/* Column 5: View */
.orders-btn-view {
  font-size: .95rem !important;
  padding: 8px 14px !important;
  white-space: nowrap;
}

/* Cancelled row */
.order-cancelled { opacity: .4; }
.order-cancelled .order-customer-name { color: var(--text-muted) !important; }

/* Empty state */
.orders-empty {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ─── Tablet responsive (768-1024px) ──────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  .new-order-table, .ready-orders-table { font-size: 1.05rem; }
  .order-customer-name { font-size: 1.1rem; }
  .order-number { font-size: 1.05rem; }
  .orders-col-customer { width: 28%; }
  .orders-col-order    { width: 22%; }
  .orders-col-printed  { width: 14%; }
  .orders-col-ready    { width: 26%; }
  .orders-col-view     { width: 10%; }
  .orders-btn-ready, .orders-btn-locked { min-width: 110px; }
}

/* ─── Mobile (< 768px) — horizontal scroll ────────────────────────────── */
@media (max-width: 767px) {
  .new-order-table, .ready-orders-table { min-width: 680px; font-size: 1rem; }
  .order-row { height: auto; min-height: 80px; }
}
