/*
 * Design system for the internal dashboard shell (sidebar nav, Classify,
 * Browse, Pending Matches, Partnerships list, Media Kit, Stories, Sync).
 *
 * Deliberately separate from style.css rather than editing it in place:
 * style.css's existing classes (.queue-row, .platform-badge, .stat-tiles,
 * .breakdown-*, .section-title, .meta, ...) are still load-bearing for
 * partnership_detail.html, which keeps its current look untouched by
 * request. Every class in here is new/renamed (.qcard, .badge, .pill,
 * .stat-chip, .dtable, ...) specifically so restyling this stylesheet can
 * never change how that page renders. base.html/style.css are otherwise
 * left exactly as they were.
 */

:root {
  --db-paper: #eef1f7;
  --db-surface: #ffffff;
  --db-ink: #161a22;
  --db-ink-soft: #444b58;
  --db-muted: #7b8494;
  --db-line: #e2e6ee;
  --db-line-strong: #cbd2e0;
  --db-accent: #1f4fd6;
  --db-accent-deep: #13328f;
  --db-accent-tint: #eaf0ff;
  --db-good: #178a52;
  --db-good-tint: #e4f7ec;
  --db-warn: #a5720a;
  --db-warn-tint: #fff4d6;
  --db-danger: #d1453b;
  --db-danger-tint: #fbe9e8;
  --db-focus: #1f4fd6;
  --db-shadow: 0 1px 2px rgba(20, 24, 33, 0.04), 0 1px 1px rgba(20, 24, 33, 0.03);
}

@media (prefers-color-scheme: dark) {
  :root {
    --db-paper: #12141a;
    --db-surface: #1b1f28;
    --db-ink: #eef0f5;
    --db-ink-soft: #c3c9d6;
    --db-muted: #8991a3;
    --db-line: #2b303c;
    --db-line-strong: #3a4050;
    --db-accent: #6f8dff;
    --db-accent-deep: #a6b8ff;
    --db-accent-tint: #1c2542;
    --db-good: #4fd18d;
    --db-good-tint: #113526;
    --db-warn: #e8b854;
    --db-warn-tint: #3a2e0f;
    --db-danger: #ff8a80;
    --db-danger-tint: #3a1a17;
    --db-focus: #6f8dff;
    --db-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

.db-body { margin: 0; background: var(--db-paper); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif; font-size: 14px; color: var(--db-ink); }

.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--db-surface);
  border-right: 1px solid var(--db-line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  font-family: "Poppins", sans-serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
  padding: 6px 10px 18px;
  color: var(--db-ink);
  text-decoration: none;
  display: block;
}
.sidebar-brand b { color: var(--db-accent); }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; }
.nav-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--db-muted);
  padding: 0 10px 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--db-ink-soft);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  margin-left: -3px;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-link:hover { background: var(--db-paper); color: var(--db-ink); }
.nav-link.is-active {
  background: var(--db-accent-tint);
  color: var(--db-accent-deep);
  font-weight: 600;
  border-left-color: var(--db-accent);
}
.nav-link.is-active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--db-accent);
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-variant-numeric: tabular-nums;
  min-width: 16px;
  text-align: center;
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--db-line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--db-accent-tint); color: var(--db-accent-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-email { font-size: 12px; color: var(--db-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-signout { margin-left: auto; font-size: 11.5px; color: var(--db-muted); text-decoration: none; flex-shrink: 0; }
.sidebar-signout:hover { color: var(--db-ink); }

.db-main { flex: 1; min-width: 0; padding: 26px 36px 60px; max-width: 1180px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; color: var(--db-ink); }
.page-subtitle { color: var(--db-muted); font-size: 13px; margin: 0; max-width: 640px; line-height: 1.5; }

.db-flash-list { margin-bottom: 16px; }
.db-flash {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
  word-break: break-word;
}
.db-flash-success { background: var(--db-good-tint); color: var(--db-good); }
.db-flash-error { background: var(--db-danger-tint); color: var(--db-danger); }

.db-empty { color: var(--db-muted); font-style: italic; font-size: 13.5px; }

/* ---------- stat strip ---------- */
.stat-strip { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.stat-chip {
  background: var(--db-surface);
  border: 1px solid var(--db-line);
  border-radius: 10px;
  padding: 11px 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  box-shadow: var(--db-shadow);
}
.stat-chip .n { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--db-ink); }
.stat-chip .l { font-size: 12px; color: var(--db-muted); }
.stat-chip.accent .n { color: var(--db-accent-deep); }
.stat-chip.warn .n { color: var(--db-warn); }

/* ---------- filter pills ---------- */
.pillbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pillbar .divider { width: 1px; height: 18px; background: var(--db-line-strong); margin: 0 2px; }
.pillbar .pillbar-label { font-size: 12px; color: var(--db-muted); }
.pill {
  appearance: none;
  border: 1px solid var(--db-line-strong);
  background: var(--db-surface);
  color: var(--db-ink-soft);
  font-family: "Inter", sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pill:hover { border-color: var(--db-accent); color: var(--db-ink); }
.pill.is-active { background: var(--db-accent); border-color: var(--db-accent); color: #fff; }
.pill-ghost { border-style: dashed; color: var(--db-muted); }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- buttons + inputs ---------- */
.btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--db-accent); color: #fff; }
.btn-primary:hover { background: var(--db-accent-deep); }
.btn-primary:disabled { background: var(--db-muted); cursor: default; }
.btn-good { background: var(--db-good); color: #fff; }
.btn-good:hover { filter: brightness(0.92); }
.btn-danger { background: var(--db-danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-ghost { background: transparent; color: var(--db-ink-soft); border: 1px solid var(--db-line-strong); }
.btn-ghost:hover { border-color: var(--db-ink-soft); color: var(--db-ink); }
.btn-sm { padding: 6px 11px; font-size: 12px; }

.field-input {
  padding: 7px 10px;
  border: 1px solid var(--db-line-strong);
  border-radius: 7px;
  font-family: "Inter", sans-serif;
  font-size: 12.5px;
  width: 128px;
  background: var(--db-surface);
  color: var(--db-ink);
}
.field-input:focus { outline: 2px solid var(--db-focus); outline-offset: 1px; border-color: var(--db-focus); }
.field-input::placeholder { color: var(--db-muted); }
.field-input-wide { width: auto; flex: 1; min-width: 220px; }

.db-inline-form { display: flex; gap: 8px; margin-bottom: 20px; }

/* ---------- classify queue cards ---------- */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--db-accent-tint);
  border: 1px solid var(--db-accent);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--db-accent-deep);
}

.card-list { display: flex; flex-direction: column; gap: 8px; }
.qcard {
  background: var(--db-surface);
  border: 1px solid var(--db-line);
  border-radius: 10px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--db-shadow);
  transition: border-color 0.12s ease;
}
.qcard:hover { border-color: var(--db-line-strong); }
.qcard input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--db-accent); cursor: pointer; flex-shrink: 0; }

.qcard-members { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.qmember { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; min-width: 0; }
.qmember .cap { color: var(--db-ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 460px; }
.qmember .cap:hover { color: var(--db-accent-deep); text-decoration: underline; }
.qmember .cap.cap-full { white-space: normal; overflow: visible; text-overflow: clip; max-width: 620px; }
.qmember .qmeta { color: var(--db-muted); font-size: 11.5px; white-space: nowrap; flex-shrink: 0; }

.badge {
  font-family: "Inter", sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2.5px 7px;
  border-radius: 5px;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  display: inline-block;
}
a.badge { cursor: pointer; }
a.badge:hover { opacity: 0.85; }
.badge-instagram { background: linear-gradient(135deg, #f6a03a, #dd2a7b 55%, #8134af); }
.badge-tiktok { background: #0b0b0b; }
.badge-facebook { background: #1877f2; }
.badge-youtube { background: #ff0000; }

.qcard-classify { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.row-select { display: flex; align-items: center; padding-right: 2px; flex-shrink: 0; }
.row-select input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--db-accent); }

/* ---------- table ---------- */
.table-card { background: var(--db-surface); border: 1px solid var(--db-line); border-radius: 12px; box-shadow: var(--db-shadow); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.dtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dtable thead th {
  position: sticky; top: 0;
  background: var(--db-surface);
  text-align: left;
  color: var(--db-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--db-line);
  white-space: nowrap;
}
.dtable td { padding: 10px 12px; border-bottom: 1px solid var(--db-line); white-space: nowrap; color: var(--db-ink-soft); }
.dtable tbody tr:hover td { background: var(--db-paper); }
.dtable tbody tr:last-child td { border-bottom: none; }
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.dtable .cap-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtable .cap-cell a { color: var(--db-ink); text-decoration: none; font-weight: 500; }
.dtable .cap-cell a:hover { color: var(--db-accent-deep); text-decoration: underline; }
.dtable .db-empty { padding: 24px 12px; white-space: normal; }

.status-chip { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.status-good { background: var(--db-good-tint); color: var(--db-good); }
.status-warn { background: var(--db-warn-tint); color: var(--db-warn); }
.status-bad { background: var(--db-danger-tint); color: var(--db-danger); }

.row-classify-form { display: flex; gap: 6px; align-items: center; }
.row-classify-form .field-input { width: 96px; padding: 5px 8px; font-size: 11.5px; }
.classified-pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--db-good);
  background: var(--db-good-tint);
  padding: 2px 7px;
  border-radius: 999px;
  margin-bottom: 3px;
}

/* ---------- pending matches ---------- */
.pcard {
  background: var(--db-surface);
  border: 1px solid var(--db-line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 14px;
  box-shadow: var(--db-shadow);
}
.pcard-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pcard-vs { color: var(--db-muted); font-size: 11.5px; text-align: center; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.pcard-actions { display: flex; flex-direction: column; gap: 6px; }

/* ---------- partnership list ---------- */
.plist { display: flex; flex-direction: column; gap: 10px; }
.pnr-card { background: var(--db-surface); border: 1px solid var(--db-line); border-radius: 10px; padding: 16px; box-shadow: var(--db-shadow); }
.pnr-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pnr-card h2 { font-family: "Poppins", sans-serif; font-size: 15px; font-weight: 600; margin: 0; }
.pnr-card h2 a { color: var(--db-ink); text-decoration: none; }
.pnr-card h2 a:hover { color: var(--db-accent-deep); text-decoration: underline; }
.pnr-count {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--db-accent-tint); color: var(--db-accent-deep); white-space: nowrap; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.pnr-count.is-empty { background: var(--db-danger-tint); color: var(--db-danger); }
.pnr-content-types { margin: 0 0 12px; padding-left: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.pnr-content-types li {
  font-size: 11.5px; color: var(--db-ink-soft); background: var(--db-paper);
  border: 1px solid var(--db-line); border-radius: 999px; padding: 3px 10px;
}
.pnr-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pnr-actions .db-inline-form { margin-bottom: 0; flex: 1; min-width: 200px; }

/* ---------- media kit ---------- */
.mk-section-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 15px; margin: 0 0 12px; color: var(--db-ink); }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 26px; }
.mk-card { background: var(--db-surface); border: 1px solid var(--db-line); border-radius: 12px; padding: 16px; box-shadow: var(--db-shadow); }
.mk-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.mk-account { font-weight: 600; font-size: 13.5px; color: var(--db-ink); }
.mk-followers { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.mk-followers .n { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 26px; font-variant-numeric: tabular-nums; color: var(--db-ink); }
.mk-followers .l { font-size: 11.5px; color: var(--db-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.mk-views { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.mk-views-tile { background: var(--db-paper); border-radius: 8px; padding: 8px 10px; }
.mk-views-tile .n { display: block; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--db-ink); overflow-wrap: break-word; }
.mk-views-tile .l { display: block; font-size: 10px; color: var(--db-muted); margin-top: 2px; }
.mk-updated { margin: 0; font-size: 11px; color: var(--db-muted); }

/* ---------- sync ---------- */
.db-sync-status { margin-top: 20px; }
.db-sync-log {
  background: #0f1117;
  color: #d8dce4;
  padding: 14px;
  border-radius: 10px;
  height: 400px;
  overflow-y: auto;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
  box-shadow: var(--db-shadow);
}
.db-error { color: var(--db-danger); font-weight: 600; font-size: 13px; }
.db-sync-step { color: var(--db-ink-soft); font-size: 13.5px; margin: 0 0 12px; }

/* ---------- stories ---------- */
.stories-table-wrap { overflow-x: auto; margin-bottom: 12px; border: 1px solid var(--db-line); border-radius: 12px; box-shadow: var(--db-shadow); }
.stories-table { width: 100%; border-collapse: collapse; background: var(--db-surface); font-size: 12.5px; }
.stories-table th, .stories-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--db-line); white-space: nowrap; }
.stories-table th { color: var(--db-muted); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.stories-table tr:last-child td { border-bottom: none; }
.stories-table tbody tr:hover td { background: var(--db-paper); }
.stories-table input, .stories-table select {
  padding: 6px 8px;
  border: 1px solid var(--db-line-strong);
  border-radius: 6px;
  font-size: 12px;
  font-family: "Inter", sans-serif;
  background: var(--db-surface);
  color: var(--db-ink);
  width: 100px;
}
.stories-table input:focus, .stories-table select:focus { outline: 2px solid var(--db-focus); outline-offset: 1px; }
.stories-table input.ns-number { width: 64px; }
.stories-table input.stories-caption-input { width: 180px; }
.stories-table input[type="date"] { width: 130px; }
.stories-row-actions { display: flex; gap: 6px; }
.remove-row-btn {
  background: transparent;
  color: var(--db-muted);
  border: none;
  font-size: 16px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}
.remove-row-btn:hover { color: var(--db-danger); }
.stories-add-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.hidden-story-form { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .db-main { padding: 20px; }
  .pcard { grid-template-columns: 1fr; }
}
