:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --line: #d9e1ec;
  --accent: #0b66ff;
  --accent-soft: #e9f1ff;
  --success: #067647;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.auth-shell {
  max-width: 720px;
}
.auth-hero {
  margin-top: 40px;
}
.auth-form {
  margin-top: 24px;
}
.auth-actions {
  justify-content: flex-start;
}
.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto 48px;
}
.hero, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.06);
}
.hero {
  padding: 28px;
  margin-bottom: 20px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
h1, h2, h3 { margin: 0; }
.summary {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 860px;
  line-height: 1.5;
}
.summary.small {
  font-size: 14px;
  margin-top: 8px;
}
.hero-grid, .grid {
  display: grid;
  gap: 16px;
}
.hero-grid {
  margin-top: 22px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.hero-grid article, .pill {
  background: var(--accent-soft);
  border-radius: 16px;
  padding: 14px 16px;
}
.label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}
.primary-action,
.button-action,
.secondary-action {
  display: inline-block;
  margin-top: 22px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 700;
  border: none;
  cursor: pointer;
}
.button-action { margin-top: 0; }
.secondary-action {
  margin-top: 0;
  background: #eef2ff;
  color: var(--accent);
}
.button-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.inline-note {
  color: var(--muted);
  font-size: 14px;
}
.grid.two-columns {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 20px;
}
.card {
  padding: 22px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.pill {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.pill.soft {
  background: #f2f4f7;
  color: var(--muted);
}
.stack, .checklist {
  margin: 0;
  padding-left: 18px;
  line-height: 1.5;
}
.stack li, .checklist li { margin-bottom: 10px; }
.stack a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.stack a:hover {
  text-decoration: underline;
}
.details {
  display: grid;
  grid-template-columns: minmax(110px, 160px) 1fr;
  gap: 10px 14px;
  margin: 0;
}
.details dt {
  color: var(--muted);
  font-weight: 600;
}
.details dd { margin: 0; }
.dashboard-shell,
.notifications-shell,
.versions-shell,
.workflow-shell,
.editor-shell {
  margin-bottom: 20px;
}
.dashboard-head {
  align-items: flex-start;
}
.dashboard-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.dashboard-filters label {
  display: grid;
  gap: 6px;
  min-width: 150px;
}
.dashboard-filters span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.dashboard-filters select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
}
.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.dashboard-metrics article,
.dashboard-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcfe;
}
.dashboard-metrics article {
  padding: 16px 18px;
}
.dashboard-grid {
  margin-bottom: 0;
}
.dashboard-panel {
  padding: 18px;
}
.compact-head {
  margin-bottom: 12px;
}
.dashboard-documents,
.dashboard-history {
  display: grid;
  gap: 12px;
}
.dashboard-row,
.history-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: white;
}
.dashboard-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(120px, 180px) minmax(150px, 180px);
  gap: 12px;
  align-items: center;
}
.dashboard-row p,
.history-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.dashboard-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.status-pill {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.history-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 6px;
}
.notifications-head,
.versions-head {
  align-items: flex-start;
}
.notifications-grid {
  margin-bottom: 0;
}
.notification-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #fbfcfe;
}
.notification-actions,
.notifications-events {
  display: grid;
  gap: 12px;
}
.notification-event-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: white;
}
.versions-head {
  align-items: flex-start;
}
.versions-groups {
  display: grid;
  gap: 16px;
}
.version-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #fbfcfe;
}
.version-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.versions-list {
  display: grid;
  gap: 12px;
}
.version-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 220px);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: white;
}
.diff-list {
  margin-bottom: 12px;
}
.workflow-head {
  align-items: flex-start;
}
.workflow-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}
.workflow-summary {
  margin-bottom: 18px;
}
.workflow-summary-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcfe;
}
.workflow-runs {
  display: grid;
  gap: 16px;
}
.workflow-run-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #fbfcfe;
}
.workflow-run-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.workflow-grid {
  margin-bottom: 0;
}
.workflow-run-card h4 {
  margin: 0 0 10px;
}
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.template-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #fbfcfe;
}
.template-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.template-required {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.template-preview {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: #18202a;
  color: #f8fafc;
  overflow: auto;
  white-space: pre-wrap;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.editor-head {
  align-items: flex-start;
}
.save-box {
  min-width: 280px;
  display: grid;
  gap: 6px;
}
#save-state[data-tone="success"] { color: var(--success); }
#save-state[data-tone="danger"] { color: var(--danger); }
#save-state[data-tone="working"] { color: var(--accent); }
.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.editor-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #fbfcfe;
}
.editor-card h3 {
  margin-bottom: 14px;
  font-size: 18px;
}
.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.field span {
  font-size: 14px;
  font-weight: 600;
}
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: white;
}
.field textarea {
  resize: vertical;
  min-height: 88px;
}
.checkbox-field {
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: white;
}
.checkbox-field input {
  width: 20px;
  height: 20px;
  margin: 0;
}
.checkbox-field span { margin: 0; }
.editor-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}
@media (max-width: 900px) {
  .dashboard-row,
  .version-row {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 1120px); }
  .hero, .card { border-radius: 18px; }
  .details { grid-template-columns: 1fr; }
  .editor-actions { justify-content: stretch; }
  .button-action { width: 100%; }
}
