/* Admin Dashboard styles — leverages design tokens from styles.css */

:root {
  --admin-sidebar-width: 240px;
  --admin-bg: #f4f7fb;
  --admin-content-pad: 1.5rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--admin-bg);
  color: var(--color-navy-900);
  font-family: var(--font-body, system-ui, sans-serif);
  min-height: 100vh;
}

body.admin-page { display: block; }

.admin-screen { display: none; }
.admin-screen.active { display: flex; }

/* ============= LOGIN SCREEN ============= */
.admin-screen[data-screen="login"] {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--color-blue-700) 0%, var(--color-blue-800) 100%);
}

.login-card {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  margin: 0 0 0.5rem 0;
  color: var(--color-navy-900);
  text-align: center;
}

.login-sub {
  color: var(--color-slate-700);
  margin: 0 0 1.5rem 0;
  text-align: center;
}

.login-form .form-group {
  margin-bottom: 1rem;
}

.login-form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.login-form input {
  width: 100%;
  padding: 0.875rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
}

.login-form input:focus {
  outline: none;
  border-color: var(--color-blue-700);
  box-shadow: 0 0 0 3px rgba(1, 40, 104, 0.1);
}

.login-form button {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.95rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--color-red-600);
  color: white;
}

.login-form button:active { background: var(--color-red-700); }

.error-banner {
  background: rgba(176, 23, 32, 0.1);
  border-left: 3px solid var(--color-red-600);
  color: var(--color-red-700);
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ============= APP LAYOUT ============= */
.admin-screen[data-screen="app"] {
  min-height: 100vh;
  display: none;
}
.admin-screen[data-screen="app"].active { display: flex; }

.sidebar {
  width: var(--admin-sidebar-width);
  flex-shrink: 0;
  background: var(--color-navy-900);
  color: white;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 0 0.5rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 1rem;
}

.sidebar-brand strong {
  display: block;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
}

.sidebar-tagline {
  font-size: 0.8rem;
  opacity: 0.7;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  text-align: left;
  padding: 0.75rem 0.85rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: white; }
.nav-link.active { background: var(--color-red-600); color: white; }

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.user-block {
  margin-bottom: 0.75rem;
  padding: 0 0.5rem;
}

.user-name { font-weight: 600; }
.user-role {
  font-size: 0.75rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#logout-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.85rem;
  padding: 0.6rem;
}

#logout-btn:active { background: rgba(255, 255, 255, 0.2); }

.main-content {
  flex: 1;
  padding: var(--admin-content-pad);
  max-width: 100%;
  overflow-x: hidden;
}

/* ============= ROUTE: DASHBOARD ============= */
.page-title {
  margin: 0 0 1rem 0;
  font-size: 1.6rem;
  color: var(--color-navy-900);
}

.page-subtitle {
  color: var(--color-slate-700);
  margin: 0 0 1.5rem 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--color-border);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-slate-700);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-navy-900);
}

.stat-value.revenue { color: var(--color-red-600); }
.stat-value.projection { color: #2a8045; }

.stat-meta {
  font-size: 0.85rem;
  color: var(--color-slate-700);
  margin-top: 0.5rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.panel {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.panel h3 {
  margin: 0 0 0.85rem 0;
  font-size: 1.05rem;
  color: var(--color-navy-900);
}

/* Bar chart — pure CSS, no chart library.
   Each bar occupies a column with a fixed height so % fills calculate correctly. */
.chart-container {
  display: flex;
  align-items: stretch;     /* bars fill full container height */
  gap: 0.6rem;
  height: 240px;
  padding: 0.5rem 0 0;
  position: relative;
}

.chart-bar {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end; /* push value+fill+label to bottom of column */
  gap: 0.25rem;
  height: 100%;
  position: relative;
}

/* Fill grows from the bottom upward. Height inline-styled per bar (% of column). */
.chart-bar-fill {
  width: 100%;
  max-width: 56px;
  background: linear-gradient(180deg, var(--color-blue-700), var(--color-blue-800));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.3s ease-out;
  flex-shrink: 0;
}

.chart-bar-label {
  font-size: 0.75rem;
  color: var(--color-slate-700);
  text-align: center;
  flex-shrink: 0;
  line-height: 1.1;
}

.chart-bar-value {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-navy-900);
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.1;
}

/* Empty-state — when all months have $0, show a friendly hint instead of flat bars */
.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 240px;
  color: var(--color-slate-700);
  font-style: italic;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  background: var(--color-surface);
}

.data-table th, .data-table td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--color-border);
}

.data-table th {
  font-weight: 600;
  color: var(--color-navy-900);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.data-table tr.row-clickable { cursor: pointer; }
.data-table tr.row-clickable:hover { background: var(--color-surface); }

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  background: white;
  border: 1px solid var(--color-border);
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--color-slate-700);
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.status-pending     { background: #fff3cd; color: #6b4f00; }
.status-in_progress { background: #cfe2ff; color: #084298; }
.status-ready       { background: #d1e7dd; color: #0f5132; }
.status-picked_up   { background: #e2e3e5; color: #41464b; }
.status-cancelled   { background: #f8d7da; color: #842029; }
.status-scheduled   { background: #d3d9f0; color: #2c3e9c; }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar select {
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  background: white;
}

.filter-bar input[type="text"] { flex: 1; min-width: 200px; }

.alphabet-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.alphabet-row button {
  min-width: 32px;
  height: 32px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: inherit;
}

.alphabet-row button.active { background: var(--color-blue-700); color: white; border-color: var(--color-blue-700); }
.alphabet-row button.empty { opacity: 0.35; cursor: not-allowed; }
.alphabet-row button.all { background: var(--color-red-600); color: white; border-color: var(--color-red-600); }

/* Customer detail */
.detail-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.detail-header h2 { margin: 0; }

.btn-link {
  background: transparent;
  border: 1px solid var(--color-border);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-blue-700);
  font-family: inherit;
}

.btn-link:hover { background: var(--color-surface); }

.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--color-border);
  margin: 1rem 0 1.25rem 0;
}

.tab {
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 500;
  margin-bottom: -2px;
  font-family: inherit;
  font-size: 0.95rem;
}

.tab.active { color: var(--color-red-600); border-bottom-color: var(--color-red-600); }

.kv-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.95rem;
}

.kv-list dt { color: var(--color-slate-700); }
.kv-list dd { margin: 0; color: var(--color-navy-900); font-weight: 500; }

/* ============= MODAL ============= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.active { display: flex; }

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--color-slate-700);
  line-height: 1;
}

.modal-card h3 { margin-top: 0; }

/* Forms inside modal */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.form-row.single { grid-template-columns: 1fr; }

.form-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.btn-primary {
  background: var(--color-red-600);
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.95rem;
}

.btn-primary:active { background: var(--color-red-700); }

.btn-secondary {
  background: var(--color-blue-700);
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.95rem;
}

.btn-secondary:active { background: var(--color-blue-800); }

.btn-back {
  background: var(--color-surface);
  color: var(--color-navy-900);
  border: 1px solid var(--color-border);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}

.btn-danger {
  background: var(--color-red-600);
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
}

select.status-select {
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  font-family: inherit;
}

/* ============= ORDERS: View toggle ============= */
.view-toggle {
  display: inline-flex;
  background: white;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-right: 0.4rem;
}

.view-toggle .view-btn {
  background: white;
  color: var(--color-navy-900);
  border: none;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.view-toggle .view-btn:hover { background: var(--color-surface); }
.view-toggle .view-btn.active {
  background: var(--color-blue-700);
  color: white;
}

.order-summary {
  margin: 0 0 0.85rem 0;
  font-size: 0.9rem;
  color: var(--color-slate-700);
}

.order-summary-total {
  font-weight: 700;
  color: var(--color-red-600);
}

/* ============= ORDERS: Calendar view ============= */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 0.5rem 0;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.calendar-month-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-navy-900);
}

.calendar-nav {
  display: flex;
  gap: 0.4rem;
}

.calendar-summary {
  margin: 0 0 0.85rem 0;
  font-size: 0.9rem;
  color: var(--color-slate-700);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: 4px;
}

.calendar-dow {
  background: var(--color-navy-900);
  color: white;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.45rem 0;
  border-radius: 4px;
}

.calendar-day {
  background: white;
  border-radius: 4px;
  padding: 0.4rem 0.45rem;
  min-height: 92px;
  position: relative;
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  transition: background 0.12s, transform 0.12s;
}

.calendar-day-blank {
  background: var(--color-surface);
  opacity: 0.55;
  min-height: 92px;
}

.calendar-day.has-orders {
  border: 1.5px solid var(--color-blue-700);
}

.calendar-day.has-orders:hover {
  background: rgba(1, 40, 104, 0.04);
}

.calendar-day.is-today {
  outline: 2px solid var(--color-red-600);
  outline-offset: -2px;
}

.calendar-day-number {
  font-weight: 700;
  color: var(--color-navy-900);
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.calendar-day.is-today .calendar-day-number {
  color: var(--color-red-600);
}

.calendar-day-count {
  font-size: 0.72rem;
  color: var(--color-slate-700);
  font-weight: 500;
}

.calendar-day-revenue {
  font-size: 0.72rem;
  color: var(--color-red-600);
  font-weight: 700;
}

.calendar-day-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 0.3rem;
  flex: 1;
  align-items: stretch;
}

.calendar-chip {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.calendar-chip.is-preview {
  border: 1px dashed currentColor;
  background: transparent !important;
  font-style: italic;
  opacity: 0.85;
}

.calendar-chip-more {
  background: var(--color-surface) !important;
  color: var(--color-slate-700) !important;
  text-align: center;
  font-weight: 700;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding: 0.6rem 0.75rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
}

.calendar-legend .calendar-chip {
  cursor: default;
}

@media (max-width: 768px) {
  .calendar-day {
    min-height: 64px;
    padding: 0.25rem 0.3rem;
    font-size: 0.7rem;
  }
  .calendar-day-blank { min-height: 64px; }
  .calendar-day-number { font-size: 0.85rem; }
  .calendar-day-count, .calendar-day-revenue { display: none; }
  .calendar-day-chips { display: none; }
  .calendar-day.has-orders::after {
    content: '';
    position: absolute;
    bottom: 0.3rem;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-blue-700);
  }
  .calendar-dow { font-size: 0.65rem; }
}

/* "Take New Order" — leaves the admin SPA and goes to the customer-facing
   intake form. Styled distinctly from sidebar route buttons since it's a
   page-level navigation, not an in-app route. */
.nav-take-order {
  display: block;
  margin: 0 0 0.85rem 0;
  padding: 0.7rem 0.85rem;
  background: var(--color-red-600);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: background 0.15s, transform 0.1s;
}
.nav-take-order:hover { background: var(--color-red-700); }
.nav-take-order:active { transform: translateY(1px); }

/* ============= NAV: accent variant ============= */
.nav-link-accent {
  background: rgba(176, 23, 32, 0.18) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  font-weight: 600 !important;
}
.nav-link-accent:hover { background: rgba(176, 23, 32, 0.35) !important; }
.nav-link-accent.active { background: var(--color-red-600) !important; border-color: var(--color-red-600) !important; }

/* ============= ORDER EDIT modal ============= */
.order-edit-header {
  margin-bottom: 0.75rem;
}

.order-edit-header h3 { margin: 0 0 0.25rem 0; }

.order-edit-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.85rem;
}

.order-edit-section h4 {
  margin: 0 0 0.6rem 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-slate-700);
}

/* Make the order modal a little wider than the default */
.order-edit { min-width: min(640px, 100%); }

/* ============= ADD RECEIPT page ============= */
.receipt-form {
  max-width: 900px;
}

.success-banner {
  background: rgba(15, 81, 50, 0.1);
  border-left: 4px solid #0f5132;
  color: #0f5132;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.selected-customer {
  padding: 0.85rem 1rem;
  background: rgba(15, 81, 50, 0.07);
  border: 1.5px solid #0f5132;
  border-radius: var(--radius-md);
}

.receipt-search-results {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 240px;
  overflow-y: auto;
}

.search-result-item-mini {
  padding: 0.55rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.92rem;
  transition: background 0.12s;
}
.search-result-item-mini:hover { background: rgba(1, 40, 104, 0.06); border-color: var(--color-blue-700); }

.tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.tier-card {
  padding: 0.85rem;
  background: white;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.tier-card:hover { background: rgba(1, 40, 104, 0.04); }
.tier-card.selected {
  border-color: var(--color-blue-700);
  background: rgba(1, 40, 104, 0.06);
}
.tier-price {
  color: var(--color-red-600);
  font-weight: 700;
  margin: 0.2rem 0;
}
.tier-desc {
  font-size: 0.8rem;
  color: var(--color-slate-700);
}

.receipt-total-display {
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--color-blue-700);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-red-600);
  text-align: center;
}

.pref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.pref-checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.6rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}
.pref-checkbox:hover { background: rgba(1, 40, 104, 0.04); }
.pref-checkbox input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
}

.addon-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.addon-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.addon-row .addon-name { font-weight: 500; font-size: 0.95rem; }
.addon-row .addon-price { color: var(--color-red-600); font-weight: 600; font-size: 0.9rem; }

.receipt-save-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  margin-top: 1rem;
  position: sticky;
  bottom: 0;
  background: var(--admin-bg);
  padding: 0.85rem 0.75rem;
  border-top: 1px solid var(--color-border);
  align-items: center;
  justify-content: space-between;
  z-index: 5;
  /* Float visually above the page background with a subtle elevation */
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
  border-radius: 6px 6px 0 0;
}

.receipt-save-bar .btn-primary { font-size: 1rem; padding: 0.85rem 1.4rem; }

.save-bar-total {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  flex: 1 1 auto;
  min-width: 0;
}

.save-bar-total-amount {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-red-600);
  letter-spacing: -0.02em;
}

.save-bar-total-meta {
  font-size: 0.75rem;
  color: var(--color-slate-700);
  margin-top: 0.15rem;
}

.save-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  /* On mobile, stack the total above the buttons full-width */
  .save-bar-total { flex-basis: 100%; }
  .save-bar-actions { flex-basis: 100%; justify-content: stretch; }
  .save-bar-actions button { flex: 1; }
}

@media (max-width: 700px) {
  .tier-grid { grid-template-columns: 1fr; }
  .pref-grid { grid-template-columns: 1fr 1fr; }
}

/* Mobile */
@media (max-width: 768px) {
  .admin-screen[data-screen="app"].active { flex-direction: column; }
  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 0.75rem;
    align-items: center;
    gap: 0.5rem;
  }
  .sidebar-brand { padding-bottom: 0; border-bottom: none; margin-bottom: 0; flex-shrink: 0; }
  .sidebar-nav { flex-direction: row; flex-wrap: nowrap; flex: 1; overflow-x: auto; }
  .sidebar-footer { flex-shrink: 0; padding-top: 0; border-top: none; display: flex; align-items: center; gap: 0.5rem; }
  .user-block { margin-bottom: 0; }
  #logout-btn { width: auto; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  /* On mobile the sidebar is a horizontal scroll — keep the Take Order
     link compact so it lives inline with the rest of the nav. */
  .nav-take-order {
    display: inline-block;
    margin: 0;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    flex-shrink: 0;
    white-space: nowrap;
  }
}

/* ============================================================
 * GHL Sync Queue panel (dashboard) — surfaces failed GHL writes.
 * The panel only renders when there's something to surface (pending or failed),
 * so these styles handle the "this stuff exists, look at it" case.
 * ============================================================ */
.ghl-queue-panel {
  border: 1px solid #f4d2c8;
  background: #fff8f5;
}
.ghl-queue-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.ghl-queue-header h3 {
  margin: 0;
}
.ghl-queue-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.ghl-queue-desc {
  margin: 0.25rem 0 1rem 0;
  color: #6b5448;
  font-size: 0.9rem;
}
.ghl-queue-actions {
  margin-bottom: 0.75rem;
}
.ghl-queue-actions .btn-primary {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}
.ghl-queue-err {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: #8a3b1f;
}

/* Pill styling — used for queue counts and other status chips */
.pill {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.pill-pending {
  background: #fff3cd;
  color: #8a6512;
  border: 1px solid #f1d99b;
}
.pill-processing {
  background: #cfe5ff;
  color: #114b8a;
  border: 1px solid #a4c8ee;
}
.pill-failed {
  background: #f8d7da;
  color: #842029;
  border: 1px solid #f1aeb5;
}

/* Tighter button variant used inline in tables */
.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  line-height: 1.1;
}
/* Monospace cell for ID-like text */
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: #555;
}
