:root {
  color-scheme: dark;
  --background: #111115;
  --rail: #0e0e12;
  --surface: #18181e;
  --raised: #222229;
  --line: #2d2c35;
  --control-line: #3a3844;
  --ink: #f1eef5;
  --secondary: #c3bdce;
  --muted: #a39bac;
  --accent: #c895ff;
  --accent-hover: #d6afff;
  --accent-ink: #21132f;
  --selected: #2a2136;
  --good: #8ac9ae;
  --warn: #e2b587;
  --bad: #f0a5b1;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  color: var(--ink);
  background: var(--background);
}
main { min-width: 0; }
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 25rem;
  padding: 1.5rem 1rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--rail);
}
.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding-inline: .25rem;
  color: var(--ink);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.125;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: .625rem;
}
.brand small, .provider small {
  display: block;
  margin-top: .25rem;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 400;
  line-height: 1.3;
}
.sidebar nav { display: grid; gap: .25rem; }
.sidebar-footer {
  display: grid;
  gap: .75rem;
  margin-top: auto;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}
.sidebar nav a, .nav-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: .625rem;
  min-height: 2.5rem;
  padding: .5rem .75rem;
  border: 0;
  border-radius: .5rem;
  background: transparent;
  color: var(--secondary);
  font-size: .9375rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.sidebar nav a:hover, .nav-button:hover, .provider:hover {
  background: var(--raised);
  color: var(--ink);
  text-decoration: none;
}
.sidebar nav [aria-current="page"] {
  background: var(--selected);
  color: var(--ink);
  font-weight: 550;
}
.sidebar nav [aria-current="page"]::before {
  position: absolute;
  inset-block: .625rem;
  left: 0;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  content: "";
}
.sidebar nav [aria-current="page"] .nav-icon { color: var(--accent); }
.nav-icon {
  position: relative;
  display: block;
  flex: 0 0 1rem;
  height: 1rem;
  color: var(--muted);
}
.nav-icon::before, .nav-icon::after {
  position: absolute;
  display: block;
  content: "";
}
.calendar-icon::before, .pack-icon::before, .backup-icon::before {
  inset: 2px 1px 1px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}
.calendar-icon::after { inset: 6px 2px auto; border-top: 1.5px solid currentColor; }
.pack-icon::after { inset: 6px 5px 4px; border-block: 1.5px solid currentColor; }
.account-icon::before { top: 1px; left: 5px; width: 6px; height: 6px; border: 1.5px solid currentColor; border-radius: 50%; }
.account-icon::after { inset: 8px 2px 1px; border: 1.5px solid currentColor; border-radius: 6px 6px 2px 2px; }
.history-icon::before { inset: 1px; border: 1.5px solid currentColor; border-radius: 50%; }
.history-icon::after { top: 4px; left: 7px; width: 4px; height: 5px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }
.backup-icon::before { inset: 5px 1px 2px; }
.backup-icon::after { inset: 2px 3px auto; border-top: 1.5px solid currentColor; }
.provider {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .625rem .75rem;
  border-radius: .5rem;
  color: var(--secondary);
  font-size: .875rem;
  line-height: 1.25;
  transition: background-color 140ms ease, color 140ms ease;
}
.provider i { flex: 0 0 .4375rem; height: .4375rem; margin-top: .3125rem; border-radius: 50%; background: var(--muted); }
.provider.active i { background: var(--good); }

.workspace { max-width: 90rem; margin-inline: auto; padding: 2.5rem 2rem 4rem; }
.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
h1 { font-size: clamp(1.875rem, 3.2vw, 2.375rem); font-weight: 550; letter-spacing: -.025em; line-height: 1.15; }
h2 { font-size: 1.125rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
h3 { font-size: 1rem; font-weight: 600; }
.page-head p { margin-top: .5rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  min-height: 2.5rem;
  padding: .5rem .75rem;
  border: 1px solid var(--control-line);
  border-radius: .5rem;
  background: var(--raised);
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 550;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.button:hover, .icon-button:hover { background: var(--control-line); text-decoration: none; }
.button.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.button.primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.button:disabled, input:disabled, select:disabled { cursor: default; }
.button:disabled { border-color: var(--line); background: var(--surface); color: var(--muted); }
.button.danger { color: var(--bad); }
.button.small { min-height: 2rem; padding: .375rem .625rem; font-size: .875rem; }
.icon-button { min-width: 2.25rem; min-height: 2.25rem; padding: .25rem; font-size: 1.25rem; }

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: .875rem;
  background: var(--surface);
}
.metric { display: grid; align-content: space-between; gap: .5rem; min-height: 5.75rem; padding: .875rem 1.25rem; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric dt { color: var(--secondary); font-size: .875rem; }
.metric dd { font-size: 1.875rem; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1; }
.metric.needs-attention dd { color: var(--warn); }

.panel {
  margin-bottom: 1.5rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .875rem;
  background: var(--surface);
}
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; }
.month-label::first-letter { text-transform: uppercase; }
.calendar-panel .panel-head .cell-sub { margin-top: .125rem; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.day {
  position: relative;
  display: grid;
  justify-items: start;
  gap: .25rem;
  min-width: 0;
  min-height: 5.75rem;
  padding: .75rem 1rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease;
}
.day + .day { border-left: 1px solid var(--line); }
.day:hover { background: var(--raised); }
.day:focus-visible { outline-offset: -3px; z-index: 1; }
.day[aria-pressed="true"] { background: var(--selected); }
.day[aria-pressed="true"]::after {
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--accent);
  content: "";
}
.day span { color: var(--muted); font-size: .875rem; text-transform: capitalize; }
.day strong { font-size: 1.25rem; font-weight: 550; line-height: 1; }
.day[aria-current="date"] strong, .day[aria-pressed="true"] strong { color: var(--accent); }
.day i { display: block; min-height: 1.125rem; color: var(--muted); font-size: .8125rem; font-style: normal; }
.day.has-posts i { color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem 1.25rem; border-block: 1px solid var(--line); }
.filters select { width: auto; max-width: 12.5rem; font-size: .875rem; }
.filter-date { display: flex; align-items: center; gap: .5rem; color: var(--secondary); }
.filters .filter-date input { width: auto; font-size: .875rem; }
.table-wrap { overflow-x: auto; }
.table-wrap:focus-visible { outline-offset: -3px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
.queue-table { min-width: 44rem; table-layout: fixed; }
.select-column { width: 2.5rem; }
.video-column { width: 22%; }
.account-column { width: 18%; }
.time-column { width: 15%; }
.status-column { width: 21%; }
th, td { padding: .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { padding-left: 1.25rem; }
th:last-child, td:last-child { padding-right: 1.25rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #1c1c23; }
th { color: var(--muted); font-size: .875rem; font-weight: 500; white-space: nowrap; }
td { color: var(--secondary); font-size: .9375rem; }
.queue-table td { padding-block: .875rem; }
.queue-table td .button { background: transparent; }
.queue-table td .button:hover { background: var(--raised); }
.queue-table td input[type="checkbox"] { margin: .25rem 0 0; }
.cell-main { display: block; color: var(--ink); font-weight: 550; overflow-wrap: anywhere; }
.cell-sub { display: block; color: var(--muted); font-size: .875rem; font-weight: 400; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.status {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--secondary);
  font-size: .875rem;
  font-weight: 500;
}
.status::before { flex: 0 0 .375rem; height: .375rem; border-radius: 50%; background: currentColor; content: ""; }
.status.scheduled, .status.sending { color: var(--accent); }
.status.published, .status.connected { color: var(--good); }
.status.attention, .status.unknown, .status.moving, .status.cancelling { color: var(--warn); }
.status.cancelled, .status.disconnected, .status.draft { color: var(--muted); }
.status.failed { color: var(--bad); }
.row-note { display: block; margin-top: .25rem; color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.empty { padding: 2rem 1.25rem 2.5rem; }
.empty p { max-width: 40rem; margin-top: .25rem; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.tile { padding: 1.25rem; border: 1px solid var(--line); border-radius: .875rem; background: var(--surface); overflow-wrap: anywhere; }
.tile .actions { margin-top: .75rem; }
.section-gap { margin-top: 1.5rem; }
.details-list { padding: 0 1.25rem .75rem; }
.details-list summary { padding-block: .5rem; color: var(--secondary); cursor: pointer; }
.clip-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 0; border-top: 1px solid var(--line); }
.clip-row strong { font-weight: 550; overflow-wrap: anywhere; }
.settings { max-width: 40rem; }
.settings p { margin-top: .5rem; }

dialog {
  width: min(calc(100vw - 2rem), 38rem);
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--control-line);
  border-radius: 1rem;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1rem 3rem #0006;
}
dialog.wide { width: min(calc(100vw - 2rem), 59rem); }
dialog::backdrop { background: #05050ab8; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
#dialog-content { padding: 1.25rem; }
form { display: grid; gap: 1rem; }
label, legend { font-size: .875rem; font-weight: 550; }
label.field { display: grid; gap: .375rem; min-width: 0; }
input:not([type="checkbox"]), textarea, select {
  min-width: 0;
  width: 100%;
  min-height: 2.25rem;
  padding: .5rem .625rem;
  border: 1px solid var(--control-line);
  border-radius: .5rem;
  background: var(--background);
  color: var(--ink);
}
select {
  appearance: none;
  padding-right: 1.75rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
input[type="checkbox"] { accent-color: var(--accent); }
textarea { resize: vertical; }
fieldset { margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: .5rem; }
.checkbox { display: flex; align-items: start; gap: .5rem; font-weight: 400; }
.checkbox input { margin-top: .25rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.form-note, .form-error { font-size: .875rem; }
.form-error { color: var(--bad); }
.form-actions { justify-content: end; }
video { display: block; width: 100%; max-height: 40vh; border-radius: .5rem; background: var(--rail); }
#notification {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: .75rem 1rem;
  border: 1px solid var(--control-line);
  border-radius: .5rem;
  background: var(--raised);
  color: var(--ink);
}
#notification.error { color: var(--bad); }

@media (max-width: 64rem) {
  body { grid-template-columns: 12rem minmax(0, 1fr); }
  .sidebar { padding-inline: .75rem; }
  .workspace { padding-inline: 1.5rem; }
  .page-head { align-items: start; }
}
@media (max-width: 48rem) {
  body { display: block; }
  .sidebar {
    position: static;
    height: auto;
    min-height: 0;
    gap: .75rem;
    padding: .75rem;
    border: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand-mark { width: 2.75rem; height: 2.75rem; }
  .sidebar nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sidebar nav a { justify-content: center; padding: .375rem .125rem; font-size: .875rem; white-space: nowrap; }
  .sidebar nav a .nav-icon { display: none; }
  .sidebar nav [aria-current="page"]::before { inset: auto .75rem 0; width: auto; height: 2px; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: .25rem; padding-top: .5rem; }
  .nav-button, .provider { padding: .375rem .5rem; font-size: .875rem; }
  .workspace { padding: 1.5rem 1rem 3rem; }
  .page-head { flex-direction: column; }
  .panel-head, .filters, .empty { padding-inline: .875rem; }
  .day { padding-inline: .5rem; }
}
@media (max-width: 32rem) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 5rem; padding: .75rem; }
  .metric:nth-child(odd) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .day { min-height: 5rem; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .sidebar nav a { font-size: .8125rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

.demo-banner {
  padding: 10px 24px;
  border-bottom: 1px solid var(--warn);
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, var(--background));
  font-size: 14px;
}
.demo-banner strong { color: var(--ink); }

.caption-text { white-space: pre-line; }
.warning-note { color: var(--bad); }
.clip-row .episode {
  min-width: 44px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--raised);
  color: var(--accent);
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.clip-row .clip-body { flex: 1; min-width: 0; }
.caption-sample {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.caption-sample pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  font: inherit;
  color: var(--ink);
}
.preview-table { max-height: 360px; overflow: auto; margin-top: 8px; }
.form-note code { color: var(--accent); }
.caption-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70ch; }
.schedule-summary { margin: 12px 0 0; display: grid; gap: 4px; }
.schedule-summary strong { font-weight: 550; }
.queue-summary { margin: 10px 0 0; display: grid; gap: 4px; }
.queue-summary strong { font-weight: 550; }
.queue-summary.ending strong { color: var(--warn); }
.ending-banner {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  border-color: var(--warn);
}
.ending-banner strong { color: var(--warn); }
.ending-banner ul { margin: 6px 0 0; padding-left: 18px; color: var(--secondary); }
.ending-banner { padding: 14px 20px; margin-bottom: 20px; }
.ending-banner ul { list-style: disc; }

.user-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; color: var(--secondary); font-size: 13px; }
.user-box .small-link { width: auto; padding: 4px 8px; }
.align-end { align-self: end; }
.login-page { display: grid; place-items: center; min-height: 100vh; grid-template-columns: 1fr; }
.login-box { width: min(420px, calc(100vw - 32px)); padding: 32px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.login-box form { display: grid; gap: 14px; }
.login-box h1 { margin: 8px 0 0; font-size: 24px; }
.login-brand { margin-bottom: 12px; }
.login-demo { border-radius: 8px; margin: 0 0 12px; }
