:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d7dde5;
  --text: #172033;
  --muted: #647084;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --accent-3: #7c3aed;
  --accent-4: #ea580c;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.06);
  --sidebar-bg: linear-gradient(180deg, #ffffff 0%, #edf2f7 100%);
  --sidebar-text: #111827;
  --sidebar-muted: #4b5563;
  --sidebar-active-bg: #e2e8f0;
  --sidebar-active-text: #0f172a;
  --sidebar-active-border: #0d9488;
  --sidebar-shadow: 14px 0 36px rgba(15, 23, 42, 0.04);
}

[data-theme="dark"] {
  --bg: #0b111c;
  --panel: #121b2a;
  --panel-soft: #172235;
  --line: #29364b;
  --text: #f3f7fb;
  --muted: #a8b3c5;
  --accent: #2dd4bf;
  --accent-2: #60a5fa;
  --accent-3: #e879f9;
  --accent-4: #fb923c;
  --danger: #f97066;
  --warning: #fdb022;
  --success: #32d583;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.24);
  --sidebar-bg: linear-gradient(180deg, #111827 0%, #070d16 100%);
  --sidebar-text: #f3f7fb;
  --sidebar-muted: #94a3b8;
  --sidebar-active-bg: rgba(255, 255, 255, 0.12);
  --sidebar-active-text: #ffffff;
  --sidebar-active-border: #2dd4bf;
  --sidebar-shadow: 14px 0 36px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-shadow: var(--sidebar-shadow);
  border-right: 1px solid var(--line);
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--sidebar-text) 28%, transparent);
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  background:
    linear-gradient(135deg, #0d9488 0%, #2563eb 58%, #c026d3 100%);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.24);
  color: #fff;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-subtitle {
  color: var(--sidebar-muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--sidebar-muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  border: 1px solid transparent;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav a svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.nav a.active,
.nav a:hover {
  background: var(--sidebar-active-bg);
  border-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.nav a.active {
  box-shadow: inset 3px 0 0 var(--sidebar-active-border);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  min-width: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
  font-weight: 750;
}

.subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}

.quick-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 10%, var(--panel));
  font-size: 12px;
  font-weight: 750;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 16%, transparent);
}

.view {
  padding: 24px 28px 36px;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.grid > *,
.view > * {
  min-width: 0;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.metric,
.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.metric {
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
}

.metric:nth-child(2)::before {
  background: var(--accent-2);
}

.metric:nth-child(3)::before {
  background: var(--accent-3);
}

.metric:nth-child(4)::before {
  background: var(--accent-4);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 760;
  line-height: 1;
}

.metric-hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.panel-title {
  font-size: 15px;
  font-weight: 720;
  margin: 0 0 12px;
}

.section-title {
  font-size: 15px;
  font-weight: 720;
  margin: 0 0 10px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.insight-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-soft);
  min-width: 0;
}

.insight-card.negative {
  border-left: 4px solid var(--warning);
}

.insight-card.positive {
  border-left: 4px solid var(--success);
}

.insight-card.neutral {
  border-left: 4px solid var(--accent-2);
}

.insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.insight-head strong {
  font-size: 14px;
}

.insight-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  text-transform: uppercase;
}

.insight-card p {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.insight-evidence {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

.chart-box {
  height: 280px;
  position: relative;
}

.chart-box.tall {
  height: 340px;
}

.chart-box.small {
  height: 220px;
}

.table-panel {
  width: min(100%, 100vw);
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-summary {
  min-width: 0;
}

.pagination-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pagination-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.pagination-btn svg {
  width: 15px;
  height: 15px;
}

.pagination-btn.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.pagination-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: color-mix(in srgb, var(--panel) 86%, var(--bg));
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  border-radius: 5px;
  font-weight: 750;
  font-size: 12px;
}

.level.S {
  background: #dcfae6;
  color: #05603a;
}

.level.A {
  background: #d1e9ff;
  color: #1849a9;
}

.level.B {
  background: #fef0c7;
  color: #93370d;
}

.level.C {
  background: #eef2f6;
  color: #344054;
}

.level.Risk {
  background: #fee4e2;
  color: #912018;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 750;
  background: #eef2f6;
  color: #344054;
}

.status-badge.completed,
.status-badge.closed,
.status-badge.ended {
  background: #dcfae6;
  color: #05603a;
}

.status-badge.partial,
.status-badge.interrupted,
.status-badge.suspended,
.status-badge.delayed {
  background: #fef0c7;
  color: #93370d;
}

.status-badge.failed,
.status-badge.cancelled {
  background: #fee4e2;
  color: #912018;
}

.status-badge.not_synced {
  background: #e0f2fe;
  color: #075985;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 750;
  background: #eef2f6;
  color: #344054;
}

.result-badge.success,
.result-badge.won {
  background: #dcfae6;
  color: #05603a;
}

.result-badge.failed,
.result-badge.lost {
  background: #fee4e2;
  color: #912018;
}

.result-badge.retired,
.result-badge.walkover {
  background: #fef0c7;
  color: #93370d;
}

.result-badge.abandoned,
.result-badge.interrupted {
  background: #e0f2fe;
  color: #075985;
}

.link-button,
.icon-button,
.action-button,
.inline-action {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  box-shadow: var(--shadow-soft);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.inline-action {
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin-right: 4px;
}

.icon-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.top-actions .icon-button {
  border-radius: 999px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  box-shadow: none;
  background: transparent;
}

.top-actions .icon-button.icon-only {
  width: 36px;
  padding: 0;
}

.theme-pill {
  background: color-mix(in srgb, var(--accent-2) 10%, transparent) !important;
  color: color-mix(in srgb, var(--accent-2) 86%, var(--text));
  font-size: 13px;
  font-weight: 750;
}

.logout-button {
  color: var(--danger);
}

.action-button.primary {
  background: var(--accent-2);
  border-color: transparent;
  color: #fff;
}

.action-button.danger,
.inline-action.danger {
  background: color-mix(in srgb, var(--danger) 9%, var(--panel));
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  color: var(--danger);
}

.link-button:hover,
.icon-button:hover,
.action-button:hover {
  border-color: #98a2b3;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.field {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 36px;
  padding: 8px 10px;
  background: var(--panel-soft);
  color: var(--text);
  min-width: 180px;
}

.sync-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr)) minmax(130px, auto) repeat(3, auto);
  gap: 10px;
  align-items: end;
}

.sync-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.check-field {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-height: 36px;
  color: var(--text) !important;
  white-space: nowrap;
}

.help-text {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.scheduler-status {
  margin-bottom: 14px;
}

.scheduler-form {
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(180px, 1fr) minmax(190px, auto) repeat(3, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.scheduler-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.scheduler-form .field {
  min-width: 0;
  width: 100%;
}

.compact-table table {
  min-width: 560px;
}

.json-box {
  margin: 0;
  padding: 12px;
  border-radius: 6px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  overflow: auto;
  max-height: 320px;
  font-size: 12px;
}

.result-panel {
  margin-top: 14px;
}

.stack {
  display: grid;
  gap: 10px;
}

.match-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.match-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.match-hero h2 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.hero-status {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 12%, var(--panel));
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.scoreboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.score-player {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px;
  min-width: 0;
}

.score-player-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.player-name {
  font-size: 17px;
  font-weight: 780;
  line-height: 1.25;
}

.player-meta,
.live-card-meta,
.point-meta,
.game-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.scoreline {
  font-size: 22px;
  font-weight: 800;
  white-space: nowrap;
}

.mini-metrics,
.hero-facts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.mini-metrics span,
.hero-facts span,
.point-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: color-mix(in srgb, var(--accent-2) 9%, var(--panel));
  color: color-mix(in srgb, var(--accent-2) 78%, var(--text));
  font-size: 12px;
  font-weight: 750;
}

.hero-facts {
  margin-top: 0;
}

.no-pad-panel {
  padding: 0;
  overflow: hidden;
}

.no-pad-panel .panel-title {
  padding: 16px 16px 0;
}

.no-pad-panel > .table-panel,
.no-pad-panel > .timeline-list,
.no-pad-panel > .game-timeline,
.no-pad-panel > .empty {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.no-pad-panel > .pagination {
  padding: 0 16px 14px;
}

.timeline-list {
  display: grid;
  max-height: 430px;
  overflow: auto;
}

.point-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.point-row:last-child {
  border-bottom: 0;
}

.point-index {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.point-title {
  font-size: 13px;
  font-weight: 760;
}

.point-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.point-tags span {
  background: color-mix(in srgb, var(--warning) 13%, var(--panel));
  color: var(--warning);
}

.game-timeline {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 16px;
}

.game-node {
  position: relative;
  min-width: 112px;
  padding: 0 10px 0 0;
}

.game-node::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  right: 0;
  height: 2px;
  background: var(--line);
}

.game-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 3px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line);
  position: relative;
  z-index: 1;
}

.game-node.break .game-dot {
  background: var(--danger);
}

.game-node.key .game-dot {
  background: var(--warning);
}

.game-title {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
}

.signal-context {
  display: grid;
  gap: 14px;
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.detail-link {
  justify-self: start;
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.live-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 15px;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.live-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line));
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.live-card-head,
.live-card-players div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.live-card-head span {
  color: var(--muted);
  font-size: 12px;
}

.live-card-head strong {
  color: var(--success);
  font-size: 12px;
}

.live-card-title {
  font-size: 17px;
  font-weight: 780;
}

.live-card-players {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.live-card-players div span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kv {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
}

.kv span:first-child {
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.empty {
  border: 1px dashed #c9d2df;
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  background: var(--panel);
}

/* Sidebar dark theme handled by variables */

[data-theme="dark"] .brand-mark {
  color: #041313;
}

[data-theme="dark"] .level.S {
  background: rgba(50, 213, 131, 0.18);
  color: #86efac;
}

[data-theme="dark"] .level.A {
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
}

[data-theme="dark"] .level.B {
  background: rgba(253, 176, 34, 0.18);
  color: #fedf89;
}

[data-theme="dark"] .level.C {
  background: rgba(163, 175, 191, 0.18);
  color: #d0d5dd;
}

[data-theme="dark"] .level.Risk {
  background: rgba(249, 112, 102, 0.18);
  color: #fda29b;
}

[data-theme="dark"] .status-badge.completed,
[data-theme="dark"] .status-badge.closed,
[data-theme="dark"] .status-badge.ended {
  background: rgba(50, 213, 131, 0.18);
  color: #86efac;
}

[data-theme="dark"] .status-badge.partial,
[data-theme="dark"] .status-badge.interrupted,
[data-theme="dark"] .status-badge.suspended,
[data-theme="dark"] .status-badge.delayed {
  background: rgba(253, 176, 34, 0.18);
  color: #fedf89;
}

[data-theme="dark"] .status-badge.failed,
[data-theme="dark"] .status-badge.cancelled {
  background: rgba(249, 112, 102, 0.18);
  color: #fda29b;
}

[data-theme="dark"] .status-badge.not_synced {
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
}

[data-theme="dark"] .result-badge.success,
[data-theme="dark"] .result-badge.won {
  background: rgba(50, 213, 131, 0.18);
  color: #86efac;
}

[data-theme="dark"] .result-badge.failed,
[data-theme="dark"] .result-badge.lost {
  background: rgba(249, 112, 102, 0.18);
  color: #fda29b;
}

[data-theme="dark"] .result-badge.retired,
[data-theme="dark"] .result-badge.walkover {
  background: rgba(253, 176, 34, 0.18);
  color: #fedf89;
}

[data-theme="dark"] .result-badge.abandoned,
[data-theme="dark"] .result-badge.interrupted {
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #111827;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.24);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  max-width: 420px;
  font-size: 13px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(100%, 420px);
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 22px;
}

.login-brand {
  color: var(--text);
}

.login-brand .brand-subtitle {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-copy {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 0;
  line-height: 1.6;
}

.login-field {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.login-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: 9px 11px;
  background: var(--panel);
  color: var(--text);
}

.login-field input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 36%, transparent);
  border-color: var(--accent);
}

.login-error {
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  color: var(--danger);
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
}

.login-submit {
  width: 100%;
  min-height: 42px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px;
    gap: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
  }

  .nav a {
    white-space: nowrap;
  }

  .nav a.active {
    box-shadow: inset 0 -3px 0 var(--sidebar-active-border);
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .insight-grid {
    grid-template-columns: 1fr;
  }

  .scoreboard-grid,
  .context-grid,
  .live-grid {
    grid-template-columns: 1fr;
  }

  .match-hero-head,
  .score-player-main {
    align-items: stretch;
  }

  .topbar {
    height: auto;
    min-height: 72px;
    padding: 14px 16px;
    gap: 12px;
    align-items: center;
  }

  .view {
    padding: 16px;
  }

  h1 {
    font-size: 20px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters,
  .field,
  .action-button {
    width: 100%;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-actions {
    justify-content: flex-start;
  }

  .sync-form,
  .scheduler-form,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    margin-left: auto;
  }

  .topbar-title {
    flex: 1;
  }

  .chart-box {
    height: 240px;
  }

  .chart-box.tall {
    height: 280px;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .point-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .point-tags {
    grid-column: 2;
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .brand-subtitle {
    display: none;
  }

  .topbar {
    padding: 12px;
  }

  .subtitle {
    font-size: 12px;
  }

  .quick-status {
    display: none;
  }

  .theme-pill span {
    display: none;
  }

  .top-actions {
    gap: 4px;
    padding: 4px;
  }

  .top-actions .icon-button,
  .top-actions .icon-button.icon-only {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
  }

  .nav a {
    padding: 9px 10px;
    font-size: 13px;
  }

  .metric-value {
    font-size: 24px;
  }

  .match-hero {
    padding: 14px;
  }

  .match-hero h2 {
    font-size: 20px;
  }

  .scoreline {
    font-size: 18px;
  }

  table {
    min-width: 640px;
  }

  .table-panel {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }

  .panel .table-panel {
    width: 100%;
    max-width: 100%;
  }
}
