:root {
  --background: #ffffff;
  --foreground: #000000;
  --destructive: #ff0000;
  --on-destructive: #ffffff;
  --bg: var(--background);
  --panel: var(--background);
  --ink: var(--foreground);
  --muted: var(--foreground);
  --card: var(--background);
  --line: var(--foreground);
}

html[data-theme="dark"] {
  --background: #000000;
  --foreground: #ffffff;
  --destructive: #ff0000;
  --on-destructive: #ffffff;
  --bg: var(--background);
  --panel: var(--background);
  --ink: var(--foreground);
  --muted: var(--foreground);
  --card: var(--background);
  --line: var(--foreground);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Funnel Sans", "Avenir Next", "Trebuchet MS", sans-serif;
  font-weight: 700;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  height: 100dvh;
}

.marketing-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

@media (max-width: 480px) {
  .marketing-shell {
    padding: 200px 40px;
  }

  #marketing-hero {
    padding: 24px;
  }
}

.marketing-background {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: stretch;
  pointer-events: none;
  opacity: 0.2;
  padding: 16px;
}

.marketing-calendar {
  width: 100%;
  height: 100%;
  border-color: var(--line);
  position: relative;
}

.marketing-calendar .year-grid,
.marketing-calendar .month-grid {
  height: 100%;
}

.marketing-calendar #marketing-month {
  display: none;
}

.marketing-calendar .month-title {
  font-size: 12px;
  padding: 6px;
}

.marketing-calendar .day-label {
  font-size: 10px;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-rows: 1fr auto;
  }

  .topbar {
    order: 2;
    border-bottom: 0;
  }

  .calendar-area {
    margin-top: 4px;
  }
  .marketing-background {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .marketing-background {
    padding: 8px;
  }

  .marketing-calendar .month-title {
    font-size: 11px;
  }

  .marketing-calendar .day-label {
    font-size: 9px;
  }
}

@media (max-width: 680px) {
  .marketing-calendar .year-grid {
    display: none;
  }

  .marketing-calendar #marketing-month {
    display: grid;
  }

  .marketing-sections {
    grid-template-columns: 1fr;
  }
}

.marketing-card {
  width: min(680px, 100%);
  border: 2px solid var(--line);
  border-radius: 40px;
  padding: 32px;
  background: var(--card);
  display: grid;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.marketing-card h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 0.94;
  letter-spacing: -0.2rem;
}

@media (max-width: 680px) {
  .marketing-card h1 {
    letter-spacing: -0.1rem;
  }
}

.marketing-card p {
  margin: 0;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.25;
}

.marketing-free {
  font-size: 16px;
}

.feature-list {
  display: grid;
  gap: 14px;
  border: 2px solid var(--line);
  border-radius: 24px;
  padding: 18px;
}

.feature-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--foreground);
  flex: 0 0 auto;
  margin-top: -2px;
}

.feature-dot.dot-a {
  background: #ff0000;
}

.feature-dot.dot-b {
  background: #ffc700;
}

.feature-dot.dot-c {
  background: #15c771;
}

.feature-dot.dot-d {
  background: #2f8cfa;
}

.feature-dot.dot-e {
  background: #b632cc;
}

.feature-dot.dot-f {
  background: #875436;
}

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

.feature-divider {
  display: none;
}

.paid-list h4 {
  margin: 0 0 4px;
  font-size: 24px;
  font-family: "Borel", "Brush Script MT", cursive;
}

.marketing-card .coming-soon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  width: fit-content;
  height: 24px;
  margin-bottom: 8px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  font-family: "Funnel Sans", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  background: var(--foreground);
  color: var(--background);
  text-size-adjust: none;
  -webkit-text-size-adjust: none;
}

.feature-bullets {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  font-size: 14px;
  line-height: 1.3;
}

.feature-bullets li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.feature-bullets .feature-dot {
  margin-top: 1px;
}

.feature-item h4 {
  margin: 0 0 4px;
  font-size: 18px;
}

.feature-item p {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
}

.feature-item {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: center;
}

.feature-item h4,
.feature-item p {
  grid-column: 2;
}

.marketing-brand {
  font-size: 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
  margin-top: 1px;
}

#enter-app {
  justify-self: start;
  background: var(--foreground);
  color: var(--background);
  border-color: var(--foreground);
  padding: 10px 16px;
}

.marketing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.marketing-actions + .marketing-sections {
  margin-top: 6px;
}

.outline-button {
  background: transparent;
  color: var(--ink);
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--panel);
}

.brand-link {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 700;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 6px 12px;
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: none;
}

.period-picker {
  position: relative;
  display: inline-flex;
  min-width: 0;
}

#period-picker-toggle {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  padding: 6px 12px;
  min-height: 40px;
  max-width: 100%;
  cursor: pointer;
  border-radius: 999px;
  white-space: nowrap;
  overflow: visible;
}

#period-picker-label {
  display: inline-block;
  white-space: nowrap;
}

.year-caret {
  font-size: 1rem;
  flex: 0 0 auto;
}

.period-picker-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  min-width: 140px;
  max-height: 280px;
  overflow: auto;
  border: 2px solid var(--foreground);
  border-radius: 12px;
  background: var(--background);
  z-index: 60;
  padding: 4px;
  display: grid;
  gap: 2px;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition:
    transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 200ms ease;
}

.period-picker-menu.visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.period-picker-item {
  text-align: left;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 8px;
}

.period-picker-item.active {
  background: var(--foreground);
  color: var(--background);
}

.period-picker-item:hover {
  transform: none;
}

.view-nav {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 8px;
}

.today-button {
  border-radius: 999px;
  padding: 6px 12px;
  line-height: 1;
}

.icon-button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  min-height: 40px;
  border-radius: 999px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 700;
}

.key-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 1.5px solid var(--foreground);
  border-radius: 5px;
  color: var(--foreground);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0.33;
}

html.hide-keyboard-hints .key-hint {
  display: none !important;
}

html.hide-keyboard-hints #settings-modal .shortcut-list .key-hint {
  display: inline-flex !important;
}

@media (max-width: 920px) {
  #settings-modal .settings-section.shortcuts {
    display: none;
  }

  .key-hint {
    display: none !important;
  }

  #settings-modal .shortcut-list .key-hint {
    display: inline-flex !important;
  }

  html.hide-keyboard-hints #settings-modal .shortcut-list .key-hint {
    display: none !important;
  }
}

#period-picker-toggle .topbar-key,
#open-settings .topbar-key {
  margin-left: 2px;
}

.icon-button:hover {
  transform: none;
}

.muted {
  color: var(--muted);
  margin-top: 8px;
}

.page {
  padding: 20px;
  min-height: 0;
}

.page.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.dot-type-form {
  display: grid;
  gap: 10px;
  margin: 16px 0 24px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

input[type="text"] {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  font: inherit;
  background: var(--card);
  color: var(--ink);
}

input[type="color"] {
  width: 52px;
  height: 34px;
  border: none;
  padding: 0;
  background: transparent;
}

button {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  transition: transform 100ms ease;
}

@media (hover: hover) and (pointer: fine) {
  button:hover {
    transform: scale(1.05);
  }
}

button:active {
  transform: scale(0.95);
  transition: none;
}

:where(button, [role="button"], a[href], input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  box-shadow: none;
}

.dot-type-row .dot-name-input:focus-visible,
.popover-note-row input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 8px;
  box-shadow: none;
}

#period-picker-toggle:focus-visible .year-caret path,
#open-settings:focus-visible svg path,
#open-settings:focus-visible svg circle {
  stroke: currentColor;
}

@media (hover: hover) and (pointer: fine) and (min-width: 921px) {
  .brand-link:hover,
  .brand-link:active {
    transform: translateY(-50%) scale(1);
  }
}

.dot-type-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
}

.empty-state {
  border: 2px dashed var(--foreground);
  border-radius: 12px;
  padding: 18px 10px;
  text-align: center;
  width: 100%;
}

.empty-state-emoji {
  display: block;
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: 8px;
}

.dot-type-row {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  overflow: visible;
  z-index: 1;
  transition: transform 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .suggestion-chip:hover {
    transform: scale(1.03);
  }
}

.suggestion-chip:active {
  transform: scale(0.9);
}

.dot-type-row.menu-open {
  z-index: 200;
}

.dot-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
}

.dot-type-row .dot-name-input {
  width: 24px;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dot-type-row .dot-name-input:focus {
  outline: none;
  box-shadow: none;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 0;
  display: inline-block;
}

.dot-type-row .swatch {
  cursor: pointer;
}

.color-picker {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  padding: 12px;
  display: grid;
  gap: 8px;
  min-width: 220px;
  z-index: 120;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 180ms ease;
}

.color-picker.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 24px);
  gap: 6px;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid var(--line);
  padding: 0;
}

.color-custom {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-items: center;
}

.color-hex-input {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  font: inherit;
  background: var(--card);
  color: var(--ink);
  width: 100%;
}

.color-picker .color-hex-input {
  width: 100%;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.color-apply {
  padding: 8px 10px;
  width: 100%;
}

.dot-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dot-actions-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
  border: 0;
  padding: 2px 6px;
  border-radius: 12px;
  min-width: 24px;
  background: transparent;
  line-height: 1;
}

.dot-actions-toggle svg {
  display: block;
}

.dot-actions-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  z-index: 100;
  padding: 4px;
  display: grid;
  gap: 2px;
  opacity: 0;
  transform: translate(
    var(--menu-offset-x, 0px),
    calc(var(--menu-offset-y, 0px) + 8px)
  );
  pointer-events: none;
  transition:
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 180ms ease;
}

.dot-actions-menu.visible {
  opacity: 1;
  transform: translate(var(--menu-offset-x, 0px), var(--menu-offset-y, 0px));
  pointer-events: auto;
}

.dot-actions-item {
  text-align: left;
  border: 0;
  border-radius: 12px;
  padding: 8px;
  background: transparent;
}

.dot-actions-item:hover {
  background: var(--ink);
  color: var(--bg);
  transform: none;
}

.dot-actions-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dot-actions-item:disabled:hover {
  background: #e6e6e6;
  color: inherit;
}

.dot-actions-item.danger-solid {
  background: transparent;
  color: var(--foreground);
}

.dot-actions-item.danger-solid:hover {
  background: var(--destructive);
  color: var(--on-destructive);
}

.small-danger {
  border: 0;
  background: var(--destructive);
  color: var(--on-destructive);
  padding: 6px 9px;
  border-radius: 12px;
}

.small-danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.danger-solid {
  background: var(--destructive);
  border-color: var(--destructive);
  color: var(--on-destructive);
}

.calendar-area {
  display: flex;
  flex-direction: column;
  padding-top: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

@media (min-width: 921px) {
  .calendar-area,
  .year-grid,
  .month-grid,
  .year-day,
  .month-day {
    cursor:
      url("data:image/svg+xml;utf8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M8%2016C12.4183%2016%2016%2012.4183%2016%208C16%203.58172%2012.4183%200%208%200C3.58172%200%200%203.58172%200%208C0%2012.4183%203.58172%2016%208%2016Z%22%20fill%3D%22black%22/%3E%3Cpath%20d%3D%22M4.66669%208H11.3334%22%20stroke%3D%22white%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3Cpath%20d%3D%22M8%204.66667V11.3333%22%20stroke%3D%22white%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E")
        8 8,
      pointer;
  }

  body.popover-open .calendar-area,
  body.popover-open .year-grid,
  body.popover-open .month-grid,
  body.popover-open .year-day,
  body.popover-open .month-day {
    cursor: default;
  }
}

@media (min-width: 921px) {
  html[data-theme="dark"] .calendar-area,
  html[data-theme="dark"] .year-grid,
  html[data-theme="dark"] .month-grid,
  html[data-theme="dark"] .year-day,
  html[data-theme="dark"] .month-day {
    cursor:
      url("data:image/svg+xml;utf8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M8%2016C12.4183%2016%2016%2012.4183%2016%208C16%203.58172%2012.4183%200%208%200C3.58172%200%200%203.58172%200%208C0%2012.4183%203.58172%2016%208%2016Z%22%20fill%3D%22white%22/%3E%3Cpath%20d%3D%22M4.66669%208H11.3334%22%20stroke%3D%22black%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3Cpath%20d%3D%22M8%204.66667V11.3333%22%20stroke%3D%22black%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E")
        8 8,
      pointer;
  }

  html[data-theme="dark"] body.popover-open .calendar-area,
  html[data-theme="dark"] body.popover-open .year-grid,
  html[data-theme="dark"] body.popover-open .month-grid,
  html[data-theme="dark"] body.popover-open .year-day,
  html[data-theme="dark"] body.popover-open .month-day {
    cursor: default !important;
  }
}

.suggestions {
  margin: 0;
}

.settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.settings-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 42px;
  height: 26px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  position: relative;
  cursor: pointer;
  transition: background 140ms ease;
}

.settings-toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--line);
  transition: transform 140ms ease;
}

.settings-toggle input[type="checkbox"]:checked {
  background: var(--ink);
}

.settings-toggle input[type="checkbox"]:checked::after {
  transform: translateX(16px);
  background: var(--bg);
}

.suggested-dot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-section h4,
.settings-section h5 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1;
}

.settings-section h5 {
  margin-top: 14px;
}

.shortcut-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.shortcut-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.shortcut-keys {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.suggested-header-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px 12px;
}

.suggested-header-row h5 {
  margin: 14px 0 0;
}

.suggested-header-row .compact-toggle {
  margin-top: 14px;
}

.settings-card hr {
  border: 0;
  border-top: 2px solid var(--line);
  margin: 32px 0;
}

.data-action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: start;
  margin-bottom: 10px;
}

.signout-row {
  margin-top: 8px;
  margin-bottom: 0;
}

.signout-row .muted {
  margin: 0;
  height: 0;
  line-height: 0;
  visibility: hidden;
}

.data-action-row .muted {
  margin: 0;
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.auth-row input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  font: inherit;
  background: var(--card);
  color: var(--ink);
}

.auth-status {
  margin-top: 8px;
  font-size: 0.9rem;
}

.auth-status.muted {
  color: var(--muted);
}

.cloud-sync-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: start;
  margin-top: 8px;
}

.cloud-sync-info {
  min-width: 0;
}

.cloud-sync-info .auth-status {
  margin-top: 0;
}

.cloud-sync-info .auth-status + .auth-status {
  margin-top: 8px;
}

#auth-signout {
  align-self: start;
}

.display-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.color-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: transparent;
}

.color-mode-toggle button {
  min-width: 74px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  padding: 6px 14px;
}

.color-mode-toggle button.active {
  background: var(--ink);
  color: var(--bg);
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 12px;
}

.suggestion-chip.add-new {
  background: var(--ink);
  color: var(--bg);
}

.suggestion-chip .swatch {
  width: 16px;
  height: 16px;
}

.dot-type-add-item {
  display: inline-flex;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.calendar-header h2 {
  min-width: 220px;
  text-align: center;
  margin: 0;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  min-height: 0;
  grid-auto-rows: minmax(0, 1fr);
}

.month-grid.month-scroll-list {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  padding-bottom: 0;
}

.month-scroll-section {
  height: 100%;
  min-height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  margin: 0;
  padding-top: 12px;
}

.month-scroll-title {
  margin: 0;
  font-size: 14px;
}

.month-scroll-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  min-height: 0;
}

.month-day {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  border: 2px solid var(--line);
  border-radius: 12px;
  min-height: 0;
  padding: 4px 4px 0 6px;
  background: var(--card);
  overflow: hidden;
  text-align: left;
}

.month-day.current-day,
.year-day.current-day {
  background: var(--foreground);
  color: var(--background);
}

.month-day.current-day .day-label,
.year-day.current-day .day-label,
.month-day.current-day .month-day-label {
  color: var(--background);
}

.month-day:hover {
  transform: none;
}

.month-day.muted-day {
  border-style: dashed;
}

.month-day-label {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.month-note {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  box-sizing: border-box;
  padding: 0 8px;
  text-align: center;
  font-family: "Borel", "Brush Script MT", cursive;
  font-weight: 700;
  font-size: 10px;
  line-height: 1.05;
  color: var(--ink);
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  transform: translate(-50%, -50%) rotate(-5deg);
  transform-origin: center;
  pointer-events: none;
}

.month-day.current-day .month-note {
  color: var(--background);
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  flex: 1;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.month-column {
  display: grid;
  grid-template-rows: auto repeat(31, minmax(0, 1fr));
  border-right: 2px solid var(--line);
  min-height: 0;
}

.month-column:last-child {
  border-right: 0;
}

.month-title {
  margin: 0;
  padding: 6px;
  text-align: left;
  border-bottom: 2px solid var(--line);
  font-size: 12px;
}

.year-day {
  position: relative;
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: 0;
  border: 0;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  padding: 4px 4px 0 6px;
  background: var(--card);
  text-align: left;
  overflow: hidden;
}

.month-column.month-31 .year-day:last-child {
  border-bottom: 0;
}

.year-day:hover {
  transform: none;
}

.month-day:focus-visible,
.year-day:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 2px var(--bg),
    inset 0 0 0 4px var(--ink);
}

.year-day.empty {
  pointer-events: none;
}

.year-day.filler {
  visibility: hidden;
  pointer-events: none;
}

.day-label {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.dot-layer {
  position: absolute;
  inset: 0;
}

.day-note {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  box-sizing: border-box;
  padding: 0 8px;
  text-align: center;
  font-family: "Borel", "Brush Script MT", cursive;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.05;
  color: var(--ink);
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  transform: translate(-50%, -50%) rotate(-5deg);
  transform-origin: center;
  pointer-events: none;
}

.year-day.current-day .day-note {
  color: var(--background);
}

.dot-sticker {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 0;
  box-shadow: none;
  cursor: move;
  touch-action: none;
}

.popover {
  position: fixed;
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  box-shadow: none;
  padding: 6px;
  z-index: 20;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 180ms ease;
}

.popover-date {
  margin: 6px 8px 4px;
  font-size: 20px;
  line-height: 1.05;
}

.popover-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 18;
}

.popover-scrim.visible {
  opacity: 1;
  pointer-events: auto;
}

.popover-scrim.hidden {
  display: none;
}

.popover.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.popover.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.22);
  z-index: 30;
}

.menu-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 900;
}

#mobile-menu-portal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

#mobile-menu-portal .dot-actions-menu {
  pointer-events: auto;
}

.menu-scrim.visible {
  opacity: 1;
  pointer-events: auto;
}

.menu-scrim.hidden {
  display: none;
}

#settings-modal {
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

#settings-modal .modal-card {
  transform: translateY(24px);
  opacity: 0;
  transition:
    transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 280ms ease;
}

#settings-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

#settings-modal.visible .modal-card {
  transform: translateY(0);
  opacity: 1;
}

#delete-modal {
  z-index: 40;
}

#delete-modal .modal-card {
  text-align: center;
  width: min(360px, calc(100vw - 48px));
  border-radius: 24px;
  border: 2px solid var(--line);
}

#delete-modal .modal-actions {
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(420px, calc(100vw - 24px));
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 40px;
  padding: 32px;
}

#onboarding-modal .modal-card {
  width: min(720px, calc(100vw - 24px));
  height: 660px;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
}

#onboarding-modal {
  background: rgba(0, 0, 0, 0.22);
}

.onboarding-card {
  display: grid;
  gap: 16px;
  min-height: 520px;
  max-width: 100%;
}

.onboarding-steps-list {
  margin: 0;
  margin-left: 0;
  padding-left: 0;
  list-style-position: inside;
  display: grid;
  gap: 10px;
  font-size: 22px;
  line-height: 1.3;
}

.onboarding-demo {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  margin-top: 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
}

.onboarding-demo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: center;
  text-align: center;
}

.demo-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1;
}

.demo-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.onboarding-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.onboarding-split-left {
  display: grid;
  gap: 12px;
}

.onboarding-split-right {
  gap: 12px;
  justify-content: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0 24px;
}

.onboarding-sync-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 4px 0;
}

.onboarding-sync-graphic {
  --sync-red: #ff0000;
  --sync-yellow: #ffc700;
  --sync-green: #15c771;
  --sync-blue: #2f8cfa;
  --sync-purple: #b632cc;
  position: relative;
  min-height: 150px;
  border: 0;
  border-radius: 18px;
  padding: 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 88%, var(--background) 12%);
}

.sync-device {
  border: 0;
  background: transparent;
  position: relative;
}

.sync-laptop {
  width: 128px;
}

.sync-laptop .sync-screen {
  border: 2px solid var(--line);
  border-radius: 8px;
  min-height: 78px;
  position: relative;
  overflow: hidden;
  background: var(--background);
}

.sync-laptop .sync-base {
  width: calc(100% + 12px);
  margin-left: -6px;
  height: 12px;
  margin-top: -2px;
  border: 2px solid var(--line);
  border-radius: 0 0 6px 6px;
  background: var(--card);
}

.sync-phone {
  width: 72px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--background);
  height: 122px;
  padding: 8px 7px 16px;
  overflow: hidden;
}

.sync-phone .sync-screen {
  border: 0;
  border-radius: 0;
  min-height: 100%;
  position: relative;
  overflow: hidden;
  background: transparent;
}

.sync-home-indicator {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 6px;
  height: 0;
  border-top: 2px solid var(--line);
  background: transparent;
}

.sync-dot {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  left: var(--x1);
  top: var(--y1);
  animation: sync-device-dot 5.4s ease-in-out infinite;
}

.sync-dot-red {
  background: var(--sync-red);
}

.sync-dot-yellow {
  background: var(--sync-yellow);
}

.sync-dot-green {
  background: var(--sync-green);
}

.sync-dot-blue {
  background: var(--sync-blue);
}

.sync-dot-purple {
  background: var(--sync-purple);
}

.sync-screen .sync-dot:nth-child(1) {
  --x1: 20%;
  --y1: 56%;
  --x2: 28%;
  --y2: 34%;
  animation-delay: 0s;
}

.sync-screen .sync-dot:nth-child(2) {
  --x1: 38%;
  --y1: 36%;
  --x2: 50%;
  --y2: 58%;
  animation-delay: -1s;
}

.sync-screen .sync-dot:nth-child(3) {
  --x1: 52%;
  --y1: 58%;
  --x2: 42%;
  --y2: 46%;
  animation-delay: -1.8s;
}

.sync-screen .sync-dot:nth-child(4) {
  --x1: 64%;
  --y1: 42%;
  --x2: 58%;
  --y2: 66%;
  animation-delay: -2.6s;
}

.sync-screen .sync-dot:nth-child(5) {
  --x1: 70%;
  --y1: 64%;
  --x2: 64%;
  --y2: 38%;
  animation-delay: -3.2s;
}

.sync-transfer {
  position: relative;
  min-width: 0;
  height: 100%;
}

.sync-travel-dot {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(-50%);
  animation: sync-flow 4.8s linear infinite;
}

.sync-travel-dot:nth-child(1) {
  top: 24%;
  animation-delay: 0s;
}

.sync-travel-dot:nth-child(2) {
  top: 42%;
  animation-delay: 0.7s;
  animation-name: sync-flow-reverse;
}

.sync-travel-dot:nth-child(3) {
  top: 60%;
  animation-delay: 1.3s;
}

.sync-travel-dot:nth-child(4) {
  top: 76%;
  animation-delay: 2.1s;
  animation-name: sync-flow-reverse;
}

.sync-note-chip {
  position: absolute;
  left: -20%;
  opacity: 0;
  font-family: "Borel", "Brush Script MT", cursive;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  color: var(--ink);
  background: transparent;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: sync-flow-chip 18s linear infinite;
}

.sync-note-chip:nth-child(5) {
  top: 14%;
  animation-delay: 0.5s;
}

.sync-note-chip:nth-child(6) {
  top: 30%;
  animation-delay: 2.5s;
  animation-name: sync-flow-chip-reverse;
}

.sync-note-chip:nth-child(7) {
  top: 70%;
  animation-delay: 4.5s;
}

.sync-note-chip:nth-child(8) {
  top: 54%;
  animation-delay: 6.5s;
  animation-name: sync-flow-chip-reverse;
}

.sync-note-chip:nth-child(9) {
  top: 22%;
  animation-delay: 8.5s;
}

.sync-note-chip:nth-child(10) {
  top: 80%;
  animation-delay: 10.5s;
  animation-name: sync-flow-chip-reverse;
}

.sync-note-chip:nth-child(11) {
  top: 42%;
  animation-delay: 12.5s;
}

.sync-note-chip:nth-child(12) {
  top: 62%;
  animation-delay: 14.5s;
  animation-name: sync-flow-chip-reverse;
}

.sync-note-chip:nth-child(13) {
  top: 8%;
  animation-delay: 16.5s;
}

@keyframes sync-flow {
  0% {
    left: 2%;
    opacity: 0;
  }
  22% {
    opacity: 1;
  }
  42% {
    opacity: 1;
  }
  55% {
    opacity: 0;
  }
  100% {
    left: 95%;
    opacity: 0;
  }
}

@keyframes sync-flow-reverse {
  0% {
    left: 95%;
    opacity: 0;
  }
  22% {
    opacity: 1;
  }
  42% {
    opacity: 1;
  }
  55% {
    opacity: 0;
  }
  100% {
    left: 2%;
    opacity: 0;
  }
}

@keyframes sync-flow-chip {
  0% {
    left: -24%;
    opacity: 0;
    transform: translateY(0) rotate(-3deg);
  }
  24% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  36% {
    opacity: 1;
  }
  44% {
    opacity: 0;
  }
  50% {
    transform: translateY(-1px) rotate(2deg);
  }
  100% {
    left: 88%;
    opacity: 0;
    transform: translateY(0) rotate(3deg);
  }
}

@keyframes sync-flow-chip-reverse {
  0% {
    left: 92%;
    opacity: 0;
    transform: translateY(0) rotate(3deg);
  }
  24% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  36% {
    opacity: 1;
  }
  44% {
    opacity: 0;
  }
  50% {
    transform: translateY(-1px) rotate(-2deg);
  }
  100% {
    left: -24%;
    opacity: 0;
    transform: translateY(0) rotate(-3deg);
  }
}

@keyframes sync-device-dot {
  0% {
    left: var(--x1);
    top: var(--y1);
    transform: scale(1);
  }
  50% {
    left: var(--x2);
    top: var(--y2);
    transform: scale(1.06);
  }
  100% {
    left: var(--x1);
    top: var(--y1);
    transform: scale(1);
  }
}

.onboarding-sync-panel h2 {
  margin: 0;
}

.onboarding-auth-row {
  margin-top: 0;
}

.demo-day {
  position: relative;
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  min-height: 124px;
  padding: 8px;
  background: transparent;
}

.demo-day:nth-child(7n) {
  border-right: 0;
}

.demo-day:nth-last-child(-n + 7) {
  border-bottom: 0;
}

.demo-day-label {
  font-size: 12px;
}

.demo-dot {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 999px;
}

.demo-dot.red,
.demo-legend-swatch.red {
  background: #ff0000;
}
.demo-dot.yellow,
.demo-legend-swatch.yellow {
  background: #ffc700;
}
.demo-dot.green,
.demo-legend-swatch.green {
  background: #15c771;
}
.demo-dot.blue,
.demo-legend-swatch.blue {
  background: #2f8cfa;
}
.demo-dot.purple,
.demo-legend-swatch.purple {
  background: #b632cc;
}
.demo-dot.brown,
.demo-legend-swatch.brown {
  background: #875436;
}

.demo-note {
  position: absolute;
  left: 50%;
  top: 70%;
  transform: translate(-50%, -50%) rotate(-5deg);
  font-family: "Borel", "Brush Script MT", cursive;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  width: 100%;
  padding: 0 6px;
}

.demo-popover {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  width: 220px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  padding: 6px;
  display: grid;
  gap: 6px;
}

.demo-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  padding: 6px;
}

.demo-popover-note {
  border-top: 2px solid var(--line);
  padding-top: 6px;
  font-size: 12px;
}

@media (max-width: 680px) {
  .onboarding-demo {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    overflow: hidden;
  }
  .demo-day {
    min-height: 102px;
  }
  .demo-note {
    font-size: 11px;
  }
  .onboarding-steps-list {
    font-size: 18px;
  }
  .onboarding-demo-legend {
    justify-content: flex-start;
  }
  .demo-legend-item {
    font-size: 11px;
  }
  .demo-popover {
    left: 12px;
    right: 12px;
  }

  .onboarding-split {
    grid-template-columns: 1fr;
  }

  .onboarding-sync-graphic {
    min-height: 132px;
    padding: 10px;
    gap: 8px;
  }

  .sync-laptop {
    width: 106px;
  }

  .sync-laptop .sync-screen {
    min-height: 62px;
  }

  .sync-laptop .sync-base {
    height: 10px;
  }

  .sync-phone {
    width: 62px;
    height: 104px;
    padding: 7px 6px 14px;
  }

  .sync-phone .sync-screen {
    min-height: 100%;
  }

  .sync-note-chip {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sync-dot,
  .sync-travel-dot,
  .sync-note-chip {
    animation: none;
    opacity: 1;
  }

  .sync-note-chip {
    left: 20%;
  }

  .sync-travel-dot:nth-child(1) {
    left: 16%;
  }

  .sync-travel-dot:nth-child(2) {
    left: 38%;
  }

  .sync-travel-dot:nth-child(3) {
    left: 62%;
  }

  .sync-travel-dot:nth-child(4) {
    left: 82%;
  }
}

.onboarding-dots {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.onboarding-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: transparent;
}

.onboarding-dot.active {
  background: var(--ink);
}

.onboarding-step.hidden {
  display: none;
}

#onboarding-modal .onboarding-step {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 360px;
  max-width: 100%;
  min-width: 0;
}

.onboarding-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  align-items: center;
}

#onboarding-modal .onboarding-actions,
#onboarding-modal .modal-actions {
  margin-top: auto;
}

#onboarding-modal .onboarding-actions .onboarding-dots {
  margin: 0 auto;
}

#onboarding-modal .centered-actions {
  justify-content: center;
}

#onboarding-modal .onboarding-step[data-step="dots"] h2:first-of-type {
  margin-top: 0;
}

.settings-card {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  text-align: left;
  position: relative;
}

.settings-back {
  border: 2px solid var(--line);
  background: transparent;
  padding: 8px 12px;
  margin-bottom: 16px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 8px;
}

.settings-back svg path {
  stroke: currentColor;
}

.settings-card .dot-type-list,
.settings-card .suggested-dot-list {
  justify-content: flex-start;
}

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

.modal-card h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.modal-card p {
  margin: 8px 0;
}

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

.popover-item {
  width: 100%;
  display: grid;
  grid-template-columns: 16px 1fr;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  text-align: left;
  padding: 8px;
  background: transparent;
}

.popover-item:hover {
  background: var(--foreground);
  color: var(--background);
  transform: none;
}

.popover-item.selected {
  background: var(--foreground);
  color: var(--background);
}

.popover-note {
  margin-top: 6px;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.popover-note-row {
  display: flex;
  gap: 6px;
}

.popover-note-row input {
  flex: 1;
  width: 100px;
  overflow: visible;
  border-radius: 0;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: "Borel", "Brush Script MT", cursive;
  font-size: 14px;
  outline: none;
  box-shadow: none;
}

.note-edit-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.note-editor {
  outline: none;
  border: 0;
  background: transparent;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  transform-origin: center;
  color: inherit;
  caret-color: currentColor;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 32px);
  opacity: 0;
  background: var(--foreground);
  color: var(--background);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 12px;
  max-width: min(calc(100vw - 24px), 520px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 80;
  transition:
    transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 280ms ease;
}

html[data-theme="dark"] .year-caret path,
html[data-theme="dark"] #open-settings svg path,
html[data-theme="dark"] #open-settings svg circle {
  stroke: var(--foreground);
}
html[data-theme="dark"] .dot-actions-item:disabled:hover {
  background: #222;
}

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

/* ── Mobile: <= 920px ─────────────────────────────────────── */
@media (max-width: 920px) {
  .calendar-area {
    overflow-x: visible;
    overflow-y: hidden;
    padding: 0 8px 8px;
  }

  /* Topbar: switch from absolute-positioned items to a proper flex row */
  .topbar {
    justify-content: space-between;
    padding: 8px 10px;
    gap: 6px;
  }

  .brand-link {
    position: static;
    transform: none;
    font-size: 16px;
    min-height: 34px;
    padding: 4px 8px;
    flex-shrink: 0;
  }

  .period-picker {
    flex: 0 1 auto;
    min-width: 0;
    justify-content: flex-start;
  }

  #period-picker-toggle {
    min-height: 34px;
    padding: 4px 8px;
    gap: 6px;
    font-size: 16px;
  }

  .view-nav {
    position: static;
    transform: none;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
  }

  /* Hide "Settings" text label, keep icon */
  .view-nav .icon-button .icon-button-label {
    font-size: 14px;
  }

  .today-button {
    padding: 4px 8px;
    font-size: 13px;
  }

  .icon-button {
    min-height: 34px;
    padding: 4px 8px;
    gap: 5px;
  }

  /* Month grid: tighter gap, better cell sizing */
  .month-grid:not(.month-scroll-list) {
    gap: 0;
    border: 2px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
  }

  .month-grid.month-scroll-list {
    gap: 0;
    border: 0;
    border-radius: 0;
    overflow-y: auto;
    height: 100%;
    grid-auto-rows: 100%;
  }

  .month-day {
    min-height: 0;
    border-radius: 0;
    border: 0;
    border-right: 2px solid var(--line);
    border-bottom: 2px solid var(--line);
    padding: 3px 3px 0 4px;
  }

  .month-day:nth-child(7n) {
    border-right: 0;
  }

  .month-day:nth-last-child(-n + 7) {
    border-bottom: 0;
  }

  .month-scroll-section {
    min-height: 100%;
    margin: 0;
  }

  .month-day-label {
    font-size: 11px;
  }

  /* Dot stickers: slightly larger for touch */
  .dot-sticker {
    width: 18px;
    height: 18px;
  }

  /* Settings modal: wider, tighter padding */
  .settings-card {
    width: min(760px, calc(100vw - 16px));
    max-height: calc(100vh - 16px);
    border-radius: 24px;
    padding: 20px;
  }

  .modal-card {
    width: min(420px, calc(100vw - 16px));
    border-radius: 24px;
    padding: 24px;
  }

  /* Period picker menu */
  .period-picker-menu {
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    min-width: 160px;
  }

  .period-picker-menu.visible {
    transform: translateX(-50%) translateY(0);
  }

  /* Toast: slightly larger text for readability */
  .toast {
    font-size: 13px;
    padding: 10px 16px;
  }
}

/* ── Small mobile: <= 480px ──────────────────────────────── */
@media (max-width: 480px) {
  .topbar {
    padding: 8px 10px;
  }

  .brand-link {
    font-size: 14px;
  }

  #period-picker-toggle {
    font-size: 15px;
  }

  .today-button {
    padding: 4px 9px;
    font-size: 12px;
  }

  .calendar-area {
    padding: 0 4px 4px;
    overflow-y: hidden;
  }

  .month-grid:not(.month-scroll-list) {
    gap: 0;
    border: 2px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
  }

  .month-grid.month-scroll-list {
    gap: 0;
    border: 0;
    border-radius: 0;
    overflow-y: auto;
    height: 100%;
    grid-auto-rows: 100%;
  }

  .month-day {
    border-radius: 0;
    border: 0;
    border-right: 2px solid var(--line);
    border-bottom: 2px solid var(--line);
    padding: 2px 2px 0 3px;
  }

  .month-day:nth-child(7n) {
    border-right: 0;
  }

  .month-day:nth-last-child(-n + 7) {
    border-bottom: 0;
  }

  .month-day-label {
    font-size: 10px;
  }

  .month-note {
    font-size: 9px;
  }

  .marketing-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .marketing-actions button {
    width: 100%;
  }

  .feature-list {
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .feature-divider {
    display: block;
    border: 0;
    border-top: 4px dotted var(--line);
    margin: 20px -24px;
    width: calc(100% + 48px);
    grid-column: 1 / -1;
  }

  .auth-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .auth-row input,
  .auth-row button {
    width: 100%;
  }

  .auth-row button {
    width: 100%;
  }

  .settings-back {
    display: inline-flex;
    width: 100%;
    justify-content: center;
  }

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

  #reset-onboarding {
    width: 100%;
  }

  .note-edit-button {
    width: 100%;
  }

  .period-picker-item,
  .dot-actions-item {
    width: 100%;
  }

  .marketing-sections {
    grid-template-columns: 1fr;
  }

  /* Popover: full width bottom sheet */
  .popover {
    left: 0 !important;
    right: 0;
    bottom: env(safe-area-inset-bottom, 0px) !important;
    top: auto !important;
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .popover.visible {
    transform: translateY(0);
  }

  .period-picker-menu,
  .dot-actions-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: env(safe-area-inset-bottom, 0px);
    top: auto;
    width: 100%;
    max-width: none;
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    z-index: 1000;
  }

  .color-picker {
    position: fixed;
    left: 0;
    right: 0;
    bottom: env(safe-area-inset-bottom, 0px);
    top: auto;
    width: 100%;
    max-width: none;
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    z-index: 1000;
    padding-bottom: 20px;
  }

  .period-picker-menu.visible,
  .dot-actions-menu.visible {
    transform: translateY(0);
  }

  /* Settings modal: nearly full screen */
  .settings-card {
    width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    padding: 16px;
  }

  .modal-card {
    width: 100vw;
    border: 0;
    border-radius: 0;
    padding: 20px;
  }

  #delete-modal .modal-card {
    width: calc(100vw - 48px);
    border-radius: 24px;
    border: 2px solid var(--line);
  }

  #settings-modal .modal-card {
    transform: translateY(100%);
  }

  #settings-modal.visible .modal-card {
    transform: translateY(0);
  }

  #onboarding-modal .modal-card {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    max-width: 100vw;
    border-radius: 0;
    border: 2px solid var(--line);
  }

  .onboarding-card {
    min-height: 100%;
  }

  .onboarding-demo {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-radius: 10px;
  }

  .demo-day {
    min-height: 94px;
    padding: 6px;
  }

  .demo-day-label {
    font-size: 11px;
  }

  .demo-dot {
    width: 13px;
    height: 13px;
  }

  .demo-note {
    font-size: 10px;
  }

  .onboarding-demo-legend {
    gap: 6px 10px;
  }

  .demo-legend-item {
    font-size: 10px;
    gap: 5px;
  }

  .demo-legend-swatch {
    width: 9px;
    height: 9px;
  }

  .onboarding-steps-list {
    font-size: 16px;
    gap: 8px;
  }

  .settings-section h4 {
    font-size: 20px;
  }

  .settings-section h5 {
    font-size: 20px;
  }

  /* Data action rows: stack vertically */
  .data-action-row {
    grid-template-columns: 1fr;
  }

  .data-action-row button {
    justify-self: start;
  }

  /* Display row: stack on very narrow screens */
  .display-row {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: start;
  }

  .color-mode-toggle {
    justify-self: start;
  }

  .settings-card hr {
    margin: 20px 0;
  }

  .dot-type-list {
    gap: 6px;
  }

  .suggested-dot-list {
    gap: 6px;
  }
}

/* ── Extra small: <= 360px ───────────────────────────────── */
@media (max-width: 360px) {
  .brand-link {
    font-size: 13px;
  }

  #period-picker-toggle {
    font-size: 14px;
    gap: 4px;
  }

  .month-grid.month-scroll-list {
    gap: 0;
  }

  .month-grid:not(.month-scroll-list) {
    gap: 2px;
  }

  .month-day {
    padding: 1px 1px 0 2px;
  }

  .month-day-label {
    font-size: 9px;
  }

  .dot-sticker {
    width: 14px;
    height: 14px;
  }

  .settings-card {
    padding: 12px;
  }
}
