*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-deep: #0f0d0b;
  --bg-surface: #1a1614;
  --bg-card: #231f1b;
  --bg-elevated: #2d2722;
  --border: rgba(196,164,120,.1);
  --border-hover: rgba(196,164,120,.25);
  --text: #f2ece6;
  --text-sec: #a89a8c;
  --text-muted: #6b5e52;
  --amber: #c4a478;
  --amber-glow: #e8c896;
  --amber-dim: #8b7355;
  --success: #6abf7b;
  --warning: #e0a84c;
  --danger: #d45f5f;
  --blue: #7ba4d4;
  --radius: 12px;
  --radius-sm: 8px;
  --ease: cubic-bezier(.4,0,.2,1);
}

html, body { height: 100%; overflow: hidden; font-family: 'Outfit', sans-serif; color: var(--text); background: var(--bg-deep); -webkit-font-smoothing: antialiased; }

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

/* ═══ SIDEBAR ═══ */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}

.sidebar-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 0 12px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.sidebar-brand span { color: var(--amber); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-sec);
  font-family: 'Outfit', sans-serif;
  font-size: .82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s var(--ease);
  text-align: left;
  width: 100%;
}

.nav-link:hover { color: var(--text); background: rgba(196,164,120,.05); }
.nav-link.active { color: var(--amber); background: rgba(196,164,120,.08); }

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

.owner-badge { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.owner-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--amber); color: var(--bg-deep); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.owner-info { display: flex; flex-direction: column; }
.owner-name { font-size: .78rem; font-weight: 600; }
.owner-role { font-size: .6rem; color: var(--text-muted); }

/* ═══ MAIN ═══ */
.main { overflow-y: auto; padding: 24px 32px; }
.main::-webkit-scrollbar { width: 5px; }
.main::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.topbar h1 { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 700; }
.topbar-sub { font-size: .7rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }
.live-text { font-size: .7rem; color: var(--success); font-family: 'JetBrains Mono', monospace; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.view { display: none; }
.view.active { display: block; }

/* ═══ STATS ROW ═══ */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--amber), var(--amber-glow)); opacity: .5; }
.stat-card .stat-label { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px; }
.stat-card .stat-value { font-family: 'JetBrains Mono', monospace; font-size: 1.5rem; font-weight: 600; color: var(--amber-glow); }
.stat-card .stat-change { font-size: .6rem; margin-top: 4px; font-family: 'JetBrains Mono', monospace; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ═══ CARDS ═══ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h3 { font-family: 'Playfair Display', serif; font-size: .9rem; font-weight: 600; }
.card-badge { font-family: 'JetBrains Mono', monospace; font-size: .6rem; background: rgba(196,164,120,.1); color: var(--amber); padding: 3px 8px; border-radius: 10px; }

.card--wide { grid-column: span 2; }
.card--full { width: 100%; }

.overview-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* ═══ CHARTS ═══ */
.chart-area { height: 160px; position: relative; }
.chart-area--lg { height: 240px; }

.chart-bar {
  position: absolute;
  bottom: 20px;
  width: 20px;
  background: linear-gradient(180deg, var(--amber-glow), var(--amber-dim));
  border-radius: 4px 4px 0 0;
  transition: height .4s var(--ease);
  opacity: .8;
}

.chart-bar:hover { opacity: 1; }
.chart-label { position: absolute; bottom: 0; font-size: .55rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; transform: translateX(-25%); }
.chart-val { position: absolute; top: -16px; font-size: .5rem; color: var(--amber); font-family: 'JetBrains Mono', monospace; white-space: nowrap; transform: translateX(-25%); }

.line-chart { width: 100%; height: 100%; }
.line-path { fill: none; stroke: var(--amber); stroke-width: 2; stroke-linecap: round; }
.line-fill { fill: url(#lineGrad); opacity: .15; }
.line-dot { fill: var(--amber-glow); }

/* ═══ LIVE FEED ═══ */
.live-feed { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.live-feed::-webkit-scrollbar { width: 3px; }
.live-feed::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 2px; }

.feed-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  animation: slideIn .2s var(--ease);
}

@keyframes slideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.feed-item .fi-left { display: flex; flex-direction: column; gap: 2px; }
.feed-item .fi-id { font-family: 'JetBrains Mono', monospace; font-size: .68rem; color: var(--amber); }
.feed-item .fi-items { font-size: .65rem; color: var(--text-sec); }
.feed-item .fi-total { font-family: 'JetBrains Mono', monospace; font-size: .75rem; font-weight: 600; }
.feed-item .fi-time { font-size: .55rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

/* ═══ TOP SELLERS ═══ */
.ts-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ts-item:last-child { border-bottom: none; }
.ts-rank { font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--text-muted); width: 16px; }
.ts-name { flex: 1; font-size: .72rem; }
.ts-bar-bg { width: 60px; height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.ts-bar-fill { height: 100%; background: var(--amber); border-radius: 2px; }
.ts-count { font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--amber); width: 24px; text-align: right; }

/* ═══ DONUT ═══ */
.donut-area { display: flex; align-items: center; gap: 20px; }
.donut-svg { width: 90px; height: 90px; transform: rotate(-90deg); }
.donut-svg text { transform: rotate(90deg); transform-origin: center; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; }
.dl-item { display: flex; align-items: center; gap: 8px; font-size: .68rem; }
.dl-dot { width: 8px; height: 8px; border-radius: 50%; }
.dl-val { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--text-muted); }

/* ═══ MINI TABLES ═══ */
.mini-tables { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mt-cell { width: 100%; aspect-ratio: 1; border-radius: var(--radius-sm); background: var(--bg-surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--text-muted); }
.mt-cell.occ { border-color: var(--amber-dim); color: var(--amber); background: rgba(196,164,120,.05); }

/* ═══ REVENUE VIEW ═══ */
.rev-controls { display: flex; gap: 8px; margin-bottom: 20px; }
.rev-tab { font-family: 'Outfit', sans-serif; font-size: .7rem; font-weight: 500; padding: 7px 16px; border: 1px solid var(--border); border-radius: 20px; background: transparent; color: var(--text-sec); cursor: pointer; transition: all .12s; }
.rev-tab:hover { border-color: var(--border-hover); color: var(--text); }
.rev-tab.active { background: var(--amber); color: var(--bg-deep); border-color: var(--amber); }

.rev-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.rev-breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }

/* ═══ ORDERS VIEW ═══ */
.orders-controls { display: flex; gap: 8px; margin-bottom: 16px; }
.orders-table { display: flex; flex-direction: column; gap: 6px; }

.ot-row {
  display: grid;
  grid-template-columns: 60px 1fr 80px 80px 80px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .72rem;
}

.ot-row.header { background: var(--bg-elevated); font-weight: 600; font-size: .6rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.ot-id { font-family: 'JetBrains Mono', monospace; color: var(--amber); }
.ot-status { font-size: .6rem; padding: 3px 8px; border-radius: 10px; text-align: center; }
.ot-status.completed { background: rgba(106,191,123,.1); color: var(--success); }
.ot-status.cancelled { background: rgba(212,95,95,.1); color: var(--danger); }

/* ═══ MENU VIEW ═══ */
.menu-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.menu-controls h3 { font-family: 'Playfair Display', serif; }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

.menu-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color .12s;
}

.menu-card:hover { border-color: var(--border-hover); }
.mc-cat { font-family: 'JetBrains Mono', monospace; font-size: .55rem; color: var(--amber-dim); text-transform: uppercase; letter-spacing: .5px; }
.mc-name { font-size: .82rem; font-weight: 600; margin: 4px 0; }
.mc-price { font-family: 'JetBrains Mono', monospace; font-size: .75rem; color: var(--amber); }
.mc-status { font-size: .58rem; margin-top: 6px; }
.mc-status.on { color: var(--success); }
.mc-status.off { color: var(--danger); }

/* ═══ STAFF VIEW ═══ */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.staff-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.staff-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-elevated); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: var(--amber); }
.staff-info { flex: 1; }
.staff-name { font-size: .82rem; font-weight: 600; }
.staff-role { font-size: .62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.staff-stats { font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--text-sec); margin-top: 4px; }

/* ═══ SETTINGS ═══ */
.settings-panel { display: flex; flex-direction: column; gap: 16px; max-width: 500px; }
.settings-form { display: flex; flex-direction: column; gap: 12px; }
.settings-form label { font-size: .72rem; color: var(--text-sec); display: flex; flex-direction: column; gap: 4px; }
.settings-form input { padding: 8px 12px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: 'Outfit', sans-serif; font-size: .8rem; outline: none; }
.settings-form input:focus { border-color: var(--amber-dim); }

.btn-primary { padding: 10px 20px; background: var(--amber); color: var(--bg-deep); border: none; border-radius: var(--radius-sm); font-family: 'Outfit', sans-serif; font-weight: 600; font-size: .72rem; cursor: pointer; transition: all .12s; }
.btn-primary:hover { background: var(--amber-glow); }
.btn-secondary { padding: 10px 20px; background: var(--bg-elevated); color: var(--text-sec); border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: 'Outfit', sans-serif; font-weight: 500; font-size: .72rem; cursor: pointer; transition: all .12s; }
.btn-secondary:hover { border-color: var(--border-hover); color: var(--text); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1024px) {
  .app { grid-template-columns: 200px 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    flex-direction: row;
    padding: 8px 12px;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 100;
    overflow-x: auto;
    gap: 4px;
  }

  .sidebar-brand, .sidebar-footer { display: none; }
  .sidebar-nav { flex-direction: row; gap: 2px; }

  .nav-link {
    flex-direction: column;
    padding: 6px 10px;
    font-size: .5rem;
    gap: 3px;
    min-width: 52px;
    text-align: center;
  }

  .nav-link svg { width: 16px; height: 16px; }

  .main { padding: 16px 16px 72px; }
  .topbar { margin-bottom: 16px; }
  .topbar h1 { font-size: 1.2rem; }

  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 1.2rem; }

  .overview-grid { grid-template-columns: 1fr; gap: 12px; }
  .card--wide { grid-column: span 1; }
  .card { padding: 16px; }

  .rev-stats { grid-template-columns: 1fr; }
  .rev-breakdown { grid-template-columns: 1fr; }

  .ot-row { grid-template-columns: 50px 1fr 60px; font-size: .65rem; padding: 10px 12px; }
  .ot-row span:nth-child(4), .ot-row span:nth-child(5) { display: none; }
  .ot-row.header span:nth-child(4), .ot-row.header span:nth-child(5) { display: none; }

  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .staff-grid { grid-template-columns: 1fr; }

  .donut-area { flex-direction: column; align-items: flex-start; gap: 12px; }

  .audit-row { grid-template-columns: 28px 1fr auto; gap: 8px; padding: 10px 12px; }
  .alert-card { grid-template-columns: 6px 1fr auto; gap: 10px; padding: 12px 14px; }

  .settings-panel { max-width: 100%; }
}

@media (max-width: 480px) {
  .main { padding: 12px 12px 68px; }
  .stats-row { gap: 8px; }
  .stat-card .stat-value { font-size: 1rem; }
  .menu-grid { grid-template-columns: 1fr; }
  .live-feed { max-height: 200px; }
  .chart-area { height: 120px; }
}

/* ═══ AUDIT LOG ═══ */
.audit-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.audit-header h3 { font-family: 'Playfair Display', serif; }

.audit-list { display: flex; flex-direction: column; gap: 6px; }

.audit-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.audit-icon { font-size: 1rem; text-align: center; }
.audit-body { display: flex; flex-direction: column; gap: 2px; }
.audit-action { font-size: .72rem; font-weight: 600; text-transform: capitalize; }
.audit-action.success { color: var(--success); }
.audit-action.warning { color: var(--warning); }
.audit-action.danger { color: var(--danger); }
.audit-detail { font-size: .65rem; color: var(--text-sec); font-family: 'JetBrains Mono', monospace; }
.audit-meta { text-align: right; }
.audit-user { display: block; font-size: .65rem; font-weight: 500; }
.audit-time { font-size: .55rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

/* ═══ ALERTS ═══ */
.alerts-header { margin-bottom: 16px; }
.alerts-header h3 { font-family: 'Playfair Display', serif; }

.alerts-list { display: flex; flex-direction: column; gap: 10px; }

.alert-card {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.alert-dot { width: 8px; height: 8px; border-radius: 50%; }
.alert-danger .alert-dot { background: var(--danger); box-shadow: 0 0 8px rgba(212,95,95,.4); }
.alert-warning .alert-dot { background: var(--warning); box-shadow: 0 0 8px rgba(224,168,76,.3); }
.alert-info .alert-dot { background: var(--blue); }

.alert-body { display: flex; flex-direction: column; gap: 3px; }
.alert-title { font-size: .78rem; font-weight: 600; }
.alert-danger .alert-title { color: var(--danger); }
.alert-warning .alert-title { color: var(--warning); }
.alert-desc { font-size: .68rem; color: var(--text-sec); line-height: 1.4; }
.alert-time { font-family: 'JetBrains Mono', monospace; font-size: .58rem; color: var(--text-muted); }

/* ═══ PAYMENT MIX — ENHANCED ═══ */
@keyframes donutDraw {
  from { stroke-dasharray: 0 999; opacity: 0; }
  to { opacity: .9; }
}

.pay-chart-wrap { display: flex; flex-direction: column; gap: 16px; }

.pay-donut-container { position: relative; width: 110px; height: 110px; margin: 0 auto; }
.pay-donut-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pay-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.pay-donut-total { font-family: 'JetBrains Mono', monospace; font-size: 1rem; font-weight: 600; color: var(--text); }
.pay-donut-label { font-size: .55rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

.pay-legend { display: flex; flex-direction: column; gap: 8px; }

.pay-legend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .12s;
}

.pay-legend-item:hover { border-color: var(--border-hover); }

.pay-legend-left { display: flex; align-items: center; gap: 8px; }
.pay-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pay-legend-icon { font-size: .75rem; }
.pay-legend-name { font-size: .72rem; font-weight: 500; }

.pay-legend-right { display: flex; align-items: center; gap: 10px; }
.pay-legend-amount { font-family: 'JetBrains Mono', monospace; font-size: .68rem; font-weight: 600; }
.pay-legend-pct { font-family: 'JetBrains Mono', monospace; font-size: .58rem; color: var(--text-muted); background: var(--bg-elevated); padding: 2px 6px; border-radius: 8px; }
