/* ── Design tokens ────────────────────────────────────────────── */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --amber: #f59e0b;
  --amber-dark: #d97706;
  --success: #10b981;
  --danger: #ef4444;
  --text: #0f172a;
  --text-sm: #334155;
  --text-muted: #64748b;
  --navy: #0f172a;
  --navy-mid: #1e293b;
  --navy-light: #334155;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --sidebar-w: 240px;
  --topbar-h: 56px;
}

/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .9375rem;
  color: var(--text);
  background: var(--bg);
  margin: 0;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1rem; flex-shrink: 0;
}
.brand-name { color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.15; }
.brand-sub  { color: rgba(255,255,255,.4); font-size: .7rem; }

.sidebar-nav {
  flex: 1;
  padding: .65rem .6rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-section-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: rgba(255,255,255,.28);
  padding: .8rem .6rem .25rem;
}
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.62);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.9);
}
.sidebar-nav .nav-link.active {
  background: rgba(245,158,11,.18);
  color: #fbbf24;
}
.sidebar-nav .nav-link i {
  width: 15px;
  text-align: center;
  font-size: .8rem;
  flex-shrink: 0;
  opacity: .85;
}

.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-notifications {
  display: flex;
  align-items: center;
  background: rgba(245,158,11,.12);
  border-radius: var(--radius-sm);
  padding: .45rem .7rem;
  color: rgba(255,255,255,.7);
  font-size: .8rem;
  margin-bottom: .65rem;
  gap: .4rem;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .82rem; flex-shrink: 0;
}
.sidebar-user-name { color: rgba(255,255,255,.85); font-weight: 600; font-size: .84rem; line-height: 1.2; }
.sidebar-logout { color: rgba(255,255,255,.38); font-size: .74rem; text-decoration: none; transition: color .15s; }
.sidebar-logout:hover { color: #f87171; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1030;
}
.sidebar-overlay.show { display: block; }

/* ── Main wrapper ─────────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top bar ──────────────────────────────────────────────────── */
.top-bar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
  box-shadow: 0 1px 0 var(--border);
}
.sidebar-toggle {
  color: var(--text-muted);
  border: none !important;
  background: none !important;
  padding: .35rem .45rem !important;
  border-radius: var(--radius-sm) !important;
}
.sidebar-toggle:hover { background: var(--bg) !important; color: var(--text); }

.top-bar-icon-btn {
  color: var(--text-muted);
  border: none;
  background: none;
  padding: .35rem .5rem;
  border-radius: var(--radius-sm);
  position: relative;
  line-height: 1;
}
.top-bar-icon-btn:hover { background: var(--bg); color: var(--text); }
.notification-dot {
  position: absolute;
  top: 1px; right: 1px;
  background: #ef4444;
  color: white;
  border-radius: 10px;
  font-size: .58rem;
  padding: 1px 4px;
  line-height: 1.4;
  font-weight: 700;
  border: 2px solid white;
}

/* ── Page content ─────────────────────────────────────────────── */
.page-content { padding: 1.75rem; flex: 1; }

/* ── Mobile sidebar ───────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open { transform: none; }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 1.25rem; }
}

/* ── Avatar circles ───────────────────────────────────────────── */
.avatar-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #f6a623, #e8471c);
  color: #fff; font-weight: 700; font-size: .82rem; flex-shrink: 0;
}
.avatar-circle-sm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  color: #fff; font-weight: 700; font-size: .68rem; flex-shrink: 0;
}
.avatar-circle-lg {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, #f6a623, #e8471c);
  color: #fff; font-weight: 700; font-size: 1.3rem; flex-shrink: 0;
}

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
.card-header {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.25rem;
  font-weight: 600;
  font-size: .9rem;
}

/* Stat cards */
.stat-card { transition: transform .15s, box-shadow .15s; cursor: default; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow) !important; }
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.stat-number { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.stat-label  { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; font-weight: 500; }

/* Clickable cards */
.restaurant-card, .order-card { transition: transform .15s, box-shadow .15s; }
.restaurant-card:hover, .order-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg) !important;
}

/* ── Urgency borders ──────────────────────────────────────────── */
.urgency-low      { border-left: 4px solid #10b981 !important; }
.urgency-medium   { border-left: 4px solid #f59e0b !important; }
.urgency-high     { border-left: 4px solid #ef4444 !important; }
.urgency-critical { border-left: 4px solid #0f172a !important; }

/* ── Tables ───────────────────────────────────────────────────── */
.table { font-size: .875rem; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .75rem 1rem; }
thead.table-dark { --bs-table-bg: var(--navy-mid); }
thead.table-dark th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  color: rgba(255,255,255,.72) !important;
  border: none !important;
}
.table-hover tbody tr { transition: background .1s; }
.table-hover tbody tr:hover td { background: rgba(59,130,246,.04); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: .875rem; }
.btn-lg { border-radius: 10px; font-size: 1rem; }
.btn-sm { font-size: .8rem; padding: .3rem .65rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-warning { background: var(--amber); border-color: var(--amber); color: #fff !important; font-weight: 600; }
.btn-warning:hover { background: var(--amber-dark); border-color: var(--amber-dark); color: #fff !important; }
.btn-outline-warning { color: var(--amber-dark); border-color: var(--amber); }
.btn-outline-warning:hover { background: var(--amber); color: #fff; }

/* ── Badges ───────────────────────────────────────────────────── */
.badge { border-radius: 6px; font-weight: 600; letter-spacing: .02em; font-size: .72rem; }

/* ── Form controls ────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  font-size: .875rem;
  color: var(--text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,.2);
  outline: none;
}
.form-label { font-size: .875rem; font-weight: 600; margin-bottom: .35rem; color: var(--text-sm); }
.form-text { font-size: .78rem; }
.input-group-text { border-color: var(--border); background: var(--bg); font-size: .875rem; }

/* ── Alerts ───────────────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); font-size: .875rem; border: none; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info    { background: #eff6ff; color: #1e40af; }

/* ── Page header ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.page-header h4, .page-header h5 {
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

/* ── Section dividers ─────────────────────────────────────────── */
.section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

/* ── Star rating ──────────────────────────────────────────────── */
.star-rating { display: flex; flex-direction: row-reverse; gap: 4px; width: fit-content; }
.star-rating input { display: none; }
.star-rating label { cursor: pointer; font-size: 1.5rem; color: #cbd5e1; transition: color .1s; }
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label { color: #f59e0b; }

/* ── Progress bars ────────────────────────────────────────────── */
.progress { border-radius: 4px; background: #e2e8f0; overflow: hidden; }
.progress-bar { transition: width .4s ease; }

/* ── Dropdown menus ───────────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .875rem;
  padding: .4rem;
}
.dropdown-item {
  border-radius: 6px;
  padding: .45rem .75rem;
  color: var(--text);
}
.dropdown-item:hover { background: var(--bg); color: var(--text); }
.dropdown-header { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: .5rem .75rem .25rem; }

/* ── List groups ──────────────────────────────────────────────── */
.list-group-item { border-color: var(--border); font-size: .875rem; }

/* ── Clock / monospace ────────────────────────────────────────── */
.font-monospace { font-family: 'Courier New', monospace; }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Activity log timeline ────────────────────────────────────── */
.timeline-item { position: relative; padding-left: 1rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1px; top: 8px; bottom: -8px;
  width: 2px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }

/* ── CK clock card ────────────────────────────────────────────── */
.clock-display-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  border-radius: var(--radius) !important;
  border: none !important;
  box-shadow: var(--shadow-lg) !important;
}
.clock-display-card .display-3 { letter-spacing: .05em; }

/* ── Kiosk (self-contained pages — don't inherit sidebar) ───── */
/* These pages have their own full-page styles */
