:root {
  color-scheme: light;
  --paper: #faf8f3;
  --white: #fff;
  --ink: #18322b;
  --muted: #53665e;
  --green: #086953;
  --champagne: #efe2cc;
  --line: #dfcdb2;
  --danger: #992e3e;
  font: 16px/1.45 system-ui, sans-serif;
  color: var(--ink);
  background: #ebe8de;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.app {
  max-width: 500px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
main { flex: 1; padding: 18px 16px 24px; }
h1 { margin: 0 0 14px; font-size: clamp(1.45rem, 6vw, 2rem); line-height: 1.15; }
h2 { margin: 0 0 8px; font-size: 1.12rem; }
p { margin: 0 0 12px; }
button, input, textarea { font: inherit; }
button {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--white);
  font-weight: 620;
  cursor: pointer;
}
button:disabled { cursor: default; background: #f0eee8; color: var(--muted); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.primary, button[aria-pressed="true"], nav button[aria-current="page"] {
  border-color: var(--green);
  background: var(--green);
  color: var(--white);
}
.primary:disabled { border-color: var(--line); }
.primary, .secondary, .danger { font-weight: 680; }
.danger { color: var(--danger); border-color: #e6bbc2; }
nav {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
nav button { padding: 6px 2px; font-size: .85rem; }
.tag {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--champagne);
  font-size: .86rem;
  font-weight: 620;
}
.tag[data-status="approved"] { background: #dceee0; color: #24543b; }
.tag[data-status="cancelled"], .tag[data-status="rejected"] { background: #f2dee3; color: #732f40; }
.tag[data-status="transfer"] { background: #dceaf5; color: #294d67; }
.tag[data-status="completed"], .tag[data-status="expired"] { background: #edf0ed; }
.preview, .muted, .meta { color: var(--muted); font-size: .9rem; }
.preview { margin-bottom: 8px; }
#notice {
  padding: 10px 12px;
  border-left: 3px solid var(--green);
  background: #edf5ee;
  overflow-wrap: anywhere;
}
#notice.error { border-color: var(--danger); background: #fbebed; }
.choice, .week, .slots, .tabs, .actions, .week-controls {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.choice { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.week button { display: grid; place-content: center; padding: 4px 0; }
.week button small { font-size: .75rem; }
.slots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choice button, .slots button { padding: 5px 1px; font-size: .9rem; }
.tabs, .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.actions.single { grid-template-columns: 1fr; }
.week-controls { grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; text-align: center; }
.form-label { display: grid; gap: 4px; font-weight: 620; }
.fields, .stack { display: grid; gap: 10px; margin-bottom: 14px; }
input, textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}
textarea { min-height: 68px; resize: vertical; }
.card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  overflow-wrap: anywhere;
}
.card .tag { margin: 0 0 6px; }
.card .tag + .tag { margin-inline-start: 6px; }
.card .actions { margin: 8px 0 0; }
.status-changes {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}
.status-changes time { display: block; }
.status-changes p { margin: 2px 0 0; }
.card p:last-child { margin-bottom: 0; }
.card-toggle {
  position: relative;
  width: 100%;
  padding: 0 22px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  font-size: 1.05rem;
}
.meet { width: 100%; margin-top: 6px; }
dialog {
  width: min(390px, calc(100vw - 24px));
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}
dialog::backdrop { background: #18251f60; }
dialog .actions { margin-bottom: 0; }
@media (max-width: 375px) {
  main { padding-inline: 12px; }
  .choice, .slots { gap: 4px; }
}

.card-toggle::after {
  content: "";
  position: absolute;
  top: calc(50% - 4px);
  right: 4px;
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}
.card-toggle[aria-expanded="true"]::after { transform: rotate(135deg); }
.transfer {
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 6px;
  background: var(--paper);
  font-size: .9rem;
}
.transfer p { margin: 0; }
.dialog-field { margin-bottom: 12px; }
.settings-form { display: grid; gap: 8px; }
.settings-form summary { padding: 8px 0; font-weight: 650; cursor: pointer; }
.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(105px, 42%);
  gap: 8px;
  align-items: center;
  font-size: .9rem;
}
.settings-form .actions { margin: 6px 0 0; }
