/**
 * App shell — sidebar + topbar chrome shared by every authenticated
 * management page (dashboard, editor, staff, account, analytics, admin).
 * Guest-facing venue pages (menu/print/bezahlen) do NOT use this — they stay
 * single-column, venue-themeable consumer pages.
 *
 * Markup contract each page provides:
 *   <div class="shell">
 *     <aside class="shell-sidebar" id="shell-sidebar">
 *       <div class="shell-brand">…</div>
 *       <nav class="shell-nav">…</nav>
 *       <div class="shell-sidebar-footer">…</div>
 *     </aside>
 *     <div class="shell-backdrop" id="shell-backdrop"></div>
 *     <div class="shell-main">
 *       <header class="shell-topbar">…</header>
 *       <main class="shell-content" id="main-content" tabindex="-1">…</main>
 *     </div>
 *   </div>
 */

.shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.shell-sidebar {
  width: 264px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg-soft), var(--bg) 85%);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 10px 20px;
}
.shell-brand .brand-mark { width: 36px; height: 36px; font-size: 0.9rem; }
.shell-brand-text { display: flex; flex-direction: column; min-width: 0; }
.shell-brand-text strong {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shell-brand-text span {
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

/* Venue switcher — shown only for accounts holding more than one venue. */
.venue-switch { padding: 0 10px 16px; }
.venue-switch[hidden] { display: none; }
.venue-switch-label {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-soft);
  margin-bottom: 6px;
}
.venue-switch select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  background: rgba(255, 255, 255, 0.04);
  color: var(--cream);
  font-family: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}
.venue-switch select:focus-visible { outline: 2px solid var(--gold, #c9a94e); outline-offset: 2px; }

.shell-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.shell-nav-group-label {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-soft);
  padding: 16px 12px 6px;
}
.shell-nav-group-label:first-child { padding-top: 4px; }

.shell-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.shell-nav-item svg { flex: none; width: 18px; height: 18px; stroke: currentColor; opacity: 0.85; }
.shell-nav-item:hover { background: rgba(148, 163, 191, 0.08); color: var(--cream); }
.shell-nav-item.active {
  background: linear-gradient(90deg, rgba(201, 169, 78, 0.16), rgba(201, 169, 78, 0.04));
  color: var(--gold-soft);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--gold);
}
.shell-nav-item.active svg { opacity: 1; }
.shell-nav-item .badge-count {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(201, 169, 78, 0.18);
  color: var(--gold-soft);
  border-radius: 999px;
  padding: 1px 7px;
}

.shell-sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shell-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 13, 0.65);
  backdrop-filter: blur(2px);
  z-index: 39;
}

.shell-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--cream);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.shell-menu-btn svg { width: 18px; height: 18px; stroke: currentColor; }

/* ── Main column ─────────────────────────────────────────────────── */
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.shell-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 23, 0.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.shell-topbar-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 0; overflow: hidden; }
.shell-topbar-title h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  margin: 0;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shell-topbar-title p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shell-topbar-spacer { flex: 0 0 auto; width: 1px; }

.shell-content { flex: 1; padding: 32px; max-width: 1280px; width: 100%; margin: 0 auto; }
.shell-content:focus { outline: none; }

/* ── KPI stat tiles (real data only — sourced from actual stores) ──── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-tile {
  background:
    linear-gradient(180deg, var(--edge-highlight), transparent 90px),
    var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-md);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.stat-tile:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-tile-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold-deep));
  color: #1a1409;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.stat-tile-icon svg { width: 17px; height: 17px; stroke: currentColor; }
.stat-tile-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.7rem;
  color: var(--cream);
  line-height: 1.1;
}
.stat-tile-label { margin-top: 4px; font-size: 0.76rem; color: var(--muted); }

/* ── Section card (replaces bare .panel for dashboard-style groupings) ── */
.section-card {
  background:
    linear-gradient(180deg, var(--edge-highlight), transparent 90px),
    var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-md);
}
.section-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.section-card-head h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  margin: 0;
  color: var(--cream);
}
.section-card-head p { margin: 3px 0 0; font-size: 0.78rem; color: var(--muted); }

/* ── Quick-action tiles (real navigation only) ──────────────────── */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.quick-action {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--cream);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.quick-action:hover { border-color: var(--gold); transform: translateY(-2px); background: rgba(201, 169, 78, 0.06); }
.quick-action-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: rgba(201, 169, 78, 0.14);
  border: 1px solid var(--border-strong);
  color: var(--gold-soft);
  display: flex; align-items: center; justify-content: center;
}
.quick-action-icon svg { width: 16px; height: 16px; stroke: currentColor; }
.quick-action strong { font-size: 0.88rem; font-weight: 600; }
.quick-action span { font-size: 0.74rem; color: var(--muted); }

/* ── Toolbar (search + filters + primary action), shared by every list page
   (staff/admin/analytics) so search+filter+CTA rows look identical app-wide ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar-search {
  position: relative;
  flex: 1 1 240px;
  min-width: 180px;
  max-width: 360px;
}
.toolbar-search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  stroke: var(--muted);
  pointer-events: none;
}
.toolbar-search input {
  padding-left: 34px;
  background: var(--bg-soft);
}
.toolbar-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.filter-chip:hover { border-color: var(--gold); color: var(--cream); }
.filter-chip.active {
  border-color: var(--gold);
  background: rgba(201, 169, 78, 0.14);
  color: var(--gold-soft);
  font-weight: 600;
}
.toolbar-spacer { flex: 1; }

/* ── Data table (premium list rendering shared by staff/admin/invoices) ── */
.dt-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.dt {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  background: var(--bg-soft);
}
table.dt thead th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-soft);
  font-weight: 600;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-softer);
  white-space: nowrap;
}
table.dt tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--cream);
  vertical-align: middle;
}
table.dt tbody tr:last-child td { border-bottom: none; }
table.dt tbody tr { transition: background var(--dur) var(--ease); }
table.dt tbody tr:hover { background: rgba(148, 163, 191, 0.05); }
table.dt .cell-actions { text-align: right; white-space: nowrap; }
table.dt .cell-muted { color: var(--muted); }

@media (max-width: 768px) {
  .dt-wrap { border: none; overflow: visible; }
  table.dt thead { display: none; }
  table.dt, table.dt tbody, table.dt tr, table.dt td { display: block; width: 100%; }
  table.dt tr {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 6px 14px;
  }
  table.dt td {
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }
  table.dt td:last-child { border-bottom: none; }
  table.dt td::before {
    content: attr(data-label);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-soft);
    flex: none;
  }
  table.dt .cell-actions { justify-content: flex-start; }
  table.dt .cell-actions::before { display: none; }
}

/* ── Small empty-state block for lists with no rows yet ── */
.dt-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

@media (max-width: 640px) {
  .shell-topbar-title p { display: none; }
  .user-chip-textcol { display: none; }  /* keep just the avatar on narrow screens */
  .shell-topbar { gap: 10px; }
  .lang-toggle { transform: scale(0.94); }
}

@media (max-width: 1024px) {
  .shell-sidebar {
    position: fixed;
    left: 0; top: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .shell-sidebar.open { transform: translateX(0); }
  .shell-backdrop.open { display: block; }
  .shell-menu-btn { display: inline-flex; }
  .shell-content { padding: 20px; }
  .shell-topbar { padding: 14px 16px; }
}

@media (max-width: 480px) {
  .shell-topbar-title h1 { font-size: 1.1rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
