/* Weight Studio — Yes Madam brand colours, Poppins */

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface2: #F7F8FA;
  --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 { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pad { padding: 24px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.up { color: var(--green); }
.down { color: var(--red); }

/* buttons */
.btn {
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: 8px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.secondary { background: var(--surface); color: var(--brand-dark); }
.btn.secondary:hover { background: var(--brand-soft); }
.btn.ghost { background: var(--surface2); color: var(--sub); border-color: var(--border); }
.btn.ghost:hover { color: var(--text); border-color: var(--dim); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.link { border: 0; background: none; color: var(--brand-dark); font-weight: 500; cursor: pointer; font-size: 13px; }

/* layout */
.main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 600; }
.page-head p { color: var(--muted); font-size: 13px; max-width: 760px; }
.section-title { font-size: 15px; font-weight: 600; margin: 26px 0 10px; }

/* banner */
.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--brand); background: var(--brand-soft);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; font-size: 13px;
}
.banner.info { border-color: var(--border); background: var(--surface); }
.banner.warn { border-color: var(--amber); background: var(--amber-soft); }
.banner strong { font-weight: 600; }
.banner .spacer { flex: 1; }

/* cohort tabs */
.tabs { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; margin-bottom: 18px; }
.tab { border: 0; background: transparent; font-size: 13px; font-weight: 500; color: var(--muted); padding: 6px 16px; border-radius: 999px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--brand); color: #fff; }
.tab .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); margin-left: 6px; vertical-align: middle; }
.tab.active .dot { background: #fff; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card h3 { font-size: 15px; font-weight: 600; }
.card .who { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.card .actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
/* Live model cards: the button sits at the bottom, level across cohorts. */
.cards > .card { display: flex; flex-direction: column; }
.cards > .card .actions { margin-top: auto; padding-top: 14px; }
.kpi { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 10px; }
.kpi .big { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .unit { font-size: 12px; color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12.5px; }
.facts dt { color: var(--muted); }
.facts dd { font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface3); color: var(--sub); }
.pill.accept { background: var(--green-soft); color: var(--green); }
.pill.reject { background: var(--amber-soft); color: var(--amber); }
.pill.brand { background: var(--brand-soft); color: var(--brand-dark); }

/* compare */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.compare .card .row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.compare .card .row span:first-child { color: var(--muted); }
.delta { font-size: 12px; font-weight: 600; }

/* tables */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; font-weight: 600; color: var(--sub); background: var(--surface2); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
td { padding: 7px 10px; border-bottom: 1px solid var(--surface3); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.group td { background: var(--surface2); font-weight: 600; color: var(--text); }
tr.changed td { background: var(--brand-soft); }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; flex-wrap: wrap; font-size: 13px; }
.toolbar input[type=search] { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-family: inherit; min-width: 240px; }
.bar { height: 6px; border-radius: 3px; background: var(--brand); opacity: 0.6; }
.wbar { position: relative; height: 8px; background: var(--surface3); border-radius: 4px; width: 140px; }
.wbar i { position: absolute; top: 0; height: 8px; border-radius: 4px; }
.wbar i.pos { left: 50%; background: var(--green); }
.wbar i.neg { right: 50%; background: var(--red); }
.wbar::after { content: ""; position: absolute; left: 50%; top: -2px; width: 1px; height: 12px; background: var(--dim); }

/* editor */
.editor { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.feature-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-height: calc(100vh - 220px); overflow: auto; }
.feature-list input { width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 10px 12px; font-family: inherit; font-size: 13px; position: sticky; top: 0; background: var(--surface); }
.fitem { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; border: 0; border-bottom: 1px solid var(--surface3); background: none; text-align: left; padding: 9px 12px; cursor: pointer; font-size: 12.5px; color: var(--text); }
.fitem:hover { background: var(--surface2); }
.fitem.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.fitem .edited { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel h2 { font-size: 17px; font-weight: 600; }
.panel .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.panel select { font-family: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.panel input[type=number] { width: 78px; font-family: var(--mono); font-size: 13px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; text-align: right; }
.panel input[type=number].edited { border-color: var(--brand); background: var(--brand-soft); }
.panel input[type=range] { width: 160px; accent-color: var(--brand); vertical-align: middle; }
.savebar { position: sticky; bottom: 0; margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 -4px 16px rgba(26, 31, 43, 0.05); }
.savebar .status { font-size: 12.5px; color: var(--muted); flex: 1; min-width: 200px; }
.savebar .status.warn { color: var(--amber); }
details.more { margin-top: 22px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.mono { font-family: var(--mono); font-size: 11.5px; }

.jobs { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.job { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface2); }
.job .status { font-weight: 600; }
.job .status.done { color: var(--green); }
.job .status.error { color: var(--red); }
.job .status.running,
.job .status.queued { color: var(--blue); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 100; max-width: 90vw; }
.toast.error { background: var(--red); }

@media (max-width: 860px) {
  .editor { grid-template-columns: 1fr; }
  .feature-list { max-height: 260px; }
  .main { padding: 16px; }
}

/* class distribution */
table.dist { margin-top: 6px; font-size: 12px; }
table.dist th, table.dist td { padding: 4px 6px; background: none; position: static; }
table.dist td.num { white-space: nowrap; }
.mini { height: 4px; border-radius: 2px; background: var(--brand); opacity: 0.55; margin-top: 2px; margin-left: auto; }

/* editor: save bar on top, change list on the side */
.savetop { position: sticky; top: 49px; z-index: 40; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--bg); padding: 12px 0 14px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.savetop h1 { font-size: 20px; font-weight: 600; }
.savetop p { font-size: 12.5px; max-width: 640px; }
.savetop-actions { display: flex; gap: 10px; align-items: center; }
.savetop-actions .status { font-size: 12.5px; color: var(--muted); }
.savetop-actions .status.warn { color: var(--brand-dark); font-weight: 600; }
.editor3 { display: grid; grid-template-columns: 260px 1fr 260px; gap: 16px; align-items: start; clear: both; }
.changes { position: sticky; top: 140px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; max-height: calc(100vh - 170px); overflow: auto; font-size: 12.5px; }
.changes h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.change { border-left: 3px solid var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 7px 9px; margin-bottom: 8px; }
.change .link { padding: 0; font-size: 12.5px; text-align: left; }
.undo { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; margin-left: 6px; }
.undo:hover { color: var(--red); }
.feature-list { max-height: calc(100vh - 200px); }
@media (max-width: 1100px) {
  .editor3 { grid-template-columns: 240px 1fr; }
  .changes { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 760px) {
  .editor3 { grid-template-columns: 1fr; }
  .savetop { position: static; }
}

/* method switch */

/* change pane: remove per change, actions at the bottom */
.changes { display: flex; flex-direction: column; }
.change-list { flex: 1; overflow: auto; }
.change-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.remove { border: 1px solid var(--border); background: var(--surface); color: var(--sub); font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 6px; cursor: pointer; }
.remove:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.change-actions { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 10px; }
.change-actions .btn { width: 100%; }

/* nothing spills past the page width: grid children may shrink, wide tables scroll in
   their own box, long rules wrap */
html, body { max-width: 100%; overflow-x: hidden; }
.main { max-width: 1400px; }
.cards > *, .compare > *, .editor3 > *, .editor > * { min-width: 0; }
.card, .panel { min-width: 0; overflow: hidden; }
.table-wrap { max-width: 100%; overflow-x: auto; }
td.mono, td { overflow-wrap: anywhere; }
.compare.stack { grid-template-columns: 1fr; }
.editor3 { grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) minmax(200px, 250px); }
.panel input[type=range] { width: 110px; }
.panel input[type=number] { width: 64px; }
@media (max-width: 1100px) {
  .editor3 { grid-template-columns: minmax(180px, 220px) minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .editor3 { grid-template-columns: minmax(0, 1fr); }
}
