:root {
  color-scheme: light dark;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --text: #1b2421;
  --muted: #566460;
  --border: #d5dcd9;
  --accent: #4338ca;
  --accent-soft: #e8e9fb;
  --on-accent: #ffffff;
  --warn: #9a3412;
  --warn-bg: #fff3ea;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111715;
    --surface: #19211e;
    --text: #e5ece9;
    --muted: #a2b0aa;
    --border: #2e3a36;
    --accent: #a5b4fc;
    --accent-soft: #25274d;
    --on-accent: #14163a;
    --warn: #fdba74;
    --warn-bg: #2b1b10;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.brand {
  padding: 20px 0 4px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent);
}

h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 8px 0 8px;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 40px 0 10px;
}

h3 {
  font-size: 1.05rem;
  margin: 20px 0 4px;
}

p {
  margin: 0 0 12px;
}

.lead,
.muted {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.tab {
  flex: 1;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.tab[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 520px) {
  .fields.two {
    grid-template-columns: 1fr 1fr;
  }
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}

input[type="date"],
input[type="number"],
input[type="time"] {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 4px;
}

.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.check label {
  margin: 0;
  font-weight: 400;
  font-size: 1rem;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.result {
  margin-top: 16px;
  padding: 16px;
  background: var(--accent-soft);
  border-radius: var(--radius);
}

.big {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  overflow-wrap: anywhere;
}

.result p {
  margin: 4px 0 0;
}

.warn {
  color: var(--warn);
  background: var(--warn-bg);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.warn:empty {
  display: none;
}

details {
  border-top: 1px solid var(--border);
  padding: 4px 0;
}

summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

details p {
  margin: 0 0 12px;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--muted);
}

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

footer {
  margin-top: 40px;
  color: var(--muted);
  font-size: 0.85rem;
}

[hidden] {
  display: none !important;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.row:first-child {
  border-top: 0;
  padding-top: 0;
}

.day {
  grid-column: 1 / -1;
  font-weight: 700;
}

.cell label {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
}

.out {
  align-self: end;
  min-height: 44px;
}

.hours {
  margin: 0;
  font-weight: 600;
  line-height: 44px;
}

.out .warn {
  margin: 0;
  line-height: 1.4;
}

@media (min-width: 640px) {
  .row {
    grid-template-columns: 96px 1fr 1fr 110px 1.3fr;
    align-items: end;
  }

  .day {
    grid-column: auto;
    line-height: 44px;
  }
}

.summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 0;
}

.summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.summary div:last-child {
  border-bottom: 0;
}

.summary dt {
  color: var(--muted);
}

.summary dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.actions {
  margin-top: 12px;
}

.btn {
  min-height: 44px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.note {
  font-size: 0.9rem;
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
  color: var(--muted);
}

.ref td:nth-child(2),
.ref td:nth-child(4) {
  font-variant-numeric: tabular-nums;
}
