:root {
  color-scheme: light;
  --ink: #14262b;
  --muted: #637176;
  --line: #d9e1e2;
  --surface: #ffffff;
  --soft: #eef5f2;
  --brand: #12343b;
  --brand-2: #28666e;
  --accent: #d58b36;
  --ok: #1e7d4f;
  --bad: #b13e36;
  --warn: #8a6817;
  --radius: 8px;
  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:
    linear-gradient(135deg, rgba(18, 52, 59, 0.08), transparent 34%),
    linear-gradient(180deg, #f8fbfa 0%, #eef4f1 100%);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.topbar,
.records-head,
.actions,
.mini-actions,
.record-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 9vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 154px;
  margin-bottom: 14px;
  padding: 22px;
  border-radius: var(--radius);
  color: white;
  background:
    linear-gradient(rgba(18, 52, 59, 0.82), rgba(18, 52, 59, 0.88)),
    repeating-linear-gradient(0deg, #d9ddd8 0 15px, #cbd1ce 15px 31px);
}

.hero-copy h2 {
  max-width: 560px;
  margin: 12px 0 0;
  font-size: clamp(1.55rem, 7vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.status-pill {
  display: inline-flex;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
  font-weight: 800;
}

.material-stack {
  display: grid;
  gap: 8px;
  width: 108px;
  transform: rotate(-6deg);
}

.material-stack span {
  display: block;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 4px;
  background: linear-gradient(90deg, #e7e3d4, #bfc8c4);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 0 12px;
  backdrop-filter: blur(14px);
}

.tab,
.primary,
.secondary,
.icon-button,
.record-actions button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.tab {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px;
  font-weight: 800;
}

.tab.is-active {
  border-color: transparent;
  background: var(--brand);
  color: white;
}

.icon-button,
.record-actions button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  padding: 0;
}

.danger {
  color: var(--bad);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 46px rgba(22, 46, 50, 0.1);
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

.field {
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(40, 102, 110, 0.15);
}

.dynamic-fields {
  padding: 12px;
  margin: 2px 0 14px;
  border-radius: var(--radius);
  background: var(--soft);
}

.result-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin: 8px 0 16px;
  border-radius: var(--radius);
  background: #f8faf9;
  border: 1px solid var(--line);
}

.result-strip p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.result-strip strong {
  font-size: clamp(1.15rem, 5vw, 1.8rem);
}

.badge {
  flex: none;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.badge.pass {
  color: white;
  background: var(--ok);
}

.badge.fail {
  color: white;
  background: var(--bad);
}

.badge.neutral {
  color: var(--warn);
  background: #fff4d7;
}

.actions {
  gap: 10px;
}

.primary,
.secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 11px 14px;
  font-weight: 900;
}

.primary {
  flex: 1;
  border-color: transparent;
  background: var(--brand);
  color: white;
}

.secondary {
  background: white;
}

.records-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.records-head h2,
.records-head p {
  margin-bottom: 0;
}

.records-head p {
  color: var(--muted);
}

.mini-actions {
  gap: 8px;
}

.search-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.search-row input {
  border: 0;
  box-shadow: none;
  padding-left: 0;
}

.records-list {
  display: grid;
  gap: 10px;
}

.pdf-ready {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(30, 125, 79, 0.35);
  border-radius: var(--radius);
  background: #edf8f1;
}

.pdf-ready[hidden] {
  display: none;
}

.pdf-ready strong {
  display: block;
  font-size: 0.92rem;
}

.pdf-ready span {
  color: var(--muted);
  font-size: 0.82rem;
}

.pdf-ready a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
  text-decoration: none;
}

.empty {
  padding: 28px 10px;
  color: var(--muted);
  text-align: center;
}

.record-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.record-type {
  margin-bottom: 4px;
  color: var(--brand-2);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.record-card h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.record-meta {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.record-result {
  min-width: 96px;
  text-align: right;
}

.record-result strong,
.record-result span {
  display: block;
}

.record-result span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.record-actions {
  gap: 6px;
}

.advisor-output {
  margin-top: 16px;
}

.advice-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.advice-card h3 {
  margin-bottom: 0;
  color: var(--brand);
}

.advice-card h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--brand-2);
}

.advice-card ul {
  margin: 0;
  padding-left: 18px;
}

.advice-card li {
  margin-bottom: 7px;
  color: var(--ink);
  line-height: 1.42;
}

svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.2;
}

i[data-lucide] {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  min-height: 19px;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 900;
}

i[data-lucide="download"]::before {
  content: "GET";
}

i[data-lucide="calculator"]::before {
  content: "=";
}

i[data-lucide="clipboard-list"]::before {
  content: "LIST";
}

i[data-lucide="settings"]::before {
  content: "SET";
}

i[data-lucide="sparkles"]::before {
  content: "AI";
}

i[data-lucide="copy"]::before {
  content: "COPY";
}

i[data-lucide="save"]::before {
  content: "SAVE";
}

i[data-lucide="rotate-ccw"]::before {
  content: "RESET";
}

i[data-lucide="file-spreadsheet"]::before {
  content: "CSV";
}

i[data-lucide="file-down"]::before {
  content: "PDF";
}

i[data-lucide="trash-2"]::before {
  content: "DEL";
}

i[data-lucide="search"]::before {
  content: "FIND";
}

i[data-lucide="printer"]::before {
  content: "PDF";
}

i[data-lucide="x"]::before {
  content: "X";
}

i[data-lucide="check"]::before {
  content: "OK";
}

@media (max-width: 680px) {
  .app-shell {
    padding-inline: 12px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .material-stack {
    position: absolute;
    right: -22px;
    bottom: 14px;
    opacity: 0.32;
  }

  .two,
  .three,
  .record-card {
    grid-template-columns: 1fr;
  }

  .record-result {
    text-align: left;
  }

  .record-actions {
    justify-content: stretch;
  }

  .record-actions button {
    width: 100%;
  }

  .pdf-ready {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .hero-panel,
  .tabs,
  .actions,
  .records-head,
  .search-row,
  .record-actions {
    display: none !important;
  }

  .app-shell,
  .panel {
    width: 100%;
    padding: 0;
    box-shadow: none;
    border: 0;
  }
}
