/* ==========================================================================
   Black Faith Network — admin panel
   Sidebar + topbar layout. Brand red, Aleo headings, Cabin body (same as the site).
   ========================================================================== */

:root {
  --red: #e00d2d;
  --red-dark: #b80a24;
  --red-soft: #fdecef;
  --ink: #1b1d22;
  --ink-2: #4b5060;
  --ink-3: #7c8293;
  --line: #e6e8ee;
  --line-2: #d5d9e2;
  --bg: #f4f5f8;
  --card: #ffffff;
  --side: #141414;
  --side-2: #1d1d1d;
  --side-text: #a9a5a0;
  --blue: #2563eb;   --blue-soft: #e8efff;
  --amber: #b7791f;  --amber-soft: #fdf3dd;
  --green: #1f8a3c;  --green-soft: #e5f5ea;
  --gray-soft: #eef0f4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --font-display: "Aleo", Georgia, serif;
  --font-body: "Cabin", "Segoe UI", system-ui, sans-serif;
  --side-w: 248px;
  --top-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Shell ---------- */
.admin-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40;
  background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.side-brand { display: flex; align-items: center; gap: 10px; height: var(--top-h); padding: 0 20px; border-bottom: 1px solid #262626; color: #fff; }
.side-brand img, .side-brand .brand-badge { width: 34px; height: 34px; object-fit: contain; }
.brand-badge { border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 11px; }
.side-brand strong { font-family: var(--font-display); font-size: 16px; letter-spacing: .01em; }
.side-brand strong em { font-style: normal; color: var(--red); }
.side-brand small { display: block; font-size: 11px; color: #77736e; letter-spacing: .12em; text-transform: uppercase; }

.side-nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.side-label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #6d6964; padding: 14px 12px 8px; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: var(--side-text); font-weight: 600; font-size: 14px; margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.side-link:hover { background: var(--side-2); color: #fff; }
.side-link.is-active { background: rgba(224, 13, 45, .14); color: #fff; box-shadow: inset 3px 0 0 var(--red); }
.side-link.is-active .icon { color: #ff5a72; }
.side-count { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.side-foot { padding: 14px 12px 18px; border-top: 1px solid #262626; }

.main { margin-left: var(--side-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; background: none; border: 0; padding: 8px; margin-left: -8px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.menu-btn:hover { background: var(--gray-soft); }
.top-search { position: relative; flex: 1; max-width: 420px; }
.top-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 16px; height: 16px; }
.top-search input { width: 100%; height: 40px; padding: 0 12px 0 36px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; font-size: 14px; }
.top-search input:focus { outline: none; border-color: var(--ink-3); background: #fff; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.top-link:hover { background: var(--gray-soft); color: var(--ink); }

.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; }
.user-btn:hover { background: var(--gray-soft); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-btn .who { text-align: left; line-height: 1.2; }
.user-btn .who strong { display: block; font-size: 14px; }
.user-btn .who span { font-size: 12px; color: var(--ink-3); }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 50;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
  padding: 6px; display: none;
}
.dropdown.is-open { display: block; }
.dropdown-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 13px; color: var(--ink-3); word-break: break-all; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 6px; background: none; border: 0; text-align: left; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.dropdown a:hover, .dropdown button:hover { background: var(--gray-soft); color: var(--ink); }
.dropdown form { margin: 0; }

.content { padding: 28px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.page-head h1 { font-family: var(--font-display); font-weight: 700; font-size: 26px; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.scrim { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn-light:hover { border-color: var(--ink-3); }
.btn-danger { background: #fff; color: var(--red); border-color: #f2c1c9; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 32px; padding: 0; }
.btn-block { width: 100%; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.alert-success { background: var(--green-soft); border-color: #bfe3cb; color: #17602b; }
.alert-error { background: var(--red-soft); border-color: #f2c1c9; color: #9b0a20; }
.alert .icon { margin-top: 1px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-family: var(--font-body); font-size: 16px; font-weight: 700; }
.card-head .sub { font-size: 13px; color: var(--ink-3); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.link-more { font-size: 13px; font-weight: 700; color: var(--red); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.link-more:hover { text-decoration: underline; }

.grid { display: grid; gap: 20px; }
.grid-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); align-items: start; }

.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon .icon { width: 20px; height: 20px; }
.stat-label { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.stat-note { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-green { background: var(--green-soft); color: var(--green); }

/* ---------- Status badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-new { background: var(--blue-soft); color: var(--blue); }
.badge-in_review { background: var(--amber-soft); color: var(--amber); }
.badge-approved { background: var(--green-soft); color: var(--green); }
.badge-declined { background: var(--red-soft); color: var(--red); }
.badge-off { background: var(--gray-soft); color: var(--ink-3); }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--gray-soft); color: var(--ink-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); background: #fafbfc; padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .muted { color: var(--ink-3); }
.table .nowrap { white-space: nowrap; }
.table .strong { font-weight: 700; color: var(--ink); }
.table .sub { font-size: 12px; color: var(--ink-3); }
.table .ref { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--ink-3); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; margin: 0; }
.row-link { display: block; }
.row-link:hover .strong { color: var(--red); }
.thumb { width: 72px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--gray-soft); }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty .icon { width: 36px; height: 36px; margin: 0 auto 10px; color: var(--line-2); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- Filters ---------- */
.tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 14px 10px 12px; font-weight: 700; font-size: 14px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--red); }
.tab .count { font-size: 12px; background: var(--gray-soft); color: var(--ink-2); padding: 0 7px; border-radius: 999px; }
.tab.is-active .count { background: var(--red); color: #fff; }
.filters { display: flex; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.filters .search { position: relative; flex: 1; min-width: 200px; }
.filters .search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); }
.filters input, .filters select { height: 38px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; padding: 0 12px; font-size: 14px; }
.filters .search input { width: 100%; padding-left: 34px; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--ink-2); }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 4px; align-items: center; }
.pager a, .pager span { min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--ink-2); background: #fff; }
.pager a:hover { border-color: var(--ink-3); color: var(--ink); }
.pager .is-current { background: var(--ink); border-color: var(--ink); color: #fff; }
.pager .is-disabled { color: var(--line-2); }
.pager-info { font-size: 13px; color: var(--ink-3); }

/* ---------- Bars (dashboard) ---------- */
.bar-list { list-style: none; margin: 0; padding: 0; }
.bar-list li + li { margin-top: 16px; }
.bar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 6px; }
.bar-top span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--red); }
.status-split { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.status-split a { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: block; }
.status-split a:hover { border-color: var(--ink-3); }
.status-split strong { display: block; font-family: var(--font-display); font-size: 22px; margin-top: 6px; }

/* ---------- Detail view ---------- */
.dl { display: grid; grid-template-columns: 180px minmax(0, 1fr); margin: 0; }
.dl dt { padding: 12px 20px; color: var(--ink-3); font-size: 14px; border-bottom: 1px solid var(--line); }
.dl dd { padding: 12px 20px 12px 0; margin: 0; font-weight: 600; border-bottom: 1px solid var(--line); word-break: break-word; }
.dl dd.text { font-weight: 400; white-space: pre-line; }
.dl dd a { color: var(--blue); }
.dl dd a:hover { text-decoration: underline; }
.dl > :nth-last-child(-n+2) { border-bottom: 0; }
.price-box { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.price-box strong { font-family: var(--font-display); font-size: 28px; }
.price-calc { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.creative-preview { border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #111; }
.creative-preview img, .creative-preview video { width: 100%; max-height: 260px; object-fit: contain; display: block; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.timeline li { display: flex; gap: 10px; padding: 6px 0; color: var(--ink-2); }
.timeline li span { color: var(--ink-3); margin-left: auto; white-space: nowrap; font-size: 13px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field > label, .field > .label { font-size: 14px; font-weight: 700; color: var(--ink); }
.field .opt { color: var(--ink-3); font-weight: 400; }
.field .hint { font-size: 13px; color: var(--ink-3); }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="number"], .field textarea, .field select {
  width: 100%; height: 42px; padding: 0 12px; font-size: 15px; background: #fff;
  border: 1px solid var(--line-2); border-radius: 8px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(27, 29, 34, .08); }
.field .error-msg { font-size: 13px; color: var(--red); }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--red); }
.money { position: relative; }
.money span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.money input { padding-left: 26px !important; }
.check-row { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--red); margin: 0; }
.preview-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.preview-row img { width: 180px; aspect-ratio: 16 / 10; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; background: var(--gray-soft); }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 20px; }

/* Active switch */
.switch { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 0; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.is-on { color: var(--green); }
.switch.is-on .track { background: var(--green); }
.switch.is-on .track::after { transform: translateX(16px); }

/* ---------- Login ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: #fff; }
.auth-side { background: #141414 radial-gradient(700px 400px at 20% 0%, rgba(224, 13, 45, .35), transparent 60%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .side-brand { padding: 0; border: 0; height: auto; }
.auth-side h2 { font-family: var(--font-display); font-size: 34px; font-weight: 400; line-height: 1.2; max-width: 420px; }
.auth-side p { color: #b9b5ae; max-width: 420px; }
.auth-side small { color: #77736e; font-size: 13px; }
.auth-form { display: grid; place-items: center; padding: 48px 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-family: var(--font-display); font-size: 28px; margin-bottom: 6px; }
.auth-box > p { color: var(--ink-3); margin: 0 0 24px; }
.auth-box .field + .field { margin-top: 16px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 22px; font-size: 14px; }
.auth-row a { color: var(--ink-3); }
.auth-row a:hover { color: var(--ink); text-decoration: underline; }
.btn-lg { height: 46px; font-size: 15px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-1, .grid-1-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .scrim.is-open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.45); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 680px) {
  .topbar { padding: 0 16px; gap: 10px; }
  .top-search, .user-btn .who, .top-link span { display: none; }
  .content { padding: 20px 16px; }
  .grid-stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .stat { padding: 14px; flex-direction: column; gap: 10px; }
  .stat-value { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding: 12px 16px 0; }
  .dl dd { padding: 2px 16px 12px; }
  .hide-sm { display: none; }
  .table th, .table td { padding: 11px 12px; }
  .page-head h1 { font-size: 22px; }
}

/* ---------- Copy field ---------- */
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); font-size: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--ink-2); }
