:root {
  color-scheme: light;
  --bg: #ecefeb;
  --canvas: #f7f7f3;
  --panel: #ffffff;
  --panel-soft: #f5f6f1;
  --panel-warm: #fbf7ef;
  --ink: #151917;
  --muted: #667169;
  --faint: #929b94;
  --line: #d9ded6;
  --line-strong: #c2cbc3;
  --track: #e7ebe4;
  --green: #176b52;
  --blue: #315f9f;
  --orange: #a86523;
  --red: #a73d52;
  --teal: #1f7771;
  --charcoal: #17201d;
  --shadow-sm: 0 1px 2px rgba(18, 24, 21, 0.05), 0 8px 18px rgba(18, 24, 21, 0.04);
  --shadow-md: 0 12px 32px rgba(18, 24, 21, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #fafaf6 0, var(--bg) 58%, #e8ece8 100%);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  text-rendering: geometricPrecision;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 64px 1fr;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 10px;
  background:
    linear-gradient(180deg, #1f2925 0%, #131b18 100%);
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 16px;
  font-weight: 800;
}

.rail-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  font-size: 15px;
}

.rail-btn.active,
.rail-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.main-shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: relative;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 248, 244, 0.9);
  backdrop-filter: blur(18px);
}

.title-block {
  display: grid;
  gap: 4px;
}

.title-block p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.18;
  font-weight: 760;
}

h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 740;
}

h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 720;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.primary-btn,
.ghost-btn,
.mini-copy {
  border-radius: 8px;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.primary-btn,
.ghost-btn {
  height: 38px;
  min-width: 98px;
  padding: 0 15px;
  font-size: 14px;
}

.primary-btn {
  border: 1px solid #101715;
  background: #101715;
  color: #fff;
  box-shadow: 0 8px 18px rgba(16, 23, 21, 0.16);
}

.primary-btn:hover {
  transform: translateY(-1px);
  background: #1f2925;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.ghost-btn:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.compact {
  min-width: 72px;
  height: 32px;
  padding: 0 11px;
  font-size: 13px;
}

.workspace {
  min-height: 0;
  height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(420px, 500px) minmax(640px, 1fr);
  gap: 14px;
  padding: 14px;
}

.brief-pane,
.review-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brief-pane {
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(251, 251, 248, 0.98));
  box-shadow: var(--shadow-sm);
}

.section-head,
.section-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head {
  padding-bottom: 2px;
}

.section-subhead {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.section-subhead strong {
  color: var(--ink);
  font-size: 14px;
}

label {
  display: flex;
  flex-direction: column;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

select,
input,
textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

select:focus,
input:focus,
textarea:focus {
  border-color: #7d9188;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 119, 113, 0.13);
}

select,
input {
  height: 38px;
  padding: 0 12px;
  font-size: 14px;
}

textarea {
  flex: 1;
  min-height: 208px;
  padding: 12px;
  resize: none;
  font-size: 14px;
  line-height: 1.66;
}

.meta-grid,
.brief-grid {
  display: grid;
  gap: 9px;
}

.meta-grid {
  grid-template-columns: 1.05fr 0.95fr;
}

.brief-grid {
  grid-template-columns: 1fr 1fr;
}

.field.grow {
  min-height: 0;
  flex: 1;
}

.material-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#fileInput {
  display: none;
}

.file-note {
  margin-top: -2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meter,
.quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.meter span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.agent-panel {
  padding-top: 2px;
}

.agent-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.agent-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.agent-toggle {
  min-height: 72px;
  display: flex;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-top: 3px solid color-mix(in srgb, var(--agent-color), white 20%);
  border-radius: 8px;
  background: #fbfbf8;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.agent-toggle:hover {
  border-color: color-mix(in srgb, var(--agent-color), white 38%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.agent-toggle:has(input:checked) {
  border-color: color-mix(in srgb, var(--agent-color), white 30%);
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--agent-color), white 94%));
}

.agent-toggle input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--agent-color);
}

.agent-toggle strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.agent-toggle small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.scoreboard {
  min-height: 112px;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) 78px 178px;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 249, 246, 0.96));
  box-shadow: var(--shadow-sm);
}

.score-main p:last-child {
  max-width: 54ch;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.score-ring {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0deg, var(--track) 0deg);
  color: var(--ink);
  font-size: 23px;
  font-weight: 820;
  position: relative;
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(18, 24, 21, 0.04);
}

.score-ring span {
  position: relative;
  font-variant-numeric: tabular-nums;
}

.score-stats {
  display: grid;
  gap: 6px;
}

.score-stats div {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: baseline;
  gap: 10px;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
}

.score-stats span {
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.score-stats small {
  color: var(--muted);
}

.priority-board {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e9d3b9;
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffaf3, #fff6eb);
  color: #533a25;
  font-size: 14px;
  line-height: 1.5;
}

.priority-board strong {
  white-space: nowrap;
  color: #3f2b1a;
}

.priority-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.priority-list span {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(168, 101, 35, 0.1);
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
}

.tab {
  height: 33px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.tab.active {
  background: var(--charcoal);
  color: #fff;
  box-shadow: 0 6px 16px rgba(23, 32, 29, 0.15);
}

.result-surface {
  min-height: 0;
  flex: 0 1 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.38);
}

.view {
  display: none;
  height: auto;
  max-height: calc(100vh - 292px);
  overflow: auto;
  padding: 12px;
}

.view.active {
  display: block;
}

.empty {
  min-height: 248px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #ccd4cc;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 248, 244, 0.72));
  color: var(--muted);
  text-align: center;
}

.empty-workbench {
  display: grid;
  gap: 12px;
}

.empty-focus,
.empty-grid,
.empty-lanes {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-sm);
}

.empty-focus {
  min-height: 136px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(244, 247, 242, 0.88));
}

.empty-focus span {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.empty-focus strong {
  font-size: 20px;
  line-height: 1.25;
}

.empty-focus p {
  max-width: 54ch;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.empty-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.empty-grid div {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.empty-grid div:last-child {
  border-right: 0;
}

.empty-grid small {
  color: var(--muted);
  font-size: 12px;
}

.empty-grid strong {
  font-size: 25px;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.empty-lanes {
  display: grid;
  gap: 0;
  align-content: start;
  padding: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.empty-lanes div {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.empty-lanes div:last-child {
  border-bottom: 0;
}

.empty-lanes span {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dfe5df, #eef2ed);
}

.empty-lanes p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.empty strong {
  color: var(--ink);
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.insight-panel,
.review-card,
.version-card,
.table-wrap,
.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.insight-panel {
  min-height: 138px;
  padding: 14px;
}

.insight-panel.wide {
  grid-column: 1 / -1;
}

.insight-panel.danger {
  border-color: #e3c2c9;
  background: linear-gradient(180deg, #fff, #fff8f9);
}

.insight-panel strong {
  display: block;
  margin: 9px 0;
  font-size: 28px;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.insight-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.panel-note {
  margin: 0 0 12px !important;
  font-size: 13px;
}

.issue-stack {
  display: grid;
  gap: 7px;
}

.issue-line {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.issue-line span {
  color: var(--muted);
  font-size: 12px;
}

.issue-line p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.review-card {
  margin-bottom: 12px;
  overflow: hidden;
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--agent-color), white 88%), #fff 70%);
}

.score-pill {
  min-width: 62px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--agent-color);
  color: #fff;
  font-weight: 820;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.review-body {
  padding: 13px 15px 15px;
}

.summary {
  margin: 0 0 13px;
  color: var(--ink);
  line-height: 1.55;
}

.evidence-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.1fr 1.1fr;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
}

.list-title {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
}

ul {
  margin: 0;
  padding-left: 18px;
}

li {
  margin: 0 0 6px;
  line-height: 1.46;
  font-size: 13px;
}

.rewrite-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d8e2dc;
  border-radius: 8px;
  background: #f6faf7;
  font-size: 13px;
  line-height: 1.5;
}

.line-review,
.optimized-version {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.module-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.module-title strong {
  font-size: 14px;
}

.module-title span {
  color: var(--muted);
  font-size: 12px;
}

.line-edit {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.line-edit:first-of-type {
  border-top: 0;
  padding-top: 2px;
}

.line-meta span,
.line-meta small {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--agent-color), white 84%);
  color: var(--ink);
  font-size: 12px;
}

.line-meta small {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
}

.line-copy {
  display: grid;
  gap: 7px;
}

.line-copy p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.52;
}

.line-copy b {
  display: inline-block;
  min-width: 43px;
  margin-right: 8px;
  color: var(--muted);
  font-weight: 650;
}

.line-copy .rewrite {
  padding: 9px 10px;
  border: 1px solid #e0e5de;
  border-radius: 8px;
  background: #fff;
}

.optimized-version pre,
.version-card pre {
  margin: 0;
  overflow: auto;
  color: var(--ink);
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 1.66;
}

.optimized-version pre {
  max-height: 260px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.version-grid {
  display: grid;
  gap: 12px;
}

.version-card {
  overflow: hidden;
}

.version-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.version-head div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.version-head span {
  color: var(--muted);
  font-size: 12px;
}

.version-card pre {
  max-height: 372px;
  padding: 15px;
  font-size: 14px;
}

.mini-copy {
  height: 29px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.mini-copy:hover {
  border-color: var(--line-strong);
}

.rubric {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.rubric-row {
  display: grid;
  grid-template-columns: 140px 1fr 38px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.rubric-row strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--agent-color);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

th {
  color: var(--muted);
  background: var(--panel-soft);
  font-weight: 650;
}

.risk-chip {
  display: inline-block;
  min-width: 44px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  font-weight: 820;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.risk-chip.ok {
  background: var(--green);
}

.risk-chip.warn {
  background: var(--orange);
}

.risk-chip.bad {
  background: var(--red);
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr 56px;
  gap: 4px 12px;
  width: 100%;
  padding: 13px;
  color: var(--ink);
  text-align: left;
}

.history-item strong {
  grid-row: span 2;
  align-self: center;
  justify-self: end;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.history-item small {
  color: var(--muted);
}

.history-item p {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.skeleton-grid div {
  min-height: 146px;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef1ed, #ffffff, #eef1ed);
  background-size: 220% 100%;
  animation: shimmer 1.2s infinite;
}

.skeleton-grid .wide {
  grid-column: 1 / -1;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    display: none;
  }

  .workspace {
    height: auto;
    grid-template-columns: 1fr;
  }

  .brief-pane,
  .review-pane {
    min-height: 640px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .meta-grid,
  .brief-grid,
  .agent-strip,
  .scoreboard,
  .overview-grid,
  .evidence-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .workspace {
    width: 100%;
    min-width: 0;
    padding: 12px;
  }

  .section-subhead {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .scoreboard {
    display: grid;
  }

  .score-ring {
    justify-self: start;
  }

  .tabbar {
    overflow-x: auto;
    grid-template-columns: repeat(5, minmax(86px, 1fr));
  }

  .issue-line,
  .rubric-row,
  .line-edit {
    grid-template-columns: 1fr;
  }
}

/* Liquid-axis refresh: translucent material layers + denser horizontal/vertical work axes. */
:root {
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-dark: rgba(17, 24, 22, 0.84);
  --line-glass: rgba(255, 255, 255, 0.58);
  --stroke: rgba(24, 34, 30, 0.14);
  --electric: #0f8f7d;
  --cobalt: #2f67d8;
  --amber: #c17422;
  --wine: #ad3658;
}

body {
  background:
    linear-gradient(115deg, rgba(47, 103, 216, 0.12), transparent 34%),
    linear-gradient(245deg, rgba(15, 143, 125, 0.14), transparent 38%),
    linear-gradient(180deg, #fbfbf8 0%, #edf1ed 48%, #e5ebe7 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.42) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34) 0 1px, transparent 1px 100%);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 74%);
}

.rail {
  background: linear-gradient(180deg, rgba(12, 19, 18, 0.94), rgba(20, 31, 29, 0.84));
  backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.08);
}

.mark,
.rail-btn.active {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 12px 28px rgba(0, 0, 0, 0.18);
}

.topbar {
  min-height: 78px;
  border-bottom: 1px solid rgba(24, 34, 30, 0.1);
  background: rgba(248, 250, 247, 0.58);
  backdrop-filter: blur(28px) saturate(1.35);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 64px;
  right: 0;
  top: 77px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(47, 103, 216, 0.32), rgba(15, 143, 125, 0.24), transparent);
}

.title-block h1 {
  font-size: 25px;
  letter-spacing: -0.01em;
}

.title-block p {
  color: rgba(21, 25, 23, 0.58);
}

.axis-strip {
  min-width: 310px;
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.72), 0 10px 24px rgba(31, 40, 36, 0.06);
  backdrop-filter: blur(18px) saturate(1.25);
}

.axis-strip span {
  display: inline-grid;
  place-items: center;
  height: 25px;
  padding: 0 10px;
  border-radius: 7px;
  color: rgba(21, 25, 23, 0.62);
  font-size: 12px;
  font-weight: 650;
}

.axis-strip span.active {
  background: var(--glass-dark);
  color: #fff;
}

.axis-strip i {
  height: 1px;
  background: linear-gradient(90deg, rgba(21, 25, 23, 0.1), rgba(21, 25, 23, 0.34));
}

.workspace {
  height: calc(100vh - 78px);
  grid-template-columns: minmax(420px, 510px) minmax(660px, 1fr);
  gap: 16px;
  padding: 16px;
}

.brief-pane,
.scoreboard,
.priority-board,
.tabbar,
.result-surface {
  border-color: rgba(255, 255, 255, 0.6);
  background: var(--glass);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.72), 0 18px 44px rgba(22, 31, 28, 0.08);
  backdrop-filter: blur(24px) saturate(1.32);
}

.brief-pane {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(246, 249, 246, 0.56));
}

.section-head h2,
.score-main h2 {
  letter-spacing: -0.01em;
}

select,
input,
textarea {
  border-color: rgba(24, 34, 30, 0.12);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.72);
}

textarea {
  min-height: 222px;
}

.primary-btn {
  border: 1px solid rgba(11, 18, 16, 0.9);
  background: linear-gradient(180deg, #1b2724, #0f1715);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12), 0 14px 28px rgba(10, 18, 16, 0.22);
}

.ghost-btn,
.mini-copy {
  border-color: rgba(24, 34, 30, 0.12);
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(14px);
}

.agent-toggle,
.score-stats div,
.insight-panel,
.review-card,
.version-card,
.table-wrap,
.history-item,
.empty-focus,
.empty-grid,
.empty-lanes {
  border-color: rgba(24, 34, 30, 0.12);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.72), 0 12px 28px rgba(21, 28, 25, 0.06);
  backdrop-filter: blur(18px) saturate(1.22);
}

.agent-toggle:has(input:checked) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), color-mix(in srgb, var(--agent-color), white 90%));
}

.scoreboard {
  grid-template-columns: minmax(260px, 1fr) 90px 180px;
  min-height: 124px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.76), rgba(245, 249, 247, 0.54)),
    linear-gradient(90deg, rgba(47, 103, 216, 0.08), transparent 48%);
}

.score-ring {
  width: 82px;
  height: 82px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.8), 0 14px 32px rgba(47, 103, 216, 0.12);
}

.priority-board {
  background: linear-gradient(90deg, rgba(255, 247, 235, 0.76), rgba(255, 255, 255, 0.52));
}

.tabbar {
  padding: 5px;
  background: rgba(255, 255, 255, 0.5);
}

.tab.active {
  background: linear-gradient(180deg, rgba(22, 32, 29, 0.94), rgba(13, 20, 18, 0.94));
}

.result-surface {
  background: rgba(245, 249, 247, 0.34);
}

.empty-focus {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(238, 247, 245, 0.62)),
    linear-gradient(90deg, rgba(47, 103, 216, 0.08), transparent);
}

.empty-focus strong {
  font-size: 22px;
}

.empty-grid div {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.18));
}

.empty-lanes span {
  background: linear-gradient(90deg, rgba(15, 143, 125, 0.18), rgba(47, 103, 216, 0.16));
}

.line-copy .rewrite {
  background: rgba(255, 255, 255, 0.72);
}

/* Form-grid refinement: align inputs, prevent textarea overlap, and add real mobile ergonomics. */
h1,
h2,
h3,
.title-block h1,
.section-head h2,
.score-main h2 {
  letter-spacing: 0;
}

.topbar {
  gap: 20px;
  padding: 14px 24px;
}

.workspace {
  grid-template-columns: minmax(440px, 500px) minmax(0, 1fr);
  align-items: stretch;
}

.brief-pane,
.review-pane {
  gap: 12px;
}

.brief-pane {
  padding: 18px;
  overflow: auto;
}

.meta-grid,
.brief-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  min-width: 0;
}

select,
input {
  height: 42px;
  min-width: 0;
  padding: 0 13px;
}

textarea {
  display: block;
  flex: none;
  min-height: 260px;
  max-height: 38vh;
  padding: 14px;
  overflow: auto;
}

.field.grow,
.material-field {
  flex: 0 0 auto;
  min-height: auto;
}

.material-field {
  display: block;
}

.material-label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.upload-wrap {
  justify-self: end;
}

.file-note {
  margin: 0;
  min-height: 18px;
}

.input-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.meter,
.quick-actions {
  flex-wrap: wrap;
}

.agent-strip {
  gap: 10px;
}

.agent-toggle {
  min-height: 84px;
  padding: 11px;
}

.submit-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
  margin: 2px 0 0;
  padding: 10px;
  border: 1px solid rgba(24, 34, 30, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.72), 0 12px 28px rgba(21, 28, 25, 0.06);
  backdrop-filter: blur(18px) saturate(1.22);
}

.submit-panel .primary-btn,
.submit-panel .ghost-btn {
  width: 100%;
  height: 46px;
}

.submit-panel .primary-btn {
  font-size: 15px;
  font-weight: 760;
}

.scoreboard {
  grid-template-columns: minmax(0, 1fr) 86px 180px;
  min-height: 144px;
  align-items: center;
}

.score-ring {
  justify-self: center;
}

.score-stats {
  align-self: center;
  gap: 7px;
}

.score-stats div {
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  overflow: hidden;
}

.score-stats small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view {
  max-height: calc(100vh - 310px);
}

@media (max-width: 1180px) {
  .topbar::after {
    left: 0;
  }

  .axis-strip {
    display: none;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 78px);
  }

  .brief-pane,
  .review-pane {
    min-height: auto;
  }

  textarea {
    max-height: none;
  }

  .view {
    max-height: none;
  }

  .meta-grid,
  .brief-grid,
  .scoreboard,
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .score-ring {
    justify-self: start;
  }

  .score-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .score-stats div {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .agent-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

  .workspace {
    gap: 12px;
    height: auto;
    padding: 12px;
  }

  .brief-pane,
  .result-surface,
  .scoreboard,
  .priority-board,
  .tabbar {
    border-radius: 10px;
  }

  .brief-pane {
    padding: 14px;
  }

  .material-label,
  .input-footer {
    grid-template-columns: 1fr;
  }

  .upload-wrap,
  .quick-actions {
    justify-self: stretch;
  }

  .upload-wrap .ghost-btn,
  .quick-actions .ghost-btn {
    width: 100%;
  }

  .section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .section-head .compact {
    width: auto;
  }

  textarea {
    min-height: 240px;
  }

  .agent-strip,
  .score-stats,
  .empty-grid,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .empty-grid div {
    min-height: 72px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .empty-grid div:last-child {
    border-bottom: 0;
  }

  .tabbar {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tabbar::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-width: 86px;
  }

  .priority-board {
    display: grid;
    gap: 8px;
  }

  .submit-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 22px;
  }

  .workspace {
    padding: 10px;
  }

  .brief-pane {
    padding: 12px;
  }
}

/* Results workspace refresh: no nested page shell, clearer waiting state, flatter edit cards. */
.priority-board {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
}

.priority-list {
  display: grid;
  gap: 8px;
}

.priority-list p {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  margin: 0;
  color: #4b3926;
  line-height: 1.5;
}

.priority-list b {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(193, 116, 34, 0.16);
  color: #7a4714;
  font-size: 12px;
}

.result-surface {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.view {
  padding: 0;
}

.overview-grid {
  gap: 12px;
}

.insight-panel,
.review-card,
.version-card,
.table-wrap,
.history-item {
  border-radius: 10px;
}

.issue-line {
  background: rgba(255, 255, 255, 0.58);
}

.loading-review {
  min-height: 360px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-content: center;
  gap: 20px;
  padding: 34px;
  border: 1px solid rgba(24, 34, 30, 0.12);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(241, 248, 245, 0.58)),
    linear-gradient(90deg, rgba(47, 103, 216, 0.08), transparent);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.72), 0 16px 36px rgba(21, 28, 25, 0.07);
}

.loading-orbit {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 1px solid rgba(24, 34, 30, 0.12);
  background: rgba(255, 255, 255, 0.48);
}

.loading-orbit::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 7px solid rgba(15, 143, 125, 0.14);
  border-top-color: #16201d;
  animation: spin 1.1s linear infinite;
}

.loading-orbit i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2f67d8;
  animation: pulse 1.4s ease-in-out infinite;
}

.loading-orbit i:nth-child(1) { left: 17px; top: 16px; }
.loading-orbit i:nth-child(2) { right: 15px; top: 28px; animation-delay: 0.18s; }
.loading-orbit i:nth-child(3) { left: 35px; bottom: 12px; animation-delay: 0.34s; }

.loading-review strong {
  display: block;
  margin-top: 6px;
  font-size: 23px;
  line-height: 1.25;
}

.loading-review p {
  max-width: 52ch;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.loading-steps {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.loading-steps span {
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(24, 34, 30, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  font-size: 13px;
}

.edit-board {
  display: grid;
  gap: 10px;
}

.edit-item {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(24, 34, 30, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.74), 0 10px 24px rgba(21, 28, 25, 0.05);
}

.edit-item header {
  display: grid;
  align-content: start;
  gap: 8px;
}

.edit-item header div {
  display: grid;
  gap: 6px;
}

.edit-item header span,
.edit-item header small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.edit-item header strong {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(22, 32, 29, 0.92);
  color: #fff;
  font-size: 12px;
}

.edit-item dl {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px 10px;
  margin: 0;
}

.edit-item dt {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.edit-item dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

.edit-rewrite {
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(15, 143, 125, 0.08);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.08); }
}

@media (max-width: 760px) {
  .loading-review,
  .edit-item {
    grid-template-columns: 1fr;
  }

  .loading-steps {
    grid-template-columns: 1fr;
  }

  .edit-item dl {
    grid-template-columns: 1fr;
  }
}

/* Graphite cockpit refresh: remove the rail, add usable color modes, and make the workbench feel like one continuous control surface. */
body,
body * {
  letter-spacing: 0;
}

body[data-theme="graphite"] {
  --bg: #070b0c;
  --canvas: #0c1112;
  --panel: rgba(16, 23, 24, 0.74);
  --panel-soft: rgba(22, 31, 32, 0.66);
  --panel-warm: rgba(44, 38, 30, 0.58);
  --ink: #f4f8f6;
  --muted: #b4bfba;
  --faint: #7e8985;
  --line: rgba(222, 236, 231, 0.15);
  --line-strong: rgba(232, 244, 239, 0.28);
  --track: rgba(229, 242, 238, 0.13);
  --green: #38d0ad;
  --blue: #79a7ff;
  --orange: #f0a34a;
  --red: #f06d83;
  --teal: #4edbc9;
  --charcoal: #f4f8f6;
  --glass: rgba(16, 23, 24, 0.72);
  --glass-strong: rgba(26, 36, 37, 0.82);
  --glass-dark: rgba(247, 251, 249, 0.94);
  --stroke: rgba(224, 239, 234, 0.16);
  --electric: #4edbc9;
  --cobalt: #78a7ff;
  --shadow-sm: 0 14px 34px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 24px 56px rgba(0, 0, 0, 0.32);
  --app-bg:
    linear-gradient(118deg, rgba(77, 219, 201, 0.18), transparent 32%),
    linear-gradient(248deg, rgba(121, 167, 255, 0.16), transparent 36%),
    linear-gradient(180deg, #111819 0%, #070b0c 58%, #0d1111 100%);
  --panel-glass: linear-gradient(145deg, rgba(25, 36, 37, 0.86), rgba(13, 19, 20, 0.68));
  --panel-sheen: linear-gradient(115deg, rgba(255, 255, 255, 0.12), transparent 38%);
  --input-glass: rgba(255, 255, 255, 0.07);
  --input-glass-strong: rgba(255, 255, 255, 0.1);
  --button-primary: linear-gradient(180deg, #f7fbf9, #ccd5d2);
  --button-primary-text: #08100f;
}

body[data-theme="ice"] {
  --bg: #e8f1f3;
  --canvas: #f7fbfb;
  --panel: rgba(255, 255, 255, 0.66);
  --panel-soft: rgba(243, 250, 250, 0.62);
  --panel-warm: rgba(255, 248, 239, 0.62);
  --ink: #11181a;
  --muted: #617074;
  --faint: #8b979a;
  --line: rgba(28, 43, 45, 0.12);
  --line-strong: rgba(28, 43, 45, 0.2);
  --track: rgba(15, 30, 32, 0.08);
  --green: #087963;
  --blue: #305cc8;
  --orange: #b66b21;
  --red: #b7435c;
  --teal: #0b8f87;
  --charcoal: #101819;
  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-dark: rgba(13, 21, 22, 0.9);
  --stroke: rgba(28, 43, 45, 0.13);
  --electric: #0b8f87;
  --cobalt: #305cc8;
  --shadow-sm: 0 14px 34px rgba(31, 48, 50, 0.08);
  --shadow-md: 0 24px 56px rgba(31, 48, 50, 0.12);
  --app-bg:
    linear-gradient(118deg, rgba(11, 143, 135, 0.16), transparent 33%),
    linear-gradient(248deg, rgba(48, 92, 200, 0.12), transparent 37%),
    linear-gradient(180deg, #f8fbfa 0%, #e8f0f2 62%, #dfe8ea 100%);
  --panel-glass: linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(243, 250, 250, 0.58));
  --panel-sheen: linear-gradient(115deg, rgba(255, 255, 255, 0.74), transparent 40%);
  --input-glass: rgba(255, 255, 255, 0.62);
  --input-glass-strong: rgba(255, 255, 255, 0.78);
  --button-primary: linear-gradient(180deg, #13211f, #0a1110);
  --button-primary-text: #ffffff;
}

body[data-theme="titanium"] {
  --bg: #eceff0;
  --canvas: #f5f6f4;
  --panel: rgba(248, 249, 247, 0.72);
  --panel-soft: rgba(240, 243, 241, 0.66);
  --panel-warm: rgba(247, 240, 229, 0.64);
  --ink: #171b1b;
  --muted: #666f70;
  --faint: #8d9595;
  --line: rgba(24, 31, 31, 0.12);
  --line-strong: rgba(24, 31, 31, 0.2);
  --track: rgba(24, 31, 31, 0.08);
  --green: #177559;
  --blue: #365fa8;
  --orange: #b06b26;
  --red: #a63d55;
  --teal: #227e7b;
  --charcoal: #171b1b;
  --glass: rgba(248, 249, 247, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.84);
  --glass-dark: rgba(17, 24, 24, 0.9);
  --stroke: rgba(24, 31, 31, 0.12);
  --electric: #227e7b;
  --cobalt: #365fa8;
  --shadow-sm: 0 14px 34px rgba(38, 44, 44, 0.08);
  --shadow-md: 0 24px 56px rgba(38, 44, 44, 0.12);
  --app-bg:
    linear-gradient(118deg, rgba(34, 126, 123, 0.12), transparent 34%),
    linear-gradient(248deg, rgba(192, 119, 46, 0.1), transparent 38%),
    linear-gradient(180deg, #fbfbf8 0%, #eceff0 60%, #e1e5e5 100%);
  --panel-glass: linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(238, 241, 240, 0.62));
  --panel-sheen: linear-gradient(115deg, rgba(255, 255, 255, 0.7), transparent 42%);
  --input-glass: rgba(255, 255, 255, 0.64);
  --input-glass-strong: rgba(255, 255, 255, 0.8);
  --button-primary: linear-gradient(180deg, #1a2221, #0e1514);
  --button-primary-text: #ffffff;
}

body {
  background: var(--app-bg);
  color: var(--ink);
}

body::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.11) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 100%);
  background-size: 52px 52px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 76%);
}

.app-shell {
  grid-template-columns: 1fr;
}

.rail {
  display: none !important;
}

.main-shell {
  min-height: 100vh;
}

.topbar {
  min-height: 74px;
  margin: 14px 16px 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-glass);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), var(--shadow-md);
  backdrop-filter: blur(30px) saturate(1.35);
}

.topbar::after {
  left: 18px;
  right: 18px;
  top: auto;
  bottom: -1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--electric), transparent 35%), color-mix(in srgb, var(--cobalt), transparent 44%), transparent);
}

.title-block h1 {
  color: var(--ink);
  font-size: 25px;
}

.title-block p {
  color: var(--muted);
}

.theme-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  gap: 4px;
  width: min(272px, 34vw);
  min-width: 238px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--input-glass), transparent 8%);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(18px) saturate(1.2);
}

.theme-switch button {
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.theme-switch button.active {
  background: var(--button-primary);
  color: var(--button-primary-text);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.24), 0 10px 22px rgba(0, 0, 0, 0.16);
}

.theme-switch button:not(.active):hover {
  color: var(--ink);
  background: var(--input-glass-strong);
}

.axis-strip {
  display: none;
}

.workspace {
  height: calc(100vh - 104px);
  grid-template-columns: minmax(410px, 470px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.brief-pane,
.scoreboard,
.priority-board,
.tabbar,
.submit-panel,
.loading-review {
  border: 1px solid var(--line);
  background: var(--panel-glass);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.14), var(--shadow-sm);
  backdrop-filter: blur(28px) saturate(1.28);
}

.brief-pane {
  position: relative;
  border-radius: 16px;
}

.brief-pane::before,
.scoreboard::before,
.priority-board::before,
.tabbar::before,
.submit-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: var(--panel-sheen);
}

.section-head,
.section-subhead,
.meta-grid,
.brief-grid,
.material-field,
.file-note,
.input-footer,
.submit-panel,
.agent-panel {
  position: relative;
}

.section-head h2,
.section-subhead strong,
label,
.score-main h2,
.priority-board strong {
  color: var(--ink);
}

.section-subhead,
.section-subhead span,
.file-note,
.eyebrow,
.panel-kicker,
.score-main p,
.title-block p {
  color: var(--muted);
}

select,
input,
textarea {
  border: 1px solid var(--line);
  background: var(--input-glass);
  color: var(--ink);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12);
}

select:hover,
input:hover,
textarea:hover,
select:focus,
input:focus,
textarea:focus {
  border-color: var(--line-strong);
  background: var(--input-glass-strong);
}

select option {
  color: #111819;
  background: #f7fbfa;
}

textarea::placeholder,
input::placeholder {
  color: var(--faint);
}

.ghost-btn,
.mini-copy {
  border-color: var(--line);
  background: var(--input-glass);
  color: var(--ink);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12);
}

.ghost-btn:hover,
.mini-copy:hover {
  border-color: var(--line-strong);
  background: var(--input-glass-strong);
}

.primary-btn {
  border: 1px solid color-mix(in srgb, var(--button-primary-text), transparent 72%);
  background: var(--button-primary);
  color: var(--button-primary-text);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.22), 0 16px 34px rgba(0, 0, 0, 0.22);
}

.primary-btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
}

.submit-panel {
  border-radius: 14px;
  padding: 10px;
}

.agent-toggle,
.score-stats div,
.insight-panel,
.review-card,
.version-card,
.table-wrap,
.history-item,
.empty-focus,
.empty-grid,
.empty-lanes,
.edit-item,
.issue-line,
.line-copy .rewrite,
.rewrite-box {
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel), transparent 10%);
  color: var(--ink);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12), 0 12px 28px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(18px) saturate(1.18);
}

.agent-toggle small,
.review-card li,
.review-card .summary,
.issue-line,
.edit-item dd,
.edit-item dt,
.line-copy p,
.line-copy small,
.empty-workbench p,
.history-item p,
.version-card pre,
.risk-table td,
.risk-table th {
  color: var(--muted);
}

.agent-toggle:has(input:checked) {
  border-color: color-mix(in srgb, var(--agent-color), white 18%);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--agent-color), transparent 82%), transparent),
    color-mix(in srgb, var(--panel), transparent 8%);
}

.scoreboard {
  position: relative;
  min-height: 142px;
  grid-template-columns: minmax(0, 1fr) 96px minmax(178px, 196px);
  gap: 18px;
  border-radius: 16px;
  background:
    linear-gradient(118deg, color-mix(in srgb, var(--electric), transparent 88%), transparent 48%),
    var(--panel-glass);
}

.score-ring {
  width: 88px;
  height: 88px;
  color: var(--ink);
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--panel), white 8%) 0 52%, transparent 53%),
    conic-gradient(var(--red) calc(var(--score, 0) * 1%), var(--track) 0);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 18px 34px rgba(0, 0, 0, 0.16);
}

.score-stats {
  display: grid;
  gap: 8px;
}

.score-stats div {
  grid-template-columns: 50px minmax(0, 1fr);
  min-height: 36px;
  border-radius: 10px;
  padding: 0 12px;
}

.score-stats span {
  color: var(--ink);
}

.score-stats small {
  color: var(--muted);
}

.priority-board {
  position: relative;
  border-radius: 14px;
  color: var(--ink);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--orange), transparent 86%), transparent 56%),
    var(--panel-glass);
}

.priority-list p {
  color: var(--muted);
}

.priority-list b {
  background: color-mix(in srgb, var(--orange), transparent 76%);
  color: var(--ink);
}

.tabbar {
  position: relative;
  border-radius: 14px;
  padding: 5px;
}

.tab {
  color: var(--muted);
}

.tab.active {
  background: var(--button-primary);
  color: var(--button-primary-text);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 12px 26px rgba(0, 0, 0, 0.15);
}

.result-surface {
  background: transparent;
}

.view {
  max-height: calc(100vh - 316px);
}

.empty-focus {
  border-radius: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--cobalt), transparent 90%), transparent),
    color-mix(in srgb, var(--panel), transparent 8%);
}

.empty-focus span {
  background: var(--input-glass-strong);
  color: var(--muted);
}

.empty-focus strong,
.empty-grid strong,
.review-card h3,
.version-card strong,
.edit-item dd,
.risk-table strong {
  color: var(--ink);
}

.empty-grid div {
  border-color: var(--line);
}

.empty-lanes span,
.loading-orbit i {
  background: linear-gradient(90deg, var(--electric), var(--cobalt));
}

.loading-review {
  border-radius: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--electric), transparent 90%), transparent 44%),
    var(--panel-glass);
}

.loading-orbit {
  border-color: var(--line);
  background: var(--input-glass);
}

.loading-orbit::before {
  border-color: color-mix(in srgb, var(--electric), transparent 78%);
  border-top-color: var(--electric);
}

body[data-theme="graphite"] .review-card,
body[data-theme="graphite"] .version-card,
body[data-theme="graphite"] .table-wrap,
body[data-theme="graphite"] .history-item,
body[data-theme="graphite"] .insight-panel {
  background: rgba(255, 255, 255, 0.07);
}

body[data-theme="graphite"] .version-card pre {
  color: #d7e0dc;
}

body[data-theme="graphite"] .risk-chip {
  color: #08100f;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(390px, 460px) minmax(0, 1fr);
  }

  .theme-switch {
    width: 246px;
    min-width: 246px;
  }
}

@media (max-width: 980px) {
  .topbar {
    margin: 10px 10px 0;
    grid-template-columns: 1fr;
  }

  .theme-switch {
    width: 100%;
    min-width: 0;
  }

  .workspace {
    height: auto;
    min-height: calc(100vh - 104px);
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .brief-pane {
    max-height: none;
  }

  .view {
    max-height: none;
  }

  .scoreboard {
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .score-stats {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    border-radius: 14px;
  }

  .title-block h1 {
    font-size: 22px;
  }

  .workspace {
    gap: 10px;
  }

  .scoreboard,
  .score-stats {
    grid-template-columns: 1fr;
  }

  .score-ring {
    justify-self: start;
  }

  .theme-switch {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .theme-switch button {
    padding: 0 6px;
    font-size: 12px;
  }
}

/* Ice glass single-theme refinement: one visual direction, no inner pane scrollbar, stronger upload entry. */
body[data-theme="ice"] {
  --app-bg:
    linear-gradient(118deg, rgba(18, 168, 158, 0.17), transparent 34%),
    linear-gradient(250deg, rgba(48, 92, 200, 0.13), transparent 38%),
    linear-gradient(180deg, #fbfdfc 0%, #edf5f6 54%, #e4eef1 100%);
}

.topbar {
  justify-content: flex-start;
}

.theme-switch {
  display: none;
}

.workspace {
  height: auto;
  min-height: calc(100vh - 104px);
  align-items: start;
  grid-template-columns: minmax(460px, 520px) minmax(0, 1fr);
}

.brief-pane {
  overflow: visible;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(246, 252, 252, 0.42));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.4), 0 20px 54px rgba(31, 48, 50, 0.1);
}

.brief-pane::-webkit-scrollbar {
  display: none;
}

.material-field {
  display: grid;
  gap: 8px;
}

.material-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.material-input-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 240px;
}

.paste-card,
.upload-card {
  min-width: 0;
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(239, 249, 249, 0.5));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.58), 0 14px 34px rgba(31, 48, 50, 0.07);
  backdrop-filter: blur(22px) saturate(1.22);
}

.paste-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 12px;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.paste-card textarea {
  height: 100%;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  resize: none;
}

.paste-card textarea:focus {
  background: transparent;
  box-shadow: none;
}

.upload-card {
  position: relative;
  display: grid;
}

.upload-card input {
  display: none;
}

.upload-card button {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 22px;
  border: 0;
  border-radius: 14px;
  background:
    linear-gradient(150deg, rgba(11, 143, 135, 0.13), rgba(48, 92, 200, 0.1)),
    rgba(255, 255, 255, 0.24);
  color: var(--ink);
  text-align: center;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.upload-card button::before {
  content: "+";
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(11, 143, 135, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  color: var(--teal);
  font-size: 28px;
  line-height: 1;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.8), 0 12px 26px rgba(11, 143, 135, 0.13);
}

.upload-card button strong {
  font-size: 18px;
  line-height: 1.2;
}

.upload-card button span {
  max-width: 18ch;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.upload-card button:hover {
  transform: translateY(-1px);
  background:
    linear-gradient(150deg, rgba(11, 143, 135, 0.19), rgba(48, 92, 200, 0.14)),
    rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.56), 0 18px 36px rgba(31, 48, 50, 0.1);
}

.upload-card button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.file-note {
  padding: 0 2px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(430px, 500px) minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .material-input-split {
    grid-template-columns: 1fr;
  }

  .paste-card,
  .upload-card {
    min-height: 210px;
  }
}
