    :root {
      color-scheme: dark;
      --bg: #081018;
      --card: rgba(14, 24, 38, 0.92);
      --line: rgba(186, 214, 255, 0.14);
      --text: #e8eef8;
      --muted: #9aabc4;
      --mint: #3ddec4;
      --mint-ink: #06241f;
      --amber: #f5c16c;
      --rose: #ff8b9a;
      --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
      --sans: "Segoe UI Variable", "Segoe UI", sans-serif;
      --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
      --mono: "Cascadia Code", Consolas, ui-monospace, monospace;
    }

    * { box-sizing: border-box; }
    [hidden] { display: none !important; }

    html, body { margin: 0; min-height: 100%; }
    body {
      font-family: var(--sans);
      color: var(--text);
      background-color: var(--bg);
      background-image:
        radial-gradient(900px 480px at 0% -10%, rgba(61, 222, 196, 0.16), transparent 55%),
        radial-gradient(700px 420px at 100% 0%, rgba(245, 193, 108, 0.1), transparent 46%),
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
      background-size: auto, auto, 56px 56px, 56px 56px;
      accent-color: var(--mint);
    }

    button, input { font: inherit; color: inherit; }
    button { cursor: pointer; }
    ::selection { background: rgba(61, 222, 196, 0.28); }

    #boot {
      min-height: 100vh;
      display: grid;
      place-items: center;
      color: var(--muted);
      letter-spacing: 0.04em;
    }

    .login-shell {
      min-height: 100vh;
      display: grid;
      grid-template-columns: minmax(280px, 1.05fr) minmax(320px, 0.95fr);
    }

    .login-aside {
      padding: 56px 64px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 32px;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
      font-weight: 650;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      font-size: 13px;
    }

    .mark {
      width: 36px;
      height: 36px;
      display: grid;
      place-items: center;
      border-radius: 10px;
      color: var(--mint);
      background: rgba(61, 222, 196, 0.12);
      border: 1px solid rgba(61, 222, 196, 0.28);
    }

    .mark svg { width: 20px; height: 20px; }

    .login-aside h1 {
      margin: 18px 0 12px;
      max-width: 12ch;
      font-family: var(--serif);
      font-size: clamp(42px, 5vw, 68px);
      font-weight: 500;
      line-height: 0.95;
      letter-spacing: -0.03em;
    }

    .login-aside p { margin: 0; max-width: 36ch; color: var(--muted); font-size: 17px; line-height: 1.5; }

    .points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
    .points li {
      display: flex;
      gap: 10px;
      align-items: center;
      color: var(--text);
    }
    .points i {
      width: 8px;
      height: 8px;
      border-radius: 99px;
      background: var(--mint);
      display: inline-block;
    }

    .aside-note { color: var(--muted); font-size: 13px; }

    .login-main {
      display: grid;
      place-items: center;
      padding: 32px 24px;
    }

    .login-card, .panel, .card {
      background: var(--card);
      border: 1px solid var(--line);
      box-shadow: var(--shadow);
      backdrop-filter: blur(16px);
    }

    .login-card {
      width: min(420px, 100%);
      border-radius: 24px;
      padding: 32px 28px;
    }

    .login-card h2 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.03em; }
    .login-card .lead { margin: 0 0 22px; color: var(--muted); }

    .stack { display: grid; gap: 14px; }

    label.login-field, .field { display: grid; gap: 8px; align-content: start; }
    .field-label, .login-field span {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      align-items: center;
      font-size: 13px;
      color: var(--muted);
    }

    .control { position: relative; }

    input {
      width: 100%;
      border-radius: 12px;
      border: 1px solid var(--line);
      background: #0b1320;
      padding: 12px 14px;
      outline: none;
    }

    input:focus {
      border-color: transparent;
      box-shadow: 0 0 0 2px rgba(61, 222, 196, 0.45);
    }

    .control input[type="password"],
    .control input[type="text"].secret {
      padding-right: 108px;
    }

    .reveal {
      position: absolute;
      top: 50%;
      right: 8px;
      transform: translateY(-50%);
      border: 0;
      background: transparent;
      color: var(--mint);
      padding: 6px 8px;
      border-radius: 8px;
    }

    .reveal:hover { background: rgba(61, 222, 196, 0.1); }

    .primary, .ghost {
      border-radius: 12px;
      padding: 12px 16px;
      border: 0;
    }

    .primary {
      background: var(--mint);
      color: var(--mint-ink);
      font-weight: 650;
    }

    .primary:hover { filter: brightness(1.05); }
    .primary:disabled { opacity: 0.65; cursor: wait; }

    .ghost {
      background: transparent;
      color: var(--text);
      border: 1px solid var(--line);
    }

    .ghost:hover { border-color: rgba(61, 222, 196, 0.45); }

    .banner {
      margin: 0;
      padding: 10px 12px;
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.04);
      color: var(--muted);
      line-height: 1.45;
    }

    .banner.bad { background: rgba(255, 139, 154, 0.12); color: #ffd0d6; }
    .banner.ok { background: rgba(61, 222, 196, 0.12); color: #d7fff6; }
    .banner.warn { background: rgba(245, 193, 108, 0.14); color: #ffe7bf; }

    #status-error:not([hidden]),
    #restart-note:not([hidden]) {
      margin-bottom: 18px;
    }

    .app {
      width: 100%;
      max-width: none;
      margin: 0;
      padding: 28px 24px 56px;
      box-sizing: border-box;
    }

    .topbar {
      display: flex;
      justify-content: space-between;
      gap: 18px;
      align-items: flex-start;
      margin-bottom: 18px;
    }

    .topbar h1 {
      margin: 8px 0 4px;
      font-family: var(--serif);
      font-size: 40px;
      font-weight: 500;
      letter-spacing: -0.03em;
    }

    .topbar p { margin: 0; color: var(--muted); }

    .actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 8px;
    }

    .ghost:disabled {
      opacity: 0.4;
      cursor: default;
    }

    .ghost:disabled:hover { border-color: var(--line); }

    .dot.off { background: #8ea0bb; }

    .status-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 16px;
    }

    .chip {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 7px 10px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: rgba(8, 16, 24, 0.55);
      color: var(--text);
      font-size: 13px;
    }

    .dot {
      width: 8px;
      height: 8px;
      border-radius: 99px;
      background: var(--mint);
    }

    .dot.busy {
      background: var(--amber);
      animation: pulse 1.4s infinite;
    }

    .dot.bad { background: var(--rose); }

    @keyframes pulse {
      0% { box-shadow: 0 0 0 0 rgba(245, 193, 108, 0.55); }
      100% { box-shadow: 0 0 0 8px rgba(245, 193, 108, 0); }
    }

    .cards { display: grid; gap: 16px; min-width: 0; }

    .nav {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 0 0 18px;
    }

    .nav button {
      border-radius: 12px;
      padding: 10px 14px;
      border: 1px solid var(--line);
      background: transparent;
      color: var(--muted);
    }

    .nav button:hover {
      border-color: rgba(61, 222, 196, 0.45);
      color: var(--text);
    }

    .nav button.active {
      background: rgba(61, 222, 196, 0.14);
      border-color: rgba(61, 222, 196, 0.4);
      color: var(--mint);
      font-weight: 650;
    }

    .page-subnav {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 0 0 14px;
    }

    .page-subnav button {
      border-radius: 10px;
      padding: 8px 12px;
      border: 1px solid var(--line);
      background: transparent;
      color: var(--muted);
      font-size: 14px;
    }

    .page-subnav button:hover {
      border-color: rgba(61, 222, 196, 0.45);
      color: var(--text);
    }

    .page-subnav button.active {
      background: rgba(61, 222, 196, 0.12);
      border-color: rgba(61, 222, 196, 0.35);
      color: var(--mint);
      font-weight: 650;
    }

    .page-panel {
      display: grid;
      gap: 16px;
      min-width: 0;
    }

    .page-panel > .status-row {
      margin-top: 0;
    }

    .api-poll-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 10px;
      margin-top: 16px;
    }

    .api-poll-actions .settings-save,
    .api-poll-actions .ghost {
      min-height: 42px;
    }

    .page { display: grid; gap: 16px; min-width: 0; }

    .card {
      border-radius: 22px;
      padding: 22px;
    }

    .card h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
    .card-text { margin: 6px 0 16px; color: var(--muted); }

    .grid { display: grid; gap: 16px; }
    .grid.cols-2 { grid-template-columns: 1fr 1fr; }
    .grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
    .grid.cols-2 .field.wide,
    .grid.cols-3 .field.wide { grid-column: 1 / -1; }

    .card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin: 0 0 6px;
    }
    .card-head h2 { margin: 0; }
    .card-head .settings-save { flex-shrink: 0; }

    .hint, .field-error { margin: 0; font-size: 12px; line-height: 1.4; }
    .hint { color: var(--muted); }
    .hint.ok { color: #d7fff6; }
    .field-error { color: #ffd0d6; }
    .field.invalid input { box-shadow: 0 0 0 2px rgba(255, 139, 154, 0.55); }

    .badge {
      border-radius: 999px;
      padding: 2px 8px;
      color: var(--amber);
      background: rgba(245, 193, 108, 0.12);
      font-size: 11px;
    }

    .badge.ok {
      color: #9dffce;
      background: rgba(61, 214, 140, 0.14);
    }

    .badge.muted {
      color: var(--muted);
      background: rgba(148, 163, 184, 0.12);
    }

    .leagues-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin: 0 0 14px;
    }

    .leagues-meta .card-text {
      margin: 0;
    }

    .matches-meta {
      margin: 0 0 14px;
    }

    .matches-meta .card-text {
      margin: 0;
    }

    .matches2-settings {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px 14px;
      align-items: end;
      margin: 0 0 12px;
    }

    .matches2-settings .matches2-url {
      grid-column: 1 / -1;
    }

    .matches2-settings .matches2-proxies {
      grid-column: 1 / -1;
    }

    .matches2-settings .matches2-actions {
      grid-column: 1 / -1;
      justify-content: flex-start;
    }

    .matches2-proxy-list {
      display: flex;
      flex-wrap: wrap;
      gap: 8px 14px;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.03);
      min-height: 42px;
    }

    .matches2-proxy-item {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-size: 13px;
      cursor: pointer;
      user-select: none;
    }

    .matches2-proxy-item input {
      margin: 0;
    }

    .telegram-chats-list {
      display: grid;
      gap: 10px;
      width: 100%;
    }

    .telegram-chat-row {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) 110px auto;
      gap: 8px;
      align-items: center;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.03);
      min-width: 0;
    }

    .telegram-chat-row input {
      width: 100%;
      min-width: 0;
    }

    .telegram-chat-enabled {
      min-height: 36px;
      padding: 3px;
      border-radius: 10px;
    }

    .telegram-chat-enabled button {
      border-radius: 8px;
      font-size: 12px;
    }

    .telegram-chat-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      justify-content: flex-end;
    }

    .telegram-chat-actions .ghost {
      padding: 6px 10px;
      font-size: 12px;
    }

    .telegram-chat-add {
      margin-top: 8px;
      align-self: flex-start;
    }

    .field[data-key="TELEGRAM_CHAT_ID"] .control {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      width: 100%;
    }

    @media (max-width: 720px) {
      .telegram-chat-row {
        grid-template-columns: 1fr;
      }

      .telegram-chat-actions {
        justify-content: flex-start;
      }
    }

    .matches-chart {
      margin: 0 0 18px;
      padding: 12px 14px 10px;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.03);
      width: 100%;
      box-sizing: border-box;
    }

    .matches-charts-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
      margin: 0 0 18px;
      align-items: stretch;
    }

    .matches-charts-row .matches-chart {
      margin: 0;
      min-width: 0;
    }

    @media (max-width: 900px) {
      .matches-charts-row {
        grid-template-columns: 1fr;
      }
    }

    .matches-chart-head {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      justify-content: space-between;
      gap: 8px 16px;
      margin: 0 0 10px;
    }

    .matches-chart-title {
      margin: 0;
      font-size: 13px;
      font-weight: 600;
      letter-spacing: -0.01em;
    }

    .matches-chart-value {
      margin: 0;
      display: flex;
      flex-wrap: wrap;
      gap: 6px 14px;
      font-size: 12px;
      color: var(--muted);
    }

    .matches-chart-legend-item {
      display: inline-flex;
      align-items: baseline;
      gap: 5px;
    }

    .matches-chart-legend-item::before {
      content: "";
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--c, var(--muted));
      flex-shrink: 0;
      align-self: center;
    }

    .matches-chart-value strong {
      color: var(--text);
      font-weight: 600;
    }

    #matches-chart-plot {
      position: relative;
      width: 100%;
      height: 180px;
    }

    #matches2-chart-plot {
      position: relative;
      width: 100%;
      height: 180px;
    }

    #matches2-signals-chart-plot {
      position: relative;
      width: 100%;
      height: 180px;
    }

    #matches-chart-plot canvas,
    #matches2-chart-plot canvas,
    #matches2-signals-chart-plot canvas {
      display: block;
      width: 100% !important;
      height: 100% !important;
    }

    .matches-chart-empty {
      margin: 0;
      font-size: 12px;
      color: var(--muted);
    }

    .matches-filter {
      margin: 0 0 14px;
      max-width: 420px;
    }

    .matches-groups {
      display: grid;
      gap: 18px;
    }

    .matches-group-title {
      margin: 0 0 10px;
      font-size: 13px;
      font-weight: 600;
      letter-spacing: -0.01em;
      color: var(--muted);
    }

    #matches-table .item-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
      gap: 10px;
      justify-content: start;
    }

    .matches-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
      gap: 10px;
      justify-content: start;
    }

    .match-card {
      padding: 10px 12px;
      gap: 8px;
      border-radius: 12px;
    }

    .match-card-teams {
      margin: 2px 0 0;
      text-align: center;
      font-size: 13px;
      font-weight: 650;
      line-height: 1.3;
      letter-spacing: -0.01em;
      word-break: break-word;
    }

    .match-card .item-card-fact {
      grid-template-columns: 52px minmax(0, 1fr);
      gap: 4px 8px;
    }

    .match-card .item-card-facts {
      gap: 4px;
      font-size: 11px;
    }

    .match-card .item-card-fact strong {
      font-size: 11px;
      overflow-wrap: break-word;
      word-break: normal;
      hyphens: none;
    }

    .match-card-comment {
      margin: 6px 0 0;
      font-size: 11px;
      line-height: 1.35;
      color: var(--muted);
    }

    .match-card-comment strong {
      color: var(--text);
      font-weight: 600;
    }

    .match-stat-rows {
      display: grid;
      gap: 8px;
      margin-top: 2px;
    }

    .match-stat-row {
      display: grid;
      grid-template-columns: 42px minmax(0, 1fr) 42px;
      align-items: end;
      gap: 6px;
    }

    .match-stat-val {
      font-size: 11px;
      font-variant-numeric: tabular-nums;
      color: var(--muted);
      text-align: center;
      line-height: 1.2;
    }

    .match-stat-val.home.is-lead {
      color: var(--mint);
      font-weight: 650;
    }

    .match-stat-val.away.is-lead {
      color: var(--amber);
      font-weight: 650;
    }

    .match-stat-mid {
      display: grid;
      gap: 3px;
      min-width: 0;
    }

    .match-stat-label {
      font-size: 10px;
      line-height: 1.2;
      color: var(--muted);
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .match-stat-track {
      display: flex;
      width: 100%;
      height: 8px;
      border-radius: 999px;
      overflow: hidden;
      background: rgba(154, 171, 196, 0.14);
    }

    .match-stat-fill {
      height: 100%;
      min-width: 0;
      flex: 0 0 auto;
    }

    .match-stat-fill.home {
      background: rgba(61, 222, 196, 0.45);
    }

    .match-stat-fill.home.is-lead {
      background: #3ddec4;
    }

    .match-stat-fill.away {
      background: rgba(245, 193, 108, 0.45);
    }

    .match-stat-fill.away.is-lead {
      background: #f5c16c;
    }

    .match-stat-xg-note {
      margin: -2px 0 0;
      font-size: 10px;
      line-height: 1.3;
      color: var(--amber);
      text-align: center;
    }

    .match-signal-blocks {
      display: grid;
      gap: 8px;
      margin-top: 8px;
    }

    .match-signal-card {
      padding: 8px 10px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: rgba(126, 182, 255, 0.06);
    }

    .match-signal-card.status-hit {
      border-color: rgba(61, 222, 196, 0.35);
      background: rgba(61, 222, 196, 0.08);
    }

    .match-signal-card.status-opponent,
    .match-signal-card.status-ended {
      border-color: rgba(255, 139, 154, 0.35);
      background: rgba(255, 139, 154, 0.06);
    }

    .match-signal-caption,
    .match-signal-line {
      margin: 0;
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
    }

    .match-signal-meta,
    .match-signal-status {
      margin: 4px 0 0;
      font-size: 11px;
      color: var(--muted);
    }

    .signal-card .signal-card-status {
      font-size: 12px;
      color: var(--muted);
      white-space: nowrap;
    }

    .signal-card.status-hit .signal-card-status { color: var(--mint); }
    .signal-card.status-opponent .signal-card-status,
    .signal-card.status-ended .signal-card-status { color: var(--rose, #ff8b9a); }

    .signal-card-reason {
      margin: 8px 0 0;
      font-size: 12px;
      color: var(--muted);
    }

    #signals-hitmiss-plot,
    #signals-outcomes-plot {
      position: relative;
      width: 100%;
      height: 180px;
    }

    #signals-hitmiss-plot canvas,
    #signals-outcomes-plot canvas {
      display: block;
      width: 100% !important;
      height: 100% !important;
    }

    .leagues-filter {
      margin: 0 0 14px;
      max-width: 420px;
    }

    .leagues-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 10px;
    }

    .league-card {
      display: flex;
      flex-direction: column;
      gap: 6px;
      min-width: 0;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.03);
    }

    .league-card-name {
      font-size: 13px;
      font-weight: 600;
      line-height: 1.3;
      letter-spacing: -0.01em;
    }

    .league-card-country {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.3;
    }

    .league-card-foot {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-top: 2px;
    }

    .league-card-id {
      color: var(--muted);
      font-family: var(--mono);
      font-size: 11px;
    }

    input[name="TELEGRAM_TOKEN"],
    input[name="API_SPORTS"] {
      font-family: var(--mono);
      font-size: 13px;
    }

    select {
      width: 100%;
      appearance: none;
      -webkit-appearance: none;
      border-radius: 12px;
      border: 1px solid var(--line);
      background-color: #0b1320;
      background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
      background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 12px) calc(50% - 2px);
      background-size: 6px 6px, 6px 6px;
      background-repeat: no-repeat;
      padding: 12px 40px 12px 14px;
      outline: none;
      color: inherit;
      font: inherit;
      cursor: pointer;
      transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    }

    select:hover {
      border-color: rgba(61, 222, 196, 0.35);
      background-color: #0e1826;
    }

    select:focus {
      border-color: transparent;
      box-shadow: 0 0 0 2px rgba(61, 222, 196, 0.45);
    }

    select option,
    select optgroup {
      background: #0b1320;
      color: var(--text);
    }

    .bin-toggle {
      display: inline-grid;
      grid-template-columns: 1fr 1fr;
      width: 100%;
      min-height: 46px;
      padding: 4px;
      border-radius: 12px;
      border: 1px solid var(--line);
      background: #0b1320;
      gap: 4px;
    }

    .bin-toggle button {
      border: 0;
      border-radius: 9px;
      background: transparent;
      color: var(--muted);
      font: inherit;
      font-size: 13px;
      font-weight: 650;
      transition: background 0.15s ease, color 0.15s ease;
    }

    .bin-toggle button:hover {
      color: var(--text);
      background: rgba(255, 255, 255, 0.04);
    }

    .bin-toggle button[aria-pressed="true"] {
      background: rgba(61, 222, 196, 0.18);
      color: var(--mint);
      box-shadow: inset 0 0 0 1px rgba(61, 222, 196, 0.35);
    }

    .state-chip {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 28px;
      padding: 2px 8px;
      border-radius: 8px;
      font-family: var(--mono);
      font-size: 12px;
      font-weight: 650;
      color: var(--muted);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--line);
    }

    .state-chip.on {
      color: var(--mint);
      background: rgba(61, 222, 196, 0.12);
      border-color: rgba(61, 222, 196, 0.28);
    }

    .state-chip.lim {
      color: var(--amber);
      background: rgba(245, 193, 108, 0.12);
      border-color: rgba(245, 193, 108, 0.28);
    }

    .item-card-fact .state-chip {
      justify-self: start;
      width: fit-content;
    }

    .data-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
    }

    .data-table th,
    .data-table td {
      text-align: left;
      padding: 10px 8px;
      border-bottom: 1px solid var(--line);
      vertical-align: top;
    }

    .data-table th {
      color: var(--muted);
      font-weight: 600;
      font-size: 12px;
    }

    .data-table td.mono,
    .mono {
      font-family: var(--mono);
      font-size: 12px;
      word-break: break-all;
    }

    .table-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .table-actions .ghost {
      padding: 6px 10px;
      font-size: 12px;
    }

    .item-list {
      display: grid;
      gap: 10px;
      min-width: 0;
      width: 100%;
    }

    .item-card {
      border: 1px solid var(--line);
      border-radius: 14px;
      background: rgba(8, 16, 24, 0.55);
      padding: 14px 16px;
      display: grid;
      gap: 10px;
      min-width: 0;
      max-width: 100%;
      overflow: hidden;
    }

    #keys-table .item-list {
      grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 400px));
      justify-content: start;
    }

    #keys-table .item-card {
      max-width: 400px;
      width: 100%;
    }

    .item-card-fact .bin-toggle {
      min-height: 36px;
      padding: 3px;
      border-radius: 10px;
    }

    .item-card-fact .bin-toggle button {
      border-radius: 8px;
      font-size: 12px;
    }

    .item-card-fact.fact-toggle {
      align-items: center;
    }

    .item-card-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px 10px;
      min-width: 0;
    }

    .item-card-title {
      font-weight: 650;
      letter-spacing: -0.01em;
      min-width: 0;
      flex: 1 1 auto;
      word-break: break-word;
    }

    .item-card-id {
      font-family: var(--mono);
      font-size: 11px;
      color: var(--muted);
      padding: 2px 7px;
      border-radius: 7px;
      border: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.03);
      flex-shrink: 0;
    }

    .item-card-meta {
      margin-left: auto;
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      flex-shrink: 0;
    }

    .item-card-facts {
      display: grid;
      gap: 6px;
      font-size: 12px;
      color: var(--muted);
      min-width: 0;
    }

    .item-card-fact {
      display: grid;
      grid-template-columns: 64px minmax(0, 1fr);
      gap: 8px 12px;
      align-items: baseline;
      min-width: 0;
    }

    .item-card-fact strong {
      color: var(--text);
      font-weight: 600;
      font-family: var(--mono);
      font-size: 12px;
      min-width: 0;
      overflow-wrap: anywhere;
      word-break: break-all;
    }

    .item-card-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      padding-top: 2px;
    }

    .item-card-actions .ghost {
      padding: 6px 10px;
      font-size: 12px;
    }

    .inline-form {
      display: grid;
      gap: 12px;
      margin-top: 16px;
      padding-top: 16px;
    }

    .inline-form.cols-3 {
      grid-template-columns: repeat(3, minmax(0, 1fr));
      align-items: end;
    }

    .inline-form.proxy-layout {
      grid-template-columns: repeat(3, minmax(0, 1fr));
      align-items: end;
    }

    .inline-form.proxy-layout .proxy-name {
      grid-column: 1;
    }

    .inline-form.proxy-layout .proxy-ua {
      grid-column: 2 / -1;
    }

    .inline-form.proxy-layout .proxy-address {
      grid-column: 1 / -1;
    }

    .inline-form.proxy-layout .form-actions {
      justify-content: flex-end;
    }

    .inline-form .full {
      grid-column: 1 / -1;
    }

    .inline-form .form-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: end;
    }

    #users-table .data-table tr:last-child td {
      border-bottom: 0;
    }

    .grid.api-top {
      grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr);
      align-items: start;
    }

    .keys-manage {
      margin-top: 16px;
    }

    .keys-manage h4 {
      margin: 0 0 12px;
      font-size: 15px;
      font-weight: 650;
    }

    .toasts {
      position: fixed;
      top: 18px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 40;
      display: grid;
      gap: 8px;
      width: min(480px, calc(100% - 32px));
      pointer-events: none;
    }

    .toast {
      margin: 0;
      padding: 12px 14px;
      border-radius: 12px;
      background: rgba(14, 24, 38, 0.96);
      border: 1px solid var(--line);
      box-shadow: var(--shadow);
      color: var(--muted);
      line-height: 1.45;
      animation: toast-in 0.18s ease-out;
    }

    .toast.ok { background: rgba(6, 36, 31, 0.96); border-color: rgba(61, 222, 196, 0.35); color: #d7fff6; }
    .toast.bad { background: rgba(48, 16, 22, 0.96); border-color: rgba(255, 139, 154, 0.35); color: #ffd0d6; }
    .toast.warn { background: rgba(42, 30, 12, 0.96); border-color: rgba(245, 193, 108, 0.35); color: #ffe7bf; }

    @keyframes toast-in {
      from { opacity: 0; transform: translateY(-8px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .logs-toolbar {
      display: grid;
      grid-template-columns: minmax(140px, 200px) auto minmax(180px, 1fr);
      gap: 10px 12px;
      align-items: end;
      margin: 0 0 14px;
    }

    .logs-toolbar .field {
      margin: 0;
    }

    .logs-match-actions {
      display: flex;
      gap: 8px;
      align-items: center;
      padding-bottom: 2px;
    }

    .logs-filter {
      margin: 0;
    }

    .logs-charts {
      display: grid;
      grid-template-columns: minmax(280px, 1.4fr) minmax(200px, 0.8fr);
      gap: 10px;
      margin: 16px 0 16px;
      align-items: stretch;
    }

    .logs-chart-card {
      border: 1px solid var(--line);
      border-radius: 14px;
      background: rgba(8, 16, 24, 0.55);
      padding: 8px 10px 6px;
      height: 180px;
      min-width: 0;
    }

    .logs-chart-card canvas {
      display: block;
      width: 100% !important;
      height: 100% !important;
    }

    .row-note {
      margin: 8px 0 0;
      font-size: 12px;
      color: var(--muted);
    }

    .row-note.bad { color: #ffd0d6; }
    .row-note.ok { color: #d7fff6; }

    .empty-row {
      color: var(--muted);
      font-size: 13px;
      padding: 12px 0;
    }

    .log-ok { color: #d7fff6; }
    .log-bad { color: #ffd0d6; }

    .logs-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
      gap: 10px;
      align-items: start;
    }

    .log-card {
      border: 1px solid var(--line);
      border-radius: 14px;
      background: rgba(8, 16, 24, 0.55);
      padding: 12px 14px;
      display: grid;
      gap: 8px;
      min-width: 0;
    }

    .log-card.bad {
      border-color: rgba(255, 139, 154, 0.28);
      background: rgba(48, 16, 22, 0.22);
    }

    .log-card-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px 10px;
    }

    .log-kind {
      font-weight: 650;
      letter-spacing: -0.01em;
    }

    .log-method {
      font-family: var(--mono);
      font-size: 11px;
      color: var(--muted);
      padding: 2px 7px;
      border-radius: 7px;
      border: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.03);
    }

    .log-status {
      font-family: var(--mono);
      font-size: 12px;
      font-weight: 650;
      padding: 2px 8px;
      border-radius: 8px;
      border: 1px solid var(--line);
      color: var(--muted);
      background: rgba(255, 255, 255, 0.05);
    }

    .log-status.ok {
      color: var(--mint);
      background: rgba(61, 222, 196, 0.12);
      border-color: rgba(61, 222, 196, 0.28);
    }

    .log-status.bad {
      color: #ffd0d6;
      background: rgba(255, 139, 154, 0.12);
      border-color: rgba(255, 139, 154, 0.28);
    }

    .log-meta {
      margin-left: auto;
      display: flex;
      flex-wrap: wrap;
      gap: 8px 12px;
      color: var(--muted);
      font-size: 12px;
    }

    .log-url {
      font-family: var(--mono);
      font-size: 12px;
      word-break: break-all;
      color: var(--text);
      line-height: 1.45;
    }

    .log-facts {
      display: flex;
      flex-wrap: wrap;
      gap: 8px 14px;
      font-size: 12px;
      color: var(--muted);
    }

    .log-facts strong {
      color: var(--text);
      font-weight: 600;
    }

    .log-error {
      margin: 0;
      font-size: 12px;
      line-height: 1.45;
      color: #ffd0d6;
      padding: 8px 10px;
      border-radius: 10px;
      background: rgba(255, 139, 154, 0.08);
      border: 1px solid rgba(255, 139, 154, 0.18);
      word-break: break-word;
    }

    .log-comment {
      margin: 0;
      font-size: 12px;
      line-height: 1.45;
      color: var(--text);
      padding: 8px 10px;
      border-radius: 10px;
      background: rgba(245, 200, 66, 0.08);
      border: 1px solid rgba(245, 200, 66, 0.2);
      word-break: break-word;
    }

    .log-body-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
    }

    .log-body-type {
      font-family: var(--mono);
      font-size: 11px;
      font-weight: 650;
      letter-spacing: 0.04em;
      padding: 2px 7px;
      border-radius: 7px;
      border: 1px solid var(--line);
      color: var(--muted);
      background: rgba(255, 255, 255, 0.04);
    }

    .log-body-type-json {
      color: var(--mint);
      border-color: rgba(61, 222, 196, 0.35);
      background: rgba(61, 222, 196, 0.1);
    }

    .log-body-type-html {
      color: var(--amber);
      border-color: rgba(245, 193, 108, 0.35);
      background: rgba(245, 193, 108, 0.1);
    }

    .log-body-type-txt {
      color: #c5d4ea;
      border-color: rgba(186, 214, 255, 0.28);
      background: rgba(186, 214, 255, 0.08);
    }

    .log-body-type-empty {
      color: var(--muted);
      border-color: rgba(154, 171, 196, 0.3);
      background: rgba(154, 171, 196, 0.1);
    }

    .log-card-head .log-body-type {
      text-transform: uppercase;
    }

    .log-body-btn {
      justify-self: start;
      padding: 6px 10px;
      font-size: 12px;
    }

    .log-body {
      margin: 0;
      font-family: var(--mono);
      font-size: 11px;
      line-height: 1.45;
      color: var(--text);
      padding: 8px 10px;
      border-radius: 10px;
      background: rgba(61, 222, 196, 0.06);
      border: 1px solid rgba(61, 222, 196, 0.16);
      white-space: pre-wrap;
      word-break: break-word;
      overflow: auto;
      max-height: min(70vh, 640px);
    }

    .modal {
      border: none;
      padding: 0;
      background: transparent;
      max-width: min(920px, calc(100vw - 32px));
      width: 100%;
    }

    .modal::backdrop {
      background: rgba(4, 10, 16, 0.72);
    }

    .modal-panel {
      border: 1px solid var(--line);
      border-radius: 16px;
      background: var(--card);
      box-shadow: var(--shadow);
      padding: 16px 18px;
      display: grid;
      gap: 12px;
    }

    .modal-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 10px;
    }

    .modal-title {
      margin: 0;
      font-size: 16px;
      font-weight: 650;
    }

    .modal-actions {
      margin-left: auto;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .modal-actions .ghost {
      padding: 6px 10px;
      font-size: 12px;
    }

    .modal-body {
      max-height: min(70vh, 640px);
    }

    .keys-block {
      margin-top: 20px;
      padding-top: 16px;
      border-top: 1px solid var(--line);
      min-width: 0;
      max-width: 100%;
    }

    .keys-block h3 {
      margin: 0 0 6px;
      font-size: 16px;
      font-weight: 650;
    }

    #keys-block,
    #keys-table {
      min-width: 0;
      max-width: 100%;
    }

    .cards > .card {
      min-width: 0;
      max-width: 100%;
      overflow: hidden;
    }

    @media (max-width: 900px) {
      .login-shell { grid-template-columns: 1fr; }
      .login-aside { display: none; }
      .grid.cols-2,
      .grid.cols-3,
      .grid.api-top { grid-template-columns: 1fr; }
      .inline-form.cols-3,
      .inline-form.proxy-layout { grid-template-columns: 1fr; }
      .inline-form.proxy-layout .proxy-name,
      .inline-form.proxy-layout .proxy-ua,
      .inline-form.proxy-layout .proxy-address {
        grid-column: 1 / -1;
      }
      .inline-form.proxy-layout .form-actions {
        justify-content: flex-end;
      }
      .matches2-settings {
        grid-template-columns: 1fr;
      }
      .logs-charts {
        grid-template-columns: 1fr;
      }
      .logs-toolbar {
        grid-template-columns: 1fr;
      }
      .logs-chart-card-wide {
        grid-column: auto;
      }
      .topbar { flex-direction: column; align-items: stretch; }
      .topbar h1 { font-size: 34px; }
      .item-card-fact {
        grid-template-columns: 1fr;
        gap: 2px;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .dot.busy { animation: none; }
      .toast { animation: none; }
    }
  
