:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111316;
  color: #f4f0e8;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #111316;
}

button,
input {
  font: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

button,
.link-button {
  min-height: 42px;
  border: 1px solid rgba(244, 240, 232, 0.14);
  border-radius: 8px;
  background: rgba(244, 240, 232, 0.07);
  color: #f4f0e8;
  cursor: pointer;
  padding: 0 14px;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

button:hover,
.link-button:hover {
  border-color: rgba(244, 240, 232, 0.26);
  background: rgba(244, 240, 232, 0.11);
}

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

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

.inline-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(244, 240, 232, 0.25);
  border-top-color: #f4f0e8;
  border-radius: 50%;
  display: inline-block;
  animation: streamboard-spin 0.7s linear infinite;
}

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

.ghost {
  background: rgba(244, 240, 232, 0.04);
  border-color: rgba(244, 240, 232, 0.1);
}

.icon-only {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid rgba(244, 240, 232, 0.08);
  background: #17191d;
  padding: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #2a8f70;
  color: #08110d;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #9da49c;
  font-size: 13px;
}

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

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 0 14px;
  text-align: left;
}

.nav-button.is-active {
  border-color: rgba(71, 169, 132, 0.68);
  background: rgba(71, 169, 132, 0.18);
}

.content {
  display: grid;
  width: 100%;
  max-width: 1240px;
  align-content: start;
  justify-self: center;
  gap: 20px;
  padding: 28px;
}

.topbar,
.panel-heading,
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  min-height: 72px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #9da49c;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  letter-spacing: 0;
  line-height: 1.08;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 22px;
}

.session {
  display: flex;
  min-width: 220px;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.session strong {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(244, 240, 232, 0.08);
  color: #d3d5cf;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.ok {
  background: rgba(71, 169, 132, 0.18);
  color: #97e0bf;
}

.pill.warn {
  background: rgba(227, 171, 88, 0.18);
  color: #ffd38f;
}

.pill.danger {
  background: rgba(227, 97, 88, 0.16);
  color: #ffaaa2;
}

.pill.neutral {
  background: rgba(126, 154, 178, 0.16);
  color: #bdd0df;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.panel,
.platform-card {
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: 8px;
  background: #1a1d22;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.panel {
  padding: 20px;
}

.stream-form {
  display: grid;
  gap: 14px;
}

.stream-form > label {
  max-width: 560px;
}

.platform-settings {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: 8px;
  background: rgba(244, 240, 232, 0.03);
  padding: 12px;
}

.platform-settings-header span {
  display: block;
  margin-bottom: 0;
  color: #aeb5ae;
  font-size: 13px;
  font-weight: 700;
}

.platform-settings-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 140px));
  justify-content: start;
  gap: 6px;
}

.platform-settings-tab {
  min-height: 36px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  text-align: left;
  background: rgba(244, 240, 232, 0.04);
}

.platform-settings-tab:hover {
  background: rgba(244, 240, 232, 0.08);
}

.platform-settings-tab:focus-visible {
  outline: 2px solid rgba(71, 169, 132, 0.78);
  outline-offset: 1px;
}

.platform-settings-tab.is-active {
  border-color: rgba(71, 169, 132, 0.64);
  background: rgba(71, 169, 132, 0.18);
}

.platform-settings-tab-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.platform-settings-tab-icon-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.platform-settings-tab-icon-fallback {
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #07110d;
  background: #7ea5cc;
}

.platform-settings-tab-icon-vkplaylive {
  background: #47a984;
}

.platform-settings-tab-icon-twitch {
  background: #9b7de3;
}

.platform-settings-tab-icon-w_tw {
  background: #5a9fd8;
}

.platform-settings-tab-icon-kick {
  background: #b7d85a;
}

.platform-settings-tab-icon-youtube {
  background: #e36158;
}

.platform-settings-tab-icon-trovo {
  background: #19d66b;
}

.platform-settings-tab-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  color: #e1e5e0;
}

.platform-settings-tab-state {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #7f8b85;
}

.platform-settings-tab-state.is-selected {
  background: #97e0bf;
}

.platform-settings-tab-state.is-connected {
  background: #7fa6bf;
}

.platform-settings-tab-state.is-disconnected {
  background: #7f8b85;
}

.platform-settings-tab-state.is-planned {
  background: #ffd38f;
}

.platform-settings-tab-state.is-unconfigured {
  background: #ffaaa2;
}

.platform-settings-panel {
  display: grid;
  gap: 8px;
  min-height: 176px;
}

.label-block {
  display: grid;
  gap: 8px;
}

.platform-settings-panel > .label-block,
.platform-settings-panel > .checkbox-line {
  max-width: 620px;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 360px);
  border: 1px solid rgba(244, 240, 232, 0.12);
  border-radius: 8px;
  background: rgba(244, 240, 232, 0.04);
  overflow: hidden;
}

.segment-button {
  min-height: 36px;
  border: 0;
  border-right: 1px solid rgba(244, 240, 232, 0.08);
  border-radius: 0;
  background: transparent;
  color: #cbd1cb;
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
}

.segment-button:last-child {
  border-right: 0;
}

.segment-button.is-active {
  background: rgba(71, 169, 132, 0.18);
  color: #9be4c2;
}

label span,
dt {
  display: block;
  margin-bottom: 7px;
  color: #aeb5ae;
  font-size: 13px;
  font-weight: 700;
}

input[type="text"],
input[type="date"],
input[type="time"],
textarea,
input:not([type]),
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(244, 240, 232, 0.12);
  border-radius: 8px;
  background: #111316;
  color: #f4f0e8;
  padding: 0 12px;
  outline: none;
}

textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(71, 169, 132, 0.8);
}

select:focus {
  border-color: rgba(71, 169, 132, 0.8);
}

.combo-wrap {
  position: relative;
}

.combo-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.combo-menu {
  position: absolute;
  z-index: 3;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid rgba(244, 240, 232, 0.12);
  border-radius: 8px;
  background: #15181d;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.4);
}

.combo-state {
  padding: 10px 12px;
  color: #c5ccc5;
  font-size: 14px;
}

.combo-option {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid rgba(244, 240, 232, 0.08);
  border-radius: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
}

.combo-option:last-child {
  border-bottom: 0;
}

.combo-option:hover {
  background: rgba(71, 169, 132, 0.16);
}

.combo-option-content {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.combo-option-image {
  width: 44px;
  height: 44px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(244, 240, 232, 0.12);
  background: #0f1216;
  flex: 0 0 44px;
}

.combo-option-image-fallback {
  display: inline-grid;
  place-items: center;
  background: rgba(244, 240, 232, 0.08);
}

.combo-option-image-fallback::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(244, 240, 232, 0.24);
  background: rgba(244, 240, 232, 0.06);
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(151, 224, 191, 0.45);
  color: #97e0bf;
  background: rgba(71, 169, 132, 0.16);
  font-size: 13px;
  width: fit-content;
}

.subtle {
  margin: 0;
  font-size: 13px;
  color: #aeb5ae;
}

.twitch-language-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr);
}

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

.twitch-source-row .ghost {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.twitch-source-row {
  color: #aeb5ae;
  font-size: 13px;
}

.twitch-source-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.twitch-tags-wrap {
  display: grid;
  gap: 8px;
}

.twitch-tag-editor {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.tag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(151, 224, 191, 0.45);
  color: #97e0bf;
  background: rgba(71, 169, 132, 0.16);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tag-chip span:last-child {
  font-size: 14px;
  line-height: 1;
}

.tag-combo-option {
  display: grid;
  min-height: 46px;
  align-content: center;
  gap: 2px;
}

.tag-combo-option small {
  color: #aeb5ae;
  font-size: 12px;
}

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

.ccl-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(244, 240, 232, 0.1);
  background: rgba(244, 240, 232, 0.04);
}

.ccl-item input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: #47a984;
}

.ccl-item-text {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.ccl-item-text strong {
  font-size: 13px;
  color: #f4f0e8;
}

.ccl-item-text small {
  font-size: 12px;
  color: #aeb5ae;
}

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

.checkbox-line span {
  margin: 0;
  color: #d3d8d3;
  font-size: 13px;
  font-weight: 700;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  accent-color: #47a984;
}

.danger-text {
  color: #ffaaa2;
}

.target-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
}

.target {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(244, 240, 232, 0.04);
}

.target input {
  width: 18px;
  height: 18px;
  accent-color: #47a984;
}

.target span {
  margin: 0;
  color: #f4f0e8;
}

.primary {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-color: rgba(71, 169, 132, 0.72);
  background: #47a984;
  color: #07110d;
  font-weight: 800;
}

.stream-form > .primary {
  width: auto;
  min-width: 220px;
  justify-self: start;
}

.primary:hover {
  background: #57bd98;
}

.result-panel {
  min-height: 0;
  align-self: start;
}

.stream-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.stream-status-panel {
  width: 100%;
}

.stream-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.stream-status-item {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: 8px;
  background: rgba(244, 240, 232, 0.035);
  padding: 12px;
}

.stream-status-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stream-status-item-head strong {
  min-width: 0;
  overflow: hidden;
  color: #f4f0e8;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-status-meta {
  display: grid;
  gap: 10px;
}

.stream-status-meta div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.stream-status-meta dt {
  margin: 0;
}

.stream-status-meta dd {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #f4f0e8;
}

.stream-status-empty {
  margin-top: 14px;
}

.result-panel .compact-list {
  margin-top: 12px;
}

.inline-note {
  margin-top: -2px;
}

.compact-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.compact-list li {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(244, 240, 232, 0.08);
  color: #bfc6bf;
}

.compact-list li.ok strong {
  color: #97e0bf;
}

.compact-list li.skipped strong,
.compact-list li.error strong {
  color: #ffd38f;
}

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

.platforms-layout {
  display: grid;
  gap: 16px;
}

.unified-chat-panel {
  display: grid;
  gap: 12px;
}

.unified-chat-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.unified-chat-panel-actions {
  display: flex;
  gap: 10px;
}

.platform-card {
  display: grid;
  min-height: 250px;
  gap: 18px;
  padding: 20px;
}

.platform-card.green {
  border-top: 3px solid #47a984;
}

.platform-card.blue {
  border-top: 3px solid #5a9fd8;
}

.platform-card.lime {
  border-top: 3px solid #b7d85a;
}

.platform-card.violet {
  border-top: 3px solid #9b7de3;
}

.platform-card.red {
  border-top: 3px solid #e36158;
}

.platform-card.teal {
  border-top: 3px solid #19d66b;
}

dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

dd {
  margin: 0;
  color: #f4f0e8;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.account-line {
  display: grid;
  gap: 4px;
  margin-top: 18px;
}

.account-line span {
  color: #aeb5ae;
  font-size: 13px;
  font-weight: 700;
}

.account-line strong {
  overflow-wrap: anywhere;
}

.account-grid .primary {
  width: 100%;
  margin-top: 22px;
}

.banner {
  border-radius: 8px;
  padding: 12px 14px;
}

.banner.danger {
  border: 1px solid rgba(227, 97, 88, 0.34);
  background: rgba(227, 97, 88, 0.12);
  color: #ffccc8;
}

.banner.info {
  border: 1px solid rgba(90, 159, 216, 0.36);
  background: rgba(90, 159, 216, 0.12);
  color: #d4e7f5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal {
  width: min(980px, 100%);
  max-height: min(88vh, 860px);
  overflow: hidden;
  border: 1px solid rgba(244, 240, 232, 0.14);
  border-radius: 8px;
  background: #1a1d22;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(244, 240, 232, 0.08);
}

.modal-footer {
  border-top: 1px solid rgba(244, 240, 232, 0.08);
  border-bottom: 0;
}

.modal-footer .primary {
  width: auto;
  min-width: 120px;
}

.modal-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(244, 240, 232, 0.08);
  color: #c2c8c2;
  font-size: 13px;
}

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

.result-table th,
.result-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(244, 240, 232, 0.08);
  text-align: left;
  vertical-align: top;
}

.result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #17191d;
  color: #ced4ce;
  font-size: 12px;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.ok {
  background: rgba(71, 169, 132, 0.18);
  color: #97e0bf;
}

.status-pill.skipped {
  background: rgba(227, 171, 88, 0.2);
  color: #ffd38f;
}

.status-pill.error {
  background: rgba(227, 97, 88, 0.2);
  color: #ffb1ab;
}

.empty {
  min-height: 44px;
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: 8px;
  color: #aeb5ae;
  padding: 12px;
}

.skeleton {
  height: 18px;
  max-width: 460px;
  border-radius: 8px;
  background: linear-gradient(90deg, #242831, #303640, #242831);
  background-size: 200% 100%;
  animation: pulse 1.4s ease-in-out infinite;
}

.skeleton.wide {
  height: 32px;
  max-width: 620px;
  margin-bottom: 18px;
}

.skeleton.short {
  max-width: 280px;
  margin-top: 14px;
}

@keyframes pulse {
  from {
    background-position: 0 0;
  }

  to {
    background-position: -200% 0;
  }
}

@media (max-width: 940px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 1px solid rgba(244, 240, 232, 0.08);
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 320px;
  }

  .nav-button {
    justify-content: center;
    text-align: center;
  }

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

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

  .stream-form > label,
  .platform-settings-panel > .label-block,
  .platform-settings-panel > .checkbox-line,
  .segmented-control {
    width: 100%;
    max-width: none;
  }

  .ccl-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .content,
  .sidebar {
    padding: 18px;
  }

  .sidebar,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .nav {
    min-width: 0;
  }

  .session {
    min-width: 0;
    align-items: flex-start;
  }

  .topbar,
  .panel-heading,
  .card-head {
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

  .compact-list li {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 10px 0;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    max-height: 96vh;
  }

  .result-table th,
  .result-table td {
    min-width: 140px;
  }

  .platform-settings-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .twitch-source-row {
    align-items: stretch;
    flex-direction: column;
  }

  .stream-form > .primary {
    width: 100%;
  }

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

  .platform-settings-panel {
    min-height: 0;
  }
}
