:root {
  --bg: #f4efe6;
  --bg-accent: #efe6d6;
  --paper: rgba(255, 250, 242, 0.9);
  --paper-strong: rgba(255, 255, 255, 0.96);
  --ink: #1d2433;
  --muted: #5d6678;
  --line: rgba(29, 36, 51, 0.12);
  --shadow: 0 24px 60px rgba(29, 36, 51, 0.08);
  --teal: #0d6f69;
  --amber: #b96c19;
  --red: #b43f31;
  --blue: #285ea8;
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(13, 111, 105, 0.12), transparent 28%),
    radial-gradient(circle at right center, rgba(185, 108, 25, 0.14), transparent 24%),
    linear-gradient(180deg, #fbf8f1 0%, #f1ebdf 100%);
  font-family: "Segoe UI Variable", Aptos, system-ui, sans-serif;
}

body { padding: 26px; }

a { color: inherit; text-decoration: none; }

.shell { max-width: 1440px; margin: 0 auto; }

.app-header,
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px 22px;
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(247,241,230,0.88));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: white;
  font-weight: 700;
  background: linear-gradient(135deg, #0d6f69, #285ea8);
}

.brand-kicker,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.brand-title {
  display: inline-block;
  margin-top: 4px;
  font-size: 1.15rem;
  font-weight: 700;
}

.main-nav,
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.main-nav a,
.admin-nav a,
button,
.secondary-link {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(29, 36, 51, 0.08);
  background: rgba(255,255,255,0.82);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.main-nav a.active,
.admin-nav a.active,
button,
.secondary-link:hover {
  color: white;
  background: linear-gradient(135deg, #1d2433, #33415e);
}

button {
  border: none;
  font: inherit;
}

.hero-grid,
.content-grid,
.metrics-grid,
.docs-grid {
  display: grid;
  gap: 22px;
  margin-top: 22px;
}

.hero-grid { grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr); }
.content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.docs-grid { grid-template-columns: minmax(290px, 0.75fr) minmax(0, 1.25fr); }
.metrics-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.hero-card,
.docs-card,
.panel,
.metric-card {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.82);
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, var(--paper-strong), var(--paper));
}

.hero-card {
  padding: 30px;
  background:
    linear-gradient(145deg, rgba(27, 39, 60, 0.96), rgba(37, 58, 91, 0.92)),
    radial-gradient(circle at top right, rgba(255,255,255,0.12), transparent 30%);
  color: white;
}

.hero-card h1,
.report-header h1,
.panel h2,
.docs-card h2,
.auth-panel h1 {
  font-family: Georgia, Cambria, "Times New Roman", serif;
}

.hero-card h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  margin: 16px 0 14px;
  line-height: 1.02;
}

.hero-card p,
.docs-card p,
.muted,
.panel-header p,
.metric-card p,
.table-subtext,
.doc-item span {
  color: var(--muted);
}

.hero-card p,
.docs-card p,
.panel-body,
.prose {
  line-height: 1.6;
}

.docs-card,
.panel,
.metric-card,
.report-header {
  padding: 24px;
}

.report-header {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, rgba(255,255,255,0.93), rgba(248,244,236,0.85));
}

.report-header h1,
.panel h2,
.docs-card h2,
.auth-panel h1 {
  margin: 10px 0 8px;
  font-size: 1.85rem;
}

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

.scan-form,
.admin-field,
.form-grid {
  display: grid;
  gap: 14px;
}

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

.scan-form { margin-top: 20px; }

.scan-form label,
.admin-field {
  gap: 8px;
}

.scan-form span,
.admin-field span {
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(29, 36, 51, 0.14);
  background: rgba(255,255,255,0.95);
  color: var(--ink);
  font: inherit;
}

textarea.code-editor {
  min-height: 420px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 0.95rem;
}

.callout-row,
.link-stack,
.run-stack,
.doc-list,
.issue-stack,
.stage-grid,
.artifact-list,
.artifact-strip {
  display: grid;
  gap: 12px;
}

.callout-row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 20px; }
.stage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.callout,
.doc-item,
.run-item,
.issue-row,
.stage-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(29, 36, 51, 0.08);
}

.doc-item,
.run-item,
.issue-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.doc-item {
  flex-direction: column;
  align-items: flex-start;
}

.stage-card h3 {
  margin: 10px 0 8px;
  font-size: 1.2rem;
}

.stage-card p {
  margin: 0 0 14px;
}

.stage-tag {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(13, 111, 105, 0.1);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.artifact-list div,
.artifact-strip div {
  display: grid;
  gap: 4px;
}

.artifact-list strong,
.artifact-strip strong {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.artifact-list span,
.artifact-strip span {
  font-size: 0.92rem;
  word-break: break-word;
}

.artifact-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.doc-item-active {
  background: rgba(13, 111, 105, 0.08);
  border-color: rgba(13, 111, 105, 0.28);
}

.run-item strong,
.doc-item strong,
.issue-row strong {
  display: block;
  margin-bottom: 4px;
}

.run-meta {
  text-align: right;
  color: var(--muted);
  font-size: 0.92rem;
}

.metrics-grid .metric-card span {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metrics-grid .metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
}

.notice {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.notice-success { background: rgba(13, 111, 105, 0.12); border-color: rgba(13, 111, 105, 0.22); }
.notice-danger { background: rgba(180, 63, 49, 0.12); border-color: rgba(180, 63, 49, 0.22); }
.notice-warning { background: rgba(185, 108, 25, 0.14); border-color: rgba(185, 108, 25, 0.24); }

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

.panel-header h2 { margin: 0; font-size: 1.4rem; }
.panel-header p { margin: 0; max-width: 36rem; }

.prose h1,
.prose h2,
.prose h3 { font-family: Georgia, Cambria, "Times New Roman", serif; }
.prose h1 { font-size: 2rem; }
.prose h2 { margin-top: 1.5rem; }
.prose code { background: rgba(29, 36, 51, 0.08); padding: 2px 6px; border-radius: 6px; }

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

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

thead th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
}

.table-subtext {
  font-size: 0.84rem;
  word-break: break-word;
}

.auth-shell {
  min-height: calc(100vh - 52px);
  display: grid;
  place-items: center;
}

.auth-panel {
  max-width: 540px;
  width: 100%;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.editor-toolbar button {
  background: rgba(255,255,255,0.8);
  color: var(--ink);
  border: 1px solid rgba(29,36,51,0.12);
}

.editor-toolbar button:hover {
  background: rgba(13, 111, 105, 0.12);
}

@media (max-width: 1180px) {
  .hero-grid,
  .content-grid,
  .docs-grid,
  .metrics-grid,
  .stage-grid,
  .artifact-strip,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body { padding: 12px; }
  .app-header,
  .admin-header,
  .hero-card,
  .docs-card,
  .panel,
  .metric-card,
  .report-header { padding: 18px; }
  .callout-row { grid-template-columns: 1fr; }
}
