:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #64748b;
  --line: #d8dee7;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --warning: #b45309;
  --ok: #15803d;
}

* {
  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;
}

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

.loginShell {
  min-height: 100vh;
  width: min(420px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.loginPanel {
  width: 100%;
  display: grid;
  gap: 16px;
}

.loginPanel button {
  width: 100%;
}

.topbar,
.layout,
.listHeader,
.actions,
.inline,
.formActions,
.channelActions,
.meta {
  display: flex;
  gap: 12px;
}

.topbar {
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

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

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

.panel,
.auth {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.auth {
  margin-bottom: 18px;
}

form.panel {
  flex: 0 0 360px;
}

.listPanel {
  flex: 1;
  min-width: 0;
}

label {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  font: inherit;
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid rgba(15, 118, 110, 0.22);
  border-color: var(--accent);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.check input {
  width: 18px;
  height: 18px;
}

button,
.button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
}

button.secondary,
.button.secondary {
  background: #fff;
  color: var(--accent-dark);
}

button.danger {
  border-color: var(--danger);
  background: #fff;
  color: var(--danger);
}

.smallButton {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.formActions {
  margin-top: 18px;
}

.listHeader {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.listHeader input {
  max-width: 280px;
}

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

.channel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfe;
}

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

.channelInfo {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.channelLogo {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.channelLogo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

.channelLogo span {
  display: none;
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 800;
}

.channelLogo.logoMissing {
  background: #e6fffb;
}

.channelLogo.logoMissing img {
  display: none;
}

.channelLogo.logoMissing span {
  display: block;
}

.channelText {
  min-width: 0;
}

.channelActions {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 420px;
}

.channelName {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.url {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.meta {
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.player {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.playerVideo {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 480px;
  border: 1px solid #111827;
  border-radius: 6px;
  background: #0f172a;
}

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

.playerError {
  color: var(--danger);
  font-weight: 700;
}

.badge {
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.online {
  background: #dcfce7;
  color: var(--ok);
}

.offline {
  background: #fee2e2;
  color: var(--danger);
}

.unknown {
  background: #fef3c7;
  color: var(--warning);
}

.message {
  margin-bottom: 12px;
  border-radius: 6px;
  padding: 10px;
  background: #e0f2fe;
  color: #075985;
}

.hidden {
  display: none;
}

@media (max-width: 820px) {
  .topbar,
  .layout,
  .channelTop,
  .playerFooter {
    flex-direction: column;
  }

  form.panel,
  .listPanel,
  .actions,
  .formActions,
  .channelActions {
    width: 100%;
  }

  .channelActions {
    justify-content: flex-start;
    max-width: none;
  }

  .channelInfo {
    width: 100%;
  }

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

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

  .listHeader input {
    max-width: none;
  }
}
