:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #f2f2f2;
  background: #080808;
  --surface: #111;
  --raised: #191919;
  --muted: #a0a0a0;
  --line: #292929;
  --blue: #155eef;
  --focus: #83aaff;
  --radius: 14px;
}

* { box-sizing: border-box; }
body, h1, h2, p, dl, dd { margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; min-height: 44px; border: 0; border-radius: var(--radius); }
button:focus-visible, input:focus-visible, select:focus-visible, .date-jump:focus-within, .import:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
button:active { opacity: .78; }

.planner {
  max-width: 720px;
  margin: auto;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
.top, .brand, .calendar-header, .schedule-header, .editor-header, .editor-actions { display: flex; align-items: center; }
.top, .calendar-header, .schedule-header, .editor-header { justify-content: space-between; gap: 10px; }
.top { margin-bottom: 14px; }
.brand { gap: 10px; font-size: 1.1rem; font-weight: 800; letter-spacing: .1em; }
.brand-description { border-left: 1px solid var(--line); padding-left: 10px; font-size: .875rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.quiet { padding: 0 13px; background: var(--raised); color: inherit; font-weight: 550; }
.calendar { border: 1px solid var(--line); padding: 7px 10px 9px; border-radius: 17px; background: var(--surface); }
.calendar-header { margin-bottom: 3px; }
.date-jump { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; font-size: .9rem; font-weight: 600; border-radius: 8px; }
.date-jump input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.date-jump input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.week-controls { display: flex; gap: 4px; }
.week-controls button, .close { display: grid; place-items: center; width: 44px; background: var(--raised); color: inherit; font-size: 1.35rem; }
.chevron { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }
.chevron.previous { transform: rotate(135deg); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.week button { position: relative; display: grid; place-items: center; align-content: center; gap: 3px; min-height: 52px; padding: 4px 0 7px; color: inherit; background: transparent; }
.week button span { color: var(--muted); font-size: .875rem; }
.week button strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.week button[aria-current="date"] { box-shadow: inset 0 0 0 1px #515151; }
.week button[aria-pressed="true"] { background: #f2f2f2; color: #080808; }
.week button[aria-pressed="true"] span { color: #444; }
.week .has-tasks::after { content: ''; position: absolute; bottom: 4px; width: 4px; height: 4px; background: currentColor; border-radius: 50%; }

.schedule { margin-top: 21px; }
.schedule-header { margin-bottom: 12px; }
#day-title { font-size: .875rem; color: var(--muted); margin-bottom: 4px; }
h1 { font-size: clamp(1.35rem, 5.1vw, 2.35rem); font-weight: 650; line-height: 1.06; letter-spacing: -.045em; }
.primary { padding: 0 13px; color: #fff; background: var(--blue); font-weight: 650; white-space: nowrap; }
#add span { font-size: 1.1em; }
.day-panel { padding: clamp(12px, 3vw, 24px); border: 1px solid var(--line); border-radius: 21px; background: var(--surface); }
.day-start { display: block; color: var(--muted); font-size: .9rem; }
.day-start input { display: block; width: 100%; margin-top: 6px; font-size: 1.18rem; font-variant-numeric: tabular-nums; }
.day-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.day-stats dt { color: var(--muted); font-size: .875rem; }
.day-stats dd { margin-top: 4px; font-weight: 650; font-size: clamp(1rem, 4.5vw, 1.65rem); font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.completion { margin: 14px 0 11px; padding-top: 13px; border-top: 1px solid var(--line); }
#summary { color: var(--muted); font-size: .875rem; }
progress { display: block; width: 100%; height: 5px; margin-top: 8px; border: 0; appearance: none; border-radius: 9px; overflow: hidden; background: var(--line); color: var(--blue); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--blue); }
progress::-moz-progress-bar { background: var(--blue); }
.empty { display: grid; justify-items: center; gap: 9px; padding: 18px 6px 10px; text-align: center; }
.empty h2 { font-size: 1rem; font-weight: 600; }
#tasks { list-style: none; padding: 0; margin: 0; }
.task { display: grid; grid-template-columns: 44px minmax(48px, auto) minmax(0, 1fr); gap: 5px; align-items: center; }
.task + .task { margin-top: 6px; }
.task-time { display: grid; gap: 3px; color: #ddd; font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.task-time .end { color: var(--muted); }
.task-card { min-width: 0; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; }
.break-task .task-card { background: transparent; border-color: transparent; }
.break-task .task-title { color: var(--focus); }
.check { display: grid; place-items: center; background: transparent; color: #fff; }
.check span { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #737373; border-radius: 50%; }
.check[aria-pressed="true"] span { background: var(--blue); border-color: var(--blue); }
.task-name { display: grid; gap: 3px; width: 100%; padding: 7px 9px; background: transparent; color: inherit; text-align: left; overflow-wrap: anywhere; }
.task-title { font-size: 1rem; font-weight: 550; }
.task-details { color: var(--muted); font-size: .875rem; }
.done .task-title { text-decoration: line-through; color: var(--muted); }

dialog { width: min(calc(100% - 24px), 460px); max-height: calc(100% - 24px); overflow: auto; padding: 17px; border: 1px solid #424242; border-radius: 19px; color: inherit; background: var(--surface); }
dialog::backdrop { background: rgb(0 0 0 / 74%); }
dialog h2 { font-size: 1.2rem; }
form { display: grid; gap: 11px; }
form label { display: block; min-width: 0; font-size: .875rem; font-weight: 600; }
form input, form select, .day-start input { display: block; width: 100%; min-width: 0; min-height: 46px; padding: 7px 10px; margin-top: 5px; border: 1px solid #404040; border-radius: 11px; background: var(--raised); color: inherit; font-size: 1rem; }
.day-start input { color: #f2f2f2; font-size: 1.18rem; }
form select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, #a0a0a0 50%), linear-gradient(135deg, #a0a0a0 50%, transparent 50%); background-position: calc(100% - 15px) center, calc(100% - 10px) center; background-size: 5px 5px; background-repeat: no-repeat; }
.time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.optional { color: var(--muted); font-weight: 400; }
.editor-actions { justify-content: flex-end; gap: 8px; }
.danger { margin-right: auto; background: #2c171b; color: #ffb1b9; padding: 0 12px; }
#notice, #form-error { color: #ffb1b9; }
#notice { margin-bottom: 10px; }
#notice[data-success] { color: var(--focus); }
.backup-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.backup-actions .quiet { font-size: .875rem; background: transparent; color: var(--muted); }
.import { position: relative; display: inline-flex; align-items: center; min-height: 44px; border-radius: var(--radius); }
.import input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
