/* ── Base + sliders + stats + top3 + chart cards + comparison table ──────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0d1117;
  color: #cdd9e5;
  padding: 28px;
}

h1 {
  font-size: 1.4rem;
  color: #fff;
  margin-bottom: 4px;
}

.sub {
  color: #6e7681;
  font-size: 0.82rem;
  margin-bottom: 22px;
}

.slider-section {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.slider-section h2 {
  font-size: 0.78rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
}

.sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.slider-group label {
  font-size: 0.82rem;
  color: #8b949e;
  display: block;
  margin-bottom: 6px;
}

.slider-val {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 6px;
}

.slider-val small {
  font-size: 0.8rem;
  color: #6e7681;
  font-weight: 400;
  margin-left: 4px;
}

input[type='range'] {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: #30363d;
  outline: none;
  appearance: none;
  cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #58a6ff;
  cursor: pointer;
}

.tick-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: #484f58;
  margin-top: 3px;
}

.ref-line {
  font-size: 0.75rem;
  color: #d29922;
  margin-top: 6px;
}

.ref-line-blue {
  font-size: 0.75rem;
  color: #58a6ff;
  margin-top: 4px;
}

.stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stat {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 11px 16px;
  flex: 1;
  min-width: 130px;
}

.stat-label {
  color: #6e7681;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-top: 3px;
}

.green .stat-val {
  color: #3fb950;
}

.amber .stat-val {
  color: #d29922;
}

.blue .stat-val {
  color: #58a6ff;
}

.top3 {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.top3-card {
  flex: 1;
  background: #161b22;
  border-radius: 9px;
  padding: 13px 15px;
  text-align: center;
}

.gold {
  border: 1px solid #b8860b;
}

.silver {
  border: 1px solid #708090;
}

.bronze {
  border: 1px solid #8b4513;
}

.medal {
  font-size: 1.3rem;
}

.medal-name {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 600;
  margin: 4px 0;
}

.medal-surplus {
  font-size: 0.95rem;
  color: #3fb950;
  font-weight: 700;
}

.medal-stat {
  font-size: 0.72rem;
  color: #8b949e;
  margin-top: 3px;
}

.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
}

.card h2 {
  font-size: 0.78rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.legend-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #8b949e;
}

.ldot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.note {
  font-size: 0.72rem;
  color: #6e7681;
  margin-top: 8px;
  line-height: 1.5;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.79rem;
}

thead th {
  background: #1c2128;
  color: #6e7681;
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid #30363d;
  white-space: nowrap;
}

tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid #21262d;
  vertical-align: top;
}

tr.sec td {
  background: #1c2128;
  color: #6e7681;
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  padding: 5px 10px;
}

tr.baseline td {
  background: #1c200a;
}

tr.dominated {
  opacity: 0.3;
}

tr:hover:not(.sec, .dominated) td {
  background: #1c2128;
}

.pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 12px;
  font-size: 0.67rem;
  font-weight: 600;
}

.pg {
  background: #1a3a2a;
  color: #3fb950;
}

.pr {
  background: #2a1215;
  color: #f85149;
}

.pa {
  background: #2a2000;
  color: #d29922;
}

.pgr {
  background: #1e2228;
  color: #6e7681;
}

.pos {
  color: #3fb950;
  font-weight: 600;
}

.neg {
  color: #f85149;
  font-weight: 600;
}

.dq-v {
  color: #3fb950;
  font-size: 0.65rem;
}

.dq-e {
  color: #d29922;
  font-size: 0.65rem;
}

.dq-u {
  color: #f85149;
  font-size: 0.65rem;
}

.sm-note {
  color: #6e7681;
  font-size: 0.7rem;
  display: block;
  margin-top: 1px;
}

.unlock-note {
  color: #6e7681;
  font-size: 0.67rem;
  margin-top: 2px;
}

/* ── Personal-circumstances panel ────────────────────────────────────────── */
.opt-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 14px 22px;
  margin-bottom: 20px;
}

.opt-panel h2 {
  font-size: 0.78rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.opt-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.opt-pill {
  background: #0d1117;
  color: #cdd9e5;
  border: 1px solid #30363d;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
}

.opt-pill:hover {
  border-color: #58a6ff;
  color: #fff;
}

.opt-pill.active {
  background: #1f3756;
  border-color: #58a6ff;
  color: #fff;
  font-weight: 600;
}

.opt-hint {
  font-size: 0.72rem;
  color: #6e7681;
  margin-top: 8px;
  line-height: 1.4;
}

.custom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #21262d;
}

.custom-row label {
  display: block;
  font-size: 0.74rem;
  color: #8b949e;
  margin-bottom: 4px;
}

.custom-dir {
  color: #6e7681;
}

.custom-val {
  color: #fff;
  font-weight: 600;
  float: right;
}

.custom-row input[type='range'] {
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: #30363d;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.custom-row input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #58a6ff;
  cursor: pointer;
}

/* ── Per-store-settings disclosure + table ───────────────────────────────── */
.yc-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 20px;
}

.yc-panel h2 {
  font-size: 0.78rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.yc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.yc-field label {
  display: block;
  font-size: 0.78rem;
  color: #8b949e;
  margin-bottom: 6px;
}

.yc-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.yc-input-row .prefix,
.yc-input-row .suffix {
  font-size: 0.85rem;
  color: #8b949e;
}

.yc-input {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #fff;
  padding: 6px 10px;
  font-size: 1.05rem;
  font-weight: 700;
  width: 90px;
  text-align: right;
}

.yc-input:focus {
  outline: none;
  border-color: #58a6ff;
}

.yc-hint {
  font-size: 0.7rem;
  color: #6e7681;
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Optimisation pills + custom-weight sliders ──────────────────────────── */
.ps-details {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  margin-bottom: 20px;
}

.ps-details > summary {
  cursor: pointer;
  padding: 14px 22px;
  font-size: 0.82rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
}

.ps-details > summary:hover {
  color: #cdd9e5;
}

.ps-details > summary::after {
  content: ' (click to expand)';
  text-transform: none;
  color: #6e7681;
  font-size: 0.72rem;
  letter-spacing: 0;
}

.ps-details[open] > summary::after {
  content: ' (click to collapse)';
}

.ps-body {
  padding: 0 22px 18px;
}

.ps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.ps-table th {
  padding: 7px 8px;
  text-align: left;
  color: #6e7681;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #30363d;
}

.ps-table th.num {
  text-align: right;
}

.ps-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #21262d;
  vertical-align: middle;
}

.ps-table td.num {
  text-align: right;
}

.ps-table tr.ps-cat td {
  background: #1c2128;
  color: #6e7681;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  padding: 5px 8px;
}

.ps-table tr.ps-unavail td:not(.ps-avail-cell) {
  opacity: 0.35;
}

.ps-table input[type='number'] {
  width: 60px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #fff;
  padding: 2px 6px;
  font-size: 0.78rem;
  text-align: right;
}

.ps-table input[type='number']:focus {
  outline: none;
  border-color: #58a6ff;
}

.ps-table input[type='number']:disabled {
  background: transparent;
  border-color: transparent;
  color: #484f58;
}

.ps-table input[type='checkbox'] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #3fb950;
}

.ps-na {
  color: #484f58;
  font-size: 0.72rem;
}

.ps-type {
  font-size: 0.7rem;
  color: #8b949e;
  padding: 1px 6px;
  border-radius: 8px;
  background: #21262d;
  display: inline-block;
}

.ps-actions {
  margin-top: 10px;
}

.ps-actions button {
  background: #21262d;
  color: #cdd9e5;
  border: 1px solid #30363d;
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.72rem;
}

.ps-actions button:hover {
  background: #30363d;
}
