* {
  box-sizing: border-box;
}

:root {
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --ink: #172333;
  --muted: #687588;
  --line: #d8e0e8;
  --primary: #17324d;
  --primary-2: #24577d;
  --accent: #f0a52b;
  --success: #24744b;
  --success-soft: #e1f3e8;
  --danger: #a33a3a;
  --danger-soft: #fceaea;
  --shadow: 0 8px 28px rgba(22, 38, 57, 0.10);
  --radius: 20px;
  --tap: 52px;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(36, 87, 125, 0.10), transparent 32rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 4px solid rgba(240, 165, 43, 0.35);
  outline-offset: 2px;
}

.app-shell {
  width: min(1800px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar,
.control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  padding: 8px 4px 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 18px;
  color: white;
  background: var(--primary);
  font-weight: 900;
  font-size: 31px;
  box-shadow: var(--shadow);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 2px;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  line-height: 1.1;
}

.range-label {
  color: var(--muted);
  font-weight: 650;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button,
.icon-button,
.nav-arrow,
.date-picker-button,
.view-button,
.history-tab {
  min-height: var(--tap);
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 800;
}

.button {
  padding: 0 20px;
}

.button-primary {
  color: white;
  background: var(--primary);
}

.button-primary:hover {
  background: var(--primary-2);
}

.button-secondary {
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
}

.button-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border: 2px solid #f4caca;
}

.icon-button {
  width: var(--tap);
  padding: 0;
  font-size: 23px;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
}

.control-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid rgba(216, 224, 232, 0.85);
  border-radius: 22px;
  background: rgba(247, 249, 251, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 22px rgba(22, 38, 57, 0.08);
}

.date-nav,
.view-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-arrow {
  width: var(--tap);
  font-size: 37px;
  line-height: 1;
  color: var(--primary);
  background: var(--surface);
  border: 2px solid var(--line);
}

.date-picker-button {
  min-width: 230px;
  padding: 0 18px;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
}

.visually-hidden-date {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.view-switch {
  padding: 5px;
  border-radius: 17px;
  background: #dfe7ee;
}

.view-button {
  min-width: 96px;
  padding: 0 20px;
  color: var(--muted);
  background: transparent;
}

.view-button.active {
  color: white;
  background: var(--primary);
  box-shadow: 0 3px 10px rgba(23, 50, 77, 0.25);
}

.week-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(265px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding: 2px 2px 22px;
  scroll-snap-type: x proximity;
}

.day-column {
  min-height: 62vh;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.64);
  scroll-snap-align: start;
}

.day-column.today {
  border: 3px solid var(--accent);
  padding: 10px;
}

.day-column-header {
  width: 100%;
  min-height: 72px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 15px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.day-column-header:hover {
  background: rgba(255, 255, 255, 0.8);
}

.day-name {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.day-number {
  font-size: 1.75rem;
  font-weight: 900;
}

.day-count {
  min-width: 42px;
  padding: 7px 10px;
  border-radius: 99px;
  color: var(--primary);
  background: #e1ebf2;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 900;
}

.card-stack {
  display: grid;
  gap: 12px;
}

.task-card {
  position: relative;
  padding: 14px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(22, 38, 57, 0.08);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.task-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 22px rgba(22, 38, 57, 0.12);
}

.task-card.completed {
  opacity: 0.72;
  background: var(--success-soft);
  border-color: #b7dfc7;
}

.task-card.completed .task-title {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.assignee-pill,
.time-pill,
.repeat-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 900;
}

.assignee-pill {
  max-width: 68%;
  overflow: hidden;
  color: var(--primary);
  background: #e6eef4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.time-pill {
  color: #714b09;
  background: #fff0ca;
}

.repeat-pill {
  color: #564875;
  background: #eee7f7;
}

.task-title {
  margin: 0 0 10px;
  font-size: 1.12rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.task-description-preview {
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.quick-toggles {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.quick-toggle,
.simple-complete-button {
  width: 100%;
  min-height: 50px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  font-weight: 800;
}

.quick-toggle.checked,
.simple-complete-button.checked {
  color: #165334;
  background: var(--success-soft);
  border-color: #a8d6b9;
}

.toggle-box {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 3px solid #94a2b1;
  border-radius: 9px;
  background: white;
  font-size: 20px;
  line-height: 1;
}

.quick-toggle.checked .toggle-box,
.simple-complete-button.checked .toggle-box {
  color: white;
  border-color: var(--success);
  background: var(--success);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.completion-note {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.edit-hint {
  color: var(--primary-2);
  font-size: 0.82rem;
  font-weight: 850;
}

.empty-state {
  min-height: 130px;
  padding: 18px;
  display: grid;
  place-items: center;
  border: 2px dashed #c8d3dd;
  border-radius: 17px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.35);
  text-align: center;
  font-weight: 750;
}

.day-view {
  padding: 4px 2px 28px;
}

.day-summary {
  margin-bottom: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.day-summary h2 {
  margin-bottom: 5px;
}

.day-summary p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  align-items: start;
  gap: 16px;
}

.day-grid .task-card {
  padding: 19px;
}

.day-grid .task-title {
  font-size: 1.35rem;
}

.hidden {
  display: none !important;
}

.modal {
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(10, 19, 29, 0.58);
  backdrop-filter: blur(4px);
}

.modal-small {
  width: min(620px, calc(100vw - 24px));
}

.modal-card {
  max-height: calc(100vh - 24px);
  padding: 24px;
  overflow: auto;
  border-radius: 24px;
  background: var(--surface);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin-bottom: 0;
  font-size: 1.8rem;
}

.modal-kicker {
  margin-bottom: 4px;
  color: var(--primary-2);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.modal-close {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border: 0;
  border-radius: 15px;
  color: var(--ink);
  background: var(--surface-2);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  font-weight: 900;
}

.field small {
  color: var(--muted);
  font-weight: 700;
}

.field-wide {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea,
.person-row input,
.checklist-row input {
  width: 100%;
  min-height: 54px;
  padding: 11px 13px;
  border: 2px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--surface);
}

.field textarea {
  min-height: 128px;
  resize: vertical;
}

.checklist-editor {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 2px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h3 {
  margin-bottom: 3px;
}

.section-heading p,
.dialog-help {
  margin-bottom: 14px;
  color: var(--muted);
}

.checklist-rows,
.people-editor {
  display: grid;
  gap: 10px;
}

.checklist-row,
.person-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drag-dot {
  color: var(--muted);
  font-size: 25px;
  letter-spacing: -6px;
}

.remove-row {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border: 0;
  border-radius: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 26px;
  cursor: pointer;
}

.modal-footer {
  position: sticky;
  bottom: -24px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px -24px -24px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.footer-spacer {
  flex: 1;
}

.history-modal-card {
  min-height: min(760px, calc(100vh - 24px));
}

.history-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 5px;
  border-radius: 16px;
  background: #e4ebf1;
}

.history-tab {
  flex: 1;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}

.history-tab.active {
  color: white;
  background: var(--primary);
}

.history-content {
  display: grid;
  gap: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.7fr) minmax(100px, 0.7fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 15px;
  background: var(--surface-2);
}

.history-title {
  font-weight: 900;
}

.history-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.status-chip {
  justify-self: start;
  padding: 6px 10px;
  border-radius: 99px;
  font-size: 0.84rem;
  font-weight: 900;
}

.status-complete {
  color: #165334;
  background: var(--success-soft);
}

.status-open {
  color: #714b09;
  background: #fff0ca;
}

.status-archived {
  color: var(--danger);
  background: var(--danger-soft);
}

.row-action {
  min-height: 44px;
  padding: 0 13px;
  border: 2px solid var(--line);
  border-radius: 12px;
  color: var(--primary);
  background: white;
  cursor: pointer;
  font-weight: 850;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  max-width: min(520px, calc(100vw - 28px));
  padding: 14px 18px;
  border-radius: 15px;
  color: white;
  background: #172333;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 24px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  font-weight: 800;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
  }

  .header-actions .button-secondary {
    display: none;
  }

  .control-bar {
    top: 0;
  }

  .week-board {
    grid-template-columns: repeat(7, minmax(82vw, 1fr));
  }
}

@media (max-width: 680px) {
  body {
    font-size: 16px;
  }

  .topbar {
    display: grid;
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 52px 52px 1fr;
  }

  .header-actions .button-primary {
    width: 100%;
  }

  .control-bar {
    display: grid;
  }

  .date-nav {
    display: grid;
    grid-template-columns: 52px 1fr 52px;
  }

  .date-picker-button {
    min-width: 0;
  }

  .view-switch {
    width: 100%;
  }

  .view-button {
    flex: 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .section-heading {
    display: grid;
  }

  .modal-card {
    padding: 18px;
  }

  .modal-footer {
    bottom: -18px;
    margin: 24px -18px -18px;
    padding: 14px 18px;
    flex-wrap: wrap;
  }

  .modal-footer .button {
    flex: 1;
  }

  .footer-spacer {
    display: none;
  }

  .history-row {
    grid-template-columns: 1fr;
  }

  .row-action {
    width: 100%;
  }
}

@media (pointer: coarse) {
  :root {
    --tap: 58px;
  }

  .task-card {
    padding: 16px;
  }

  .quick-toggle,
  .simple-complete-button {
    min-height: 58px;
  }

  .field input,
  .field select,
  .field textarea,
  .person-row input,
  .checklist-row input {
    min-height: 58px;
  }
}

/* Compact desktop/touch layout: keeps controls finger-friendly while fitting more on screen. */
:root {
  --radius: 16px;
  --tap: 44px;
}

body {
  font-size: 15px;
  line-height: 1.32;
}

.app-shell {
  width: min(1920px, 100%);
  padding: 12px;
}

.topbar,
.control-bar {
  gap: 10px;
}

.topbar {
  padding: 2px 2px 10px;
}

.brand-block {
  gap: 10px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex-basis: 46px;
  border-radius: 14px;
  font-size: 25px;
}

h1 {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
}

.range-label {
  font-size: 0.92rem;
}

.header-actions {
  gap: 7px;
}

.button,
.icon-button,
.nav-arrow,
.date-picker-button,
.view-button,
.history-tab {
  border-radius: 12px;
}

.button {
  padding: 0 15px;
}

.icon-button {
  font-size: 20px;
}

.control-bar {
  padding: 8px;
  margin-bottom: 10px;
  border-radius: 17px;
}

.date-nav,
.view-switch {
  gap: 6px;
}

.nav-arrow {
  font-size: 30px;
}

.date-picker-button {
  min-width: 190px;
  padding: 0 14px;
}

.view-switch {
  padding: 4px;
  border-radius: 14px;
}

.view-button {
  min-width: 78px;
  padding: 0 15px;
}

.week-board {
  grid-template-columns: repeat(7, minmax(205px, 1fr));
  gap: 9px;
  padding-bottom: 12px;
}

.day-column {
  min-height: 58vh;
  padding: 8px;
}

.day-column.today {
  padding: 6px;
}

.day-column-header {
  min-height: 55px;
  padding: 5px 7px;
  border-radius: 12px;
}

.day-name {
  font-size: 0.75rem;
}

.day-number {
  font-size: 1.35rem;
}

.day-count {
  min-width: 34px;
  padding: 5px 8px;
  font-size: 0.78rem;
}

.card-stack {
  gap: 8px;
}

.task-card,
.day-grid .task-card {
  padding: 10px;
  border-radius: 14px;
}

.card-topline {
  gap: 6px;
  margin-bottom: 6px;
}

.assignee-pill,
.time-pill,
.repeat-pill {
  min-height: 25px;
  padding: 3px 8px;
  font-size: 0.74rem;
}

.task-title-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 7px;
}

.task-title,
.day-grid .task-title {
  margin: 0 0 7px;
  font-size: 1.06rem;
  line-height: 1.18;
}

.task-title-row .task-title {
  flex: 1;
  margin: 4px 0 0;
}

.title-checkbox {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: 3px solid #94a2b1;
  border-radius: 9px;
  color: white;
  background: white;
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.title-checkbox.checked {
  border-color: var(--success);
  background: var(--success);
}

.task-description-preview {
  margin: -1px 0 7px;
  font-size: 0.82rem;
  -webkit-line-clamp: 1;
}

.quick-toggles {
  gap: 6px;
  margin-top: 7px;
}

.quick-toggle {
  min-height: 42px;
  padding: 5px 9px;
  gap: 8px;
  border-radius: 11px;
}

.toggle-box {
  width: 26px;
  height: 26px;
  flex-basis: 26px;
  border-width: 2px;
  border-radius: 7px;
  font-size: 17px;
}

.card-footer {
  margin-top: 7px;
}

.completion-note,
.edit-hint {
  font-size: 0.74rem;
}

.empty-state {
  min-height: 95px;
  padding: 12px;
  border-radius: 13px;
}

.day-view {
  padding: 2px 1px 18px;
}

.day-summary {
  margin-bottom: 10px;
  padding: 11px 14px;
}

.day-summary h2 {
  margin-bottom: 2px;
  font-size: 1.45rem;
}

.day-summary p {
  font-size: 0.9rem;
}

.day-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 275px), 1fr));
  gap: 10px;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 9px;
  }

  .week-board {
    grid-template-columns: repeat(7, minmax(76vw, 1fr));
  }
}

@media (max-width: 680px) {
  body {
    font-size: 15px;
  }

  .header-actions {
    grid-template-columns: 44px 44px 1fr;
  }

  .date-nav {
    grid-template-columns: 44px 1fr 44px;
  }
}

@media (pointer: coarse) {
  :root {
    --tap: 48px;
  }

  .task-card,
  .day-grid .task-card {
    padding: 11px;
  }

  .quick-toggle {
    min-height: 46px;
  }

  .title-checkbox {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .field input,
  .field select,
  .field textarea,
  .person-row input,
  .checklist-row input {
    min-height: 50px;
  }
}

/* Google Calendar integration */
.settings-modal {
  width: min(820px, calc(100vw - 24px));
}

.settings-section + .settings-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 2px solid var(--line);
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.settings-section-heading h3 {
  margin-bottom: 2px;
}

.settings-section-heading .dialog-help {
  margin-bottom: 0;
}

.connection-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: #e8edf2;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.connection-badge.configured {
  color: #714b09;
  background: #fff0ca;
}

.connection-badge.connected {
  color: #165334;
  background: var(--success-soft);
}

.google-panel {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.google-setup-copy {
  display: grid;
  gap: 2px;
}

.google-setup-copy span,
.privacy-note,
.setup-details {
  color: var(--muted);
  font-size: 0.84rem;
}

.google-file-row,
.google-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.google-file-row input[type="file"] {
  min-width: min(100%, 330px);
  flex: 1;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 11px;
  background: white;
}

.setup-details {
  padding-top: 4px;
}

.setup-details summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  color: var(--primary-2);
  cursor: pointer;
  font-weight: 850;
}

.setup-details ol {
  margin: 7px 0 8px 22px;
  padding: 0;
}

.setup-details li + li {
  margin-top: 5px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  cursor: pointer;
  font-weight: 800;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-control {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 48px;
  border-radius: 999px;
  background: #aab5c1;
  transition: background 120ms ease;
}

.switch-control::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
  transition: transform 120ms ease;
}

.switch-row input:checked + .switch-control {
  background: var(--success);
}

.switch-row input:checked + .switch-control::after {
  transform: translateX(20px);
}

.switch-row input:focus-visible + .switch-control {
  outline: 4px solid rgba(240, 165, 43, 0.35);
  outline-offset: 2px;
}

.privacy-note {
  margin: 0;
}

.calendar-card {
  border-color: #c7d9ee;
  background: #f6faff;
  cursor: pointer;
}

.calendar-card:hover {
  border-color: #8db3dc;
}

.calendar-source-pill,
.calendar-time-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
}

.calendar-source-pill {
  max-width: 66%;
  overflow: hidden;
  color: #174f82;
  background: #dfeeff;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.calendar-time-pill {
  color: #4c3b09;
  background: #fff1bf;
}

.calendar-location {
  margin: -1px 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-footer {
  border-top: 1px solid #d8e6f4;
  padding-top: 6px;
}

@media (max-width: 680px) {
  .settings-section-heading {
    display: grid;
  }

  .connection-badge {
    justify-self: start;
  }

  .google-file-row,
  .google-actions {
    display: grid;
  }

  .google-file-row .button,
  .google-actions .button {
    width: 100%;
  }
}

/* Unified dashboard header */
.dashboard-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(216, 224, 232, 0.9);
  border-radius: 17px;
  background: rgba(247, 249, 251, 0.96);
  box-shadow: 0 6px 22px rgba(22, 38, 57, 0.08);
  backdrop-filter: blur(12px);
}

.dashboard-bar .brand-block {
  flex: 0 1 auto;
  min-width: 310px;
}

.dashboard-bar .brand-copy {
  min-width: 0;
}

.dashboard-bar h1 {
  margin: 0;
  font-size: clamp(1.18rem, 1.75vw, 1.58rem);
  line-height: 1.08;
  white-space: nowrap;
}

.dashboard-bar .range-label {
  display: none;
}

.dashboard-bar .brand-mark {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border-radius: 13px;
  font-size: 23px;
}

.dashboard-controls {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.dashboard-bar .date-nav,
.dashboard-bar .view-switch,
.dashboard-bar .header-actions {
  flex: 0 0 auto;
}

.dashboard-bar .date-picker-button {
  min-width: 158px;
  padding: 0 11px;
}

.dashboard-bar .view-button {
  min-width: 62px;
  padding: 0 10px;
}

.dashboard-bar .button {
  padding: 0 12px;
}

.dashboard-bar .header-actions {
  gap: 6px;
  flex-wrap: nowrap;
}

@media (max-width: 1180px) {
  .dashboard-bar {
    flex-wrap: wrap;
  }

  .dashboard-bar .brand-block {
    min-width: 0;
  }

  .dashboard-controls {
    width: 100%;
    flex-basis: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 790px) {
  .dashboard-bar {
    align-items: stretch;
  }

  .dashboard-bar h1 {
    white-space: normal;
  }

  .dashboard-controls {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .dashboard-bar .date-nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap);
  }

  .dashboard-bar .view-switch {
    width: 100%;
  }

  .dashboard-bar .view-button {
    flex: 1;
  }

  .dashboard-bar .header-actions {
    display: flex;
  }

  .dashboard-bar #todayBtn {
    display: none;
  }
}

@media (max-width: 520px) {
  .dashboard-controls {
    grid-template-columns: 1fr;
  }

  .dashboard-bar .view-switch,
  .dashboard-bar .header-actions {
    width: 100%;
  }

  .dashboard-bar .header-actions {
    display: grid;
    grid-template-columns: var(--tap) var(--tap) 1fr;
  }

  .dashboard-bar .header-actions .button-primary {
    width: 100%;
  }
}


/* Household task colors */
.task-card.household-task {
  border-left: 6px solid var(--task-color, #596575);
  background: linear-gradient(
    90deg,
    var(--task-color-soft, rgba(89, 101, 117, 0.12)) 0,
    var(--surface) 42%
  );
}

.task-card.household-task .assignee-pill {
  color: white;
  background: var(--task-color, #596575);
}

.task-card.household-task.completed {
  border-left-color: var(--task-color, #596575);
  background: linear-gradient(
    90deg,
    var(--task-color-soft, rgba(89, 101, 117, 0.12)) 0,
    var(--success-soft) 46%
  );
}

.person-row .person-name-input {
  flex: 1 1 auto;
  min-width: 120px;
}

.person-color-field {
  min-height: 46px;
  padding: 4px 9px 4px 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}

.person-color-input,
.outlook-color-input {
  width: 38px !important;
  min-width: 38px;
  height: 34px;
  min-height: 34px !important;
  padding: 1px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  cursor: pointer;
}

/* Day header and calendar source switches */
.day-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.day-summary-copy {
  min-width: 210px;
}

.calendar-quick-toggles {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.calendar-quick-toggle {
  min-height: 40px;
  padding: 5px 10px 5px 6px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 2px solid var(--source-color, #596575);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  touch-action: manipulation;
}

.calendar-quick-toggle.active {
  color: var(--ink);
  background: var(--source-soft, rgba(89, 101, 117, 0.14));
}

.calendar-toggle-box {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: grid;
  place-items: center;
  border: 2px solid var(--source-color, #596575);
  border-radius: 8px;
  color: white;
  background: white;
  font-size: 17px;
  line-height: 1;
}

.calendar-quick-toggle.active .calendar-toggle-box {
  background: var(--source-color, #596575);
}

/* Provider-specific read-only calendar cards */
.calendar-card {
  border-left: 6px solid var(--calendar-color, #4285f4);
  border-top-color: var(--calendar-color, #4285f4);
  border-right-color: var(--calendar-color, #4285f4);
  border-bottom-color: var(--calendar-color, #4285f4);
  background: linear-gradient(
    90deg,
    var(--calendar-soft, rgba(66, 133, 244, 0.12)) 0,
    #f9fbfd 45%
  );
}

.calendar-card:hover {
  border-color: var(--calendar-color, #4285f4);
}

.calendar-card .calendar-source-pill {
  color: white;
  background: var(--calendar-color, #4285f4);
}

.calendar-card .calendar-footer {
  border-top-color: var(--calendar-soft, rgba(66, 133, 244, 0.18));
}

/* Microsoft Outlook setup */
.outlook-panel {
  display: grid;
  gap: 13px;
}

.outlook-setup-copy {
  display: grid;
  gap: 3px;
}

.outlook-setup-copy span {
  color: var(--muted);
}

.outlook-client-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.outlook-client-field input {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
}

.outlook-accounts-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.outlook-account-card {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 12px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.outlook-account-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.outlook-account-heading h4 {
  margin: 0 0 2px;
  font-size: 1rem;
}

.outlook-account-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.outlook-account-dot {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.outlook-account-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.outlook-color-setting {
  min-width: 90px;
}

.outlook-color-setting .outlook-color-input {
  width: 100% !important;
  height: 46px;
  min-height: 46px !important;
  border: 2px solid var(--line) !important;
  background: white !important;
}

.outlook-account-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.outlook-connect-button {
  width: 100%;
}

.setup-details code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #e8eef3;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

@media (max-width: 760px) {
  .outlook-client-row,
  .outlook-accounts-editor {
    grid-template-columns: 1fr;
  }

  .outlook-client-row .button,
  .outlook-account-actions .button {
    width: 100%;
  }

  .calendar-quick-toggles {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .person-row {
    flex-wrap: wrap;
  }

  .person-row .person-name-input {
    flex-basis: calc(100% - 62px);
  }

  .person-color-field {
    flex: 1 1 auto;
  }
}

/* Outlook published ICS feed settings */
.outlook-ics-field input {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
}

.outlook-feed-status {
  min-height: 24px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.outlook-feed-error {
  color: var(--danger);
  font-weight: 850;
}

.outlook-ics-help {
  margin-top: 2px;
}

.calendar-card:not(.calendar-openable) {
  cursor: default;
}

@media (max-width: 760px) {
  .outlook-account-fields {
    grid-template-columns: 1fr;
  }

  .outlook-color-setting {
    min-width: 0;
  }
}

/* -------------------------------------------------------------------------
   Weekly-board containment
   Keep every task and calendar event strictly inside its assigned day column.
   The Day view intentionally keeps the more detailed layout.
   ------------------------------------------------------------------------- */

.week-board,
.week-board > .day-column,
.week-board .day-column-header,
.week-board .card-stack,
.week-board .task-card,
.week-board .card-topline,
.week-board .task-title-row,
.week-board .quick-toggles,
.week-board .card-footer {
  min-width: 0;
  max-width: 100%;
}

.week-board {
  align-items: start;
}

.week-board > .day-column {
  overflow: hidden;
}

.week-board .card-stack {
  width: 100%;
}

.week-board .task-card {
  width: 100%;
  overflow: hidden;
}

.week-board .card-topline {
  flex-wrap: wrap;
  align-items: center;
}

.week-board .card-topline > * {
  min-width: 0;
}

.week-board .assignee-pill,
.week-board .calendar-source-pill {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.week-board .time-pill,
.week-board .calendar-time-pill {
  max-width: 100%;
  white-space: nowrap;
}

.week-board .task-title-row {
  width: 100%;
}

.week-board .task-title,
.week-board .task-title-row .task-title {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Descriptions are useful in Day view, but they make seven narrow columns
   difficult to scan and may contain long meeting links with no break points. */
.week-board .task-description-preview {
  display: none;
}

.week-board .calendar-location {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.week-board .quick-toggle {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
}

.week-board .quick-toggle > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.week-board .card-footer {
  width: 100%;
  flex-wrap: wrap;
  align-items: flex-start;
}

.week-board .completion-note,
.week-board .edit-hint {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* "Open in Calendar" and "ICS feed" are available in Day view and Settings.
   Omitting the secondary footer action keeps week cards compact. */
.week-board .calendar-footer .edit-hint {
  display: none;
}

/* On wide dashboard displays, divide the available width evenly among all
   seven days rather than allowing long content to influence track sizing. */
@media (min-width: 1200px) {
  .week-board {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    overflow-x: hidden;
  }
}


/* -------------------------------------------------------------------------
   Shared-password login
   ------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 10%, rgba(36, 87, 125, 0.18), transparent 32rem),
    radial-gradient(circle at 90% 80%, rgba(240, 165, 43, 0.13), transparent 28rem),
    var(--bg);
}

.login-shell {
  width: min(460px, 100%);
}

.login-card {
  padding: clamp(28px, 6vw, 46px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.login-brand-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 22px;
  color: white;
  background: var(--primary);
  font-size: 40px;
  font-weight: 950;
}

.login-kicker {
  margin-bottom: 3px;
  color: var(--primary-2);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-card h1 {
  margin-bottom: 8px;
}

.login-help {
  margin-bottom: 24px;
  color: var(--muted);
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 14px;
  text-align: left;
}

.login-button {
  width: 100%;
  margin-top: 5px;
}

.login-error {
  margin: 0;
  padding: 11px 13px;
  border-radius: 12px;
  color: var(--danger);
  background: var(--danger-soft);
  font-weight: 800;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}
