/* ML-only pieces on top of the HazeBox panel theme (app.css + hazebox.css); colours come from its variables. */
:root { --ml-red: var(--red, #f05d5e); --ml-red-text: #ff8b8c; --ml-blue: #60a5fa; --ml-yellow: #facc15; --ml-pink: #f472b6; }

/* Labels: LEGIT is always green and CHEAT always red, as a badge and as a word in text. */
.badge.ml-legit { color: var(--green); background: color-mix(in srgb, var(--green) 10%, transparent);
  border-color: color-mix(in srgb, var(--green) 28%, transparent); }
.badge.ml-cheat { color: var(--ml-red-text); background: color-mix(in srgb, var(--ml-red) 12%, transparent);
  border-color: color-mix(in srgb, var(--ml-red) 34%, transparent); }
.ml-legit-text { color: var(--green); font-weight: 800; }
.ml-cheat-text { color: var(--ml-red-text); font-weight: 800; }

.ml-pad { padding: 22px; }
.ml-stack { display: grid; gap: 20px; }
.ml-stack > .kpi-grid { margin-bottom: 0; }
.ml-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.kpi-grid.ml-kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi.ml-ok { border-color: color-mix(in srgb, var(--green) 35%, var(--line-soft)); }
.kpi.ml-warn { border-color: color-mix(in srgb, var(--amber) 40%, var(--line-soft)); }
.ml-muted { color: var(--muted); }
.ml-error { color: #ff9b8f; }
.ml-small { font-size: 12px; }
.ml-tiny { font-size: 11px; }
.ml-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.view code { background: var(--surface-input); border: 1px solid var(--line-soft); border-radius: 6px; padding: 1px 6px;
  font-size: 12px; color: var(--amber-2); }

/* Lists of servers, keys and admins */
.ml-list { display: grid; gap: 8px; }
.ml-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 13px; border: 1px solid var(--line-soft);
  border-radius: 10px; background: var(--surface-input); font-size: 13px; }
.ml-row.revoked { opacity: .5; }
.ml-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ml-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); flex: 0 0 auto; }
.ml-dot.on { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 14%, transparent); }
.service-state.ml-down i { background: var(--ml-red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ml-red) 14%, transparent); }

/* Progress and score bars */
.ml-bar { height: 7px; border-radius: 99px; background: var(--surface-input); border: 1px solid var(--line-soft); overflow: hidden; margin: 10px 0; }
.ml-bar.slim { width: 120px; margin: 0; }
.ml-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--amber-2)); }
.ml-score { position: relative; display: inline-block; vertical-align: middle; width: 120px; height: 8px; margin-right: 8px;
  border-radius: 99px; background: var(--surface-input); border: 1px solid var(--line-soft); overflow: hidden; }
.ml-score span { display: block; height: 100%; width: 0; background: var(--green); }
.ml-score span.high { background: var(--ml-red); }
.ml-score i { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: .75; }
.ml-spark { width: 120px; height: 30px; }
.ml-spark path { fill: none; stroke: var(--amber-2); stroke-width: 1.6; vector-effect: non-scaling-stroke; }

/* Stats chips */
.ml-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.ml-stat { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; font-size: 12px;
  background: var(--surface-input); border: 1px solid var(--line-soft); color: var(--muted); }
.ml-stat b { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }

/* Filters and forms */
.ml-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.section-head > .ml-toolbar { flex: 1 1 auto; justify-content: flex-end; }
.ml-toolbar .field { min-width: 220px; width: auto; }
.ml-inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.ml-inline-form .field { flex: 1 1 180px; }
.ml-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--table-text); cursor: pointer; }
.ml-check input { accent-color: var(--amber); width: 15px; height: 15px; }
select.field { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
  linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px; background-repeat: no-repeat; }
.ml-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.ml-detail-head .ml-actions { flex: 0 1 auto; justify-content: flex-end; margin-top: 0; align-self: flex-start; }
.ml-actions .field { width: auto; }
select.field.ml-sm { min-height: 34px; padding: 6px 32px 6px 10px; font-size: 12px; background-position: calc(100% - 17px) 14px, calc(100% - 12px) 14px; }
.button.ml-sm { min-height: 34px; padding: 6px 12px; font-size: 12px; }
.data-table tr.ml-click { cursor: pointer; }
.data-table tr.ml-selected td { background: color-mix(in srgb, var(--amber) 8%, transparent); }

/* Capture detail and the rotation chart */
.ml-detail-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ml-detail-head h3 { font-size: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0; }
.ml-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 6px 0 10px; font-size: 12px; }
.ml-legend .ml-check { padding-left: 8px; border-left: 3px solid var(--muted-2); }
.ml-legend .s-dyaw { border-left-color: var(--amber-2); }
.ml-legend .s-dpitch { border-left-color: var(--ml-blue); }
.ml-legend .s-yawErr { border-left-color: var(--ml-yellow); }
.ml-legend .s-pitchErr { border-left-color: var(--ml-pink); }
.ml-legend-note { margin-left: auto; display: inline-flex; gap: 7px; align-items: center; color: var(--muted); }
.ml-legend-note .tick { width: 3px; height: 11px; background: var(--ml-red); display: inline-block; }
.ml-legend-note .glide { width: 15px; height: 11px; border-radius: 2px; background: color-mix(in srgb, var(--ml-blue) 28%, transparent); display: inline-block; }
.ml-chart { display: block; width: 100%; height: 320px; border-radius: 12px; background: var(--surface-input); border: 1px solid var(--line-soft); }
.ml-overview { display: block; width: 100%; height: 46px; margin-top: 10px; border-radius: 10px; cursor: pointer;
  background: var(--surface-input); border: 1px solid var(--line-soft); }
.ml-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

/* Players: heads from their skins (face + hat layer, set by applySkins), status, lists, fights and their hits */
.ml-head { display: inline-block; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 6px; vertical-align: middle;
  background-color: var(--surface-input); background-repeat: no-repeat; image-rendering: pixelated; overflow: hidden;
  color: var(--muted); font-size: 12px; font-weight: 800; line-height: 28px; text-align: center; }
.ml-head.big { width: 64px; height: 64px; border-radius: 12px; font-size: 24px; line-height: 64px; }
.ml-head.ml-head-ready { color: transparent; }
.ml-player { display: inline-flex; align-items: center; gap: 10px; }
.ml-player small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.ml-player-head { display: flex; align-items: center; gap: 16px; }
.ml-status { font-weight: 800; font-size: 12px; }
.ml-status.clean { color: var(--green); }
.ml-status.suspicious { color: var(--amber-2); }
.range-tabs .ml-tab-suspicious { color: var(--amber-2); }
.range-tabs .ml-tab-clean { color: var(--green); }
.ml-timeline { display: grid; gap: 8px; }
.ml-dot.alarm { background: var(--ml-red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ml-red) 14%, transparent); }

.data-table .ml-dot, .ml-detail-head h3 .ml-dot { display: inline-block; vertical-align: middle; margin-right: 8px; }
.ml-fights { display: grid; gap: 14px; }
.ml-fight { display: grid; gap: 12px; }
.ml-fight-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.ml-fight-head .ml-actions { margin-top: 0; }
.ml-fight-head .button, .ml-hit-actions .button { white-space: nowrap; }
.ml-toolbar.ml-players-bar { justify-content: space-between; }
.ml-fight .ml-score { width: 90px; }
.ml-hits td { padding-top: 7px; padding-bottom: 7px; }
.ml-hit-actions { display: flex; gap: 6px; }
.button.ml-xs { min-height: 28px; padding: 3px 10px; font-size: 11px; }

.ml-help ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--table-text); font-size: 13px; }
.ml-warnings { margin: 8px 0; padding-left: 18px; color: var(--amber-2); font-size: 12px; }
.ml-log { margin: 0; padding: 14px; max-height: 360px; overflow: auto; border-radius: 10px; background: var(--surface-input);
  border: 1px solid var(--line-soft); font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--table-text);
  white-space: pre-wrap; word-break: break-word; }
.view details summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 12px; }
.ml-loading { padding: 40px; text-align: center; color: var(--muted); }
.ml-highlight { border-color: var(--amber) !important; box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber) 40%, transparent); }
.toast.ok { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }

@media (max-width: 760px) {
  .ml-chart { height: 240px; }
  .ml-legend-note { margin-left: 0; }
  .ml-toolbar .field { min-width: 0; flex: 1 1 100%; }
}
