/* ── Chaileela Admin CSS ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #1a4731;
  --green-light: #2d6a4f;
  --gold: #d4a017;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #e2e6ea;
  --text: #1c2b22;
  --text-muted: #6b7b72;
  --danger: #c0392b;
  --success: #27ae60;
  --warn: #e67e22;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
}

/* ── Top Bar ── */
.a-topbar {
  height: 58px;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.a-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.a-logo { font-size: 22px; }
.a-topbar-right { display: flex; align-items: center; gap: 14px; }
.a-user-email { font-size: 13px; opacity: .8; }

/* ── Layout ── */
.a-layout { display: flex; min-height: calc(100vh - 58px); }

/* ── Sidebar ── */
.a-sidebar {
  width: 200px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.a-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  width: 100%;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.a-nav-item:hover { background: #f0f5f2; color: var(--green); }
.a-nav-item.active { color: var(--green); background: #e8f4ee; border-left-color: var(--green); }
.a-nav-icon { font-size: 16px; }

/* ── Main ── */
.a-main { flex: 1; padding: 28px; overflow-x: auto; }
.a-page-title { font-size: 22px; font-weight: 800; margin-bottom: 22px; color: var(--green); }
.a-section { display: block; }
.hidden { display: none !important; }

/* ── Sub-tabs (Store Ops) ── */
.a-sub-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.a-sub-tab {
  padding: 9px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .15s;
}
.a-sub-tab:hover { color: var(--green); }
.a-sub-tab.active { color: var(--green); border-bottom-color: var(--green); }

/* ── Stats Grid ── */
.a-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.a-stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px;
  text-align: center;
  border-top: 3px solid var(--green);
}
.a-stat-icon { font-size: 26px; margin-bottom: 8px; }
.a-stat-val { font-size: 28px; font-weight: 800; color: var(--green); }
.a-stat-lbl { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ── Table ── */
.a-table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.a-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 13px;
}
.a-table th {
  background: var(--green);
  color: #fff;
  padding: 11px 14px;
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
}
.a-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.a-table tr:last-child td { border-bottom: none; }
.a-table tr:hover td { background: #f8fbf9; }

/* ── Buttons ── */
.a-btn {
  padding: 7px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: opacity .15s;
}
.a-btn:hover { opacity: .88; }
.a-btn-primary { background: var(--green); color: #fff; }
.a-btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.a-btn-sm { padding: 4px 10px; font-size: 12px; }
.a-btn-danger { background: var(--danger); color: #fff; }
.a-btn-warn { background: var(--warn); color: #fff; }

/* ── Action Bar ── */
.a-action-bar { margin-bottom: 14px; }

/* ── Status Badges ── */
.a-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-active, .badge-completed { background: #d4edda; color: #155724; }
.badge-draft, .badge-placed { background: #d1ecf1; color: #0c5460; }
.badge-paused, .badge-preparing, .badge-confirmed { background: #fff3cd; color: #856404; }
.badge-expired, .badge-canceled, .badge-refunded { background: #f8d7da; color: #721c24; }
.badge-ready { background: #cce5ff; color: #004085; }
.badge-admin { background: #e2d9f3; color: #432874; }
.badge-customer { background: #f0f5f2; color: var(--text-muted); }

/* ── Tabs ── */
.a-tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 2px solid var(--border); }
.a-tab {
  padding: 8px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.a-tab.active { color: var(--green); border-bottom-color: var(--green); }
.a-tab-content { display: block; }

/* ── Detail Panel ── */
.a-detail-panel {
  margin-top: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  border-top: 3px solid var(--gold);
}
.a-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.a-detail-header h2 { font-size: 17px; font-weight: 800; }

.a-loyalty-info {
  background: #f0f5f2;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}
.a-loyalty-info .lval { font-size: 20px; font-weight: 800; color: var(--green); }
.a-loyalty-info .llbl { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }

/* ── Modal ── */
.a-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.a-modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.a-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
  margin-bottom: 18px;
}
.a-modal-header h2 { font-size: 17px; font-weight: 800; }
.a-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
}

/* ── Form ── */
.a-form { padding: 0 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.a-field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.a-field label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.a-field input,
.a-field select,
.a-field textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.a-field input:focus,
.a-field select:focus,
.a-field textarea:focus { border-color: var(--green); }
.a-field-row { display: flex; gap: 14px; }
.a-field-check { flex-direction: row; align-items: center; gap: 8px; }
.a-field-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--green); }
.a-field-check label { text-transform: none; font-size: 14px; color: var(--text); font-weight: 600; }

.a-day-checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.a-day-checks label { display: flex; align-items: center; gap: 5px; font-weight: 600; font-size: 13px; color: var(--text); text-transform: none; letter-spacing: 0; cursor: pointer; }
.a-day-checks input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--green); cursor: pointer; }

.a-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ── Status Select (inline) ── */
.a-status-select {
  padding: 4px 8px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  background: var(--surface);
  cursor: pointer;
}

/* ── Toast ── */
.a-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--green);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.a-toast.show { transform: translateY(0); opacity: 1; }

/* ── Empty State ── */
.a-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ── Admin Login Overlay ── */
.a-login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 36, 22, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(6px);
}
.a-login-overlay.hidden { display: none; }
.a-login-box {
  background: #fff;
  border-radius: 18px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
}
.a-login-brand { text-align: center; margin-bottom: 28px; }
.a-login-brand h1 { font-size: 22px; font-weight: 800; color: var(--green); margin-top: 8px; }
.a-login-error {
  background: #fdf2f2;
  color: var(--danger);
  border: 1px solid #f5c6c6;
  border-radius: 7px;
  padding: 10px 13px;
  font-size: 13px;
  margin-bottom: 14px;
}
.a-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  transition: border-color .2s;
  outline: none;
}
.a-input:focus { border-color: var(--green-light); }
