/* Midnight teal: quiet surfaces, soft neon accents and readable text. */
:root {
  color-scheme: dark;
  --ink: #c9dfdf;
  --muted: #8da8b2;
  --line: #29434f;
  --blue: #71dacf;
  --surface: #102531;
  --bg: #0a1722;
  --navy: #091e29;
  --lime: #b5db97;
  --raised: #15303c;
  --axis: #122936;
  --grid-half: #1b3540;
  --grid-hour: #294550;
  background: var(--bg);
  color: var(--ink);
  --link-colour: #86b1bc;
  --focus: #82d6d3;
  --sidebar-label: #a4bfc6;
  --avatar-bg: #233f4b;
  --secondary-ink: #afc8cf;
  --nav-active-bg: #21404a;
  --nav-active-ink: #d2e7e4;
  --legend-ink: #bcd3d9;
  --scroll-thumb: #42616e;
  --scroll-track: #0d222e;
  --note-bg: #0d2631;
  --primary-ink: #092b31;
  --accent-wash: #71dacf12;
  --positive: #8dbb85;
  --card-shadow: #030d1533;
  --switch-track: #0c202c;
  --switch-active-ink: #bcebe3;
  --switch-shadow: #030d1540;
  --switch-off: #36505d;
  --switch-knob: #b9d1d5;
  --switch-on-knob: #0e3438;
  --home-bg: #24364f;
  --home-ink: #b9d0f4;
  --groote-bg: #1b3a36;
  --groote-ink: #b0e2ce;
  --travel-bg: #393923;
  --travel-ink: #e1d8a5;
  --axis-ink: #9bb8c0;
  --unavailable-bg: #0310193d;
  --unavailable-ink: #89a4ae;
  --event-shadow: #020e1826;
  --warning: #e3cb82;
  --warning-wash: #e3cb8233;
  --warning-ink: #eee0af;
  --priority-ink: #122e3a;
  --event-hover-shadow: #72dacf16;
  --merge-bg: #164441f5;
  --merge-ink: #b5ece2;
  --important: #e1a0bc;
  --priority-hover: #122e3a18;
  --floating-shadow: #020d1666;
  --drag-over-bg: #173c47;
  --hint-bg: #173a43;
  --hint-ink: #89ded4;
  --hint-strong: #aacdd0;
  --weekend-bg: #12212c;
  --dialog-shadow: #020b165c;
  --dialog-backdrop: #020c16a6;
  --input-bg: #0d202b;
  --input-line: #36515d;
  --input-disabled-bg: #142f3b;
  --input-disabled-ink: #93aeb8;
  --dependency-bg: #16343e;
  --dependency-ink: #afcbd1;
  --danger: #efa2b0;
  --toast-bg: #193641;
  --toast-line: #47777c;
  --toast-ink: #d0e5e2;
  --toast-shadow: #020d1640;
  --selection-bg: #71dacf40;
  --selection-ink: #d8edeb;
  --drawer-shadow: #020d164d;
  --drawer-backdrop: #020c168f;
  --google-bg: #eef2f4;
  --google-ink: #1f3038;
  --google-line: #b4c4c9;
  --google-mark: #315fc1;
  --notice-line: #a69867;
  --notice-bg: #30352e;
}

:root[data-theme="light"] {
  color-scheme: light;
  --ink: #233747;
  --muted: #5b707e;
  --line: #cddce3;
  --blue: #1c786f;
  --surface: #ffffff;
  --bg: #f1f5f7;
  --navy: #e7edf2;
  --lime: #b5d496;
  --raised: #eef4f5;
  --axis: #e9f0f3;
  --grid-half: #e5ecef;
  --grid-hour: #cbd8de;
  --link-colour: #557988;
  --focus: #1c786f;
  --sidebar-label: #526b79;
  --avatar-bg: #d2e0e8;
  --secondary-ink: #506876;
  --nav-active-bg: #d7e9e7;
  --nav-active-ink: #205951;
  --legend-ink: #405c6b;
  --scroll-thumb: #a1b6c1;
  --scroll-track: #e8eef2;
  --note-bg: #e0eaed;
  --primary-ink: #ffffff;
  --accent-wash: #1c786f12;
  --positive: #4c7b52;
  --card-shadow: #24425512;
  --switch-track: #e7edf1;
  --switch-active-ink: #205951;
  --switch-shadow: #23374718;
  --switch-off: #c3d1d9;
  --switch-knob: #ffffff;
  --switch-on-knob: #ffffff;
  --home-bg: #e2edf8;
  --home-ink: #335777;
  --groote-bg: #e1efe7;
  --groote-ink: #346c50;
  --travel-bg: #f4ecd5;
  --travel-ink: #77571c;
  --axis-ink: #587180;
  --unavailable-bg: #c7d2dc3d;
  --unavailable-ink: #627986;
  --event-shadow: #23374714;
  --warning: #a0792d;
  --warning-wash: #a0792d33;
  --warning-ink: #695622;
  --priority-ink: #233747;
  --event-hover-shadow: #1c786f16;
  --merge-bg: #deeeeaf5;
  --merge-ink: #235d53;
  --important: #914664;
  --priority-hover: #23374718;
  --floating-shadow: #23374730;
  --drag-over-bg: #dfefed;
  --hint-bg: #dceeea;
  --hint-ink: #286f65;
  --hint-strong: #456774;
  --weekend-bg: #f3f6f8;
  --dialog-shadow: #23374735;
  --dialog-backdrop: #20344266;
  --input-bg: #ffffff;
  --input-line: #aabbc5;
  --input-disabled-bg: #e9eff3;
  --input-disabled-ink: #627885;
  --dependency-bg: #e5efef;
  --dependency-ink: #41616c;
  --danger: #a43853;
  --toast-bg: #deedea;
  --toast-line: #72a79e;
  --toast-ink: #234e46;
  --toast-shadow: #23374725;
  --selection-bg: #1c786f40;
  --selection-ink: #233747;
  --drawer-shadow: #23374735;
  --drawer-backdrop: #20344266;
  --google-bg: #ffffff;
  --google-ink: #1f3038;
  --google-line: #b4c4c9;
  --google-mark: #315fc1;
  --notice-line: #b3a26a;
  --notice-bg: #f9f2df;
}

:root[data-theme="aloula"] {
  color-scheme: light;
  --ink: #3c2f14;
  --muted: #756557;
  --line: #cfc1b7;
  --blue: #8c5e3f;
  --surface: #f9f7f4;
  --bg: #e5dede;
  --navy: #d9d6cc;
  --lime: #cab38f;
  --raised: #eee8e3;
  --axis: #e0d8d1;
  --grid-half: #e8e0d9;
  --grid-hour: #cfc0b5;
  --link-colour: #94775d;
  --focus: #a1704a;
  --sidebar-label: #675d52;
  --avatar-bg: #c7bbae;
  --secondary-ink: #655950;
  --nav-active-bg: #d8c9c8;
  --nav-active-ink: #3c2f14;
  --legend-ink: #5b5043;
  --scroll-thumb: #b5a69c;
  --scroll-track: #e2d9d3;
  --note-bg: #e8ddd6;
  --primary-ink: #fffaf4;
  --accent-wash: #a1704a12;
  --positive: #8c8e66;
  --card-shadow: #3c2f1412;
  --switch-track: #e3dad4;
  --switch-active-ink: #3c2f14;
  --switch-shadow: #3c2f1420;
  --switch-off: #c6bbb0;
  --switch-knob: #f9f7f4;
  --switch-on-knob: #f9f7f4;
  --home-bg: #e6e3e8;
  --home-ink: #5b5060;
  --groote-bg: #e3e6db;
  --groote-ink: #525b41;
  --travel-bg: #eaddc6;
  --travel-ink: #6b5029;
  --axis-ink: #726352;
  --unavailable-bg: #b8aaa03d;
  --unavailable-ink: #72685d;
  --event-shadow: #3c2f1414;
  --warning: #a1704a;
  --warning-wash: #a1704a33;
  --warning-ink: #635026;
  --priority-ink: #3c2f14;
  --event-hover-shadow: #a1704a16;
  --merge-bg: #eee3d9f5;
  --merge-ink: #3c2f14;
  --important: #86534e;
  --priority-hover: #3c2f1418;
  --floating-shadow: #3c2f1430;
  --drag-over-bg: #e4d6ca;
  --hint-bg: #e2d4c7;
  --hint-ink: #895d3c;
  --hint-strong: #6d5846;
  --weekend-bg: #eee7e2;
  --dialog-shadow: #3c2f1435;
  --dialog-backdrop: #3c2f1466;
  --input-bg: #fdfbf8;
  --input-line: #b8a797;
  --input-disabled-bg: #e7ddd5;
  --input-disabled-ink: #7b6b5d;
  --dependency-bg: #e9ddd2;
  --dependency-ink: #6a523e;
  --danger: #9a403d;
  --toast-bg: #e8ddd0;
  --toast-line: #b39270;
  --toast-ink: #3c2f14;
  --toast-shadow: #3c2f1425;
  --selection-bg: #a1704a40;
  --selection-ink: #3c2f14;
  --drawer-shadow: #3c2f1435;
  --drawer-backdrop: #3c2f1466;
  --google-bg: #f9f7f4;
  --google-ink: #3c2f14;
  --google-line: #c4b3a4;
  --google-mark: #315fc1;
  --notice-line: #b29770;
  --notice-bg: #efe3cc;
}

body { background: var(--bg); }
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline-color: var(--focus);
}
.sidebar { color: var(--ink); }
.demo-label { color: var(--sidebar-label); border-color: var(--line); }
.avatar { background: var(--avatar-bg); }
.profile small, .nav-heading, .project-legend small,
.sidebar-bottom, .sidebar-bottom small, .roster-note p {
  color: var(--muted);
}
.nav-item { color: var(--secondary-ink); }
.nav-item.active { background: var(--nav-active-bg); color: var(--nav-active-ink); }
.project-legend { color: var(--legend-ink); }
.project-list { gap: 4px; padding: 4px 0; }
button.project-legend { width: 100%; min-height: 42px; padding: 9px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: .875rem; text-align: left; cursor: pointer; }
button.project-legend small { margin-left: auto; }
button.project-legend:hover, button.project-legend.selected { background: var(--raised); border-color: var(--line); }
.project-overview { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.project-overview-heading { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.project-overview-heading > strong { flex: 1; font-size: .875rem; overflow-wrap: anywhere; }
.project-overview-heading .icon-button { flex-shrink: 0; }
.project-activities { display: grid; gap: 8px; max-height: 320px; overflow-y: auto; padding: 10px; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
.project-activity { display: grid; gap: 6px; width: 100%; padding: 10px; border: 1px solid var(--line); border-left: 3px solid var(--highlight-colour); border-radius: 6px; background: var(--raised); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.project-activity:hover { border-color: var(--highlight-colour); }
.project-activity strong { font-size: .875rem; line-height: 1.4; overflow-wrap: anywhere; }
.project-activity-category { color: var(--highlight-colour); font-size: .8125rem; line-height: 1.4; }
.project-activity-time { color: var(--secondary-ink); font-size: .875rem; line-height: 1.4; }
.project-activity.complete strong { text-decoration: line-through; }
.project-empty { margin: 0; font-size: .875rem; color: var(--muted); }
.project-focus { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--raised); font-size: .875rem; }
.project-focus > span { flex: 1; min-width: 120px; }
.project-focus .text-button { color: var(--blue); font-size: .875rem; }
.roster-note { background: var(--note-bg); border-color: var(--line); }
.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--primary-ink);
  box-shadow: 0 2px 9px var(--accent-wash);
}
.subtle, .icon-button, .summary-card, .planner-card,
.schedule-surface, .calendar-head, .calendar-end, dialog {
  background-color: var(--surface);
  color: var(--ink);
}
.summary-card:nth-child(3) { border-top-color: var(--positive); }
.planner-card { box-shadow: 0 5px 22px var(--card-shadow); }
.view-switch { background: var(--switch-track); border-color: var(--line); }
.view-switch button.active {
  background: var(--nav-active-bg);
  color: var(--switch-active-ink);
  box-shadow: 0 1px 4px var(--switch-shadow);
}
.planner-options { border-top-color: var(--line); }
.switch { background: var(--switch-off); }
.switch:after { background: var(--switch-knob); }
.switch-label input:checked + .switch:after { background: var(--switch-on-knob); }
.switch-label input:focus-visible + .switch { outline-color: var(--focus); }
.schedule-surface { scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
.calendar-inner, .calendar-body{ background-color: var(--surface); }
.day-head.today .day-num { color: var(--primary-ink); }
.date-nav #today { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; font-size: .875rem; }
.location-pill { background: var(--home-bg); color: var(--home-ink); }
.location-pill.groote { background: var(--groote-bg); color: var(--groote-ink); }
.location-pill.travel { background: var(--travel-bg); color: var(--travel-ink); }
.time-header, .time-axis, .calendar-end span { background: var(--axis); }
.time-header { align-items: center; justify-content: center; text-align: center; }
.calendar-head { z-index: 12; }
.day-head .day-name { font-size: 1rem; line-height: 1.4; font-weight: 600; }
.weekday-full { display: inline; }
.weekday-short { display: none; }
.time-label, .calendar-end span { color: var(--axis-ink); }
.day-column {
  background-color: var(--surface);
  background-image: repeating-linear-gradient(to bottom,
    transparent, transparent calc(var(--hour)/2 - 1px),
    var(--grid-half) calc(var(--hour)/2 - 1px),
    var(--grid-half) calc(var(--hour)/2),
    transparent calc(var(--hour)/2),
    transparent calc(var(--hour) - 1px),
    var(--grid-hour) calc(var(--hour) - 1px),
    var(--grid-hour) var(--hour));
}
/* Scheduling windows still apply; empty hours share one theme surface. */
.unavailable { background: transparent; }
.unavailable-label { color: var(--unavailable-ink); }
.task-event { box-shadow: 0 1px 3px var(--event-shadow); }
.task-event.fixed { opacity: .94; }
.task-event.non-negotiable{ border: 1px solid var(--warning); border-left: 4px solid var(--warning); box-shadow: inset 0 0 0 1px var(--warning-wash); }
.priority-badge { display: inline-block; color: var(--warning-ink); font-size: .75rem; font-weight: 650; line-height: 1.3; }
.task-event.compact .priority-badge { display: none; }
.task-event.project-highlight{ outline: 2px solid var(--highlight-colour); outline-offset: 1px; border-left-color: var(--highlight-colour); background: color-mix(in srgb, var(--highlight-colour) 25%, var(--surface)); color: var(--ink); }
.task-event.priority-highlight, .project-activity.priority-highlight, .activity-task.priority-highlight { background: var(--highlight-colour); color: var(--priority-ink); border-color: var(--highlight-colour); opacity: 1; box-shadow: none; }
.task-event.priority-highlight small, .task-event.priority-highlight .activity-category, .task-event.priority-highlight .priority-badge, .project-activity.priority-highlight .project-activity-category, .project-activity.priority-highlight .project-activity-time, .activity-task.priority-highlight small { color: var(--priority-ink); opacity: 1; }
.task-event.priority-highlight .activity-category i { box-shadow: 0 0 0 1px currentColor; }
.task-event:hover { box-shadow: 0 2px 10px var(--event-hover-shadow); }
.task-event.merge-target { outline: 2px solid var(--blue); outline-offset: 1px; z-index: 4; }
.task-event.merge-target::after { content: 'Merge · ' attr(data-merge-duration); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 4px; background: var(--merge-bg); color: var(--merge-ink); font-size: .875rem; font-weight: 650; }
.task-event.merge-blocked { outline: 2px solid var(--important); outline-offset: 1px; }
.calendar-task { position: absolute; left: 4px; right: 4px; z-index: 2; }
.calendar-task > .task-event { width: 100%; }
.calendar-task > .task-event, .calendar-task > .task-event.compact { padding-right: 25px; }
.task-event.locked { cursor: pointer; }
.lockable-task { position: relative; }
.lockable-task > .project-activity, .lockable-task > .activity-task { width: 100%; padding-right: 34px; }
.task-lock, .task-flag { position: absolute; top: 2px; right: 2px; z-index: 10; display: grid; place-items: center; width: 22px; height: 22px; max-height: calc(100% - 2px); padding: 2px; border: 0; border-radius: 4px; background: transparent; color: var(--event-ink, var(--ink)); cursor: pointer; touch-action: manipulation; }
.task-lock svg, .task-flag svg { width: 15px; height: 15px; max-height: 100%; }
.task-flag { top: auto; bottom: 2px; opacity: .65; }
.task-flag.is-important { color: var(--important); opacity: 1; }
.task-flag.is-important .flag-cloth{ fill: currentColor; }
.calendar-task.compact-controls > .task-lock { right: 26px; }
.calendar-task.compact-controls > .task-event { padding-right: 49px; }
.task-lock.is-unlocked { opacity: .7; }
.task-lock.is-locked { color: var(--warning); }
.task-lock:hover, .task-lock:focus-visible, .task-flag:hover, .task-flag:focus-visible { opacity: 1; background: var(--raised); outline: 1px solid var(--blue); }
.task-lock:disabled, .task-flag:disabled { opacity: .45; cursor: default; }
.task-lock:disabled:hover, .task-flag:disabled:hover { background: transparent; outline: 0; }
.lockable-task .task-lock { top: 6px; right: 5px; }
.lockable-task .task-flag { bottom: 6px; right: 5px; }
.priority-highlight > .task-lock, .priority-highlight > .task-flag{ color: var(--priority-ink); }
.priority-highlight > .task-lock:hover, .priority-highlight > .task-flag:hover, .priority-highlight > .task-lock:focus-visible, .priority-highlight > .task-flag:focus-visible { background: var(--priority-hover); }
.calendar-task:hover, .calendar-task:focus-within, .calendar-task.resizing { z-index: 8; }
.resize-handle { position: absolute; z-index: 9; display: grid; place-items: center; padding: 0; border: 1px solid var(--highlight-colour); border-radius: 5px; background: var(--surface); color: var(--highlight-colour); opacity: 0; pointer-events: none; touch-action: none; }
.calendar-task:hover .resize-handle, .calendar-task:focus-within .resize-handle { opacity: .6; pointer-events: auto; }
.calendar-task.resizing .resize-handle { opacity: 1; pointer-events: auto; }
.resize-top, .resize-bottom { width: 32px; height: 14px; left: 50%; transform: translateX(-50%); cursor: ns-resize; opacity: .35; pointer-events: auto; background: transparent; border-color: transparent; }
.resize-top { top: -7px; }.resize-bottom { bottom: -7px; }
.resize-left, .resize-right { width: 18px; height: 32px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.resize-left { left: -7px; }.resize-right { right: -7px; }
.resize-grip { display: block; width: 12px; height: 4px; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; }
.resize-left .resize-grip, .resize-right .resize-grip { width: 4px; height: 12px; border: 0; border-left: 1px solid currentColor; border-right: 1px solid currentColor; }
.resize-handle:hover, .resize-handle:focus-visible { background: color-mix(in srgb, var(--highlight-colour) 25%, var(--surface)); outline: 2px solid var(--highlight-colour); outline-offset: 1px; }
.calendar-task .resize-handle:hover { opacity: .8; }
.calendar-task .resize-handle:focus-visible { opacity: 1; }
.resize-handle:disabled { color: var(--muted); border-color: var(--line); border-style: dashed; cursor: not-allowed; }
.resize-top:disabled, .resize-bottom:disabled { opacity: .18; }
.calendar-task:hover .resize-handle:disabled, .calendar-task:focus-within .resize-handle:disabled { opacity: .3; }
.resize-handle:disabled:hover { background: var(--surface); outline: 0; }
.calendar-task.resizing .task-event { opacity: .3; }
.resize-preview { position: absolute; left: 4px; right: 4px; z-index: 6; box-sizing: border-box; padding: 8px 6px; overflow: hidden; border: 2px dashed var(--highlight-colour); border-radius: 5px; background: color-mix(in srgb, var(--highlight-colour) 22%, var(--surface)); color: var(--ink); font-size: .875rem; pointer-events: none; }
.resize-status { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 65; width: max-content; max-width: min(90vw,600px); padding: 12px 16px; border: 1px solid var(--blue); border-radius: 10px; background: var(--raised); color: var(--ink); box-shadow: 0 6px 30px var(--floating-shadow); font-size: .875rem; line-height: 1.5; pointer-events: none; }
.calendar-resizing { user-select: none; }
.calendar-resizing[data-resize-direction=top], .calendar-resizing[data-resize-direction=bottom] { cursor: ns-resize; }
.calendar-resizing[data-resize-direction=left], .calendar-resizing[data-resize-direction=right] { cursor: ew-resize; }
@media (hover:none) { .calendar-task .resize-handle { opacity: .5; pointer-events: auto; } .calendar-task .resize-handle:disabled { opacity: .2; } .calendar-task .resize-handle:focus-visible, .calendar-task.resizing .resize-handle { opacity: 1; } }
.calendar-slot { position: absolute; left: 0; width: 100%; z-index: 1; border: 0; border-radius: 0; padding: 8px; background: transparent; color: var(--merge-ink); font: inherit; font-size: .875rem; text-align: left; cursor: pointer; }
.calendar-slot span { opacity: 0; }
.calendar-slot:hover:not(:disabled), .calendar-slot:focus-visible { background: var(--accent-wash); }
.calendar-slot:hover:not(:disabled) span, .calendar-slot:focus-visible span { opacity: 1; }
.calendar-slot:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.calendar-slot:disabled { cursor: default; }
.unavailable { pointer-events: none; }
.day-column.drag-over { background-color: var(--drag-over-bg); }
.hint-icon { background: var(--hint-bg); color: var(--hint-ink); }
.hint-card b { color: var(--hint-strong); }
.example-note { color: var(--muted); }
dialog { box-shadow: 0 20px 80px var(--dialog-shadow); }
dialog::backdrop { background: var(--dialog-backdrop); }
.dialog-content input:not([type=checkbox]),
.dialog-content select, .dialog-content textarea {
  background: var(--input-bg);
  border-color: var(--input-line);
  color: var(--ink);
}
.dialog-content input:disabled, .dialog-content select:disabled {
  background: var(--input-disabled-bg);
  color: var(--input-disabled-ink);
}
.dependency-note { background: var(--dependency-bg); color: var(--dependency-ink); }
.form-error, .danger { color: var(--danger); }
.task-timing { display: grid; gap: 14px; }
.task-timing .form-row { margin: 0; }
.duration-field { max-width: 180px; }
.task-save-actions { display: flex; gap: 10px; margin-left: auto; }
.task-save-actions .primary { margin-left: 0; }
.task-save-actions .button { min-height: 44px; font-size: .875rem; white-space: nowrap; }
.task-save-actions [hidden] { display: none; }
@media (max-width:540px) {
  #task-form .dialog-footer { flex-wrap: wrap; }
  .task-save-actions { flex-basis: 100%; }
  .task-save-actions .button { flex: 1; }
}
.timing-help { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.check-row { flex-wrap: wrap; gap: 12px 20px; }
.check-row label { font-size: .875rem; line-height: 1.5; }
.time-fund { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
.time-fund h3 { margin: 0 0 12px; font-size: 1rem; }
.available-hours-controls { display: grid; gap: 10px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.available-hours-save { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.available-hours-save p { flex: 1; min-width: 150px; margin: 0; color: var(--secondary-ink); font-size: .875rem; line-height: 1.5; }
.available-hours-save .button { min-height: 44px; font-size: .875rem; }
.time-fund-totals { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.time-fund-totals > div { display: grid; align-content: start; gap: 6px; }
.time-fund-totals span { font-size: .875rem; color: var(--muted); line-height: 1.4; }
.time-fund-totals strong { font-size: 1rem; color: var(--ink); line-height: 1.4; }
.time-fund-totals > div:last-child strong { color: var(--blue); }
.time-allocation, .time-budget-controls { display: grid; gap: 12px; }
.time-allocation h3 { margin: 0; font-size: 1rem; }
.time-fund-breakdown { min-width: 0; }
.time-allocation-table { width: 100%; border-collapse: collapse; font-size: .8rem; line-height: 1.4; }
.time-allocation-table th, .time-allocation-table td { padding: 10px 4px; text-align: right; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.time-allocation-table thead th { color: var(--muted); font-weight: 500; }
.time-allocation-table th:first-child { width: 34%; padding-left: 0; text-align: left; }
.time-allocation-table td { font-variant-numeric: tabular-nums; }
.budget-category { display: flex; align-items: center; gap: 7px; min-height: 30px; padding: 0; border: 0; text-align: left; font: inherit; color: var(--ink); background: transparent; cursor: pointer; }
.budget-category:hover { color: var(--blue); }
.budget-category i { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; }
.budget-over { color: var(--danger); }
.time-budget-controls { padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width:420px) { .time-allocation-table { font-size: .75rem; } .time-allocation-table th, .time-allocation-table td { padding-right: 2px; padding-left: 2px; } }
.time-available { margin: 0; font-size: .875rem; line-height: 1.5; color: var(--blue); }
@media (max-width:420px) { .time-fund-totals { grid-template-columns: 1fr; } .time-fund-totals > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; } }
.dialog-content input[type=date], .dialog-content input[type=time] { color-scheme: inherit; min-width: 0; }
.category-field { display: grid; gap: 7px; }
.category-picker { display: flex; align-items: center; gap: 10px; }
.category-picker select { flex: 1; min-width: 0; }
.category-picker .button { flex-shrink: 0; }
.category-intro { margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.5; }
#category-form { display: grid; gap: 16px; }
.category-palette { padding: 0; margin: 0; border: 0; min-width: 0; }
.category-palette legend { margin-bottom: 10px; font-size: .875rem; font-weight: 550; }
.category-colours { display: flex; flex-wrap: wrap; gap: 10px; }
.category-palette .colour-choice { position: relative; display: grid; place-items: center; width: 42px; height: 42px; cursor: pointer; }
.category-palette .colour-choice input[type=radio] { position: absolute; width: 1px; min-height: 0; height: 1px; margin: 0; padding: 0; opacity: 0; }
.colour-choice span { width: 26px; height: 26px; border-radius: 50%; }
.colour-choice input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); }
.colour-choice input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 7px; }
.category-status { margin: 0; color: var(--blue); font-size: .875rem; line-height: 1.5; }
.category-status:empty, #category-error:empty { display: none; }
.category-list-title { margin: 4px 0 0; font-size: 1rem; font-weight: 600; }
.category-list { list-style: none; padding: 0; margin: 0; display: grid; }
.category-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.category-list li:last-child { border-bottom: 0; }
.category-list strong { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .875rem; font-weight: 550; }
.category-list small { flex-shrink: 0; color: var(--muted); font-size: .875rem; }
.category-swatch { width: 12px; height: 12px; flex-shrink: 0; border-radius: 4px; }
.activity-category { display: flex; align-items: center; gap: 5px; min-width: 0; margin-top: 4px; font-size: .75rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-category i { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; }
.activity-category span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.task-event.compact .activity-category { display: none; }
.toast {
  background: var(--toast-bg);
  border: 1px solid var(--toast-line);
  color: var(--toast-ink);
  box-shadow: 0 4px 25px var(--toast-shadow);
}
::selection { background: var(--selection-bg); color: var(--selection-ink); }

/* The menu stays reachable while the sidebar is collapsed. */
.app-shell.sidebar-collapsed { grid-template-columns: minmax(0,1fr); }
.sidebar[hidden], .sidebar-backdrop[hidden] { display: none; }
.topbar-leading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-leading > div { min-width: 0; }
.burger-button { width: 40px; height: 40px; color: var(--blue); }
.hamburger-icon { display: flex; flex-direction: column; gap: 4px; }
.hamburger-icon span { width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
.sidebar-heading { display: flex; align-items: center; gap: 10px; }
.sidebar-heading .brand { flex: 1; }
.sidebar-close, .sidebar-backdrop { display: none; }

@media (max-width:850px) {
  .sidebar { display: none; }
  .app-shell.sidebar-open .sidebar {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px,86vw);
    height: 100vh;
    height: 100dvh;
    padding: 24px 20px;
    z-index: 30;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    box-shadow: 12px 0 45px var(--drawer-shadow);
  }
  .sidebar[hidden] { display: none; }
  .sidebar-heading .brand { max-width: none; }
  .sidebar-close { display: inline-grid; }
  .sidebar .profile { display: flex; }
  .sidebar .nav-heading, .sidebar .roster-note, .sidebar .sidebar-bottom { display: block; }
  .sidebar .project-list { display: flex; }
  .sidebar nav { display: block; }
  .sidebar .nav-item { width: 100%; margin: 3px 0; padding: 12px 14px; font-size: .94rem; }
  .sidebar .nav-item span { display: inline; }
  .sidebar-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    width: 100%;
    height: 100%;
    border: 0;
    background: var(--drawer-backdrop);
    cursor: pointer;
  }
  body.navigation-drawer-open { overflow: hidden; }
}
@media (max-width:540px) {
  .topbar-leading { gap: 10px; }
  .burger-button { width: 36px; height: 36px; }
}

/* Shared planner controls stay hidden until Google login is configured. */
[hidden] { display: none !important; }
.cloud-start .app-shell { display: none; }
.cloud-start .login-gate { display: flex !important; }
.login-gate { min-height: 100dvh; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(100%, 420px); padding: 32px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.login-card h1 { margin: 12px 0 18px; font-size: 2rem; line-height: 1.15; }
.login-card p { font-size: 1rem; line-height: 1.6; }
.login-note { color: var(--muted); margin-top: 24px; }
.google-button { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; margin: 20px 0 12px; background: var(--google-bg); color: var(--google-ink); border: 1px solid var(--google-line); }
.google-button span { font-size: 1.25rem; font-weight: 700; color: var(--google-mark); }
.account-controls { border-top: 1px solid var(--line); padding: 14px 0; display: flex; flex-wrap: wrap; gap: 10px; }
.account-email, .account-role { flex-basis: 100%; margin: 0; font-size: .875rem; overflow-wrap: anywhere; }
.account-role { color: var(--muted); }
.account-controls .text-button { color: var(--ink); }
.sync-warning, .import-planner { border: 1px solid var(--notice-line); padding: 14px 18px; margin-bottom: 16px; border-radius: 12px; background: var(--notice-bg); }
.sync-warning p, .import-planner p { margin: 0 0 12px; font-size: .875rem; line-height: 1.5; }
.sync-warning > div { display: flex; flex-wrap: wrap; gap: 8px; }
#share-dialog { width: min(94vw, 560px); }
#share-form { display: grid; gap: 16px; }
#share-form > button { justify-self: start; }
.shared-member { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.shared-member span { font-size: .875rem; overflow-wrap: anywhere; }
.shared-member button { flex-shrink: 0; }
.shared-planner .hint-card, .shared-planner .example-note, .shared-planner .sidebar-bottom small { display: none; }

/* Editable weekly controls and a compact activity overview. */
.summary-control { text-align: left; cursor: pointer; font: inherit; color: var(--ink); }
.summary-control:hover:not(:disabled) { border-color: var(--blue); background: var(--raised); }
.summary-control:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.summary-control:disabled { opacity: 1; cursor: default; }
.summary-label { font-size: .875rem; }
.summary-card small { font-size: .875rem; }
.planner-options { justify-content: flex-end; }
.option-controls { width: 100%; justify-content: space-between; }
#schedule-time-form .dialog-content { gap: 16px; }
#schedule-time-form label, #week-location-form label { display: grid; gap: 7px; font-size: .875rem; }
#schedule-time-form .form-row { margin: 0; }
#location-review:empty, #location-error:empty, #schedule-time-error:empty { display: none; }
.activity-tasks { display: grid; gap: 10px; }
.activity-task { text-align: left; display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--raised); color: var(--ink); }
.activity-task strong { font-size: 1rem; font-weight: 550; }
.activity-task small { font-size: .875rem; line-height: 1.4; color: var(--secondary-ink); }
@media (max-width:850px) {
  .weekday-full { display: none; }
  .weekday-short { display: inline; }
  .day-head .day-name{ font-size: .875rem; }
}
@media (max-width:540px) {
  .summary-label, .summary-card small { font-size: .875rem; }
  .summary-card strong { font-size: 1.25rem; }
  .summary-control { min-height: 116px; }
  #schedule-time-dialog .dialog-content, #week-location-dialog .dialog-content { padding: 16px; }
}

/* A device preference, available even with the navigation closed. */
.topbar-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.calendar-actions { display: flex; justify-content: flex-end; margin: 12px 0 16px; }
.calendar-actions .button { min-height: 44px; font-size: .875rem; }
.reset-preview { padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--raised); color: var(--ink); }
.reset-preview strong { font-size: 1rem; line-height: 1.5; }
.reset-preview p { margin: 8px 0 0; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.reset-confirm { background: var(--danger); border-color: var(--danger); color: var(--primary-ink); }
#reset-form .dialog-footer .button { min-height: 44px; font-size: .875rem; }
@media (max-width:420px) { #reset-form .form-row { grid-template-columns: 1fr; } }
.theme-picker { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .875rem; }
.theme-picker select { min-height: 40px; padding: 7px 28px 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
:root[data-theme=light] .project-activity-category, :root[data-theme=aloula] .project-activity-category{ color: color-mix(in srgb, var(--highlight-colour) 25%, var(--ink)); }
:root[data-theme=light] .priority-highlight .project-activity-category, :root[data-theme=aloula] .priority-highlight .project-activity-category{ color: var(--priority-ink); }
@media (max-width:680px) {
  .topbar { flex-wrap: wrap; gap: 14px; }
  .topbar-actions { margin-left: auto; gap: 10px; }
}

/* A single scrolling surface per modal; fixed actions remain reachable on iOS. */
dialog { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; }
dialog > form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
dialog .dialog-header, dialog .dialog-footer { flex: 0 0 auto; }
dialog .dialog-content { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
body:has(dialog[open]) { overflow: hidden; }
.account-button { display: grid; place-items: center; }
.account-button[hidden] { display: none; }
#account-dialog .account-controls { border-top: 0; padding: 0 0 18px; border-bottom: 1px solid var(--line); }
.push-settings { display: flex; flex-direction: column; gap: 14px; }
.push-settings p { margin: 0; line-height: 1.5; }
.push-settings .push-privacy { flex-direction: row; align-items: center; }
.push-privacy input { width: 20px; height: 20px; flex: 0 0 auto; }
.push-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
@media (max-width: 600px) {
  dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  dialog .dialog-header, dialog .dialog-footer { padding: 12px 16px; }
  dialog .dialog-content { padding: 18px 16px; }
  dialog input:not([type=checkbox]), dialog select, dialog textarea { font-size: 16px !important; }
  dialog .dialog-content > * { flex-shrink: 0; }
  dialog .dialog-footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .topbar-actions { gap: 8px; }
}
