    :root {
      --ink: #edf4fb;
      --muted: #9fb0c4;
      --line: #2d3a4b;
      --paper: #141d2a;
      --field: #192637;
      --navy: #0d1420;
      --blue: #5da7d8;
      --gold: #e3a936;
      --green: #47c58f;
      --red: #ef7668;
      --shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
    }

    * { box-sizing: border-box; }
    body {
      margin: 0;
      min-height: 100vh;
      color: var(--ink);
      background: linear-gradient(180deg, #090f18 0%, #111a27 45%, #0c121b 100%);
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    header {
      background: #0a111b;
      color: #fff;
      border-bottom: 5px solid var(--gold);
      padding: 22px clamp(16px, 4vw, 44px);
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 20px;
      flex-wrap: wrap;
    }

    h1 {
      margin: 0;
      font-size: clamp(28px, 4vw, 48px);
      line-height: 0.95;
      text-transform: uppercase;
      letter-spacing: 0;
    }

    .subtitle {
      margin-top: 8px;
      color: #b8c7d8;
      font-size: 14px;
      max-width: 780px;
    }

    .shell {
      width: min(1800px, calc(100% - 16px));
      margin: 24px auto 36px;
      display: grid;
      grid-template-columns: 320px minmax(0, 1fr);
      gap: 14px;
    }

    .panel, .table-wrap {
      background: var(--paper);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: var(--shadow);
    }

    .panel { padding: 18px; align-self: start; }
    .section-title {
      margin: 0 0 14px;
      font-size: 13px;
      text-transform: uppercase;
      color: var(--gold);
      letter-spacing: 1.4px;
      font-weight: 800;
    }

    .upload {
      display: grid;
      gap: 10px;
      padding: 14px;
      border: 1px dashed #4d6178;
      border-radius: 8px;
      background: #101926;
    }

    input[type="file"] { width: 100%; }
    .file-slot {
      display: grid;
      gap: 5px;
    }
    .file-slot label {
      color: #d8e9fb;
      font-size: 12px;
      font-weight: 850;
    }
    .btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
    button {
      border: 1px solid #3c4d61;
      background: #182334;
      color: var(--ink);
      min-height: 38px;
      padding: 8px 12px;
      border-radius: 6px;
      font-weight: 800;
      cursor: pointer;
    }
    button.primary {
      background: var(--gold);
      border-color: var(--gold);
      color: #151007;
    }
    button:hover { border-color: var(--blue); }
    input[type="file"]::file-selector-button {
      border: 1px solid #3c4d61;
      background: #20354f;
      color: var(--ink);
      border-radius: 6px;
      padding: 7px 10px;
      font-weight: 800;
      cursor: pointer;
    }

    .status {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.4;
      min-height: 34px;
    }
    .audit {
      display: grid;
      gap: 8px;
      margin-top: 10px;
      padding: 10px;
      border: 1px solid #314156;
      border-radius: 6px;
      background: #0d1623;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.35;
    }
    .audit[hidden] { display: none; }
    .audit b { color: #f2f7fc; }
    .audit-line { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid #223144; padding-bottom: 6px; }
    .audit-line:last-child { border-bottom: 0; padding-bottom: 0; }
    .audit-list { display: grid; gap: 3px; }

    .weights { display: grid; gap: 12px; margin-top: 18px; }
    .weight-row { display: grid; grid-template-columns: 1fr 58px; gap: 6px 10px; align-items: center; }
    .weight-row label { font-size: 12px; color: var(--ink); font-weight: 800; }
    .factor-help {
      grid-column: 1 / 3;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.35;
      margin-top: -3px;
    }
    .weight-row input { width: 100%; accent-color: var(--gold); grid-column: 1 / 3; }
    .weight-value { text-align: right; color: #d8e9fb; font-weight: 850; }
    .weight-total {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      padding: 9px 10px;
      border: 1px solid #314156;
      border-radius: 6px;
      background: #101926;
      color: var(--muted);
      font-size: 12px;
      font-weight: 750;
    }
    .weight-total b { color: #f2f7fc; font-size: 14px; }
    .preset-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }
    .preset-btn {
      min-height: 34px;
      padding: 7px 9px;
      font-size: 11px;
      text-align: left;
    }
    .preset-btn.active {
      background: #203a5b;
      border-color: var(--blue);
      color: #fff;
    }
    .control-grid {
      display: grid;
      gap: 10px;
      margin-top: 18px;
    }
    .field {
      display: grid;
      gap: 5px;
    }
    .field label {
      color: #d8e9fb;
      font-size: 12px;
      font-weight: 850;
    }
    select, input[type="number"] {
      width: 100%;
      min-height: 38px;
      border: 1px solid #3c4d61;
      border-radius: 6px;
      padding: 7px 9px;
      color: var(--ink);
      background: #101926;
      font: inherit;
      font-size: 13px;
    }
    .range-field {
      display: grid;
      grid-template-columns: 1fr 48px;
      gap: 6px 10px;
      align-items: center;
    }
    .range-field input {
      grid-column: 1 / 3;
      width: 100%;
      accent-color: var(--gold);
    }

    .stats {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      margin-top: 18px;
    }
    .stat {
      background: var(--field);
      border: 1px solid #2f4a43;
      border-radius: 8px;
      padding: 12px;
    }
    .stat b { display: block; font-size: 24px; color: #f2f7fc; }
    .stat span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; }

    .board-head {
      padding: 18px 20px;
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 14px;
      flex-wrap: wrap;
      border-bottom: 1px solid var(--line);
    }
    .board-head h2 { margin: 0; color: #f2f7fc; font-size: 22px; }
    .context { color: var(--muted); font-size: 13px; }

    .table-scroll { overflow-x: visible; }
    table { width: 100%; border-collapse: collapse; table-layout: fixed; }
    th, td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
    th:nth-child(1), td:nth-child(1) { width: 52px; }
    th:nth-child(2), td:nth-child(2) { width: 150px; }
    th:nth-child(3), td:nth-child(3) { width: 84px; }
    th:nth-child(4), td:nth-child(4) { width: 122px; }
    th:nth-child(5), td:nth-child(5) { width: 122px; }
    th:nth-child(6), td:nth-child(6) { width: 108px; }
    th:nth-child(7), td:nth-child(7) { width: 190px; }
    th:nth-child(8), td:nth-child(8) { width: 136px; }
    th:nth-child(9), td:nth-child(9) { width: 128px; }
    th {
      background: #101926;
      color: #aebdd0;
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      position: sticky;
      top: 0;
      z-index: 1;
    }
    tbody tr:first-child td { background: #241f12; }
    .rank {
      width: 46px;
      height: 46px;
      border-radius: 50%;
      display: inline-grid;
      place-items: center;
      background: var(--navy);
      color: #fff;
      font-size: 20px;
      font-weight: 900;
    }
    tbody tr:first-child .rank { background: var(--gold); color: #151007; }
    .name { font-weight: 900; color: var(--ink); }
    .small { color: var(--muted); font-size: 12px; margin-top: 4px; }
    .score {
      font-size: 22px;
      font-weight: 950;
      color: var(--green);
      line-height: 1;
    }
    .score.low { color: var(--red); }
    .bar {
      height: 7px;
      background: #263449;
      border-radius: 99px;
      overflow: hidden;
      margin-top: 7px;
      width: min(112px, 100%);
    }
    .bar i { display: block; height: 100%; background: var(--green); border-radius: inherit; }
    .bar.repair i { background: var(--red); }
    details.rank-breakdown {
      margin-top: 7px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.35;
    }
    details.rank-breakdown summary {
      cursor: pointer;
      color: #d8e9fb;
      font-weight: 850;
    }
    .rank-breakdown-grid {
      display: grid;
      gap: 3px;
      margin-top: 6px;
      padding: 7px;
      border: 1px solid #2c3c50;
      border-radius: 6px;
      background: #101926;
    }
    .rank-breakdown-grid div { display: flex; justify-content: space-between; gap: 8px; }
    .money-group {
      margin-top: 8px;
      padding-top: 7px;
      border-top: 1px solid #2c3c50;
    }
    .pill {
      display: inline-block;
      padding: 4px 8px;
      border-radius: 999px;
      background: #20354f;
      color: #d8e9fb;
      font-size: 11px;
      font-weight: 850;
      margin: 2px 3px 2px 0;
      white-space: normal;
      line-height: 1.2;
    }
    .empty {
      padding: 72px 20px;
      text-align: center;
      color: var(--muted);
    }
    .empty b { color: #f2f7fc; display: block; font-size: 24px; margin-bottom: 8px; }

    @media (max-width: 980px) {
      .shell { grid-template-columns: 1fr; }
      .panel { order: 1; }
      .table-wrap { order: 2; }
    }
