:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --surface-strong: #e9eee8;
  --paper: #fffdf8;
  --ink: #202624;
  --muted: #66706d;
  --line: #dde3dd;
  --brand: #0f6b5f;
  --brand-dark: #0b554c;
  --brand-soft: #e2f1ec;
  --accent: #2d6f91;
  --danger: #b93832;
  --danger-soft: #fdeceb;
  --warning: #b7791f;
  --warning-soft: #fff3d8;
  --success: #2e7d57;
  --success-soft: #e6f4ea;
  --missing: #52677a;
  --missing-soft: #e8eff4;
  --shadow: 0 12px 32px rgba(29, 47, 42, 0.08);
  --shadow-paper: 0 18px 44px rgba(32, 38, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 22px 18px;
  background: #253532;
  color: #f6fbf8;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #dbf1e8;
  color: var(--brand-dark);
  font-size: 20px;
  font-weight: 800;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-subtitle {
  margin-top: 3px;
  color: #b7c8c2;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c8d6d1;
  text-align: left;
}

.nav-item svg,
.primary-button svg,
.ghost-button svg,
.icon-button svg,
.analysis-steps svg,
.drop-icon svg,
.report-empty svg,
.file-icon svg,
.error-banner svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}

.nav-item:hover,
.nav-item.active {
  background: #344945;
  color: #ffffff;
}

.quota-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.quota-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #dbe9e4;
  font-size: 13px;
}

.quota-track,
.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 99px;
  background: #dce5df;
}

.quota-track {
  margin: 12px 0 10px;
  background: rgba(255, 255, 255, 0.14);
}

.quota-track span,
.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.quota-panel p {
  margin: 0;
  color: #aec1ba;
  font-size: 12px;
  line-height: 1.6;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  max-width: 820px;
  font-size: 28px;
  line-height: 1.24;
  letter-spacing: 0;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions,
.report-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.primary-button {
  padding: 0 16px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  border-color: #a9b7b0;
  background: #a9b7b0;
}

.ghost-button:disabled,
.icon-button:disabled,
.focus-chip:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.ghost-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.ghost-button:hover {
  border-color: #bdd1c5;
  background: #f7faf8;
}

.ghost-button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-button:hover {
  border-color: #b9c9c0;
  background: var(--surface-soft);
}

.wide {
  width: 100%;
}

.section-panel {
  display: none;
}

.section-panel.active {
  display: block;
}

.analysis-flow-view {
  display: none;
}

.analysis-flow-view.active {
  display: block;
}

.upload-report-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.upload-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(280px, 360px);
  gap: 18px;
  align-items: start;
  justify-content: center;
}

.upload-panel,
.result-panel,
.rules-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.upload-panel,
.rules-panel {
  padding: 18px;
}

.upload-panel {
  padding: 24px;
}

.result-panel {
  min-height: 620px;
  overflow: hidden;
}

.report-page-panel {
  width: 100%;
}

.expectation-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.compact-heading {
  align-items: flex-start;
}

.panel-heading,
.subsection-heading,
.report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2,
.report-toolbar h2,
.subsection-heading h3 {
  margin: 0;
  letter-spacing: 0;
}

.panel-heading h2,
.report-toolbar h2 {
  font-size: 20px;
  line-height: 1.3;
}

.subsection-heading h3 {
  font-size: 16px;
}

.subsection-heading.compact {
  min-height: 40px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.status-pill,
.risk-badge,
.confidence {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.ready {
  background: var(--surface-soft);
  color: var(--muted);
}

.status-pill.processing {
  background: #e2eff8;
  color: #286486;
}

.status-pill.done,
.risk-badge.low {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.failed,
.risk-badge.high {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill.beta,
.risk-badge.medium {
  background: var(--warning-soft);
  color: var(--warning);
}

.drop-zone {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 172px;
  margin-top: 18px;
  padding: 24px;
  border: 1.5px dashed #adc5bc;
  border-radius: 8px;
  background: #f7faf8;
  outline: none;
}

.file-input-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.drop-zone:hover,
.drop-zone.dragging,
.drop-zone:focus-visible {
  border-color: var(--brand);
  background: #edf7f3;
}

.drop-zone.locked,
.drop-zone.locked:hover,
.drop-zone.locked:focus-visible {
  cursor: not-allowed;
  border-color: var(--line);
  background: #f1f4f1;
  color: var(--muted);
}

.drop-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
}

.drop-icon svg {
  width: 28px;
  height: 28px;
}

.drop-zone strong {
  display: block;
  margin-bottom: 6px;
  font-size: 19px;
}

.drop-zone p,
.selected-file p,
.error-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.selected-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.selected-file > div {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.file-icon {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--brand);
}

.selected-file strong {
  display: block;
  overflow: hidden;
  max-width: 240px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-type-row,
.settings-grid {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

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

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

.contract-type-row label,
.form-grid label,
.settings-grid label,
.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.settings-grid label > span,
.focus-area-box p {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.ai-score-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.score-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid #d6ded9;
  border-radius: 8px;
  background: var(--surface-soft);
}

.score-mode-option {
  position: relative;
  display: grid;
  min-height: 40px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.score-mode-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.score-mode-option:has(input:checked) {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 14px rgba(15, 107, 95, 0.18);
}

.score-mode-option:has(input:focus-visible) {
  outline: 2px solid rgba(15, 107, 95, 0.34);
  outline-offset: 2px;
}

.score-mode-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.62;
}

.score-mode-note {
  display: none;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
}

.score-mode-note.active {
  display: grid;
}

.score-mode-note p {
  margin: 0;
}

.local-note strong {
  color: var(--danger);
  font-size: 14px;
  line-height: 1.4;
}

.ai-note {
  color: #3f6860;
}

.email-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.email-field input {
  margin-top: 0;
}

.email-field input:disabled {
  background: #eef2ef;
  color: #8a9691;
  cursor: not-allowed;
}

.email-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.email-field span.warning {
  color: var(--warning);
  font-weight: 800;
}

.focus-area-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.focus-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.focus-chip {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.focus-chip:hover,
.focus-chip.active {
  border-color: #a8cabd;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.focus-area-box p.warning {
  color: var(--warning);
  font-weight: 800;
}

.expectation-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.expectation-list div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: #34423e;
  font-size: 14px;
  font-weight: 700;
}

.expectation-list svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.privacy-note {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #d7e4df;
  border-radius: 8px;
  background: #f5fbf8;
}

.privacy-note strong {
  font-size: 13px;
}

.privacy-note p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.score-rules-card {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #d6e2e8;
  border-radius: 8px;
  background: #f7fbfd;
}

.score-rules-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.score-rules-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

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

.score-rule-list div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  background: #fff;
}

.score-rule-list strong {
  color: #244c60;
  font-size: 13px;
}

.score-rule-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

select,
input[type="text"],
input[type="number"],
input[type="email"] {
  width: 100%;
  min-height: 40px;
  margin-top: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

select:focus,
input:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(17, 105, 93, 0.13);
}

.progress-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 14px;
}

.activity-indicator {
  display: grid;
  grid-template-columns: repeat(3, 8px) minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid #d8e5df;
  border-radius: 8px;
  background: #f2faf6;
  color: var(--brand-dark);
}

.activity-indicator[hidden] {
  display: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
  animation: activityPulse 1.1s ease-in-out infinite;
}

.activity-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.activity-dot:nth-child(3) {
  animation-delay: 0.32s;
}

.activity-indicator p {
  margin: 0;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.progress-panel.running .progress-track span {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.26) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.26) 50%, rgba(255, 255, 255, 0.26) 75%, transparent 75%, transparent);
  background-size: 18px 18px;
  animation: progressStripes 0.8s linear infinite;
}

.progress-track span {
  width: 0;
  transition: width 0.22s ease;
}

.analysis-steps {
  display: grid;
  gap: 9px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.analysis-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--muted);
  font-size: 13px;
}

.analysis-steps li.active {
  color: var(--accent);
  font-weight: 800;
}

.analysis-steps li.done {
  color: var(--success);
  font-weight: 800;
}

.upload-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
}

.error-banner {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
}

.error-banner strong {
  display: block;
  margin-bottom: 3px;
}

.report-empty {
  display: grid;
  min-height: 620px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.report-empty svg {
  width: 42px;
  height: 42px;
  color: #86a095;
}

.report-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.report-empty p {
  max-width: 440px;
  margin: 0;
  line-height: 1.7;
}

.report-content {
  padding: 18px;
}

.report-toolbar {
  margin-bottom: 16px;
}

.report-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 120px 120px 120px 120px;
  gap: 12px;
}

.score-card,
.metric-card,
.risk-list-panel,
.risk-detail-panel,
.original-panel,
.dimension-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.score-card {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 156px;
  padding: 16px;
}

.score-card h3 {
  margin: 11px 0 6px;
  font-size: 20px;
}

.score-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.score-ring {
  position: relative;
  width: 118px;
  height: 118px;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring circle {
  fill: none;
  stroke-width: 11;
}

.ring-bg {
  stroke: #eceeed;
}

.ring-value {
  stroke: var(--danger);
  stroke-dasharray: 314;
  stroke-dashoffset: 119;
  stroke-linecap: round;
}

.score-ring div {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 38px;
}

.score-ring strong {
  font-size: 34px;
  letter-spacing: 0;
}

.score-ring span {
  color: var(--muted);
  font-weight: 700;
}

.metric-card {
  display: grid;
  min-height: 156px;
  place-items: center;
  align-content: center;
  gap: 7px;
}

.metric-number {
  max-width: 100%;
  font-size: 32px;
  font-weight: 850;
  line-height: 1;
  overflow-wrap: anywhere;
  text-align: center;
}

#enhancementCount {
  font-size: 32px;
}

.metric-number.metric-status,
.workbench-tabs button strong.metric-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #cfe0da;
  border-radius: 999px;
  background: #eef6f3;
  color: #315f54;
  font-size: 13px !important;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.metric-number.metric-status[data-status="running"],
.workbench-tabs button strong.metric-status[data-status="running"] {
  border-color: #d9cba7;
  background: #fff8e5;
  color: #856114;
}

.metric-number.metric-status[data-status="failed"],
.workbench-tabs button strong.metric-status[data-status="failed"] {
  border-color: #edc4c4;
  background: #fff1f1;
  color: #9d3434;
}

.ai-completion-panel[hidden] {
  display: none;
}

.high-text {
  color: var(--danger);
}

.mid-text {
  color: var(--warning);
}

.low-text {
  color: var(--success);
}

.missing-text {
  color: var(--missing);
}

.missing-metric {
  background: #f7fafc;
}

.metric-card span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.report-action-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid #cfe1d8;
  border-radius: 8px;
  background: #f5fbf7;
}

.role-context-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 12px 0;
  padding: 11px 12px;
  border: 1px solid #cfe1d8;
  border-radius: 8px;
  background: #f5fbf8;
  color: #2e4a44;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.role-context-bar svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

.critical-section,
.review-workbench,
.recheck-panel,
.comparison-panel {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.critical-section .subsection-heading p,
.review-workbench .subsection-heading p,
.recheck-panel .subsection-heading p,
.comparison-panel .subsection-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.review-workbench {
  padding: 0;
  overflow: hidden;
  background: #f8faf9;
  box-shadow: 0 14px 34px rgba(36, 55, 50, 0.07);
}

.workbench-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 14px 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.workbench-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid #d5e0dc;
  border-radius: 8px;
  background: #eef3f1;
}

.workbench-tabs button {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5b6864;
  font-size: 13px;
  font-weight: 850;
}

.workbench-tabs button svg {
  width: 17px;
  height: 17px;
}

.workbench-tabs button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-tabs button strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(32, 38, 36, 0.08);
  color: #34423e;
  font-size: 12px;
}

.workbench-tabs button.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(31, 48, 43, 0.12);
}

.workbench-tabs button.active:first-child svg {
  color: var(--danger);
}

.workbench-tabs button.active:last-child svg {
  color: var(--missing);
}

.workbench-tabs button.active strong {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.workbench-tabs button strong.metric-status,
.workbench-tabs button.active strong.metric-status {
  min-width: auto;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid #cfe0da;
  background: #eef6f3;
  color: #315f54;
  font-size: 12px;
  line-height: 1;
}

.workbench-tabs button strong.metric-status[data-status="running"],
.workbench-tabs button.active strong.metric-status[data-status="running"] {
  border-color: #d9cba7;
  background: #fff8e5;
  color: #856114;
}

.workbench-tabs button strong.metric-status[data-status="failed"],
.workbench-tabs button.active strong.metric-status[data-status="failed"] {
  border-color: #edc4c4;
  background: #fff1f1;
  color: #9d3434;
}

.critical-risk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.critical-risk-card {
  display: grid;
  gap: 9px;
  min-height: 178px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
}

.critical-risk-card:hover,
.critical-risk-card.active {
  border-color: #aac3ba;
  background: #f8fbf9;
  box-shadow: 0 8px 18px rgba(29, 47, 42, 0.06);
}

.critical-topline {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.critical-topline > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.critical-topline strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.critical-risk-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.critical-risk-card small {
  color: #46605a;
  font-size: 12px;
  font-weight: 800;
}

.empty-critical {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

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

.enhancement-card {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 13px;
  border: 1px solid #d4dde5;
  border-left: 3px solid var(--missing);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
}

.enhancement-card.high {
  border-left-color: var(--danger);
}

.enhancement-card.medium {
  border-left-color: var(--warning);
}

.enhancement-card.low {
  border-left-color: var(--success);
}

.enhancement-card:hover,
.enhancement-card.active,
.enhancement-card:focus-visible {
  border-color: #9eb2c1;
  background: #f7fafc;
  outline: none;
}

.enhancement-card.active {
  border-left-width: 5px;
  box-shadow: 0 8px 20px rgba(49, 72, 91, 0.08);
}

.enhancement-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.enhancement-topline div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.enhancement-topline strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.enhancement-topline span,
.enhancement-card > p,
.enhancement-suggestion span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.enhancement-card > p,
.enhancement-suggestion p {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
}

.enhancement-suggestion {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  background: #f7fafc;
}

.enhancement-card .ghost-button {
  justify-self: start;
}

.empty-enhancement {
  grid-column: 1 / -1;
  border-style: dashed;
  border-left-width: 1px;
  color: var(--muted);
  text-align: center;
}

.report-action-strip div {
  min-width: 0;
}

.report-action-strip strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
}

.report-action-strip p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.report-action-strip .primary-button {
  flex: 0 0 auto;
  min-width: 118px;
}

.info-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.info-strip div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  background: #fbfcfb;
}

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

.info-strip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(340px, 1fr);
  gap: 14px;
  padding: 14px;
}

.risk-list-panel,
.risk-detail-panel,
.original-panel {
  padding: 14px;
}

.risk-list-panel {
  grid-row: span 2;
  background: #ffffff;
}

.risk-detail-panel,
.original-panel {
  background: #ffffff;
}

.list-heading {
  align-items: flex-start;
  gap: 10px;
}

.list-heading p {
  max-width: 460px;
}

#generateEnhancementsBtn {
  flex: 0 0 auto;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(4, 1fr);
  min-width: 160px;
  min-height: 32px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segmented-control button {
  min-width: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented-control button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(33, 42, 39, 0.1);
}

.risk-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.risk-list,
.workbench-enhancement-list {
  overflow: visible;
}

.workbench-enhancement-list {
  margin-top: 14px;
}

.risk-card {
  display: grid;
  gap: 9px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  text-align: left;
}

.risk-card.high {
  border-left-color: var(--danger);
}

.risk-card.medium {
  border-left-color: var(--warning);
}

.risk-card.low {
  border-left-color: var(--success);
}

.risk-card.missing_clause {
  background: #fbfdff;
}

.risk-card:hover,
.risk-card.active {
  border-color: #9fbbb1;
  background: #f6faf7;
}

.risk-card.active {
  border-color: #9fbbb1;
  border-left-width: 5px;
  box-shadow: 0 8px 20px rgba(39, 84, 74, 0.08);
}

.risk-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.risk-card h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.risk-card .clause {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.risk-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.risk-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.mini-tag.priority {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.mini-tag.missing,
.risk-badge.missing {
  background: var(--missing-soft);
  color: var(--missing);
}

.mini-tag.ai-running {
  background: #fff8e5;
  color: #856114;
}

.mini-tag.ai-failed {
  background: #fff1f1;
  color: #9d3434;
}

.confidence {
  background: #e5eef3;
  color: #376b81;
}

.detail-stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.detail-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.detail-block span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-block p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
}

.detail-block.current {
  border-color: #ecc4c0;
  background: #fff8f7;
}

.detail-block.suggestion {
  border-color: #bcdac8;
  background: #f5fbf6;
}

.detail-block.action {
  border-color: #c8d8ee;
  background: #f6f9fd;
}

.detail-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.suggestion-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.suggestion-title-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.suggestion-title-row > span {
  margin: 0;
}

.icon-button.tiny {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
}

.icon-button.tiny svg {
  width: 15px;
  height: 15px;
}

.clause-variant-control,
.change-filter-tabs {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf3ef;
}

.clause-variant-control button,
.change-filter-tabs button {
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.clause-variant-control button.active,
.change-filter-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(33, 42, 39, 0.1);
}

.detail-block.legal {
  border-color: #c8d6dd;
  background: #f7fbfd;
}

.ai-completion-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #c7ddd5;
  border-radius: 8px;
  background: linear-gradient(180deg, #f7fbf9 0%, #eef7f3 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.ai-completion-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.ai-completion-copy strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.ai-completion-copy p {
  margin: 0;
  color: #52645f;
  font-size: 13px;
  line-height: 1.55;
}

.ai-completion-button {
  min-width: auto;
  white-space: nowrap;
}

.ai-completion-button svg {
  width: 16px;
  height: 16px;
}

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

.legal-reference-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid #d6e2e8;
  border-radius: 8px;
  background: #ffffff;
}

.legal-reference-item strong {
  color: #244c60;
  font-size: 13px;
  line-height: 1.4;
}

.legal-reference-item p,
.empty-legal {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.legal-reference-item .legal-relevance {
  color: #39423f;
}

.legal-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legal-reference-item a {
  justify-self: start;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.legal-reference-item a:hover {
  text-decoration: underline;
}

.original-panel {
  min-height: 360px;
}

.original-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contract-text {
  display: grid;
  gap: 10px;
  max-height: 378px;
  overflow: auto;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  scroll-behavior: smooth;
}

.pdf-locator {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.pdf-toolbar span {
  min-width: 86px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.pdf-page-stage {
  overflow: hidden;
  min-height: clamp(620px, 78vh, 980px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9eeeb;
  cursor: zoom-in;
}

.pdf-page-stage:hover {
  border-color: #9fbbb1;
}

.pdf-page-canvas {
  position: relative;
  width: 100%;
}

.pdf-page-stage img {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
}

.pdf-highlight-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pdf-highlight {
  position: absolute;
  border: 2px solid rgba(194, 65, 58, 0.82);
  border-radius: 4px;
  background: rgba(255, 115, 105, 0.28);
  box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0.03);
}

.pdf-highlight.flash-target,
.contract-text p.flash-target {
  animation: locatorFlash 1.2s ease-in-out 2;
}

@keyframes locatorFlash {
  0%,
  100% {
    outline-color: #f2b8b2;
    border-color: rgba(194, 65, 58, 0.82);
    box-shadow: 0 0 0 0 rgba(251, 191, 36, 0);
  }

  50% {
    outline-color: #fbbf24;
    border-color: #fbbf24;
    box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.55);
  }
}

.missing-locator-notice {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #d4dde5;
  border-radius: 8px;
  background: #f7fafc;
  color: var(--missing);
}

.missing-locator-notice svg {
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.missing-locator-notice strong {
  display: block;
  color: #374b5d;
  font-size: 14px;
}

.missing-locator-notice p {
  grid-column: 2;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.contract-text p {
  margin: 0;
  padding: 8px 10px;
  border-radius: 7px;
  color: #39423f;
  font-size: 14px;
  line-height: 1.75;
}

.contract-text mark {
  padding: 2px 4px;
  border-radius: 4px;
  background: #ffe2df;
  color: #8f2e29;
  font-weight: 750;
}

.contract-text p.active-clause {
  background: #fff2ef;
  outline: 2px solid #f2b8b2;
}

.disclaimer {
  margin: 14px 0 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.report-footnote-link {
  display: block;
  margin-top: 5px;
}

.report-footnote-link a {
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: none;
  word-break: break-all;
}

.report-footnote-link a:hover {
  text-decoration: underline;
}

.site-footer {
  margin-top: auto;
  padding: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.site-footer strong {
  color: var(--brand-dark);
  font-weight: 850;
}

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

.mini-drop-zone {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px dashed #adc5bc;
  border-radius: 8px;
  background: #fff;
}

.mini-drop-zone:hover,
.mini-drop-zone.dragging,
.mini-drop-zone:focus-visible {
  border-color: var(--brand);
  background: #f3faf6;
}

.mini-drop-zone > svg {
  width: 26px;
  height: 26px;
  color: var(--brand);
}

.mini-drop-zone strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.mini-drop-zone p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.compact-progress {
  margin-top: 12px;
}

.comparison-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.comparison-score-grid div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.comparison-score-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.comparison-score-grid strong {
  font-size: 32px;
  line-height: 1;
}

.comparison-score-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.change-filter-tabs {
  margin-top: 12px;
}

.change-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.change-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.change-card.resolved {
  border-left-color: var(--success);
}

.change-card.remaining {
  border-left-color: var(--warning);
}

.change-card.new {
  border-left-color: var(--danger);
}

.change-card div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.change-card div > span {
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.change-card p,
.change-card small {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.next-actions {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cfe1d8;
  border-radius: 8px;
  background: #f5fbf8;
}

.next-actions strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.next-actions p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.dimension-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.dimension-card strong {
  font-size: 16px;
}

.dimension-card span {
  color: var(--brand);
  font-size: 24px;
  font-weight: 850;
}

.dimension-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.rules-table {
  display: grid;
  overflow: hidden;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rules-table [role="row"] {
  display: grid;
  grid-template-columns: 1.2fr 0.55fr 0.55fr 2fr;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.rules-table .table-head {
  border-top: 0;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 33, 31, 0.42);
}

.rule-config-modal {
  display: grid;
  width: min(880px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid #cfdad5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(19, 31, 28, 0.24);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.modal-body {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding: 18px;
}

.modal-note {
  margin: 0;
  padding: 12px;
  border: 1px solid #cfe1d8;
  border-radius: 8px;
  background: #f5fbf8;
  color: #2e4a44;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.rule-config-grid,
.rule-threshold-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.rule-config-grid label,
.rule-threshold-grid div {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.rule-config-grid span,
.rule-threshold-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.rule-threshold-grid strong {
  color: var(--ink);
  font-size: 14px;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  background: #fbfcfb;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  visibility: hidden;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #213532;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease;
}

.toast.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #7b2f2f;
}

.ui-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(18, 27, 25, 0.42);
  backdrop-filter: blur(3px);
}

.ui-lock-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(320px, calc(100vw - 36px));
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
}

.ui-lock-panel svg {
  width: 28px;
  height: 28px;
  color: var(--brand);
  animation: spin 1s linear infinite;
}

.ui-lock-panel strong {
  font-size: 15px;
}

.ui-lock-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

@keyframes activityPulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes progressStripes {
  to {
    background-position: 18px 0;
  }
}

[hidden] {
  display: none !important;
}

@media (max-width: 1240px) {
  .overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .score-card {
    grid-column: 1 / -1;
  }

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

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

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

  .quota-panel {
    display: none;
  }

  .upload-report-grid,
  .upload-page-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .workbench-header {
    align-items: stretch;
    flex-direction: column;
  }

  .workbench-tabs {
    width: 100%;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

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

@media (max-width: 720px) {
  .workspace {
    padding: 16px;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .drop-zone,
  .score-card {
    grid-template-columns: 1fr;
  }

  .overview-grid,
  .info-strip,
  .report-action-strip,
  .settings-grid,
  .critical-risk-grid,
  .recheck-grid,
  .comparison-score-grid,
  .rule-config-grid,
  .rule-threshold-grid {
    grid-template-columns: 1fr;
  }

  .report-action-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .upload-actions {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .subsection-heading,
  .report-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .original-actions {
    width: 100%;
  }

  .original-actions .ghost-button {
    flex: 1 1 140px;
  }

  .segmented-control {
    width: 100%;
    overflow-x: auto;
    grid-auto-flow: column;
    grid-template-columns: repeat(4, minmax(52px, 1fr));
  }

  .workbench-tabs {
    grid-template-columns: 1fr;
  }

  .suggestion-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-completion-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ai-completion-button {
    width: 100%;
  }

  .clause-variant-control,
  .change-filter-tabs {
    width: 100%;
    grid-auto-flow: column;
  }

  .rules-table [role="row"] {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-header,
  .modal-footer,
  .score-rules-head {
    align-items: stretch;
    flex-direction: column;
  }
}
