:root {
  color-scheme: light;
  --background: #f4f6fc;
  --paper: #fff;
  --ink: #172138;
  --muted: #526079;
  --border: #e1e6f0;
  --accent: #5146bf;
  --accent-dark: #4238a7;
  --accent-pale: #f0eeff;
  --shadow: 0 8px 28px rgb(24 37 74 / 6%);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); }
a { color: var(--accent-dark); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #7569e8; outline-offset: 3px;
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.65rem); line-height: 1.1; letter-spacing: -.04em; }
h2 { font-size: 1.15rem; line-height: 1.3; letter-spacing: -.015em; }
small, .muted { color: var(--muted); }
.shell { width: min(100% - 2.5rem, 1210px); margin-inline: auto; }
.topbar { background: #151b33; color: #fff; }
.topbar .shell { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.35rem; min-height: 67px; padding-block: .55rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 750; white-space: nowrap; text-decoration: none; color: #fff; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #7061e7; }
.brand-mark svg { width: 22px; height: 22px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem; }
.nav a, .logout { padding: .42rem .65rem; border-radius: 7px; color: #e1e5f6; text-decoration: none; font: inherit; font-size: .875rem; }
.nav a:hover, .nav a[aria-current="page"], .logout:hover { background: #303858; color: #fff; }
.account { margin-left: auto; display: flex; align-items: center; gap: .65rem; font-size: .85rem; }
.logout { background: transparent; border: 1px solid #455073; cursor: pointer; }
main.shell { padding-block: 2rem 3rem; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 1.2rem; padding: 1.8rem 2rem; border-radius: 20px; background: linear-gradient(115deg,#201c55,#3c347c); color: white; box-shadow: var(--shadow); }
.hero p:not(.eyebrow) { color: #e1ddf8; margin-top: .6rem; }
.eyebrow { font-size: .73rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: #c7befb; margin-bottom: .5rem; }
.hero-actions, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.button { display: inline-flex; justify-content: center; align-items: center; border: 1px solid transparent; border-radius: 8px; background: var(--accent); color: #fff; padding: .55rem .86rem; font: inherit; font-size: .88rem; font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap; }
.button:hover { background: var(--accent-dark); color: white; }
.button--light { background: #fff; color: #3f358f; }
.button--light:hover { background: #efedff; color: #382e83; }
.button--quiet { color: var(--accent-dark); border-color: var(--border); background: #fff; }
.button--quiet:hover { color: var(--accent-dark); background: var(--accent-pale); }
.button--small { font-size: .78rem; padding: .4rem .62rem; }
.button--danger { background: #a92e49; }
.button:disabled { opacity: .5; cursor: default; }
.section { margin-top: 1.3rem; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .55rem; margin-bottom: .7rem; }
.section-heading p { font-size: .84rem; }
.collector-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .85rem; }
.collector { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center; min-width: 0; background: var(--paper); color: var(--ink); border: 1px solid var(--border); border-radius: 13px; padding: 1rem; text-decoration: none; box-shadow: var(--shadow); }
.collector:hover, .collector[aria-current="true"] { border-color: #8c7fe9; background: #fbfaff; }
.collector-name { font-weight: 730; line-height: 1.2; display: block; margin-bottom: .2rem; }
.collector small { display: block; font-size: .76rem; }
.collector-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 10px; background: #eeebff; color: #5042c0; }
.collector-icon svg { width: 21px; height: 21px; }
.collector-icon.youtube { color: #a82947; background: #ffe9ee; }
.collector-icon.telegram { color: #126794; background: #e3f3fc; }
.collector-count { text-align: right; }
.collector-count strong { font-size: 1.25rem; display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.panel { background: var(--paper); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); min-width: 0; }
.panel-pad { padding: 1.1rem 1.25rem; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(117px,1fr)); gap: .55rem; margin: .8rem 0; }
.metrics[data-progress-url] { grid-template-columns: repeat(5,minmax(0,1fr)); }
.metric { padding: .5rem .65rem; background: #f6f7fc; border-radius: 8px; }
.metric dt { font-size: .76rem; color: var(--muted); }
.metric dd { margin: 0; font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th, td { text-align: left; padding: .7rem .85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .73rem; text-transform: uppercase; letter-spacing: .055em; color: var(--muted); background: #f8f9fc; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcff; }
.url-cell { max-width: 22rem; overflow-wrap: anywhere; }
.badge { display: inline-block; border-radius: 999px; font-size: .74rem; font-weight: 650; line-height: 1.3; white-space: nowrap; padding: .28rem .52rem; background: #eef1f8; color: #475776; }
.badge--queued, .badge--waiting, .badge--uncertain { background: #fff0ce; color: #79501a; }
.badge--submitted, .badge--submitting, .badge--collecting, .badge--publishing, .badge--expanding { background: #ebe8ff; color: #4c3cb4; }
.badge--published, .badge--enqueued, .badge--active { background: #dff5ec; color: #246a53; }
.badge--failed { background: #ffe8ed; color: #9b2e46; }
.notice { margin-bottom: .85rem; padding: .7rem .9rem; border: 1px solid #b9e5d4; border-radius: 9px; background: #e9faf3; color: #205a49; }
.notice--error { border-color: #f2b9c7; background: #fff0f3; color: #8d2741; }
.page-head { margin-bottom: 1.15rem; }
.page-head p { margin-top: .45rem; }
.form-panel { max-width: 790px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .95rem 1rem; }
.field label { display: block; font-weight: 650; margin-bottom: .3rem; font-size: .87rem; }
.field input:not([type=checkbox]), .field select { width: 100%; min-width: 0; border: 1px solid #ccd4e5; border-radius: 8px; padding: .55rem .65rem; color: var(--ink); background: #fff; font: inherit; font-size: .92rem; }
.field input[type=checkbox] { accent-color: var(--accent); }
.field small { display: block; margin-top: .25rem; font-size: .76rem; }
.field--wide { grid-column: 1 / -1; }
.form-actions { margin-top: 1rem; }
.errorlist { color: #a02f49; margin: .25rem 0; padding-left: 1.2rem; font-size: .84rem; }
.login-panel { max-width: 435px; margin: 2rem auto; }
.empty { color: var(--muted); padding-block: .9rem; }
@media (max-width: 800px) {
  .collector-grid { grid-template-columns: 1fr; }
  .metrics[data-progress-url] { grid-template-columns: repeat(auto-fit,minmax(112px,1fr)); }
  .hero { align-items: start; flex-direction: column; }
}
@media (max-width: 580px) {
  .shell { width: calc(100% - 1.5rem); }
  .topbar .shell { gap: .35rem .65rem; }
  .account span { display: none; }
  main.shell { padding-top: 1rem; }
  .hero, .panel-pad { padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
}
