:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #68736d;
  --paper: #f5f1e8;
  --panel: #fffdf8;
  --line: #ded5c4;
  --accent: #285943;
  --accent-2: #c46a3a;
  --warning: #8f4d22;
  --soft: #ece4d5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(196, 106, 58, 0.16), transparent 28rem),
    linear-gradient(135deg, #f7f0df, #eef2e8 48%, #f8f4ea);
  color: var(--ink);
}

a {
  color: var(--accent);
}

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

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  padding: 0.72rem 1rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(40, 89, 67, 0.18);
}

button.secondary,
.button.secondary {
  background: #ebe4d6;
  color: var(--ink);
  box-shadow: none;
}

button.danger {
  background: #9b3d31;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: white;
  color: var(--ink);
  padding: 0.72rem 0.82rem;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.app-shell,
.public-shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 4rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.9rem;
  background: var(--ink);
  color: var(--paper);
}

.hero-card,
.panel,
.auth-card,
.mini-card {
  border: 1px solid rgba(104, 115, 109, 0.2);
  border-radius: 1.4rem;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: 0 24px 70px rgba(40, 56, 46, 0.1);
}

.hero-card {
  padding: clamp(1.4rem, 4vw, 3rem);
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -3rem -7rem auto;
  width: 18rem;
  height: 18rem;
  border-radius: 999px;
  background: rgba(40, 89, 67, 0.08);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 1.5rem;
  align-items: start;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  letter-spacing: -0.04em;
}

h1 {
  margin: 0;
  max-width: 13ch;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: 0.92;
}

h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

h3 {
  margin: 0 0 0.5rem;
}

.lede {
  max-width: 63ch;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.auth-card,
.panel,
.mini-card {
  padding: 1rem;
}

.auth-card form,
.stack {
  display: grid;
  gap: 0.8rem;
}

.auth-grid,
.content-grid,
.form-grid,
.editor-grid,
.chart-row {
  display: grid;
  gap: 1rem;
}

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

.content-grid {
  grid-template-columns: 330px minmax(0, 1fr);
  align-items: start;
}

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

.full {
  grid-column: 1 / -1;
}

.pack-list {
  display: grid;
  gap: 0.7rem;
}

.pack-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fffaf0;
  color: var(--ink);
  padding: 0.9rem;
  text-align: left;
  box-shadow: none;
}

.pack-card.active {
  border-color: var(--accent);
  background: #e8efe8;
}

.pack-card small,
.muted,
.source-line span {
  color: var(--muted);
}

.main-panels {
  display: grid;
  gap: 1rem;
}

.panel-header,
.action-row,
.inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  padding: 0.22rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: capitalize;
}

.responsive-table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

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

.mini-card {
  box-shadow: none;
  margin: 0.7rem 0;
}

.mini-card.warning,
.contradiction-panel .mini-card {
  background: #fff3e8;
  border-color: rgba(143, 77, 34, 0.28);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.metric-grid div {
  border-radius: 1rem;
  background: #efe8dc;
  padding: 1rem;
}

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

.metric-grid span {
  color: var(--muted);
  font-weight: 700;
}

.chart-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
  background: #fffaf0;
}

.bar-row {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr) 2rem;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0;
  font-size: 0.86rem;
}

.bar-row div {
  height: 0.55rem;
  border-radius: 999px;
  background: #e0d5c2;
  overflow: hidden;
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-2);
}

.source-line {
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0;
}

.source-line a {
  display: block;
  font-weight: 850;
}

.subtle-link {
  display: inline-flex;
  margin: 0.7rem 0;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.public-hero h1 {
  max-width: 16ch;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.5rem 0;
}

.meta-grid div {
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.58);
}

.meta-grid dt {
  color: var(--muted);
  font-weight: 850;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.meta-grid dd {
  margin: 0.4rem 0 0;
}

.toast {
  position: sticky;
  top: 0.7rem;
  z-index: 2;
  border-radius: 1rem;
  background: var(--ink);
  color: white;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 880px) {
  .hero-grid,
  .auth-grid,
  .content-grid,
  .editor-grid,
  .form-grid,
  .chart-row,
  .meta-grid {
    grid-template-columns: 1fr;
  }

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

  .metric-grid {
    grid-template-columns: 1fr;
  }
}
