/* ============================================================
   RestoCRM Design System
   Палитра: cool glass + deep ink + teal / amber status accents
   ============================================================ */

:root {
  color-scheme: light;

  /* Color tokens */
  --color-primary: #0a4a50;
  --color-primary-hover: #073b40;
  --color-on-primary: #ffffff;
  --color-secondary: #557891;
  --color-on-secondary: #ffffff;
  --color-accent: #137c78;
  --color-accent-hover: #0f615e;
  --color-accent-text: #08484d;
  --color-accent-soft: #e2f2ef;
  --color-on-accent: #ffffff;
  --color-background: #eaf1f3;
  --color-foreground: #173042;
  --color-card: rgba(255, 255, 255, 0.74);
  --color-card-foreground: #173042;
  --color-muted: rgba(234, 242, 245, 0.75);
  --color-muted-foreground: #284755;
  --color-border: rgba(255, 255, 255, 0.72);
  --color-destructive: #b94f5d;
  --color-destructive-soft: #fae9ec;
  --color-destructive-fg: #983946;
  --color-on-destructive: #ffffff;
  --color-ring: #08484d;

  --color-success: #176c58;
  --color-success-bg: #dff3ea;
  --color-success-border: #b7dfd0;
  --color-warning: #8b5c12;
  --color-warning-bg: #fff0d0;
  --color-warning-border: #e9cd93;

  /* Sidebar */
  --color-sidebar-bg: linear-gradient(176deg, #173042 0%, #244760 55%, #17364b 100%);
  --color-sidebar-fg: #d5e5ed;
  --color-sidebar-fg-strong: #ffffff;
  --color-sidebar-line: rgba(255, 255, 255, 0.18);

  /* Typography */
  --font-heading: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --text-xs: 0.72rem;
  --text-sm: 0.82rem;
  --text-base: 0.92rem;
  --text-lg: 1.05rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.85rem;

  /* Spacing (dense) */
  --space-xs: 0.125rem;
  --space-sm: 0.25rem;
  --space-md: 0.5rem;
  --space-lg: 0.75rem;
  --space-xl: 1rem;
  --space-2xl: 1.5rem;
  --space-3xl: 2rem;

  /* Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 8px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 4px 18px rgba(25, 59, 79, 0.06);
  --shadow-md: 0 10px 28px rgba(25, 59, 79, 0.1);
  --shadow-lg: 0 18px 42px rgba(25, 59, 79, 0.15);
  --shadow-xl: 0 25px 55px rgba(25, 59, 79, 0.2);

  /* Motion */
  --transition-fast: 150ms ease;
  --transition-base: 220ms ease;
  --transition-slow: 300ms ease;

  font-family: var(--font-body);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

html { min-width: 320px; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--color-foreground);
  background: linear-gradient(130deg, #93b9c9 0%, #b5d3df 28%, #b7d4ce 53%, #b7b3cc 78%, #d4e5e8 100%);
  background-attachment: fixed;
  font-size: var(--text-base);
  line-height: 1.5;
}

img, svg { display: inline-block; vertical-align: middle; }

h1, h2, h3 { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
}

h2 {
  margin-bottom: var(--space-lg);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
}

h3 { margin: 0; font-size: var(--text-lg); font-weight: 700; }

p { margin: 0 0 var(--space-md); }

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover { color: var(--color-primary-hover); text-decoration: underline; }

button, input, select { font: inherit; color: inherit; }

.icon {
  width: 1.05em;
  height: 1.05em;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---------- Focus & motion a11y ---------- */
:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */
button, .button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--transition-base),
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-base);
}

button:hover, .button:hover {
  border-color: var(--color-accent-hover);
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--color-on-accent);
}

button:active, .button:active { transform: translateY(0); }

button:disabled, .button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; box-shadow: none; }

button.secondary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary);
}

button.secondary:hover {
  border-color: var(--color-primary-hover);
  background: var(--color-primary-hover);
}

button.ghost, a.ghost {
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-primary);
  box-shadow: none;
}

button.ghost:hover, a.ghost:hover {
  border-color: var(--color-primary);
  background: var(--color-destructive-soft);
  color: var(--color-primary-hover);
  box-shadow: none;
  transform: none;
}

button.danger {
  border: 1px solid var(--color-border);
  background: var(--color-destructive-soft);
  color: var(--color-destructive-fg);
  box-shadow: none;
}

button.danger:hover {
  border-color: var(--color-destructive);
  background: var(--color-destructive);
  color: var(--color-on-destructive);
  box-shadow: var(--shadow-md);
}

button.compact, .button.compact { min-height: 36px; padding: 0.42rem 0.8rem; font-size: var(--text-sm); }

.block { width: 100%; }

.text-link {
  color: var(--color-primary);
  font-weight: 700;
}

.text-link:hover { text-decoration: underline; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.guest-shell { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: var(--space-3xl) var(--space-xl); }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  width: 220px;
  min-width: 220px;
  min-height: 100vh;
  flex-direction: column;
  gap: var(--space-2xl);
  padding: 1.9rem var(--space-xl) var(--space-xl);
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-fg);
  box-shadow: 8px 0 30px rgba(17, 48, 69, 0.12);
}

.sidebar-header { padding: 0 var(--space-sm); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--color-sidebar-fg-strong);
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
}

.brand:hover { color: var(--color-sidebar-fg-strong); text-decoration: none; }
.brand .icon { width: 1.4em; height: 1.4em; color: #9bd7d0; }
.brand span, h1 span { color: var(--color-accent); }
.sidebar .brand span { color: #9bd7d0; }

.sidebar-nav { display: grid; gap: var(--space-xs); }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.68rem 0.8rem;
  color: var(--color-sidebar-fg);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast);
}

.sidebar-nav a .icon { opacity: 0.85; }

.sidebar-nav a:hover { color: var(--color-sidebar-fg-strong); background: rgba(255, 255, 255, 0.08); text-decoration: none; }

.sidebar-nav a.active {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.18);
  color: var(--color-sidebar-fg-strong);
  font-weight: 700;
}

.userbox {
  display: grid;
  gap: var(--space-md);
  margin-top: auto;
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-sidebar-line);
  color: var(--color-sidebar-fg);
  font-size: var(--text-sm);
}

.user-role { font-weight: 600; line-height: 1.4; }

.userbox form { margin: 0; }

.userbox button.ghost, .userbox a.ghost {
  min-height: 38px;
  justify-content: flex-start;
  gap: var(--space-md);
  border-color: transparent;
  padding: 0.45rem 0.6rem;
  background: transparent;
  color: var(--color-sidebar-fg);
  font-weight: 600;
}

.userbox button.ghost:hover, .userbox a.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-sidebar-fg-strong);
}

/* Theme toggle switch */
.theme-toggle { position: relative; display: flex !important; width: 100%; align-items: center; }
.userbox button.ghost.theme-toggle { padding-right: 3.4rem; }
.theme-toggle::after {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 36px;
  height: 22px;
  border: 1px solid var(--color-sidebar-line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
  content: "";
  transform: translateY(-50%);
  transition: background-color var(--transition-base);
}
.theme-toggle::before {
  position: absolute;
  top: 50%;
  right: 27px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  content: "";
  transform: translateY(-50%);
  transition: right var(--transition-base);
}
.theme-toggle[aria-pressed="true"]::after { background: var(--color-accent); }
.theme-toggle[aria-pressed="true"]::before { right: 11px; }

.app-main { flex: 1; min-width: 0; }
.workspace-bar {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 20px clamp(var(--space-xl), 3vw, var(--space-3xl)) 0;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.67);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.workspace-context { display: grid; gap: 0.1rem; }
.workspace-context span { color: var(--color-muted-foreground); font-size: var(--text-xs); font-weight: 600; }
.workspace-context time { color: var(--color-foreground); font-family: var(--font-heading); font-size: 0.94rem; font-weight: 700; }
.workspace-meta { display: flex; align-items: center; gap: 1.3rem; }
.workspace-account { display: inline-flex; align-items: center; gap: 0.65rem; color: var(--color-foreground); font-size: var(--text-sm); font-weight: 600; }
.workspace-account:hover { color: var(--color-primary); text-decoration: none; }
.workspace-avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 50%; background: #d5eae8; color: #145d5c; font-family: var(--font-heading); font-weight: 800; }
.guest-main { display: flex; width: 100%; justify-content: center; }
.guest-main-inner { display: grid; width: min(440px, 92vw); min-height: 100vh; place-items: center; }

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.7rem clamp(var(--space-xl), 3vw, var(--space-3xl)) var(--space-3xl);
}

/* ---------- Page scaffolding ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.page-head > * { min-width: 0; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: 0 0 var(--space-sm);
  color: var(--color-accent-text);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow a { color: inherit; }
.eyebrow a:hover { text-decoration: underline; }

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-2xl) 0 var(--space-lg);
}

/* ---------- Surfaces: cards & panels ---------- */
.panel, .panel-glass, .card, .bill, .auth-card,
.stats article, .table-card, .menu-item, .menu-window {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.panel, .stats article, .table-card { padding: var(--space-xl) var(--space-xl); }

.panel-glass.form-grid { padding: var(--space-xl); }

.empty-panel {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-xl);
  background: var(--color-muted);
  color: var(--color-muted-foreground);
  font-weight: 600;
  text-align: center;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  border: 1px solid var(--color-success-border);
  border-radius: var(--radius-pill);
  padding: 0.22rem 0.65rem;
  background: var(--color-success-bg);
  color: var(--color-success);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.badge .icon { width: 0.9em; height: 0.9em; }

.badge.free { border-color: var(--color-success-border); background: var(--color-success-bg); color: var(--color-success); }
.badge.occupied { border-color: var(--color-warning-border); background: var(--color-warning-bg); color: var(--color-warning); }
.badge.accent { border-color: #b9ded7; background: var(--color-accent-soft); color: var(--color-accent-text); }
.badge.muted { border-color: var(--color-border); background: var(--color-muted); color: var(--color-muted-foreground); }

/* ---------- Flash / alerts ---------- */
.flashes { display: grid; gap: var(--space-md); margin-bottom: var(--space-xl); }

.flash {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  border: 1px solid var(--color-border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.95rem;
  background: var(--color-card);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.flash .icon { margin-top: 0.15em; width: 1.15em; height: 1.15em; }

.flash.success { border-color: var(--color-success-border); border-left-color: var(--color-success); background: var(--color-success-bg); color: var(--color-success); }
.flash.error { border-color: var(--color-border); border-left-color: var(--color-destructive); background: var(--color-destructive-soft); color: var(--color-destructive-fg); }

.success-note {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  border: 1px solid var(--color-success-border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  background: var(--color-success-bg);
  color: var(--color-success);
  font-weight: 600;
}

/* ---------- Forms ---------- */
label {
  display: grid;
  gap: var(--space-sm);
  color: var(--color-muted-foreground);
  font-size: var(--text-sm);
  font-weight: 700;
}

input, select {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.78rem;
  outline: none;
  background: rgba(255, 255, 255, 0.86);
  color: var(--color-foreground);
  font-size: var(--text-base);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

input::placeholder { color: var(--color-muted-foreground); opacity: 1; }

input:focus, select:focus {
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px rgba(19, 124, 120, 0.16);
}

input:disabled, select:disabled { cursor: not-allowed; opacity: 0.6; background: var(--color-muted); }

input[type="checkbox"] { width: auto; min-width: 18px; min-height: 18px; accent-color: var(--color-primary); cursor: pointer; }

input[readonly] { background: var(--color-muted); color: var(--color-muted-foreground); }

.stack { display: grid; gap: var(--space-xl); margin-top: var(--space-2xl); }

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  min-width: 0;
}

.form-grid > *, .filter-form > *, .page-head > * { min-width: 0; }

.staff-form { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; }

.staff-name-form { display: flex; width: 100%; min-width: 0; max-width: 100%; align-items: center; gap: var(--space-md); }
.staff-name-form input { flex: 1 1 0; width: 0; min-width: 0; }
.staff-name-form button { flex: 0 0 auto; white-space: nowrap; }

.inline-form { display: flex; align-items: flex-end; gap: var(--space-lg); }

.category-form { margin-bottom: var(--space-xl); }
.category-form label { min-width: min(100%, 260px); }

.filter-form {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr) auto auto;
  align-items: end;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  padding: var(--space-xl);
  min-width: 0;
}

.history-filter { grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(145px, 1fr)) auto auto; }

.profile-form { display: grid; max-width: 520px; gap: var(--space-xl); }
.profile-form button { justify-self: start; }

.password-form { display: grid; max-width: 520px; gap: var(--space-xl); }
.password-form button { justify-self: start; }

.add-table-form {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-sm);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
}

.add-table-form input { width: auto; min-width: 90px; min-height: 40px; border-color: transparent; background: var(--color-muted); }
.add-table-form input:focus { border-color: var(--color-ring); }
.add-table-form button { min-height: 40px; padding: 0.55rem 0.9rem; white-space: nowrap; }

/* ---------- Tables ---------- */
.table-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

.data { width: 100%; border-collapse: collapse; }

.data th, .data td {
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 0.55rem;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.data th {
  color: var(--color-muted-foreground);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.data tbody tr:last-child td { border-bottom: 0; }
.data tbody tr:hover { background: rgba(226, 241, 242, 0.55); }
.data td form { min-width: 0; }
.data td > form > button, .data td.actions button { min-width: 84px; white-space: nowrap; }
.data td.actions { width: 1%; white-space: nowrap; }
.data td.actions form { flex: 0 0 auto; }

.actions, .row-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-md); max-width: 100%; }

.staff-table { min-width: 720px; }
.staff-table th:nth-child(1) { width: 40%; }
.staff-table th:nth-child(2) { width: 23%; }
.staff-table th:nth-child(3) { width: 17%; }
.staff-table th:nth-child(4) { width: 20%; }

.category-table { min-width: 680px; }

.product-table { min-width: 900px; }
.product-table th:last-child { width: 300px; }
.product-table td.actions { display: flex; width: 300px; align-items: center; justify-content: flex-start; gap: var(--space-md); }
.product-table td.actions form { margin: 0; }
.product-table td.actions button { min-width: 96px; }

.bill-table { min-width: 600px; }

/* ---------- Dashboard ---------- */
.dashboard-page { padding-top: 0.2rem; }

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  margin-bottom: 1.25rem;
}

.dashboard-header > * { min-width: 0; }
.header-copy { display: grid; gap: var(--space-xs); }

.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-lg); margin-bottom: var(--space-xl); }
.overview-card { display: flex; min-width: 0; min-height: 132px; flex-direction: column; justify-content: space-between; border: 1px solid rgba(255, 255, 255, 0.8); border-radius: var(--radius); padding: 1rem 1.15rem; background: rgba(255, 255, 255, 0.72); box-shadow: var(--shadow-sm); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.overview-card:nth-child(2) { border-top: 3px solid #d99a35; }
.overview-card:nth-child(3) { border-top: 3px solid #3b86a9; }
.overview-card:nth-child(4) { border-top: 3px solid #137c78; }
.overview-label { color: var(--color-muted-foreground); font-size: var(--text-sm); font-weight: 600; }
.overview-card strong { color: var(--color-foreground); font-family: var(--font-heading); font-size: 1.55rem; font-weight: 800; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.overview-detail { color: var(--color-muted-foreground); font-size: var(--text-xs); font-weight: 600; }
.overview-link { align-self: flex-start; color: var(--color-primary); }
.overview-link:hover { color: var(--color-primary-hover); }

.capacity-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.capacity-copy { display: grid; gap: 0.1rem; min-width: 0; }
.capacity-copy .panel-kicker { margin: 0; }
.capacity-copy strong { font-family: var(--font-heading); font-size: var(--text-base); }
.capacity-meter-wrap { display: flex; width: min(42%, 380px); min-width: 180px; align-items: center; gap: 0.85rem; }
.capacity-meter-wrap > span { flex: 0 0 auto; color: var(--color-muted-foreground); font-size: var(--text-sm); }
.capacity-meter { width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: var(--radius-pill); background: var(--color-muted); }
.capacity-meter::-webkit-progress-bar { border-radius: var(--radius-pill); background: var(--color-muted); }
.capacity-meter::-webkit-progress-value { border-radius: var(--radius-pill); background: var(--color-accent); }
.capacity-meter::-moz-progress-bar { border-radius: var(--radius-pill); background: var(--color-accent); }

.room-panel { border: 0; padding: 0; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }

.panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.panel-topline > * { min-width: 0; }
.panel-topline h2 { margin: 0; }
.room-filters { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; border: 1px solid rgba(94, 129, 144, 0.18); border-radius: var(--radius-sm); padding: 0.22rem; background: rgba(232, 241, 244, 0.66); }
.room-filter { min-height: 34px; border: 0; border-radius: 4px; padding: 0.35rem 0.65rem; background: transparent; color: var(--color-muted-foreground); font-size: var(--text-sm); font-weight: 600; box-shadow: none; }
.room-filter:hover { border: 0; background: rgba(255, 255, 255, 0.72); color: var(--color-foreground); box-shadow: none; transform: none; }
.room-filter.active { background: #ffffff; color: var(--color-primary); box-shadow: var(--shadow-sm); }
.room-filter span { margin-left: 0.25rem; font-size: var(--text-xs); }
.filter-empty { margin: 1.5rem 0 0; color: var(--color-muted-foreground); }

.panel-kicker {
  display: inline-block;
  margin-bottom: var(--space-sm);
  color: var(--color-accent-text);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.room-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  border: 1px solid #b9ded7;
  border-radius: var(--radius-pill);
  padding: 0.38rem 0.7rem;
  background: var(--color-accent-soft);
  color: var(--color-accent-text);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}

.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-lg); }

.table-card {
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

.table-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--color-success);
  content: "";
}

.table-card:hover { transform: translateY(-2px); border-color: rgba(19, 124, 120, 0.5); box-shadow: var(--shadow-md); }
.table-card.occupied { background: rgba(255, 251, 242, 0.82); }
.table-card.occupied::before { background: #d99a35; }
.table-card p { margin: var(--space-sm) 0; }

.table-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-lg); }
.table-card-top > * { min-width: 0; }
.table-name-wrap h3 { margin: var(--space-xs) 0 0; font-family: var(--font-heading); font-size: 1.5rem; }

.table-label {
  display: block;
  color: var(--color-muted-foreground);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.table-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  color: var(--color-muted-foreground);
  font-size: var(--text-sm);
  font-weight: 600;
}

.sum { margin-top: var(--space-lg) !important; font-size: var(--text-lg); font-weight: 700; }

.sidebar-stack { display: grid; gap: var(--space-xl); }
.sidebar-panel { padding: var(--space-xl); }
.stat-list { display: grid; gap: var(--space-md); }

.mini-stat {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
  background: var(--color-card);
}

.mini-stat span { display: flex; align-items: center; gap: var(--space-sm); color: var(--color-muted-foreground); font-size: var(--text-sm); font-weight: 600; overflow-wrap: anywhere; }
.mini-stat strong { font-size: var(--text-lg); overflow-wrap: anywhere; }
.mini-stat.accent { border-color: #b9ded7; background: var(--color-accent-soft); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-xl); margin-bottom: var(--space-2xl); }
.stats article { transition: box-shadow var(--transition-base), transform var(--transition-base); }
.stats article:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stats span { display: block; color: var(--color-muted-foreground); font-size: var(--text-sm); font-weight: 600; }
.stats strong { display: block; margin-top: var(--space-sm); font-size: 1.6rem; font-weight: 700; }

/* ---------- Order page ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr); align-items: start; gap: var(--space-xl); min-width: 0; }

.menu-list { display: grid; gap: var(--space-md); }

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: 0.8rem 0.9rem;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.menu-item:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.menu-item > * { min-width: 0; }
.menu-item div { display: grid; flex: 1; gap: var(--space-xs); }
.menu-item span { color: var(--color-muted-foreground); font-size: var(--text-sm); font-weight: 600; }
.menu-item input, .qty input { width: 76px; }

.check { position: sticky; top: var(--space-2xl); }
.check ul { margin: var(--space-xl) 0; padding: 0; list-style: none; }

.check li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--color-border);
}

.check li > * { min-width: 0; }
.check li span { display: block; color: var(--color-muted-foreground); font-size: var(--text-sm); }

.qty { display: flex; align-items: center; gap: var(--space-md); }
.qty input { padding: 0.4rem 0.55rem; min-height: 38px; }

.total { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-xl); margin: var(--space-xl) 0; }
.total strong { font-size: 1.6rem; font-weight: 700; }

/* ---------- Bill ---------- */
.narrow { max-width: 760px; margin: 0 auto; }

.bill { padding: clamp(var(--space-xl), 4vw, var(--space-3xl)); box-shadow: var(--shadow-md); }
.bill.paid { border-color: var(--color-success-border); }

.pay-row { display: flex; align-items: center; gap: var(--space-xl); margin: var(--space-xl) 0 var(--space-lg); }
.pay-row button { flex: 1; }

/* ---------- Menu windows (details) ---------- */
.menu-window { margin-bottom: var(--space-xl); border: 0; padding: 0; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }

.menu-window > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  border-bottom: 1px solid rgba(80, 112, 128, 0.22);
  padding: var(--space-xl) var(--space-xs);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.menu-window > summary::-webkit-details-marker { display: none; }

.menu-window > summary::after {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-accent);
  content: "+";
  font-family: var(--font-body);
  font-size: 1.1rem;
  transition: transform var(--transition-base), background-color var(--transition-base);
}

.menu-window[open] > summary::after { content: "−"; background: var(--color-accent-soft); }

.menu-window-content { padding-bottom: var(--space-lg); }

.create-product { margin-bottom: var(--space-xl); }
.create-product > summary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  background: var(--color-card);
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: 700;
  list-style: none;
  cursor: pointer;
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.create-product > summary::-webkit-details-marker { display: none; }
.create-product > summary::before { content: "+"; font-size: 1.1rem; line-height: 1; }
.create-product[open] > summary::before { content: "−"; }
.create-product > summary:hover { border-color: var(--color-primary); background: var(--color-muted); }
.create-product > .form-grid { margin-top: var(--space-lg); }

.category-delete-form { display: flex; max-width: 100%; align-items: center; gap: var(--space-md); }
.category-delete-form select { min-width: 220px; }

/* ---------- History ---------- */
.history-list { overflow: hidden; padding: 0; }

.history-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  padding: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.select-all-label { display: flex; align-items: center; gap: var(--space-md); cursor: pointer; }
.select-all-label input, .history-order-select, #select-all-orders { width: auto; min-width: 18px; min-height: 18px; cursor: pointer; }

.history-table-scroll, .invoice-items-scroll { overflow-x: auto; border-radius: var(--radius-sm); }
.history-table { min-width: 760px; margin: 0; table-layout: auto; }
.history-table td { vertical-align: top; }

.invoice-details > summary {
  color: var(--color-primary);
  font-weight: 700;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: color var(--transition-fast);
}

.invoice-details > summary:hover { color: var(--color-primary-hover); }
.invoice-items { min-width: 630px; margin: var(--space-lg) 0; table-layout: auto; background: var(--color-muted); }
.invoice-items th, .invoice-items td { padding: 0.55rem 0.45rem; }

/* ---------- Auth ---------- */
.auth { display: grid; width: 100%; place-items: center; }

.auth-card { width: min(440px, 92vw); padding: clamp(var(--space-2xl), 5vw, var(--space-3xl)); box-shadow: var(--shadow-lg); }
.auth-card .eyebrow { margin-bottom: var(--space-md); }
.auth-card h1 { font-size: 2.2rem; }
.auth-card .muted { margin: var(--space-md) 0 var(--space-xl); }
.auth-card button { width: 100%; }

/* ---------- Utility text ---------- */
.empty { padding: var(--space-xl) 0; color: var(--color-muted-foreground); }
.muted, .hint { color: var(--color-muted-foreground); }
.hint { font-size: var(--text-sm); }

.menu-item strong, .check li strong, .user-role, .muted, .hint, .empty, .success-note, .room-tag, .badge { overflow-wrap: anywhere; }

/* ============================================================
   Dark theme
   ============================================================ */
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #b6b9ff;
  --color-primary-hover: #d2d3ff;
  --color-on-primary: #11131c;
  --color-accent: #5e63d9;
  --color-accent-hover: #7378ed;
  --color-accent-text: #b6b9ff;
  --color-on-accent: #ffffff;
  --color-ring: #afb3ff;
  --color-background: #101218;
  --color-foreground: #f2f3f8;
  --color-card: rgba(29, 32, 43, 0.88);
  --color-card-foreground: #f2f3f8;
  --color-muted: rgba(40, 44, 58, 0.92);
  --color-muted-foreground: #abb2c1;
  --color-border: rgba(166, 173, 199, 0.18);
  --color-destructive-soft: #3f2835;
  --color-destructive-fg: #ffb8c6;
  --color-success: #8de0b7;
  --color-success-bg: #173e35;
  --color-success-border: #346e5c;
  --color-warning: #ffd38c;
  --color-warning-bg: #4b3825;
  --color-warning-border: #7f6038;
  --color-accent-soft: #292c53;
  --color-sidebar-bg: #171922;
  --color-sidebar-fg: #b5bac8;
  --color-sidebar-line: rgba(188, 193, 212, 0.14);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 38px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 28px 50px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] body {
  background: #101218;
}

:root[data-theme="dark"] .sidebar { border-right: 1px solid var(--color-sidebar-line); box-shadow: none; }
:root[data-theme="dark"] .brand .icon, :root[data-theme="dark"] .sidebar .brand span { color: #a8adff; }
:root[data-theme="dark"] .sidebar-nav a.active { border-color: rgba(146, 151, 255, 0.18); background: rgba(105, 110, 222, 0.18); color: #e6e7ff; }
:root[data-theme="dark"] .sidebar-nav a.active .icon { color: #b6b9ff; }
:root[data-theme="dark"] .table-card.occupied { background: rgba(48, 41, 38, 0.88); }
:root[data-theme="dark"] .table-card::before { background: #73d5ab; }
:root[data-theme="dark"] .table-card.occupied::before { background: #e4ad64; }
:root[data-theme="dark"] .table-card:hover { border-color: rgba(168, 173, 255, 0.42); }
:root[data-theme="dark"] .data tbody tr:hover { background: rgba(170, 177, 230, 0.07); }
:root[data-theme="dark"] button.ghost, :root[data-theme="dark"] a.ghost { background: transparent; }
:root[data-theme="dark"] .userbox button.ghost, :root[data-theme="dark"] .userbox a.ghost { background: transparent; }
:root[data-theme="dark"] .invoice-items { background: var(--color-muted); }
:root[data-theme="dark"] .badge.accent, :root[data-theme="dark"] .room-tag, :root[data-theme="dark"] .mini-stat.accent { border-color: #54589d; color: #c3c6ff; }
:root[data-theme="dark"] .add-table-form input { background: var(--color-muted); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select { background: #222532; }
:root[data-theme="dark"] .room-panel, :root[data-theme="dark"] .menu-window { background: transparent; }
:root[data-theme="dark"] .workspace-bar, :root[data-theme="dark"] .overview-card { border-color: var(--color-border); background: var(--color-card); }
:root[data-theme="dark"] .workspace-bar { margin-top: 0; border-top: 0; border-right: 0; border-left: 0; border-radius: 0; padding-right: 0; padding-left: 0; background: transparent; box-shadow: none; }
:root[data-theme="dark"] .workspace-avatar { background: #333760; color: #e8e9ff; }
:root[data-theme="dark"] .room-filters { border-color: var(--color-border); background: var(--color-muted); }
:root[data-theme="dark"] .room-filter.active { background: #494d87; color: #ffffff; }
:root[data-theme="dark"] .room-filter:hover { background: #40446f; color: #ffffff; }
:root[data-theme="dark"] .overview-card strong { color: var(--color-foreground); }
:root[data-theme="dark"] .overview-card { min-height: 144px; padding: 1.1rem 1.2rem; }
:root[data-theme="dark"] .overview-card::before { display: block; width: 31px; height: 4px; border-radius: var(--radius-pill); background: #9d9fff; content: ""; }
:root[data-theme="dark"] .overview-card-orders::before { background: #f1bd78; }
:root[data-theme="dark"] .overview-card-revenue::before { background: #83cbef; }
:root[data-theme="dark"] .overview-card-menu::before { background: #7dd4ae; }
:root[data-theme="dark"] .overview-card:nth-child(n) { border-top: 1px solid var(--color-border); }
:root[data-theme="dark"] .overview-card strong { font-size: 1.65rem; }
:root[data-theme="dark"] .capacity-strip { background: rgba(27, 31, 41, 0.76); }
:root[data-theme="dark"] .capacity-meter::-webkit-progress-value { background: #8f92f9; }
:root[data-theme="dark"] .capacity-meter::-moz-progress-bar { background: #8f92f9; }
:root[data-theme="dark"] .create-product > summary { border-color: var(--color-border); }
:root[data-theme="dark"] .menu-window > summary { border-color: var(--color-border); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1050px) {
  .sidebar { width: 202px; min-width: 202px; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid.staff-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .app-shell { display: block; }
  .guest-main-inner { width: min(440px, 100%); }

  .sidebar {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: auto;
    gap: var(--space-md);
    padding: var(--space-lg) var(--space-xl);
  }

  .sidebar-header { padding: 0; }

  .sidebar-nav {
    display: flex;
    gap: var(--space-xs);
    overflow-x: auto;
    padding-bottom: var(--space-xs);
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-nav a { flex: 0 0 auto; padding: 0.5rem 0.7rem; font-size: var(--text-sm); }

  .userbox { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); margin-top: 0; padding-top: var(--space-md); }
  .userbox .user-role { display: none; }
  .userbox .theme-toggle { width: auto !important; }
  .userbox button.ghost, .userbox a.ghost { min-height: 34px; padding-top: 0.35rem; padding-bottom: 0.35rem; }

  main { padding: var(--space-2xl) var(--space-xl); }

  .page-head, .dashboard-header { align-items: flex-start; }
  .dashboard-header { flex-wrap: wrap; }
  .add-table-form { flex: 1 1 350px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; gap: var(--space-xl); }
  .check { position: static; }
  .form-grid, .staff-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-form, .history-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-bulk-actions { align-items: flex-start; flex-direction: column; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .sidebar-stack { grid-template-columns: 1fr; }
  .workspace-bar { margin-top: var(--space-xl); }
}

@media (max-width: 560px) {
  .guest-shell { padding: var(--space-xl); }
  .workspace-bar { gap: 0.5rem; padding: 0.8rem 1rem; }
  .workspace-context time { font-size: var(--text-sm); }
  .workspace-meta { gap: 0.6rem; }
  .workspace-account > span:last-child { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-head, .dashboard-header, .panel-topline { display: grid; }
  .page-head { gap: var(--space-lg); }
  .add-table-form { width: 100%; flex-wrap: wrap; }
  .add-table-form input { flex: 1; min-width: 70px; }
  .add-table-form button { flex: 1; }
  .stats { gap: var(--space-md); }
  .stats article { padding: var(--space-lg); }
  .stats strong { font-size: 1.3rem; }
  .room-panel { padding: 0; }
  .room-grid { grid-template-columns: 1fr; }
  .overview-grid { gap: var(--space-md); }
  .overview-card { min-height: 120px; padding: 0.8rem; }
  .overview-card strong { font-size: 1.3rem; white-space: normal; overflow-wrap: anywhere; }
  .capacity-strip { align-items: stretch; flex-direction: column; gap: var(--space-lg); }
  .capacity-meter-wrap { width: 100%; }
  .room-filters { width: 100%; }
  .room-filter { flex: 1 1 auto; }
  .form-grid, .staff-form, .filter-form, .history-filter { grid-template-columns: 1fr; }
  .staff-name-form { min-width: 0; }
  .menu-item { flex-wrap: wrap; }
  .menu-item div { flex-basis: 100%; }
  .menu-item input { flex: 1; }
  .category-delete-form { align-items: stretch; flex-direction: column; }
  .category-delete-form select { min-width: 0; }
  .row-actions { flex-wrap: wrap; }
  .check li { grid-template-columns: minmax(0, 1fr) auto; }
  .check li > div { grid-column: 1 / -1; }
  .check li .qty { grid-column: 1; }
  .check li > b { grid-column: 2; text-align: right; }
  .check li .qty button { min-height: 38px; padding: 0.35rem 0.55rem; }
  .bill .pay-row { align-items: stretch; flex-direction: column; }
  .total strong { font-size: 1.4rem; }
  .data th, .data td { padding: 0.68rem 0.42rem; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Pulse-inspired iOS surfaces, adapted to the server-rendered restaurant CRM. */
:root {
  color-scheme: light;
  --color-primary: #006ee6;
  --color-primary-hover: #0059bd;
  --color-on-primary: #fff;
  --color-accent: #007aff;
  --color-accent-hover: #0069dc;
  --color-accent-text: #006ee6;
  --color-accent-soft: #e8f2ff;
  --color-on-accent: #fff;
  --color-background: #f2f2f7;
  --color-foreground: #1c1c1e;
  --color-card: #fff;
  --color-card-foreground: #1c1c1e;
  --color-muted: #f2f2f7;
  --color-muted-foreground: #62646c;
  --color-border: rgba(60, 60, 67, 0.14);
  --color-destructive: #d92e27;
  --color-destructive-soft: #fff0ef;
  --color-destructive-fg: #b5211d;
  --color-ring: #007aff;
  --color-success: #187f35;
  --color-success-bg: #e8f8ec;
  --color-success-border: #bce9c7;
  --color-warning: #965600;
  --color-warning-bg: #fff3df;
  --color-warning-border: #f2d4a0;
  --color-sidebar-bg: rgba(245, 245, 250, 0.78);
  --color-sidebar-fg: #383a42;
  --color-sidebar-fg-strong: #1c1c1e;
  --color-sidebar-line: rgba(60, 60, 67, 0.13);
  --font-heading: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.16);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #6cb5ff;
  --color-primary-hover: #a2d0ff;
  --color-on-primary: #fff;
  --color-accent: #0a84ff;
  --color-accent-hover: #389bff;
  --color-accent-text: #7dbbff;
  --color-accent-soft: #15314e;
  --color-on-accent: #fff;
  --color-background: #000;
  --color-foreground: #f2f2f7;
  --color-card: #1c1c1e;
  --color-card-foreground: #f2f2f7;
  --color-muted: #2c2c2e;
  --color-muted-foreground: #b5b5bf;
  --color-border: rgba(120, 120, 128, 0.38);
  --color-destructive-soft: #3d2020;
  --color-destructive-fg: #ff9b95;
  --color-success: #82e89a;
  --color-success-bg: #173d24;
  --color-success-border: #326e43;
  --color-warning: #ffd087;
  --color-warning-bg: #49351d;
  --color-warning-border: #78552a;
  --color-sidebar-bg: rgba(28, 28, 30, 0.8);
  --color-sidebar-fg: #c6c6d0;
  --color-sidebar-fg-strong: #f2f2f7;
  --color-sidebar-line: rgba(120, 120, 128, 0.32);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

body, :root[data-theme="dark"] body { background: var(--color-background); }
body { font-family: var(--font-body); }
h1 { font-size: 2rem; line-height: 1.12; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
a, button, input, select { -webkit-tap-highlight-color: transparent; }
button, .button { font-weight: 600; }
button:hover, .button:hover { box-shadow: none; transform: none; }
button:active, .button:active { opacity: 0.72; transform: scale(0.985); }
button.ghost:hover, a.ghost:hover { border-color: var(--color-border); background: var(--color-muted); color: var(--color-primary); }
button.danger { border-color: transparent; }

.sidebar {
  width: 240px;
  min-width: 240px;
  gap: 1rem;
  border-right: 1px solid var(--color-sidebar-line);
  padding: 1.5rem 0.8rem 1.2rem;
  background: var(--color-sidebar-bg);
  box-shadow: none;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.sidebar-header { padding: 0 0.45rem 0.65rem; }
.brand { gap: 0.65rem; color: var(--color-sidebar-fg-strong); font-size: 1rem; }
.brand:hover { color: var(--color-sidebar-fg-strong); }
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(150deg, #007aff, #5856d6);
  color: #fff;
  font-size: 0.94rem;
  font-weight: 800;
}
.brand-copy { display: grid; gap: 0.05rem; color: var(--color-sidebar-fg-strong) !important; }
.brand-copy strong { line-height: 1.15; }
.brand-copy small { color: var(--color-muted-foreground); font-size: 0.69rem; font-weight: 500; }
.sidebar-nav { gap: 0.1rem; }
.sidebar-nav a { min-height: 42px; border: 0; border-radius: 9px; padding: 0.58rem 0.8rem; color: var(--color-sidebar-fg); font-weight: 500; }
.sidebar-nav a:hover { background: rgba(120, 120, 128, 0.12); color: var(--color-sidebar-fg-strong); }
.sidebar-nav a.active, :root[data-theme="dark"] .sidebar-nav a.active { border: 0; background: rgba(120, 120, 128, 0.15); color: var(--color-primary); font-weight: 650; }
.sidebar-nav a.active .icon, :root[data-theme="dark"] .sidebar-nav a.active .icon { color: var(--color-primary); }
.userbox { gap: 0.25rem; padding: 0.9rem 0.3rem 0; }
.user-role { padding: 0 0.55rem 0.4rem; color: var(--color-muted-foreground); font-size: 0.75rem; }
.userbox button.ghost, .userbox a.ghost { min-height: 38px; border-radius: 9px; color: var(--color-sidebar-fg); }
.userbox button.ghost:hover, .userbox a.ghost:hover, :root[data-theme="dark"] .userbox button.ghost:hover, :root[data-theme="dark"] .userbox a.ghost:hover { background: rgba(120, 120, 128, 0.14); color: var(--color-sidebar-fg-strong); }

.workspace-bar, :root[data-theme="dark"] .workspace-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: 70px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--color-sidebar-line);
  border-radius: 0;
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
  background: var(--color-sidebar-bg);
  box-shadow: none;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.workspace-context span { font-size: 0.7rem; }
.workspace-context time { font-family: var(--font-body); font-size: 0.9rem; }
.workspace-meta { gap: 0.7rem; }
.workspace-avatar, :root[data-theme="dark"] .workspace-avatar { background: #e6edff; color: #005ec7; }
:root[data-theme="dark"] .workspace-avatar { background: #263c60; color: #a9d3ff; }
.workspace-account { cursor: pointer; }
.workspace-account:hover { color: var(--color-foreground); }
.workspace-menu { position: relative; }
.workspace-menu summary { list-style: none; }
.workspace-menu summary::-webkit-details-marker { display: none; }
.workspace-menu-panel {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  display: grid;
  width: 190px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0.35rem;
  background: var(--color-card);
  box-shadow: var(--shadow-md);
}
.workspace-menu-panel a, .workspace-menu-panel button { display: block; width: 100%; min-height: 38px; border: 0; border-radius: 7px; padding: 0.55rem 0.7rem; background: transparent; color: var(--color-foreground); font-size: 0.86rem; font-weight: 500; text-align: left; }
.workspace-menu-panel a:hover, .workspace-menu-panel button:hover { background: var(--color-muted); color: var(--color-foreground); text-decoration: none; }
.workspace-menu-panel form { margin: 0; }
.theme-toggle { display: grid; width: 36px; height: 36px; min-height: 36px; place-items: center; border: 0; border-radius: 50%; padding: 0; background: rgba(120, 120, 128, 0.14); color: var(--color-foreground); }
.theme-toggle:hover { border: 0; background: rgba(120, 120, 128, 0.25); color: var(--color-foreground); }
.theme-toggle::before, .theme-toggle::after { content: none; }
.theme-toggle .icon { width: 18px; height: 18px; }
.theme-sun, :root[data-theme="dark"] .theme-moon { display: none; }
:root[data-theme="dark"] .theme-sun { display: inline-block; }
.mobile-brand, .mobile-tabs { display: none; }

main { max-width: 1190px; padding-top: 1.55rem; }
.eyebrow, .panel-kicker { color: var(--color-muted-foreground); font-size: 0.72rem; font-weight: 600; }
.page-head { margin-bottom: 1.3rem; }
.panel, .panel-glass, .card, .bill, .auth-card, .stats article, .table-card, .menu-item, .menu-window, .overview-card, :root[data-theme="dark"] .overview-card {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.panel, .stats article, .table-card { padding: 1rem; }
.panel-glass.form-grid { padding: 1rem; }
.empty-panel { border-color: var(--color-border); background: var(--color-card); }
.badge { border-radius: 999px; }
input, select, :root[data-theme="dark"] input, :root[data-theme="dark"] select { border-color: var(--color-border); border-radius: 9px; background: var(--color-muted); }
input:focus, select:focus { box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.14); }
.data th, .data td { border-color: var(--color-border); }
.data tbody tr:hover, :root[data-theme="dark"] .data tbody tr:hover { background: var(--color-muted); }
.filter-form { padding: 1rem; }

.dashboard-header { align-items: flex-end; margin-bottom: 1.1rem; }
.header-copy { gap: 0.15rem; }
.overview-grid { gap: 0.75rem; margin-bottom: 1rem; }
.overview-card, :root[data-theme="dark"] .overview-card { min-height: 140px; padding: 1rem; }
.overview-card::before, :root[data-theme="dark"] .overview-card::before { position: absolute; top: 1rem; right: 1rem; width: 9px; height: 9px; border-radius: 50%; background: #007aff; content: ""; }
.overview-card-orders::before, :root[data-theme="dark"] .overview-card-orders::before { background: #af52de; }
.overview-card-revenue::before, :root[data-theme="dark"] .overview-card-revenue::before { background: #34c759; }
.overview-card-menu::before, :root[data-theme="dark"] .overview-card-menu::before { background: #ff9500; }
.overview-card { position: relative; }
.overview-card strong, :root[data-theme="dark"] .overview-card strong { font-family: var(--font-body); font-size: 1.55rem; font-weight: 700; }
.overview-label { color: var(--color-muted-foreground); }
.overview-detail { font-size: 0.72rem; }
.overview-card:nth-child(n), :root[data-theme="dark"] .overview-card:nth-child(n) { border-top: 1px solid var(--color-border); }
.capacity-strip, :root[data-theme="dark"] .capacity-strip { border: 1px solid var(--color-border); border-radius: 14px; background: var(--color-card); }
.capacity-meter::-webkit-progress-value, :root[data-theme="dark"] .capacity-meter::-webkit-progress-value { background: var(--color-accent); }
.capacity-meter::-moz-progress-bar, :root[data-theme="dark"] .capacity-meter::-moz-progress-bar { background: var(--color-accent); }
.room-panel, :root[data-theme="dark"] .room-panel { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.room-filters, :root[data-theme="dark"] .room-filters { border: 0; border-radius: 9px; background: rgba(120, 120, 128, 0.14); }
.room-filter.active, :root[data-theme="dark"] .room-filter.active { border-radius: 7px; background: var(--color-card); color: var(--color-foreground); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.13); }
.room-filter:hover, :root[data-theme="dark"] .room-filter:hover { background: var(--color-card); color: var(--color-foreground); }
.table-card.occupied, :root[data-theme="dark"] .table-card.occupied { background: var(--color-card); }
.table-card::before, :root[data-theme="dark"] .table-card::before { width: 3px; background: #34c759; }
.table-card.occupied::before, :root[data-theme="dark"] .table-card.occupied::before { background: #ff9500; }
.table-card:hover, :root[data-theme="dark"] .table-card:hover { border-color: rgba(0, 122, 255, 0.35); }
.table-card .row-actions { margin-top: 0.7rem; }
.add-table-form { border-radius: 11px; background: var(--color-card); }
.add-table-form input, :root[data-theme="dark"] .add-table-form input { background: var(--color-muted); }
.menu-item:hover { border-color: rgba(0, 122, 255, 0.35); }
.menu-window, :root[data-theme="dark"] .menu-window { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.menu-window > summary { border-color: var(--color-border); }
.create-product > summary, :root[data-theme="dark"] .create-product > summary { border-color: var(--color-border); border-radius: 9px; }
.auth-card { border-radius: 18px; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .workspace-bar, :root[data-theme="dark"] .workspace-bar { min-height: 62px; padding: 0.65rem 1rem; }
  .workspace-context { display: none; }
  .mobile-brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--color-foreground); font-size: 1.05rem; }
  .mobile-brand:hover { color: var(--color-foreground); text-decoration: none; }
  .mobile-brand .brand-mark { width: 29px; height: 29px; flex-basis: 29px; border-radius: 8px; font-size: 0.8rem; }
  .workspace-account-name { display: none; }
  .mobile-tabs {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--color-sidebar-line);
    padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom));
    background: var(--color-sidebar-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
  .mobile-tabs a { display: grid; min-width: 0; min-height: 49px; flex: 1; align-content: center; justify-items: center; gap: 0.1rem; color: var(--color-muted-foreground); font-size: 0.63rem; font-weight: 600; text-align: center; }
  .mobile-tabs a:hover, .mobile-tabs a.active { color: var(--color-primary); text-decoration: none; }
  .mobile-tabs .icon { width: 21px; height: 21px; }
  .app-main main { padding: 1.3rem 1rem calc(84px + env(safe-area-inset-bottom)); }
  .guest-main-inner { padding-bottom: 0 !important; }
}

@media (max-width: 560px) {
  h1 { font-size: 1.85rem; }
  .overview-card, :root[data-theme="dark"] .overview-card { min-height: 132px; }
  .add-table-form { gap: 0.3rem; }
  .add-table-form input { min-width: 90px; }
  .room-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 245px), 1fr)); }
}
