:root {
  color-scheme: light;
  --bg: #f9f9f9;
  --side: #ffffff;
  --side-text: #0f0f0f;
  --side-muted: #606060;
  --panel: #ffffff;
  --panel-2: #f2f2f2;
  --line: #e5e5e5;
  --line-2: #cccccc;
  --text: #0f0f0f;
  --muted: #606060;
  --faint: #909090;
  --brand: #ff0000;
  --find: #ff0000;
  --down: #065fd4;
  --up: #ff0000;
  --shorts: #ff0033;
  --danger: #cc0000;
  --ok: #ff0000;
  --link: #065fd4;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08);
  --font: Roboto, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --side-w: 220px;
  --top-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
a { color: var(--link); }

.login {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f9f9f9;
}
.login[hidden] { display: none; }
.login-card {
  width: min(360px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px 22px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  display: grid;
  gap: 10px;
}
.login-card .mark { width: 48px; height: 34px; }
.login-card h1 { font-size: 22px; }
.login-card p { color: var(--muted); font-size: 14px; }
.login-card input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  background: #fff;
}
.login-card button {
  height: 32px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 0 14px;
}
.login-card button:hover { background: #cc0000; border-color: #cc0000; }
.login-msg { min-height: 1.2em; }
.login-msg.bad { color: var(--danger); }

.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.nav {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  background: #fff;
  border-right: 1px solid var(--line);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 16px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.mark {
  width: 36px; height: 26px; border-radius: 0;
  display: grid; place-items: center;
  background: transparent;
  color: #fff;
  border: 0;
  box-shadow: none;
}
.mark svg { width: 36px; height: 26px; display: block; }
.brand b { display: block; font-size: 16px; font-weight: 650; letter-spacing: .2px; color: var(--side-text); }
.brand small { color: var(--side-muted); font-size: 12px; }
.menu { display: grid; gap: 4px; }
.menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  border: 0; background: transparent; color: #0f0f0f;
  border-radius: 10px; padding: 10px 10px;
  font-size: 15px; font-weight: 500;
}
.menu button .ico {
  width: 24px; height: 24px; display: grid; place-items: center; color: #0f0f0f;
}
.menu button .ico svg { width: 22px; height: 22px; display: block; }
.menu button:hover { background: #f2f2f2; color: #0f0f0f; }
.menu button.on {
  background: #f2f2f2;
  color: #0f0f0f;
  font-weight: 600;
  box-shadow: none;
}
.menu button.on .ico { color: #0f0f0f; }
.nav-note,
.side-status {
  margin-top: auto;
}
.side-status {
  min-width: 0;
  overflow: hidden;
  padding: 8px 2px 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 2px;
}
.side-status .health,
.side-status .services {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  margin: 0;
}
.side-status .health > div,
.side-status .svc {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 1px 2px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.side-status .health span,
.side-status .svc span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  white-space: nowrap;
}
.side-status .health b,
.side-status .svc b,
.side-status .disk b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.side-status .disk {
  margin: 0;
  padding: 0 2px;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.side-status .disk-top { margin: 0 0 4px; font-size: 12px; }
.side-status .disk .bar { width: 100%; height: 3px; margin: 0; }
.side-restart {
  width: 100%;
  height: 32px;
  margin-top: 4px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.side-restart:hover { background: #cc0000; border-color: #cc0000; }
.side-restart:disabled { opacity: .5; }
.side-restart-msg {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.side-restart-msg:empty { display: none; }
.side-restart-msg.ok { color: #0f0f0f; }
.side-restart-msg.bad { color: var(--danger); }

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.crumb { color: var(--faint); font-size: 12px; letter-spacing: .3px; margin-bottom: 2px; }
.topbar h1 { font-size: 18px; font-weight: 600; letter-spacing: -.2px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.live { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-family: var(--mono); }
.live i {
  width: 8px; height: 8px; border-radius: 50%; background: #c5cec9; flex: none;
}
.live i.on { background: var(--brand); box-shadow: 0 0 0 4px #ff000022; }
.ghost {
  height: 32px;
  border: 1px solid var(--line);
  background: #f2f2f2;
  color: #0f0f0f;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}
.ghost:hover { background: #e5e5e5; }
.ops-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}
.ops-bar > * { flex: 0 0 auto; }
.ops-bar > .ops-marquee { flex: 1 1 auto; min-width: 0; }
body[data-view="douyin"] .notices { display: none; }
.dy-panel {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 16px 22px;
  align-items: start;
  padding: 16px 18px 18px;
}
.dy-side { min-width: 0; }
.dy-dock { min-width: 0; }
.dy-panel:not(:has(.dy-list li)) { grid-template-columns: 1fr; }
.dy-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.dy-bar input {
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 16px;
}
.dy-bar button {
  flex: none;
  height: 32px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}
.dy-bar button:hover { background: #cc0000; border-color: #cc0000; }
.dy-msg { margin: 8px 2px 0; font-size: 13px; color: var(--muted); }
.dy-msg.bad { color: var(--danger); }
.dy-msg:empty { display: none; }
.dy-now {
  margin: 14px 0 0;
  font-size: 15px;
  font-weight: 600;
}
.dy-now[hidden] { display: none; }
.dy-now.go::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px #ff000022;
}
.dy-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; align-content: start; }
.dy-list:empty { display: none; }
.dy-list li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #e5e5e5;
  border-left: 3px solid #d0d0d0;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}
.dy-list li.go { border-left-color: var(--brand); }
.dy-list li.bad { border-left-color: var(--danger); }
.dy-list .row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dy-list .t { color: var(--muted); font-family: var(--mono); font-size: 12px; flex: none; }
.dy-list .u { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.dy-list .d { color: var(--muted); line-height: 1.4; }
.dy-title {
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.dy-list .s { font-weight: 600; }
.dy-list .s.bad { color: var(--danger); }
.dy-list .s.go { color: var(--brand); }
.dy-list a.u { color: var(--muted); }
.dy-redo {
  align-self: flex-start;
  margin-top: 2px;
  height: 32px;
  border: 1px solid var(--line);
  background: #f2f2f2;
  color: #0f0f0f;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}
.dy-redo:hover { background: #e5e5e5; }
.dy-redo:disabled { opacity: 0.6; }
.dy-meter {
  height: 6px;
  border-radius: 99px;
  background: #eee;
  overflow: hidden;
}
.dy-meter span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
}
.ops-marquee,
.ops-marquee * {
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
}
.ops-marquee { overflow: hidden; }
.ops-track { display: flex; width: max-content; align-items: center; }
.ops-track.run { animation: ops-run linear infinite; }
.ops-chunk {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.ops-chunk > * { flex: 0 0 auto; }
.ops-track.run .ops-chunk { padding-right: 48px; }
@keyframes ops-run {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.ops-bar button {
  height: 32px;
  border: 1px solid var(--line);
  background: #f2f2f2;
  color: #0f0f0f;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  flex: none;
}
.ops-bar button:hover { background: #e5e5e5; }
.ops-bar button.on {
  background: #fff;
  color: #0f0f0f;
  border-color: #ff0000;
}
.ops-bar button.on:hover { background: #fff; border-color: #ff0000; }
.ops-bar button:disabled { opacity: .5; }
.ops-msg {
  margin: 0;
  color: #606060;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.ops-msg:empty { display: none; }
.ops-msg.ok { color: #606060; }
.ops-msg.bad { color: var(--danger); }
.ops-help { margin-bottom: 14px; }
.ops-help p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.notices, .views { padding: 0 22px; }
.notices { padding-top: 8px; flex: none; }
.notices:empty, .notices:not(:has(:not([hidden]))) { display: none; padding: 0; }
.views {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-top: 8px;
  padding-bottom: 8px;
}
.view[data-view="overview"].on {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  gap: 8px;
}
.view[data-view="overview"] .stage-tabs { margin-bottom: 0; flex: none; }
.view[data-view="overview"] .stages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.view[data-view="overview"] .stage.on {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.view[data-view="overview"] .stage[data-stage="find"].on { overflow: hidden; }
.view[data-view="overview"] .stage[data-stage="down"] {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}
.view[data-view="overview"] .find-grid {
  height: 100%;
  min-height: 0;
  align-items: stretch;
}
.view[data-view="overview"] .find-col {
  min-height: 0;
  overflow: auto;
}
.view[data-view="overview"] .find-tools,
.view[data-view="overview"] .weight-box {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.view[data-view="overview"] .weight-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  margin-bottom: 8px;
}

.find-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.find-col .metrics { grid-template-columns: repeat(2, 1fr); }
.find-tools { display: grid; gap: 12px; align-content: start; }
.find-tools .weight-box {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f2f2f2;
}
.find-tools .weight-list { max-height: none; }
.src-list[hidden] { display: none; }
.detail { min-height: 0; }

.view { display: none; }
.view.on { display: block; }

.flow {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--mono);
}
.flow i { flex: 1; height: 1px; background: var(--line-2); max-width: 72px; }

.stage-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.stage-tabs button {
  flex: 1 1 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  height: 32px;
  border: 1px solid var(--line);
  background: #f2f2f2;
  color: #0f0f0f;
  border-radius: 999px;
  padding: 0 14px;
  margin-bottom: 0;
  min-width: 0;
  box-shadow: none;
  font-size: 13px;
  font-weight: 600;
}
.stage-tabs button:hover { background: #e5e5e5; color: #0f0f0f; }
.stage-tabs button b {
  font-size: 13px;
  font-weight: 600;
}
.stage-tabs button small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46%;
}
.stage-tabs button:hover { color: #0f0f0f; }
.stage-tabs button.on,
.stage-tabs button[data-stage-tab].on {
  background: #fff;
  border-color: #ff0000;
  color: #0f0f0f;
  box-shadow: none;
}
.stage-tabs button.on b { font-weight: 650; }
.stage-tabs button.on small { color: #606060; }
.stage-tabs button.working small { color: var(--up); }
.stage-tabs button[data-stage-tab="down"].working small { color: var(--down); }
.stage-tabs button[data-stage-tab="shorts"].working small { color: var(--shorts); }
.stage-tabs button.watching small { color: #606060; }
.stage-tabs button.error small { color: var(--danger); }
.stage-tabs button.idle small { color: var(--muted); }

.stages { display: block; }
.stage { display: none; }
.stage.on { display: block; }
.stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 16px 14px;
  min-width: 0;
  box-shadow: var(--shadow);
}
.stage[data-stage="find"] { --accent: var(--find); }
.stage[data-stage="down"] { --accent: var(--down); }
.stage[data-stage="up"] { --accent: var(--up); }
.stage[data-stage="shorts"] { --accent: var(--shorts); }
.stage.working { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.stage-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tag { font-family: var(--mono); font-size: 12px; letter-spacing: 1px; color: var(--accent); font-weight: 700; }
.state {
  font-size: 12px; padding: 3px 8px; border-radius: 999px;
  background: #eef2f0; color: var(--muted);
}
.state.working { background: color-mix(in srgb, var(--accent) 14%, #fff); color: var(--accent); }
.state.watching { background: #f2f2f2; color: #0f0f0f; }
.state.idle { color: var(--muted); }
.state.error { background: #fdecea; color: var(--danger); }
.stage h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }

.metrics, .row {
  display: grid; gap: 8px; margin-bottom: 12px;
}
.metrics { grid-template-columns: repeat(4, 1fr); }
.row { grid-template-columns: repeat(3, 1fr); }
.metrics div, .row div {
  background: #f2f2f2;
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  border: 1px solid #e3e8e5;
  min-width: 0;
}
.metrics em, .row em {
  display: block; font-style: normal; font-size: 24px; font-weight: 700;
  font-variant-numeric: tabular-nums; font-family: var(--mono);
  letter-spacing: -.4px;
  color: var(--text);
}
.metrics div:nth-child(2) em { color: var(--down); }
.metrics div:nth-child(3) em { color: #0f0f0f; }
.metrics div:nth-child(4) em { color: var(--danger); }
.metrics span, .row span { color: var(--muted); font-size: 12px; }
.find-rules {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.find-rules li {
  padding: 2px 8px;
  border-radius: 999px;
  background: #f2f2f2;
  border: 1px solid #e3e8e5;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.find-actions, .find-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.find-actions button, .find-form-actions button {
  height: 32px;
  border: 1px solid var(--line);
  background: #f2f2f2;
  color: #0f0f0f;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}
.find-actions button:hover, .find-form-actions button:hover { background: #e5e5e5; }
.find-form-actions button[type="submit"] {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.find-form-actions button[type="submit"]:hover { background: #cc0000; border-color: #cc0000; }
.find-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.find-form[hidden] { display: none; }
.find-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.find-form input, .find-form select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
  color: var(--text);
}
.find-check { grid-column: 1 / -1; display: flex !important; align-items: center; gap: 6px; }
.find-check input { width: auto; }
#find-cap-label[hidden] { display: none; }
.find-msg { margin: 0 0 8px; min-height: 1em; font-size: 13px; color: var(--muted); }
.find-msg.ok { color: var(--ok); }
.find-msg.bad { color: var(--danger); }
.weight-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.weight-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex: none;
}
.weight-head b { font-size: 16px; margin-right: auto; }
.weight-head .find-msg { margin: 0; min-height: 0; }
#save-weights {
  flex: none;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f2f2f2;
  color: #0f0f0f;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}
#save-weights:hover { background: #e5e5e5; }
.weight-head span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.weight-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  min-height: 0;
  overflow: auto;
  margin-bottom: 8px;
}
.weight-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f8f8;
}
.weight-row span { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weight-name { display: grid; gap: 1px; min-width: 0; white-space: normal; }
.weight-name b {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.weight-name small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.weight-name small.has { color: #0f0f0f; font-weight: 600; }
.weight-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
  background: #fff;
}
.weight-row em { font-style: normal; color: var(--muted); font-size: 13px; }
.weight-empty { margin: 0; color: var(--muted); font-size: 14px; grid-column: 1 / -1; }
.perf-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.hit-list, .src-list { display: grid; gap: 6px; margin: 8px 0; }
.hit-row, .src-row {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f8f8;
  font-size: 14px;
}
.hit-row { grid-template-columns: 64px minmax(0, 1fr); }
.src-row { grid-template-columns: 22px minmax(0, 1fr); }
.hit-row b { font-variant-numeric: tabular-nums; }
.hit-row span, .src-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hit-row small, .src-row small {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.src-row em { font-style: normal; color: var(--muted); text-align: right; }
.detail {
  margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55;
  min-height: 2.6em; overflow-wrap: anywhere;
}

.bar {
  height: 4px; background: #e5e5e5; border-radius: 99px; overflow: hidden; margin: 0 0 12px;
}
.bar i {
  display: block; height: 100%; width: 0%;
  background: var(--accent, var(--ok));
  border-radius: inherit;
}

.next-box {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  background: #f8f8f8; border: 1px solid #e3ebe6;
}
.next-label { font-size: 12px; letter-spacing: .8px; color: var(--faint); margin-bottom: 4px; font-family: var(--mono); }
.next-title {
  font-size: 15px; font-weight: 600; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.next-meta { margin-top: 6px; font-size: 13px; color: var(--muted); }
.shorts-box .phase { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e5e5e5; }
.phase-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 6px; }
.phase-row span { color: #5d6b64; }
.phase-row em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.phase-bar { margin: 0 0 6px; height: 4px; }
.phase[data-phase="cut"] { --accent: #0f0f0f; }
.phase[data-phase="upload"] { --accent: #065fd4; }
.phase.on .phase-row span { color: var(--text); }
.phase-meta { font-size: 13px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; min-height: 1.2em; }

.hist { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e5e5e5; display: grid; gap: 10px; }
.hist-list {
  list-style: none; margin: 0; padding: 0;
  max-height: min(52vh, 520px); overflow-y: auto;
  display: grid; gap: 4px;
}
.hist-list li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  font-size: 13px; line-height: 1.45; color: #3d4a44;
  padding: 5px 8px; border-radius: 6px; background: #f8f8f8;
  border: 1px solid #e5e5e5;
}
.hist-list li .res {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: #0f0f0f;
  border: 1px solid #e5e5e5;
  background: #f2f2f2;
  border-radius: 999px;
  padding: 0 6px;
  white-space: nowrap;
}
.hist-list li .res.low {
  color: #b45309;
  border-color: #f0d0b0;
  background: #fff6ee;
}
.hist-list li .t { color: #6b7a73; margin-right: 6px; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.hist-list li a { color: #065fd4; text-decoration: none; }
.hist-list li a:hover { text-decoration: underline; }
#down-hist-today,
#down-hist-total,
#up-hist-today,
#up-hist-total {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr);
  overflow-x: hidden;
}
#down-hist-today li,
#down-hist-total li,
#up-hist-today li,
#up-hist-total li {
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
#down-hist-today li .t,
#down-hist-total li .t,
#up-hist-today li .t,
#up-hist-total li .t,
#down-hist-today li .res,
#down-hist-total li .res,
#up-hist-today li .res,
#up-hist-total li .res,
#down-hist-today li .up-flag,
#down-hist-total li .up-flag { flex: none; margin-left: 0; }
#down-hist-today li .hist-title,
#down-hist-total li .hist-title,
#up-hist-today li .hist-title,
#up-hist-total li .hist-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hist-list li .up-flag {
  margin-left: auto;
  font-size: 12px;
  border-radius: 999px;
  padding: 0 6px;
  white-space: nowrap;
  background: #eef2f0;
  color: #5a6b63;
}
.hist-list li .up-flag.uploaded { background: #0f0f0f; color: #fff; }
.badge.ok { background: #f2f2f2; color: #0f0f0f; }
.hist-list li .up-flag.uploading { background: #eef5fb; color: #065fd4; }
.hist-list li .up-flag.failed { background: #fdecea; color: var(--danger); }
.hist-list .empty { color: var(--muted); background: transparent; border: none; padding: 2px 0; }

.quota-banner {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: #fff6f1; border: 1px solid #f0cfc4; color: #8a3d28;
}
.quota-banner[hidden] { display: none; }
.quota-banner b { display: block; font-size: 14px; font-weight: 600; color: #c0563a; margin-bottom: 4px; }
.quota-banner p { margin: 0; font-size: 13px; line-height: 1.45; color: #8a4a38; overflow-wrap: anywhere; }

.wait-banner {
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.wait-label { color: #5d7a8a; font-size: 13px; white-space: nowrap; }
.wait-banner b {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  color: #065fd4;
  white-space: nowrap;
  display: inline-block;
  min-width: 8ch;
}
.wait-banner p {
  margin: 0;
  display: inline;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}
.wait-banner[hidden] { display: none; }

.alert {
  margin-bottom: 6px; padding: 4px 10px; border-radius: 8px;
  background: #fff6f1; border: 1px solid #f0cfc4; color: #8a3d28; font-size: 13px;
}
.alert[hidden] { display: none; }
.alert p {
  margin: 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.health > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
  box-shadow: var(--shadow);
}
.health span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.health b { font-size: 15px; font-weight: 600; }
.health b.warn { color: var(--danger); }

.services {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.svc {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
}
.svc span { color: var(--muted); display: block; margin-bottom: 4px; font-family: var(--mono); }
.svc b { font-size: 15px; font-weight: 600; }
.svc.ok b { color: #0f0f0f; }
.svc.bad b { color: var(--danger); }
.svc.unknown b { color: var(--muted); }

.disk {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
}
.disk.warn { border-color: #f0cfc4; background: #fff8f5; }
.disk-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.disk-top span { color: var(--muted); }
.disk .bar { margin: 0; --accent: #ff0000; }
.disk.warn .bar { --accent: var(--danger); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.panel-h, .log-top, .filters-top.panel-h {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: .4px; color: var(--faint); margin-bottom: 2px;
}
.panel-h h2, .files h2 { font-size: 16px; font-weight: 600; }
.files .panel-h { border-bottom: 0; padding-bottom: 0; }

.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px;
}
.tabs button {
  height: 32px;
  border: 1px solid var(--line);
  background: #f2f2f2;
  color: #0f0f0f;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.tabs button:hover { background: #e5e5e5; }
.tabs button.on { color: #0f0f0f; border-color: #ff0000; background: #fff; }

.list-head {
  display: flex; justify-content: space-between;
  padding: 0 16px 8px;
  color: var(--faint); font-size: 12px; letter-spacing: .2px;
  border-bottom: 1px solid var(--line);
}
.list { display: grid; }
.card {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.card:last-child { border-bottom: 0; }
.card:hover { background: #f4f7f5; }
.card .name { font-size: 15px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; min-width: 0; }
.card .meta {
  margin-top: 0;
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px;
  color: var(--muted); font-size: 13px; flex: none; max-width: 52%;
}
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 999px; background: #eef2f0; color: #3d4a44;
}
.badge.size { color: #065fd4; background: #eef5fb; }
.badge.res {
  font-family: var(--mono);
  color: #0f0f0f;
  background: #f2f2f2;
  border: 1px solid #e5e5e5;
}
.badge.res.low {
  color: #b45309;
  background: #fff6ee;
  border-color: #f0d0b0;
}
.badge.partial { background: #fff6e8; color: #b86e12; }
.badge.fail { background: #fdecea; color: var(--danger); }
.badge.retry { background: #fff8e6; color: #a16207; }
.badge.ok { background: #f2f2f2; color: #0f0f0f; }
.empty { color: var(--muted); font-size: 14px; padding: 28px 16px; text-align: center; }

.log { display: flex; flex-direction: column; min-height: calc(100vh - 180px); }
.log-top span:last-child { color: var(--muted); font-size: 13px; }
pre {
  margin: 0; padding: 14px 16px 18px; flex: 1;
  overflow: auto; max-height: none; min-height: 420px;
  font-size: 13px; line-height: 1.55; color: #2c3a34;
  white-space: pre-wrap; font-family: var(--mono);
  background: #f8f8f8;
}

.system-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.account-facts {
  list-style: none;
  margin: 0;
  padding: 6px 0 0;
}
.account-facts li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  line-height: 1.45;
}
.account-facts span { color: var(--muted); }
.account-form { padding: 12px 16px 16px; display: grid; gap: 8px; }
.account-form label { font-size: 13px; color: var(--muted); }
.account-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  background: #f8f8f8;
}
.account-form-actions { display: flex; align-items: center; gap: 10px; }
.account-form-actions button {
  height: 32px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 0 14px;
}
.account-form-actions button:hover { background: #cc0000; border-color: #cc0000; }
.account-msg { font-size: 13px; color: var(--muted); }
.account-msg.ok { color: var(--ok); }
.account-msg.bad { color: var(--danger); }
.auth, .filters { font-size: 14px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; }
.auth-label { color: var(--muted); display: block; font-size: 12px; margin-bottom: 3px; }
.auth b.ok { color: var(--ok); }
.auth b.bad { color: var(--danger); }
.auth button, .auth-go {
  height: 32px;
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 30px;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}
.auth button:hover, .auth-go:hover { background: #cc0000; border-color: #cc0000; }
.auth button:disabled { opacity: .5; cursor: default; }
.auth-go.loading { opacity: .5; pointer-events: none; }
.auth-step { padding: 0 16px 16px; }
.auth-step[hidden] { display: none; }
.auth-step p { margin: 0 0 8px; line-height: 1.5; color: var(--muted); }
.auth-row { display: flex; gap: 8px; }
.auth-row input {
  flex: 1; min-width: 0; background: #fff; color: inherit; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 14px;
}
.auth-msg { min-height: 1em; }
.auth-msg.ok { color: var(--ok); }
.auth-msg.bad { color: var(--danger); }
.auth-link a { word-break: break-all; font-size: 13px; }

.filters ul {
  list-style: none; margin: 0; padding: 6px 0 10px;
}
.filters li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 16px;
  line-height: 1.45;
  border-top: 1px solid #e5e5e5;
}
.filters li span { color: var(--muted); }
.filters-top small { color: var(--muted); font-size: 12px; text-align: right; }

.statusbar {
  position: sticky;
  bottom: 0;
  flex: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 22px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--side);
  color: var(--side-muted);
  font-size: 12px;
  font-family: var(--mono);
}

@media (max-width: 1100px) {
  .system-grid { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
  .ov-meta,
  .find-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  html, body, .shell, .workspace { height: auto; min-height: 100%; overflow: auto; }
  .views { overflow: visible; }
  .view[data-view="overview"].on,
  .view[data-view="overview"] .stage.on,
  .view[data-view="overview"] .stage[data-stage="find"].on { height: auto; overflow: visible; display: block; }
  .view[data-view="overview"] .stage[data-stage="down"].on {
    overflow-x: hidden;
    max-width: 100%;
    min-width: 0;
  }
  .view[data-view="overview"].on { display: block; }
  .view[data-view="overview"] .weight-list { max-height: 46vh; }
  .shell { display: block; }
  .nav {
    position: fixed;
    top: auto; bottom: 0; left: 0; right: 0;
    height: auto;
    z-index: 20;
    flex-direction: row;
    padding: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
    background: #fff;
    backdrop-filter: blur(12px);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .brand, .nav-note, .side-status { display: none; }
  .menu { grid-template-columns: repeat(5, 1fr); width: 100%; gap: 0; }
  .menu button {
    flex-direction: column; gap: 2px;
    justify-content: center;
    border-radius: 0;
    padding: 8px 2px 10px;
    font-size: 12px;
  }
  .menu button.on { box-shadow: inset 0 -2px 0 #ff0000; color: #0f0f0f; background: transparent; }
  .workspace { padding-bottom: 62px; }
  .topbar {
    height: auto;
    padding: 10px 14px;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .titles { flex: 1 1 auto; min-width: 0; order: 1; }
  .top-actions { display: contents; }
  #refresh, #logout { order: 2; flex: none; }
  .live { order: 3; flex: 1 1 100%; min-width: 0; }
  .topbar h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .live span { max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .notices, .views { padding-left: 14px; padding-right: 14px; }
  .statusbar { display: none; }
  .card { flex-direction: column; gap: 8px; }
  .card .meta { max-width: none; justify-content: flex-start; }
  .list-head { display: none; }
  .stage-tabs { gap: 4px; }
  .stage-tabs button {
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 6px 2px;
  }
  .stage-tabs button b,
  .stage-tabs button small {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .stage-tabs button b { font-size: 13px; }
  .stage-tabs button small { font-size: 12px; }
  .ops-bar { flex-wrap: wrap; gap: 6px; }
  .stage-tabs button { height: auto; min-height: 32px; }
  .ops-bar button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 4px;
    white-space: nowrap;
  }
  .ops-bar > .ops-marquee { flex: 1 1 100%; min-height: 1.4em; }
  .metrics em, .row em {
    font-size: 16px;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .row em { font-size: 13px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .weight-list { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
  .dy-panel { grid-template-columns: 1fr; padding: 14px; }
  .dy-list { margin-top: 4px; }
  body[data-view="douyin"] .dy-dock {
    position: fixed;
    z-index: 18;
    left: 0;
    right: 0;
    bottom: calc(62px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    margin: 0;
    padding: 8px 12px;
    background: #fff;
    border-top: 1px solid var(--line);
  }
  body[data-view="douyin"] .dy-msg { margin: 0 2px; }
  body[data-view="douyin"] .dy-now { margin-top: 0; }
  body[data-view="douyin"] .dy-panel { padding-bottom: 78px; }
}
