:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6fb;
  color: #171923;
  --purple: #7028ff;
  --violet: #9b6df3;
  --blue: #3677ff;
  --yellow: #ffbe2e;
  --line: #e6e8ef;
  --muted: #697386;
  --danger: #db3a34;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 276px 1fr;
}

button,
input,
select {
  font: inherit;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 28px 12px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
}

.brand-mark,
.profile {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--yellow), var(--purple));
  font-weight: 800;
}

.brand span {
  display: block;
  color: var(--purple);
  font-size: 13px;
  font-weight: 700;
}

nav {
  display: grid;
  gap: 10px;
}

.nav-item,
.secondary,
.ghost,
.icon-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-item {
  text-align: left;
  padding: 14px 20px;
  border-radius: 8px;
  color: #4f5668;
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  box-shadow: 0 10px 20px rgba(112, 40, 255, 0.24);
  font-weight: 700;
}

.agent-card {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fbfcff;
}

.agent-card small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

.dot.online {
  background: #21a67a;
}

.shell {
  padding: 24px 28px 48px;
}

.topbar {
  height: 52px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
}

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

.stat {
  background: linear-gradient(135deg, #8b44f3, #6414f4);
  color: #fff;
  border-radius: 8px;
  min-height: 98px;
  padding: 20px 24px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.stat span,
.notice span {
  font-size: 13px;
  opacity: 0.9;
}

.stat strong {
  font-size: 28px;
}

.storage-meter {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.storage-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #ffbe2e;
}

.notice {
  background: linear-gradient(135deg, #7733f2, #6518f3);
  color: #fff;
  border-radius: 8px;
  padding: 14px 24px;
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 20px;
}

.notice.warning {
  background: linear-gradient(135deg, #f59f00, #e03131);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(21, 32, 56, 0.04);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 18px;
}

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

label,
.repeat-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

label span,
.repeat-row > span,
.field-label {
  color: #252b3a;
  font-weight: 600;
}

input,
select {
  width: 100%;
  border: 1px solid #dfe3ec;
  border-radius: 999px;
  min-height: 42px;
  padding: 0 16px;
  background: #fff;
}

.repeat-row label {
  display: inline-flex;
  grid-template-columns: none;
  width: auto;
  align-items: center;
  gap: 8px;
  color: #4d566b;
}

.repeat-row input {
  width: auto;
  min-height: auto;
}

.secondary {
  border: 1px solid #b9becb;
  border-radius: 999px;
  padding: 10px 18px;
  background: #fff;
  font-weight: 700;
}

.upload-button {
  display: inline-flex;
  width: auto;
  grid-template-columns: none;
  border: 1px solid #b9becb;
  border-radius: 999px;
  padding: 10px 18px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.upload-button input {
  display: none;
}

.tabs {
  display: flex;
  gap: 34px;
  margin: -6px 0 22px;
  border-bottom: 1px solid transparent;
}

.tab {
  border: 0;
  background: transparent;
  color: #8a90a0;
  padding: 0 0 10px;
  cursor: pointer;
}

.tab.active {
  color: #171923;
  border-bottom: 2px solid var(--purple);
}

.library-list {
  min-height: 320px;
  border: 1px solid #eef0f5;
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.empty-state {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #8a90a0;
}

.empty-state strong {
  display: block;
  color: #454b59;
  margin: 12px 0 8px;
}

.empty-box {
  width: 86px;
  height: 66px;
  border: 2px solid #e3e5eb;
  border-radius: 8px;
  transform: perspective(120px) rotateX(14deg);
  background: linear-gradient(135deg, #fff, #eef0f5);
  margin: 0 auto;
}

.segmented {
  justify-self: center;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  min-width: 312px;
  padding: 3px;
  border-radius: 999px;
  background: #eef0f6;
}

.segment {
  border: 0;
  border-radius: 999px;
  min-height: 38px;
  background: transparent;
  color: #969baa;
  cursor: pointer;
}

.segment.active {
  background: #fff;
  color: #171923;
  box-shadow: 0 4px 12px rgba(20, 24, 36, 0.16);
}

.drop-zone {
  min-height: 146px;
  border: 1px dashed var(--purple);
  border-radius: 8px;
  background: #fbf8ff;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 28px;
}

.drop-zone.dragging,
.library-list.dragging {
  border-color: #4f46e5;
  background: #f4f0ff;
}

.file-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 0 22px;
}

.file-pick input {
  display: none;
}

.url-pane {
  display: grid;
  gap: 16px;
}

.inline-action {
  margin-top: 24px;
}

.primary {
  justify-self: center;
  border: 0;
  border-radius: 999px;
  min-width: 164px;
  min-height: 44px;
  color: #fff;
  background: linear-gradient(135deg, #a77af0, #8e55f0);
  box-shadow: 0 10px 20px rgba(142, 85, 240, 0.2);
  font-weight: 800;
  cursor: pointer;
}

.destination-list,
.streams-list {
  display: grid;
  gap: 10px;
}

.destination,
.stream-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

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

.destination code {
  color: var(--muted);
}

.danger {
  color: var(--danger);
  border: 0;
  background: transparent;
  cursor: pointer;
}

.dialog {
  width: min(960px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.34);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.46);
}

.dialog form {
  padding: 24px;
  display: grid;
  gap: 20px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ghost {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #687083;
  font-size: 26px;
}

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

.platform {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 10px 14px;
  cursor: pointer;
}

.platform.active {
  color: #fff;
  border-color: var(--purple);
  background: var(--purple);
}

.hidden {
  display: none;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #171923;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}

@media (max-width: 880px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 16px;
  }

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

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

  label,
  .repeat-row {
    grid-template-columns: 1fr;
  }

  .notice,
  .panel-heading,
  .destination,
  .stream-card {
    align-items: stretch;
    flex-direction: column;
  }
}
