:root {
  color-scheme: light;
  --bg: #f7f4ec;
  --ink: #1f2428;
  --muted: #667071;
  --panel: #ffffff;
  --line: #d8d7cf;
  --accent: #126f78;
  --bar: #1f2428;
  --green-soft: #dcebd8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.25 ui-sans-serif, system-ui, -apple-system, sans-serif;
}

button, input { font: inherit; }

.alarm-bar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  background: var(--bar);
  color: white;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
}

.alarm-bar strong {
  font: 700 1.7rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -0.03em;
}

.alarm-bar p {
  margin: 0;
  color: #cad6d2;
  font-size: 0.78rem;
  font-weight: 700;
}

.app-shell {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: calc(68px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
}

.week-row,
.row,
.transport-times,
.dialog-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-row { margin-bottom: 8px; }
.week-row .segmented { flex: 1; margin: 0; }

.stack {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.row {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 4px 8px 4px 10px;
}

.row span,
.row > label {
  flex: 1;
  font-size: 0.86rem;
  font-weight: 800;
}

.row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

input[type="number"],
input[type="time"] {
  width: 4.4rem;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf6;
  color: var(--ink);
  padding: 4px 6px;
  text-align: center;
}

.hygiene:has(#showerEnabled:checked) .when-off,
.hygiene:has(#showerEnabled:not(:checked)) .when-on { display: none; }

.hygiene:has(#showerEnabled:checked) {
  border-color: var(--accent);
  background: var(--green-soft);
}

.row:has(> input[type="checkbox"]:checked) {
  border-color: var(--accent);
  background: var(--green-soft);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0 0 8px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eeece4;
}

.week-row .segmented { grid-template-columns: 1fr 1fr; }

.segmented label { min-width: 0; }

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.segmented input:checked + span {
  background: var(--accent);
  color: white;
}

.transport-times {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.transport-times label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.transport-times input { width: 100%; }

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #2b3236;
  color: white;
  padding: 0;
}

.week-row .icon-button {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.icon-button.copied { background: var(--accent); }

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

dialog {
  width: min(360px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px;
}

dialog::backdrop { background: rgba(31, 36, 40, 0.45); }

.dialog-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.dialog-head button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  padding: 6px 10px;
  font-weight: 800;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
}

.schedule-table th,
.schedule-table td {
  padding: 4px 2px;
  text-align: left;
}

.schedule-table thead th {
  color: var(--muted);
  font-size: 0.72rem;
}

.schedule-table tbody th {
  width: 2.4rem;
  font-size: 0.82rem;
}

.schedule-table input[type="time"] { width: 100%; }

input:focus,
.icon-button:focus-visible,
.dialog-head button:focus-visible,
.segmented input:focus-visible + span {
  outline: 2px solid rgba(18, 111, 120, 0.35);
  outline-offset: 1px;
}
