:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #131720;
  --panel-2: #1b2230;
  --line: #2c3443;
  --text: #f4f7fb;
  --muted: #a9b3c4;
  --accent: #17c964;
  --accent-2: #248bff;
  --danger: #ff4d4f;
  --warn: #f5a524;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #041009;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1119;
  color: var(--text);
  padding: 0 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand strong {
  font-size: 1.15rem;
}

.brand span,
.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.span-4 {
  grid-column: span 4;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.form {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

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

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.pill.ok {
  background: rgba(23, 201, 100, 0.14);
  color: #65f0a0;
}

.pill.bad {
  background: rgba(255, 77, 79, 0.16);
  color: #ff9a9b;
}

.watch {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.watch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 16, 0.94);
}

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

.watch-title strong,
.watch-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-title span {
  color: var(--muted);
  font-size: 0.86rem;
}

.player-stage {
  position: relative;
  min-height: 0;
  background: #020305;
  display: grid;
  place-items: center;
}

video {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 62px);
  object-fit: contain;
  background: #020305;
}

.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px;
}

.overlay .row {
  gap: 8px;
}

.floating-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
}

.floating-actions button {
  pointer-events: auto;
  min-width: 44px;
  padding: 0 12px;
}

.center-message {
  position: absolute;
  inset: auto 18px;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}

.login-card {
  width: min(440px, calc(100% - 28px));
  margin: 12vh auto 0;
}

.toast {
  margin-top: 10px;
  color: var(--warn);
}

.hidden {
  display: none !important;
}

@media (max-width: 840px) {
  .span-4,
  .span-8 {
    grid-column: span 12;
  }

  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel {
    padding: 14px;
  }

  .watch-header {
    padding-top: calc(10px + env(safe-area-inset-top));
  }
}

