/* =========================================================
   CaffeGo — App shell (sidebar + dashboard widgets)
   Used by customer / owner / admin
   ========================================================= */

body.app {
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 30;
  transition: transform 0.3s var(--ease);
}
.sidebar .brand { margin: 6px 10px 28px; }
.side-section {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 18px 12px 8px;
}
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 14px; font-weight: 500;
  transition: all 0.15s var(--ease);
  margin-bottom: 2px;
}
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link.active {
  background: var(--espresso);
  color: var(--cream);
  box-shadow: 0 6px 18px -8px rgba(42, 24, 16, 0.4);
}
.side-link.active .side-icon { color: var(--amber-soft); }
.side-icon {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px;
  color: var(--ink-mute);
  flex-shrink: 0;
}
.side-link.active .side-icon { color: var(--amber-soft); }
.side-link .badge-mini {
  margin-left: auto;
  font-size: 10.5px; font-weight: 700;
  background: var(--amber);
  color: #fff;
  padding: 2px 7px;
  border-radius: 999px;
}

.side-foot {
  margin-top: auto;
  padding: 14px 12px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.side-foot .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), var(--coffee));
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .name { font-weight: 700; font-size: 13.5px; }
.side-foot .role { font-size: 11.5px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.05em; }
.side-foot .logout {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--surface-2);
  font-size: 14px;
  transition: all 0.2s var(--ease);
}
.side-foot .logout:hover { background: var(--ruby); color: #fff; }

/* MAIN */
.main {
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column;
}
.topbar {
  height: 72px;
  padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 247, 240, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 20;
  gap: 20px;
}
[data-theme="dark"] .topbar { background: rgba(26, 15, 9, 0.78); }
.topbar-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.topbar-title {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 500;
  letter-spacing: -0.015em;
}
.topbar-sub { font-size: 13px; color: var(--ink-mute); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.menu-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  display: none; place-items: center;
  font-size: 18px;
}

.content {
  padding: 32px;
  flex: 1;
}
.content-wide { padding: 32px 40px; }

/* PAGE HEAD INSIDE CONTENT */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 28px;
  gap: 20px; flex-wrap: wrap;
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.page-head h1 em { font-style: italic; color: var(--amber-deep); font-weight: 500; }
[data-theme="dark"] .page-head h1 em { color: var(--amber-soft); }
.page-head p { color: var(--ink-soft); margin-top: 4px; font-size: 14.5px; }

/* STAT GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s var(--ease);
}
.stat:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.stat.dark { background: var(--espresso); color: var(--cream); border-color: var(--espresso); }
.stat.dark .stat-label { color: rgba(246, 239, 228, 0.7); }
.stat.dark .stat-trend.up { color: var(--amber-soft); }
.stat-label {
  font-size: 13px; color: var(--ink-mute);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; font-weight: 500;
}
.stat-icon-bubble {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: rgba(224, 122, 31, 0.12);
  color: var(--amber-deep);
  display: inline-grid; place-items: center;
  font-size: 16px;
}
.stat.dark .stat-icon-bubble { background: rgba(244, 182, 106, 0.15); color: var(--amber-soft); }
.stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 8px;
}
.stat-trend { font-size: 12.5px; color: var(--ink-mute); display: flex; align-items: center; gap: 6px; }
.stat-trend.up { color: var(--leaf); font-weight: 600; }
.stat-trend.down { color: var(--ruby); font-weight: 600; }
.stat-spark { position: absolute; right: 16px; bottom: 16px; opacity: 0.6; }

/* PANEL */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px; flex-wrap: wrap;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.panel-sub { font-size: 13px; color: var(--ink-mute); margin-top: 2px; }

/* TWO-COL DASHBOARD ROW */
.dash-row {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}
.dash-row.r-2 { grid-template-columns: 2fr 1fr; }
.dash-row.r-3 { grid-template-columns: 1fr 1fr 1fr; }
.dash-row.r-1-2 { grid-template-columns: 1fr 2fr; }

/* TABLE */
.table-wrap {
  overflow-x: auto;
  margin: -8px;
  padding: 8px;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tbl th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr { transition: background 0.15s var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .id-cell { font-family: var(--font-display); font-weight: 500; color: var(--amber-deep); }
.tbl .name-cell { font-weight: 600; }

/* QUEUE / ORDER CARDS */
.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  transition: all 0.2s var(--ease);
}
.order-card:hover { box-shadow: var(--shadow-sm); }
.order-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 12px; gap: 12px;
}
.order-id {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  color: var(--amber-deep);
  letter-spacing: -0.01em;
}
.order-customer { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.order-items { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 14px; }
.order-items .it { padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
.order-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  flex-wrap: wrap; gap: 12px;
}
.order-total {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
}

/* PROGRESS TRACKER */
.tracker {
  display: flex; align-items: flex-start;
  position: relative;
  margin: 24px 0;
}
.tracker-step {
  flex: 1; text-align: center;
  position: relative;
  padding: 0 8px;
}
.tracker-step .dot-step {
  width: 36px; height: 36px;
  background: var(--surface-3);
  color: var(--ink-mute);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px;
  margin: 0 auto 10px;
  position: relative; z-index: 1;
  border: 2px solid var(--surface);
  transition: all 0.3s var(--ease);
}
.tracker-step.done .dot-step {
  background: var(--leaf); color: #fff;
}
.tracker-step.current .dot-step {
  background: var(--amber); color: #fff;
  box-shadow: 0 0 0 6px rgba(224, 122, 31, 0.18);
  animation: pulseAmber 1.6s ease-in-out infinite;
}
@keyframes pulseAmber {
  0%, 100% { box-shadow: 0 0 0 6px rgba(224, 122, 31, 0.18); }
  50% { box-shadow: 0 0 0 12px rgba(224, 122, 31, 0.05); }
}
.tracker-step .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.tracker-step .sub { font-size: 11px; color: var(--ink-mute); margin-top: 2px; }
.tracker-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px; left: 50%; width: 100%; height: 2px;
  background: var(--surface-3);
  z-index: 0;
}
.tracker-step.done:not(:last-child)::after { background: var(--leaf); }

/* CART / SUMMARY rows */
.sum-row { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; }
.sum-row.total {
  margin-top: 10px; padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
}

/* PRODUCT TILE (cafe menu / cafe owner) */
.product {
  display: flex; gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
}
.product:hover { box-shadow: var(--shadow-sm); }
.product-thumb {
  width: 88px; height: 88px;
  border-radius: 12px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #d4a374, #6f4e37);
  display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 32px;
}
.product-info { flex: 1; min-width: 0; }
.product-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.product-desc { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 8px; line-height: 1.45; }
.product-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.product-price {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--amber-deep);
}

/* CART ITEM */
.cart-item {
  display: flex; gap: 14px; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.cart-item:last-child { border-bottom: none; }
.cart-thumb {
  width: 64px; height: 64px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d4a374, #6f4e37);
  display: grid; place-items: center;
  font-size: 24px; color: #fff;
  flex-shrink: 0;
}
.qty {
  display: inline-flex; align-items: center; gap: 0;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.qty button {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  font-size: 16px;
  color: var(--ink);
  transition: background 0.15s;
}
.qty button:hover { background: var(--surface-3); }
.qty span { padding: 0 10px; font-weight: 700; font-size: 13.5px; min-width: 36px; text-align: center; }

/* CHART CONTAINER */
.chart-box {
  position: relative;
  height: 280px;
  width: 100%;
}
.chart-box.tall { height: 360px; }
.chart-box.short { height: 200px; }

/* FILTERS BAR */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.filters .search-bar { flex: 1; min-width: 220px; max-width: 380px; }

/* MOBILE */
@media (max-width: 968px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-row.r-2, .dash-row.r-3, .dash-row.r-1-2 { grid-template-columns: 1fr; }
  .content { padding: 22px 18px; }
  .topbar { padding: 0 18px; }
  .topbar-title { font-size: 19px; }
  .menu-btn { display: grid; }
  .sidebar {
    position: fixed; top: 0; left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(26, 15, 9, 0.4);
    z-index: 25;
    display: none;
  }
  .sidebar-backdrop.show { display: block; }
  .page-head h1 { font-size: 28px; }
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .tracker-step .lbl { font-size: 11px; }
}
