:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --ink: #17211f;
  --muted: #5b6762;
  --line: #d8dfda;
  --primary: #0f766e;
  --primary-dark: #0b4f4b;
  --accent: #c2410c;
  --surface: #ffffff;
  --soft: #e7f2ef;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(23, 33, 31, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  padding: 28px clamp(16px, 4vw, 48px) 18px;
  background: #0f3d3a;
  color: #fff;
}

.app-header h1 {
  max-width: 760px;
  margin: 4px 0 8px;
  font-size: clamp(2rem, 7vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.lede {
  max-width: 620px;
  margin: 0;
  color: #dceae6;
  font-size: 1.03rem;
}

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

.app-header .eyebrow {
  color: #fbbf24;
}

.app-shell {
  width: min(1180px, calc(100% - 24px));
  margin: 14px auto 42px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.tab {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.is-active {
  background: var(--primary);
  color: #fff;
}

.panel {
  display: none;
  margin-top: 14px;
  padding: clamp(16px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

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

h2,
h3 {
  margin: 3px 0 0;
  letter-spacing: 0;
}

.profile-grid,
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

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

.primary-button,
.install-button,
.ghost-button,
.danger-button,
.file-button {
  min-height: 44px;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-button,
.install-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.ghost-button,
.file-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary-dark);
}

.danger-button {
  border: 1px solid #f4b6b1;
  background: #fff4f2;
  color: var(--danger);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stat,
.item,
.summary-box,
.emergency-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stat {
  padding: 14px;
  min-height: 92px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 1.7rem;
  line-height: 1;
}

.summary-box {
  display: grid;
  gap: 8px;
  padding: 18px;
  background: var(--soft);
}

.summary-box p:last-child {
  margin: 0;
  color: var(--muted);
}

.list-section {
  margin-top: 24px;
}

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

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.item h3 {
  font-size: 1rem;
}

.item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.item button {
  min-width: 44px;
  min-height: 38px;
  border: 1px solid #f4b6b1;
  border-radius: 6px;
  background: #fff4f2;
  color: var(--danger);
  font-weight: 800;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.item .taken-button {
  border-color: #a7d8d0;
  background: #e7f2ef;
  color: var(--primary-dark);
}

.empty,
.hint {
  margin: 0;
  color: var(--muted);
}

.emergency-card {
  margin-top: 16px;
  padding: 18px;
}

.emergency-card dl {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px;
  margin: 0;
}

.emergency-card dt {
  color: var(--muted);
  font-weight: 800;
}

.emergency-card dd {
  margin: 0;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.file-button input {
  display: none;
}

@media (max-width: 840px) {
  .app-header {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(5, minmax(104px, 1fr));
  }

  .profile-grid,
  .form-grid,
  .inline-form,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .emergency-card dl {
    grid-template-columns: 1fr;
  }
}
