:root {
  color-scheme: dark;
  font-family: "Russo One Local", "Segoe UI", "Trebuchet MS", sans-serif;

  --font-main: "Russo One Local", "Segoe UI", "Trebuchet MS", sans-serif;
  --bg-main: #050307;
  --bg-card: rgba(16, 9, 18, 0.9);
  --bg-card-strong: rgba(28, 12, 29, 0.96);
  --bg-soft: rgba(255, 255, 255, 0.055);
  --text-main: #fff7fb;
  --text-dim: #e1c4d4;
  --pink-main: #ff4fa7;
  --pink-soft: #ff8dc8;
  --pink-deep: #8f1c61;
  --pink-glass: rgba(255, 79, 167, 0.12);
  --violet-main: #9146ff;
  --violet-soft: #cfb1ff;
  --violet-deep: #4c1d95;
  --line-soft: rgba(255, 143, 200, 0.18);
  --shadow-pink: 0 24px 80px rgba(255, 79, 167, 0.24);
  --shadow-green: 0 18px 44px rgba(50, 217, 120, 0.26);
  --green-main: #32d978;
  --green-soft: #baf5cb;
  --red-main: #ff6b6b;
  --red-soft: #ffc9c9;
  --yellow-main: #ffd166;
  --yellow-soft: #ffe8a3;

  --bg-page: var(--bg-main);
  --bg-shell: var(--bg-card);
  --bg-muted: var(--bg-soft);
  --bg-strong: var(--bg-card-strong);
  --line: var(--line-soft);
  --line-strong: rgba(255, 143, 200, 0.34);
  --text: var(--text-main);
  --text-muted: var(--text-dim);
  --accent: var(--pink-main);
  --accent-soft: var(--pink-soft);
  --accent-glass: var(--pink-glass);
  --secondary-accent: var(--violet-main);
  --shadow: var(--shadow-pink);
  --radius: 12px;
  --surface-radius: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  background: #070409;
  color: var(--text);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-template-rows: 64px minmax(0, 1fr);
  grid-template-areas:
    "topbar topbar"
    "sidebar workspace";
  background: #070409;
}

.shell.is-sidebar-collapsed {
  grid-template-columns: 68px minmax(0, 1fr);
}

.topbar {
  grid-area: topbar;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 10px 18px;
  background: #120a14;
  border-bottom: 1px solid var(--line);
}

.brand,
.topbar__actions,
.topbar__status {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--pink-main), var(--violet-main));
  color: #ffffff;
  font-size: 13px;
  letter-spacing: 0;
  box-shadow: 0 12px 28px rgba(255, 79, 167, 0.24);
}

.brand__text {
  white-space: nowrap;
}

.topbar__status {
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--pink-soft);
  box-shadow: 0 0 0 4px rgba(255, 79, 167, 0.14);
}

.status-dot.is-ready {
  background: var(--green-main);
  box-shadow: 0 0 0 4px rgba(50, 217, 120, 0.14);
}

.status-dot.is-realtime-online {
  background: var(--green-main);
  box-shadow: 0 0 0 4px rgba(50, 217, 120, 0.14);
}

.status-dot.is-realtime-reconnecting {
  background: var(--yellow-main);
  box-shadow: 0 0 0 4px rgba(255, 191, 87, 0.16);
}

.status-dot.is-realtime-offline {
  background: var(--red-main);
  box-shadow: 0 0 0 4px rgba(255, 89, 112, 0.16);
}

.status-dot.is-realtime-fallback {
  background: var(--violet-main);
  box-shadow: 0 0 0 4px rgba(169, 112, 255, 0.16);
}

.topbar__actions {
  justify-content: flex-end;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.button:hover {
  border-color: rgba(255, 143, 200, 0.56);
  background: rgba(255, 79, 167, 0.12);
  box-shadow: 0 14px 32px rgba(255, 79, 167, 0.14);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.button:focus-visible,
.nav__item:focus-visible,
.nav__drag-handle:focus-visible,
.sidebar__toggle:focus-visible,
.field__control:focus-visible {
  outline: 3px solid rgba(255, 79, 167, 0.34);
  outline-offset: 2px;
}

.button--primary {
  border-color: rgba(255, 143, 200, 0.7);
  background: linear-gradient(135deg, var(--pink-main), var(--violet-main));
  color: #ffffff;
}

.button--primary:hover {
  border-color: rgba(255, 255, 255, 0.46);
  background: linear-gradient(135deg, var(--pink-soft), var(--violet-main));
}

.button--ghost {
  border-color: transparent;
  background: var(--pink-glass);
}

.button--danger {
  border-color: rgba(255, 107, 107, 0.62);
  background: rgba(255, 107, 107, 0.14);
  color: var(--red-soft);
}

.viewer-greeting-panel {
  display: grid;
  gap: 16px;
}

.greeting-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(360px, 1.35fr);
  gap: 16px;
  align-items: start;
}

.greeting-layout__preview,
.greeting-layout__settings,
.greeting-card,
.greeting-intro {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.greeting-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.greeting-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.greeting-card__header h3,
.greeting-intro h2 {
  margin: 0;
  letter-spacing: 0;
}

.greeting-card__status {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.greeting-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
}

.greeting-preview__media {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.greeting-preview__empty {
  padding: 18px;
  color: var(--text-muted);
  text-align: center;
}

.greeting-card__actions,
.greeting-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.greeting-controls .field {
  flex: 1 1 140px;
  min-width: 140px;
}

.greeting-upload {
  position: relative;
  overflow: hidden;
}

.greeting-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.problem--inline {
  margin: 0;
}

.viewer-music-panel {
  display: grid;
  gap: 16px;
}

.music-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(380px, 1.4fr);
  gap: 16px;
  align-items: start;
}

.music-controls,
.music-layout__queue,
.music-intro,
.music-queue,
.music-queue__list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.music-order-form {
  display: grid;
  grid-template-columns: minmax(120px, 0.42fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

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

.youtube-proxy-health {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.youtube-proxy-health--ok {
  border-color: rgba(50, 217, 120, 0.44);
}

.youtube-proxy-health--warning {
  border-color: rgba(255, 209, 102, 0.48);
}

.youtube-proxy-health--error {
  border-color: rgba(255, 107, 107, 0.54);
}

.youtube-proxy-health__summary {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.youtube-proxy-health__summary strong {
  font-size: 14px;
}

.youtube-proxy-health__summary span,
.youtube-proxy-health__details {
  color: var(--text-muted);
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.youtube-proxy-health__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.youtube-proxy-health__badge--ok {
  border-color: rgba(50, 217, 120, 0.48);
  background: rgba(50, 217, 120, 0.1);
  color: var(--green-soft);
}

.youtube-proxy-health__badge--warning {
  border-color: rgba(255, 209, 102, 0.52);
  background: rgba(255, 209, 102, 0.1);
  color: var(--yellow-soft);
}

.youtube-proxy-health__badge--error {
  border-color: rgba(255, 107, 107, 0.54);
  background: rgba(255, 107, 107, 0.1);
  color: var(--red-soft);
}

.youtube-proxy-health__details {
  margin: 0;
  white-space: pre-line;
  font-size: 12px;
}

.music-queue {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.music-queue__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.music-queue__header h3,
.music-intro h2 {
  margin: 0;
  letter-spacing: 0;
}

.music-queue-item {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.16);
}

.music-queue-item__thumb {
  width: 74px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.26);
}

.music-queue-item__body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.music-queue-item__title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.music-queue-item__meta,
.music-queue-item__state {
  color: var(--text-muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.viewer-notifications-panel {
  display: grid;
  gap: 16px;
}

.admin-overview-panel,
.channel-dashboard-panel {
  display: grid;
  gap: 16px;
}

.admin-overview-layout,
.admin-overview-intro,
.admin-channel-group,
.admin-channel-list,
.dashboard-summary-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.admin-overview-intro h2,
.admin-channel-group__header h3,
.admin-channel-card h4,
.dashboard-summary-header h2,
.dashboard-summary-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.admin-overview-intro p,
.admin-channel-group p,
.admin-channel-card p,
.dashboard-summary-header p,
.dashboard-summary-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

.admin-channel-group {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.admin-channel-group__header,
.admin-channel-card,
.dashboard-summary-header,
.dashboard-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.admin-channel-card,
.dashboard-summary-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.16);
}

.admin-channel-card--selected {
  border-color: rgba(50, 217, 120, 0.48);
  background: rgba(50, 217, 120, 0.07);
}

.admin-channel-card__body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.admin-channel-card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-summary-header {
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

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

.dashboard-summary-card {
  align-items: flex-start;
  min-height: 132px;
}

.dashboard-summary-card--youtube-proxy {
  display: block;
  padding: 0;
  background: transparent;
}

.dashboard-summary-card--youtube-proxy .youtube-proxy-health {
  height: 100%;
}

.channel-greeting-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  min-width: 0;
}

.channel-greeting-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  min-width: 0;
}

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

.channel-greeting-card__header h3,
.channel-greeting-asset-card h4 {
  margin: 0;
  letter-spacing: 0;
}

.channel-greeting-card__header p,
.channel-greeting-asset-card p {
  margin: 4px 0 0;
  color: var(--text-muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.channel-greeting-form-grid,
.channel-greeting-assets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.channel-greeting-test-fields,
.channel-greeting-template-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.toggle-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.channel-greeting-asset-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.greeting-template-list__items {
  display: grid;
  gap: 8px;
}

.greeting-template-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.greeting-preview--audio {
  min-height: 96px;
}

.notifications-layout,
.notifications-intro {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.notifications-intro h2,
.notifications-policy h3 {
  margin: 0;
  letter-spacing: 0;
}

.notifications-intro p,
.notifications-policy p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.notifications-policy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.notifications-policy--ready {
  border-color: rgba(50, 217, 120, 0.44);
}

.notifications-policy--blocked {
  border-color: rgba(255, 209, 102, 0.5);
}

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

.notifications-wide-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.notifications-wide-table--subscriptions {
  min-width: 0;
}

.notifications-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.notifications-table--wide {
  min-width: 940px;
}

.notifications-table th,
.notifications-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.notifications-table th {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.notifications-table td:first-child {
  text-align: center;
}

.notifications-subtext {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sidebar {
  grid-area: sidebar;
  min-width: 0;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: #100912;
  transition: padding 160ms ease;
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-bottom: 12px;
}

.sidebar__title {
  min-width: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  min-height: 34px;
  border: 1px solid rgba(255, 143, 200, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--pink-soft);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.sidebar__toggle:hover {
  border-color: rgba(255, 143, 200, 0.48);
  background: rgba(255, 79, 167, 0.12);
}

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

.nav__group {
  margin: 16px 8px 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav__group:first-child {
  margin-top: 0;
}

.nav__row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
  border-radius: var(--radius);
  touch-action: manipulation;
  position: relative;
}

.nav__row.is-dragging {
  opacity: 0.62;
}

.nav__row.is-drop-target {
  background: rgba(255, 79, 167, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 143, 200, 0.34);
}

.nav__drag-handle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 38px;
  border: 1px solid rgba(255, 143, 200, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--pink-soft);
  cursor: grab;
  font-size: 17px;
  line-height: 1;
  opacity: 0.78;
  user-select: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

.nav__drag-handle:hover {
  border-color: rgba(255, 143, 200, 0.42);
  background: rgba(255, 79, 167, 0.1);
  color: var(--text-main);
  opacity: 1;
}

.nav__drag-handle:active {
  cursor: grabbing;
}

.nav__item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.nav__icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: rgba(255, 79, 167, 0.12);
  color: var(--pink-soft);
  font-size: 11px;
  font-weight: 900;
}

.nav__row:hover .nav__drag-handle,
.nav__row:focus-within .nav__drag-handle {
  opacity: 1;
}

.nav__item:hover {
  border-color: rgba(255, 143, 200, 0.28);
  background: rgba(255, 79, 167, 0.1);
  color: var(--pink-soft);
}

.nav__item.is-active {
  border-color: rgba(255, 143, 200, 0.48);
  background:
    linear-gradient(135deg, rgba(255, 79, 167, 0.18), rgba(145, 70, 255, 0.14));
  color: var(--text-main);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--pink-main);
}

.nav__item--locked {
  color: var(--text-muted);
}

.nav__label {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.25;
}

.nav__badge {
  min-width: 0;
  padding: 3px 7px;
  border: 1px solid rgba(255, 143, 200, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--pink-soft);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.shell.is-sidebar-collapsed .sidebar {
  padding: 14px 8px;
}

.shell.is-sidebar-collapsed .sidebar__header {
  justify-content: center;
}

.shell.is-sidebar-collapsed .sidebar__title,
.shell.is-sidebar-collapsed .nav__group,
.shell.is-sidebar-collapsed .nav__label,
.shell.is-sidebar-collapsed .nav__badge {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.shell.is-sidebar-collapsed .nav {
  gap: 8px;
}

.shell.is-sidebar-collapsed .nav__drag-handle {
  display: none;
}

.shell.is-sidebar-collapsed .nav__row {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 4px;
}

.shell.is-sidebar-collapsed .nav__item {
  position: relative;
  justify-items: center;
  grid-template-columns: 1fr;
  width: 44px;
  min-height: 42px;
  padding: 8px;
}

.shell.is-sidebar-collapsed .nav__item.is-active {
  box-shadow: inset 0 -3px 0 var(--pink-main);
}

.shell.is-sidebar-collapsed .nav__icon {
  width: 26px;
  height: 26px;
}

.shell.is-sidebar-collapsed .nav__item:hover::after,
.shell.is-sidebar-collapsed .nav__item:focus-visible::after {
  content: attr(data-nav-label);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  z-index: 30;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #160c19;
  color: var(--text);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  pointer-events: none;
  transform: translateY(-50%);
}

.workspace {
  grid-area: workspace;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 22px;
}

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

.workspace-panel {
  min-width: 0;
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 720px;
}

.workspace-panel.is-active {
  outline: 1px solid rgba(255, 143, 200, 0.22);
  outline-offset: 0;
}

.workspace__header,
.surface,
.problem {
  border: 1px solid var(--line);
  border-radius: var(--surface-radius);
  background: #120a14;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}

.workspace__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
}

.workspace__header h1,
.surface h2,
.problem h2,
.modal h2 {
  margin: 0;
  letter-spacing: 0;
}

.workspace__header h1 {
  font-size: 28px;
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--pink-soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.workspace__meta,
.badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 143, 200, 0.28);
  background: var(--pink-glass);
  color: var(--pink-soft);
  font-size: 12px;
  font-weight: 700;
}

.surface {
  padding: 18px;
}

.section-summary,
.section-body {
  margin: 0 0 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.section-body {
  margin: 14px 0 0;
}

.surface--accent {
  border-left: 5px solid var(--pink-main);
}

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

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

.primitive-grid {
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px);
}

.state-tile {
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.state-tile__label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.state-tile strong {
  font-size: 18px;
}

.state-tile span:last-child {
  color: var(--text-muted);
  line-height: 1.45;
}

.field-demo,
.actions-panel,
.problem-demo {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.field__label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.field__control {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.052);
  color: var(--text);
}

.field__control--native-select {
  display: none;
}

.styled-select {
  position: relative;
  display: grid;
  min-width: 0;
}

.styled-select::after {
  content: "⌄";
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 2;
  color: var(--pink-soft);
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
  transition: transform 140ms ease, color 140ms ease;
}

.styled-select.is-open::after {
  color: var(--pink-main);
  transform: rotate(180deg);
}

.styled-select__input.field__control[readonly] {
  min-height: 42px;
  padding-right: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  cursor: pointer;
  opacity: 1;
}

.styled-select__input:hover,
.styled-select__input:focus {
  border-color: rgba(255, 143, 200, 0.42);
  background: rgba(255, 79, 167, 0.08);
}

.styled-select__results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 24;
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(255, 143, 200, 0.18);
  border-radius: 14px;
  background: rgba(14, 8, 18, 0.98);
  box-shadow: 0 18px 34px rgba(7, 4, 10, 0.34);
}

.styled-select__results[hidden] {
  display: none;
}

.styled-select__results::-webkit-scrollbar {
  width: 10px;
}

.styled-select__results::-webkit-scrollbar-thumb {
  border: 2px solid rgba(14, 8, 18, 0.98);
  border-radius: 999px;
  background: rgba(255, 143, 200, 0.26);
}

.styled-select__option {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 143, 200, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.styled-select__option:hover,
.styled-select__option:focus-visible {
  border-color: rgba(255, 143, 200, 0.36);
  background: rgba(255, 79, 167, 0.12);
  color: var(--pink-soft);
  transform: translateY(-1px);
}

.styled-select__option.is-selected {
  border-color: rgba(145, 70, 255, 0.48);
  background: rgba(145, 70, 255, 0.16);
  color: var(--text-main);
}

.styled-select__option-title,
.styled-select__option-meta {
  overflow-wrap: anywhere;
}

.styled-select__option-title {
  color: var(--text);
  font-weight: 500;
  line-height: 1.25;
}

.styled-select__option-meta {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.3;
}

.field__control:disabled,
.field__control[readonly] {
  cursor: not-allowed;
  opacity: 0.74;
}

.field__hint {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.field--focus {
  border-color: rgba(255, 143, 200, 0.36);
  background: rgba(255, 79, 167, 0.06);
}

.field--dirty .field__control {
  border-color: rgba(255, 209, 102, 0.7);
  background: rgba(255, 209, 102, 0.08);
}

.field--saving .field__control {
  border-color: rgba(145, 70, 255, 0.72);
  background: rgba(145, 70, 255, 0.1);
}

.field--success .field__control {
  border-color: rgba(50, 217, 120, 0.72);
  background: rgba(50, 217, 120, 0.09);
}

.field--success .field__hint {
  color: var(--green-soft);
}

.field--error .field__control {
  border-color: rgba(255, 107, 107, 0.72);
  background: rgba(255, 107, 107, 0.1);
}

.field--error .field__hint {
  color: var(--red-soft);
}

.field--disabled {
  opacity: 0.78;
}

.form-status {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-muted);
  line-height: 1.4;
}

.form-status--saving {
  border-color: rgba(145, 70, 255, 0.48);
  color: var(--violet-soft);
}

.form-status--success {
  border-color: rgba(50, 217, 120, 0.48);
  color: var(--green-soft);
}

.form-status--error {
  border-color: rgba(255, 107, 107, 0.54);
  color: var(--red-soft);
}

.form-status--warning {
  border-color: rgba(255, 209, 102, 0.52);
  color: var(--yellow-soft);
}

.canary-feedback-host,
.canary-feedback-panel,
.canary-feedback-form {
  display: grid;
  gap: 14px;
  min-width: 0;
}

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

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

.feedback-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-muted);
  line-height: 1.35;
}

.feedback-check input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: 0 0 auto;
  accent-color: var(--pink-main);
}

.feedback-note {
  min-height: 132px;
  resize: vertical;
}

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

.feedback-actions .form-status {
  flex: 1 1 260px;
}

.feedback-output {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-muted);
  font-family: "Consolas", "Segoe UI Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

.feedback-output::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-muted);
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--pink-main);
}

.problem {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
}

.problem p:last-child {
  margin: 8px 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.problem__action {
  margin-top: 14px;
}

.problem__actions,
.problem-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.problem__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: rgba(255, 107, 107, 0.14);
  color: var(--red-soft);
  font-weight: 900;
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
}

.demo-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.demo-table th,
.demo-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.demo-table th {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--pink-main);
  border-radius: var(--radius);
  background: var(--bg-card-strong);
  box-shadow: var(--shadow);
  color: var(--text);
}

.toast--success {
  border-left-color: var(--green-main);
}

.toast--warning {
  border-left-color: var(--yellow-main);
}

.toast--error {
  border-left-color: var(--red-main);
}

.modal-backdrop,
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 3, 7, 0.68);
  backdrop-filter: blur(10px);
}

.modal {
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--surface-radius);
  background: var(--bg-card-strong);
  box-shadow: var(--shadow);
}

.modal p {
  color: var(--text-muted);
  line-height: 1.5;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.loading-overlay {
  z-index: 60;
  color: #ffffff;
  text-align: center;
}

.loader {
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  border: 4px solid rgba(255, 255, 255, 0.38);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

.noscript {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 80;
  max-width: 320px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 107, 107, 0.42);
  background: rgba(255, 107, 107, 0.16);
  color: var(--red-soft);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "sidebar"
      "workspace";
  }

  .topbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .topbar__status {
    order: 3;
    width: 100%;
  }

  .topbar__actions {
    margin-left: auto;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 10px 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(16, 9, 18, 0.9);
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: center;
  }

  .nav__group {
    margin: 0 4px;
  }

  .nav__item {
    width: auto;
    min-width: 190px;
    white-space: nowrap;
  }

  .nav__row {
    grid-template-columns: 34px minmax(190px, 1fr);
    min-width: 236px;
  }

  .workspace {
    padding: 14px;
    min-width: 0;
  }

  .state-grid,
  .primitive-grid,
  .greeting-layout,
  .channel-greeting-form-grid,
  .channel-greeting-assets-grid,
  .channel-greeting-test-fields,
  .channel-greeting-template-create,
  .music-layout,
  .notifications-stats,
  .music-order-form,
  .dashboard-summary-grid,
  .feedback-grid,
  .feedback-checklist {
    grid-template-columns: 1fr;
  }

  .notifications-policy {
    display: grid;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 10px;
    padding: 10px 12px;
  }

  .brand__text {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar__actions,
  .modal__actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .workspace__header {
    display: grid;
  }

  .workspace__header h1 {
    font-size: 22px;
  }

  .surface,
  .workspace__header,
  .problem {
    padding: 14px;
  }

  .toast-region {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }

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

  .problem__actions,
  .problem-demo,
  .greeting-card__actions,
  .greeting-controls,
  .admin-channel-card,
  .admin-channel-card__actions,
  .channel-greeting-card__header,
  .greeting-template-row,
  .dashboard-summary-header,
  .music-order-form,
  .notifications-policy {
    display: grid;
    grid-template-columns: 1fr;
  }

  .greeting-controls .field {
    min-width: 0;
  }

  .music-queue-item {
    grid-template-columns: 1fr;
  }

  .music-queue-item__thumb {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
  }

  .demo-table,
  .demo-table thead,
  .demo-table tbody,
  .demo-table tr,
  .demo-table th,
  .demo-table td {
    display: block;
    width: 100%;
  }

  .demo-table thead {
    display: none;
  }

  .demo-table tr {
    padding: 10px;
    border-bottom: 1px solid var(--line);
  }

  .demo-table td {
    display: grid;
    grid-template-columns: minmax(98px, 0.42fr) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: 0;
    text-align: left;
  }

  .demo-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
  }
}
