:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f7f9fd;
  --text: #0f172a;
  --muted: #667085;
  --line: #e5eaf3;
  --line-strong: #c8d3e2;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #0f766e;
  --accent-soft: #ecfdf5;
  --success: #12b76a;
  --warning: #f59e0b;
  --shadow: 0 12px 34px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(180deg, #edf4ff 0, rgba(237, 244, 255, 0.58) 260px, rgba(246, 248, 251, 0) 560px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.018) 0 1px, transparent 1px 104px) top / 104px 560px no-repeat,
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.app-shell {
  width: calc(100% - 48px);
  margin: 0 0 0 24px;
  padding: 0 0 24px;
}

.topbar {
  width: 100vw;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 18px -24px;
  padding: 0 24px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.78);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.top-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 34px;
  flex: 1;
  min-width: 0;
  align-self: stretch;
}

.top-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: #475467;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav a.active {
  color: #00369f;
}

.top-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 13px;
  height: 2px;
  border-radius: 999px;
  background: #00369f;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.icon-button {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  color: #475467;
  background: transparent;
  box-shadow: none;
  font-size: 20px;
  line-height: 1;
}

.icon-button:hover {
  color: var(--primary);
  background: #f1f5f9;
  box-shadow: none;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero {
  display: block;
  margin-bottom: 16px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 5px 9px;
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: 8px;
  color: var(--primary);
  background: rgba(239, 246, 255, 0.75);
  font-size: 13px;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 700px;
  font-size: clamp(30px, 3vw, 36px);
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

.subtitle {
  max-width: 680px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.hero > .hero-metrics {
  display: none;
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hero-metrics div {
  min-width: 120px;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid rgba(203, 213, 225, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: none;
}

.hero-metrics strong,
.hero-metrics span {
  display: block;
}

.hero-metrics strong {
  font-size: 20px;
  line-height: 1.1;
}

.hero-metrics span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.server-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 800;
  box-shadow: none;
}

.server-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #98a2b3;
}

.server-pill.ok {
  color: var(--success);
  border-color: rgba(18, 183, 106, 0.18);
  background: #f0fdf4;
}

.server-pill.ok::before {
  background: var(--success);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(520px, 28vw, 680px);
  gap: 24px;
  align-items: stretch;
  min-height: calc(100vh - 360px);
}

.main-stack {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  height: 100%;
}

.side-stack {
  display: grid;
  align-content: start;
  grid-template-rows: auto 1fr;
  gap: 18px;
  height: 100%;
}

.panel {
  border: 1px solid rgba(203, 213, 225, 0.78);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.composer-panel {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-style: dashed;
  box-shadow: none;
}

.composer-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--primary);
  display: none;
}

.requirement-panel {
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.compact-panel,
#rulePanel,
#resultPanel {
  padding: 20px;
}

.side-stack .compact-panel {
  display: flex;
  flex-direction: column;
}

#rulePanel,
#resultPanel {
  margin-top: 20px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.panel-head > span {
  flex: none;
  padding: 6px 10px;
  border-radius: 8px;
  color: #475467;
  background: #f1f5f9;
  font-size: 13px;
  font-weight: 800;
}

.compact-head {
  margin-bottom: 12px;
}

.upload-box {
  min-height: 108px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfdff;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.composer-panel .upload-box {
  min-height: 132px;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 20px;
  border-style: solid;
  background: #ffffff;
}

.upload-box:hover {
  border-color: var(--primary);
  background: #f8fbff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.upload-box.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.22);
}

.upload-box.drag-over .upload-icon {
  color: #fff;
  background: var(--primary);
}

.upload-box.selected {
  border-style: solid;
  border-color: #9db7ff;
  background: #f8fbff;
}

.upload-box.selected .upload-icon {
  color: #fff;
  background: var(--primary);
}

.upload-box.invalid {
  border-color: #f97316;
  background: #fff7ed;
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.18);
}

.upload-box.invalid .upload-icon {
  color: #c2410c;
  background: #ffedd5;
}

.upload-box input {
  display: none;
}

.upload-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 8px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 28px;
  font-weight: 500;
}

.upload-box strong,
.upload-box small {
  display: block;
}

.upload-box strong {
  font-size: 16px;
}

.upload-box small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.field-label {
  display: block;
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 900;
}

.optional-label {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  padding: 14px;
  border: 1px solid #d9e1ec;
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  line-height: 1.55;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.requirement-panel textarea {
  flex: 0 1 104px;
}

textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

button,
.link-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

button:hover:not(:disabled),
.link-button:hover:not(.disabled) {
  transform: translateY(-1px);
}

.examples button,
.secondary {
  color: var(--primary);
  background: #f8fbff;
}

.examples button {
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid #d8e5ff;
  border-radius: 999px;
  color: #1d4ed8;
  background: #f6f9ff;
  font-size: 13px;
  font-weight: 800;
}

.examples button:hover {
  background: #eff6ff;
  box-shadow: none;
}

.secondary {
  border: 1px solid #d8e5ff;
  color: var(--primary);
  background: #f8fbff;
}

.secondary:hover:not(:disabled) {
  border-color: #b8ccff;
  background: #eff6ff;
}

.primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.primary:hover:not(:disabled) {
  background: var(--primary-strong);
}

button:disabled,
.disabled {
  cursor: not-allowed;
  color: #8ba4d6;
  background: #e8effc;
  box-shadow: none;
  opacity: 1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.actions .secondary,
.actions .primary {
  min-width: 136px;
}

.actions .primary {
  min-height: 48px;
  background: #0b3aa6;
  box-shadow: 0 12px 24px rgba(11, 58, 166, 0.22);
}

.actions .primary:hover:not(:disabled) {
  background: #082f8f;
}

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

.steps li {
  display: grid;
  grid-template-columns: 30px 1fr;
  column-gap: 10px;
  align-items: center;
  padding: 7px;
  border-radius: 8px;
  opacity: 0.58;
}

.steps li span {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-row: span 2;
  border-radius: 8px;
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 900;
}

.steps li:first-child {
  border: 1px solid #d8e5ff;
  background: #f8fbff;
  opacity: 1;
}

.steps li:first-child span {
  color: #fff;
  background: var(--primary);
}

.steps li strong,
.steps li small {
  display: block;
}

.steps li small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

.capability-list span {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #e6edf7;
  border-radius: 6px;
  color: #475467;
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.side-metrics div {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
}

.side-metrics div:nth-child(2) {
  display: none;
}

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

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rule-grid div,
.summary-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: var(--panel-soft);
}

.summary-grid div.summary-warning {
  border-color: #fbbf24;
  background: #fffbeb;
}

.summary-grid div.summary-warning span {
  color: #92400e;
}

.summary-grid div.summary-warning strong {
  color: #b45309;
}

dt,
.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

dd,
.summary-grid strong {
  display: block;
  overflow-wrap: anywhere;
  margin: 6px 0 0;
  font-size: 15px;
}

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

.review-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  color: #78350f;
  background: #fffbeb;
}

.review-notice strong {
  flex: none;
}

.review-notice span {
  line-height: 1.5;
}

.process-notes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
}

.process-notes span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1e3a8a;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.result-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid #edf1f6;
}

.result-item.needs-review {
  padding: 12px;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  color: #78350f;
  background: #fffbeb;
}

.result-item.result-error {
  align-items: flex-start;
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
}

.result-item.result-error span:first-child {
  flex: 0 0 auto;
  color: #991b1b;
  font-weight: 700;
}

.result-item.result-error span:last-child {
  color: #7f1d1d;
  text-align: right;
}

.result-item:last-child {
  border-bottom: 0;
}

.result-item span:last-child {
  color: var(--muted);
}

.validation-card {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.validation-card.warning {
  border-color: #fbbf24;
  background: #fffbeb;
}

.validation-card.failed {
  border-color: #fecaca;
  background: #fef2f2;
}

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

.validation-title div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.validation-title strong {
  color: #1e3a8a;
  font-size: 16px;
}

.validation-card.warning .validation-title strong {
  color: #92400e;
}

.validation-card.failed .validation-title strong {
  color: #991b1b;
}

.validation-title span {
  display: inline-block;
  color: var(--muted);
  font-size: 13px;
}

.validation-title em {
  flex: none;
  padding: 5px 9px;
  border-radius: 999px;
  color: #1e3a8a;
  background: #dbeafe;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.validation-card.warning .validation-title em {
  color: #92400e;
  background: #fef3c7;
}

.validation-card.failed .validation-title em {
  color: #991b1b;
  background: #fee2e2;
}

.validation-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.validation-fields {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.validation-fields > span {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.validation-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #fff;
}

.validation-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #fff;
}

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

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

.validation-check strong,
.validation-field strong {
  color: var(--ink);
  font-size: 13px;
}

.validation-check.failed,
.validation-field.warning {
  border-color: #fbbf24;
  background: #fff7ed;
}

.validation-check.failed strong,
.validation-field.warning strong {
  color: #c2410c;
}

.validation-samples {
  margin-top: 10px;
  padding: 14px;
  border-radius: 8px;
  color: #7f1d1d;
  background: rgba(254, 226, 226, 0.75);
}

.validation-samples strong {
  display: block;
  margin-bottom: 10px;
}

.validation-samples p {
  margin: 4px 0 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.validation-sample-grid {
  display: grid;
  grid-template-columns: minmax(120px, 13%) minmax(80px, 9%) minmax(280px, 38%) minmax(100px, 12%) minmax(220px, 28%);
  width: 100%;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.55;
}

.validation-sample-grid > div {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(248, 113, 113, 0.24);
  overflow-wrap: anywhere;
}

.validation-sample-head {
  color: #991b1b;
  font-weight: 700;
  background: rgba(254, 202, 202, 0.45);
}

.preview-block {
  margin-top: 18px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #edf1f6;
}

.preview-head h3 {
  margin: 0;
  font-size: 16px;
}

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

.preview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #edf1f6;
  background: var(--panel-soft);
}

.preview-tab {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #344054;
  background: #fff;
  font-weight: 800;
}

.preview-tab.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.preview-tab.needs-review {
  border-color: #fbbf24;
  color: #92400e;
  background: #fffbeb;
}

.preview-table-wrap {
  overflow: auto;
  max-height: 420px;
}

.preview-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 13px;
}

.preview-table th,
.preview-table td {
  max-width: 220px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fff;
  background: var(--primary);
}

.preview-empty {
  padding: 18px;
  color: var(--muted);
}

.task-log-panel {
  margin-top: 0;
  padding: 20px;
}

.compact-action {
  min-height: 36px;
  padding: 0 14px;
}

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

.task-log-entry {
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.task-log-item {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 120px 110px 160px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.task-log-item:hover,
.task-log-item.expanded {
  background: #f8fbff;
}

.task-log-item.expanded {
  border-bottom: 1px solid #edf1f6;
}

.task-log-title {
  min-width: 0;
}

.task-log-title strong,
.task-log-meta span {
  display: block;
}

.task-log-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-log-title small,
.task-log-time,
.task-log-meta span,
.task-log-error {
  color: var(--muted);
  font-size: 12px;
}

.task-log-time {
  margin-top: 4px;
}

.task-log-status {
  justify-self: start;
  padding: 5px 9px;
  border-radius: 999px;
  color: #475467;
  background: #eef2f7;
  font-size: 12px;
  font-weight: 900;
}

.task-log-status.completed {
  color: #067647;
  background: #ecfdf3;
}

.task-log-status.failed {
  color: #b42318;
  background: #fef3f2;
}

.task-log-download {
  justify-self: end;
  min-height: 34px;
  padding: 0 12px;
}

.task-log-preview {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.task-log-preview .preview-table-wrap {
  max-height: 360px;
}

.empty-state {
  padding: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100% - 48px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(17, 24, 39, 0.92);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
}

.hidden {
  display: none !important;
}

.site-footer {
  display: flex;
  justify-content: center;
  padding: 22px 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.hero-metrics,
.side-metrics {
  display: none !important;
}

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

  .workspace {
    min-height: 0;
  }

  .topbar {
    gap: 16px;
  }

  .top-nav {
    gap: 22px;
    justify-content: flex-end;
  }

  .hero-metrics {
    max-width: 520px;
    justify-content: flex-start;
  }

  .side-stack {
    grid-template-columns: 1fr 1fr;
  }

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

  .task-log-item {
    grid-template-columns: minmax(0, 1fr) 110px;
  }

  .task-log-download {
    justify-self: start;
  }
}

@media (min-width: 961px) and (max-height: 820px) {
  .topbar {
    min-height: 50px;
    margin-bottom: 18px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .hero {
    margin-bottom: 16px;
  }

  .eyebrow {
    margin-bottom: 8px;
    padding: 4px 8px;
    font-size: 12px;
  }

  h1 {
    font-size: clamp(28px, 2.4vw, 34px);
  }

  .subtitle {
    margin-top: 6px;
    line-height: 1.35;
  }

  .main-stack {
    grid-template-rows: auto auto;
    height: auto;
    gap: 16px;
  }

  .side-stack {
    gap: 14px;
  }

  .composer-panel,
  .requirement-panel,
  .compact-panel,
  #rulePanel,
  #resultPanel {
    padding: 18px;
  }

  .panel-head {
    margin-bottom: 12px;
  }

  .composer-panel .upload-box {
    min-height: 132px;
    padding: 16px;
  }

  .upload-icon {
    width: 42px;
    height: 42px;
  }

  textarea {
    min-height: 76px;
    padding: 12px;
  }

  .requirement-panel textarea {
    flex-basis: 104px;
  }

  .field-label {
    margin-bottom: 10px;
  }

  .examples {
    margin-top: 10px;
  }

  .examples button {
    min-height: 26px;
  }

  .actions {
    margin-top: 14px;
  }

  .actions .primary {
    min-height: 44px;
  }

  .steps {
    gap: 6px;
  }

  .steps li {
    padding: 6px;
  }

  .capability-list span {
    padding: 7px 8px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    width: calc(100% + 24px);
    min-height: auto;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-left: -12px;
    padding: 10px 12px;
  }

  .top-nav {
    order: 3;
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 26px;
    min-height: 40px;
  }

  .top-nav a.active::after {
    bottom: 5px;
  }

  .top-actions {
    margin-left: auto;
    gap: 8px;
  }

  .hero-metrics,
  .side-stack,
  .rule-grid,
  .summary-grid,
  .task-log-item {
    grid-template-columns: 1fr;
  }

  .hero-metrics {
    display: grid;
    max-width: none;
  }

  .composer-panel,
  .compact-panel,
  #rulePanel,
  #resultPanel {
    padding: 18px;
  }

  .actions {
    justify-content: stretch;
  }

  button,
  .link-button {
    width: 100%;
  }

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

  .examples button {
    width: auto;
    max-width: 100%;
  }

  .upload-box {
    align-items: flex-start;
    min-height: 112px;
  }
}
