:root {
  color-scheme: light dark;
  --bg: #f6f5f2;
  --card: #fff;
  --text: #25232b;
  --muted: #6a6673;
  --line: #e4e1e8;
  --accent: #6d4fc2;
  --accent-hover: #593eaa;
  --accent-text: #fff;
  --selected: #efebf8;
  --bar: #c8bce9;
  --bar-posted: #6d4fc2;
  --ok: #246c49;
  --warn: #875714;
  --err: #b42318;
  --fresh: #faf7ed;
  --focus: #6d4fc2;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17161b; --card: #211f27; --text: #eeebf3; --muted: #ada7b8;
    --line: #393440; --accent: #b8a0ff; --accent-hover: #cbbaff; --accent-text: #22183d;
    --selected: #332b48; --bar: #5d4f7b; --bar-posted: #b8a0ff; --focus: #b8a0ff;
    --ok: #7ed0a2; --warn: #e6b964; --err: #ff9b94; --fresh: #2b271e;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
::selection { background: var(--selected); color: var(--text); }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
a, button, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
input, textarea { caret-color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; line-height: 1.25; font-weight: 650; letter-spacing: -.025em; margin-bottom: 8px; }
h2 { font-size: 18px; line-height: 1.4; font-weight: 650; letter-spacing: -.012em; margin-bottom: 16px; }
h3 { font-size: 14px; font-weight: 600; margin-bottom: 0; }
p { margin-bottom: 14px; }
p:last-child { margin-bottom: 0; }
code { font-family: var(--mono); font-size: .88em; }
main { width: 100%; max-width: 1256px; margin: 0 auto; padding: 36px 32px 64px; }
main:focus { outline: none; }
.skip-link { position: fixed; top: 8px; left: 12px; padding: 10px 16px; background: var(--card); z-index: 10; transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.top { display: flex; align-items: center; flex-wrap: wrap; gap: 28px; padding: 16px 32px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; flex-shrink: 0; color: var(--text); line-height: 1.35; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--muted); font-size: 12px; }
.brand .brand-title { font-size: 15px; font-weight: 650; color: var(--text); margin-bottom: 2px; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { min-height: 44px; display: flex; align-items: center; padding: 10px 14px; color: var(--muted); border-radius: 8px; font-size: 14px; }
.top nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.top nav a.on { background: var(--selected); color: var(--accent); font-weight: 600; }
.logout { margin: 0; }
.head { margin-bottom: 24px; }
.summary-head { margin-bottom: 16px; }
.head p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.err { color: var(--err); }
.nowrap { white-space: nowrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.row-between > * { min-width: 0; }
.source-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.source-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }
.status-dot { width: 6px; height: 6px; background: currentColor; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.card { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.notice { border: 1px solid currentColor; border-radius: 10px; padding: 14px 16px; margin: 0 0 20px; font-size: 14px; overflow-wrap: anywhere; }
.notice ul { padding-left: 20px; margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.metric { padding: 16px 24px; min-width: 0; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric .label { font-size: 13px; color: var(--muted); }
.metric .value { font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin: 8px 0; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric .hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.summary-grid { display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 24px; align-items: start; }
.summary-main, .summary-side { min-width: 0; }
.button.mobile-only { display: none; }
.quick-tasks { display: grid; gap: 8px; }
.quick-tasks .button { justify-content: flex-start; }
.quota-note { margin: 14px 0 0; font-size: 12px; }
.panel-section { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 18px; }
.panel-section h3 { margin-bottom: 12px; }
.next-step .panel-section { margin-top: 16px; padding-top: 16px; }
.next-step .panel-section h3 { margin-bottom: 8px; }
.last-result { display: grid; gap: 3px; margin-bottom: 12px; }
.job-links { list-style: none; padding: 0; margin: 0; }
.job-links li { display: grid; gap: 4px; margin: 12px 0; font-size: 13px; }
.next-step { scroll-margin-top: 20px; }
.section-head { margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 13px; }
.chart { width: 100%; height: auto; display: block; }
.chart-panel { padding: 20px; }
.chart-panel .section-head { margin-bottom: 12px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--bar); }
.chart .bar.posted { fill: var(--bar-posted); }
.chart .bar:hover, .chart .bar:focus { fill: var(--accent); stroke: var(--text); stroke-width: 1; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--bar); margin-right: 4px; }
.dot.posted { background: var(--bar-posted); }
.chart-caption { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); margin: 8px 0; }
.chart-data { margin-top: 8px; font-size: 13px; }
.audience-number { font-size: 30px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.audience-change { margin: 18px 0 10px; font-variant-numeric: tabular-nums; }
.connection { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; }
.connection p { margin: 8px 0 0; }
.table-panel { padding: 24px 0 0; }
.table-panel .section-head { padding: 0 24px; }
.scroll-x { max-width: 100%; overflow-x: auto; }
.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.data th, .data td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data th { font-size: 12px; color: var(--muted); font-weight: 550; white-space: nowrap; background: var(--bg); }
.data th a { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; min-height: 28px; }
.data th a.on { color: var(--accent); }
.data .r { text-align: right; white-space: nowrap; }
.data tr:last-child td { border-bottom: 0; }
.data tbody tr:hover td { background: var(--bg); }
.data tr.fresh td { background: var(--fresh); }
.data td.cap { max-width: 340px; min-width: 200px; }
.data td.cap > a { color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
.recent-posts { min-width: 700px; }
.post-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.fresh-label { color: var(--warn); }
.table-note { padding: 16px 24px; border-top: 1px solid var(--line); }
.data.compact td, .data.compact th { padding: 8px 12px; }
.methodology { color: var(--muted); font-size: 13px; margin: 24px 0 0; max-width: 75ch; }
.methodology p { margin-top: 12px; }
.filters { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin: 24px 0 12px; }
.filters label { font-size: 12px; font-weight: 550; margin: 0; min-width: 130px; }
.filters .search-field { flex: 1; min-width: 240px; max-width: 460px; }
.filter-reset { align-self: center; font-size: 13px; padding: 12px 0; }
.sticky-save { position: sticky; bottom: 0; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 16px 0; background: var(--bg); z-index: 1; }
label { display: block; margin-bottom: 16px; font-weight: 550; font-size: 14px; }
label .hint { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 6px; max-width: 75ch; }
input[type=text], input[type=password], input[type=date], input[type=search], select, textarea { display: block; width: 100%; min-height: 44px; margin-top: 6px; padding: 10px 12px; font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; transition: border-color 160ms ease; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input[aria-invalid=true] { border-color: var(--err); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input.rubric { display: inline-block; min-width: 150px; width: 150px; min-height: 44px; margin-top: 0; padding: 8px 10px; font-size: 13px; }
textarea { resize: vertical; line-height: 1.6; }
textarea.mono { font-family: var(--mono); font-size: 13px; }
button, .button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; background: var(--accent); color: var(--accent-text); font: inherit; font-size: 14px; font-weight: 600; line-height: 1.4; text-align: center; transition: background-color 160ms ease, border-color 160ms ease; }
button:hover, .button:hover { background: var(--accent-hover); text-decoration: none; }
button:active, .button:active { transform: translateY(1px); }
button.secondary, .button.secondary { background: var(--card); color: var(--text); border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { background: var(--bg); border-color: var(--muted); }
button:disabled { cursor: wait; opacity: .6; transform: none; }
button.small { padding: 8px 12px; font-size: 13px; }
button.link { background: none; color: var(--muted); padding: 10px 4px; font-weight: 400; }
button.link:hover { color: var(--text); }
.req { color: var(--err); }
.task-context { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; margin-bottom: 24px; }
.task-context p { margin: 0 0 4px; max-width: 75ch; }
.tasks { display: grid; gap: 12px; max-width: 900px; }
.task { padding: 0; margin-bottom: 0; }
.task summary { cursor: pointer; display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; min-height: 72px; padding: 20px 24px; }
.task summary::after { content: ''; width: 7px; height: 7px; border-bottom: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: rotate(45deg); margin-left: auto; flex-shrink: 0; }
.task[open] summary::after { transform: rotate(225deg); }
.task summary::-webkit-details-marker { display: none; }
.task[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 0; }
.task > p, .task > form { margin: 20px 24px; }
.task > form { max-width: 720px; }
.t-title { font-size: 16px; font-weight: 600; }
.t-skill { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 400; }
.task summary > .small { flex-basis: 100%; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); }
.badge.heavy { color: var(--warn); }
.form-actions { margin-top: 20px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.state { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; white-space: nowrap; }
.state.done { color: var(--ok); }
.state.error { color: var(--err); }
.state.limit, .state.cancelled { color: var(--warn); }
.state.running, .state.queued { color: var(--accent); }
.status-line { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.status-line > span { overflow-wrap: anywhere; }
.status-line p { flex-basis: 100%; margin: 0; }
.actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.actions form { margin: 0; }
.back-link { display: inline-block; font-size: 13px; margin-bottom: 20px; }
pre.result { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 13px; line-height: 1.65; margin: 16px 0 0; background: var(--bg); padding: 16px; border-radius: 10px; }
.files { padding-left: 18px; }
.files li { margin-bottom: 12px; overflow-wrap: anywhere; }
form.inline { display: inline; margin-left: 8px; }
details > summary { cursor: pointer; font-weight: 550; min-height: 32px; }
details[open] > summary { margin-bottom: 12px; }
.md { line-height: 1.7; overflow-wrap: anywhere; max-width: 85ch; margin-top: 24px; }
.md h1, .md h2, .md h3 { font-size: 18px; margin: 28px 0 12px; letter-spacing: -.01em; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 14px; font-variant-numeric: tabular-nums; }
.md th, .md td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.md pre { background: var(--bg); border-radius: 10px; padding: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 13px; line-height: 1.65; }
.md code { background: var(--bg); padding: 1px 4px; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.md ul, .md ol { padding-left: 24px; }
.md li { margin-bottom: 8px; }
.md blockquote { margin: 16px 0; padding-left: 16px; border-left: 1px solid var(--line); color: var(--muted); }
.export-menu { position: relative; font-size: 13px; }
.export-menu summary { color: var(--accent); padding: 8px 0; }
.export-menu ul { list-style: none; padding: 12px 16px; margin: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.export-menu li { padding: 6px 0; }
.site-footer { max-width: 1256px; margin: 0 auto; padding: 20px 32px; border-top: 1px solid var(--line); display: flex; gap: 8px 24px; justify-content: space-between; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.empty-state { text-align: center; padding: 44px 24px; }
.empty-state p { max-width: 65ch; margin: 12px auto 20px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); background: var(--text); color: var(--card); padding: 12px 20px; border-radius: 10px; font-size: 14px; z-index: 10; }
body.login { min-height: 100dvh; display: grid; place-items: center; }
.login-main { padding: 32px 20px; max-width: 440px; }
.card.narrow { padding: 32px; margin: 0; }
.login h1 { font-size: 25px; }
.login button { width: 100%; }
.login-note { text-align: center; margin-top: 20px; }
@media (max-width: 1000px) {
  .top { gap: 16px; padding: 16px 24px; }
  .top nav { order: 3; flex-basis: 100%; }
  .logout { margin-left: auto; }
  .metric { padding: 20px; }
  .metric .value { font-size: 26px; }
  .summary-grid { grid-template-columns: minmax(0, 1fr) 250px; gap: 20px; }
}
@media (max-width: 760px) {
  main { padding: 28px 20px 44px; }
  .summary-grid { grid-template-columns: minmax(0, 1fr); }
  .button.mobile-only { display: inline-flex; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .hide-narrow { display: none; }
  .actions { margin-left: 0; }
  .top nav { overflow-x: auto; min-width: 0; }
  .top nav a { white-space: nowrap; padding: 10px 12px; }
  .task summary { padding: 18px 20px; }
  .task > p, .task > form { margin: 20px; }
  .task .t-skill { display: none; }
}
@media (max-width: 420px) {
  main { padding: 24px 16px 40px; }
  h1 { font-size: 24px; }
  .top { padding: 14px 16px 8px; gap: 12px; }
  .brand .brand-title { font-size: 14px; }
  .top nav a { padding: 10px; }
  .head.row-between { align-items: flex-start; }
  .metric { padding: 18px 14px; }
  .metric .label { font-size: 12px; }
  .metric .value { font-size: 24px; }
  .metric .hint { font-size: 11px; }
  .card { padding: 20px; }
  .table-panel { padding: 20px 0 0; }
  .table-panel .section-head { padding: 0 20px; }
  .chart-panel { padding: 20px 12px; }
  .chart-panel .section-head, .chart-panel .chart-caption, .chart-panel > p, .chart-data { margin-left: 8px; margin-right: 8px; }
  .task { padding: 0; }
  .task summary { gap: 8px; }
  .filters .search-field { flex-basis: 100%; max-width: none; min-width: 0; }
  .filters label { min-width: 0; flex: 1; }
  .filters button { flex: none; }
  .sticky-save { gap: 8px; }
  .site-footer { padding: 20px 16px; }
  .card.narrow { padding: 24px; }
  .form-actions > button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; scroll-behavior: auto !important; }
}
