/* ============================================================
   GhostVend Merchant Dashboard
   ============================================================ */

body {
  font-size: 15px;
  line-height: 1.5;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login[hidden], .app[hidden] { display: none !important; }

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(600px 300px at 30% 20%, rgba(227,27,35,0.12), transparent 60%),
    radial-gradient(500px 250px at 80% 90%, rgba(227,27,35,0.06), transparent 60%),
    var(--gv-bg);
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--gv-surface);
  border: 1px solid var(--gv-border);
  border-radius: var(--gv-radius-lg);
  padding: 40px 36px;
  box-shadow: var(--gv-shadow-lg);
}
.brand-lg {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--gv-text);
  margin-bottom: 32px;
}
.brand-lg svg { color: var(--gv-primary); }
.brand-tag {
  font-weight: 500;
  color: var(--gv-text-muted);
  margin-left: 8px;
  font-size: 15px;
  letter-spacing: 0;
}
.login-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.login-sub {
  color: var(--gv-text-muted);
  margin-bottom: 24px;
  font-size: 15px;
  line-height: 1.5;
}
.login-form label {
  display: block;
  margin-bottom: 16px;
}
.login-form span {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--gv-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.login-form input {
  width: 100%;
  padding: 12px 14px;
  background: var(--gv-surface-2);
  border: 1px solid var(--gv-border);
  border-radius: var(--gv-radius-sm);
  color: var(--gv-text);
  font-size: 15px;
}
.login-form input:focus {
  outline: none;
  border-color: var(--gv-primary);
  box-shadow: 0 0 0 3px rgba(227,27,35,0.15);
}
.login-message {
  margin-top: 20px;
  padding: 16px;
  border-radius: var(--gv-radius-sm);
  background: var(--gv-primary-dim);
  border: 1px solid var(--gv-primary);
  font-size: 14px;
}
.login-message.error {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--gv-error);
}
.login-message a {
  color: var(--gv-primary);
  text-decoration: underline;
  font-weight: 700;
}
.login-fine {
  margin-top: 20px;
  font-size: 12px;
  color: var(--gv-text-faint);
  text-align: center;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--gv-primary);
  color: white;
  padding: 12px 20px;
  border-radius: var(--gv-radius-sm);
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--gv-primary-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-block { width: 100%; justify-content: center; padding: 14px 20px; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--gv-surface-3);
  color: var(--gv-text);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--gv-border);
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--gv-surface-4); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--gv-surface);
  border-right: 1px solid var(--gv-border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 24px;
  color: var(--gv-primary);
}
.sidebar-brand-name {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--gv-text);
}
.sidebar-brand-name span {
  display: block;
  font-size: 11px;
  color: var(--gv-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  margin-top: 2px;
}
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--gv-divider);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--gv-radius-sm);
  color: var(--gv-text-muted);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--gv-surface-2); color: var(--gv-text); }
.nav-item.active {
  background: var(--gv-primary-dim);
  color: var(--gv-primary);
}
.nav-item svg { opacity: 0.9; flex-shrink: 0; }

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--gv-divider);
}
.user-card {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: var(--gv-radius-sm);
  background: var(--gv-surface-2);
  border: 1px solid var(--gv-border);
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--gv-primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
}
.user-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--gv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.user-email {
  font-size: 11px;
  color: var(--gv-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.user-logout {
  width: 30px; height: 30px;
  border-radius: 6px;
  color: var(--gv-text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.user-logout:hover { background: var(--gv-surface-4); color: var(--gv-text); }

/* ============================================================
   MAIN
   ============================================================ */
.main {
  padding: 32px 40px 80px;
  max-width: 1400px;
  min-width: 0;
}
.page[hidden] { display: none; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gv-text-faint);
  margin-bottom: 6px;
}
.page-title {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--gv-surface-2);
  border: 1px solid var(--gv-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--gv-text-muted);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.status-pill.status-ok { color: var(--gv-success); border-color: rgba(16,185,129,0.4); }
.status-pill.status-ok .dot { background: var(--gv-success); }
.status-pill.status-warn { color: var(--gv-warning); border-color: rgba(245,158,11,0.4); }
.status-pill.status-warn .dot { background: var(--gv-warning); }

/* ---------- Notice ---------- */
.notice {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--gv-radius);
  margin-bottom: 28px;
}
.notice[hidden] { display: none; }
.notice-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--gv-warning);
  display: flex; align-items: center; justify-content: center;
}
.notice-title { font-weight: 700; color: var(--gv-text); margin-bottom: 2px; }
.notice-sub { color: var(--gv-text-muted); font-size: 13px; }
.notice-cta {
  background: var(--gv-warning);
  color: #1a1200;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
}

/* ---------- Stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: var(--gv-surface);
  border: 1px solid var(--gv-border);
  border-radius: var(--gv-radius);
  padding: 20px 22px;
  min-width: 0;
}
.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gv-text-muted);
  font-weight: 700;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
}
.stat-delta.up { color: var(--gv-success); }
.stat-delta.down { color: var(--gv-error); }
.stat-sub {
  font-size: 12px;
  color: var(--gv-text-faint);
}

/* ---------- Cards + sections ---------- */
.section-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
}
@media (max-width: 1100px) {
  .section-grid { grid-template-columns: 1fr; }
}
.card {
  background: var(--gv-surface);
  border: 1px solid var(--gv-border);
  border-radius: var(--gv-radius);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px 8px;
}
.card-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.card-sub {
  font-size: 13px;
  color: var(--gv-text-muted);
}
.chart-wrap {
  padding: 20px 20px 24px;
}
.chart-wrap canvas { width: 100%; height: auto; display: block; }

/* ---------- Live orders ---------- */
.live-orders {
  max-height: 380px;
  overflow-y: auto;
  padding: 0 8px 12px;
}
.live-order {
  padding: 12px 16px;
  border-radius: var(--gv-radius-sm);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  border-bottom: 1px solid var(--gv-divider);
  transition: background 0.15s;
}
.live-order:hover { background: var(--gv-surface-2); }
.live-order:last-child { border-bottom: none; }
.lo-restaurant { font-weight: 700; font-size: 14px; color: var(--gv-text); }
.lo-items { font-size: 12px; color: var(--gv-text-muted); grid-column: 1 / 2; margin-top: 2px; }
.lo-total { font-weight: 800; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.lo-status { grid-column: 2; text-align: right; margin-top: 2px; }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.status-badge.paid, .status-badge.pending { background: rgba(227, 27, 35, 0.15); color: var(--gv-primary); }
.status-badge.preparing { background: rgba(245,158,11,0.15); color: var(--gv-warning); }
.status-badge.ready { background: rgba(16,185,129,0.15); color: var(--gv-success); }
.status-badge.completed { background: rgba(163,163,163,0.15); color: var(--gv-text-muted); }
.status-badge.cancelled { background: rgba(239,68,68,0.15); color: var(--gv-error); }

/* ---------- Orders table ---------- */
.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--gv-surface);
  border: 1px solid var(--gv-border);
  border-radius: 999px;
  padding: 4px;
}
.tab {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--gv-text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}
.tab.active {
  background: var(--gv-primary);
  color: white;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.orders-table th {
  text-align: left;
  padding: 14px 14px;
  color: var(--gv-text-faint);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--gv-divider);
  background: var(--gv-surface-2);
}
.orders-table td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--gv-divider);
  vertical-align: middle;
}
.orders-table tbody tr:hover { background: var(--gv-surface-2); }
.orders-table tbody tr:last-child td { border-bottom: none; }
.order-id { font-family: 'SF Mono', ui-monospace, monospace; font-size: 12px; color: var(--gv-primary); font-weight: 700; }
.order-items-preview { color: var(--gv-text-muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.money.take { color: var(--gv-text-muted); font-weight: 600; }
.money.payout { color: var(--gv-success); }
.time { color: var(--gv-text-muted); font-size: 12px; white-space: nowrap; }
.status-cell { }
.advance-btn {
  padding: 6px 12px;
  background: var(--gv-surface-3);
  border: 1px solid var(--gv-border);
  border-radius: 6px;
  color: var(--gv-text);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s;
}
.advance-btn:hover { background: var(--gv-primary); border-color: var(--gv-primary); }
.advance-btn:disabled { opacity: 0.4; cursor: default; }
.advance-btn:hover { color: #fff; }
.action-cell { white-space: nowrap; text-align: right; padding-right: 16px !important; }
.action-cell .advance-btn { white-space: nowrap; }

/* ---------- Empty state ---------- */
.empty-card {
  text-align: center;
  padding: 60px 40px;
}
.empty-illustration {
  width: 100px; height: 100px;
  margin: 0 auto 24px;
  border-radius: 24px;
  background: var(--gv-surface-2);
  color: var(--gv-text-muted);
  display: flex; align-items: center; justify-content: center;
}
.empty-card h3 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.empty-card p {
  color: var(--gv-text-muted);
  max-width: 500px;
  margin: 0 auto;
}

/* ---------- Settings ---------- */
.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gv-divider);
}
.setting-row:last-child { border-bottom: none; }
.setting-name { font-weight: 700; font-size: 15px; }
.setting-sub { font-size: 13px; color: var(--gv-text-muted); margin-top: 2px; }
.setting-value {
  color: var(--gv-text);
  font-weight: 700;
  font-size: 15px;
  padding: 8px 14px;
  background: var(--gv-surface-2);
  border: 1px solid var(--gv-border);
  border-radius: 8px;
}
.rest-pill {
  display: inline-block;
  padding: 6px 12px;
  background: var(--gv-surface-2);
  border: 1px solid var(--gv-border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 6px;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
  }
  .sidebar-nav {
    flex-direction: row;
    border-top: none;
    padding: 0;
    overflow-x: auto;
  }
  .nav-item { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  .sidebar-brand { padding: 0 12px 0 0; }
  .sidebar-brand-name span { display: none; }
  .sidebar-footer { display: none; }
  .main { padding: 20px 20px 60px; }
  .page-title { font-size: 28px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
