:root {
  --bg: #f2f5f4;
  --panel: #ffffff;
  --ink: #14211f;
  --muted: #6b7c78;
  --line: #e4e9e7;
  --line-strong: #d3dcda;
  --brand: #0f766e;
  --brand-dark: #0b4f4a;
  --brand-soft: #e6f5f1;
  --side: #0b241f;
  --side-muted: #8fb0a8;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --serious: #c2410c;
  --serious-soft: #fff7ed;
  --suggest: #1d4ed8;
  --suggest-soft: #eff6ff;
  --shadow: 0 16px 44px rgba(11, 36, 31, .08);
  --shadow-soft: 0 4px 16px rgba(11, 36, 31, .05);
  --radius: 18px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
          "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
svg { display: block; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.file-warning {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 100; background: #fffbeb; border: 1px solid #fcd34d;
  color: #92400e; border-radius: 10px; padding: 9px 14px;
  font-size: 12px; box-shadow: var(--shadow-soft);
}
.file-warning code { background: rgba(146, 64, 14, .08); padding: 1px 4px; border-radius: 4px; }
.file-warning a { color: #92400e; }

/* ---------- layout ---------- */
.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0c2823 0%, #081d19 100%);
  color: #e6f2ee;
  padding: 22px 16px 18px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(94, 234, 212, .1);
  border: 1px solid rgba(94, 234, 212, .22);
  color: #5eead4;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 17px; letter-spacing: .04em; }
.brand-text small { font-size: 11px; color: var(--side-muted); margin-top: 3px; letter-spacing: .02em; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; color: #b9d2cc;
  padding: 11px 12px; border-radius: 11px; text-align: left;
  transition: background .18s ease, color .18s ease;
}
.nav-item svg { width: 18px; height: 18px; opacity: .9; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.is-active {
  background: rgba(94, 234, 212, .12);
  color: #d8fff6;
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, .16);
}

.side-note {
  margin-top: 28px; padding: 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
}
.side-note-eyebrow { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: #5eead4; }
.side-note p { margin: 7px 0 0; font-size: 12px; line-height: 1.65; color: #a9c4bd; }

.sidebar-foot {
  margin-top: auto; padding: 14px 8px 0;
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--side-muted);
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.ver { margin-left: auto; opacity: .7; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; flex: none; }
.live-dot.is-on { background: #5eead4; box-shadow: 0 0 0 3px rgba(94, 234, 212, .14); }
.live-dot.is-off { background: #f87171; }

/* ---------- main / topbar ---------- */
.main { min-width: 0; padding: 26px 34px 60px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.topbar-title h1 { font-size: 25px; letter-spacing: -.02em; margin: 0; }
.topbar-title p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.account-wrap { position: relative; }
.account-btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); border-radius: 999px; padding: 5px 10px 5px 5px;
  cursor: pointer; font-size: 13px;
}
.account-btn:hover { border-color: #9bb8ad; }
.account-avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #0b4f3c; color: #fff; font-size: 12px; font-weight: 700;
}
.account-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-caret { color: var(--muted); font-size: 10px; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 270px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(10, 50, 35, .16);
  padding: 8px; z-index: 80;
}
.account-menu-head { padding: 10px 10px 6px; font-weight: 700; font-size: 13px; color: var(--ink); }
.account-menu-list { display: grid; gap: 3px; max-height: 220px; overflow: auto; }
.account-menu-item {
  text-align: left; border: 0; background: transparent; border-radius: 9px; padding: 9px 10px;
  cursor: pointer; display: grid; gap: 2px;
}
.account-menu-item:hover { background: #f2f8f5; }
.account-menu-item.is-active { background: #e8f4ee; }
.account-menu-item strong { font-size: 13px; color: var(--ink); }
.account-menu-item small { font-size: 11px; color: var(--muted); }
.account-menu-empty { padding: 10px; font-size: 12px; color: var(--muted); }
.account-menu-sep { height: 1px; background: var(--line); margin: 7px 4px; }
.account-menu-note { padding: 4px 10px 7px; font-size: 11px; color: var(--muted); }
.account-menu-action {
  width: 100%; text-align: left; border: 0; background: transparent; border-radius: 9px;
  padding: 9px 10px; cursor: pointer; color: var(--ink); font-size: 13px;
}
.account-menu-action:hover { background: #f2f8f5; }
.env-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 12px;
  font-size: 12px; color: var(--muted);
}
.env-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.env-pill.is-auth .dot { background: #0ea5e9; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 11px; color: var(--muted);
  transition: color .18s, border-color .18s, transform .18s;
}
.icon-btn:hover { color: var(--brand); border-color: #b9d9d3; transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- cards / typography ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-soft);
}
.card-head { margin-bottom: 18px; }
.card-head.inline { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.card-head h2 { font-size: 18px; margin: 3px 0 0; letter-spacing: -.01em; }
.card-head p { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; }
.eyebrow { font-size: 10px; letter-spacing: .18em; color: var(--brand); font-weight: 700; }

/* ---------- hero ---------- */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .9fr); gap: 20px; align-items: start; }

.dropzone {
  position: relative;
  border: 1.5px dashed #c8d7d2;
  border-radius: 14px;
  background: #f8fbfa;
  padding: 34px 20px;
  text-align: center;
  transition: border-color .18s, background .18s, transform .18s;
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-drag {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.dropzone.is-drag { transform: scale(1.005); }
.drop-icon {
  width: 46px; height: 46px; margin: 0 auto 12px;
  border-radius: 13px; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line);
  color: var(--brand);
}
.drop-icon svg { width: 24px; height: 24px; }
.drop-title { font-weight: 600; font-size: 14.5px; }
.drop-title span { color: var(--brand); }
.drop-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }

.file-card {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; padding: 12px 14px;
  border: 1px solid #cfe6df; background: #f4fbf8; border-radius: 13px;
  animation: rise .25s ease both;
}
.file-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #fff; color: var(--brand); border: 1px solid var(--line); }
.file-icon svg { width: 19px; height: 19px; }
.file-meta { display: flex; flex-direction: column; min-width: 0; }
.file-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta span { font-size: 11.5px; color: var(--muted); }
.file-remove { margin-left: auto; width: 32px; height: 32px; }

.options { margin: 18px 0 8px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px;
  background: #fbfcfc; cursor: pointer;
}
.switch-copy { display: flex; flex-direction: column; }
.switch-copy strong { font-size: 13px; }
.switch-copy small { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 42px; height: 24px; border-radius: 999px; background: #d8e1de;
  position: relative; flex: none; transition: background .18s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .22); transition: transform .18s;
}
.switch-row input:checked + .switch { background: var(--brand); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; border: 1px solid transparent;
  padding: 11px 16px; font-weight: 600; font-size: 13.5px;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(15, 118, 110, .22); }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-primary:disabled { background: #c4d3cf; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #b9d9d3; color: var(--brand); }
.btn-block { width: 100%; margin-top: 6px; padding: 13px 16px; }

/* ---------- progress ---------- */
.progress { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); animation: rise .2s ease both; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; }
.progress-head span { color: var(--muted); }
.progress-head strong { color: var(--brand); font-variant-numeric: tabular-nums; }
.progress-bar { height: 7px; border-radius: 999px; background: #e8efec; overflow: hidden; margin-top: 8px; }
.progress-bar.large { height: 10px; margin-top: 16px; }
.progress-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #0f766e, #34d399); transition: width .3s ease; }
.progress-steps { list-style: none; display: flex; gap: 10px; padding: 0; margin: 12px 0 0; flex-wrap: wrap; }
.progress-steps li { font-size: 11px; color: #9aaaa5; display: inline-flex; align-items: center; gap: 5px; }
.progress-steps i { width: 6px; height: 6px; border-radius: 50%; background: #d5dfdb; }
.progress-steps li.is-done { color: var(--brand); }
.progress-steps li.is-done i { background: var(--brand); }
.progress-steps li.is-active { color: var(--ink); }
.progress-steps li.is-active i { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .14); }

.error-box {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: var(--danger-soft); border: 1px solid #fecaca; color: #991b1b;
  font-size: 12.5px;
}
.btn-link {
  border: 0; background: transparent; color: #1d4ed8; padding: 0 2px;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline;
}
.btn-link:hover { color: #1e3a8a; }

/* ---------- flow card ---------- */
.flow-card { background: linear-gradient(180deg, #ffffff, #f8fbfa); }
.flow { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 14px; }
.flow li { display: flex; gap: 12px; }
.flow li > span {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  color: var(--brand); background: var(--brand-soft); border: 1px solid #d2eae4;
}
.flow div strong { font-size: 13px; }
.flow div p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
.privacy {
  margin-top: 20px; padding: 13px; border-radius: 13px;
  background: #f2f7f5; border: 1px solid #e0ebe7;
  display: flex; gap: 10px; align-items: flex-start;
}
.privacy svg { width: 17px; height: 17px; color: var(--brand); flex: none; margin-top: 2px; }
.privacy p { margin: 0; font-size: 11.5px; color: var(--muted); }

/* ---------- result ---------- */
.result { margin-top: 30px; animation: rise .35s ease both; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.result-head h2 { font-size: 22px; margin: 3px 0 0; letter-spacing: -.02em; }
.result-head p { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }
.stat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 15px;
  padding: 15px 16px; box-shadow: var(--shadow-soft);
}
.stat .label { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .label i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 11px; color: var(--muted); }
.stat.is-block .value { color: var(--danger); }
.stat.is-block .label i { background: var(--danger); }
.stat.is-serious .value { color: var(--serious); }
.stat.is-serious .label i { background: var(--serious); }
.stat.is-suggest .value { color: var(--suggest); }
.stat.is-suggest .label i { background: var(--suggest); }

.download-card { margin-bottom: 18px; }
.download-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.download {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 14px; border-radius: 13px;
  border: 1px solid var(--line); background: #fbfcfc;
  text-decoration: none; color: var(--ink);
  transition: border-color .18s, background .18s, transform .18s;
}
.download:hover { border-color: #b9d9d3; background: #f4fbf8; transform: translateY(-1px); }
.download.is-primary { border-color: #bfe3da; background: var(--brand-soft); }
.download .dl-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line); color: var(--brand); flex: none;
}
.download .dl-icon svg { width: 19px; height: 19px; }
.download div { display: flex; flex-direction: column; min-width: 0; }
.download strong { font-size: 12.5px; }
.download span { font-size: 11px; color: var(--muted); }
.download.is-disabled { opacity: .5; pointer-events: none; }

/* ---------- issue panel ---------- */
.issue-panel { padding: 0; overflow: hidden; }
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  background: #fbfcfc; flex-wrap: wrap;
}
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.filter strong { font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums; }
.filter.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter.is-active strong { color: #fff; }
.filter.filter-block.is-active { background: var(--danger); border-color: var(--danger); }
.filter.filter-serious.is-active { background: var(--serious); border-color: var(--serious); }
.filter.filter-suggest.is-active { background: var(--suggest); border-color: var(--suggest); }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.search {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 7px 10px; min-width: 240px;
}
.search svg { width: 16px; height: 16px; color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 12.5px; }
select {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 7px 9px; font-size: 12.5px; color: var(--muted);
}

.issue-list { display: flex; flex-direction: column; }
.issue-card {
  display: flex; gap: 14px; padding: 16px 20px;
  border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background .15s;
}
.issue-card:last-child { border-bottom: 0; }
.issue-card:hover { background: #f8fbfa; }
.issue-rail { width: 3px; border-radius: 999px; background: var(--line-strong); flex: none; }
.issue-card.level-block .issue-rail { background: var(--danger); }
.issue-card.level-serious .issue-rail { background: var(--serious); }
.issue-card.level-suggest .issue-rail { background: var(--suggest); }
.issue-main { min-width: 0; flex: 1; }
.issue-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag {
  font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  background: #f1f5f4; color: var(--muted); font-weight: 600;
}
.tag.block { background: var(--danger-soft); color: var(--danger); }
.tag.serious { background: var(--serious-soft); color: var(--serious); }
.tag.suggest { background: var(--suggest-soft); color: var(--suggest); }
.rule-code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10.5px; color: var(--muted); background: #f4f7f6; padding: 1px 6px; border-radius: 5px; }
.ai-badge { font-size: 10px; color: #7c3aed; background: #f5f3ff; border-radius: 999px; padding: 1px 7px; font-weight: 700; letter-spacing: .04em; }
.verify { font-size: 10px; border-radius: 999px; padding: 1px 7px; font-weight: 700; letter-spacing: .04em; }
.verify.confirmed { color: #047857; background: #ecfdf5; }
.verify.doubtful { color: #b45309; background: #fffbeb; }
.issue-top h3 { font-size: 13.5px; margin: 0; font-weight: 600; }
.issue-section { margin: 5px 0 0; font-size: 11.5px; color: var(--muted); }
.issue-quote {
  margin: 9px 0 0; padding: 9px 12px; border-left: 2px solid #d9e5e1;
  background: #f8fbfa; border-radius: 0 8px 8px 0;
  font-size: 12px; color: #3d4d49; overflow-wrap: anywhere;
}
.issue-detail { margin: 8px 0 0; font-size: 12px; color: #4d5d59; }
.issue-feedback {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 11px; padding-top: 9px; border-top: 1px dashed #e6eeeb;
}
.fb-label { font-size: 10.5px; color: var(--muted); margin-right: 2px; }
.fb-btn {
  border: 1px solid #dbe6e2; background: #fff; color: #52635e;
  border-radius: 999px; padding: 3px 10px; font-size: 11px; cursor: pointer;
}
.fb-btn:hover { border-color: #b8cec6; background: #f7fbf9; }
.fb-btn.accept.active { background: #ecfdf5; border-color: #86efac; color: #047857; font-weight: 700; }
.fb-btn.reject.active { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; font-weight: 700; }
.fb-btn.review.active { background: #fffbeb; border-color: #fcd34d; color: #92400e; font-weight: 700; }
.fb-reason { font-size: 10.5px; color: #9a6b1f; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-chevron { align-self: center; color: #b3c2be; }
.issue-chevron svg { width: 18px; height: 18px; }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty strong { color: var(--ink); }

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(480px, 94vw);
  background: #fff; box-shadow: -24px 0 60px rgba(11, 36, 31, .16);
  z-index: 40; display: flex; flex-direction: column;
  animation: slide-in .22s ease both;
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 22px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; margin: 3px 0 0; }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.drawer-foot { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fbfcfc; }
.drawer-foot .btn { flex: 1; }
.detail-block { margin-bottom: 20px; }
.detail-block .detail-label { font-size: 10.5px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; margin-bottom: 5px; }
.detail-block p { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.detail-quote { background: #f8fbfa; border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; font-size: 12.5px; }
.detail-suggestion { background: var(--brand-soft); border: 1px solid #d2eae4; border-radius: 11px; padding: 12px 14px; font-size: 12.5px; color: #145c54; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- history ---------- */
.history-list { display: flex; flex-direction: column; margin-top: 8px; }
.history-row {
  display: grid; grid-template-columns: minmax(0, 1.5fr) 130px 150px 120px 92px;
  gap: 12px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
}
.history-row:last-child { border-bottom: 0; }
.history-file { min-width: 0; }
.history-file strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-file span { font-size: 11px; color: var(--muted); }
.history-cell { font-size: 12px; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }
.status.done::before { background: #22c55e; }
.status.error::before { background: #ef4444; }
.history-actions { display: flex; gap: 6px; justify-content: flex-end; }
.history-actions .icon-btn { width: 32px; height: 32px; }

/* ---------- usage ---------- */
.usage-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); gap: 20px; }
.usage-card { text-align: center; padding: 34px 26px; }
.quota-ring {
  width: 190px; height: 190px; margin: 22px auto 8px; border-radius: 50%;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at center, #f4fbf8 0 62%, transparent 63%),
              conic-gradient(var(--brand) var(--pct, 0%), #e8efec 0);
}
.quota-ring strong { font-size: 42px; line-height: 1; letter-spacing: -.04em; }
.quota-ring > span { position: absolute; left: calc(50% + 32px); top: calc(50% + 10px); font-size: 13px; color: var(--muted); white-space: nowrap; }
.usage-side h3 { margin: 0 0 14px; font-size: 15px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.plain-list li:last-child { border-bottom: 0; }
.plain-list span { color: var(--muted); }
.plain-list strong { font-weight: 600; }

/* ---------- feedback stats ---------- */
.feedback-table-wrap { margin-top: 18px; overflow: auto; max-height: calc(100vh - 250px); }
.feedback-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.feedback-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 4; background: var(--panel); box-shadow: 0 1px 0 var(--line); }
.feedback-table td { padding: 10px; border-bottom: 1px solid var(--line); }
.feedback-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.feedback-table .num.ok { color: #047857; font-weight: 700; }
.feedback-table .num.bad { color: #b91c1c; font-weight: 700; }
.lib-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.lib-tab { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 9px; padding: 7px 14px; font: inherit; font-size: 12px; cursor: pointer; }
.lib-tab.is-active { color: #065f46; border-color: #a7d7c5; background: #f0fdf7; font-weight: 700; }
.lib-toolbar .input { margin-left: auto; min-width: 220px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: 12px; }
.lib-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.lib-actions { display: flex; gap: 6px; }
.lib-actions button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.lib-actions button:hover { color: #065f46; }
.lib-text-card { width: min(900px, 100%); }
.lib-textarea { width: 100%; height: 46vh; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--ink); background: #fbfdfc; }
.feedback-table .feedback-reasons-cell { min-width: 160px; }
.rule-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.rule-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.rule-status.bad { color: #b91c1c; background: #fef2f2; }
.rule-status.warn { color: #b45309; background: #fffbeb; }
.rule-status.ok { color: #047857; background: #ecfdf5; }
.rule-status.muted { color: #64748b; background: #f1f5f9; }
.lib-note { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64748b; font-size: 12px; }
.reason-chip { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 7px; border-radius: 6px; background: #f8fafc; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.reason-list { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 6px; }
.feedback-runs { margin-top: 22px; }
.feedback-runs h3 { font-size: 14px; margin: 0 0 8px; }
.feedback-run-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.feedback-run-row span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feedback-run-row strong { white-space: nowrap; font-weight: 600; }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(8, 24, 20, .45); display: grid; place-items: center; z-index: 60; padding: 20px; }
.modal-card { width: min(440px, 100%); background: #fff; border-radius: 18px; box-shadow: var(--shadow); animation: rise .2s ease both; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 0; }
.modal-head h2 { font-size: 18px; margin: 3px 0 0; }
.modal-body { padding: 18px 22px 22px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 12px; font-weight: 600; }
.field input {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; outline: none; background: #fbfcfc;
}
.field input:focus { border-color: #9fd3c9; box-shadow: 0 0 0 3px rgba(15, 118, 110, .1); }
.field small { color: var(--muted); font-size: 11px; }
.ai-note {
  margin: 4px 0 16px; padding: 11px 12px; border-radius: 10px;
  background: var(--brand-soft); border: 1px solid #d2eae4;
  color: #145c54; font-size: 11.5px; line-height: 1.6;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #0b241f; color: #e8fff9; border-radius: 12px;
  padding: 11px 18px; font-size: 12.5px; box-shadow: var(--shadow); z-index: 80;
  animation: rise .2s ease both;
}
.toast.is-error { background: #7f1d1d; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 14px; padding: 12px 14px; flex-wrap: wrap; }
  .brand { padding: 0; }
  .side-note { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .nav { flex-direction: row; flex: 1; }
  .nav-item { padding: 8px 10px; font-size: 12px; }
  .main { padding: 18px 16px 40px; }
  .topbar { flex-direction: column; gap: 10px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-row { grid-template-columns: minmax(0, 1fr) 90px 100px; }
  .history-row .history-cell:nth-child(2), .history-row .history-actions { display: none; }
  .usage-grid { grid-template-columns: 1fr; }
  .toolbar-right { width: 100%; }
  .search { flex: 1; min-width: 0; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .topbar-title h1 { font-size: 21px; }
}
