:root {
  --bg: #1e1e1e;
  --bg-soft: #252526;
  --bg-panel: #181818;
  --bg-panel-alt: #202020;
  --bg-hover: #2a2d2e;
  --line: #313131;
  --line-soft: #2a2a2a;
  --text: #d4d4d4;
  --muted: #9da2a6;
  --accent: #3794ff;
  --accent-soft: rgba(55, 148, 255, 0.16);
  --warn: #d7ba7d;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.bootstrap-shell {
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--bg-panel-alt);
  --bs-primary: var(--accent);
  --bs-primary-rgb: 55, 148, 255;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.app-shell.is-booting {
  background: var(--bg);
}

.app-shell.is-booting .activity-rail,
.app-shell.is-booting .workspace,
.app-shell.is-booting .mobile-bottom-nav {
  visibility: hidden;
}

.activity-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
}

.rail-brand {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0 2px;
}

.rail-brand img {
  width: 30px;
  height: 30px;
  display: block;
  object-fit: contain;
}

.rail-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  align-items: center;
}

.rail-spacer {
  flex: 1;
}

.rail-divider {
  width: 22px;
  height: 2px;
  margin: 8px 0 6px;
  background: #4a4a4a;
}

.rail-button {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.rail-button:hover,
.rail-button:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  outline: none;
}

.rail-button.is-active {
  color: var(--text);
}

.rail-button.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--warn);
}

.rail-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-icon-image {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  flex: 1;
  min-width: 0;
  align-content: start;
}

.workspace-view[hidden] {
  display: none !important;
}

#tv-view.workspace-view {
  display: grid;
  gap: 10px;
  align-content: start;
}

.welcome-view {
  display: grid;
  place-items: center;
  min-height: min(78vh, 760px);
}

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

.welcome-hero {
  width: min(520px, 100%);
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 12px;
}

.welcome-logo {
  width: min(360px, 72vw);
  height: auto;
  object-fit: contain;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.welcome-sign-in-button {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0;
  height: auto;
  min-height: 0;
}

.welcome-sign-in-button:hover,
.welcome-sign-in-button:focus-visible {
  background: transparent !important;
  color: var(--warn);
  filter: none;
}

.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 0;
}

.mode-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mode-heading-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: var(--text);
}

.mode-heading-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-heading-icon img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

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

.auth-profile-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
}

.auth-profile-kicker {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-strip-button {
  min-width: 88px;
  width: auto;
  flex: 0 0 auto;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 7, 7, 0.62);
  backdrop-filter: blur(4px);
}

.auth-dialog {
  width: min(440px, calc(100vw - 32px));
  border: 1px solid var(--line);
  background: var(--bg-panel);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

.auth-dialog-body {
  display: grid;
  gap: 16px;
  padding: 22px 18px 20px;
}

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

.auth-status {
  margin: 0;
  min-height: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-status.is-error {
  color: #e57373;
}

.auth-status.is-success {
  color: #8bcf7a;
}

.auth-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.auth-secondary-button {
  justify-self: auto;
}

.auth-actions > button {
  min-width: 148px;
}

.auth-link-row {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.auth-text-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-text-link:hover,
.auth-text-link:focus-visible {
  color: var(--text);
  text-decoration: underline;
}

.header-logo {
  display: block;
  width: min(320px, 32vw);
  height: auto;
  object-fit: contain;
}

.app-shell.is-auth-shell .activity-rail,
.app-shell.is-auth-shell .mobile-bottom-nav,
.app-shell.is-auth-shell .log-panel {
  display: none !important;
}

.app-shell.is-auth-shell .rail-brand,
.app-shell.is-auth-shell .mode-heading,
.app-shell.is-auth-shell .auth-strip,
.app-shell.is-auth-shell .header-logo {
  display: none !important;
}

.app-shell.is-auth-shell .workspace {
  grid-template-rows: auto minmax(0, 1fr);
}

.app-shell.is-auth-shell .workspace-header {
  justify-content: center;
  min-height: 0;
  padding-top: 0;
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 1.4rem;
}

.mode-title {
  color: var(--text);
  font-size: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

h2 {
  font-size: 1rem;
}

.list-header h2 {
  color: var(--text);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.log-panel:not(.is-collapsed) .list-header {
  padding-top: 10px;
  padding-bottom: 10px;
}

.body-copy {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 74ch;
}

.panel {
  border: 1px solid var(--line);
  background: var(--bg-panel);
}

.settings-shell {
  align-items: start;
}

.settings-stack {
  display: grid;
  gap: 12px;
}

.settings-panel {
  display: block;
}

.settings-panel-body {
  padding: 14px;
  display: grid;
  gap: 16px;
}

.settings-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.settings-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  background: var(--bg-panel-alt);
}

.settings-group-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.settings-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-group-header > div {
  min-width: 0;
}

.settings-group-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.settings-inline-action {
  flex: 0 0 auto;
}

.list-inline-action {
  flex: 0 0 auto;
}

.table-head-action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.table-head-action > span {
  min-width: 0;
}

.table-head-action .icon-button {
  width: 28px;
  min-width: 28px;
  height: 28px;
}

.table-head-action .icon-button svg {
  width: 15px;
  height: 15px;
}

.icon-button.is-busy svg {
  animation: icon-spin 0.9s linear infinite;
}

.icon-button.is-success {
  color: #9cdc8c;
  border-color: rgba(156, 220, 140, 0.45);
  background: rgba(156, 220, 140, 0.08);
}

.icon-button.is-error {
  color: #f48771;
  border-color: rgba(244, 135, 113, 0.45);
  background: rgba(244, 135, 113, 0.08);
}

@keyframes icon-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.settings-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.settings-field span {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.settings-textarea {
  min-height: 96px;
  resize: vertical;
  padding: 10px;
}

#settings-tv-country-rule,
#settings-movies-country-rule,
#settings-shows-country-rule,
#settings-tv-country-allowlist,
#settings-movies-country-allowlist,
#settings-shows-country-allowlist {
  min-height: 34px;
  height: 34px;
  resize: none;
  overflow: hidden;
  padding-top: 6px;
  padding-bottom: 6px;
}

.settings-code {
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 0.82rem;
}

.settings-actions-panel {
  padding: 14px;
}

.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-danger-panel .settings-actions > button {
  min-width: 148px;
}

.settings-save-row {
  display: flex;
  justify-content: center;
  padding: 18px 0;
  margin: 12px 0 18px;
}

.settings-save-button {
  min-width: 180px;
}

.settings-danger-panel .settings-panel-body {
  gap: 12px;
}

.settings-danger-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.settings-danger-button {
  border-color: rgba(213, 94, 94, 0.45);
  color: #ef9a9a;
}

.settings-danger-button:hover,
.settings-danger-button:focus-visible {
  border-color: rgba(239, 154, 154, 0.75);
  color: #ffc0c0;
  background: rgba(120, 22, 22, 0.22);
}

.filter-bar {
  padding: 0 0 12px;
  min-height: 0;
  align-self: start;
}

.filter-bar-header {
  padding: 0 14px 10px;
}

.filter-bar .row {
  --bs-gutter-y: 0.5rem;
  align-content: start;
  align-items: flex-start;
  padding: 10px 10px 0;
}

.filter-bar.is-collapsed {
  padding: 0;
  overflow: hidden;
}

.filter-bar.is-collapsed .filter-bar-header {
  height: 48px;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  overflow: hidden;
}

.filter-bar.is-collapsed .filter-bar-header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.filter-bar.is-collapsed .row {
  display: none;
}

.filter-bar .row > [class*="col-"] {
  align-self: start;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.7fr) repeat(4, minmax(120px, 0.8fr)) auto;
  gap: 10px;
  align-items: end;
}

.filter-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filter-field span {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.time-scope-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-scope-row .form-select {
  flex: 1;
}

.filter-field input,
.filter-field select,
.settings-field input,
.settings-field select,
.settings-field textarea {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--bg-panel-alt);
}

.settings-field textarea {
  height: auto;
}

.form-control,
.form-select {
  color: var(--text);
  border-color: var(--line);
  background-color: var(--bg-panel-alt);
}

.form-control[readonly],
.settings-field textarea[readonly] {
  color: var(--muted);
  background-color: #161616;
  cursor: default;
}

.form-control:focus,
.form-select:focus {
  color: var(--text);
  border-color: var(--accent);
  background-color: var(--bg-panel-alt);
  box-shadow: 0 0 0 0.2rem rgba(55, 148, 255, 0.15);
}

.filter-field input:focus,
.filter-field select:focus,
.action-button:focus,
.ghost-button:focus {
  outline: 1px solid var(--accent);
  outline-offset: 0;
}

.action-button,
.ghost-button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
}

.action-button {
  background: var(--warn);
  border-color: var(--warn);
  color: #171717;
}

.ghost-button {
  background: var(--bg-panel-alt);
}

.icon-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-outline-light {
  --bs-btn-color: var(--text);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: var(--bg-hover);
  --bs-btn-hover-border-color: var(--line);
  --bs-btn-hover-color: var(--text);
  --bs-btn-active-bg: var(--bg-hover);
  --bs-btn-active-border-color: var(--line);
}

.btn-primary {
  --bs-btn-bg: var(--warn);
  --bs-btn-border-color: var(--warn);
  --bs-btn-color: #171717;
  --bs-btn-hover-bg: #e1c68d;
  --bs-btn-hover-border-color: #e1c68d;
  --bs-btn-hover-color: #171717;
  --bs-btn-active-bg: #caa96a;
  --bs-btn-active-border-color: #caa96a;
  --bs-btn-active-color: #171717;
}

.ghost-button:hover,
.action-button:hover {
  filter: brightness(1.06);
}

.lists-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.list-panel,
.log-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.embedded-player-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.embedded-player-panel.is-collapsed {
  grid-template-rows: auto;
  min-height: 48px;
  height: 48px;
  max-height: 48px;
  overflow: hidden;
}

.embedded-player-panel.is-collapsed .embedded-player-stage,
.embedded-player-panel.is-collapsed .embedded-player-status,
.embedded-player-panel.is-collapsed #stop-embedded-player,
.embedded-player-panel.is-collapsed .embedded-player-mode {
  display: none;
}

.embedded-player-panel.is-collapsed .list-header {
  height: 48px;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  overflow: hidden;
}

.embedded-player-panel.is-collapsed .list-header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.embedded-player-panel.is-collapsed h2 {
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lists-layout > [class*="col-"] {
  display: flex;
  min-width: 0;
  padding: 0;
  margin-top: 0;
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
}

.lists-layout .list-panel {
  flex: 1;
  width: 100%;
}

.list-panel.is-drop-target {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.list-panel.is-collapsed {
  grid-template-rows: auto;
  min-height: 48px;
  height: 48px;
  max-height: 48px;
  overflow: hidden;
}

.list-panel.is-collapsed .table-head,
.list-panel.is-collapsed .list-body {
  display: none;
}

.list-panel.is-collapsed .list-header {
  height: 48px;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  overflow: hidden;
}

.list-panel.is-collapsed .list-header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.list-panel.is-collapsed h2 {
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.table-head,
.list-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.table-head {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-head > span:last-child {
  min-width: 0;
}

.list-body {
  min-height: 0;
  overflow: auto;
  max-height: calc(10 * 39px);
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: calc(10 * 39px);
  position: relative;
}

.list-virtual-spacer {
  width: 1px;
  opacity: 0;
  pointer-events: none;
}

.list-virtual-viewport {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
}

.list-row {
  width: 100%;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.list-row.is-dragging {
  opacity: 0.45;
}

.list-row:hover,
.list-row:focus-visible {
  background: var(--bg-hover);
  outline: none;
}

.list-row.is-selected {
  background: rgba(55, 148, 255, 0.18);
  box-shadow: inset 2px 0 0 var(--accent);
}

.country-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 22px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  background: var(--bg-panel-alt);
  color: var(--warn);
}

.channel-stack {
  min-width: 0;
}

.channel-name,
.programme-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.channel-name {
  font-size: 0.92rem;
}

.programme-name {
  color: var(--muted);
  font-size: 0.84rem;
}

.empty-state {
  padding: 18px 14px;
  color: var(--muted);
}

.log-panel {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  align-self: start;
}

.embedded-player-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.embedded-player-mode {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.embedded-player-stage {
  position: relative;
  background: #000;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: clamp(220px, 32vh, 520px);
  max-height: calc(100vh - 320px);
}

.embedded-player-stage video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.embedded-player-empty {
  display: none;
}

.embedded-player-empty[hidden] {
  display: none;
}

.embedded-player-status {
  padding: 8px 12px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-panel);
  color: #bbb;
  font-size: 12px;
}

.embedded-player-status[hidden] {
  display: none;
}

.log-list {
  min-height: 0;
  overflow: auto;
  max-height: calc(5 * 30px);
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.2;
}

.log-panel.is-collapsed .log-list {
  display: none;
}

.log-panel.is-collapsed {
  grid-template-rows: auto;
  min-height: 48px;
  height: 48px;
  max-height: 48px;
  overflow: hidden;
}

.log-panel.is-collapsed .list-header {
  height: 48px;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  overflow: hidden;
}

.log-panel.is-collapsed .list-header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.log-panel.is-collapsed .section-kicker {
  display: none;
}

.log-panel.is-collapsed h2 {
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-panel.is-collapsed .log-toggle-button {
  height: 34px;
  min-width: 34px;
  width: 34px;
  flex: 0 0 34px;
}

.log-panel.is-collapsed .log-toggle-button svg {
  width: 16px;
  height: 16px;
}

.log-toggle-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 160ms ease;
}

.log-toggle-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
}

.panel-toggle-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
}

.log-toggle-button svg {
  width: 15px;
  height: 15px;
}

.panel-toggle-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 160ms ease;
}

.log-panel.is-collapsed .log-toggle-button svg {
  transform: rotate(180deg);
}

.list-panel.is-collapsed .panel-toggle-button svg {
  transform: rotate(180deg);
}

.filter-bar.is-collapsed .panel-toggle-button svg {
  transform: rotate(180deg);
}

.embedded-player-panel.is-collapsed .panel-toggle-button svg {
  transform: rotate(180deg);
}

.log-entry {
  padding: 5px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}

.log-panel:not(.is-collapsed) {
  grid-template-rows: auto auto;
}

.context-menu {
  position: fixed;
  z-index: 1600;
  width: max-content;
  min-width: 0;
  max-width: min(240px, calc(100vw - 16px));
  padding: 6px 0;
  border: 1px solid var(--line);
  background: #252526;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.context-menu[hidden] {
  display: none;
}

.context-menu-item {
  width: auto;
  min-width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.context-menu-item:hover,
.context-menu-item:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1400;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: rgba(24, 24, 24, 0.94);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.mobile-bottom-button {
  position: relative;
  width: 44px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.mobile-bottom-button:hover,
.mobile-bottom-button:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  outline: none;
}

.mobile-bottom-button.is-active {
  color: var(--text);
}

.mobile-bottom-button.is-active::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  background: var(--warn);
}

.mobile-bottom-divider {
  width: 2px;
  height: 24px;
  margin: 0 4px;
  background: #4a4a4a;
}

@media (max-width: 1200px) {
  .workspace {
    grid-template-rows: auto auto auto auto;
  }

  .header-logo {
    display: none;
  }

  .lists-layout {
    grid-template-columns: 1fr;
  }

  .lists-layout > :first-child {
    order: 2;
  }

  .lists-layout > :last-child {
    order: 1;
  }

  .embedded-player-stage {
    min-height: clamp(220px, 28vh, 420px);
    max-height: calc(100vh - 280px);
  }
}

@media (max-width: 720px) {
  .activity-rail {
    display: none;
  }

  .workspace {
    padding-left: 12px !important;
    padding-bottom: 88px !important;
  }

  .mobile-bottom-nav {
    display: grid;
  }

  .workspace-header {
    flex-direction: row !important;
    align-items: flex-start !important;
    justify-content: space-between;
  }

  .header-right {
    width: auto;
    align-items: flex-end;
    gap: 4px;
  }

  .auth-strip {
    width: auto;
    justify-content: flex-end;
  }

  .auth-profile-summary {
    align-items: flex-end;
    margin-right: 0;
  }

  .header-logo {
    width: min(280px, 70vw);
  }

  .welcome-hero {
    padding: 8px;
    gap: 14px;
  }

  .welcome-actions {
    width: 100%;
  }

  .welcome-actions > * {
    flex: 1 1 150px;
  }

  .embedded-player-stage {
    aspect-ratio: 16 / 10;
    min-height: clamp(200px, 26vh, 320px);
    max-height: calc(100vh - 240px);
  }

  #tv-view.has-mobile-playback-priority .embedded-player-panel {
    order: -3;
  }

  #tv-view.has-mobile-playback-priority .filter-bar {
    order: -2;
  }

  #tv-view.has-mobile-playback-priority .lists-layout {
    order: -1;
  }

  .filter-actions {
    flex-direction: column;
  }

  .action-button,
  .ghost-button:not(.icon-button) {
    width: 100%;
  }

  .settings-actions {
    display: grid;
  }

  .settings-actions .ghost-button,
  .settings-actions .action-button,
  .settings-save-row .ghost-button,
  .settings-save-row .action-button,
  .settings-save-button {
    width: auto;
  }

  .settings-actions {
    justify-content: start;
  }
}

@media (max-width: 430px) {
  .mobile-bottom-nav {
    padding: 6px 8px;
    gap: 2px;
  }

  .mobile-bottom-button {
    width: 38px;
    height: 42px;
  }

  .mobile-bottom-button.is-active::before {
    left: 8px;
    right: 8px;
  }

  .mobile-bottom-divider {
    height: 20px;
    margin: 0 1px;
  }
}


@media (min-width: 721px) {
  .mobile-bottom-nav {
    display: none !important;
  }
}
