/* Arson Theory Publishing Portal — shared design system.
   Dark, premium, red-accent aesthetic. Upgrade over the white Vydia dashboard. */

:root {
  --bg:        #f7f7f9;
  --bg-2:      #ffffff;
  --surface:   #ffffff;
  --surface-2: #f1f1f4;
  --line:      rgba(17,17,20,.09);
  --line-2:    rgba(17,17,20,.16);
  --ink:       #18181b;
  --muted:     #5c5c66;
  --faint:     #8a8a93;
  --red:       #fe2b09;
  --red-hi:    #fe2b09;
  --red-deep:  #fe2b09;
  --green:     #149a55;
  --amber:     #c97f00;
  --blue:      #2f7fe0;
  --radius:    0px;
  --radius-sm: 0px;
  --radius-pill: 0px;
  --shadow:    0 12px 34px -14px rgba(17,17,20,.20);
  --display:   'Geist', 'Helvetica Neue', Arial, sans-serif;
  --body:      'Geist', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
::selection { background: rgba(254,43,9,.3); }

/* ---------- Ambient background ---------- */
.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 88% -8%, rgba(254,43,9,.055), transparent 60%),
    radial-gradient(700px 600px at -5% 110%, rgba(254,43,9,.03), transparent 55%);
}

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; margin: 0; }
.eyebrow {
  font-family: var(--display); font-size: 11px; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--red);
}
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--red); color: #fff; border: 0; cursor: pointer;
  padding: 12px 22px; border-radius: var(--radius-pill);
  font-family: var(--display); font-weight: 600; font-size: 13px;
  letter-spacing: .02em; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: #e4e4e7; color: var(--faint); cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn.sm { padding: 8px 16px; font-size: 12px; }
.btn.block { width: 100%; }
.link { color: var(--red); cursor: pointer; }
.link:hover { filter: brightness(1.15); text-decoration: underline; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.card.pad-lg { padding: 28px; }

/* ---------- Forms ---------- */
label.fld { display: block; margin-bottom: 18px; }
label.fld > span {
  display: block; font-family: var(--display); font-size: 11px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
label.fld .req { color: var(--red); }
input, select, textarea {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 14.5px;
  background: var(--bg-2); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(254,43,9,.15);
}
select { appearance: none; -webkit-appearance: none; border-radius: var(--radius-pill);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239a9aa1' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; padding-left: 16px; padding-right: 40px; }
.hint { font-size: 12px; color: var(--faint); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Messages / toast ---------- */
.msg { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-top: 14px; }
.msg.error { background: rgba(254,43,9,.12); color: #fe2b09; border: 1px solid rgba(254,43,9,.25); }
.msg.success { background: rgba(20,154,85,.10); color: #0f7a42; border: 1px solid rgba(20,154,85,.28); }
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink);
  padding: 13px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: 13.5px; max-width: 340px; animation: slidein .2s ease;
}
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--display);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 0; border: 1px solid var(--line-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 0; background: currentColor; }
.badge.submitted { color: var(--blue); }
.badge.in_review { color: var(--amber); }
.badge.registered { color: var(--green); }
.badge.rejected { color: var(--red); }

/* ---------- App shell (sidebar layout) ---------- */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(255,255,255,.78); backdrop-filter: blur(10px);
  border-right: 1px solid var(--line); padding: 24px 18px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.sidebar .logo img { width: 34px; height: 34px; border-radius: 0; }
.sidebar .logo .lt { font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1.1; }
.sidebar .logo .lt small { display: block; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--red); font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; font-weight: 500; transition: background .12s, color .12s;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.active { background: var(--surface-2); color: var(--ink); }
.nav a.active svg { color: var(--red); }
.nav .sep { margin: 14px 12px 8px; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }
.side-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.side-foot .who { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; }
.avatar { width: 34px; height: 34px; border-radius: 0; background: linear-gradient(135deg, var(--red), var(--red-deep));
  display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 14px; color: #fff; }
.side-foot .who .nm { font-size: 13px; font-weight: 600; line-height: 1.2; }
.side-foot .who .em { font-size: 11px; color: var(--faint); }

.main { padding: 34px 40px 60px; max-width: 1080px; position: relative; z-index: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 10px; overflow-x: auto; }
  .sidebar .logo { padding: 0 12px 0 4px; border: 0; }
  .nav { flex-direction: row; }
  .nav .sep { display: none; }
  .side-foot { display: none; }
  .main { padding: 24px 18px 50px; }
}

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat .k { font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; font-family: var(--display); font-weight: 600; }
.stat .v { font-family: var(--display); font-size: 30px; font-weight: 700; margin-top: 8px; }
.stat .v small { font-size: 15px; color: var(--muted); font-weight: 500; }

/* ---------- Tables / lists ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-family: var(--display); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; padding: 0 14px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 15px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(17,17,20,.025); }
.tbl .title { font-weight: 600; }
.tbl .sub { font-size: 12px; color: var(--faint); }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .ico { font-size: 34px; margin-bottom: 12px; opacity: .5; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(17,17,20,.42); backdrop-filter: blur(3px); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal .mh h3 { font-size: 18px; }
.modal .mb { padding: 24px; }
.modal .mf { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x { cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; background: none; border: 0; }
.x:hover { color: var(--ink); }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.divider { height: 1px; background: var(--line); margin: 22px 0; border: 0; }

/* ---------- Money / hero numbers ---------- */
.money { color: var(--green); }
.hero-num { font-family: var(--display); font-weight: 700; font-size: 40px; letter-spacing: -.02em; line-height: 1.05; }
.hero-num small { font-size: 16px; color: var(--muted); font-weight: 600; margin-left: 5px; }

/* ---------- Filter bar ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 24px; }
.filters .fl { display: flex; flex-direction: column; gap: 6px; }
.filters .fl > span { font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.filters select { min-width: 158px; }
.filters .spacer { flex: 1; }

/* ---------- Bar chart (income by period) ---------- */
.chart-grid { display: flex; align-items: flex-end; gap: 14px; height: 240px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.cbar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cbar .bar-area { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.cbar .stack { width: 100%; max-width: 46px; display: flex; flex-direction: column-reverse; border-radius: 0; overflow: hidden; transition: filter .15s; }
.cbar:hover .stack { filter: brightness(1.14); }
.cbar .seg { width: 100%; }
.cbar .amt { font-family: var(--display); font-weight: 600; font-size: 11px; color: var(--muted); }
.cbar .lab { font-family: var(--display); font-weight: 600; font-size: 10.5px; letter-spacing: .03em; color: var(--faint); white-space: nowrap; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 16px; }
.chart-legend .lg { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 0; flex: none; }

/* Income-type color ramp (brand red family + green for sync) */
.seg-streaming,   .dot-streaming   { background: var(--red); }
.seg-performance, .dot-performance { background: #ff7d5e; }
.seg-mechanical,  .dot-mechanical  { background: var(--amber); }
.seg-sync,        .dot-sync        { background: var(--green); }
.seg-other,       .dot-other       { background: #6b6b72; }

/* ---------- Breakdown bars (by type / song / writer) ---------- */
.bk { display: flex; flex-direction: column; gap: 13px; }
.bk-row { display: grid; grid-template-columns: 160px 1fr auto; align-items: center; gap: 14px; }
.bk-row .nm { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-row .nm small { color: var(--faint); font-weight: 400; }
.bk-row .track { height: 8px; border-radius: 0; background: var(--surface-2); overflow: hidden; }
.bk-row .fill { height: 100%; border-radius: 0; background: var(--red); transition: width .3s; }
.bk-row .val { font-family: var(--display); font-weight: 600; font-size: 13px; min-width: 78px; text-align: right; }
.bk-row .rank { color: var(--faint); font-family: var(--display); font-weight: 600; font-size: 12px; }
@media (max-width: 640px) { .bk-row { grid-template-columns: 1fr auto; } .bk-row .track { grid-column: 1 / -1; order: 3; } }

/* ---------- Collection-gap timeline ---------- */
.timeline { margin-top: 8px; }
.tl-step { display: grid; grid-template-columns: 22px 1fr; gap: 14px; }
.tl-step .rail { display: flex; flex-direction: column; align-items: center; }
.tl-step .node { width: 12px; height: 12px; border-radius: 0; border: 2px solid var(--red); background: var(--bg); margin-top: 3px; flex: none; }
.tl-step.done .node { background: var(--red); }
.tl-step .line { flex: 1; width: 2px; background: var(--line-2); min-height: 16px; }
.tl-step:last-child .line { display: none; }
.tl-step .body { padding-bottom: 18px; }
.tl-step .t { font-weight: 600; font-size: 13.5px; }
.tl-step .d { font-size: 12px; color: var(--muted); }
.gap-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 0;
  background: rgba(245,166,35,.12); color: var(--amber); border: 1px solid rgba(245,166,35,.25); font-size: 12px; font-weight: 600; }

/* ---------- Required-fields tracker (register form) ---------- */
.req-tracker { margin-bottom: 22px; padding: 16px 20px; border-left: 3px solid var(--amber); }
.req-tracker.ok { border-left-color: var(--green); }
.req-tracker .rt-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13.5px; }
.req-tracker .rt-ico { color: var(--amber); font-size: 15px; }
.req-tracker.ok .rt-ico { color: var(--green); }
.rt-grp { color: var(--muted); font-size: 12.5px; }
.rt-count { font-family: var(--display); font-weight: 700; color: var(--amber); margin-left: 4px; }
.rt-grp.done .rt-count { color: var(--green); }
.rt-sep { color: var(--faint); }
.rt-toggle { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; font-family: var(--display); }
.rt-toggle:hover { color: var(--ink); }
.rt-list { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px 22px; }
@media (max-width: 640px) { .rt-list { grid-template-columns: 1fr; } }
.rt-list.collapsed { display: none; }
.rt-item { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.rt-item .ck { width: 17px; height: 17px; border-radius: 0; border: 1.5px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 10px; color: transparent; flex: none; }
.rt-item.done { color: var(--ink); }
.rt-item.done .ck { background: var(--green); border-color: var(--green); color: #06281a; }

/* ---------- Section header (inside cards) ---------- */
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.sec-head h2 { font-size: 18px; }
.badge.paid { color: var(--green); }
.badge.available { color: var(--blue); }

/* ---------- Writer collection tags (controlled vs registration-only) ---------- */
.wtag { display: inline-block; font-family: var(--display); font-size: 10px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px; border-radius: 0;
  margin-left: 8px; vertical-align: middle; line-height: 1.5; }
.wtag.collecting { color: var(--green); background: rgba(20,154,85,.10); }
.wtag.reg-only { color: var(--amber); background: rgba(201,127,0,.12); }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(17,17,20,.15); border-top-color: var(--red); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.btn .spinner { border-color: rgba(255,255,255,.45); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
