:root {
  color-scheme: light;
  --bg: #f3f7fa;
  --paper: #fff;
  --ink: #13314b;
  --muted: #667d8d;
  --line: #dce5ec;
  --accent: #137f78;
  --accent-soft: #e7f4ef;
  --gold: #e2ad48;
  --danger: #b53a46;
  --shadow: 0 12px 34px #16334b08;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: 15px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 90% 0, #e3f0ed 0, transparent 45%), var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
a {
  color: inherit;
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1.12;
}
h2 {
  font-size: 1.3rem;
  letter-spacing: -0.035em;
}
h3 {
  font-size: 1rem;
  letter-spacing: -0.02em;
}
small {
  font-size: 0.8rem;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
.workspace {
  display: flex;
  min-height: 100dvh;
}
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 32px 20px;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 5;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.04em;
}
.brand small {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  font-weight: 400;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  background: var(--ink);
  color: var(--gold);
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-size: 2rem;
}
.sidebar nav {
  display: grid;
  gap: 8px;
  margin-top: 52px;
}
.sidebar nav a {
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 13px 15px;
  color: var(--muted);
  border-radius: 12px;
  font-weight: 550;
}
.sidebar nav a > span:first-child {
  font-size: 1.45rem;
  width: 24px;
  line-height: 1;
  text-align: center;
}
.sidebar nav a.selected {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar nav a:hover {
  background: var(--bg);
}
.sidebar-note {
  margin-top: auto;
  padding: 26px 12px 0;
  font-size: 0.75rem;
  color: var(--ink);
}
.sidebar-note p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.7rem;
}
.access-dot {
  display: inline-block;
  background: var(--accent);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
}
.main-shell {
  margin-left: 248px;
  min-width: 0;
  flex: 1;
}
.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 5%;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}
.topbar > .quiet {
  margin-left: auto;
}
.profile {
  font-size: 0.75rem;
}
.mobile-brand {
  display: none;
}
main {
  max-width: 1160px;
  padding: 45px 5% 30px;
  margin: auto;
  animation: reveal 0.3s ease-out;
}
.page-heading {
  margin-bottom: 34px;
}
.eyebrow {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}
.page-heading p {
  color: var(--muted);
  max-width: 620px;
  margin-top: 16px;
  font-size: 0.9rem;
}
.overview {
  display: grid;
  grid-template-columns: 1fr 1fr 1.7fr;
  gap: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
  margin-bottom: 32px;
}
.overview > div {
  border-right: 1px solid var(--line);
}
.overview .eyebrow {
  margin: 0;
  font-size: 0.6rem;
  color: var(--muted);
}
.overview strong {
  display: block;
  font-size: 2.4rem;
  font-weight: 500;
  letter-spacing: -0.05em;
}
.overview p {
  font-size: 0.8rem;
  color: var(--muted);
  align-self: center;
}
.composer {
  background: var(--paper);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.panel-title {
  margin-bottom: 24px;
}
.panel-title p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
}
label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
}
input,
textarea,
select {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  max-width: 100%;
}
textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.8;
  min-height: 145px;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
.composer-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
}
.primary,
.secondary,
.load-more,
.quiet,
.text-button,
.danger-text,
.tabs button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 0.8rem;
  font-weight: 600;
}
.primary {
  background: var(--ink);
  color: var(--paper);
  min-height: 44px;
}
.primary:hover {
  background: var(--accent);
}
.secondary {
  background: var(--accent-soft);
  color: var(--accent);
  min-height: 42px;
}
.secondary:hover {
  filter: brightness(0.96);
}
.quiet,
.text-button,
.danger-text {
  background: transparent;
  color: var(--muted);
}
.text-button {
  color: var(--accent);
  padding: 8px 0;
}
.danger-text {
  color: var(--danger);
}
.info-note {
  padding: 20px 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.65;
}
.info-note strong {
  color: var(--ink);
  font-weight: 600;
}
.info-note p {
  margin-top: 6px;
}
.submit-results:not(:empty) {
  margin-top: 30px;
}
.submission {
  background: var(--paper);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 12px;
  overflow-wrap: anywhere;
}
.submission p {
  font-size: 0.85rem;
  margin-top: 8px;
  color: var(--muted);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}
.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  max-width: 450px;
  margin-bottom: 26px;
}
.searchbar > span {
  font-size: 1.5rem;
  color: var(--muted);
}
.searchbar input {
  width: 100%;
  background: none;
  border: 0;
  padding: 14px 0;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.report-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.channel-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--bg);
  color: var(--gold);
  font-size: 1.4rem;
}
.channel-name {
  min-width: 0;
  flex: 1;
}
.channel-name h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-name small {
  font-size: 0.7rem;
}
.badge {
  display: inline-block;
  flex-shrink: 0;
  border-radius: 6px;
  padding: 4px 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.65rem;
  white-space: nowrap;
  font-weight: 650;
}
.badge.completed {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge.in_progress {
  background: #fff3d6;
  color: #946615;
}
.badge.error {
  background: #fbe8e9;
  color: var(--danger);
}
.badge.paused {
  background: #eaf0fa;
  color: #42648e;
}
.card-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 24px 0;
}
.card-numbers strong {
  font-size: 1.8rem;
  font-weight: 500;
  letter-spacing: -0.05em;
}
.card-numbers small {
  display: block;
  font-size: 0.7rem;
}
.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 15px;
}
.card-bottom small {
  font-size: 0.7rem;
}
.progress-block {
  margin: 25px 0;
}
.progress-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 8px;
}
progress {
  appearance: none;
  width: 100%;
  height: 5px;
  display: block;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--line);
  accent-color: var(--accent);
}
progress::-webkit-progress-bar {
  background: var(--line);
}
progress::-webkit-progress-value {
  background: var(--accent);
}
progress::-moz-progress-bar {
  background: var(--accent);
}
.load-more {
  display: block;
  margin: 25px auto;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  min-width: 170px;
}
.empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 55px 24px;
  color: var(--muted);
}
.empty-mark {
  display: block;
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 10px;
}
.empty h3 {
  color: var(--ink);
  margin-bottom: 8px;
}
.empty p {
  font-size: 0.85rem;
}
.tabs {
  display: flex;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}
.tabs button {
  background: none;
  color: var(--muted);
  border-radius: 0;
  border-bottom: 2px solid transparent;
}
.tabs button.selected {
  color: var(--accent);
  border-color: var(--accent);
}
.schedule-list {
  display: grid;
  gap: 14px;
}
.schedule-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  overflow-wrap: anywhere;
  margin-bottom: 12px;
}
.schedule-card p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
}
.schedule-card .actions {
  margin-top: 0;
}
.search-row {
  display: flex;
  gap: 14px;
}
.search-row input {
  flex: 1;
  min-width: 0;
}
.compact {
  max-width: 760px;
}
.lookup-total {
  padding: 30px 0;
}
.lookup-total > span {
  font-size: 0.8rem;
  color: var(--muted);
}
.lookup-total strong {
  display: block;
  font-size: 2.5rem;
  letter-spacing: -0.05em;
  font-weight: 500;
}
.lookup-total p {
  font-size: 0.85rem;
  color: var(--muted);
}
.lookup-list > div:not(.empty) {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}
.lookup-list strong {
  white-space: nowrap;
}
.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
}
.gate .brand-mark {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  margin-bottom: 24px;
}
.gate p {
  max-width: 440px;
  color: var(--muted);
  margin-top: 16px;
}
footer {
  padding: 20px 5% 35px;
  font-size: 0.65rem;
  color: var(--muted);
  max-width: 1160px;
  margin: auto;
}
dialog {
  max-width: 620px;
  width: calc(100% - 32px);
  max-height: 90dvh;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 100px #102c4a40;
  overflow: auto;
}
dialog::backdrop {
  background: #102c4a80;
  backdrop-filter: blur(4px);
}
.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.dialog-top .eyebrow {
  margin: 0;
}
dialog h2 {
  font-size: 1.8rem;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
}
.muted {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 12px;
}
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  background: var(--bg);
  padding: 24px;
  border-radius: 12px;
  margin-top: 22px;
}
.metrics strong {
  display: block;
  font-size: 1.7rem;
  font-weight: 500;
  letter-spacing: -0.04em;
}
.metrics span {
  font-size: 0.7rem;
  color: var(--muted);
}
.detail-section {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 22px;
}
.detail-section > p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 8px;
}
.post-result {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 0.85rem;
  max-height: 50dvh;
  overflow: auto;
  margin: 20px 0;
}
.error-text {
  color: var(--danger) !important;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
  margin: 12px 0;
}
.warning {
  background: #fff3d6;
  color: #775718;
  padding: 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  margin-top: 16px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
  padding: 14px 22px;
  border-radius: 12px;
  max-width: calc(100% - 28px);
  width: max-content;
  z-index: 20;
  font-size: 0.85rem;
}
body:has(dialog[open]) > .toast {
  z-index: 30;
}
@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (min-width: 1400px) {
  main {
    padding-top: 60px;
  }
  .page-heading {
    margin-bottom: 42px;
  }
}
@media (max-width: 1050px) {
  .sidebar {
    width: 200px;
    padding: 28px 14px;
  }
  .main-shell {
    margin-left: 200px;
  }
  .profile {
    display: none;
  }
  .overview {
    grid-template-columns: 1fr 1fr;
  }
  .overview p {
    grid-column: 1/-1;
  }
  .overview > div:nth-child(2) {
    border: 0;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .schedule-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}
@media (max-width: 650px) {
  :root {
    font-size: 15px;
  }
  .sidebar {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    padding: 8px 6px max(8px, env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--line);
    background: var(--paper);
  }
  .sidebar .brand,
  .sidebar-note {
    display: none;
  }
  .sidebar nav {
    display: flex;
    justify-content: space-around;
    gap: 0;
    margin: 0;
  }
  .sidebar nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 7px 1px;
    border-radius: 8px;
    font-size: 0.6rem;
  }
  .sidebar nav a > span:first-child {
    font-size: 1.5rem;
  }
  .main-shell {
    margin-left: 0;
    padding-bottom: 85px;
  }
  .topbar {
    height: 65px;
    padding: env(safe-area-inset-top) 20px 0;
    gap: 10px;
  }
  .mobile-brand {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.04em;
    color: var(--ink);
  }
  #section-label {
    display: none;
  }
  .topbar .quiet {
    font-size: 0.7rem;
    padding: 8px;
  }
  main {
    padding: 28px 20px 15px;
  }
  .page-heading {
    margin-bottom: 26px;
  }
  h1 {
    font-size: 2.35rem;
  }
  .page-heading p {
    font-size: 0.85rem;
    margin-top: 14px;
  }
  .eyebrow {
    font-size: 0.6rem;
  }
  .overview {
    gap: 18px;
    padding: 20px 0;
    margin-bottom: 24px;
  }
  .overview strong {
    font-size: 2rem;
  }
  .overview .eyebrow {
    font-size: 0.55rem;
  }
  .overview p {
    font-size: 0.75rem;
  }
  .composer {
    padding: 22px 18px;
    border-radius: 14px;
  }
  .composer-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }
  .composer-bottom select {
    width: 100%;
  }
  .composer-bottom .primary {
    width: 100%;
  }
  .card-grid {
    gap: 14px;
  }
  .report-card {
    padding: 18px;
  }
  .card-head {
    gap: 9px;
  }
  .badge {
    font-size: 0.6rem;
  }
  .channel-name h3 {
    font-size: 0.95rem;
  }
  .channel-avatar {
    width: 34px;
    height: 34px;
  }
  .card-numbers strong {
    font-size: 1.7rem;
  }
  .search-row {
    flex-direction: column;
  }
  .schedule-card {
    padding: 20px;
  }
  .toast {
    bottom: calc(90px + env(safe-area-inset-bottom));
    font-size: 0.8rem;
  }
  dialog {
    padding: 22px;
    max-height: 85dvh;
  }
  dialog h2 {
    font-size: 1.55rem;
  }
  .metrics {
    padding: 18px;
    gap: 16px;
  }
  .actions {
    gap: 8px;
  }
  .actions button {
    flex-grow: 1;
  }
  footer {
    padding: 20px;
    font-size: 0.6rem;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10222f;
  --paper: #172e3d;
  --ink: #e4eef4;
  --muted: #a0b5c3;
  --line: #2b4556;
  --accent: #7ad2be;
  --accent-soft: #203e40;
  --shadow: none;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(ellipse at 90% 0, #173b3a, transparent 45%), var(--bg);
}
html[data-theme="dark"] .brand-mark {
  background: #244655;
}
html[data-theme="dark"] .badge.in_progress,
html[data-theme="dark"] .warning {
  background: #4b3b20;
  color: #f2cc7d;
}
html[data-theme="dark"] .badge.error {
  background: #492f39;
  color: #ffb2bc;
}
html[data-theme="dark"] .badge.paused {
  background: #263b55;
  color: #b0ccf1;
}
html[data-theme="dark"] .error-text,
html[data-theme="dark"] .danger-text {
  color: #ffb2bc !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

.user-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.user-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  min-width: 0;
}
.user-card .channel-name small {
  display: block;
  overflow-wrap: anywhere;
}
.user-facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 8px 12px;
  font-size: 0.75rem;
  margin: 22px 0 0;
}
.user-facts dt {
  color: var(--muted);
}
.user-facts dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.admin-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  margin-bottom: 15px;
}
.admin-add input,
.admin-filters input {
  min-width: 0;
}
@media (max-width: 1050px) {
  .user-list {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 650px) {
  .admin-filters {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .admin-filters input {
    grid-column: 1 / -1;
  }
  .user-card {
    padding: 18px;
  }
}
