/* ═══════════════════════════════════════
   ADMIN DASHBOARD
   Full sidebar layout, sits below sticky nav (60px)
═══════════════════════════════════════ */

#view-admin {
  background: #f0f2f5;
  min-height: 100vh;
}

.adm-shell {
  display: flex;
  min-height: calc(100vh - 60px);
}

/* ── Sidebar ── */
.adm-sidebar {
  width: 240px;
  background: var(--navy);
  border-right: 1px solid rgba(255,255,255,.07);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 60px;
  left: 0;
  height: calc(100vh - 60px);
  z-index: 200;
  overflow-y: auto;
}

.adm-sb-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}

.adm-sb-icon {
  width: 34px;
  height: 34px;
  background: rgba(249,115,22,.2);
  border: 1px solid rgba(249,115,22,.3);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.adm-sb-wordmark { }

.adm-sb-title {
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.adm-sb-sub {
  font-size: .67rem;
  color: rgba(255,255,255,.35);
  margin-top: 2px;
}

.adm-sb-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.adm-sb-section-label {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.25);
  padding: 10px 10px 4px;
}

.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: .82rem;
  font-weight: 500;
  color: rgba(255,255,255,.5);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all .13s;
  font-family: var(--font);
  width: 100%;
  position: relative;
}

.adm-nav-item:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.8);
}

.adm-nav-item.active {
  background: rgba(249,115,22,.15);
  color: var(--accent);
}

.adm-nav-item svg { flex-shrink: 0; }

.adm-nav-badge {
  margin-left: auto;
  background: #dc2626;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.adm-nav-badge:empty { display: none; }

.adm-sb-divider {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin: 6px 8px;
}

.adm-sb-footer {
  padding: 10px 8px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.adm-sb-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: .79rem;
  font-weight: 500;
  color: rgba(255,255,255,.35);
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  font-family: var(--font);
  transition: all .13s;
}

.adm-sb-back:hover {
  color: rgba(255,255,255,.65);
  background: rgba(255,255,255,.05);
}

/* ── Main area ── */
.adm-main {
  margin-left: 240px;
  flex: 1;
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
}

.adm-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 60px;
  z-index: 100;
}

.adm-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-topbar-title {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--navy);
}

.adm-topbar-sub {
  font-size: .75rem;
  color: var(--muted);
}

.adm-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-content {
  flex: 1;
  padding: 24px;
}

/* ── Sections ── */
.adm-section { display: none; }
.adm-section.active { display: block; }

/* ── Stat cards ── */
.adm-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.adm-stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
}

.adm-stat-lbl {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.adm-stat-val {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -.05em;
  line-height: 1;
  color: var(--navy);
  font-family: var(--font-display);
}

.adm-stat-chg {
  font-size: .7rem;
  margin-top: 5px;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
}

.adm-stat-chg.down { color: #dc2626; }
.adm-stat-chg.neutral { color: var(--muted); }

/* ── Cards ── */
.adm-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 16px;
}

.adm-card-hdr {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.adm-card-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--navy);
}

.adm-card-sub {
  font-size: .73rem;
  color: var(--muted);
}

/* ── Tables ── */
.adm-table-wrap { overflow-x: auto; }

.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .81rem;
}

.adm-table thead tr { background: #f9fafb; }

.adm-table th {
  padding: 9px 13px;
  text-align: left;
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.adm-table td {
  padding: 11px 13px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.adm-table tbody tr:last-child td { border-bottom: none; }
.adm-table tbody tr:hover td { background: #fafafa; }

/* ── Subtabs ── */
.adm-subtabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  gap: 0;
}

.adm-subtab {
  padding: 9px 15px;
  font-size: .81rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .13s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.adm-subtab:hover { color: var(--navy); }
.adm-subtab.active { color: var(--accent); border-bottom-color: var(--accent); }

.adm-subtab .cnt {
  background: #f3f4f6;
  color: var(--muted);
  font-size: .63rem;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.adm-subtab.active .cnt {
  background: rgba(249,115,22,.15);
  color: var(--accent);
}

/* ── Toolbar ── */
.adm-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.adm-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.adm-search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.adm-search-wrap input {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 7px 11px 7px 32px;
  font-size: .81rem;
  font-family: var(--font);
  color: var(--navy);
  outline: none;
  box-sizing: border-box;
  transition: border-color .13s, box-shadow .13s;
}

.adm-search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.1);
}

.adm-filter-select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 7px 11px;
  font-size: .79rem;
  font-family: var(--font);
  color: var(--body);
  outline: none;
  cursor: pointer;
}

/* ── Status badges ── */
.adm-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
}

.adm-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.adm-status-live     { background: #dcfce7; color: #15803d; }
.adm-status-pending  { background: #fef9c3; color: #a16207; }
.adm-status-suspended{ background: #fee2e2; color: #b91c1c; }
.adm-status-new      { background: #dbeafe; color: #1d4ed8; }
.adm-status-responded{ background: #f0fdf4; color: #15803d; }
.adm-status-closed   { background: #f3f4f6; color: var(--muted); }

/* ── Role badges ── */
.adm-role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: .67rem;
  font-weight: 700;
}

.adm-role-super { background: rgba(249,115,22,.12); color: var(--accent); border: 1px solid rgba(249,115,22,.25); }
.adm-role-mod   { background: #ede9fe; color: #7c3aed; border: 1px solid #c4b5fd; }

/* ── Avatar ── */
.adm-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #dc2626);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-display);
}

/* ── Grid layouts ── */
.adm-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.adm-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Empty state ── */
.adm-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.adm-empty-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: .4;
}

.adm-empty-title {
  font-size: .87rem;
  font-weight: 600;
  color: var(--body);
  margin-bottom: 4px;
}

.adm-empty-sub { font-size: .78rem; }

/* ── Activity feed ── */
.adm-activity-item {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid #f3f4f6;
  align-items: flex-start;
}

.adm-activity-item:last-child { border-bottom: none; }

.adm-activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.adm-activity-dot.green  { background: #16a34a; }
.adm-activity-dot.orange { background: var(--accent); }
.adm-activity-dot.blue   { background: #2563eb; }
.adm-activity-dot.red    { background: #dc2626; }
.adm-activity-dot.gray   { background: #9ca3af; }

.adm-activity-text {
  font-size: .8rem;
  color: var(--body);
  line-height: 1.5;
  flex: 1;
}

.adm-activity-text strong { color: var(--navy); font-weight: 600; }

.adm-activity-time {
  font-size: .7rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Settings ── */
.adm-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.adm-setting-group {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
}

.adm-setting-title {
  font-size: .86rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
}

.adm-field {
  margin-bottom: 12px;
}

.adm-field:last-child { margin-bottom: 0; }

.adm-field label {
  display: block;
  font-size: .76rem;
  font-weight: 600;
  color: var(--body);
  margin-bottom: 4px;
}

.adm-field input,
.adm-field select,
.adm-field textarea {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 7px 10px;
  font-size: .81rem;
  font-family: var(--font);
  color: var(--navy);
  outline: none;
  box-sizing: border-box;
  transition: border-color .13s, box-shadow .13s;
}

.adm-field input:focus,
.adm-field select:focus,
.adm-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.1);
  background: #fff;
}

.adm-field textarea { resize: vertical; min-height: 70px; }

/* ── Toggle switch ── */
.adm-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid #f3f4f6;
}

.adm-toggle-row:last-child { border-bottom: none; }

.adm-toggle-info { flex: 1; min-width: 0; }

.adm-toggle-label {
  font-size: .81rem;
  font-weight: 600;
  color: var(--navy);
}

.adm-toggle-sub {
  font-size: .71rem;
  color: var(--muted);
  margin-top: 2px;
}

.adm-toggle {
  width: 38px;
  height: 20px;
  background: #d1d5db;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  border: none;
  transition: background .2s;
  flex-shrink: 0;
  margin-left: 12px;
}

.adm-toggle.on { background: #16a34a; }
.adm-toggle.on.warn { background: #dc2626; }

.adm-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .18s;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

.adm-toggle.on::after { transform: translateX(18px); }

/* ── Add admin modal ── */
.adm-modal-field {
  margin-bottom: 14px;
}

.adm-modal-field label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--body);
  margin-bottom: 5px;
}

.adm-modal-field input,
.adm-modal-field select {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 9px 12px;
  font-size: .83rem;
  font-family: var(--font);
  color: var(--navy);
  outline: none;
  box-sizing: border-box;
  transition: border-color .13s, box-shadow .13s;
}

.adm-modal-field input:focus,
.adm-modal-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.1);
  background: #fff;
}

/* ── Quick actions ── */
.adm-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.adm-qa-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--body);
  cursor: pointer;
  font-family: var(--font);
  transition: all .13s;
}

.adm-qa-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(249,115,22,.04);
}

/* ── Tier badge ── */
.adm-tier {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: .67rem;
  font-weight: 700;
}

.adm-tier-free     { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }
.adm-tier-analytics{ background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.adm-tier-featured { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }

/* ── Section header ── */
.adm-section-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.adm-section-hdr-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--navy);
  font-family: var(--font-display);
}

.adm-section-hdr-sub {
  font-size: .77rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Review card ── */
.adm-review-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.adm-review-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.adm-review-stars {
  color: #f59e0b;
  font-size: .83rem;
  display: flex;
  gap: 1px;
}

.adm-review-text {
  font-size: .81rem;
  color: var(--body);
  line-height: 1.6;
  margin-bottom: 10px;
  background: #f9fafb;
  padding: 9px 12px;
  border-radius: var(--rsm);
  border: 1px solid var(--border);
}

.adm-review-meta {
  font-size: .73rem;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Subpanel ── */
.adm-subpanel { display: none; }
.adm-subpanel.active { display: block; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .adm-sidebar {
    width: 200px;
  }
  .adm-main { margin-left: 200px; }
  .adm-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .adm-settings-grid { grid-template-columns: 1fr; }
  .adm-2col { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .adm-sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,.07);
  }
  .adm-main { margin-left: 0; }
  .adm-sb-brand { flex: 0 0 100%; }
  .adm-sb-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 6px 8px;
    gap: 2px;
  }
  .adm-nav-item { width: auto; }
  .adm-sb-section-label { display: none; }
  .adm-sb-footer { flex: 0 0 100%; }
  .adm-shell { flex-direction: column; }
  .adm-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .adm-content { padding: 14px; }
  .adm-topbar { top: 0; position: static; }
  .adm-3col { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .adm-stats-grid { grid-template-columns: 1fr 1fr; }
}
