:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #eef2f5;
  --text: #182026;
  --muted: #5b6873;
  --line: #d8e0e6;
  --accent: #006d77;
  --accent-strong: #00535c;
  --accent-soft: #e2f3f4;
  --ready: #2f855a;
  --ready-soft: #e3f4ea;
  --review: #a15c00;
  --review-soft: #fff2d9;
  --danger: #a23e48;
  --danger-soft: #fae7e9;
  --ink: #26323a;
  --shadow: 0 16px 40px rgba(24, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

button {
  color: inherit;
}

svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.icon-sprite {
  display: none;
}

.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

h1 {
  font-size: 2.15rem;
}

h2 {
  font-size: 1.05rem;
}

h3 {
  font-size: 0.95rem;
}

.header-actions,
.editor-actions,
.assist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tool-button,
.primary-button,
.secondary-button {
  min-height: 42px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 13px;
  cursor: pointer;
  font-weight: 750;
  white-space: nowrap;
}

.tool-button,
.secondary-button {
  border-color: var(--line);
  background: var(--surface);
}

.tool-button:hover,
.secondary-button:hover {
  border-color: #b8c5ce;
  background: #fdfefe;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.dashboard-overview {
  margin-bottom: 12px;
}

.dashboard-card {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) auto minmax(280px, 1fr);
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 32, 38, 0.04);
}

.dashboard-copy {
  display: grid;
  gap: 10px;
}

.dashboard-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.dashboard-chart-wrap {
  display: grid;
  justify-items: center;
}

.pie-chart {
  position: relative;
  display: grid;
  place-items: center;
  width: 220px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(#d8e0e6 0deg 360deg);
}

.pie-chart-center {
  position: relative;
  z-index: 1;
  width: 122px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: center;
}

.pie-chart-center span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.pie-chart-center strong {
  font-size: 2rem;
}

.dashboard-stats {
  display: grid;
  gap: 10px;
}

.dashboard-legend {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 96px;
  display: grid;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 32, 38, 0.04);
}

.metric span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.metric strong {
  font-size: 2rem;
}

.metric-finished {
  border-color: rgba(47, 133, 90, 0.22);
}

.metric-unfinished {
  border-color: rgba(162, 62, 72, 0.22);
}

.metric-review {
  border-color: rgba(161, 92, 0, 0.22);
}

.legend-item {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfcfd;
}

.legend-item span:not(.legend-swatch) {
  color: var(--muted);
  font-weight: 650;
}

.legend-item strong {
  font-size: 1.05rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.legend-swatch.is-finished {
  background: var(--ready);
}

.legend-swatch.is-unfinished {
  background: var(--danger);
}

.legend-swatch.is-review {
  background: var(--review);
}

.assist-band,
.export-output,
.records-panel,
.editor-panel,
.check-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 32, 38, 0.04);
}

.assist-band {
  margin-bottom: 12px;
  padding: 16px;
}

.assist-form {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(160px, 0.45fr)) auto;
  gap: 12px;
  align-items: end;
}

.description-field {
  grid-row: span 2;
}

.assist-actions {
  align-self: stretch;
  flex-direction: column;
  justify-content: end;
}

.assist-actions .primary-button,
.assist-actions .secondary-button {
  width: 100%;
}

.status-line {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.export-output {
  margin-bottom: 12px;
  padding: 16px;
}

.export-output[hidden] {
  display: none;
}

.export-output-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#export-preview {
  min-height: 190px;
  font-family:
    "Cascadia Mono",
    "Segoe UI Mono",
    Consolas,
    monospace;
  font-size: 0.86rem;
  white-space: pre;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(520px, 1.6fr) minmax(280px, 0.9fr);
  gap: 12px;
  align-items: start;
}

.records-panel,
.editor-panel,
.check-panel {
  min-width: 0;
  overflow: hidden;
}

.records-panel,
.check-panel {
  position: sticky;
  top: 16px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.editor-title {
  align-items: start;
}

.list-controls {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field label {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cdd7df;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(0, 109, 119, 0.18);
  border-color: var(--accent);
}

.record-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 280px);
  overflow: auto;
  padding: 12px;
}

.record-row {
  width: 100%;
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.record-row:hover,
.record-row.is-selected {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.record-row-top,
.record-row-meta,
.risk-preview {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.record-row-top {
  justify-content: space-between;
}

.record-row-top strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-row-meta,
.risk-preview {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.82rem;
}

.risk-preview span {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.status-chip,
.risk-chip,
.status-pill,
.risk-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-chip.is-ready,
.status-pill.is-ready {
  background: var(--ready-soft);
  color: var(--ready);
}

.status-chip.is-review,
.status-pill.is-review {
  background: var(--review-soft);
  color: var(--review);
}

.status-chip.is-missing,
.status-pill.is-missing {
  background: var(--danger-soft);
  color: var(--danger);
}

.risk-chip.is-low,
.risk-pill.is-low {
  background: var(--surface-muted);
  color: var(--muted);
}

.risk-chip.is-medium,
.risk-pill.is-medium {
  background: var(--review-soft);
  color: var(--review);
}

.risk-chip.is-high,
.risk-pill.is-high {
  background: var(--danger-soft);
  color: var(--danger);
}

.record-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.record-form .wide,
.form-section {
  grid-column: 1 / -1;
}

.form-section {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.check-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 16px 0;
}

.completion {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 16px;
}

.completion-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.completion-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms ease;
}

.check-block {
  padding: 0 16px 16px;
}

.check-block h3 {
  margin-bottom: 8px;
}

.check-block ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.muted,
.empty-state {
  color: var(--muted);
}

.empty-state {
  border: 1px dashed #b8c5ce;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

@media (max-width: 1180px) {
  .dashboard-card,
  .assist-form,
  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-chart-wrap {
    justify-items: start;
  }

  .dashboard-legend {
    grid-template-columns: 1fr;
  }

  .description-field {
    grid-row: auto;
  }

  .assist-actions {
    flex-direction: row;
  }

  .records-panel,
  .check-panel {
    position: static;
  }

  .record-list {
    max-height: 420px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 18px 14px 42px;
  }

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

  .header-actions,
  .editor-actions,
  .assist-actions,
  .export-actions {
    width: 100%;
  }

  .tool-button,
  .primary-button,
  .secondary-button {
    flex: 1 1 auto;
  }

  .dashboard-stats,
  .record-form {
    grid-template-columns: 1fr;
  }

  .panel-title,
  .export-output-head,
  .editor-title {
    align-items: stretch;
    flex-direction: column;
  }

  .record-row-top {
    align-items: start;
    flex-direction: column;
  }
}
