:root {
  color-scheme: light dark;

  --bg: Canvas;
  --fg: CanvasText;
  --card: color-mix(in srgb, Canvas 92%, CanvasText 8%);
  --field: color-mix(in srgb, Canvas 96%, CanvasText 4%);
  --muted-card: color-mix(in srgb, Canvas 96%, CanvasText 4%);
  --line: color-mix(in srgb, CanvasText 18%, Canvas 82%);
  --soft-line: color-mix(in srgb, CanvasText 12%, Canvas 88%);
  --strong-line: color-mix(in srgb, CanvasText 28%, Canvas 72%);
  --hover: color-mix(in srgb, CanvasText 8%, Canvas 92%);
  --focus: color-mix(in srgb, CanvasText 36%, Canvas 64%);
  --muted: color-mix(in srgb, CanvasText 62%, Canvas 38%);

  --radius: 1rem;
  --shadow: 0 1rem 2.5rem rgb(0 0 0 / 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100dvh;
  margin: 0;
}

.app {
  min-height: 100dvh;
  padding: 1rem;
  display: grid;
  place-items: center;
}

.panel {
  width: min(100%, 34rem);
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

input,
textarea,
select,
button {
  width: 100%;
  font: inherit;
  color: inherit;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--field);
  padding: 0.8rem 0.9rem;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--focus);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: clamp(1.05rem, 4vw, 1.35rem);
}

tr:not(:last-child) td {
  border-bottom: 1px solid var(--line);
}

tr:hover {
  background: var(--hover);
}

td {
  padding: 1rem;
  vertical-align: middle;
}

td:first-child {
  width: 35%;
  font-weight: 700;
}

td:last-child {
  text-align: right;
  white-space: nowrap;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.helper {
  display: grid;
  gap: 0.75rem;
  margin-top: 2.25rem;
  padding: 1rem;
  border: 1px solid var(--soft-line);
  border-top: 0.25rem solid var(--strong-line);
  border-radius: var(--radius);
  background: var(--muted-card);
  box-shadow: none;
  opacity: 0.9;
}

.helper h2 {
  margin: 0 0 0.35rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--soft-line);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.helper input,
.helper textarea,
.helper select,
.helper button {
  font-size: 0.92rem;
}

.helper textarea {
  min-height: 2.8rem;
}

select {
  cursor: pointer;
}

button {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--card);
  padding: 0.8rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.helper button {
  width: auto;
  min-width: 8rem;
  padding: 0.65rem 0.9rem;
  font-weight: 600;
}

.empty-cell {
  text-align: center;
  white-space: normal;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

button:hover {
  background: var(--hover);
}

button:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 24rem) {
  .app {
    padding: 0.75rem;
  }

  .panel {
    gap: 0.75rem;
  }

  td {
    padding: 0.9rem 0.75rem;
  }

  td:last-child {
    font-size: 0.95em;
  }

  .helper {
    margin-top: 1.75rem;
    padding: 0.75rem;
  }

  .button-row {
    display: grid;
  }

  .helper button {
    width: 100%;
  }
}
