/* Singulariti TV Platform — app stylesheet.
   Brand tokens: Singulariti (Void/Night/Stone/Bone/Wash/Flare, Instrument Serif + Sans). */
:root {
  --void: #0A0A0B;
  --night: #1E1B18;
  --stone: #8A847C;
  --bone: #D9D5CB;
  --wash: #F0EDE6;
  --flare: #F2C782;
  --flare-dim: rgba(242, 199, 130, 0.14);
  --border: rgba(217, 213, 203, 0.14);
  --border-soft: rgba(217, 213, 203, 0.08);
  --pos: #F2C782;
  --neg: #C98A6B;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Instrument Sans", -apple-system, "Segoe UI", sans-serif;
  --rail-w: 216px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--void);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--sans); cursor: pointer; }
input, select, textarea { font-family: var(--sans); font-size: 14px; }
a { color: var(--flare); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
::selection { background: var(--flare-dim); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(138, 132, 124, 0.35); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ LOGIN ============ */
.login { min-height: 100vh; display: flex; flex-direction: column; position: relative; }
.login-mark { position: absolute; top: 28px; left: 32px; }
.login-mark img { height: 30px; }
.login-wrap { margin: auto; width: 100%; display: flex; justify-content: center; padding: 24px; }
.login-card {
  width: 400px; max-width: 100%;
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 44px 36px 36px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.login-title { font-family: var(--serif); font-size: 30px; font-weight: 400; color: var(--wash); text-align: center; margin-bottom: 6px; }
.login-sub { color: var(--stone); text-align: center; font-size: 13px; margin-bottom: 28px; }
.field { margin-bottom: 20px; }
.field label { display: block; font-size: 12px; color: var(--stone); margin-bottom: 8px; letter-spacing: 0.04em; text-transform: uppercase; }
.input-line {
  width: 100%; background: transparent; border: none;
  border-bottom: 2px solid var(--border);
  color: var(--wash); font-size: 16px; padding: 8px 2px; outline: none;
  transition: border-color 0.15s;
}
.input-line:focus { border-bottom-color: var(--flare); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--flare); color: #16130F; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; padding: 11px 18px;
  transition: filter 0.15s;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--bone); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--stone); filter: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.login-alt { text-align: center; margin-top: 16px; font-size: 13px; color: var(--stone); }
.login-alt a { color: var(--flare); }
.login-terms { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--stone); }
.login-terms a { color: var(--stone); }

/* ============ APP SHELL ============ */
.shell { display: flex; min-height: 100vh; }
.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w);
  background: var(--night);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 20px 12px;
  overflow-y: auto;
}
.rail-logo { padding: 0 10px 20px; border-bottom: 1px solid var(--border-soft); margin-bottom: 14px; }
.rail-logo img { height: 26px; }
.rail-group-label { font-size: 10.5px; letter-spacing: 0.12em; color: var(--stone); text-transform: uppercase; padding: 14px 10px 6px; }
.rail-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; color: var(--bone);
  font-size: 13.5px; padding: 8px 10px; border-radius: 8px; text-align: left;
  transition: background 0.12s;
}
.rail-btn:hover { background: var(--border-soft); text-decoration: none; }
.rail-btn.on { background: var(--flare-dim); color: var(--wash); font-weight: 600; }
.rail-ico { width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.75; }
.rail-spacer { flex: 1; }
.rail-foot { border-top: 1px solid var(--border-soft); padding-top: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 40;
}
.topbar-title { font-family: var(--serif); font-size: 19px; color: var(--wash); }
.topbar-crumb { color: var(--stone); font-size: 13px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.daterange { color: var(--stone); font-size: 12.5px; border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; }
.chipbtn {
  background: none; border: 1px solid var(--border); color: var(--bone);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px;
}
.chipbtn:hover { border-color: var(--stone); text-decoration: none; }
.chipbtn.on { background: var(--flare-dim); border-color: var(--flare); color: var(--wash); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--flare); color: #16130F;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
}
.view { flex: 1; padding: 24px 28px 40px; max-width: 1560px; width: 100%; }
.app-foot { padding: 18px 28px; color: var(--stone); font-size: 12px; border-top: 1px solid var(--border-soft); }

/* ============ GENERIC LAYOUT ============ */
.page-head { margin-bottom: 20px; }
.page-title { font-family: var(--serif); font-size: 30px; color: var(--wash); line-height: 1.15; }
.page-sub { color: var(--stone); font-size: 13.5px; margin-top: 6px; max-width: 760px; }
.card { background: var(--night); border: 1px solid var(--border-soft); border-radius: 12px; padding: 20px; }
.card + .card { margin-top: 16px; }
.card-title { font-size: 14px; font-weight: 600; color: var(--wash); margin-bottom: 4px; }
.card-note { font-size: 12.5px; color: var(--stone); margin-bottom: 14px; }
.split { display: grid; gap: 16px; }
.split-2-1 { grid-template-columns: 2fr 1fr; }
.split-1-2 { grid-template-columns: 1fr 2fr; }
.split-1-1 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .split-2-1, .split-1-2, .split-1-1 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.text-stone { color: var(--stone); } .text-wash { color: var(--wash); }
.small { font-size: 12.5px; }

/* ============ KPI CARDS ============ */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-card { background: var(--night); border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px 16px; }
.kpi-label { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); }
.kpi-value { font-family: var(--serif); font-size: 26px; color: var(--wash); margin: 4px 0 2px; }
.kpi-delta { font-size: 12px; color: var(--pos); }
.kpi-delta.neg { color: var(--neg); }

/* ============ TABLES ============ */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--night); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--stone); font-weight: 600; padding: 10px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); color: var(--bone); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(217, 213, 203, 0.03); }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .sub { display: block; color: var(--stone); font-size: 11.5px; }
.pub-cell { display: flex; align-items: center; gap: 9px; }
.pub-logo {
  width: 26px; height: 26px; border-radius: 6px; flex: 0 0 26px;
  background: var(--flare-dim); color: var(--flare);
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.02em;
}
.tbl input[type="checkbox"], .check input[type="checkbox"] { accent-color: var(--flare); width: 14px; height: 14px; }

/* ============ CHIPS / PILLS / STATUS ============ */
.chipbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--flare-dim); color: var(--wash);
  border: 1px solid rgba(242, 199, 130, 0.35);
  border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 12.5px;
}
.chip-x { background: none; border: none; color: var(--stone); font-size: 14px; line-height: 1; padding: 2px 6px; border-radius: 50%; }
.chip-x:hover { color: var(--wash); }
.chip-sep { color: var(--stone); font-size: 12px; }
.pill {
  display: inline-flex; align-items: center;
  background: var(--night); border: 1px solid var(--border);
  color: var(--bone); border-radius: 999px; padding: 6px 14px; font-size: 12.5px;
  cursor: pointer; transition: border-color 0.12s;
}
.pill:hover { border-color: var(--flare); color: var(--wash); text-decoration: none; }
.status { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 11.5px; font-weight: 600; }
.status-available, .status-active, .status-sent { background: rgba(156, 194, 184, 0.14); color: #9CC2B8; }
.status-sold, .status-paused { background: rgba(201, 138, 107, 0.14); color: var(--neg); }
.status-unsent { background: rgba(138, 132, 124, 0.16); color: var(--stone); }

/* ============ FORMS ============ */
.sel {
  background: var(--void); color: var(--bone); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; outline: none; max-width: 100%;
}
.sel:focus { border-color: var(--flare); }
.field-inline label { font-size: 11.5px; color: var(--stone); display: block; margin-bottom: 5px; }
.field-inline { min-width: 130px; flex: 0 1 auto; }
.input-box {
  width: 100%; background: var(--void); color: var(--wash);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; outline: none;
}
.input-box:focus { border-color: var(--flare); }

.checklist, .radiolist { display: flex; flex-direction: column; gap: 7px; }
.check, .radio { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--bone); cursor: pointer; }
.check:hover, .radio:hover { color: var(--wash); }
.radiolist input { accent-color: var(--flare); }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn {
  background: none; border: none; color: var(--stone); font-size: 12.5px;
  padding: 6px 14px; border-right: 1px solid var(--border);
}
.seg-btn:last-child { border-right: none; }
.seg-btn.on { background: var(--flare); color: #16130F; font-weight: 600; }

.toggle-btn {
  width: 40px; height: 22px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--void); position: relative; transition: background 0.15s;
}
.toggle-btn::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--stone); transition: transform 0.15s, background 0.15s;
}
.toggle-btn.on { background: var(--flare-dim); border-color: var(--flare); }
.toggle-btn.on::after { transform: translateX(18px); background: var(--flare); }

/* ============ ACCORDIONS ============ */
.acc { border: 1px solid var(--border-soft); border-radius: 10px; background: var(--night); overflow: hidden; }
.acc + .acc { margin-top: 10px; }
.acc-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: none; border: none; color: var(--wash); font-size: 14px; font-weight: 600;
  padding: 13px 16px; text-align: left;
}
.acc-head:hover { background: rgba(217, 213, 203, 0.03); }
.acc-chev { transition: transform 0.18s; color: var(--stone); flex: 0 0 auto; }
.acc.open .acc-chev { transform: rotate(180deg); }
.acc-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.2s ease; }
.acc.open .acc-body { grid-template-rows: 1fr; }
.acc-body > div { overflow: hidden; }
.acc-content { padding: 2px 16px 16px; font-size: 13px; color: var(--stone); }
.acc-content p + p { margin-top: 10px; }
.acc-content ul { margin: 8px 0 0 18px; }
.acc-content li { margin-bottom: 4px; }

/* ============ DIAGRAM ============ */
.diagram { display: flex; align-items: center; gap: 0; flex-wrap: wrap; padding: 26px 8px; }
.node {
  border: 1px solid var(--border); border-radius: 10px; background: var(--void);
  padding: 12px 18px; text-align: center; min-width: 108px;
}
.node.hl { border-color: var(--flare); background: var(--flare-dim); }
.node-label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; color: var(--wash); text-transform: uppercase; }
.node-sub { font-size: 11px; color: var(--stone); margin-top: 2px; }
.conn { flex: 1; min-width: 34px; height: 2px; background: var(--stone); position: relative; margin: 0 6px; }
.conn.dotted { background: none; border-top: 2px dashed var(--stone); height: 0; }
.conn-label {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font-size: 10.5px; color: var(--stone); white-space: nowrap;
}
.benefit-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.benefit { background: var(--night); border: 1px solid var(--border-soft); border-radius: 12px; padding: 16px; }
.benefit-ico { width: 30px; height: 30px; border-radius: 50%; background: var(--flare-dim); color: var(--flare); display: flex; align-items: center; justify-content: center; font-size: 15px; margin-bottom: 10px; }
.benefit-title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--wash); }
.benefit-body { font-size: 12.5px; color: var(--stone); margin-top: 5px; }

/* ============ SPONSOR CARDS ============ */
.sponsor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.sponsor-card { border-radius: 14px; overflow: hidden; border: 1px solid var(--border-soft); background: var(--night); }
.sponsor-img { aspect-ratio: 16/9; overflow: hidden; position: relative; }
.sponsor-img img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.05); transition: transform 0.4s; }
.sponsor-card:hover .sponsor-img img { transform: scale(1.03); }
.sponsor-stat {
  position: absolute; bottom: 10px; left: 12px;
  background: rgba(10, 10, 11, 0.82); border: 1px solid var(--border);
  color: var(--flare); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.sponsor-body { padding: 16px; }
.sponsor-title { font-family: var(--serif); font-size: 21px; color: var(--wash); }
.sponsor-blurb { font-size: 12.5px; color: var(--stone); margin-top: 6px; }

/* ============ MEASUREMENT CONFIG PANEL ============ */
.cfg-section { padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.cfg-section:last-child { border-bottom: none; }
.cfg-label { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); margin-bottom: 9px; }
.cfg-note { font-size: 12px; color: var(--stone); margin-top: 12px; padding: 10px 12px; background: var(--void); border-radius: 8px; border: 1px solid var(--border-soft); }
.callout {
  background: var(--flare-dim); border: 1px solid rgba(242, 199, 130, 0.4);
  border-radius: 10px; padding: 14px 16px; margin-top: 14px;
}
.callout-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--flare); }
.callout-body { font-size: 13px; color: var(--bone); margin-top: 4px; }

/* ============ WIZARD ============ */
.wiz-steps { display: flex; gap: 0; margin-bottom: 22px; }
.wiz-step { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--stone); padding: 8px 0; }
.wiz-step::before {
  content: attr(data-n); display: block; width: 26px; height: 26px; margin: 0 auto 6px;
  border-radius: 50%; border: 1px solid var(--border); line-height: 24px; font-weight: 700;
}
.wiz-step.on { color: var(--wash); }
.wiz-step.on::before { background: var(--flare); border-color: var(--flare); color: #16130F; }
.wiz-step.done::before { background: var(--flare-dim); border-color: var(--flare); color: var(--flare); }
.goal-card {
  display: block; width: 100%; text-align: left;
  background: var(--night); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 18px; color: var(--bone); margin-bottom: 12px;
}
.goal-card.on { border-color: var(--flare); background: var(--flare-dim); }
.goal-title { font-size: 15px; font-weight: 700; color: var(--wash); }
.goal-sub { font-size: 12.5px; color: var(--stone); margin-top: 5px; }
.channel-card { background: var(--night); border: 1px solid var(--border-soft); border-radius: 12px; padding: 16px; }
.channel-title { font-size: 14px; font-weight: 700; color: var(--wash); }
.channel-body { font-size: 12.5px; color: var(--stone); margin-top: 6px; }
.channel-pct { font-family: var(--serif); font-size: 24px; color: var(--flare); margin-top: 10px; }
.interest-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.interest-row:last-child { border-bottom: none; }
.interest-size { margin-left: auto; color: var(--stone); font-size: 12px; white-space: nowrap; }

/* ============ FREQ TABLE ============ */
.freq-bar { height: 8px; background: var(--flare); border-radius: 4px; min-width: 4px; }

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--wash); color: #16130F; font-size: 13px; font-weight: 600;
  padding: 10px 20px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ S3 PIPELINE ============ */
.pipeline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.pipe-node {
  border: 1px solid var(--border); border-radius: 10px; background: var(--void);
  padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--bone);
  display: flex; align-items: center; gap: 8px;
}
.pipe-node .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--flare); }
.pipe-conn { flex: 1; min-width: 26px; border-top: 2px dashed var(--stone); position: relative; height: 0; }
.pipe-label { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--stone); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }

/* ============ SETTINGS ============ */
.set-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.set-row:last-child { border-bottom: none; }
.set-label { font-size: 13px; color: var(--wash); font-weight: 600; min-width: 160px; }
.set-body { font-size: 13px; color: var(--stone); flex: 1; }

/* ============ RESPONSIVE ============ */
@media (max-width: 860px) {
  .rail { width: 64px; flex: 0 0 64px; padding: 16px 8px; }
  .rail-logo img { height: 22px; }
  .rail-btn span, .rail-group-label, .rail-foot .small { display: none; }
  .rail-btn { justify-content: center; }
  .view { padding: 18px 16px 32px; }
  .topbar { padding: 0 16px; }
}
