:root {
  color-scheme: dark;
  --bg: #080b10;
  --surface: #0e131b;
  --surface-2: #131a24;
  --surface-3: #18212d;
  --line: #252e3b;
  --line-strong: #364253;
  --text: #f3f6fb;
  --muted: #8c98aa;
  --brand: #5cddb0;
  --brand-strong: #37c891;
  --brand-soft: rgba(92, 221, 176, .11);
  --blue: #79a8ff;
  --blue-soft: rgba(121, 168, 255, .12);
  --warn: #f3bf62;
  --warn-soft: rgba(243, 191, 98, .12);
  --bad: #ff7b87;
  --bad-soft: rgba(255, 123, 135, .12);
  --sidebar: 238px;
  --ttoh-yellow: #ffdc19;
  --ttoh-yellow-strong: #ffc700;
  --ttoh-ink: #17150a;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 52% -22%, rgba(49, 154, 118, .13), transparent 33%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid rgba(92, 221, 176, .65);
  outline-offset: 2px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.18; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.3; letter-spacing: -.015em; }
strong { font-weight: 700; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.app-version { margin-top: 6px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px; }
.eyebrow { margin-bottom: 5px; color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(10, 14, 20, .97);
  padding: 24px 16px 18px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.02em; }
.brand span { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid rgba(92, 221, 176, .5);
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -.02em;
  box-shadow: inset 0 0 24px rgba(92, 221, 176, .06);
}
.brand-mark.large { width: 48px; height: 48px; margin-bottom: 20px; border-radius: 14px; font-size: 14px; }

.main-nav { display: grid; gap: 6px; }
.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #aeb8c7;
  padding: 0 12px;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.nav-item:hover { background: #111823; color: var(--text); }
.nav-item.active { border-color: rgba(92, 221, 176, .18); background: var(--brand-soft); color: var(--brand); }
.nav-item:active { transform: translateY(1px); }
.nav-icon { font-size: 17px; line-height: 1; text-align: center; }
.nav-badge { min-width: 21px; border-radius: 99px; background: #202a37; padding: 1px 6px; color: #cbd4df; font-size: 11px; text-align: center; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 18px 9px 2px; }
.ttoh-ad-slot { --ttoh-shift: 0px; }
.ttoh-ad-desktop { padding: 18px 0 0; }
.ttoh-ad-mobile { display: none; }
.ttoh-ad { position: relative; overflow: hidden; color: var(--ttoh-ink); border: 1px solid rgba(255, 232, 102, .8); background: radial-gradient(circle at 88% 8%, rgba(255, 255, 255, .62), transparent 25%), linear-gradient(145deg, #ffe857 0%, var(--ttoh-yellow) 48%, var(--ttoh-yellow-strong) 100%); box-shadow: 0 14px 36px rgba(255, 199, 0, .13); }
.ttoh-ad:after { content: ""; position: absolute; width: 82px; height: 82px; right: -44px; bottom: -47px; border: 15px solid rgba(23, 21, 10, .08); border-radius: 50%; pointer-events: none; }
.ttoh-ad-desktop .ttoh-ad { border-radius: 14px; padding: 14px; }
.ttoh-ad-link { position: relative; z-index: 1; display: block; color: inherit; text-decoration: none; }
.ttoh-ad-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.ttoh-home-link { position: relative; z-index: 2; color: var(--ttoh-ink); font-size: 12px; font-weight: 950; letter-spacing: -.025em; text-decoration: none; }
.ttoh-home-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.ttoh-sponsored { color: rgba(23, 21, 10, .58); font-size: 9px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.ttoh-ad-copy { transition: opacity .22s ease, transform .22s ease; }
.ttoh-ad.is-changing .ttoh-ad-copy { opacity: 0; transform: translateY(4px); }
.ttoh-kicker { margin: 0 0 5px; color: rgba(23, 21, 10, .62); font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.ttoh-title { display: -webkit-box; overflow: hidden; margin: 0; font-size: 15px; line-height: 1.23; letter-spacing: -.025em; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ttoh-description { display: -webkit-box; overflow: hidden; min-height: 34px; margin: 7px 0 11px; color: rgba(23, 21, 10, .73); font-size: 10px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ttoh-ad-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ttoh-meta { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px; }
.ttoh-chip { border: 1px solid rgba(23, 21, 10, .15); border-radius: 99px; background: rgba(255, 255, 255, .28); padding: 2px 6px; font-size: 8px; font-weight: 750; white-space: nowrap; }
.ttoh-cta { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 900; white-space: nowrap; }
.ttoh-cta-arrow { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: var(--ttoh-ink); color: var(--ttoh-yellow); transition: transform .18s ease; }
.ttoh-ad-link:hover .ttoh-cta-arrow { transform: translateX(2px); }
.ttoh-ad-controls { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 10px; }
.ttoh-dot { width: 16px; height: 3px; border: 0; border-radius: 99px; background: rgba(23, 21, 10, .2); padding: 0; cursor: pointer; }
.ttoh-dot.active { background: var(--ttoh-ink); }
.ttoh-close { position: absolute; z-index: 3; top: 7px; right: 7px; display: grid; width: 25px; height: 25px; place-items: center; border: 0; border-radius: 50%; background: rgba(23, 21, 10, .09); color: rgba(23, 21, 10, .68); cursor: pointer; }
.ttoh-close:hover { background: rgba(23, 21, 10, .16); color: var(--ttoh-ink); }
.ttoh-ad-desktop .ttoh-ad-topline { padding-right: 25px; }
.connection-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(140, 152, 170, .08); }
.connection-dot.online { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.connection-dot.offline { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.sidebar-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.sidebar-meta .app-version { margin-top: 0; }
.github-link { display: inline-grid; width: 25px; height: 25px; flex: 0 0 25px; place-items: center; border: 1px solid transparent; border-radius: 7px; color: var(--muted); transition: border-color .18s ease, background .18s ease, color .18s ease; }
.github-link:hover { border-color: var(--line-strong); background: var(--surface-soft); color: var(--text); }
.github-link svg { width: 16px; height: 16px; fill: currentColor; }

.workspace { min-height: 100vh; margin-left: var(--sidebar); padding: 0 34px 48px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 106px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(37, 46, 59, .78);
  background: rgba(8, 11, 16, .9);
  backdrop-filter: blur(18px);
}
.topbar-copy { display: flex; align-items: center; gap: 12px; }
.page-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions, .button-group { display: flex; align-items: center; gap: 9px; }
.page { display: none; max-width: 1480px; margin: 0 auto; padding-top: 28px; animation: page-in .18s ease both; }
.page.active { display: block; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.button, .icon-button, .text-button {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease, opacity .16s ease;
}
.button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 8px; border-radius: 9px; padding: 8px 13px; font-weight: 650; }
.button:hover, .icon-button:hover { border-color: var(--line-strong); background: var(--surface-3); }
.button:active, .icon-button:active { transform: translateY(1px); }
.button.primary { border-color: var(--brand); background: var(--brand); color: #06150f; }
.button.primary:hover { border-color: #7ce8c3; background: #7ce8c3; }
.button.ghost { background: transparent; }
.button.danger { border-color: rgba(255, 123, 135, .25); background: var(--bad-soft); color: #ff9da6; }
.button.small-button { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.icon-button { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 9px; font-size: 18px; }
.text-button { border: 0; background: transparent; color: var(--brand); padding: 4px; font-weight: 700; }
.wide-button { width: 100%; }
.mobile-only { display: none; }

.notice { max-width: 1480px; margin: 20px auto -6px; border: 1px solid rgba(243, 191, 98, .28); border-radius: 11px; background: var(--warn-soft); padding: 11px 14px; color: #f8d799; }

.panel, .metric-card {
  border: 1px solid var(--line);
  background: rgba(14, 19, 27, .94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .14);
}
.panel { border-radius: var(--radius); padding: 21px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.panel-heading.compact { align-items: center; margin-bottom: 17px; }
.panel-heading p:not(.eyebrow) { margin: 7px 0 0; }

.metric-grid { display: grid; gap: 12px; margin-bottom: 18px; }
.generate-metrics, .video-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.account-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metric-card { position: relative; overflow: hidden; min-height: 118px; border-radius: 14px; padding: 17px 18px; }
.metric-card span { display: block; color: #a9b3c1; font-size: 12px; }
.metric-card strong { display: block; margin: 8px 0 1px; font-size: 29px; line-height: 1; letter-spacing: -.04em; }
.metric-card small { color: var(--muted); font-size: 11px; }
.metric-card.accent { border-color: rgba(92, 221, 176, .28); background: linear-gradient(135deg, rgba(92, 221, 176, .13), rgba(14, 19, 27, .96) 60%); }
.metric-card.accent:after { content: ""; position: absolute; width: 90px; height: 90px; top: -48px; right: -32px; border: 18px solid rgba(92, 221, 176, .08); border-radius: 50%; }

.generate-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(290px, .72fr); gap: 18px; align-items: start; }
.generate-aside { display: grid; gap: 18px; }
.capability-chip { border: 1px solid rgba(92, 221, 176, .25); border-radius: 99px; background: var(--brand-soft); padding: 4px 9px; color: var(--brand); font-size: 11px; font-weight: 700; }
.mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 22px; }
.mode-button { display: flex; min-height: 67px; flex-direction: column; align-items: flex-start; justify-content: center; border: 1px solid var(--line); border-radius: 11px; background: #0b1017; color: var(--muted); padding: 10px 13px; cursor: pointer; }
.mode-button strong { color: #dce3ec; font-size: 13px; }
.mode-button span { margin-top: 2px; font-size: 10px; }
.mode-button:hover { border-color: var(--line-strong); }
.mode-button.active { border-color: rgba(92, 221, 176, .46); background: var(--brand-soft); color: var(--brand); }
.mode-button.active strong { color: var(--brand); }

.form-row { display: grid; gap: 13px; }
.two-columns { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 17px; color: #cdd5df; font-size: 12px; font-weight: 650; }
.field small { color: var(--muted); font-weight: 400; }
.field > span { display: flex; justify-content: space-between; gap: 10px; }
.field > span strong, .field small b { color: var(--brand); }
input:not([type="range"]):not([type="checkbox"]):not([type="file"]), textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0a0f16;
  color: var(--text);
  padding: 10px 11px;
}
input:not([type="range"]):not([type="checkbox"]):not([type="file"]), select { min-height: 42px; }
textarea { min-height: 148px; resize: vertical; line-height: 1.65; }
select { appearance: auto; }
input::placeholder, textarea::placeholder { color: #5f6a79; }
input[type="range"] { width: 100%; accent-color: var(--brand); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }

.upload-zone { display: grid; min-height: 120px; place-items: center; border: 1px dashed #364456; border-radius: 12px; background: rgba(10, 15, 22, .65); padding: 18px; color: var(--muted); text-align: center; cursor: pointer; }
.upload-zone:hover { border-color: rgba(92, 221, 176, .55); background: var(--brand-soft); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-zone strong { color: #dfe5ed; }
.upload-zone span:last-child { font-size: 11px; }
.upload-symbol { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--brand); font-size: 20px; }
.file-list { display: grid; gap: 7px; margin: 9px 0 17px; }
.file-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 9px; background: #0a0f16; padding: 8px 10px; }
.file-item div { min-width: 0; }
.file-item strong { display: block; overflow: hidden; color: #d9e0e8; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.file-item span { color: var(--muted); font-size: 10px; }
.file-kind { flex: 0 0 auto; border-radius: 5px; background: var(--blue-soft); padding: 3px 6px; color: var(--blue) !important; font-size: 9px !important; text-transform: uppercase; }

.parameter-note { display: flex; gap: 11px; border: 1px solid rgba(121, 168, 255, .2); border-radius: 11px; background: var(--blue-soft); padding: 12px 13px; color: #d5e2f8; }
.parameter-note p { margin: 3px 0 0; color: #9cacbf; font-size: 11px; }
.note-icon { display: grid; width: 21px; height: 21px; flex: 0 0 21px; place-items: center; border-radius: 50%; background: rgba(121, 168, 255, .18); color: var(--blue); font-size: 11px; font-weight: 800; }
.submit-button { width: 100%; min-height: 52px; justify-content: space-between; margin-top: 17px; padding-inline: 18px; }
.submit-button small { opacity: .7; }
.form-error { min-height: 19px; margin-top: 10px; color: var(--bad); font-size: 12px; white-space: pre-wrap; }

.empty-state { display: grid; min-height: 230px; place-content: center; color: var(--muted); padding: 22px; text-align: center; }
.empty-state > span { color: var(--brand); font-size: 28px; }
.empty-state strong { margin-top: 8px; color: #dbe2ea; }
.empty-state p { max-width: 260px; margin: 6px auto 0; font-size: 12px; }
.compact-empty { min-height: 205px; }
.task-focus { display: grid; gap: 13px; }
.task-focus-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.task-id { overflow: hidden; color: #bdc7d4; text-overflow: ellipsis; white-space: nowrap; }
.task-progress { height: 5px; overflow: hidden; border-radius: 99px; background: #202936; }
.task-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .25s ease; }
.task-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.task-meta div { border: 1px solid var(--line); border-radius: 8px; background: #0a0f16; padding: 8px; }
.task-meta span { display: block; color: var(--muted); font-size: 10px; }
.task-meta strong { display: block; margin-top: 2px; font-size: 12px; }
.task-error { border: 1px solid rgba(255, 123, 135, .23); border-radius: 9px; background: var(--bad-soft); padding: 10px; color: #ffabb3; font-size: 11px; overflow-wrap: anywhere; }

.quick-guide ol { display: grid; gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.quick-guide li { display: flex; gap: 11px; }
.quick-guide li > span { color: var(--brand); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.quick-guide li strong { color: #dbe2ea; font-size: 12px; }
.quick-guide li p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.recent-panel { margin-top: 18px; }
.recent-task-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.recent-task { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: #0a0f16; padding: 12px; }
.recent-task-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.recent-task p { display: -webkit-box; overflow: hidden; min-height: 36px; margin: 10px 0; color: #b6c0cd; font-size: 11px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.recent-task footer { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }

.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 3px 8px; color: #b7c1ce; font-size: 11px; white-space: nowrap; }
.pill:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.pill.ok:before { background: var(--brand); }
.pill.info:before { background: var(--blue); }
.pill.wait:before { background: var(--warn); }
.pill.bad:before { background: var(--bad); }

.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid rgba(37, 46, 59, .74); padding: 12px 10px; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody > tr:not(.detail-row):not(.subaccount-row):hover > td { background: rgba(255, 255, 255, .012); }
.accounts-table { min-width: 1060px; }
.video-table { min-width: 1040px; }
.cell-title { color: #e1e6ed; font-size: 12px; font-weight: 700; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions .button { min-height: 29px; padding: 4px 8px; font-size: 10px; }
.subaccount-row td { background: #0a0f16; padding: 10px; }
.subaccounts { display: grid; gap: 7px; }
.subaccounts-head, .sub-row { display: grid; grid-template-columns: minmax(230px, 1.25fr) 118px 88px 170px minmax(150px, .8fr); align-items: center; gap: 12px; }
.subaccounts-head { padding: 0 12px 3px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.sub-row { border: 1px solid rgba(37, 46, 59, .8); border-radius: 9px; padding: 10px 12px; }
.sub-name { min-width: 0; }
.sub-name div { min-width: 0; }
.sub-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-control { display: inline-flex; align-items: center; gap: 9px; min-height: 32px; color: #cbd4df; font-size: 10px; cursor: pointer; }
.schedule-control.disabled { cursor: not-allowed; color: var(--muted); }
.switch { position: relative; display: inline-flex; flex: 0 0 auto; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch-track { position: relative; display: block; width: 36px; height: 20px; border: 1px solid #3a4655; border-radius: 99px; background: #202834; transition: background .16s ease, border-color .16s ease, opacity .16s ease; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #a6b0be; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); transition: transform .16s ease, background .16s ease; }
.switch input:checked + .switch-track { border-color: var(--brand); background: var(--brand); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); background: #06150f; }
.switch input:focus-visible + .switch-track { outline: 2px solid rgba(92, 221, 176, .65); outline-offset: 2px; }
.switch input:disabled + .switch-track { border-color: #2b3440; background: #171d26; opacity: .58; }
.switch input:disabled + .switch-track .switch-thumb { background: #586271; }
.switch-label { white-space: nowrap; }
.sub-note { display: block; color: var(--muted); font-size: 10px; }
.sub-note.denied { color: #d1949a; }
.sub-error { display: block; margin-top: 3px; color: var(--bad); font-size: 10px; overflow-wrap: anywhere; }
.table-empty { padding: 42px !important; color: var(--muted); text-align: center; }

.filter-panel { margin-bottom: 14px; padding: 16px 18px; }
.analytics-toolbar { display: grid; gap: 12px; margin-bottom: 14px; padding: 15px 18px; }
.analytics-toolbar-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.range-switch { display: inline-flex; gap: 3px; border: 1px solid var(--line); border-radius: 10px; background: #090e15; padding: 3px; }
.range-button { min-height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); padding: 5px 12px; font-size: 11px; font-weight: 700; cursor: pointer; }
.range-button:hover { color: var(--text); }
.range-button.active { background: var(--surface-3); color: var(--brand); box-shadow: inset 0 0 0 1px rgba(92, 221, 176, .18); }
.speed-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 13px; color: var(--muted); font-size: 10px; }
.speed-legend span { display: inline-flex; align-items: center; gap: 6px; }
.speed-legend i { width: 9px; height: 9px; border-radius: 3px; }
.speed-good i { background: var(--brand); }
.speed-normal i { background: var(--warn); }
.speed-busy i { background: var(--bad); }
.analytics-scope { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 10px; }
.scope-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.recommendation-grid { display: grid; grid-template-columns: 1.2fr 1.2fr .8fr; gap: 12px; margin-bottom: 14px; }
.recommendation-card { display: flex; min-width: 0; min-height: 112px; align-items: flex-start; gap: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(14, 19, 27, .94); padding: 17px 18px; }
.recommendation-card > span { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 9px; font-weight: 900; }
.recommendation-card div { min-width: 0; }
.recommendation-card small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.recommendation-card strong { display: block; color: #edf2f7; font-size: clamp(16px, 1.45vw, 22px); line-height: 1.25; letter-spacing: -.025em; overflow-wrap: anywhere; }
.recommendation-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.recommendation-card.recommended { border-color: rgba(92, 221, 176, .28); background: linear-gradient(135deg, rgba(92, 221, 176, .11), rgba(14, 19, 27, .96) 64%); }
.recommendation-card.recommended > span { background: var(--brand-soft); color: var(--brand); }
.recommendation-card.avoid { border-color: rgba(255, 123, 135, .25); background: linear-gradient(135deg, rgba(255, 123, 135, .09), rgba(14, 19, 27, .96) 64%); }
.recommendation-card.avoid > span { background: var(--bad-soft); color: var(--bad); }
.recommendation-card.sample > span { background: var(--blue-soft); color: var(--blue); }
.hourly-chart-panel { min-width: 0; margin-bottom: 14px; }
.analytics-heading p.muted { margin: 5px 0 0; font-size: 10px; }
.hourly-duration-chart { position: relative; min-height: 410px; overflow: hidden; }
.hourly-duration-chart svg { display: block; width: 100%; height: 410px; overflow: visible; }
.chart-gridline line { stroke: rgba(140, 152, 170, .13); stroke-width: 1; }
.chart-gridline text, .hour-label, .hour-samples, .hour-value, .chart-axis-title { fill: var(--muted); font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 10px; }
.chart-gridline text { text-anchor: end; }
.hour-label, .hour-samples, .hour-value { text-anchor: middle; }
.hour-label { fill: #b9c3cf; font-size: 9px; font-weight: 700; }
.hour-samples { fill: #596575; font-size: 8px; }
.hour-value { fill: #cbd4df; font-size: 8px; font-weight: 700; }
.chart-axis-title { fill: #657184; text-anchor: middle; font-size: 9px; letter-spacing: .08em; }
.hour-bar { opacity: .72; transition: opacity .16s ease; }
.hour-bar-group.level-recommended .hour-bar { fill: var(--brand); }
.hour-bar-group.level-normal .hour-bar { fill: var(--warn); }
.hour-bar-group.level-busy .hour-bar { fill: var(--bad); }
.hour-bar-group:hover .hour-bar { opacity: 1; }
.no-data-mark { stroke: #34404e; stroke-width: 2; stroke-linecap: round; }
.chart-hitbox { fill: transparent; }
.hour-axis-hint { position: absolute; right: 4px; bottom: 1px; color: #596575; font-size: 9px; }
.chart-empty { display: grid; min-height: 360px; place-content: center; color: var(--muted); text-align: center; }
.chart-empty span { color: var(--brand); font-size: 30px; }
.chart-empty strong { margin-top: 7px; color: #dbe2ea; }
.chart-empty p { margin: 5px 0 0; font-size: 11px; }
.heatmap-panel { min-width: 0; }
.duration-heatmap { overflow: hidden; }
.heatmap-scroll { min-width: 880px; }
.heatmap-hours, .heatmap-row { display: grid; grid-template-columns: 58px repeat(24, minmax(28px, 1fr)); gap: 3px; }
.heatmap-hours { margin-bottom: 5px; }
.heatmap-hours span { color: #647083; font-size: 8px; text-align: center; }
.heatmap-row { align-items: center; margin-bottom: 3px; }
.heatmap-date { color: var(--muted); font-size: 9px; text-align: right; padding-right: 7px; }
.heat-cell { display: grid; min-width: 0; height: 26px; place-items: center; border: 1px solid rgba(37, 46, 59, .55); border-radius: 4px; background: #111721; color: rgba(255,255,255,.76); font-size: 7px; cursor: help; }
.heat-cell.level-recommended { border-color: rgba(92, 221, 176, .22); background: rgba(55, 200, 145, .5); }
.heat-cell.level-normal { border-color: rgba(243, 191, 98, .2); background: rgba(243, 191, 98, .46); }
.heat-cell.level-busy { border-color: rgba(255, 123, 135, .24); background: rgba(255, 123, 135, .52); }
.heat-cell.level-unknown { background: #0a0f16; }
.heatmap-empty { padding: 42px; color: var(--muted); text-align: center; }
.filter-row { display: grid; grid-template-columns: minmax(240px, 1fr) 170px 170px auto; align-items: end; gap: 12px; }
.video-filter-row { grid-template-columns: minmax(260px, 1fr) 180px auto; }
.filter-row .field { margin: 0; }
.toggle-field { display: inline-flex; min-height: 42px; align-items: center; gap: 8px; color: #c8d1dc; font-size: 12px; cursor: pointer; }

.log-list { display: grid; }
.log-entry { display: grid; grid-template-columns: 94px 72px minmax(220px, 1fr) minmax(150px, .4fr); gap: 12px; align-items: start; border-top: 1px solid rgba(37, 46, 59, .72); padding: 13px 2px; }
.log-entry:first-child { border-top: 0; }
.log-time { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.log-level { display: inline-flex; justify-content: center; border-radius: 5px; padding: 2px 6px; background: var(--blue-soft); color: var(--blue); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.log-level.success { background: var(--brand-soft); color: var(--brand); }
.log-level.warning { background: var(--warn-soft); color: var(--warn); }
.log-level.error { background: var(--bad-soft); color: var(--bad); }
.log-message strong { display: block; font-size: 12px; }
.log-message pre { overflow: hidden; margin: 4px 0 0; color: var(--muted); font: 10px/1.45 "SFMono-Regular", Consolas, monospace; text-overflow: ellipsis; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-context { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 14px; }
.pagination-summary { margin-right: auto; color: var(--muted); font-size: 11px; }
.pagination-pages { color: #c8d1dc; font-size: 11px; min-width: 76px; text-align: center; }
.pagination-size { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.pagination-size select { width: auto; min-width: 76px; height: 32px; padding: 5px 26px 5px 9px; }
.pagination .button { min-height: 32px; padding: 6px 10px; }

.task-main { max-width: 330px; }
.task-main .cell-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-prompt { display: -webkit-box; overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 10px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.model-label strong { display: block; font-size: 12px; }
.task-error-inline { display: block; max-width: 310px; margin-top: 5px; color: var(--bad); font-size: 10px; overflow-wrap: anywhere; }
.accounts-table .task-error-inline, .account-status-note { max-width: 310px; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.detail-row td { background: #0a0f16; padding: 0; }

.settings-panel { max-width: 1120px; margin: 0 auto; }
.settings-note { margin-bottom: 18px; }
.settings-note strong { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.settings-groups { display: grid; gap: 14px; }
.settings-group { border: 1px solid var(--line); border-radius: 13px; background: #0a0f16; padding: 17px; }
.settings-group-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.settings-group-heading h3 { margin: 0; font-size: 14px; }
.settings-group-heading p { max-width: 600px; margin: 0; color: var(--muted); font-size: 10px; text-align: right; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.setting-field { margin-bottom: 13px; }
.setting-field > span small { color: #596575; font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
.setting-toggle { display: flex; min-height: 59px; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(19, 26, 36, .6); margin-bottom: 13px; padding: 8px 11px; cursor: pointer; }
.setting-toggle strong, .setting-toggle small { display: block; }
.setting-toggle strong { color: #cdd5df; font-size: 12px; }
.setting-toggle small { margin-top: 2px; color: #596575; font: 9px "SFMono-Regular", Consolas, monospace; }
.settings-actions { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); background: rgba(14, 19, 27, .96); margin: 18px -2px -2px; padding: 15px 2px 2px; }
.settings-actions .muted { font-size: 11px; }
.api-key-manager { margin-bottom: 14px; }
.api-key-form { display: grid; grid-template-columns: minmax(160px, .7fr) minmax(260px, 1.3fr) auto; align-items: end; gap: 12px; }
.api-key-form .field { margin: 0; }
.api-key-buttons { align-self: end; flex-wrap: nowrap; }
.api-key-hint { margin: 10px 0 14px; font-size: 10px; }
.api-key-list { display: grid; gap: 8px; }
.api-key-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 9px; background: rgba(19, 26, 36, .6); padding: 10px 12px; }
.api-key-row strong, .api-key-row .cell-sub { display: block; }

.auth-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(5, 8, 12, .97); padding: 20px; }
.auth-card { width: min(430px, 100%); border: 1px solid var(--line); border-radius: 19px; background: var(--surface); padding: 29px; box-shadow: 0 32px 100px rgba(0, 0, 0, .45); }
.auth-card h1 { margin-bottom: 10px; font-size: 25px; }
.auth-card > .muted { margin-bottom: 24px; }
.auth-card .field { margin-bottom: 4px; }

dialog { width: min(570px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--text); padding: 23px; box-shadow: 0 28px 100px rgba(0, 0, 0, .6); }
dialog::backdrop { background: rgba(3, 5, 8, .76); backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field.wide { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: grid; width: min(380px, calc(100vw - 30px)); gap: 8px; }
.toast { border: 1px solid var(--line-strong); border-radius: 11px; background: #151d28; padding: 11px 13px; box-shadow: 0 18px 50px rgba(0, 0, 0, .38); animation: toast-in .2s ease both; }
.toast.success { border-color: rgba(92, 221, 176, .35); }
.toast.error { border-color: rgba(255, 123, 135, .4); }
.toast strong { display: block; font-size: 12px; }
.toast span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.mobile-backdrop { position: fixed; inset: 0; z-index: 15; background: rgba(0, 0, 0, .56); }

@media (max-width: 1180px) {
  .account-metrics { grid-template-columns: repeat(3, 1fr); }
  .recommendation-grid { grid-template-columns: 1fr 1fr; }
  .recommendation-card.sample { grid-column: 1 / -1; min-height: 90px; }
  .generate-layout { grid-template-columns: minmax(0, 1.4fr) minmax(270px, .75fr); }
  .recent-task-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar: 230px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 22px 0 70px rgba(0, 0, 0, .35); }
  .sidebar.open { transform: translateX(0); }
  .ttoh-ad-desktop { display: none; }
  .ttoh-ad-mobile { position: fixed; z-index: 55; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); left: 12px; display: block; transform: translateY(calc(120% + env(safe-area-inset-bottom))); transition: transform .28s cubic-bezier(.22, 1, .36, 1); pointer-events: none; }
  body.ttoh-mobile-visible .ttoh-ad-mobile { transform: none; pointer-events: auto; }
  .ttoh-ad-mobile .ttoh-ad { border-radius: 16px; padding: 11px 42px 11px 12px; box-shadow: 0 14px 44px rgba(0, 0, 0, .38), 0 0 0 1px rgba(255, 220, 25, .16); }
  .ttoh-ad-mobile .ttoh-ad-topline { margin-bottom: 5px; }
  .ttoh-ad-mobile .ttoh-home-link { font-size: 11px; }
  .ttoh-ad-mobile .ttoh-sponsored { padding-right: 6px; }
  .ttoh-ad-mobile .ttoh-description { display: none; }
  .ttoh-ad-mobile .ttoh-title { max-width: calc(100vw - 150px); font-size: 13px; -webkit-line-clamp: 1; }
  .ttoh-ad-mobile .ttoh-ad-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
  .ttoh-ad-mobile .ttoh-kicker { grid-column: 1 / -1; margin-bottom: -4px; }
  .ttoh-ad-mobile .ttoh-ad-footer { justify-content: flex-end; }
  .ttoh-ad-mobile .ttoh-meta { display: none; }
  .ttoh-ad-mobile .ttoh-ad-controls { position: absolute; right: 13px; bottom: 7px; margin: 0; }
  .ttoh-ad-mobile .ttoh-dot { width: 7px; height: 3px; }
  .ttoh-ad-mobile .ttoh-close { display: grid; }
  .workspace { margin-left: 0; padding-inline: 18px; }
  .mobile-only { display: grid; }
  .topbar { min-height: 92px; }
  .topbar-actions .muted { display: none; }
  .generate-layout { grid-template-columns: 1fr; }
  .generate-aside { grid-template-columns: 1fr 1fr; }
  .filter-row, .video-filter-row { grid-template-columns: 1fr 1fr; }
  .analytics-toolbar-main { align-items: stretch; flex-direction: column; }
  .speed-legend { justify-content: flex-start; }
  .settings-grid { grid-template-columns: 1fr; }
  .search-field { grid-column: 1 / -1; }
  .log-entry { grid-template-columns: 84px 65px 1fr; }
  .log-context { grid-column: 3; }
}

@media (max-width: 680px) {
  .api-key-form, .api-key-row { grid-template-columns: 1fr; }
  .workspace { padding-inline: 13px; padding-bottom: 30px; }
  body.ttoh-mobile-visible .workspace { padding-bottom: 124px; }
  .topbar { align-items: center; }
  .topbar .eyebrow, .page-subtitle, .topbar-actions .button { display: none; }
  .topbar h1 { font-size: 23px; }
  .page { padding-top: 18px; }
  .generate-metrics, .video-metrics, .account-metrics { grid-template-columns: repeat(2, 1fr); }
  .metric-card { min-height: 103px; padding: 14px; }
  .metric-card strong { font-size: 25px; }
  .panel { padding: 16px; border-radius: 13px; }
  .panel-heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .panel-heading.compact { flex-direction: row; align-items: center; }
  .mode-switch { grid-template-columns: 1fr; }
  .mode-button { min-height: 54px; }
  .two-columns, .generate-aside, .form-grid, .filter-row, .video-filter-row { grid-template-columns: 1fr; }
  .recommendation-grid { grid-template-columns: 1fr; }
  .recommendation-card.sample { grid-column: auto; }
  .range-switch { display: grid; grid-template-columns: repeat(3, 1fr); }
  .range-button { padding-inline: 7px; }
  .hourly-duration-chart, .duration-heatmap { margin-inline: -9px; overflow-x: auto; }
  .hourly-duration-chart svg { width: 920px; max-width: none; }
  .settings-group-heading { display: block; }
  .settings-group-heading p { margin-top: 5px; text-align: left; }
  .settings-actions { align-items: stretch; flex-direction: column; }
  .field.wide, .search-field { grid-column: auto; }
  .recent-task-grid { grid-template-columns: 1fr; }
  .log-entry { grid-template-columns: 75px 60px 1fr; gap: 8px; }
  .log-context { grid-column: 1 / -1; padding-left: 143px; }
  .pagination { justify-content: center; }
  .pagination-summary { width: 100%; margin-right: 0; text-align: center; }
  .button-group { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
