:root {
  color-scheme: light dark;
  --bg: #111827;
  --panel: #1f2937;
  --panel-strong: #273449;
  --text: #f9fafb;
  --muted: #aeb7c7;
  --accent: #f59e0b;
  --accent-dark: #b45309;
  --border: rgba(255, 255, 255, 0.12);
  --error: #fca5a5;
  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 top left, rgba(245, 158, 11, 0.2), transparent 32rem),
    linear-gradient(135deg, #0f172a, #111827 45%, #0b1120);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 360px);
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 800px;
  margin-bottom: 16px;
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.lede {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.panel,
.scope-card,
.note {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(31, 41, 55, 0.82);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
}

.scope-card,
.stat-card {
  display: grid;
  gap: 6px;
}

.scope-card {
  padding: 24px;
  background: linear-gradient(145deg, rgba(39, 52, 73, 0.96), rgba(31, 41, 55, 0.82));
}

.scope-card span,
.stat-card span {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scope-card strong,
.stat-card strong {
  font-size: 1.08rem;
}

.scope-card small,
.stat-card small {
  color: var(--muted);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 24px;
  align-items: start;
  padding: 24px;
  margin-bottom: 16px;
}

.controls p,
.table-header p {
  margin-bottom: 0;
  color: var(--muted);
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.input-with-unit {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.72);
}

input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 14px 10px 14px 14px;
  outline: none;
}

input:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.input-with-unit span {
  padding-right: 14px;
  color: var(--muted);
}

.error-message {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--error);
  font-weight: 700;
}

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

.stat-card {
  padding: 20px;
}

.table-panel {
  padding: 24px;
}

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

button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #111827;
  cursor: pointer;
  font-weight: 800;
  padding: 12px 18px;
}

button:hover {
  background: #fbbf24;
}

button:active {
  background: var(--accent-dark);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
}

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

th,
td {
  padding: 15px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead {
  background: rgba(15, 23, 42, 0.7);
}

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

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr.zero-row {
  background: rgba(245, 158, 11, 0.13);
}

.note {
  margin-top: 16px;
  padding: 18px 20px;
  color: var(--muted);
  line-height: 1.55;
}

.note strong {
  color: var(--text);
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 1120px);
    padding: 28px 0;
  }

  .hero,
  .controls,
  .summary-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --panel: #ffffff;
    --panel-strong: #f1f5f9;
    --text: #111827;
    --muted: #5b6677;
    --border: rgba(17, 24, 39, 0.12);
  }

  body {
    background:
      radial-gradient(circle at top left, rgba(245, 158, 11, 0.18), transparent 32rem),
      linear-gradient(135deg, #f8fafc, #e5e7eb);
  }

  .panel,
  .scope-card,
  .note {
    background: rgba(255, 255, 255, 0.84);
  }

  .scope-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.86));
  }

  .input-with-unit,
  thead {
    background: rgba(241, 245, 249, 0.9);
  }
}
