@font-face {
  font-family: 'Inter Tight';
  src: url('/inter-tight.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --canvas: #05070a;
  --surface: #10141b;
  --muted: #1a2029;
  --line: #29313d;
  --text: #f5f7fa;
  --text-secondary: #8d98a6;
  --focus: #5b9dff;
  --accent: #5b9dff;
  --accent-ink: #05070a;
  --action-fill: #f5f7fa;
  --action-ink: #05070a;
  --control-border: #8d98a6;
  --success: #48cfa0;
  --danger: #ef6666;
  --warning: #f0b45b;
  --radius: 14px;
  --button-radius: 10px;
  --control-height: 54px;
  --gutter: 24px;
  --stack: 12px;
  --section: 24px;
  --font: 'Inter Tight', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 400 1rem/1.5 var(--font); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; font-weight: 600; overflow-wrap: anywhere; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
ul, ol { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
svg { flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
main:focus, h1:focus, #week-title:focus { outline-offset: 7px; }
.skip { position: fixed; z-index: 10; top: 12px; left: 12px; padding: 10px 16px; background: var(--surface); transform: translateY(-150%); }
.skip:focus { transform: none; }
.icon { width: 20px; height: 20px; }
.quiet { color: var(--text-secondary); font-size: .875rem; }

.button, .icon-button, .week-today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--button-radius);
  color: var(--text);
  background: var(--surface);
  font-size: .9375rem;
  font-weight: 600;
}
.button { min-height: var(--control-height); padding: 8px 16px; text-align: center; }
.button:hover, .icon-button:hover, .week-today:enabled:hover { background: var(--muted); border-color: var(--control-border); }
.button.primary { color: var(--action-ink); background: var(--action-fill); border-color: var(--action-fill); }
.button.primary:hover { background: #dbe5f4; border-color: #dbe5f4; }
.button.danger { color: var(--danger); border-color: currentColor; }
.button:disabled, .week-today:disabled { background: var(--muted); color: var(--text-secondary); border-color: var(--line); }
.icon-button { width: 44px; min-width: 44px; height: 44px; padding: 0; color: var(--text-secondary); }
.icon-button:hover { color: var(--text); }
.week-today { height: 44px; padding-inline: 12px; }

.loading { min-height: 65vh; display: grid; gap: var(--stack); place-content: center; padding: var(--gutter); text-align: center; }
.login {
  min-height: 100svh;
  padding: var(--gutter);
  display: grid;
  align-items: center;
  justify-items: center;
  background: radial-gradient(ellipse at 50% 12%, #14263f 0%, var(--canvas) 65%);
}
.login-panel { width: min(100%, 29rem); display: grid; gap: 32px; padding: clamp(24px, 7vw, 44px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.login-panel .brand { justify-self: start; }
.login h1 { font-size: 2.125rem; }
.login-copy { display: grid; gap: 12px; }
.login-copy p { color: var(--text-secondary); }
.login-panel form .button { width: 100%; }

.shell { display: grid; min-height: 100svh; grid-template-rows: auto 1fr; }
.top { min-height: 76px; padding: 10px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 10px; align-items: center; font-size: .875rem; line-height: 1.1; color: var(--text-secondary); }
.brand img { width: 40px; height: 40px; }
.brand strong { color: var(--text); font-size: 1.02rem; font-weight: 600; }
.account { display: flex; align-items: center; min-width: 0; gap: 8px; }
.account-name { display: none; }
.account .icon-button { border-color: transparent; background: transparent; }
.avatar { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--muted); color: var(--accent); font-weight: 600; }
.navigation { display: flex; position: fixed; z-index: 2; bottom: 0; inset-inline: 0; min-height: 80px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.navigation a { display: flex; flex: 1; align-items: center; justify-content: center; flex-direction: column; gap: 5px; border-radius: var(--button-radius); font-size: .875rem; min-width: 0; color: var(--text-secondary); }
.navigation a:hover, .navigation [aria-current] { background: var(--muted); color: var(--accent); }
.shell main { width: 100%; min-width: 0; max-width: 1380px; margin-inline: auto; padding: 24px var(--gutter) calc(108px + env(safe-area-inset-bottom)); }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px var(--section); margin-bottom: var(--section); }
.page-head p { margin-top: 6px; color: var(--text-secondary); font-size: .9375rem; }

.dashboard, .overview { display: grid; gap: var(--section); align-items: start; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-head { padding: 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--stack); border-bottom: 1px solid var(--line); }
.week-head h2 { margin-top: 4px; }
.eyebrow { font-size: .75rem; font-weight: 600; color: var(--accent); }
.week-nav { display: inline-flex; gap: 4px; }
.overview-panel { padding: 16px; display: grid; gap: 14px; }
.overview-heading { display: flex; align-items: center; gap: 8px; }
.overview-heading .icon { color: var(--accent); }
.overview-heading h2 { font-size: 1.125rem; }
.progress-value { display: flex; align-items: baseline; gap: 8px; }
.progress-value strong { font-size: 1.875rem; font-weight: 600; line-height: 1; }
.progress-value span { color: var(--text-secondary); font-size: .875rem; }
progress { width: 100%; height: 4px; appearance: none; border: 0; border-radius: 2px; background: var(--muted); color: var(--accent); }
progress::-webkit-progress-bar { background: var(--muted); border-radius: 2px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 2px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 2px; }
.lanes li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding-block: 10px; }
.lanes li + li { border-top: 1px solid var(--line); }
.lanes strong { min-width: 0; overflow-wrap: anywhere; text-align: right; font-size: .9375rem; }
.lane-tag, .today-tag, .pending-tag { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 4px 8px; border: 1px solid var(--line); border-radius: 15px; background: var(--muted); font-size: .8125rem; font-weight: 500; line-height: 1.2; overflow-wrap: anywhere; }
.lane-dot { background: var(--lane-color); width: 8px; height: 8px; border-radius: 100%; flex: none; }
.lane-tag .icon { width: 15px; height: 15px; color: var(--accent); }
.pending-tag { color: var(--warning); }
.today-tag { color: var(--accent); }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 36px 16px; min-height: 248px; text-align: center; }
.empty p { color: var(--text-secondary); font-size: .9375rem; margin-top: 6px; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 12px; color: var(--accent); background: var(--muted); }
.day { padding: 14px 16px; display: grid; align-items: start; gap: 8px; }
.day + .day, .entry + .entry { border-top: 1px solid var(--line); }
.day.today { background: var(--muted); }
.week-list .day:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.day-label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.day-label h3 { font-size: .9375rem; }
.day-label > span:not(.today-tag), .no-tasks { color: var(--text-secondary); font-size: .875rem; }
.no-tasks { padding-block: 5px; }
.occurrence { min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; }
.occurrence-content { flex: 1; min-width: 0; display: grid; overflow-wrap: anywhere; }
.occurrence .lane-tag { max-width: 40%; }
.task-title { font-weight: 600; }
.complete .task-title { text-decoration: line-through; color: var(--text-secondary); }
.task-person { color: var(--text-secondary); font-size: .875rem; }
.check { flex: none; appearance: none; width: 26px; height: 26px; margin: 9px; border: 1px solid var(--control-border); border-radius: 6px; cursor: pointer; }
.check::after { content: ''; display: block; width: 44px; height: 44px; margin: -10px; }
.check:checked { border-color: var(--success); background: var(--success); position: relative; }
.check:checked::before { content: ''; width: 7px; height: 13px; border: solid var(--canvas); border-width: 0 2px 2px 0; transform: rotate(45deg); position: absolute; top: 3px; left: 8px; }
.future-mark { margin: 18px; width: 8px; height: 8px; border: 1px solid var(--control-border); border-radius: 50%; flex: none; }
.entry { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 14px 16px; }
.entry h2 { font-size: 1.05rem; }
.entry p { margin-top: 4px; color: var(--text-secondary); font-size: .875rem; }
.entry-content { min-width: 5rem; flex: 1; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 6px; order: 1; width: 100%; }
.entry-actions { display: flex; gap: 4px; }
.entry-actions [data-action^='remove']:hover { color: var(--danger); }
.person-entry { flex-wrap: nowrap; }
.person-entry .entry-content { min-width: 0; }

dialog { width: min(34rem, calc(100% - 32px)); max-height: calc(100svh - 32px); padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--surface); }
dialog::backdrop { background: rgb(5 7 10 / 78%); }
dialog form { display: grid; gap: 8px; }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog-head { margin-bottom: 4px; }
.dialog-actions { justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
dialog label, dialog legend { font-size: .9375rem; font-weight: 600; }
dialog input:not([type='checkbox']), dialog select { width: 100%; padding: 8px 12px; min-height: var(--control-height); border: 1px solid var(--control-border); border-radius: var(--radius); background: var(--canvas); color: var(--text); margin-bottom: 6px; }
dialog select { appearance: none; padding-right: 32px; background: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%) right 17px center / 5px 5px no-repeat, linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%) right 12px center / 5px 5px no-repeat, var(--canvas); }
dialog fieldset { margin: 2px 0 6px; padding: 0; border: 0; }
dialog legend { padding: 0; margin-bottom: 8px; }
.day-options { display: flex; gap: 6px; flex-wrap: wrap; }
.day-choice { position: relative; }
.day-choice input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.day-choice span { display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 6px; border-radius: 18px; border: 1px solid var(--control-border); }
.day-choice input:checked + span { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.day-choice input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.form-error { color: var(--danger); }
.notice:empty { display: none; }
.notice { position: fixed; z-index: 3; left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); width: fit-content; max-width: calc(100% - 32px); margin-inline: auto; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--button-radius); background: var(--surface); color: var(--success); }
.notice.error { color: var(--danger); }

@media (min-width: 660px) {
  .account-name { display: inline; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .shell { grid-template-columns: 170px minmax(0, 1fr); }
  .top { grid-column: 1 / -1; }
  .navigation { position: static; flex-direction: column; width: auto; gap: 4px; padding: 24px 12px; border-right: 1px solid var(--line); border-top: 0; background: var(--canvas); }
  .navigation a { flex: none; min-height: 48px; justify-content: start; flex-direction: row; gap: 10px; padding: 0 10px; }
  .shell main { padding: 28px var(--gutter) 48px; }
  .entry-meta { order: initial; width: auto; max-width: 45%; }
  .notice { bottom: 24px; }
}

@media (min-width: 980px) {
  .shell { grid-template-columns: 202px minmax(0, 1fr); }
  .top { padding-inline: 28px; }
  .shell main { padding: 36px 32px 56px; }
  .dashboard { grid-template-columns: minmax(0, 1fr) minmax(246px, 30%); }
  .overview { gap: 16px; }
}

@media (min-width: 1150px) {
  .day { grid-template-columns: 112px minmax(0, 1fr); }
  .day-label { align-content: center; min-height: 44px; }
  .day-label h3 { width: 100%; }
}
