:root {
  --admin-bg: #0d0d0d;
  --admin-panel: #151515;
  --admin-panel-2: #1b1b1b;
  --admin-border: #2b2b2b;
  --admin-gold: #e4c590;
  --admin-gold-dark: #b89a68;
  --admin-text: #f5f2eb;
  --admin-muted: #a8a8a8;
  --admin-danger: #e66a6a;
  --admin-success: #77c79a;
  --admin-warning: #e6b86a;
  --admin-radius: 14px;
  --admin-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--admin-bg);
  color: var(--admin-text);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.admin-auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 10% 10%, rgba(228, 197, 144, 0.11), transparent 34%),
    radial-gradient(circle at 90% 90%, rgba(228, 197, 144, 0.08), transparent 28%),
    #0d0d0d;
}

.auth-shell {
  width: min(980px, 100%);
  min-height: 610px;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  overflow: hidden;
  border: 1px solid var(--admin-border);
  border-radius: 22px;
  background: var(--admin-panel);
  box-shadow: var(--admin-shadow);
}

.auth-brand-panel {
  position: relative;
  padding: 56px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(rgba(9, 9, 9, 0.78), rgba(9, 9, 9, 0.88)),
    url("../images/footer-bg.jpg") center/cover;
}
.auth-brand-panel::after {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(228, 197, 144, 0.22);
  pointer-events: none;
}
.auth-brand-content, .auth-brand-footer { position: relative; z-index: 1; }
.auth-logo { width: 170px; margin-bottom: 56px; }
.auth-kicker {
  margin: 0 0 12px;
  color: var(--admin-gold);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 700;
}
.auth-brand-panel h1 {
  margin: 0 0 18px;
  font-family: "Forum", serif;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 400;
  line-height: 1;
}
.auth-brand-panel p { color: #c2c2c2; line-height: 1.7; }
.auth-brand-footer { font-size: 13px; color: #9f9f9f; }

.auth-form-panel {
  padding: 58px 62px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-form-panel h2 {
  margin: 0 0 8px;
  font-family: "Forum", serif;
  font-size: 40px;
  font-weight: 400;
}
.auth-lead { margin: 0 0 30px; color: var(--admin-muted); line-height: 1.6; }
.auth-form { display: grid; gap: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 13px; font-weight: 700; color: #dedede; }
.field input,
.field select,
.field textarea {
  width: 100%;
  color: var(--admin-text);
  background: #101010;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 13px 14px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--admin-gold);
  box-shadow: 0 0 0 3px rgba(228, 197, 144, 0.12);
}
.field-hint { font-size: 12px; color: var(--admin-muted); line-height: 1.5; }
.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 78px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 54px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--admin-muted);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--admin-gold);
  background: rgba(228, 197, 144, 0.08);
}

.admin-primary-btn,
.admin-secondary-btn,
.admin-danger-btn,
.admin-icon-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 42px;
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  transition: 160ms ease;
}
.admin-primary-btn { background: var(--admin-gold); color: #17120a; }
.admin-primary-btn:hover, .admin-primary-btn:focus-visible { background: #f1d5a2; }
.admin-secondary-btn { background: transparent; color: var(--admin-text); border-color: #3b3b3b; }
.admin-secondary-btn:hover, .admin-secondary-btn:focus-visible { border-color: var(--admin-gold); color: var(--admin-gold); }
.admin-danger-btn { background: rgba(230, 106, 106, 0.1); color: #ff9a9a; border-color: rgba(230, 106, 106, 0.35); }
.admin-danger-btn:hover, .admin-danger-btn:focus-visible { background: rgba(230, 106, 106, 0.18); }
.admin-icon-btn { min-width: 38px; min-height: 38px; padding: 8px; background: transparent; color: var(--admin-muted); border-color: #383838; }
.admin-icon-btn:hover, .admin-icon-btn:focus-visible { color: var(--admin-gold); border-color: var(--admin-gold); }
.admin-primary-btn:focus-visible,
.admin-secondary-btn:focus-visible,
.admin-danger-btn:focus-visible,
.admin-icon-btn:focus-visible,
a:focus-visible,
button:focus-visible { outline: 3px solid rgba(228, 197, 144, 0.35); outline-offset: 2px; }

.auth-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 2px; }
.auth-switch { color: var(--admin-muted); font-size: 14px; }
.auth-switch a { color: var(--admin-gold); font-weight: 700; }
.auth-back { display: inline-flex; margin-top: 28px; color: var(--admin-muted); font-size: 14px; }
.auth-back:hover { color: var(--admin-gold); }
.auth-note {
  margin-top: 24px;
  padding: 12px 14px;
  border: 1px solid rgba(228, 197, 144, 0.22);
  background: rgba(228, 197, 144, 0.06);
  color: #c5b99f;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.55;
}
.form-message { min-height: 20px; margin: 0; font-size: 13px; }
.form-message.error { color: #ff9a9a; }
.form-message.success { color: var(--admin-success); }

.admin-app { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #111;
  border-right: 1px solid var(--admin-border);
  padding: 26px 18px 20px;
  z-index: 20;
}
.admin-sidebar-logo { width: 152px; margin: 0 10px 34px; }
.admin-nav { display: grid; gap: 6px; }
.admin-nav-link {
  min-height: 46px;
  padding: 11px 13px;
  border-radius: 10px;
  color: #bdbdbd;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
}
.admin-nav-link ion-icon { font-size: 20px; }
.admin-nav-link:hover { color: var(--admin-text); background: #191919; }
.admin-nav-link.active { color: var(--admin-gold); background: rgba(228, 197, 144, 0.09); border-color: rgba(228, 197, 144, 0.15); }
.admin-sidebar-bottom { margin-top: auto; display: grid; gap: 8px; }
.admin-sidebar-user { padding: 14px; border: 1px solid var(--admin-border); border-radius: 12px; background: #151515; }
.admin-sidebar-user strong { display: block; font-size: 14px; }
.admin-sidebar-user span { display: block; color: var(--admin-muted); font-size: 12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; }

.admin-main { min-width: 0; }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 32px;
  border-bottom: 1px solid var(--admin-border);
  background: rgba(13, 13, 13, 0.94);
  backdrop-filter: blur(12px);
}
.admin-topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-mobile-menu {
  display: none;
  border: 1px solid var(--admin-border);
  background: #171717;
  color: var(--admin-text);
  border-radius: 9px;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
}
.admin-topbar h1 { margin: 0; font-size: 22px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-topbar-actions { display: flex; align-items: center; gap: 10px; }
.admin-user-chip { display: flex; align-items: center; gap: 10px; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--admin-border); background: #151515; }
.admin-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--admin-gold); color: #16110a; font-weight: 800; }
.admin-user-chip span { font-size: 13px; }

.admin-content { padding: 30px 32px 48px; }
.admin-section { display: none; }
.admin-section.active { display: block; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-heading h2 { margin: 0 0 7px; font-family: "Forum", serif; font-size: 36px; font-weight: 400; }
.section-heading p { margin: 0; color: var(--admin-muted); font-size: 14px; line-height: 1.55; }
.section-heading-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card,
.admin-card {
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: var(--admin-panel);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.stat-card { padding: 22px; }
.stat-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stat-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: rgba(228,197,144,.09); color: var(--admin-gold); font-size: 22px; }
.stat-label { color: var(--admin-muted); font-size: 13px; }
.stat-value { margin: 13px 0 3px; font-size: 30px; font-weight: 800; }
.stat-note { color: #7f7f7f; font-size: 12px; }

.dashboard-grid { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 18px; }
.admin-card { padding: 22px; }
.admin-card h3 { margin: 0 0 18px; font-size: 17px; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-action {
  min-height: 106px;
  padding: 16px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: #111;
  color: var(--admin-text);
  text-align: left;
  display: grid;
  align-content: space-between;
  gap: 14px;
}
.quick-action:hover { border-color: var(--admin-gold-dark); }
.quick-action ion-icon { color: var(--admin-gold); font-size: 25px; }
.quick-action strong { display: block; font-size: 14px; }
.quick-action span { display: block; color: var(--admin-muted); font-size: 12px; margin-top: 4px; }
.activity-list { display: grid; gap: 12px; }
.activity-item { display: flex; align-items: flex-start; gap: 10px; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--admin-gold); flex: 0 0 auto; }
.activity-item p { margin: 0; font-size: 13px; line-height: 1.5; color: #d4d4d4; }
.activity-item time { display: block; margin-top: 3px; color: #777; font-size: 11px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-group { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-search,
.admin-filter {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--admin-border);
  background: #121212;
  color: var(--admin-text);
  padding: 9px 12px;
  outline: none;
}
.admin-search { width: min(320px, 100%); }
.admin-search:focus, .admin-filter:focus { border-color: var(--admin-gold); }

.table-wrap { overflow-x: auto; border: 1px solid var(--admin-border); border-radius: var(--admin-radius); background: var(--admin-panel); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.admin-table th,
.admin-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid #272727; vertical-align: middle; }
.admin-table th { color: #9f9f9f; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; background: #121212; }
.admin-table td { font-size: 13px; color: #d7d7d7; }
.admin-table tr:last-child td { border-bottom: 0; }
.table-food { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.table-food img { width: 48px; height: 48px; object-fit: cover; border-radius: 9px; background: #222; }
.table-food strong { display: block; color: var(--admin-text); }
.table-food small { display: block; color: var(--admin-muted); margin-top: 3px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-actions { display: flex; gap: 7px; }
.status-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: capitalize; }
.status-pill.active { color: #9de2ba; background: rgba(119,199,154,.1); }
.status-pill.inactive { color: #c4c4c4; background: rgba(255,255,255,.07); }
.empty-state { padding: 44px 22px !important; text-align: center !important; color: var(--admin-muted) !important; }

.restaurant-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.restaurant-form-grid .field.full { grid-column: 1 / -1; }
.restaurant-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,.72);
}
.admin-modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid #343434;
  border-radius: 16px;
  background: #161616;
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 19px 20px; border-bottom: 1px solid var(--admin-border); }
.modal-header h3 { margin: 0; font-size: 19px; }
.modal-body { padding: 20px; display: grid; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 20px; border-top: 1px solid var(--admin-border); }

.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 130; display: grid; gap: 10px; }
.admin-toast { min-width: 260px; max-width: 380px; padding: 13px 15px; border-radius: 10px; background: #202020; border: 1px solid #3a3a3a; box-shadow: var(--admin-shadow); font-size: 13px; }
.admin-toast.success { border-color: rgba(119,199,154,.45); }
.admin-toast.error { border-color: rgba(230,106,106,.5); }

.sidebar-overlay { display: none; }
.frontend-badge { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; padding: 3px 8px; border-radius: 999px; background: rgba(228,197,144,.08); color: var(--admin-gold); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; vertical-align: middle; }

@media (max-width: 1040px) {
  .admin-app { grid-template-columns: 220px 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand-panel { min-height: 280px; padding: 38px 34px; }
  .auth-logo { margin-bottom: 30px; }
  .auth-brand-footer { display: none; }
  .auth-form-panel { padding: 38px 34px; }
  .admin-app { display: block; }
  .admin-sidebar { position: fixed; left: -280px; width: 260px; transition: left 180ms ease; }
  .admin-sidebar.open { left: 0; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 19; background: rgba(0,0,0,.62); opacity: 0; pointer-events: none; transition: 180ms ease; }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .admin-mobile-menu { display: inline-flex; }
  .admin-topbar { padding: 0 18px; }
  .admin-content { padding: 24px 18px 40px; }
  .admin-user-chip span { display: none; }
}

@media (max-width: 620px) {
  .admin-auth-page { padding: 14px; }
  .auth-shell { border-radius: 16px; }
  .auth-brand-panel { display: none; }
  .auth-form-panel { padding: 34px 22px; min-height: calc(100vh - 28px); }
  .form-row { grid-template-columns: 1fr; }
  .auth-actions { align-items: stretch; flex-direction: column; }
  .auth-actions .admin-primary-btn { width: 100%; }
  .password-wrap input { padding-right: 76px; }
  .stats-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .section-heading { flex-direction: column; }
  .section-heading-actions { width: 100%; }
  .section-heading-actions .admin-primary-btn, .section-heading-actions .admin-secondary-btn { flex: 1; }
  .restaurant-form-grid { grid-template-columns: 1fr; }
  .restaurant-form-grid .field.full { grid-column: auto; }
  .admin-topbar-actions .admin-secondary-btn { display: none; }
  .admin-topbar h1 { font-size: 18px; }
}

/* Super-admin approval workflow */
.admin-request-count {
  margin-left: auto;
  min-width: 22px;
  min-height: 22px;
  padding: 2px 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--admin-gold);
  color: #17120a;
  font-size: 10px;
  font-weight: 800;
}

.admin-compact-btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.status-pill.pending {
  color: #f1cf8c;
  background: rgba(230, 184, 106, 0.12);
}

.status-pill.approved {
  color: #9de2ba;
  background: rgba(119, 199, 154, 0.1);
}

.status-pill.rejected {
  color: #ff9a9a;
  background: rgba(230, 106, 106, 0.1);
}


/* Password recovery */
.auth-help-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -7px;
}

.forgot-password-link,
.reset-link {
  color: var(--admin-gold);
  font-size: 13px;
  font-weight: 700;
}

.forgot-password-link:hover,
.forgot-password-link:focus-visible,
.reset-link:hover,
.reset-link:focus-visible {
  color: #f1d5a2;
}

.reset-step[hidden] { display: none !important; }

.reset-email-summary {
  padding: 12px 14px;
  border: 1px solid rgba(228, 197, 144, 0.22);
  border-radius: 10px;
  background: rgba(228, 197, 144, 0.06);
  color: var(--admin-muted);
  font-size: 13px;
}

.reset-email-summary strong {
  color: var(--admin-text);
  word-break: break-word;
}

.verification-code-input {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.35em;
  font-variant-numeric: tabular-nums;
}

.reset-actions {
  margin-top: 2px;
}

@media (max-width: 620px) {
  .auth-help-row { justify-content: flex-start; }
  .reset-actions { align-items: stretch; flex-direction: column; }
  .reset-actions .admin-primary-btn,
  .reset-actions .admin-secondary-btn { width: 100%; }
}
