:root {
  --bg: #05080c;
  --bg-soft: rgba(12, 16, 23, 0.92);
  --panel: rgba(9, 14, 20, 0.86);
  --panel-2: rgba(15, 21, 30, 0.82);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #f3f6fa;
  --muted: #9aa6b2;
  --green: #1fa35b;
  --white: #f6f7f8;
  --red: #d62828;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: minmax(276px, 318px);
  --gap: 10px;
  --page-pad: 10px;
  --topbar-h: 54px;
  --statusbar-h: 26px;
  --transition: 180ms ease;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

html {
  background:
    radial-gradient(62vw 62vw at 14% 12%, rgba(31, 163, 91, 0.14), transparent 55%),
    radial-gradient(50vw 50vw at 82% 8%, rgba(214, 40, 40, 0.14), transparent 52%),
    linear-gradient(180deg, #06090e 0%, #05080c 100%);
  overflow: hidden;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(31, 163, 91, 0.05), transparent 16%, transparent 84%, rgba(214, 40, 40, 0.05)),
    transparent;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.46);
  border: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 20;
}

body[data-drawer="open"] .mobile-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.app-shell {
  position: relative;
  height: 100svh;
  width: 100%;
  padding: var(--page-pad);
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--gap);
  overflow: hidden;
}

.sidebar,
.stage,
.dialog-shell .modal-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.sidebar {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(8, 12, 18, 0.92), rgba(10, 14, 21, 0.82));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar__top {
  padding: 10px 10px 9px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

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

.brand__main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand__logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line-2);
  padding: 6px;
  flex: 0 0 auto;
}

.brand__copy {
  min-width: 0;
}

.brand__copy h1 {
  margin: 0 0 3px;
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.brand__copy p {
  margin: 0;
  font-size: 0.77rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flag-strip {
  height: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
}

.flag-strip span {
  border-radius: 999px;
}

.flag-strip .green {
  background: linear-gradient(90deg, rgba(31, 163, 91, 0.95), rgba(31, 163, 91, 0.5));
}

.flag-strip .white {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(233, 238, 242, 0.5));
}

.flag-strip .red {
  background: linear-gradient(90deg, rgba(214, 40, 40, 0.95), rgba(214, 40, 40, 0.45));
}

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

.action-button,
.icon-button,
.layout-button,
.focus-chip,
.tile-mini-button,
.primary-button,
.secondary-button,
.filter-chip {
  transition: background var(--transition), border-color var(--transition), transform var(--transition), color var(--transition), opacity var(--transition);
}

.action-button {
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  padding: 0 10px;
  font-size: 0.82rem;
}

.action-button:hover,
.icon-button:hover,
.layout-button:hover,
.primary-button:hover,
.secondary-button:hover,
.filter-chip:hover,
.tile-mini-button:hover,
.focus-chip:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.18);
}

.search-box {
  display: block;
}

.search-box input {
  width: 100%;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.filter-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.filter-chip {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
}

.filter-chip.is-active,
.layout-button.is-active,
.primary-button {
  background: linear-gradient(90deg, rgba(31, 163, 91, 0.18), rgba(214, 40, 40, 0.18));
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
}

.channel-list {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  padding: 10px 8px 10px 10px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.sidebar__bottom {
  height: 42px;
  border-top: 1px solid var(--line);
  padding: 0 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.025);
}

.sidebar__bottom div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.sidebar__bottom strong {
  color: var(--text);
  font-size: 0.94rem;
}

.sidebar-item {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 9px;
  text-align: left;
}

.sidebar-item:hover,
.sidebar-item.is-active {
  background: rgba(255, 255, 255, 0.085);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-item__logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
}

.sidebar-item__body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sidebar-item__body strong {
  font-size: 0.84rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item__body small {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item__aside {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sidebar-slot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.73rem;
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.07);
}

.sidebar-remove {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  cursor: pointer;
}

.logo-badge,
.active-chip__logo,
.tile-logo,
.sidebar-item__logo img,
.tile-logo img {
  border-radius: 12px;
}

.logo-badge {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--badge-accent) 34%, rgba(255,255,255,0.12)), rgba(255,255,255,0.05));
  color: #fff;
}

.sidebar-item__logo img,
.tile-logo img,
.active-chip__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.stage {
  min-width: 0;
  min-height: 0;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(9, 13, 18, 0.82), rgba(11, 16, 23, 0.8));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

.status-pill[data-syncing="false"]::before {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}

.target-chip {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(90deg, rgba(59,130,246,0.18), rgba(168,85,247,0.16));
  color: var(--text);
  cursor: pointer;
  font-size: 0.74rem;
  white-space: nowrap;
}

.target-chip:hover {
  background: linear-gradient(90deg, rgba(59,130,246,0.24), rgba(168,85,247,0.22));
}

.active-chip {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: min(42vw, 420px);
  max-width: min(52vw, 520px);
  height: 38px;
  padding: 4px 10px 4px 4px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.active-chip__logo {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
}

.active-chip__copy {
  min-width: 0;
  display: grid;
}

.active-chip__copy strong,
.active-chip__copy small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-chip__copy strong {
  font-size: 0.82rem;
  line-height: 1.05;
}

.active-chip__copy small {
  color: var(--muted);
  font-size: 0.69rem;
}

.segmented {
  display: inline-flex;
  gap: 7px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.layout-button,
.icon-button,
.primary-button,
.secondary-button {
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.layout-button {
  height: 34px;
  min-width: 72px;
  padding: 0 12px;
}

.icon-button {
  min-width: 38px;
  height: 36px;
  padding: 0 11px;
}

.icon-button.is-active {
  background: rgba(255, 255, 255, 0.1);
}

.video-stage {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px;
}

.video-grid {
  height: 100%;
  width: 100%;
  display: grid;
  gap: 10px;
}

body[data-layout="quad"] .video-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

body[data-layout="single"] .video-grid {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.video-tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    radial-gradient(circle at 18% 18%, rgba(31, 163, 91, 0.12), transparent 33%),
    radial-gradient(circle at 80% 14%, rgba(214, 40, 40, 0.11), transparent 30%),
    linear-gradient(180deg, rgba(8, 12, 19, 0.96), rgba(8, 12, 18, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.video-tile.is-active {
  border-color: color-mix(in srgb, var(--channel-accent, #60a5fa) 62%, #ffffff 10%);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--channel-accent, #60a5fa) 52%, transparent),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 18px 48px rgba(0, 0, 0, 0.28);
}

.video-tile.is-armed {
  border-color: rgba(96,165,250,0.58);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,0.42), 0 0 0 1px rgba(96,165,250,0.16);
}

.video-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 30%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.18), transparent 24%);
  pointer-events: none;
  z-index: 3;
}

.tile-poster,
.player-host,
.web-fallback-frame,
.fallback-panel,
.tile-hitbox {
  position: absolute;
  inset: 0;
  z-index: 20;
  cursor: pointer;
  pointer-events: auto;
}

.tile-poster {
  z-index: 0;
}

.tile-poster__glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 24%, rgba(31, 163, 91, 0.18), transparent 32%),
    radial-gradient(circle at 82% 18%, rgba(214, 40, 40, 0.18), transparent 34%),
    radial-gradient(circle at 54% 78%, rgba(255, 255, 255, 0.08), transparent 26%);
  opacity: 0.72;
}

.tile-poster__bars {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 4px;
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      rgba(31, 163, 91, 0.96) 0%,
      rgba(31, 163, 91, 0.8) 33%,
      rgba(255, 255, 255, 0.95) 33%,
      rgba(255, 255, 255, 0.9) 66%,
      rgba(214, 40, 40, 0.95) 66%,
      rgba(214, 40, 40, 0.78) 100%);
  opacity: 0.8;
}

.player-host {
  z-index: 1;
  background: rgba(0, 0, 0, 0.16);
}

.player-host iframe {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.web-fallback-frame {
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(7, 10, 15, 0.82);
}

.web-fallback-frame[hidden] {
  display: none;
}

.fallback-panel {
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.05), transparent 40%);
  pointer-events: none;
}

.fallback-panel[hidden] {
  display: none;
}

.fallback-panel__card {
  pointer-events: auto;
  width: min(92%, 360px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(8, 12, 19, 0.78);
  backdrop-filter: blur(12px);
  padding: 14px;
  text-align: center;
  display: grid;
  gap: 10px;
}

.fallback-panel__title {
  font-size: 0.9rem;
  font-weight: 700;
}

.fallback-panel__copy {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

.fallback-panel__actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fallback-button {
  min-width: 108px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  text-decoration: none;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  cursor: pointer;
}

.fallback-button:hover {
  background: rgba(255,255,255,0.11);
}

.tile-hitbox {
  z-index: 2;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.tile-top,
.tile-bottom {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tile-top {
  top: 0;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(7, 10, 15, 0.72), rgba(7, 10, 15, 0));
}

.tile-bottom {
  bottom: 0;
  justify-content: space-between;
  background: linear-gradient(0deg, rgba(7, 10, 15, 0.84), rgba(7, 10, 15, 0));
}

.tile-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.tile-slot-index {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.67rem;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(6, 9, 14, 0.54);
  pointer-events: none;
}

.tile-logo {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.tile-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.tile-copy h3,
.tile-copy p,
.tile-story {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-copy h3 {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.1;
}

.tile-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.72rem;
}

.tile-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tile-mini-button.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.status-chip {
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(6, 9, 14, 0.62);
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  white-space: nowrap;
}

.tile-mini-button,
.focus-chip {
  height: 28px;
  min-width: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(6, 9, 14, 0.58);
  color: var(--text);
  text-decoration: none;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0 10px;
}

.focus-chip {
  min-width: 56px;
  font-size: 0.74rem;
}

.tile-story {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  padding-right: 8px;
}

.status-live,
.status-live.sidebar-dot {
  background: #22c55e;
}

.status-playable,
.status-playable.sidebar-dot {
  background: #38bdf8;
}

.status-blocked,
.status-blocked.sidebar-dot {
  background: #f59e0b;
}

.status-offline,
.status-offline.sidebar-dot,
.status-unavailable,
.status-unavailable.sidebar-dot {
  background: #ef4444;
}

.status-checking,
.status-checking.sidebar-dot {
  background: #60a5fa;
}

.status-live {
  border-color: rgba(34, 197, 94, 0.32);
  color: #dcfce7;
}

.status-playable {
  border-color: rgba(56, 189, 248, 0.3);
  color: #dbeafe;
}

.status-blocked {
  border-color: rgba(245, 158, 11, 0.28);
  color: #fde68a;
}

.status-offline,
.status-unavailable {
  border-color: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}

.status-checking {
  border-color: rgba(96, 165, 250, 0.3);
  color: #dbeafe;
}

.statusbar {
  height: var(--statusbar-h);
  min-height: var(--statusbar-h);
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
}

.statusbar span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-shell {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
}

.dialog-shell::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(4px);
}

.modal-card {
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(10, 15, 22, 0.98), rgba(12, 17, 24, 0.92));
  padding: 18px;
}

.modal-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.modal-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

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

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

.field {
  display: grid;
  gap: 6px;
}

.field label,
.checkbox-row label {
  font-size: 0.8rem;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 0 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 0 2px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button {
  height: 38px;
  padding: 0 14px;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.045);
}

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 60;
}

.toast {
  min-width: 240px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(13, 18, 27, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateY(10px);
  opacity: 0;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-warning {
  border-color: rgba(245, 158, 11, 0.26);
}

.mobile-only {
  display: none;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 284px minmax(0, 1fr);
  }

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

  .active-chip {
    max-width: 42vw;
  }
}

@media (max-width: 900px) {
  :root {
    --page-pad: 10px;
    --topbar-h: auto;
    --statusbar-h: 26px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mobile-only {
    display: inline-grid;
  }

  .sidebar {
    position: fixed;
    top: 10px;
    left: 10px;
    bottom: 10px;
    width: min(86vw, 340px);
    z-index: 30;
    transform: translateX(calc(-100% - 16px));
    transition: transform var(--transition);
  }

  body[data-drawer="open"] .sidebar {
    transform: translateX(0);
  }

  .topbar {
    height: auto;
    min-height: 0;
    padding: 10px;
    flex-wrap: wrap;
  }

  .topbar__left,
  .topbar__right {
    width: 100%;
  }

  .topbar__right {
    justify-content: space-between;
  }

  .active-chip {
    min-width: 0;
    flex: 1 1 auto;
    max-width: none;
  }

  .video-stage {
    padding: 10px;
  }

  body[data-layout="quad"] .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  body[data-layout="single"] .video-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .tile-copy h3 {
    font-size: 0.8rem;
  }

  .tile-copy p,
  .tile-story {
    font-size: 0.68rem;
  }

  .statusbar {
    padding: 0 10px;
  }
}

@media (max-width: 560px) {
  .target-chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

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

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

  .segmented {
    flex: 1 1 auto;
  }

  .layout-button {
    min-width: 0;
    flex: 1 1 0;
  }

  .icon-button {
    min-width: 0;
    flex: 0 0 auto;
    padding: 0 10px;
  }

  .form-grid--two {
    grid-template-columns: 1fr;
  }

  .tile-top,
  .tile-bottom {
    padding: 7px 8px;
  }

  .tile-brand {
    gap: 7px;
  }

  .tile-logo {
    width: 26px;
    height: 26px;
  }

  .tile-mini-button,
  .focus-chip,
  .status-chip {
    height: 26px;
  }

  .status-chip {
    display: none;
  }

  .tile-actions {
    gap: 5px;
  }
}


.video-tile[hidden] {
  display: none !important;
}
