/* =========================================================================
   ZubesGrub - Admin shell styles (mockup)
   Loads AFTER ../assets/app.css (reuses its tokens). Adds the app frame:
   dark sidebar + topbar + content, plus admin components (stat cards,
   tables, kanban, toggles). Density ~6. Same color/shape locks apply:
   orange = the only interactive accent; green/red = status signifiers only.
   ========================================================================= */

:root {
  --side-w: 244px;
  --admin-bg: #f6f1e8;
  --admin-card: #ffffff;
}

body.admin {
  background: var(--admin-bg);
}

/* ---------- Layout frame ---------- */
.admin-layout {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100dvh;
}

/* ---------- Sidebar ---------- */
.admin-sidebar {
  background: var(--ink);
  color: #cabfb3;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}
.admin-sidebar .brand {
  color: #fff;
  font-size: 1.2rem;
  padding: 4px 8px 16px;
}
.admin-role {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2a231e;
  border: 1px solid #3a322c;
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.admin-role .av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.admin-role small {
  color: #9b9088;
  display: block;
  font-size: 0.72rem;
}
.admin-role strong {
  color: #fff;
  font-size: 0.92rem;
}
.nav-group {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7d736b;
  padding: 14px 10px 6px;
}
.admin-nav {
  list-style: none;
  display: grid;
  gap: 2px;
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 11px;
  color: #cabfb3;
  font-weight: 600;
  font-size: 0.92rem;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.admin-nav a:hover {
  background: #2a231e;
  color: #fff;
}
.admin-nav a.active {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 6px 16px rgba(255, 90, 31, 0.32);
}
.admin-nav a.active svg {
  stroke: #fff;
}
.admin-nav svg {
  width: 18px;
  height: 18px;
  stroke: #9b9088;
  flex: none;
}
.admin-nav a:hover svg {
  stroke: #fff;
}
.admin-nav .badge-count {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
}
.side-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #2a231e;
}
.side-foot a {
  color: #9b9088;
  font-size: 0.85rem;
  padding: 8px 11px;
  display: block;
}

/* ---------- Main + topbar ---------- */
.admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 241, 232, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-topbar h1 {
  font-size: 1.4rem;
}
.admin-topbar .sub {
  color: var(--ink-3);
  font-size: 0.85rem;
  font-weight: 500;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.search {
  position: relative;
}
.search input {
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 0.55em 1em 0.55em 2.2em;
  font: inherit;
  font-size: 0.9rem;
  width: 220px;
}
.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--ink-3);
}
.admin-content {
  padding: 28px;
  display: grid;
  gap: 24px;
}
.admin-mobile-top {
  display: none;
}

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.stat {
  background: var(--admin-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat .label {
  color: var(--ink-3);
  font-size: 0.82rem;
  font-weight: 600;
}
.stat .num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.9rem;
  margin-top: 6px;
  letter-spacing: -0.02em;
}
.stat .delta {
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 4px;
}
.delta.up {
  color: var(--green);
}
.delta.down {
  color: var(--red);
}

/* ---------- Panels ---------- */
.panel {
  background: var(--admin-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 {
  font-size: 1.05rem;
  font-family: var(--display);
}
.panel-body {
  padding: 20px;
}
.cols-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.table th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover {
  background: #faf6ef;
}
.table .num {
  font-family: var(--mono);
  font-weight: 700;
}

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.b-new {
  background: rgba(255, 90, 31, 0.14);
  color: var(--orange-deep);
}
.b-prep {
  background: rgba(245, 170, 30, 0.18);
  color: #9a6a00;
}
.b-ready {
  background: rgba(19, 138, 54, 0.16);
  color: var(--green-deep);
}
.b-done {
  background: #eee7db;
  color: var(--ink-3);
}
.b-refund {
  background: rgba(214, 36, 44, 0.12);
  color: var(--red-deep);
}
.b-web {
  background: #eaf1ff;
  color: #2950b0;
}
.b-pos {
  background: #f0eaff;
  color: #5a3bb0;
}

/* ---------- Kanban (order board) ---------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}
.kanban-col {
  background: #efe8dc;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  min-height: 200px;
}
.kanban-col h4 {
  font-family: var(--sans);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 12px;
}
.kanban-col h4 .count {
  font-family: var(--mono);
  background: #fff;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.78rem;
}
.order-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.order-card .oc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.order-card .oc-id {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
}
.order-card ul {
  list-style: none;
  font-size: 0.85rem;
  color: var(--ink-2);
  display: grid;
  gap: 3px;
  margin: 8px 0;
}
.order-card .oc-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 0.8rem;
}

/* ---------- Toggle (visual) ---------- */
.toggle {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d8cdbd;
  position: relative;
  flex: none;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s ease;
}
.toggle.on {
  background: var(--orange);
}
.toggle.on::after {
  left: 21px;
}

/* ---------- Mini progress (loyalty/analytics) ---------- */
.bar {
  height: 8px;
  border-radius: 999px;
  background: #e7ddcd;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--orange);
  border-radius: 999px;
}

/* ---------- Simple bar chart (analytics) ---------- */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 200px;
  padding-top: 12px;
}
.chart .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  height: 100%;
}
.chart .bar-v {
  width: 100%;
  max-width: 38px;
  background: linear-gradient(var(--orange), var(--orange-deep));
  border-radius: 8px 8px 0 0;
}
.chart .col small {
  color: var(--ink-3);
  font-size: 0.72rem;
}

/* split bars for NG vs US */
.split-row {
  display: grid;
  grid-template-columns: 90px 1fr 60px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.split-track {
  height: 14px;
  border-radius: 999px;
  background: #e7ddcd;
  overflow: hidden;
  display: flex;
}
.split-ng {
  background: var(--green);
  height: 100%;
}
.split-us {
  background: var(--red);
  height: 100%;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .kanban {
    grid-template-columns: repeat(2, 1fr);
  }
  .cols-2,
  .cols-3 {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 820px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    display: none;
  }
  .admin-mobile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ink);
    color: #fff;
    padding: 12px 18px;
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .admin-mobile-top .brand {
    color: #fff;
    font-size: 1.1rem;
    padding: 0;
  }
}
@media (max-width: 560px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .kanban {
    grid-template-columns: 1fr;
  }
  .admin-content {
    padding: 16px;
  }
  .search input {
    width: 140px;
  }
}
