/* User Lists — Yes Madam brand colours, Poppins (as Weight Studio) */

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface3: #F1F3F6;
  --border: #E7E9EE;
  --text: #1A1F2B;
  --sub: #4B5563;
  --muted: #6B7280;
  --dim: #9AA1AC;
  --brand: #E5006E;
  --brand-dark: #B80059;
  --brand-soft: rgba(229, 0, 110, 0.07);
  --green: #0E9F6E;
  --green-soft: rgba(14, 159, 110, 0.10);
  --red: #E02424;
  --red-soft: rgba(224, 36, 36, 0.08);
  --amber: #C27803;
  --amber-soft: rgba(194, 120, 3, 0.10);
  --blue: #2563EB;
  --blue-soft: rgba(37, 99, 235, 0.08);
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  font-family: "Poppins", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; font-size: 14px; }
button, input, select { font-family: inherit; font-size: 14px; color: inherit; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }

.field { margin-bottom: 20px; }
.field > label, .label { display: block; font-weight: 500; margin-bottom: 8px; }
.label em { font-style: normal; font-weight: 400; color: var(--dim); font-size: 12px; margin-left: 6px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.hint:empty { display: none; }
select, input[type=text], input:not([type]) { width: 100%; max-width: 420px; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; background: var(--surface); }
select:focus, input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.card { display: flex; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer; }
.card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.card input { accent-color: var(--brand); margin-top: 4px; }
.card-body { display: flex; flex-direction: column; gap: 2px; }
.card-body span { color: var(--muted); font-size: 12.5px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; color: var(--sub); }
.seg label + label span { border-left: 1px solid var(--border); }
.seg input:checked + span { background: var(--brand); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; color: var(--sub); user-select: none; }
.chip input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 500; }
.chip input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.chip input:disabled + span { opacity: .4; cursor: not-allowed; }
.deciles .chip span { min-width: 40px; text-align: center; font-family: var(--mono); font-size: 13px; }

.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.check:has(input:disabled) { opacity: .5; cursor: not-allowed; }

.row2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.row2 input { max-width: none; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } main { padding: 16px; } .panel { padding: 16px; }  }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
button.primary { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 10px 20px; font-weight: 500; cursor: pointer; }
button.primary:hover { background: var(--brand-dark); }
button.primary:disabled { opacity: .6; cursor: progress; }
button.ghost { background: none; border: 1px solid var(--border); border-radius: 7px; padding: 4px 10px; cursor: pointer; color: var(--sub); font-size: 12.5px; }
button.ghost:hover { border-color: var(--brand); color: var(--brand); }
.err { color: var(--red); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table.hist { width: 100%; border-collapse: collapse; font-size: 13px; }
.hist th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.hist td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.hist td.nowrap, .hist .nowrap { white-space: nowrap; }
.hist td.filters { min-width: 180px; }
.hist .status-cell { white-space: nowrap; }
.hist .status-cell .muted { margin-left: 6px; }
.hist tr.row { cursor: pointer; }
.hist tr.row:hover td { background: var(--surface3); }
.hist tr.open td { background: var(--brand-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row-actions { white-space: nowrap; width: 1%; }
a.dl { color: var(--brand); text-decoration: none; font-weight: 500; }
a.dl:hover { text-decoration: underline; }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 500; }
.pill.done { background: var(--green-soft); color: var(--green); }
.pill.failed { background: var(--red-soft); color: var(--red); }
.pill.running, .pill.queued { background: var(--amber-soft); color: var(--amber); }
.pill.running::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: middle; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

.detail td { background: var(--surface) !important; padding: 16px 20px 20px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } }
.detail h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini td, .mini th { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.mini th { color: var(--muted); font-weight: 500; }
.files { list-style: none; max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.files li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.files li:last-child { border-bottom: 0; }
.error-box { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; white-space: pre-wrap; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* form + live count side by side */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.layout[hidden] { display: none; }
.count { position: sticky; top: 16px; }
.count h2 { font-size: 13px; font-weight: 500; color: var(--muted); }
.count .total { font-size: 30px; font-weight: 600; color: var(--brand); margin: 2px 0 14px; font-variant-numeric: tabular-nums; }
.cohort-row { border-top: 1px solid var(--border); padding: 10px 0; }
.cohort-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.cohort-head span { font-variant-numeric: tabular-nums; font-weight: 500; }
.cells { display: flex; flex-wrap: wrap; gap: 6px; }
.cell { background: var(--surface3); border-radius: 6px; padding: 3px 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.cell i { font-style: normal; color: var(--muted); margin-right: 5px; }
.cell.zero { opacity: .45; }

.bucket-groups { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.bucket-group { display: flex; align-items: center; gap: 10px; }
.bucket-group .group-name { font-size: 12px; color: var(--muted); min-width: 72px; }
.bucket-group.off { opacity: .4; }

.result { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.running { display: flex; gap: 12px; align-items: center; }
.spinner { width: 20px; height: 20px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.done-head { margin-bottom: 12px; }
a.big-dl { display: inline-block; background: var(--brand); color: #fff; text-decoration: none; border-radius: 8px; padding: 9px 18px; font-weight: 500; margin-bottom: 12px; }
a.big-dl:hover { background: var(--brand-dark); }

/* estimate */
button.secondary { margin-top: 14px; width: 100%; background: var(--surface); color: var(--brand); border: 1px solid var(--brand);
  border-radius: 8px; padding: 9px 14px; font-weight: 500; cursor: pointer; display: inline-flex; gap: 8px; justify-content: center; align-items: center; }
button.secondary:hover { background: var(--brand-soft); }
button.secondary:disabled { opacity: .7; cursor: progress; }
.spinner.small { width: 14px; height: 14px; border-width: 2px; }
.count.stale .total, .count.stale .count-body { opacity: .4; }
.stale-note { font-size: 12px; color: var(--amber); background: var(--amber-soft); border-radius: 6px; padding: 5px 8px; margin: -6px 0 10px; }
.deciles .chip.unscored span { min-width: 0; font-family: inherit; font-size: 12.5px; }
.icon-row { display: flex; gap: 6px; }
.rerun-ask { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 150px; }
.ask-btn { border: 1px solid var(--border); background: var(--surface); color: var(--sub); border-radius: 7px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.ask-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.ask-btn:hover { border-color: var(--brand); }
.ask-btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.ask-btn.danger:hover { opacity: .9; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--sub); cursor: pointer; padding: 0; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--brand-dark); border-color: var(--brand); background: var(--brand-soft); }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.icon-btn:disabled, .icon-btn[aria-disabled="true"] { opacity: .35; cursor: not-allowed; }
.icon-btn[aria-disabled="true"]:hover { color: var(--sub); border-color: var(--border); background: var(--surface); }
.row-actions .spinner.small { display: inline-block; vertical-align: middle; margin-right: 4px; }
.submitted { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; }
.submitted a { color: var(--brand); font-weight: 500; }

/* manual overrides */
.ov-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.ov-layout[hidden] { display: none; }
.ov-layout .format { grid-column: 2; grid-row: 1 / span 2; }
.ov-layout .ov-log { grid-column: 1; grid-row: 2; }
@media (max-width: 900px) { .ov-layout { grid-template-columns: 1fr; } .ov-layout .format, .ov-layout .ov-log { grid-column: 1; grid-row: auto; } }
.panel-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.format h3 { font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
.format .mini { margin: 10px 0; }
.sample { font-family: var(--mono); font-size: 12px; background: var(--surface3); border-radius: 8px; padding: 10px 12px; margin: 10px 0; overflow-x: auto; }
.rules { padding-left: 18px; display: grid; gap: 6px; color: var(--sub); }
input[type=file] { font-size: 13px; }
.progress { margin-top: 16px; display: grid; gap: 6px; }
.progress[hidden] { display: none; }
.progress .bar { height: 6px; border-radius: 3px; background: var(--brand-soft); position: relative; overflow: hidden; }
.progress .bar::after { content: ""; position: absolute; inset: 0; width: var(--p, 0%); background: var(--brand); transition: width .2s; }
.pill.processing { background: var(--amber-soft); color: var(--amber); }
.pill.active { background: var(--green-soft); color: var(--green); }
.pill.expired, .pill.removed { background: var(--surface3); color: var(--muted); }
.effect { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.effect .up { color: var(--green); }
.effect .down { color: var(--red); }
.effect .ign { color: var(--amber); }
.ov-log .file { word-break: break-all; }
.ov-log .hist td { padding: 10px 8px; }
.ov-log .hist .status-cell { white-space: normal; min-width: 110px; }
