/* Sankalpam — personal: clear orange on white; work: electric blue on white. Tasks are amber, events are blue
   (an orange/blue pair stays distinct for most colour-vision differences). */

:root {
  --bg: #f8f7f6;
  --surface: #ffffff;
  --ink: #1f1a17;
  --ink-soft: #4f4741;
  --muted: #8c847d;
  --line: #e8e4e0;
  --line-soft: #f2efec;

  --accent: #ea580c;
  --accent-deep: #c2410c;
  --accent-tint: #fff1e7;

  --task: #ea580c;
  --task-ink: #9a3412;
  --task-tint: #fff5ee;
  --event: #2b6cb0;
  --event-ink: #1e4e80;
  --event-tint: #eef4fb;

  --task-line: #fde0cc;
  --event-line: #d5e3f3;
  --task-faded: #fdc9a8;
  --event-faded: #bcd2ea;
  --note-task: linear-gradient(170deg, #ffe9d9, #fed3b4);
  --note-task-ink: #7c2d0a;
  --note-event: linear-gradient(170deg, #e3eefb, #ccdff4);
  --note-event-ink: #1e3f66;

  --accent-light: #fb923c;
  --accent-button: #f97316;
  --accent-shadow: rgba(194, 65, 12, .25);
  --accent-glow: rgba(234, 88, 12, .3);
  --accent-wash: rgba(234, 88, 12, .06);
  --accent-wash-strong: rgba(234, 88, 12, .12);
  --focus: rgba(234, 88, 12, .4);
  --border-hover: #d6cfc9;
  --glow-1: #fde7d8;
  --glow-1-clear: rgba(253, 231, 216, 0);
  --glow-2: #f1efed;
  --glow-2-clear: rgba(241, 239, 237, 0);
  --header-bg: rgba(248, 247, 246, .84);
  --header-line: rgba(232, 228, 224, .9);
  --day-bg: #ffffff;
  --day-weekend: #faf9f7;
  --day-rule: rgba(232, 228, 224, .45);
  --day-hover: #f3cdb3;

  --danger: #c2412d;
  --danger-tint: #fcebe7;

  /* Season chart: deliberately unlike either theme's accent, the same in both spaces. */
  --chart-task: #14857a;
  --chart-event: #7e5bd6;
  --chart-task-faded: #a9d8d2;
  --chart-event-faded: #d3c6f3;

  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .04), 0 12px 32px rgba(60, 40, 20, .06);
  --shadow-lift: 0 2px 4px rgba(60, 40, 20, .06), 0 24px 60px rgba(60, 40, 20, .14);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 85% -120px, var(--glow-1) 0%, var(--glow-1-clear) 70%),
    radial-gradient(900px 400px at -10% 0, var(--glow-2) 0%, var(--glow-2-clear) 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -.02em;
  margin: 0;
}

.eyebrow {
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ---- Work theme: graphite & electric blue. Tasks blue, events amber, overdue stays red. ---- */

body.theme-work {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1b1f24;
  --ink-soft: #49505a;
  --muted: #858c97;
  --line: #e2e5ea;
  --line-soft: #eef0f3;

  --accent: #2563eb;
  --accent-deep: #1d4ed8;
  --accent-tint: #e8effd;
  --accent-light: #60a5fa;
  --accent-button: #3b82f6;
  --accent-shadow: rgba(29, 78, 216, .25);
  --accent-glow: rgba(37, 99, 235, .3);
  --accent-wash: rgba(37, 99, 235, .06);
  --accent-wash-strong: rgba(37, 99, 235, .12);
  --focus: rgba(37, 99, 235, .4);
  --border-hover: #c9cfd8;

  --task: #2563eb;
  --task-ink: #1e40af;
  --task-tint: #eff4ff;
  --task-line: #d6e2fb;
  --task-faded: #bfd2f8;
  --event: #d97706;
  --event-ink: #92400e;
  --event-tint: #fdf6e9;
  --event-line: #f5e0bb;
  --event-faded: #f3d6a6;
  --note-task: linear-gradient(170deg, #e3ecff, #cddcfc);
  --note-task-ink: #1e3a8a;
  --note-event: linear-gradient(170deg, #ffefcf, #fde0a6);
  --note-event-ink: #7c3a06;

  --glow-1: #dfe8fb;
  --glow-1-clear: rgba(223, 232, 251, 0);
  --glow-2: #eceff4;
  --glow-2-clear: rgba(236, 239, 244, 0);
  --header-bg: rgba(246, 247, 249, .82);
  --header-line: rgba(226, 229, 234, .9);
  --day-bg: #ffffff;
  --day-weekend: #f8f9fb;
  --day-rule: rgba(226, 229, 234, .45);
  --day-hover: #c9d6ee;
}

/* Work headings and numbers are set in the sans for a crisper, more businesslike feel. */
body.theme-work h1, body.theme-work h2 {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -.03em;
}

body.theme-work .header-family, body.theme-work .menu-family, body.theme-work .stat-number,
body.theme-work .donut-total, body.theme-work .empty-state b, body.theme-work .page-footer {
  font-family: var(--sans);
  font-style: normal;
}

body.theme-work .stat-number, body.theme-work .donut-total {
  font-weight: 700;
  letter-spacing: -.03em;
}

body.theme-work .header-family {
  font-weight: 600;
  font-size: 17px;
}

body.theme-work .avatar-lg {
  background: linear-gradient(150deg, #475569, #1e293b);
}

body, .card, .stat, .site-header {
  transition: background-color .35s ease, border-color .35s ease;
}

/* ---- Brand ---- */

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: linear-gradient(150deg, var(--accent-light), var(--accent) 55%, var(--accent-deep));
  box-shadow: 0 6px 16px var(--accent-glow);
}

.brand-mark svg {
  width: 32px;
  height: 32px;
  fill: #fff8ee;
}

.brand-mark.small {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  box-shadow: none;
}

.brand-mark.small svg {
  width: 15px;
  height: 15px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -.02em;
}

/* ---- Buttons ---- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: .6;
  cursor: progress;
  transform: none;
}

.button-primary {
  background: linear-gradient(150deg, var(--accent-button), var(--accent-deep));
  color: #fff;
  box-shadow: 0 8px 20px var(--accent-shadow);
}

.button-primary:hover {
  box-shadow: 0 12px 26px var(--accent-shadow);
}

.button-quiet {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-soft);
}

.button-quiet:hover {
  border-color: var(--border-hover);
  color: var(--ink);
}

.button-soft {
  background: var(--accent-tint);
  color: var(--accent-deep);
}

.button-danger {
  margin-right: auto;
  background: var(--danger-tint);
  color: var(--danger);
}

.button-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.button-wide {
  width: 100%;
}

.link-button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent-deep);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---- Header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  gap: 18px;
  padding: 22px max(32px, calc((100% - 1180px) / 2 + 32px));
  border-bottom: 1px solid var(--header-line);
  background: var(--header-bg);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}

.header-family {
  padding-left: 18px;
  border-left: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 20px;
}

.header-spacer {
  flex: 1;
}

.demo-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.avatar-lg {
  width: 46px;
  height: 46px;
  font-size: 18px;
  background: linear-gradient(150deg, #57504a, #2c2622);
}

.avatar-button {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

.account {
  position: relative;
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 300px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}

.menu-section {
  padding: 12px 14px;
}

.menu-section + .menu-section {
  border-top: 1px solid var(--line-soft);
}

.menu-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.menu-family {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--serif);
  font-size: 18px;
}

.member-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.member-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}

.member-list .avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.member-list small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.menu-me {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Space switch ---- */

.space-switch {
  display: flex;
  gap: 3px;
  margin-left: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .04);
}

.space-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.space-tab svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.space-tab:hover {
  color: var(--ink);
}

.space-tab[aria-selected="true"] {
  background: linear-gradient(150deg, var(--accent-button), var(--accent-deep));
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-shadow);
}

.menu-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.member-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.member-actions .link-button {
  font-size: 12px;
}

.icon-x {
  border: 0;
  padding: 0 2px;
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.icon-x:hover {
  color: var(--danger);
}

.team-form {
  display: flex;
  gap: 8px;
}

.team-form input {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: 0;
  background: var(--bg);
  font-size: 14px;
}

.team-form input:focus {
  border-color: var(--accent);
}

/* ---- Chart pager ---- */

.chart-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 16px;
}

.range-pager {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-label {
  min-width: 118px;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}

.round-button.small {
  width: 32px;
  height: 32px;
  font-size: 18px;
}

.round-button:disabled {
  opacity: .35;
  cursor: default;
}

.chart-tools .legend {
  padding-top: 0;
}

/* ---- Page ---- */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 32px 40px;
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 30px;
}

.intro h1 {
  margin: 8px 0;
  font-size: clamp(28px, 3.6vw, 36px);
  line-height: 1.05;
}

.intro h1 em {
  color: var(--accent-deep);
  font-style: normal;
}

.intro-summary {
  margin: 0;
  color: var(--ink-soft);
  font-size: 17px;
}

.intro-summary .warn {
  color: var(--danger);
  font-weight: 600;
}

.intro-actions {
  display: flex;
  flex: none;
  gap: 10px;
}

.voice-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-tint);
}

.listening .voice-dot {
  background: var(--danger);
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  to {
    box-shadow: 0 0 0 8px rgba(194, 65, 45, .15);
  }
}

/* ---- Stats ---- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.stat.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint), var(--shadow);
}

.stat-number {
  grid-row: span 2;
  min-width: 1.4em;
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1;
}

.stat-label {
  font-weight: 600;
}

.stat-hint {
  color: var(--muted);
  font-size: 13px;
}

.stat-overdue.has-items {
  border-color: #f0c6bd;
  background: linear-gradient(160deg, #fff4f0, var(--surface));
}

.stat-overdue.has-items .stat-number, .stat-overdue.has-items .stat-label {
  color: var(--danger);
}

.stat-overdue.has-items .stat-label::before {
  content: '⚠ ';
}

.stat-asap .stat-number {
  color: var(--accent-deep);
}

.stat-backlog .stat-number {
  color: var(--muted);
}

/* ---- Cards ---- */

.card {
  margin-bottom: 22px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.card-heading h2 {
  font-size: 26px;
}

.card-heading p {
  margin: 2px 0 0;
  color: var(--muted);
}

.legend {
  display: flex;
  gap: 16px;
  padding-top: 6px;
  color: var(--ink-soft);
  font-size: 14px;
}

.legend-item::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 3px;
  vertical-align: -1px;
}

.legend-item.task::before {
  background: var(--chart-task);
}

.legend-item.event::before {
  background: var(--chart-event);
}

/* ---- Forecast chart ---- */

.forecast-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.chart-label {
  fill: var(--muted);
  font: 500 11px var(--sans);
}

.chart-label.now {
  fill: var(--danger);
  font-weight: 700;
}

.chart-count {
  fill: var(--ink-soft);
  font: 700 11px var(--sans);
}

/* ---- Insights row: season chart + donut ---- */

.insights {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr);
  gap: 22px;
  margin-bottom: 22px;
}

.insights .card {
  margin-bottom: 0;
}

.season {
  display: flex;
  flex-direction: column;
}

.season .forecast-chart {
  flex: 1;
  display: flex;
  align-items: flex-end;
}

.bar-hit {
  fill: transparent;
  cursor: pointer;
}

.bar-col:hover .bar-hit {
  fill: var(--accent-wash);
}

.bar-col.active .bar-hit {
  fill: var(--accent-wash-strong);
}

.bar-seg {
  cursor: pointer;
  transition: opacity .15s ease;
}

.bar-col.dimmed .bar-seg {
  opacity: .35;
}

.bar-seg:hover {
  opacity: .8;
}

.bar-seg.picked {
  stroke: var(--ink);
  stroke-width: 2;
}

.chart-label.active {
  fill: var(--accent-deep);
  font-weight: 700;
}

.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.donut svg {
  display: block;
  width: 190px;
  height: 190px;
}

.donut-track {
  fill: none;
  stroke: var(--line-soft);
  stroke-width: 26;
}

.donut-slice {
  fill: none;
  stroke-width: 26;
  cursor: pointer;
  transition: stroke-width .15s ease, opacity .15s ease;
}

.donut-slice:hover, .donut-slice.picked {
  stroke-width: 34;
}

.donut-slice.dimmed {
  opacity: .35;
}

.donut-total {
  fill: var(--ink);
  font: 500 38px var(--serif);
}

.donut-caption {
  fill: var(--muted);
  font: 500 12px var(--sans);
}

.donut-legend {
  list-style: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

.donut-row {
  display: grid;
  grid-template-columns: 12px 1fr auto 42px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  cursor: pointer;
}

.donut-row:hover, .donut-row.picked {
  background: var(--line-soft);
}

.donut-row i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.donut-row small {
  color: var(--muted);
  text-align: right;
}

.donut-empty {
  color: var(--muted);
  text-align: center;
}

/* ---- Calendar with sticky notes ---- */

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.round-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.round-button:hover {
  border-color: var(--border-hover);
  color: var(--ink);
}

.calendar-grid {
  display: grid;
  grid-template-columns: 44px repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-head {
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.cal-week-head {
  padding: 4px 0;
  text-align: center;
}

.cal-week {
  align-self: stretch;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cal-week:hover {
  background: var(--line-soft);
  color: var(--accent-deep);
}

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 128px;
  padding: 8px 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, var(--day-rule) 23px 24px),
    var(--day-bg);
  cursor: copy;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.cal-day:hover {
  border-color: var(--day-hover);
  box-shadow: 0 4px 14px rgba(60, 40, 20, .06);
}

.cal-day.weekend {
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, var(--day-rule) 23px 24px),
    var(--day-weekend);
}

.cal-day.outside {
  opacity: .45;
}

.cal-day.today {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-tint);
}

.cal-date {
  align-self: flex-start;
  min-width: 26px;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
  line-height: 24px;
  text-align: center;
}

.cal-day.today .cal-date {
  background: var(--accent);
  color: #fff;
}

.cal-day.past:not(.today) .cal-date {
  color: var(--muted);
}

/* A sticky note: tinted paper, a strip of tape, a slight tilt, a curled shadow. */
.note {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 9px 8px 8px;
  border: 0;
  border-radius: 2px 2px 10px 2px;
  background: var(--note-bg);
  color: var(--note-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  box-shadow: 0 1px 1px rgba(60, 40, 20, .08), 0 6px 10px -6px rgba(60, 40, 20, .35);
  transform: rotate(var(--tilt, 0deg));
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.note::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  width: 34px;
  height: 10px;
  margin-left: -17px;
  background: rgba(255, 255, 255, .6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .03);
  transform: rotate(-2deg);
}

.note:hover {
  z-index: 1;
  transform: rotate(0deg) scale(1.04);
  box-shadow: 0 2px 3px rgba(60, 40, 20, .1), 0 12px 18px -8px rgba(60, 40, 20, .4);
}

.note.task {
  --note-bg: var(--note-task);
  --note-ink: var(--note-task-ink);
}

.note.event {
  --note-bg: var(--note-event);
  --note-ink: var(--note-event-ink);
}

.note.overdue {
  outline: 2px solid var(--danger);
  outline-offset: -2px;
}

.note.overdue .note-title {
  color: var(--danger);
}

.note.done {
  opacity: .5;
}

.note.done .note-title {
  text-decoration: line-through;
}

.note-title {
  display: -webkit-box;
  flex: 1;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.note-who {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.cal-more {
  align-self: flex-start;
  border: 0;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--line-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Plans ---- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filters {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--line-soft);
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.filter.selected {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(60, 40, 20, .1);
}

.filter-task::before, .filter-event::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.filter-task::before {
  background: var(--task);
}

.filter-event::before {
  background: var(--event);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(300px, 100%);
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
}

.search:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.active-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  color: var(--accent-deep);
  font-weight: 600;
  font-size: 14px;
}

.plan-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.plan-table thead th {
  padding: 4px 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-align: left;
  text-transform: uppercase;
}

.col-when {
  width: 26%;
}

.col-who {
  width: 22%;
}

.group-row td {
  padding: 16px 16px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.group-row.overdue td {
  color: var(--danger);
}

.group-count {
  margin-left: 6px;
  font-weight: 500;
  letter-spacing: 0;
}

.plan-row {
  cursor: pointer;
}

.plan-row.task {
  --row-tint: var(--task-tint);
  --row-line: var(--task-line);
  --row-accent: var(--task);
  --row-ink: var(--task-ink);
}

.plan-row.event {
  --row-tint: var(--event-tint);
  --row-line: var(--event-line);
  --row-accent: var(--event);
  --row-ink: var(--event-ink);
}

.plan-row.is-done {
  --row-tint: #f7f3ed;
  --row-accent: #cfc4b6;
  --row-line: var(--line-soft);
}

.plan-row td {
  padding: 14px 16px;
  background: var(--row-tint);
  border-top: 1px solid var(--row-line);
  border-bottom: 1px solid var(--row-line);
  vertical-align: middle;
  transition: background .15s ease;
}

.plan-row td:first-child {
  border-left: 5px solid var(--row-accent);
  border-radius: 12px 0 0 12px;
}

.plan-row td:last-child {
  border-right: 1px solid var(--row-line);
  border-radius: 0 12px 12px 0;
}

.plan-row:hover td {
  background: var(--surface);
}

.plan-row:focus-visible {
  outline: none;
}

.plan-row:focus-visible td {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--row-accent);
}

.what {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.done-toggle {
  appearance: none;
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: 1px 0 0;
  border: 2px solid var(--row-accent);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

.done-toggle:checked {
  background: var(--row-accent);
}

.done-toggle:checked::after {
  content: '';
  width: 6px;
  height: 11px;
  margin-top: -2px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.what > div {
  min-width: 0;
}

.plan-title {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 16px;
}

.plan-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 14px;
}

.plan-kind {
  color: var(--row-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.plan-description {
  overflow: hidden;
  max-width: 46ch;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-progress {
  color: var(--row-ink);
  font-weight: 600;
  font-size: 13px;
}

.plan-row.is-done .plan-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(0, 0, 0, .25);
}

.when-date {
  display: block;
  font-weight: 600;
}

.when-sub {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.week-chip {
  display: inline-block;
  margin-right: 6px;
  padding: 0 7px;
  border: 1px solid var(--row-line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .75);
  color: var(--row-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
}

.overdue-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.plan-row.overdue .when-date {
  color: var(--danger);
}

.asap-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.backlog-label {
  color: var(--muted);
  font-style: italic;
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
}

.empty-state {
  padding: 40px 10px 30px;
  text-align: center;
}

.empty-mark {
  color: var(--accent);
  font-size: 30px;
}

.empty-state b {
  display: block;
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
}

.empty-state p {
  margin: 6px 0 18px;
  color: var(--muted);
}

.plans-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 0 10px;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
}

/* ---- Dialogs and forms ---- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(42, 34, 29, .35);
  backdrop-filter: blur(6px);
  animation: fade .18s ease;
}

.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  padding: 30px 32px 26px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  animation: rise .22s ease;
}

.modal-narrow {
  width: min(440px, 100%);
}

@keyframes fade {
  from { opacity: 0; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal h2 {
  font-size: 30px;
}

.modal-intro {
  margin: 4px 0 20px;
  color: var(--muted);
}

.field {
  display: block;
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.field input, .field textarea, .field select, .checklist-input-row input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
  transition: border-color .15s ease, background .15s ease;
}

.field input:focus, .field textarea:focus, .field select:focus, .checklist-input-row input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.field textarea {
  resize: vertical;
}

.optional {
  margin-left: 4px;
  color: var(--muted);
  font-weight: 400;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.kind-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.kind-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.kind-option input {
  position: absolute;
  opacity: 0;
}

.kind-option b {
  display: block;
}

.kind-option small {
  color: var(--muted);
  font-size: 13px;
}

.kind-swatch {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.kind-option.task .kind-swatch {
  background: var(--task);
}

.kind-option.event .kind-swatch {
  background: var(--event);
}

.kind-option.task:has(input:checked) {
  border-color: var(--task);
  background: var(--task-tint);
}

.kind-option.event:has(input:checked) {
  border-color: var(--event);
  background: var(--event-tint);
}

.kind-option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
}

.priority-choice {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: -4px 0 18px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 14px;
}

.priority-choice span {
  margin-right: auto;
  color: var(--muted);
}

.priority-choice label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  cursor: pointer;
}

.priority-choice input, .checklist-item input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.checklist-input-row {
  display: flex;
  gap: 8px;
}

.checklist-input-row .button {
  margin-top: 6px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font-weight: 400;
  font-size: 15px;
}

.checklist-item.is-done span {
  color: var(--muted);
  text-decoration: line-through;
}

.checklist-item button {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 20;
  max-width: calc(100% - 40px);
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff8ee;
  font-weight: 500;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity .2s ease, transform .2s ease;
}

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

/* ---- Sign in ---- */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, .8fr);
  background: var(--bg);
}

.auth-photo {
  display: flex;
  align-items: flex-end;
  padding: 48px;
  background: linear-gradient(180deg, rgba(42, 34, 29, 0) 40%, rgba(42, 34, 29, .55)), url('/images/sankalpam-morning.jpg') center / cover;
}

.auth-photo blockquote {
  max-width: 420px;
  margin: 0;
  color: #fff8ee;
  font-family: var(--serif);
  font-size: 28px;
  font-style: italic;
  line-height: 1.3;
}

.auth-card {
  align-self: center;
  width: min(420px, calc(100% - 48px));
  margin: 0 auto;
}

.auth-card .brand {
  margin-bottom: 56px;
}

.auth-card h1 {
  margin: 10px 0;
  font-size: 48px;
}

.auth-card h1 em {
  color: var(--accent-deep);
}

.auth-card > p {
  margin: 0 0 26px;
  color: var(--ink-soft);
  font-size: 16px;
}

.auth-card .link-button {
  display: block;
  margin: 14px auto 0;
}

.auth-error {
  min-height: 22px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 14px;
}

.auth-footnote {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

/* ---- Responsive ---- */

@media (max-width: 1000px) {
  .insights {
    grid-template-columns: minmax(0, 1fr);
  }
  .donut-wrap {
    flex-direction: row;
    justify-content: center;
  }
  .donut-legend {
    max-width: 320px;
  }
}

@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .intro {
    flex-direction: column;
    align-items: stretch;
  }
  .intro-actions .button {
    flex: 1;
  }
}

@media (max-width: 700px) {
  .site-header {
    padding: 14px 18px;
  }
  .site-header {
    gap: 10px;
  }
  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .brand-mark svg {
    width: 26px;
    height: 26px;
  }
  .brand-name {
    font-size: 29px;
  }
  .intro h1 {
    font-size: 26px;
  }
  .demo-badge {
    padding: 2px 8px;
    font-size: 10px;
  }
  .avatar-button .avatar-lg {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  .donut-wrap {
    flex-direction: column;
  }
  .calendar .card-heading, .season .card-heading {
    flex-direction: column;
  }
  .chart-tools {
    justify-content: space-between;
    width: 100%;
  }
  .calendar-grid {
    grid-template-columns: 26px repeat(7, minmax(0, 1fr));
    gap: 3px;
  }
  .cal-head {
    padding: 2px;
    font-size: 10px;
    letter-spacing: 0;
    text-align: center;
  }
  .cal-week {
    font-size: 9px;
    padding: 0;
  }
  .cal-day {
    min-height: 74px;
    padding: 4px 3px;
    gap: 3px;
    border-radius: 8px;
  }
  .cal-date {
    min-width: 20px;
    padding: 0 3px;
    font-size: 12px;
    line-height: 20px;
  }
  /* Notes shrink to coloured slips on phones. */
  .note {
    padding: 4px;
    font-size: 10px;
    transform: none;
  }
  .note::before, .note-who {
    display: none;
  }
  .note-title {
    -webkit-line-clamp: 2;
  }
  .cal-more {
    padding: 1px 3px;
    font-size: 10px;
  }
  .header-family {
    display: none;
  }
  .site-header {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .space-switch {
    order: 3;
    width: 100%;
    margin-left: 0;
  }
  .space-tab {
    flex: 1;
    justify-content: center;
  }
  .page {
    padding: 0 16px 30px;
  }
  .intro {
    padding: 14px 0 22px;
  }
  .card {
    padding: 20px 16px;
    border-radius: var(--radius);
  }
  .stat {
    padding: 14px;
  }
  .stat-number {
    grid-row: auto;
    font-size: 32px;
  }
  .forecast-chart {
    overflow-x: auto;
    margin: 0 -16px;
    padding: 0 16px 6px;
  }
  .forecast-svg {
    min-width: 540px;
  }
  .stat-hint, .card-heading .legend {
    display: none;
  }
  .filters {
    width: 100%;
    overflow-x: auto;
  }
  .filter {
    flex: 1;
    justify-content: center;
    padding: 0 10px;
  }
  .search {
    width: 100%;
  }

  /* Table rows become cards: what on top, when and who underneath. */
  .plan-table thead {
    display: none;
  }
  .plan-table, .plan-table tbody, .plan-table tr {
    display: block;
  }
  .plan-row {
    display: grid !important;
    grid-template-columns: 1fr auto;
    margin-bottom: 10px;
    border: 1px solid var(--row-line);
    border-left: 5px solid var(--row-accent);
    border-radius: 14px;
    background: var(--row-tint);
    overflow: hidden;
  }
  .plan-row td, .plan-row td:first-child, .plan-row td:last-child {
    display: block;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .plan-row td:first-child {
    grid-column: 1 / -1;
    padding-bottom: 6px;
  }
  .plan-row td.when-cell {
    padding: 0 16px 14px 54px;
  }
  .plan-row td.who-cell {
    padding: 0 16px 14px;
    align-self: end;
  }
  .who-name {
    display: none;
  }
  .plan-row:hover td {
    background: transparent;
  }
  .group-row td {
    display: block;
    padding: 14px 4px 8px;
  }
  .plan-description {
    display: -webkit-box;
    max-width: 100%;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .field-row, .kind-choice {
    grid-template-columns: 1fr;
  }
  .modal {
    padding: 26px 20px 20px;
  }
  .modal-actions {
    flex-wrap: wrap;
  }
  .auth-screen {
    display: block;
    overflow: auto;
  }
  .auth-photo {
    height: 34vh;
    padding: 24px;
  }
  .auth-photo blockquote {
    font-size: 20px;
  }
  .auth-card {
    padding: 34px 0 40px;
  }
  .auth-card .brand {
    margin-bottom: 30px;
  }
  .auth-card h1 {
    font-size: 38px;
  }
}

@media (max-width: 380px) {
  .brand-name {
    font-size: 26px;
  }
  .intro h1 {
    font-size: 23px;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
  }
}
