:root {
  color-scheme: light;
  --ink: var(--lab-text);
  --muted: var(--lab-muted);
  --line: var(--lab-border);
  --strong-line: var(--lab-border-strong);
  --surface: var(--lab-surface);
  --surface-soft: var(--lab-surface-soft);
  --surface-quiet: var(--lab-surface-tint);
  --accent: var(--lab-accent);
  --accent-strong: var(--lab-accent-strong);
  --accent-soft: var(--lab-accent-soft);
  --danger: var(--lab-danger);
  --shadow: var(--lab-shadow);
  --sage-bg: rgba(31, 122, 104, 0.14);
  --sage-border: rgba(31, 122, 104, 0.34);
  --sage-ink: #155b4d;
  --sage-solid: #1f7a68;
  --blue-bg: rgba(47, 111, 189, 0.14);
  --blue-border: rgba(47, 111, 189, 0.34);
  --blue-ink: #225b9d;
  --blue-solid: #2f6fbd;
  --violet-bg: rgba(126, 87, 194, 0.14);
  --violet-border: rgba(126, 87, 194, 0.34);
  --violet-ink: #5e3f9e;
  --violet-solid: #7e57c2;
  --amber-bg: rgba(181, 106, 20, 0.14);
  --amber-border: rgba(181, 106, 20, 0.34);
  --amber-ink: #854b0d;
  --amber-solid: #b56a14;
  --rose-bg: rgba(189, 58, 45, 0.12);
  --rose-border: rgba(189, 58, 45, 0.32);
  --rose-ink: #913129;
  --rose-solid: #bd3a2d;
  --gray-bg: rgba(99, 112, 102, 0.12);
  --gray-border: rgba(99, 112, 102, 0.3);
  --gray-ink: #4e5a51;
  --gray-solid: #637066;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--lab-bg); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--lab-bg);
  font-family: var(--lab-font);
  font-size: 14px;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button, input, select, textarea { transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(31, 122, 104, 0.24);
  outline-offset: 1px;
}

.app-local-header-inner { max-width: var(--lab-shell-width); }
.view-switcher { display: inline-flex; padding: 5px; border: 1px solid var(--lab-border); background: var(--lab-surface-soft); border-radius: 999px; }
.view-tab { min-width: 92px; min-height: 36px; padding: 7px 14px; border: 0; border-radius: 999px; color: var(--lab-muted); background: transparent; font-weight: 800; }
.view-tab:hover { color: var(--lab-text); background: var(--lab-surface); }
.view-tab.active { color: var(--lab-accent-strong); background: var(--lab-surface); box-shadow: var(--lab-shadow-soft); }

.planner-shell { width: 100%; max-width: var(--lab-wide-shell-width); }
.toolbar {
  display: grid;
  grid-template-columns: minmax(310px, 1fr) minmax(330px, 520px) auto;
  gap: 18px;
  align-items: end;
}
.month-controls, .toolbar-actions, .filters { display: flex; align-items: end; gap: 9px; }
.month-controls h1 { margin: 0 0 2px 6px; font-size: 21px; line-height: 34px; white-space: nowrap; }
.toolbar-actions { justify-content: flex-end; }
.filters { display: grid; grid-template-columns: minmax(190px, 1fr) 140px; }

.icon-button, .primary-button, .secondary-button, .danger-button, .mini-button {
  min-height: 36px;
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  padding: 7px 13px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}
.icon-button { width: 36px; padding: 0; display: inline-grid; place-items: center; font-size: 24px; line-height: 1; }
.primary-button { border-color: var(--accent); background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-strong); }
.secondary-button:hover, .icon-button:hover, .mini-button:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.danger-button { border-color: #d3a39e; color: var(--danger); background: #fff7f6; }
.mini-button { min-height: 28px; padding: 4px 8px; font-size: 12px; }
.icon-mini-button {
  display: inline-grid;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  place-items: center;
  font-size: 16px;
  line-height: 1;
}
.on-app .mini-button.icon-mini-button {
  flex: 0 0 28px;
  width: 28px !important;
  min-width: 28px;
  height: 28px !important;
  min-height: 28px;
  padding: 0 !important;
  border-radius: 8px !important;
}

.field { display: grid; gap: 5px; min-width: 0; }
.field > span, .field > legend { color: var(--lab-text); font-size: 12px; font-weight: 750; }
.compact-field > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--strong-line);
  border-radius: 5px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; }
.workspace { padding-top: 18px; }
.loading-state, .empty-state { padding: 38px 16px; color: var(--muted); text-align: center; }

.table-layout { display: grid; grid-template-columns: minmax(360px, 0.86fr) minmax(520px, 1.2fr); gap: 18px; align-items: start; }
.left-stack { display: grid; gap: 16px; }
.panel { min-width: 0; }
.table-panel { overflow: clip; }
.panel-header {
  min-height: 50px;
  padding: 0 0 13px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(38, 54, 48, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.panel-title h2, .panel-title h3 { margin: 0; font-size: 16px; }
.panel-count, .task-meta { color: var(--muted); font-size: 12px; }
.table-panel > .panel-header {
  margin: -18px -18px 14px;
  padding: 14px 18px 13px;
  background: #f7faf8;
}
.table-panel--today > .panel-header { border-bottom-color: rgba(31, 122, 104, 0.16); background: rgba(31, 122, 104, 0.075); }
.table-panel--someday > .panel-header { border-bottom-color: rgba(47, 111, 189, 0.16); background: rgba(47, 111, 189, 0.065); }
.table-panel--upcoming > .panel-header, .table-panel--selected > .panel-header { background: #f4f7f6; }
.table-panel--overdue > .panel-header { border-bottom-color: rgba(189, 58, 45, 0.2); background: rgba(189, 58, 45, 0.075); }
.table-panel--overdue .panel-title h2, .table-panel--today .panel-title h2 { display: inline-flex; align-items: center; gap: 8px; }
.table-panel--overdue .panel-title h2::before, .table-panel--today .panel-title h2::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}
.table-panel--overdue .panel-title h2::before { background: var(--rose-solid); }
.on-app .table-panel--overdue { border-color: rgba(189, 58, 45, 0.24) !important; box-shadow: 0 10px 26px rgba(145, 49, 41, 0.075) !important; }
.table-panel--overdue .panel-count { color: var(--rose-ink) !important; }
.table-panel--utility > .panel-header { min-height: 44px; margin-bottom: 12px; padding-top: 11px; padding-bottom: 11px; background: #fafcfb; }
.panel-controls { display: flex; gap: 7px; align-items: center; }
.panel-controls input { width: 142px; min-width: 0; }
.table-mode-switch { display: inline-flex; flex: 0 0 auto; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.table-mode-option { min-height: 30px; padding: 5px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 760; }
.table-mode-option:hover { color: var(--ink); }
.table-mode-option.active { color: var(--accent-strong); background: var(--surface); box-shadow: 0 1px 4px rgba(31, 41, 51, 0.1); }
.table-panel:has(> .empty-state) .panel-header { min-height: 42px; margin-bottom: 6px; padding-bottom: 9px; }
.table-panel > .empty-state { display: grid; min-height: 42px; place-items: center; padding: 10px 8px 12px; }
.card-board { display: grid; gap: 8px; }
.task-card, .entity-card, .template-card, .reminder-card {
  position: relative;
  border: 1px solid var(--task-border, var(--line));
  border-left: 4px solid var(--task-solid, var(--strong-line));
  border-radius: 6px;
  background: var(--task-bg, #fff);
  color: var(--task-ink, var(--ink));
}
.task-card { padding: 11px 12px; }
.reminder-card { padding: 11px 12px; border-left-color: var(--task-solid); background: var(--lab-surface); color: var(--lab-text); box-shadow: var(--lab-shadow-soft); }
.table-task-card {
  background: var(--lab-surface) !important;
  border-left-color: var(--task-solid) !important;
  color: var(--lab-text);
  box-shadow: var(--lab-shadow-soft) !important;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.table-task-card:hover { border-color: var(--task-border, var(--lab-border-strong)); box-shadow: 0 8px 20px rgba(31, 41, 51, 0.09) !important; }
.table-task-card.expandable-card { cursor: pointer; }
.table-task-card.expandable-card:hover { transform: translateY(-1px); }
.table-task-card.expandable-card:focus-visible { outline: 3px solid rgba(31, 122, 104, 0.22); outline-offset: 2px; }
.task-card.completed { opacity: 0.62; }
.task-card.completed .task-title { text-decoration: line-through; }
.task-card-top { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.expandable-card .task-card-top { grid-template-columns: 22px minmax(0, 1fr) auto 26px; }
.task-check, .subtask-check { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--task-solid, var(--accent)); }
.task-title-wrap { min-width: 0; }
.task-title { min-width: 0; overflow-wrap: anywhere; font-weight: 780; line-height: 1.35; }
.task-card-actions { display: flex; gap: 5px; }
.task-card-actions > * { flex: 0 0 auto; }
.task-action-menu { position: relative; }
.task-card:has(.task-action-menu[open]) { z-index: 11; }
.task-action-menu > summary { list-style: none; }
.task-action-menu > summary::-webkit-details-marker { display: none; }
.task-more-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}
.task-more-button:hover, .task-action-menu[open] .task-more-button { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.task-action-popover {
  position: absolute;
  z-index: 12;
  top: calc(100% + 5px);
  right: 0;
  width: 112px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.task-menu-item { width: 100%; min-height: 30px; padding: 5px 8px; border: 0; border-radius: 4px; background: transparent; text-align: left; font-size: 12px; font-weight: 700; }
.task-menu-item.danger { color: var(--danger); }
.task-menu-item:hover { background: #fff3f1; }
.task-expand-indicator {
  position: relative;
  width: 26px;
  min-height: 26px;
  margin: -2px -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
}
.task-expand-indicator::before {
  position: absolute;
  top: 7px;
  left: 8px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  content: "";
  transform: rotate(45deg);
  transform-origin: 60% 60%;
  transition: transform 220ms ease, border-color 180ms ease;
}
.task-expand-indicator:hover { background: var(--surface-soft); }
.expandable-card:hover .task-expand-indicator::before { border-color: var(--task-solid); }
.expandable-card.expanded .task-expand-indicator::before { transform: rotate(225deg); }
.task-card-footer { margin-top: 9px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.meta-row, .badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.overdue-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid rgba(189, 58, 45, 0.28);
  border-radius: 999px;
  color: var(--rose-ink);
  background: rgba(189, 58, 45, 0.075);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
}
.tag-pill, .owner-badge, .project-badge, .type-pill {
  max-width: 100%;
  border: 1px solid var(--task-border, var(--strong-line));
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(255,255,255,0.65);
  color: inherit;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.type-pill { width: auto; max-width: 82px; flex: 0 0 auto; align-self: start; padding: 2px 6px; font-size: 10px; line-height: 1.2; white-space: nowrap; overflow: hidden; overflow-wrap: normal; text-overflow: ellipsis; }
.card-notes { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--task-border, var(--line)); color: var(--muted); font-size: 12px; white-space: pre-wrap; }
.task-card-details {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 320ms cubic-bezier(0.22, 0.8, 0.26, 1), opacity 220ms ease;
  will-change: grid-template-rows, opacity;
}
.task-card-details-inner { min-height: 0; overflow: hidden; transform: translateY(-5px); transition: transform 280ms cubic-bezier(0.22, 0.8, 0.26, 1); }
.range-card.expanded .task-card-details { grid-template-rows: 1fr; opacity: 1; }
.range-card.expanded .task-card-details-inner { transform: translateY(0); }
.progress-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.progress-dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--task-solid); }
.progress-dot.done { background: var(--task-solid); }
.subtask-list { margin-top: 11px; padding: 8px; border: 1px solid var(--task-border); border-radius: 6px; display: grid; gap: 3px; background: var(--surface-soft); }
.subtask-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 6px 5px; border-radius: 5px; }
.subtask-row:hover { background: var(--surface-soft); }
.subtask-row.completed .subtask-title { text-decoration: line-through; color: var(--muted); }
.subtask-date { color: var(--muted); font-size: 11px; white-space: nowrap; }

.entity-board, .template-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 8px; }
.entity-card, .template-card { padding: 10px; min-height: 74px; }
.entity-card { border-color: var(--entity-border); border-left-color: var(--entity-solid); background: var(--entity-bg); color: var(--entity-ink); }
.owner-card, .project-card {
  background: var(--lab-surface) !important;
  border-left-color: var(--entity-solid) !important;
  color: var(--lab-text);
  box-shadow: var(--lab-shadow-soft) !important;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.editable-summary-card { cursor: pointer; }
.editable-summary-card:focus-visible { outline: 3px solid rgba(31, 122, 104, 0.22); outline-offset: 2px; }
.editable-summary-card:hover { transform: translateY(-1px); box-shadow: 0 7px 17px rgba(31, 41, 51, 0.08) !important; }
.template-card {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  background: var(--lab-surface) !important;
  border-left-color: var(--task-solid) !important;
  color: var(--lab-text);
  box-shadow: var(--lab-shadow-soft) !important;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.owner-card:hover, .project-card:hover, .template-card:hover { transform: translateY(-1px); box-shadow: 0 7px 17px rgba(31, 41, 51, 0.08) !important; }
.entity-name, .template-title { display: block; font-weight: 780; overflow-wrap: anywhere; }
.template-title { min-width: 0; line-height: 1.35; }
.entity-counts { margin-top: 7px; color: inherit; opacity: 0.8; font-size: 11px; }
.entity-card button { margin-top: 9px; }
.template-card-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; }
.template-card .task-meta { margin-top: 5px; }
.template-card .task-card-actions { margin-top: auto; padding-top: 10px; }
.template-card .task-card-actions .mini-button { margin-top: 0; }
.reminder-card-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.reminder-title { font-weight: 780; line-height: 1.35; overflow-wrap: anywhere; }
.reminder-meta { margin-top: 7px; }
.reminder-card > .badge-row { margin-top: 8px; }
.reminder-notes { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--task-border); color: var(--muted); font-size: 12px; white-space: pre-wrap; }
.schedule-reminder-button { min-width: 72px; }
.upcoming-groups { display: grid; gap: 20px; }
.task-date-group { display: grid; gap: 9px; }
.task-date-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 1px 3px 7px;
  border-bottom: 1px solid rgba(38, 54, 48, 0.12);
}
.task-date-heading { display: flex; min-width: 0; align-items: baseline; gap: 8px; }
.task-date-label { color: var(--ink); font-family: var(--on-display-font, var(--lab-font)); font-size: 13px; font-weight: 700; }
.task-date-full { color: var(--muted); font-size: 11px; }
.task-date-count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 800;
}

.calendar-layout { display: grid; grid-template-columns: minmax(700px, 1fr) 330px; gap: 18px; align-items: start; }
.calendar-surface, .day-detail { background: var(--lab-surface); border: 1px solid var(--lab-border); border-radius: 8px; box-shadow: var(--lab-shadow-soft); }
.calendar-vertical-scroll {
  max-height: calc(100vh - 224px);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.calendar-vertical-scroll::-webkit-scrollbar { width: 10px; }
.calendar-vertical-scroll::-webkit-scrollbar-track { background: var(--surface-soft); }
.calendar-vertical-scroll::-webkit-scrollbar-thumb { border: 3px solid var(--surface-soft); border-radius: 999px; background: var(--strong-line); }
.calendar-month { border-bottom: 14px solid var(--lab-bg); background: var(--lab-surface); }
.calendar-month:last-child { border-bottom: 0; }
.calendar-month-title {
  position: sticky;
  top: 0;
  z-index: 7;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--lab-border);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 2px 8px rgba(31, 41, 51, 0.04);
}
.calendar-month.is-current .calendar-month-title { background: var(--lab-accent-soft); }
.calendar-month-title h2 { margin: 0; font-size: 18px; }
.calendar-month-title span { color: var(--lab-muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays { border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.calendar-weekdays div { padding: 9px; color: var(--muted); text-align: center; font-size: 11px; font-weight: 760; }
.calendar-week {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-height: calc(112px + var(--bar-lanes, 0) * 24px);
  border-bottom: 1px solid var(--lab-border);
}
.calendar-day {
  position: relative;
  min-height: inherit;
  padding: calc(38px + var(--bar-lanes, 0) * 24px) 7px 7px;
  border-right: 1px solid var(--line);
  overflow: hidden;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
.calendar-day:nth-child(7) { border-right: 0; }
.calendar-day.outside { background: #f8faf8; color: #9aa49e; }
.calendar-day:hover:not(.selected) { background: rgba(31, 122, 104, 0.055); }
.calendar-day.today { box-shadow: inset 0 0 0 2px rgba(31, 122, 104, 0.34); }
.calendar-day.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 2px rgba(31, 122, 104, 0.42); }
.calendar-day.range-selected { background: #e9f3ef; }
.day-number { position: absolute; top: 7px; left: 8px; display: inline-grid; place-items: center; width: 25px; height: 25px; font-weight: 800; font-size: 12px; }
.calendar-day.today .day-number { border-radius: 999px; color: #fff; background: var(--lab-accent); }
.calendar-items { display: grid; gap: 3px; }
.week-bar-layer {
  position: absolute;
  z-index: 3;
  top: 35px;
  right: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: 22px;
  gap: 2px 0;
  pointer-events: none;
}
.range-bar {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 20px;
  margin: 0 4px;
  padding: 0 17px;
  border: 1px solid var(--task-border);
  border-radius: 999px;
  background: var(--task-bg);
  color: var(--task-ink);
  font-size: 10px;
  font-weight: 800;
  pointer-events: auto;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.08);
  transition: box-shadow 160ms ease, filter 160ms ease, transform 160ms ease;
}
.range-bar:hover { filter: saturate(1.08); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(31, 41, 51, 0.14); }
.range-bar.completed { opacity: 0.58; }
.calendar-range-title { position: relative; z-index: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-range-subtask {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: block;
  max-width: 82px;
  min-height: 14px;
  padding: 0 5px;
  border: 1px solid var(--task-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--task-ink);
  font-size: 8px;
  font-weight: 850;
  line-height: 14px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-range-subtask.near-start { transform: translate(0, -50%); }
.calendar-range-subtask.near-end { transform: translate(-100%, -50%); }
.calendar-range-subtask.done { opacity: 0.6; text-decoration: line-through; }
.range-bar .range-handle { top: 2px; bottom: 2px; width: 10px; border-radius: 999px; background: var(--task-solid); opacity: 0.42; transition: opacity 150ms ease; }
.range-bar:hover .range-handle { opacity: 0.82; }
.range-bar .range-handle.start { left: 3px; }
.range-bar .range-handle.end { right: 3px; }
.calendar-pill {
  display: block;
  width: 100%;
  border: 1px solid var(--task-border);
  border-radius: 4px;
  padding: 3px 5px;
  color: var(--task-ink);
  background: var(--task-bg);
  font-size: 10px;
  font-weight: 730;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-pill.single[draggable="true"] { cursor: grab; }
.calendar-pill.single[draggable="true"]:active { cursor: grabbing; }
.calendar-pill.completed { opacity: 0.58; text-decoration: line-through; }
.day-detail { position: sticky; top: 12px; padding: 0; overflow: hidden; }
.day-detail-header { padding: 16px; border-bottom: 1px solid rgba(31, 122, 104, 0.16); background: var(--accent-soft); }
.day-detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.day-detail-kicker { display: block; margin-bottom: 3px; color: var(--accent-strong); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.day-detail h2 { margin: 0; font-size: 17px; line-height: 1.3; }
.day-task-count {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(31, 122, 104, 0.22);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 850;
}
.day-detail-content { padding: 14px; }
.day-detail-content > .empty-state { min-height: 120px; display: grid; place-items: center; padding: 18px 8px; }
.day-detail .card-board { margin-top: 0; }
.drop-target.drag-over { outline: 3px solid rgba(31, 122, 104, 0.35); outline-offset: -3px; }

.range-handle { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; background: rgba(255,255,255,0.55); }
.range-handle.start { left: 0; }
.range-handle.end { right: 0; }

.modal { width: min(570px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--lab-border-strong); border-radius: var(--lab-radius-lg); color: var(--lab-text); background: var(--lab-surface); box-shadow: var(--lab-shadow); }
.large-modal { width: min(810px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(14, 28, 21, 0.48); }
.modal form { display: grid; max-height: calc(100vh - 34px); }
.modal-header, .modal-footer { display: flex; align-items: center; gap: 9px; padding: 13px 16px; }
.modal-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-header .icon-button { min-height: 30px; width: 30px; border: 0; }
.modal-body { padding: 16px; overflow: auto; }
.modal-footer { border-top: 1px solid var(--line); background: var(--surface-soft); }
.footer-spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; }
.check-field { display: flex; align-items: center; gap: 8px; }
.check-field input { width: 17px; height: 17px; accent-color: var(--accent); }
fieldset { margin: 0; padding: 0; border: 0; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.choice-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; }
.choice-chip input { width: 15px; height: 15px; }
.color-options { display: flex; flex-wrap: wrap; gap: 9px; }
.color-choice { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; }
.color-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.color-swatch { width: 26px; height: 26px; border: 2px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--strong-line); }
.color-choice input:checked + .color-swatch { box-shadow: 0 0 0 3px var(--ink); }
.editor-section { border-top: 1px solid var(--line); padding-top: 12px; }
.editor-section-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.editor-section-header h3 { margin: 0; font-size: 15px; }
.editor-list { display: grid; gap: 8px; margin-top: 9px; }
.editor-row { display: grid; grid-template-columns: minmax(0, 1fr) 145px auto auto; gap: 7px; align-items: center; }
.template-editor-row { grid-template-columns: minmax(0, 1fr) 90px auto; }
.editor-row .check-field { white-space: nowrap; }
.modal-record-title { font-size: 16px; font-weight: 780; }
.template-preview { padding: 10px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 5px; color: var(--muted); }
.template-preview ul { margin: 7px 0 0; padding-left: 18px; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); }
.toast { padding: 11px 13px; border: 1px solid var(--strong-line); border-radius: 6px; background: #fff; box-shadow: var(--shadow); }
.toast.error { border-color: #d9a19b; color: var(--danger); }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media (max-width: 1000px) {
  .toolbar { grid-template-columns: 1fr auto; }
  .filters { grid-column: 1 / -1; grid-row: 2; }
  .table-layout, .calendar-layout { grid-template-columns: 1fr; }
  .day-detail { position: static; }
}

@media (max-width: 680px) {
  .view-switcher { width: 100%; }
  .view-tab { min-width: 0; flex: 1; }
  .app-shell { padding: 13px 10px 28px; }
  .toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .month-controls { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 8px; width: 100%; }
  .month-controls h1 { grid-column: 1 / -1; width: 100%; margin: 2px 0 0; }
  .month-controls .secondary-button { width: 100%; }
  .filters { grid-column: auto; grid-row: auto; grid-template-columns: 1fr; }
  .toolbar-actions { justify-content: stretch; }
  .toolbar-actions button { width: 100%; }
  .table-layout > .left-stack { display: contents; }
  .table-panel[data-panel-kind="overdue"] { order: 1; }
  .table-panel[data-panel-kind="today"] { order: 2; }
  .table-panel[data-panel-kind="someday"] { order: 3; }
  .table-layout > .table-panel[data-panel-kind="upcoming"], .table-layout > .table-panel[data-panel-kind="selected"] { order: 4; }
  .table-panel[data-panel-kind="projects"] { order: 5; }
  .table-panel[data-panel-kind="owners"] { order: 6; }
  .table-panel[data-panel-kind="templates"] { order: 7; }
  .task-card-actions .mini-button, .entity-card .mini-button, .template-card .mini-button { width: auto; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .table-panel--utility > .panel-header { align-items: center; flex-direction: row; }
  .panel-controls { display: grid; width: 100%; grid-template-columns: 1fr; }
  .panel-controls input { width: 100%; }
  .table-mode-switch { width: 100%; }
  .table-mode-option { flex: 1; }
  .calendar-surface { overflow-x: hidden; }
  .calendar-weekdays, .calendar-week { min-width: 0; width: 100%; }
  .calendar-weekdays div { padding: 7px 2px; font-size: 9px; }
  .calendar-week { min-height: calc(90px + var(--bar-lanes, 0) * 21px); }
  .calendar-day { min-height: inherit; padding: calc(31px + var(--bar-lanes, 0) * 21px) 3px 4px; }
  .day-number { top: 4px; left: 3px; width: 22px; height: 22px; font-size: 10px; }
  .week-bar-layer { top: 28px; grid-auto-rows: 19px; }
  .range-bar { min-height: 17px; margin: 0 2px; padding: 0 12px; font-size: 8px; }
  .calendar-range-subtask { display: none; }
  .calendar-pill { padding: 3px; font-size: 9px; }
  .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .editor-row, .template-editor-row { grid-template-columns: 1fr; padding: 9px; border: 1px solid var(--line); border-radius: 5px; }
}
