:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #697586;
  --line: #d9e0e8;
  --blue: #2457c5;
  --blue-dark: #173f95;
  --green: #16805d;
  --yellow: #c68a10;
  --red: #c2413a;
  --purple: #6b4fc7;
  --shadow: 0 18px 45px rgba(25, 39, 61, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: #121927;
  color: #fff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #4f86ff, #19a77b);
  font-weight: 800;
}

.brand strong, .brand span { display: block; }
.brand span, .sidebar-footer { color: #aab6c7; font-size: 14px; }

.role-nav {
  display: grid;
  gap: 8px;
}

.role-nav button {
  color: #dce5f2;
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 700;
}

.role-nav button:hover,
.role-nav button.active {
  background: #202b41;
  border-color: #33425d;
  color: #fff;
}

.role-nav button.locked {
  opacity: .35;
  pointer-events: none;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.user-badge {
  padding: 12px;
  border: 1px solid #2d3a52;
  border-radius: 12px;
  background: #182236;
}

.workspace {
  padding: 28px;
  min-width: 0;
}

.login-panel {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 420px;
  align-items: center;
  gap: 32px;
}

.login-copy {
  max-width: 720px;
  padding: 44px;
  border-radius: 24px;
  color: #fff;
  background:
    linear-gradient(rgba(18, 25, 39, .78), rgba(18, 25, 39, .78)),
    url("https://images.unsplash.com/photo-1555396273-367ea4eb4db5?auto=format&fit=crop&w=1400&q=80") center/cover;
  box-shadow: var(--shadow);
}

.login-copy h1 {
  margin: 8px 0 14px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1;
  letter-spacing: 0;
}

.login-copy p {
  max-width: 640px;
  color: #dce5f2;
  font-size: 18px;
}

.login-card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.login-card {
  padding: 28px;
  display: grid;
  gap: 16px;
}

.login-card h2, .panel h2, .topbar h1 {
  margin: 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

select, input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  border-radius: 10px;
}

.primary-button, .secondary-button, .ghost-button, .pill-button {
  border: 0;
  border-radius: 10px;
  font-weight: 800;
  padding: 12px 14px;
}

.primary-button {
  color: #fff;
  background: var(--blue);
}

.primary-button:hover { background: var(--blue-dark); }

.secondary-button {
  color: var(--blue);
  background: #e9efff;
}

.ghost-button {
  color: #fff;
  background: #26344c;
}

.pill-button {
  color: var(--ink);
  background: #edf2f7;
  padding: 9px 11px;
}

.pill-button.success { color: #fff; background: var(--green); }
.pill-button.warning { color: #fff; background: var(--yellow); }
.pill-button.danger { color: #fff; background: var(--red); }

.hint, .message, .panel p {
  color: var(--muted);
  margin: 0;
}

.message { min-height: 22px; font-weight: 700; }
.message.error { color: var(--red); }
.message.success { color: var(--green); }

.eyebrow {
  color: #6ca0ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h1 {
  font-size: clamp(30px, 5vw, 52px);
  letter-spacing: 0;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.status-strip span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
}

.status-strip b { color: var(--ink); }

.view-grid {
  display: none;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, .8fr);
  gap: 22px;
}

.view-grid.active { display: grid; }

.panel {
  padding: 22px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.wide { min-height: 400px; }

.floor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.table-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fbfcfe;
  display: grid;
  gap: 10px;
  min-height: 176px;
}

.table-card h3 { margin: 0; font-size: 24px; }
.table-card p { min-height: 42px; }

.table-status {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.status-Available .table-status { background: var(--green); }
.status-Occupied .table-status { background: var(--yellow); }
.status-Dirty .table-status { background: var(--red); }

.table-actions, .tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.stack {
  display: grid;
  gap: 12px;
}

.assignment-row, .queue-card, .trend-row, .staff-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fbfcfe;
}

.assignment-row {
  display: grid;
  gap: 10px;
}

.tabs { margin: 14px 0; }
.tabs button.active { color: #fff; background: var(--purple); }

.menu-list {
  display: grid;
  gap: 10px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 5px;
}

.menu-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.menu-item h3, .queue-card h3 { margin: 0; }

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-control button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: #e9efff;
  color: var(--blue);
  font-weight: 900;
}

.check-total {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin: 16px 0;
  padding-top: 16px;
  font-size: 20px;
}

.updates-block {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
}

.updates-block h2 {
  margin-bottom: 12px;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.queue-list {
  display: grid;
  gap: 12px;
}

.queue-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.queue-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.plain-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.mini-progress {
  height: 12px;
  border-radius: 999px;
  background: #e8eef5;
  margin-top: 12px;
  overflow: hidden;
}

.mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.big-link {
  display: block;
  margin-top: 14px;
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  background: var(--blue);
  color: white;
  text-decoration: none;
  font-weight: 900;
}

.muted-link {
  background: #edf2f7;
  color: var(--ink);
}

.admin-table-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.admin-table {
  min-height: 150px;
  border-radius: 18px;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: #f8fbff;
}

.admin-table strong {
  font-size: 28px;
}

.admin-table span {
  font-weight: 900;
  color: var(--muted);
}

.admin-table.busy {
  border-color: #eaa2a2;
  background: #fff0f0;
}

.admin-table.busy span {
  color: var(--red);
}

.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-weight: 800;
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-block;
}

.dot.green { background: var(--green); }
.dot.red { background: var(--red); }

.menu-admin-list {
  display: grid;
  gap: 12px;
}

.menu-admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 90px auto auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  background: #fbfcfe;
  border-radius: 14px;
  padding: 14px;
}

.menu-admin-row p {
  margin-top: 4px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  border: 1px solid var(--line);
  background: #fbfcfe;
  border-radius: 16px;
  padding: 18px;
}

.stat-card strong {
  display: block;
  font-size: 34px;
}

.stat-card span { color: var(--muted); font-weight: 700; }
.stat-card.success strong { color: var(--green); }
.stat-card.danger strong { color: var(--red); }

.data-table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
  }
  .role-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .login-panel, .view-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    display: grid;
    align-items: start;
  }
  .status-strip {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .workspace, .sidebar { padding: 18px; }
  .login-copy, .login-card, .panel { border-radius: 14px; padding: 18px; }
  .analytics-grid { grid-template-columns: 1fr; }
  .queue-card, .menu-item { grid-template-columns: 1fr; }
  .admin-table-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-admin-row { grid-template-columns: 1fr; }
}
