/* *********************
 * FILE: assets/admin.css
 * PURPOSE: Admin-area styles. Self-contained — does NOT import brand.css or
 *          landing.css. Admin intentionally uses a cool/neutral palette so
 *          changes to the public landing can't ripple into the admin panel.
 *          Organized by section banner to match the admin page files under
 *          main_site/admin/.
 * ********************* */


/* ─── ADMIN TOKENS (own palette, cool/neutral, not shared with landing) ─ */
:root {
  --bg: #fafaf9;
  --bg-alt: #f5f5f4;
  --surface: #ffffff;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --text: #0b1220;
  --text-muted: #57534e;
  --text-dim: #78716c;
  --accent: #0b1220;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warn: #ca8a04;
  --warn-bg: #fefce8;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(11,18,32,0.04);
  --shadow: 0 8px 24px -8px rgba(11,18,32,0.12);
  --shadow-lg: 0 30px 60px -20px rgba(11,18,32,0.25);
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; line-height: 1.5; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
code, pre { font-family: var(--font-mono); }
h1, h2, h3, h4, h5 { margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }


/* ─── BASE COMPONENTS (buttons, pills, inputs — admin flavour) ─────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease; text-decoration: none; font-family: inherit; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1c2434; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-alt); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-full { width: 100%; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-warn    { background: var(--warn-bg);    color: var(--warn); }
.pill-danger  { background: var(--danger-bg);  color: var(--danger); }
.pill-info    { background: var(--info-bg);    color: var(--info); }
.pill-neutral { background: var(--bg-alt);     color: var(--text-muted); }
.pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

.input { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11,18,32,0.08); }
.label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.02em; margin-bottom: 6px; }
.eyebrow { font-size: 11px; letter-spacing: 0.14em; color: var(--text-dim); font-weight: 600; text-transform: uppercase; }
.mono { font-family: var(--font-mono); font-size: 12px; }


/* ─── SHELL (admin/_layout.php) ────────────────────────────────────── */
body.admin { background: var(--bg-alt); }

.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #0b1220; color: #cbd5e1; padding: 20px 0; font-size: 13px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sb-brand { padding: 0 20px 24px; display: flex; align-items: center; gap: 10px; }
.sb-logo { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; }
.sb-title { color: #fff; font-weight: 600; font-size: 14px; }
.sb-sub { font-size: 11px; color: #64748b; }
.sb-group-label { font-size: 10px; letter-spacing: 0.14em; color: #64748b; padding: 0 20px 8px; font-weight: 600; margin-top: 18px; }
.sb-link { display: flex; align-items: center; gap: 12px; padding: 9px 20px; color: #cbd5e1; text-decoration: none; border-left: 2px solid transparent; font-size: 13px; }
.sb-link:hover { background: #1e293b; color: #fff; }
.sb-link.active { background: #1e293b; color: #fff; border-left-color: #8b5cf6; }
.sb-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.admin-main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 10; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 999px; background: #ede9fe; color: #6d28d9; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.live-pill { color: var(--success); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.live-pill.sandbox { color: var(--warn); }
.live-pill .dot { width: 7px; height: 7px; background: currentColor; border-radius: 999px; }

.content { flex: 1; padding: 28px 32px; overflow: auto; }

.page-head { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }
.page-head .sub { color: var(--text-muted); font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.kpi-l { font-size: 10px; color: var(--text-dim); letter-spacing: 0.08em; font-weight: 600; margin-bottom: 8px; text-transform: uppercase; }
.kpi-v { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.kpi-d { font-size: 12px; font-weight: 600; margin-top: 4px; }
.kpi-d.up { color: var(--success); }
.kpi-d.down { color: var(--danger); }

.panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.panel + .panel { margin-top: 16px; }
.panel-head { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.panel-head h3 { font-size: 15px; font-weight: 600; }
.panel-body { padding: 18px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 10px 16px; background: #f9fafb; border-bottom: 1px solid var(--border); font-size: 11px; letter-spacing: 0.08em; color: var(--text-dim); font-weight: 600; text-transform: uppercase; }
.tbl td { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tr:hover { background: #fafafa; }
.tbl td form { display: inline; }

.note { padding: 14px 18px; border-radius: 10px; font-size: 12px; line-height: 1.55; margin: 14px 0; }
.note-info { background: var(--info-bg); color: #075985; border: 1px solid #bae6fd; }
.note-warn { background: var(--warn-bg); color: #7f1d1d; border: 1px solid #fde68a; }
.note-danger { background: var(--danger-bg); color: #7f1d1d; border: 1px solid #fecaca; }
.note-ok { background: var(--success-bg); color: #065f46; border: 1px solid #bbf7d0; }

.flash { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.flash.ok    { background: var(--success-bg); color: var(--success); border-color: #a7f3d0; }
.flash.error { background: var(--danger-bg);  color: var(--danger);  border-color: #fecaca; }
.flash.warn  { background: var(--warn-bg);    color: var(--warn);    border-color: #fde68a; }
.flash.info  { background: var(--info-bg);    color: var(--info);    border-color: #bae6fd; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-stack > * + * { margin-top: 14px; }
textarea.input { min-height: 84px; font-family: inherit; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2378716c' d='M1 1l5 5 5-5'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

/* Login page (centered card, no shell) */
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg-alt); padding: 24px; }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 32px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 24px; margin-bottom: 6px; }
.login-card .lede { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

/* Small utility classes */
.stack-xs > * + * { margin-top: 6px; }
.stack-sm > * + * { margin-top: 10px; }
.stack    > * + * { margin-top: 14px; }
.stack-lg > * + * { margin-top: 22px; }
.muted { color: var(--text-muted); }
.dim   { color: var(--text-dim); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row.cols-3 { grid-template-columns: 1fr; }
  .content { padding: 20px; }
}
