:root {
  --bg: oklch(0.985 0.002 95);
  --bg-subtle: oklch(0.965 0.003 95);
  --text: oklch(0.235 0.005 95);
  --text-secondary: oklch(0.5 0.008 95);
  --text-faint: oklch(0.66 0.008 95);
  --hairline: oklch(0.9 0.004 95);
  --link-underline: oklch(0.8 0.006 95);
  --tomato: oklch(0.58 0.17 31);
  --tomato-bg: oklch(0.94 0.055 31);
  --tomato-soft: oklch(0.88 0.08 31);
  --forest: oklch(0.47 0.095 145);
  --forest-bg: oklch(0.94 0.045 145);
  --forest-soft: oklch(0.86 0.07 145);
  --drop-line: oklch(0.58 0.18 250);
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Helvetica, "Apple Color Emoji", "Noto Sans Arabic", "Noto Sans Hebrew", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --p1: oklch(0.52 0.1 250);
  --p1-bg: oklch(0.952 0.022 250);
  --p2: oklch(0.52 0.1 155);
  --p2-bg: oklch(0.952 0.022 155);
  --p3: oklch(0.52 0.1 75);
  --p3-bg: oklch(0.952 0.022 75);
  --p4: oklch(0.52 0.1 30);
  --p4-bg: oklch(0.952 0.022 30);
  --p5: oklch(0.52 0.1 310);
  --p5-bg: oklch(0.952 0.022 310);
  --p6: oklch(0.52 0.1 205);
  --p6-bg: oklch(0.952 0.022 205);
  --toast-bg: oklch(0.235 0.005 95);
  --toast-text: oklch(0.92 0.003 95);
  --toast-secondary: oklch(0.76 0.006 95);
  --toast-border: oklch(0.34 0.006 95);
  --toast-action-bg: oklch(0.3 0.006 95);
  --z-toast: 10000;
  --week-chip-bg: color-mix(in oklch, var(--text) 9%, var(--bg-subtle));
  --week-chip-color: var(--text-secondary);
  --week-chip-active-bg: oklch(0.18 0.004 95);
  --week-chip-active-color: oklch(0.985 0.002 95);
  --week-chip-active-range: oklch(0.82 0.004 95);
}

html[data-theme="dark"] {
  --bg: oklch(0.205 0.004 95);
  --bg-subtle: oklch(0.24 0.005 95);
  --text: oklch(0.92 0.003 95);
  --text-secondary: oklch(0.68 0.006 95);
  --text-faint: oklch(0.54 0.006 95);
  --hairline: oklch(0.31 0.005 95);
  --link-underline: oklch(0.42 0.006 95);
  --tomato: oklch(0.72 0.16 31);
  --tomato-bg: oklch(0.27 0.065 31);
  --tomato-soft: oklch(0.36 0.085 31);
  --forest: oklch(0.75 0.105 145);
  --forest-bg: oklch(0.25 0.05 145);
  --forest-soft: oklch(0.35 0.075 145);
  --drop-line: oklch(0.72 0.14 250);
  --p1: oklch(0.78 0.09 250);
  --p1-bg: oklch(0.3 0.035 250);
  --p2: oklch(0.78 0.09 155);
  --p2-bg: oklch(0.3 0.035 155);
  --p3: oklch(0.78 0.09 75);
  --p3-bg: oklch(0.3 0.035 75);
  --p4: oklch(0.78 0.09 30);
  --p4-bg: oklch(0.3 0.035 30);
  --p5: oklch(0.78 0.09 310);
  --p5-bg: oklch(0.3 0.035 310);
  --p6: oklch(0.78 0.09 205);
  --p6-bg: oklch(0.3 0.035 205);
  --toast-bg: oklch(0.94 0.003 95);
  --toast-text: oklch(0.2 0.005 95);
  --toast-secondary: oklch(0.42 0.007 95);
  --toast-border: oklch(0.82 0.005 95);
  --toast-action-bg: oklch(0.985 0.002 95);
  --week-chip-bg: color-mix(in oklch, var(--text) 10%, var(--bg-subtle));
  --week-chip-color: var(--text-secondary);
  --week-chip-active-bg: oklch(0.88 0.004 95);
  --week-chip-active-color: oklch(0.18 0.004 95);
  --week-chip-active-range: oklch(0.42 0.006 95);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: clip;
  -webkit-font-smoothing: auto;
  font-optical-sizing: auto;
  transition: background 0.25s ease, color 0.25s ease;
}

html[data-restoring-scroll] {
  background: var(--bg);
}

html[data-restoring-scroll] body {
  visibility: hidden;
}

html[data-day-entry-tab-switching],
html[data-day-entry-tab-switching] body,
html[data-day-entry-tab-switching] .week-panel {
  overflow-anchor: none;
}

.lucide-icon {
  display: block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

.top-nav-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
}

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

.mobile-nav-toggle {
  appearance: none;
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  place-items: center;
  position: relative;
}

.mobile-nav-toggle span {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 1px;
  border-radius: 1px;
  background: currentColor;
  transition: transform 0.18s ease, opacity 0.18s ease, top 0.18s ease;
}

.mobile-nav-toggle span:nth-child(1) {
  top: 12px;
}

.mobile-nav-toggle span:nth-child(2) {
  top: 17px;
}

.mobile-nav-toggle span:nth-child(3) {
  top: 22px;
}

.mobile-nav-toggle[aria-expanded="true"] span:nth-child(1) {
  top: 17px;
  transform: rotate(45deg);
}

.mobile-nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.mobile-nav-toggle[aria-expanded="true"] span:nth-child(3) {
  top: 17px;
  transform: rotate(-45deg);
}

.mobile-nav-toggle:hover,
.mobile-nav-toggle:focus {
  border-color: var(--text-faint);
  outline: 0;
}

.save-status {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: var(--z-toast);
  display: flex;
  width: min(380px, calc(100vw - 32px));
  flex-direction: column;
  gap: 8px;
  transform: translateX(-50%);
  border: 1px solid var(--toast-border);
  border-radius: 8px;
  background: var(--toast-bg);
  box-shadow: 0 18px 42px color-mix(in oklch, black 22%, transparent);
  color: var(--toast-secondary);
  font-size: 13px;
  line-height: 1.45;
  padding: 14px;
  backdrop-filter: blur(14px);
}

.save-status[hidden] {
  display: none;
}

.save-status[data-status="save-failed"],
.save-status[data-status="client-upgrade"],
.save-status[data-status="workspace-reload"] {
  border-color: var(--p4);
}

.sign-out {
  appearance: none;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 5px 9px;
  text-transform: lowercase;
}

.sign-out:hover,
.sign-out:focus {
  color: var(--text);
  border-color: var(--text-faint);
  outline: 0;
}

.sign-out[hidden] {
  display: none;
}

.sync-toast-title {
  color: var(--toast-text);
  font-size: 14px;
  font-weight: 600;
}

.sync-toast-body {
  display: block;
}

.sync-toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.sync-toast-actions button {
  appearance: none;
  border: 1px solid var(--toast-border);
  border-radius: 6px;
  background: var(--toast-action-bg);
  color: var(--toast-text);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 9px;
}

.sync-toast-actions button:hover,
.sync-toast-actions button:focus {
  border-color: var(--toast-secondary);
  outline: 0;
}

.clipboard-fallback {
  position: fixed;
  left: -9999px;
  top: 0;
}

.auth-gate {
  --auth-gutter: clamp(24px, 3vw, 48px);
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow: auto;
  padding: var(--auth-gutter);
  background: var(--bg);
}

.auth-gate[hidden] {
  display: none;
}

body[data-auth-pending] .layout,
body[data-auth-pending] #pomodoro-widget-root {
  display: none;
}

.auth-shell {
  align-items: center;
  display: grid;
  column-gap: 0;
  grid-template-columns: minmax(0, 1.3fr) minmax(420px, 1fr);
  height: calc(100svh - var(--auth-gutter) - var(--auth-gutter));
  width: 100%;
}

/* The panel is three groups — heading, actions, legal — and this single gap is
   the ONLY thing spacing them apart, so they stay evenly separated. Spacing
   *within* each group is that group's own gap; nothing here uses margins. */
.auth-panel {
  align-items: stretch;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 32px;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  max-width: 420px;
  width: 100%;
}

.auth-heading-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-kicker {
  color: var(--text);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}

.auth-heading {
  color: var(--text);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.08;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.45;
}

.auth-error {
  min-height: 20px;
  color: var(--tomato);
  font-size: 13px;
  text-align: left;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.auth-google {
  appearance: none;
  align-items: center;
  gap: 10px;
  justify-content: center;
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  min-height: 46px;
  padding: 0 18px;
}

.auth-google-icon {
  flex: 0 0 auto;
  height: 20px;
  width: 20px;
}

.auth-google:hover,
.auth-google:focus {
  border-color: var(--text-faint);
  outline: 0;
}

.auth-google:disabled {
  cursor: default;
  opacity: 0.6;
}

/* Visibility comes from an attribute the server stamps on <html> while serving
   index.html, so the button paints with the page instead of appearing a moment
   later once the bundle has parsed and asked whether Google is configured.
   Defaulting to hidden keeps an instance without Google credentials from
   advertising a sign-in it cannot complete. */
.auth-google {
  display: none;
}

:root[data-auth-google="on"] .auth-google {
  display: inline-flex;
}

/* Secondary, low-emphasis action: returning users who already set up a passkey
   sign in directly from here (one click), keeping the first view focused on the
   single primary action (Continue with Google). */
.auth-passkey-link {
  appearance: none;
  align-self: center;
  border: 0;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  text-underline-offset: 2px;
}

.auth-passkey-link:hover,
.auth-passkey-link:focus {
  color: var(--text);
  outline: 0;
  text-decoration: underline;
}

.auth-passkey-link:disabled {
  cursor: default;
  opacity: 0.6;
}

.auth-passkey-link[hidden] {
  display: none;
}

.auth-legal {
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.55;
}

.auth-legal a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-legal a:hover,
.auth-legal a:focus {
  color: var(--text);
  outline: 0;
}

.auth-art {
  align-self: stretch;
  border-radius: 8px;
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  width: 100%;
}

.auth-art img {
  display: block;
  height: 100%;
  object-fit: cover;
  object-position: center;
  width: 100%;
}

@media (max-width: 1160px) {
  .auth-gate {
    place-items: start center;
    padding: 28px 20px;
  }

  .auth-shell {
    display: grid;
    gap: 28px;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(240px, 42svh) auto;
    height: auto;
    min-height: auto;
    width: min(100%, 420px);
  }

  .auth-panel {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
    max-width: none;
    width: 100%;
  }

  .auth-heading {
    font-size: 30px;
  }

  .auth-art {
    display: block;
    grid-column: 1;
    grid-row: 1;
    min-height: 240px;
  }
}

body[data-editing-blocked] .entry-line,
body[data-editing-blocked] .metric-actual-input,
body[data-editing-blocked] .entry-code-chip,
body[data-editing-blocked] .entry-pomodoro-start-chip,
body[data-editing-blocked] .entry-pomodoro-badge,
body[data-editing-blocked] .pomodoro-history-delete,
body[data-editing-blocked] .toc-action {
  cursor: not-allowed;
}

body[data-editing-blocked] .entry-line {
  color: var(--text-secondary);
}

button,
select {
  font: inherit;
}

.layout {
  --layout-sidebar-width: 200px;
  --layout-main-width: 816px;
  --layout-gap: 64px;
  --layout-page-padding-x: 40px;
  --layout-max-width: 1160px;
  display: grid;
  grid-template-columns: var(--layout-sidebar-width) minmax(0, var(--layout-main-width));
  gap: var(--layout-gap);
  width: 100%;
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: 72px var(--layout-page-padding-x) 140px;
}

.sidebar {
  position: fixed;
  top: 72px;
  left: max(var(--layout-page-padding-x), calc((100vw - var(--layout-max-width)) / 2 + var(--layout-page-padding-x)));
  display: flex;
  width: var(--layout-sidebar-width);
  height: calc(100vh - 144px);
  min-width: 0;
  flex-direction: column;
  gap: 16px;
}

.sidebar-nav-panel {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
}

.sidebar-scroll {
  --sidebar-toggle-track: 22px;
  box-sizing: border-box;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 24px;
  margin-left: calc(var(--sidebar-toggle-track) * -1);
  overflow-y: auto;
  padding-left: var(--sidebar-toggle-track);
  scrollbar-width: thin;
}

.site-name {
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.toc,
.goal-filter,
.side-module {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
}

.sidebar-section-heading {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 6px;
  justify-content: stretch;
  margin-bottom: 0;
  position: relative;
  cursor: grab;
}

.sidebar-section-toggle {
  appearance: none;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  width: 16px;
  height: 20px;
  left: calc((var(--sidebar-toggle-track) * -1) + 3px);
  place-items: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 0;
}

.sidebar-section-toggle:hover,
.sidebar-section-toggle:focus {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.sidebar-section-chevron {
  display: block;
  width: 0;
  height: 0;
  border-top: 6px solid currentColor;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
}

.sidebar-section-toggle[aria-expanded="false"] .sidebar-section-chevron {
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid currentColor;
  border-right: 0;
}

.sidebar-section-heading .sidebar-section-title {
  align-self: center;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  grid-column: 1;
  letter-spacing: 0.08em;
  line-height: 20px;
  min-width: 0;
  padding: 0;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

.sidebar-section[data-has-page="true"] .sidebar-section-title:hover,
.sidebar-section[data-has-page="true"] .sidebar-section-title:focus {
  color: var(--text);
  outline: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sidebar-section-heading .sidebar-section-title.active {
  color: var(--text);
  outline: 0;
}

.sidebar-section:not([data-has-page="true"]) .sidebar-section-title {
  cursor: default;
}

.sidebar-section-actions {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  grid-column: 2;
  justify-content: flex-end;
  min-width: 18px;
}

.sidebar-section-actions > .toc-action,
.sidebar-section-actions > .pomodoro-settings-trigger {
  flex: 0 0 auto;
}

.sidebar-section-body {
  min-width: 0;
  width: 100%;
}

.sidebar-section[data-collapsed] .sidebar-section-body {
  display: none;
}

.toc a,
.goal-filter a,
.side-module a {
  color: var(--text-secondary);
  text-decoration: none;
}

.toc a {
  padding: 3px 0;
  font-size: 13.5px;
  transition: color 0.15s ease;
}

.toc a:hover,
.goal-filter a:hover,
.side-module a:hover {
  color: var(--text);
}

.toc-sub {
  display: flex;
  flex-direction: column;
  margin: 1px 0 4px;
  padding-left: 12px;
  border-left: 1px solid var(--hairline);
}

.toc-sub a {
  padding: 2px 0;
  color: var(--text-faint);
  font-size: 12.5px;
}

.toc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.toc-row a {
  min-width: 0;
}

.toc-row-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.toc-row:hover .toc-row-actions,
.toc-row:focus-within .toc-row-actions {
  opacity: 1;
  pointer-events: auto;
}

.toc-action {
  appearance: none;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  line-height: 1;
}

.toc-action .lucide-icon {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}

.toc-action:hover,
.toc-action:focus {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.toc-action-danger:hover,
.toc-action-danger:focus {
  color: var(--p4);
}

.filter-item {
  appearance: none;
  border: 0;
  background: transparent;
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 4px 0;
  cursor: pointer;
  text-align: left;
  transition: opacity 0.15s ease;
}

.filter-name {
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.4;
}

.filter-item:hover .filter-name,
.filter-item.active .filter-name {
  color: var(--text);
}

.filter-item.active .code {
  box-shadow: 0 0 0 1px currentColor;
}

.goal-filter.filtering .filter-item:not(.active) {
  opacity: 0.45;
}

.goal-code-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 1px;
}

.goal-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 4px;
}

.goal-code-row .filter-item {
  align-items: center;
  min-width: 0;
  width: 100%;
}

.goal-code-row .filter-item .code {
  transform: none;
}

.goal-code-row .filter-name {
  min-width: 0;
}

.goal-code-edit {
  appearance: none;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.goal-code-row:hover .goal-code-edit,
.goal-code-row:focus-within .goal-code-edit {
  opacity: 1;
  pointer-events: auto;
}

.goal-code-edit:hover,
.goal-code-edit:focus {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.goal-code-edit svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.filter-clear,
/* --- User profile (bottom of side nav) --- */

.user-profile {
  position: relative;
  flex: 0 0 auto;
}

.user-profile-trigger {
  appearance: none;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 6px 8px;
  text-align: left;
}

.user-profile-trigger:hover,
.user-profile-trigger:focus-visible,
.user-profile.open .user-profile-trigger,
.user-profile.active .user-profile-trigger {
  background: var(--bg-subtle);
  outline: 0;
}

.user-profile.active .user-profile-trigger {
  border-color: var(--hairline);
}

.user-profile-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--week-chip-bg);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.user-profile-meta {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.user-profile-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profile-caret {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid currentColor;
  color: var(--text-faint);
}

.user-profile-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 10px 30px oklch(0 0 0 / 0.16);
  padding: 6px;
  z-index: 30;
}

.user-profile-menu[hidden] {
  display: none;
}

.user-profile-menu-item {
  appearance: none;
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  padding: 8px 10px;
  text-align: left;
  text-decoration: none;
}

.user-profile-menu-item:hover,
.user-profile-menu-item:focus-visible {
  background: var(--bg-subtle);
  outline: 0;
}

.user-profile-signout {
  color: var(--tomato);
}

/* --- Settings view --- */

.settings-sections {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.settings-section {
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 18px 20px;
}

.settings-section-head {
  margin-bottom: 14px;
}

.settings-section-head h2 {
  font-size: 15px;
}

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

.settings-row + .settings-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.settings-row-label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.settings-row-title {
  color: var(--text);
  font-size: 13.5px;
}

.settings-row-hint {
  color: var(--text-faint);
  font-size: 12px;
}

.settings-row-hint[hidden] {
  display: none;
}

.settings-row-hint.error {
  color: var(--tomato);
}

.settings-name-form {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.settings-name-input {
  width: 200px;
  max-width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 7px 10px;
}

.settings-name-input:focus-visible {
  border-color: var(--text-faint);
  outline: 0;
}

.settings-name-save {
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 7px 14px;
}

.settings-name-save:hover {
  opacity: 0.88;
}

.settings-name-save:focus-visible {
  outline: 2px solid var(--drop-line);
  outline-offset: 1px;
}

.settings-name-save:disabled {
  cursor: default;
  opacity: 0.5;
}

.theme-switcher {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg-subtle);
  padding: 3px;
}

.theme-option {
  appearance: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 6px 12px;
}

.theme-option:hover {
  color: var(--text);
}

.theme-option:focus-visible {
  outline: 2px solid var(--drop-line);
  outline-offset: 1px;
}

.theme-option.selected {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.12);
}

.settings-signout {
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 6px 12px;
}

.settings-signout:hover,
.settings-signout:focus-visible {
  color: var(--tomato);
  border-color: var(--tomato);
  outline: 0;
}

.filter-clear {
  align-self: flex-start;
  margin-top: 6px;
  border: 0;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.filter-clear[hidden] {
  display: none;
}

.side-module-title {
  display: block;
}

.side-module-title.active {
  color: var(--text);
}

.sidebar-empty {
  color: var(--text-faint);
  font-size: 13px;
  padding: 2px 0;
}

.sidebar-empty-action {
  display: inline-block;
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
}

.sidebar-empty-action:hover,
.sidebar-empty-action:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: 0;
}

.sidebar-empty-action:disabled {
  color: var(--text-faint);
  cursor: default;
  text-decoration: none;
}

.metrics-list {
  list-style: none;
  margin-top: 0;
}

.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  text-decoration: none;
}

.metric-name {
  color: var(--text-secondary);
  font-size: 12.5px;
}

.metric-target {
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.pomodoro-stats {
  margin-top: 0;
}

.pomodoro-stats:empty {
  display: none;
}

.pomodoro-stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pomodoro-stats-title {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pomodoro-stats-nav {
  display: flex;
  align-items: center;
  gap: 3px;
}

.pomodoro-stats-nav-button {
  appearance: none;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  padding: 0;
}

.pomodoro-stats-nav-button svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.pomodoro-stats-today-button svg {
  width: 10px;
  height: 10px;
}

.pomodoro-stats-nav-button:not(:disabled):hover,
.pomodoro-stats-nav-button:not(:disabled):focus-visible {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.pomodoro-stats-today-button:disabled {
  color: color-mix(in oklch, var(--text-faint) 58%, transparent);
  cursor: default;
}

.pomodoro-settings-trigger {
  appearance: none;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  font-size: 13px;
  line-height: 1;
}

.pomodoro-settings-trigger svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.pomodoro-settings-trigger:hover,
.pomodoro-settings-trigger:focus {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.pomodoro-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.pomodoro-weekday {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  line-height: 1;
  text-align: center;
}

.pomodoro-heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.pomodoro-day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  background: transparent;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
  position: relative;
}

.pomodoro-day.blank {
  border-color: transparent;
  color: transparent;
}

.pomodoro-day:not(.blank):hover,
.pomodoro-day:not(.blank):focus-visible {
  border-color: color-mix(in oklch, var(--text) 32%, var(--hairline));
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--text) 7%, transparent);
  outline: 0;
  z-index: 3;
}

.pomodoro-day.today {
  font-weight: 600;
}

.pomodoro-day.today::after {
  background: currentColor;
  border-radius: 999px;
  bottom: 3px;
  content: "";
  height: 3px;
  left: 50%;
  opacity: 0.68;
  position: absolute;
  transform: translateX(-50%);
  width: 3px;
}

.pomodoro-day-tooltip {
  --pomodoro-tooltip-arrow-left: 50%;
  background: var(--bg);
  border: 1px solid color-mix(in oklch, var(--text) 12%, var(--hairline));
  border-radius: 6px;
  box-shadow: 0 10px 24px color-mix(in oklch, var(--text) 12%, transparent);
  color: var(--text);
  display: grid;
  font-family: var(--sans);
  gap: 3px 10px;
  grid-template-columns: max-content max-content;
  left: 0;
  max-width: calc(100vw - 24px);
  min-width: 188px;
  opacity: 0;
  padding: 8px 9px;
  pointer-events: none;
  position: fixed;
  text-align: left;
  top: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
  visibility: hidden;
  width: max-content;
  z-index: 10000;
}

.pomodoro-day-tooltip[data-open="true"] {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.pomodoro-day-tooltip::after {
  background: var(--bg);
  content: "";
  height: 8px;
  left: var(--pomodoro-tooltip-arrow-left);
  position: absolute;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
}

.pomodoro-day-tooltip[data-side="top"]::after {
  border-bottom: 1px solid color-mix(in oklch, var(--text) 12%, var(--hairline));
  border-right: 1px solid color-mix(in oklch, var(--text) 12%, var(--hairline));
  bottom: -5px;
}

.pomodoro-day-tooltip[data-side="bottom"]::after {
  border-left: 1px solid color-mix(in oklch, var(--text) 12%, var(--hairline));
  border-top: 1px solid color-mix(in oklch, var(--text) 12%, var(--hairline));
  top: -5px;
}

.pomodoro-day-tooltip-label {
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.2;
}

.pomodoro-day-tooltip-value {
  color: var(--text);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.pomodoro-day[data-level="1"] {
  background: color-mix(in oklch, var(--p4-bg) 65%, transparent);
  border-color: color-mix(in oklch, var(--p4) 22%, var(--hairline));
  color: var(--text);
  font-weight: 500;
}

.pomodoro-day[data-level="2"] {
  background: color-mix(in oklch, var(--p4-bg) 82%, transparent);
  border-color: color-mix(in oklch, var(--p4) 34%, var(--hairline));
  color: var(--text);
  font-weight: 500;
}

.pomodoro-day[data-level="3"] {
  background: color-mix(in oklch, var(--p4) 32%, var(--p4-bg));
  border-color: color-mix(in oklch, var(--p4) 46%, var(--hairline));
  color: var(--text);
  font-weight: 500;
}

.pomodoro-day[data-level="4"] {
  background: var(--p4);
  border-color: var(--p4);
  color: var(--bg);
  font-weight: 500;
}

.pomodoro-day.today:hover,
.pomodoro-day.today:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--text) 7%, transparent);
}

main {
  grid-column: 2;
  min-width: 0;
}

h1 {
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
}

h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
}

.lede {
  width: 100%;
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: 14px;
  text-wrap: pretty;
}

.meta {
  margin-top: 18px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
}

.anchor {
  color: inherit;
  text-decoration: none;
}

.anchor:hover::after {
  content: " #";
  color: var(--text-faint);
  font-weight: 400;
}

.code {
  flex: none;
  display: inline-grid;
  width: 28px;
  min-width: 28px;
  height: 24px;
  place-items: center;
  border-radius: 5px;
  padding: 0;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  transform: translateY(-1px);
}

.code-p1 {
  background: var(--p1-bg);
  color: var(--p1);
}

.code-p2 {
  background: var(--p2-bg);
  color: var(--p2);
}

.code-p3 {
  background: var(--p3-bg);
  color: var(--p3);
}

.code-p4 {
  background: var(--p4-bg);
  color: var(--p4);
}

.code-p5 {
  background: var(--p5-bg);
  color: var(--p5);
}

.code-p6 {
  background: var(--p6-bg);
  color: var(--p6);
}

.month-link-chip,
.entry-month-link-chip {
  flex: none;
  display: inline-grid;
  min-width: 34px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  padding: 0 7px;
  transform: translateY(-1px);
}

.entry-month-link-chip {
  appearance: none;
  cursor: pointer;
}

.entry[data-entry-kind="daily"]:not(.draft-entry) > .entry-month-link-chip {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.entry[data-entry-kind="daily"]:not(.draft-entry) > .entry-month-link-chip:active {
  cursor: grabbing;
}

.entry-month-link-chip:hover,
.entry-month-link-chip:focus {
  border-color: var(--text-faint);
  color: var(--text);
  outline: 0;
}

.month-entry-index-label {
  min-width: max-content;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.5;
  padding-left: 1px;
  text-align: left;
  transform: translateY(-1px);
}

.month-entry-index-label[data-reorderable="true"] {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.month-entry-index-label[data-reorderable="true"]:hover {
  color: var(--text-secondary);
}

.entry-month-link-chip.is-empty {
  border-style: dashed;
}

.month {
  margin-top: 24px;
}

.month-subsection-title {
  margin: 32px 0 16px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.month-subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 32px 0 16px;
}

.month-subsection-header .month-subsection-title {
  margin: 0;
}

.monthly-release-sort-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.monthly-release-sort-trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.monthly-release-sort-trigger .lucide-icon {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  pointer-events: none;
  stroke-width: 2.2;
}

.monthly-release-sort-label {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
  white-space: nowrap;
}

.monthly-release-sort-trigger:hover,
.monthly-release-sort-trigger:focus,
.monthly-release-sort-trigger[aria-expanded="true"] {
  color: var(--text-secondary);
  outline: 0;
}

.monthly-release-sort-trigger:disabled {
  cursor: default;
  opacity: 0.55;
}

.monthly-release-sort-trigger[aria-expanded="true"] .monthly-release-sort-chevron {
  transform: rotate(180deg);
}

.monthly-release-sort-menu {
  position: absolute;
  z-index: 60;
  display: grid;
  gap: 2px;
  width: min(230px, calc(100vw - 24px));
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 18px 42px color-mix(in oklch, var(--text) 12%, transparent);
  padding: 4px;
}

.monthly-release-sort-option {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  padding: 6px 8px;
  text-align: left;
  position: relative;
}

.monthly-release-sort-option:hover,
.monthly-release-sort-option:focus,
.monthly-release-sort-option[aria-checked="true"] {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.monthly-release-sort-option[aria-checked="true"]::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  z-index: 1;
  width: 68px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(90deg, transparent, var(--bg-subtle) 64%);
  pointer-events: none;
}

.monthly-release-sort-check {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  pointer-events: none;
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  color: var(--tomato);
}

.monthly-release-sort-check .lucide-icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.4;
}

.monthly-release-sort-option-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-subsection-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  width: fit-content;
}

.month-subsection-toggle:hover,
.month-subsection-toggle:focus {
  color: var(--text-secondary);
  outline: 0;
}

.month-subsection-toggle .lucide-icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
  transition: transform 0.15s ease;
}

.month-subsection-toggle.is-collapsed .lucide-icon {
  transform: rotate(-90deg);
}

.monthly-release[hidden],
.weekly-release[hidden] {
  display: none;
}

.month-sep {
  height: 1px;
  margin: 40px 0 24px;
  background: var(--hairline);
}

.week-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.week-tabs::-webkit-scrollbar {
  display: none;
}

.week-tab-list {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.week-tab {
  appearance: none;
  position: relative;
  border: 0;
  border-radius: 999px;
  background: var(--week-chip-bg);
  color: var(--week-chip-color);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 8px;
  min-height: 30px;
  padding: 4px 12px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background 0.3s ease, color 0.3s ease;
}

.week-tab:focus {
  color: var(--text);
  outline: 0;
}

.week-tab.active {
  background: var(--week-chip-active-bg);
  color: var(--week-chip-active-color);
  font-weight: 500;
}

.week-tab.active .week-tab-range {
  color: var(--week-chip-active-range);
}

.week-tab-range {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.week-back-today {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  flex: 0 0 auto;
  margin-left: auto;
  min-height: 30px;
  padding: 4px 0 4px 16px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  white-space: nowrap;
}

.week-back-today:hover,
.week-back-today:focus {
  color: var(--text);
  outline: 0;
}

.week-panel {
  margin-top: 30px;
}

.week-panel[data-day-entry-drag-stable] {
  overflow-anchor: none;
}

.week-spine {
  display: flex;
  flex-direction: column;
}

.day-group {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  column-gap: 14px;
  padding: 0 0 16px;
}

.day-group:last-child {
  padding-bottom: 0;
}

.day-group[data-empty] {
  padding-bottom: 14px;
}

.day-group::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: -12px;
  left: 3px;
  width: 1px;
  background: var(--hairline);
}

.day-group:last-child::before {
  display: none;
}

.day-marker {
  position: relative;
  z-index: 1;
  width: 7px;
  height: 7px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--hairline);
  box-shadow: 0 0 0 7px var(--bg);
}

.day-group[data-today] .day-marker {
  background: var(--tomato);
  box-shadow: none;
}

.day-content {
  min-width: 0;
}

.day-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
}

.day-group[data-empty] .day-label {
  margin-bottom: 0;
}

.day-weekday {
  color: var(--text);
}

.day-label .day-date {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.day-label .day-date::before {
  content: "·";
  margin-right: 10px;
  color: var(--text-faint);
}

.day-group[data-today] .day-weekday {
  color: var(--tomato);
}

.month-create-target {
  align-self: stretch;
  flex: 1 1 auto;
  min-width: 80px;
  cursor: text;
  outline: 0;
}

.month-create-target:focus::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.12em;
  background: var(--text-faint);
  animation: caret-blink 1s steps(1) infinite;
}

.month-create-target:focus::after {
  content: "Return to create an entry...";
  margin-left: 0;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.week-empty-note {
  margin-top: 2px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
}

.entries {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.day-content .entries {
  margin-top: 0;
}

.entries-daily {
  min-height: 22px;
}

.entries-monthly {
  display: grid;
  grid-template-columns: max-content 28px minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 8px;
}

.entries-monthly:empty {
  margin-top: 0;
}

.entries-monthly > .entry {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  column-gap: inherit;
  row-gap: 0;
}

.entry {
  display: flex;
  align-items: baseline;
  gap: 10px;
  position: relative;
  transition: opacity 0.18s ease;
}

.entry-line {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 4px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  margin: -2px -3px;
  outline: 0;
  padding: 2px 3px;
  text-wrap: pretty;
  transition: background 0.15s ease;
}

.entry[data-entry-kind="daily"] > .entry-line {
  flex: 1 1 0;
}

.entry-line:hover,
.entry:has(.entry-line:focus) .entry-line,
.entry.is-context-active > .entry-line {
  background: var(--bg-subtle);
  box-shadow: none;
}

.entry-line:empty::before {
  color: var(--text-faint);
  content: attr(data-placeholder);
}

.entry-line[data-note-placeholder]::after {
  color: var(--text-faint);
  content: " " attr(data-note-placeholder);
  pointer-events: none;
}

.entry-format-toolbar {
  position: absolute;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: color-mix(in oklch, var(--bg) 94%, var(--bg-subtle));
  box-shadow: 0 12px 32px color-mix(in oklch, black 16%, transparent);
  padding: 4px;
}

.entry-format-toolbar[hidden] {
  display: none;
}

.entry-format-toolbar-button {
  appearance: none;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
}

.entry-format-toolbar-button[hidden] {
  display: none;
}

.entry-format-toolbar-button:hover,
.entry-format-toolbar-button:focus {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.entry-format-toolbar-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.1;
}

.entry[data-merge-selected="true"] > .entry-line {
  background: var(--bg-subtle);
}

.entry-merge-flash > .entry-line {
  animation: entry-merge-flash 0.7s ease;
}

.entry-reveal-flash > .entry-line {
  animation: entry-merge-flash 1.2s ease;
}

@keyframes entry-merge-flash {
  0% {
    background: color-mix(in oklch, var(--drop-line) 28%, var(--bg-subtle));
  }
  100% {
    background: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .entry-reveal-flash > .entry-line {
    animation: none;
  }
}

.merge-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: color-mix(in oklch, var(--bg) 92%, var(--bg-subtle));
  box-shadow: 0 14px 36px color-mix(in oklch, black 18%, transparent);
  padding: 5px 6px 5px 11px;
  font-family: var(--sans);
}

.merge-toolbar[hidden] {
  display: none;
}

.merge-toolbar-count {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.merge-toolbar-button {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 7px;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 550;
}

.merge-toolbar-merge {
  background: var(--drop-line);
  color: oklch(0.99 0 0);
}

.merge-toolbar-merge:hover,
.merge-toolbar-merge:focus {
  background: color-mix(in oklch, var(--drop-line) 88%, black);
  outline: 0;
}

.merge-toolbar-button svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

@media (prefers-reduced-motion: reduce) {
  .entry-merge-flash > .entry-line {
    animation: none;
  }
}

.entry-code-chip {
  appearance: none;
  border: 0;
  cursor: pointer;
}

.entry-code-chip:hover,
.entry-code-chip:focus {
  box-shadow: 0 0 0 1px currentColor;
  outline: 0;
}

.entry-code-chip[data-reorderable="true"] {
  touch-action: none;
  user-select: none;
}

.entry[data-reordering="true"] {
  z-index: 1;
}

.entry[data-reordering="true"] .entry-line {
  background: var(--bg-subtle);
  box-shadow: 0 0 0 1px var(--text-faint);
}

body[data-entry-reordering] {
  user-select: none;
}

body[data-day-entry-dragging],
body[data-month-entry-dragging] {
  cursor: grabbing;
  user-select: none;
}

body[data-sidebar-dragging] {
  cursor: grabbing;
  user-select: none;
}

body[data-metric-dragging] {
  cursor: grabbing;
  user-select: none;
}

body[data-sidebar-dragging] .sidebar-section-heading {
  cursor: grabbing;
}

body[data-metric-dragging] .metric-card {
  cursor: grabbing;
}

body[data-day-entry-dragging] .entries-daily,
body[data-month-entry-dragging] .entries-monthly {
  position: relative;
}

body[data-metric-dragging] .metric-group-column {
  position: relative;
  outline: 1px solid transparent;
  outline-offset: 4px;
}

.entries-daily > .entry-drag-ghost {
  display: block;
  flex: 0 0 28px;
  width: 100%;
  height: 28px;
  min-height: 28px;
  margin: 2px 0;
  overflow: hidden;
  border-radius: 4px;
  background: color-mix(in oklch, var(--drop-line) 12%, transparent);
  box-shadow: none;
  opacity: 1;
  pointer-events: none;
}

.entries-daily > .entry-drag-ghost > * {
  visibility: hidden;
}

.entries-monthly > .entry-drag-ghost {
  display: block;
  grid-column: 1 / -1;
  width: 100%;
  height: 28px;
  min-height: 28px;
  margin: 2px 0;
  overflow: hidden;
  border-radius: 4px;
  background: color-mix(in oklch, var(--drop-line) 12%, transparent);
  box-shadow: none;
  opacity: 1;
  pointer-events: none;
}

.entries-monthly > .entry-drag-ghost > * {
  visibility: hidden;
}

.sidebar-section-drag-ghost {
  min-height: 28px;
  overflow: hidden;
  border-radius: 4px;
  background: color-mix(in oklch, var(--drop-line) 12%, transparent);
  box-shadow: none;
  opacity: 1;
  pointer-events: none;
}

.sidebar-section-drag-ghost > * {
  visibility: hidden;
}

.metric-card-drag-ghost {
  min-height: 260px;
  overflow: hidden;
  border: 1px dashed color-mix(in oklch, var(--drop-line) 54%, var(--hairline));
  border-radius: 8px;
  background: color-mix(in oklch, var(--drop-line) 10%, transparent);
  box-shadow: none;
  opacity: 1;
  pointer-events: none;
}

.metric-card-drag-ghost > * {
  visibility: hidden;
}

.sidebar-section-drag-active {
  opacity: 0.96;
}

.sidebar-section-drag-fallback {
  border-radius: 4px;
  background: color-mix(in oklch, var(--bg) 84%, var(--bg-subtle));
  box-shadow: 0 12px 28px color-mix(in oklch, black 14%, transparent);
}

.entries-daily[data-day-drop-target="true"]:not(:has(.entry[data-entry-kind="daily"]:not(.draft-entry)))::before {
  content: "";
  display: block;
  height: 28px;
  margin: 2px 0;
  border-radius: 4px;
  background: color-mix(in oklch, var(--drop-line) 12%, transparent);
}

.entries-monthly[data-month-drop-target="true"]:not(:has(.entry[data-entry-kind="monthly"]:not(.draft-entry)))::before {
  content: "";
  display: block;
  grid-column: 1 / -1;
  height: 28px;
  margin: 2px 0;
  border-radius: 4px;
  background: color-mix(in oklch, var(--drop-line) 12%, transparent);
}

.entry-drag-chosen .entry-line,
.entry-drag-active .entry-line {
  background: var(--bg-subtle);
}

.entry-drag-active {
  opacity: 0.96;
}

.entry-drag-fallback {
  border-radius: 4px;
  background: color-mix(in oklch, var(--bg) 84%, var(--bg-subtle));
  box-shadow: 0 12px 28px color-mix(in oklch, black 14%, transparent);
  pointer-events: none;
}

.metric-group-column[data-metric-drop-source="true"] {
  outline-color: color-mix(in oklch, var(--drop-line) 22%, transparent);
}

.metric-group-column[data-metric-drop-target="true"] {
  outline-color: var(--drop-line);
  background: color-mix(in oklch, var(--drop-line) 7%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--drop-line) 24%, transparent);
}

.metric-group-column[data-metric-drop-target="true"]:empty::before {
  border-color: color-mix(in oklch, var(--drop-line) 70%, var(--hairline));
  background: color-mix(in oklch, var(--drop-line) 9%, transparent);
  color: var(--text-secondary);
}

.metric-card-drag-chosen {
  border-color: color-mix(in oklch, var(--drop-line) 46%, var(--hairline));
}

.metric-card-drag-active {
  opacity: 0.98;
}

.entry-pomodoro-controls {
  --entry-pomodoro-chip-width: 38px;
  display: flex;
  align-items: center;
  flex: 0 0 var(--entry-pomodoro-chip-width);
  justify-content: flex-end;
  margin-left: auto;
  transform: translateY(-1px);
  transition: flex-basis 0.18s ease, width 0.18s ease;
  width: var(--entry-pomodoro-chip-width);
}

.entry[data-entry-kind="daily"] .entry-side-controls {
  align-self: stretch;
  flex: 0 0 38px;
  position: relative;
  width: 38px;
}

.entry[data-entry-kind="daily"] .entry-pomodoro-controls {
  flex: 0 0 auto;
  inset-inline-end: 0;
  inset-block-start: 50%;
  min-width: 38px;
  position: absolute;
  transform: translateY(-50%);
  width: max-content;
  z-index: 2;
}

.entry[data-entry-kind="daily"] .entry-pomodoro-chip {
  gap: 0;
  min-width: 38px;
  width: max-content;
}

.entry-side-controls {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
}

.entry-pomodoro-chip {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 28px;
  max-width: 100%;
  overflow: hidden;
  padding: 2px;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  width: 100%;
}

.entry[data-entry-kind="daily"][data-pomodoro-reveal="true"] .entry-pomodoro-chip {
  border-color: var(--hairline);
  background: color-mix(in oklch, var(--bg) 88%, var(--bg-subtle));
  gap: 4px;
  box-shadow: 0 2px 10px color-mix(in oklch, black 6%, transparent);
}

.entry-pomodoro-chip[data-pomodoro-active],
.entry-pomodoro-chip[data-pomodoro-paused] {
  overflow: visible;
}

.entry-pomodoro-start-chip {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 5px;
  height: 22px;
  justify-content: center;
  line-height: 1;
  max-width: 0;
  min-width: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  pointer-events: none;
  transition: color 0.15s ease, max-width 0.18s ease, opacity 0.12s ease;
  white-space: nowrap;
}

.entry[data-entry-kind="daily"][data-pomodoro-reveal="true"] .entry-pomodoro-start-chip {
  max-width: 78px;
  opacity: 1;
  padding: 0 4px 0 6px;
  pointer-events: auto;
}

.entry-pomodoro-start-chip:hover,
.entry-pomodoro-start-chip:focus {
  color: var(--text);
  outline: 0;
}

.entry-pomodoro-start-chip:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
  opacity: 0.5;
}

.entry-pomodoro-start-icon {
  color: var(--tomato);
  fill: var(--tomato);
  width: 12px;
  height: 12px;
  stroke-width: 0;
}

.entry-pomodoro-duration {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
}

.entry-pomodoro-chip-divider {
  color: var(--text-faint);
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.18s ease, opacity 0.12s ease;
  white-space: nowrap;
}

.entry[data-entry-kind="daily"][data-pomodoro-reveal="true"] .entry-pomodoro-chip-divider {
  max-width: 10px;
  opacity: 1;
}

.entry-pomodoro-badge {
  appearance: none;
  border: 0;
  background: var(--bg-subtle);
  border-radius: 4px;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1;
  min-width: 31px;
  padding: 3px 4px;
  text-align: center;
  white-space: nowrap;
}

.entry-pomodoro-chip .entry-pomodoro-badge {
  background: var(--bg-subtle);
  border-radius: 999px;
  color: inherit;
  flex: 0 0 auto;
  height: 22px;
  min-width: 36px;
  padding: 0 8px;
  position: relative;
  z-index: 1;
}

.entry-pomodoro-chip[data-pomodoro-active] .entry-pomodoro-badge,
.entry-pomodoro-chip[data-pomodoro-paused] .entry-pomodoro-badge {
  background: color-mix(in oklch, var(--tomato) 14%, transparent);
}

.entry-pomodoro-chip[data-pomodoro-active] .entry-pomodoro-badge::after,
.entry-pomodoro-chip[data-pomodoro-paused] .entry-pomodoro-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: pomodoro-sonar 2.1s ease-out infinite;
}

.entry-pomodoro-chip[data-pomodoro-paused] .entry-pomodoro-badge::after {
  animation-play-state: paused;
}

.entry-pomodoro-chip .entry-pomodoro-badge:hover,
.entry-pomodoro-chip .entry-pomodoro-badge:focus {
  background: color-mix(in oklch, var(--text) 5%, var(--bg-subtle));
}

.entry-pomodoro-chip[data-pomodoro-active] .entry-pomodoro-badge:hover,
.entry-pomodoro-chip[data-pomodoro-active] .entry-pomodoro-badge:focus,
.entry-pomodoro-chip[data-pomodoro-paused] .entry-pomodoro-badge:hover,
.entry-pomodoro-chip[data-pomodoro-paused] .entry-pomodoro-badge:focus {
  background: color-mix(in oklch, var(--tomato) 18%, transparent);
}

.entry-pomodoro-badge:hover,
.entry-pomodoro-badge:focus {
  color: inherit;
  outline: 0;
  box-shadow: none;
}

.entry[data-pomodoro-selected="true"] .entry-pomodoro-badge {
  color: inherit;
  box-shadow: none;
}

.entry[data-pomodoro-locked="true"] .entry-pomodoro-badge {
  color: inherit;
  box-shadow: none;
}

.entry-pomodoro-badge[data-readonly="true"] {
  cursor: default;
  opacity: 1;
}

.entry-pomodoro-badge[data-readonly="true"]:hover,
.entry-pomodoro-badge[data-readonly="true"]:focus {
  color: var(--text-faint);
  box-shadow: none;
}

.entry-pomodoro-badge[data-aggregated="true"] {
  cursor: pointer;
}

.entry-pomodoro-badge[data-aggregated="true"]:hover,
.entry-pomodoro-badge[data-aggregated="true"]:focus {
  background: color-mix(in oklch, var(--text) 5%, var(--bg-subtle));
  color: var(--text-secondary);
  outline: 0;
}

.month-pomodoro-breakdown {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 95;
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: color-mix(in oklch, var(--bg) 94%, var(--bg-subtle));
  box-shadow: 0 16px 40px color-mix(in oklch, black 18%, transparent);
}

.month-pomodoro-breakdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 8px 7px;
}

.month-pomodoro-breakdown-title {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.month-pomodoro-breakdown-total {
  flex: none;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.month-pomodoro-breakdown-list {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow-y: auto;
}

.month-pomodoro-breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 10px;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
}

.month-pomodoro-breakdown-row:hover,
.month-pomodoro-breakdown-row:focus {
  background: var(--bg-subtle);
  outline: 0;
}

.month-pomodoro-breakdown-date {
  grid-column: 1;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
}

.month-pomodoro-breakdown-count {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  flex: none;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.month-pomodoro-breakdown-text {
  grid-column: 1;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.month-pomodoro-breakdown-empty {
  margin: 0;
  padding: 8px;
  color: var(--text-faint);
  font-size: 13px;
}

@keyframes pomodoro-sonar {
  0% {
    box-shadow: 0 0 0 0 color-mix(in oklch, var(--tomato) 42%, transparent);
  }

  70% {
    box-shadow: 0 0 0 13px transparent;
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .entry-pomodoro-chip[data-pomodoro-active] .entry-pomodoro-badge::after,
  .entry-pomodoro-chip[data-pomodoro-paused] .entry-pomodoro-badge::after {
    animation: none;
  }
}

.code-ghost {
  background: transparent;
  border: 1px dashed var(--hairline);
  box-shadow: none;
}

.entry-code-chip.code-ghost,
.entry-month-link-chip.is-empty {
  width: 28px;
  min-width: 28px;
  height: 24px;
  border-color: var(--hairline);
  border-radius: 5px;
  background: transparent;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  opacity: 1;
  padding: 0;
}

.entry-code-chip.code-ghost:hover,
.entry-code-chip.code-ghost:focus,
.entry-month-link-chip.is-empty:hover,
.entry-month-link-chip.is-empty:focus {
  border-color: var(--text-faint);
  box-shadow: none;
  color: var(--text);
  opacity: 1;
}

.document-command-line {
  margin-top: 32px;
  opacity: 0.72;
}

.slash-menu,
.goal-menu,
.month-link-menu,
.pomodoro-history-menu,
.pomodoro-sound-menu,
.entry-context-menu {
  position: absolute;
  z-index: 20;
  display: flex;
  min-width: 190px;
  flex-direction: column;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 18px 42px color-mix(in oklch, var(--text) 12%, transparent);
  overflow: hidden;
  padding: 4px;
}

.goal-menu {
  max-height: min(360px, calc(100vh - 24px));
  min-width: 260px;
  overflow-y: auto;
}

.month-link-menu {
  gap: 4px;
  width: min(390px, calc(100vw - 24px));
  padding: 6px;
}

.pomodoro-history-menu {
  width: min(310px, calc(100vw - 24px));
  z-index: 30;
  padding: 6px 10px;
}

.pomodoro-sound-menu {
  --pomodoro-accent: var(--tomato);
  position: fixed;
  width: min(270px, calc(100vw - 24px));
  z-index: 70;
  padding: 6px;
}

.pomodoro-sound-menu[data-kind="break"] {
  --pomodoro-accent: var(--forest);
}

.pomodoro-sound-option {
  appearance: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  padding: 7px 8px;
  text-align: left;
}

.pomodoro-sound-option:hover,
.pomodoro-sound-option:focus,
.pomodoro-sound-option[data-active="true"] {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.pomodoro-sound-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pomodoro-sound-check {
  display: grid;
  place-items: center;
  color: color-mix(in oklch, var(--pomodoro-accent, var(--text)) 74%, var(--text));
}

.pomodoro-sound-check .lucide-icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.3;
}

.slash-menu button,
.goal-menu button {
  appearance: none;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  padding: 8px 10px;
  text-align: left;
}

.slash-menu button:hover,
.slash-menu button.active,
.goal-menu button:hover,
.goal-menu button.active {
  background: var(--bg-subtle);
  color: var(--text);
}

.month-link-menu-input {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  padding: 6px 7px;
  white-space: nowrap;
}

.month-link-menu-input:focus {
  border-color: var(--text-faint);
  outline: 0;
}

.month-link-menu-input:empty::before {
  color: var(--text-faint);
  content: attr(data-placeholder);
  pointer-events: none;
}

.month-link-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 1px 0 2px;
  scrollbar-width: none;
}

.month-link-tabs::-webkit-scrollbar {
  display: none;
}

.month-link-tab {
  appearance: none;
  --month-link-tab-bg: var(--bg-subtle);
  --month-link-tab-color: var(--text-secondary);
  --month-link-tab-border: color-mix(in oklch, var(--text) 8%, transparent);
  --month-link-tab-hover-bg: var(--bg-subtle);
  --month-link-tab-hover-color: var(--text);
  --month-link-tab-hover-border: color-mix(in oklch, var(--text) 18%, transparent);
  --month-link-tab-active-bg: var(--month-link-tab-bg);
  --month-link-tab-active-color: var(--text);
  --month-link-tab-active-border: color-mix(in oklch, var(--tomato) 24%, transparent);
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  width: 34px;
  max-width: 34px;
  height: 30px;
  overflow: hidden;
  border: 1px solid var(--month-link-tab-border);
  border-radius: 6px;
  background: var(--month-link-tab-bg);
  color: var(--month-link-tab-color);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  padding: 0 6px;
  text-align: center;
  white-space: nowrap;
  transition:
    background 220ms ease,
    border-color 220ms ease,
    color 220ms ease;
}

.month-link-tab:hover,
.month-link-tab:focus {
  border-color: var(--month-link-tab-hover-border);
  background: var(--month-link-tab-hover-bg);
  color: var(--month-link-tab-hover-color);
  outline: 0;
}

.month-link-tab.active {
  gap: 5px;
  width: auto;
  max-width: 170px;
  border-color: var(--month-link-tab-active-border);
  background: var(--month-link-tab-active-bg);
  color: var(--month-link-tab-active-color);
}

.month-link-tab[data-tab-value="goal"] {
  --month-link-tab-bg: var(--month-link-accent-bg);
  --month-link-tab-color: var(--month-link-accent);
  --month-link-tab-border: color-mix(in oklch, var(--month-link-accent) 12%, transparent);
  --month-link-tab-hover-bg: var(--month-link-accent-bg);
  --month-link-tab-hover-color: color-mix(in oklch, var(--month-link-accent) 86%, var(--text));
  --month-link-tab-hover-border: color-mix(in oklch, var(--month-link-accent) 26%, transparent);
  --month-link-tab-active-bg: var(--month-link-accent-bg);
  --month-link-tab-active-color: color-mix(in oklch, var(--month-link-accent) 82%, var(--text));
  --month-link-tab-active-border: color-mix(in oklch, var(--month-link-accent) 42%, transparent);
}

.month-link-tab.code-p1 {
  --month-link-accent: var(--p1);
  --month-link-accent-bg: var(--p1-bg);
}

.month-link-tab.code-p2 {
  --month-link-accent: var(--p2);
  --month-link-accent-bg: var(--p2-bg);
}

.month-link-tab.code-p3 {
  --month-link-accent: var(--p3);
  --month-link-accent-bg: var(--p3-bg);
}

.month-link-tab.code-p4 {
  --month-link-accent: var(--p4);
  --month-link-accent-bg: var(--p4-bg);
}

.month-link-tab.code-p5 {
  --month-link-accent: var(--p5);
  --month-link-accent-bg: var(--p5-bg);
}

.month-link-tab.code-p6 {
  --month-link-accent: var(--p6);
  --month-link-accent-bg: var(--p6-bg);
}

.month-link-tab[data-tab-value="all"] {
  justify-content: center;
  width: 34px;
  max-width: 34px;
  padding: 0;
}

.month-link-tab[data-tab-value="all"].active {
  width: 34px;
  max-width: 34px;
}

.month-link-tab-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 20px;
  min-width: 20px;
  height: 20px;
  place-items: center;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1;
}

.month-link-tab-label {
  min-width: 0;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  text-overflow: ellipsis;
  transition: opacity 180ms ease;
}

.month-link-tab.active .month-link-tab-label {
  max-width: 130px;
  opacity: 1;
  font-weight: 500;
}

.month-link-tab[data-tab-value="all"] .month-link-tab-label {
  max-width: 34px;
  opacity: 1;
  font-weight: 400;
}

.month-link-tab[data-tab-value="all"].active .month-link-tab-label {
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  .month-link-tab,
  .month-link-tab-label {
    transition: none;
  }
}

.month-link-menu-list {
  display: grid;
  max-height: min(320px, 52vh);
  overflow: auto;
}

.month-link-menu-item {
  appearance: none;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 6px;
  position: relative;
  text-align: left;
}

.month-link-menu .month-link-chip {
  min-width: 30px;
  height: 20px;
  border-radius: 5px;
  font-size: 12px;
  padding: 0 6px;
  transform: none;
}

.month-link-menu .code {
  min-width: 24px;
  height: 20px;
  border-radius: 5px;
  font-size: 12px;
  padding: 0 5px;
}

.month-link-menu-item:hover,
.month-link-menu-item:focus,
.month-link-menu-item.active {
  background: var(--bg-subtle);
  outline: 0;
}

.month-link-menu-item.active {
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--tomato) 38%, transparent);
}

.month-link-menu-item.active::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  z-index: 1;
  width: 68px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(90deg, transparent, var(--bg-subtle) 64%);
  pointer-events: none;
}

.month-link-menu-check {
  display: inline-grid;
  height: 16px;
  pointer-events: none;
  place-items: center;
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  z-index: 2;
  color: var(--tomato);
}

.month-link-menu-check svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}

.month-link-menu-text {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-link-menu-empty {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 6px;
}

/* --- Day entry context menu (#19) --- */

.entry-context-menu {
  position: fixed;
  min-width: 232px;
  gap: 2px;
  padding: 6px;
  overflow: visible;
}

.entry-context-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0;
}

.entry-context-section + .entry-context-section {
  margin-top: 2px;
  border-top: 1px solid var(--hairline);
  padding-top: 4px;
}

.entry-context-group-title {
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px 3px;
}

.entry-context-row {
  appearance: none;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  padding: 7px 8px;
  text-align: left;
}

.entry-context-row:hover,
.entry-context-row:focus-visible {
  background: var(--bg-subtle);
  outline: 0;
}

.entry-context-row:disabled {
  color: var(--text-faint);
  cursor: default;
}

.entry-context-row:disabled:hover {
  background: transparent;
}

.entry-context-row-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.entry-context-row-label {
  flex: 1 1 auto;
  min-width: 0;
}

.entry-context-row-detail {
  margin-left: 6px;
  color: var(--text-faint);
}

.entry-context-row-chevron {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: var(--text-faint);
}

.entry-context-row-danger,
.entry-context-row-danger .entry-context-row-icon {
  color: var(--tomato);
}

.entry-context-row-danger:hover,
.entry-context-row-danger:focus-visible {
  background: var(--tomato-bg);
}

.entry-context-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  color: var(--text-faint);
}

.entry-context-key {
  font-size: 12px;
  line-height: 1;
}

.entry-context-key-icon {
  width: 15px;
  height: 15px;
}

/* mini calendar */

.entry-cal-back {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  padding: 5px 6px;
}

.entry-cal-back:hover,
.entry-cal-back:focus-visible {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.entry-cal-back-icon {
  width: 15px;
  height: 15px;
}

.entry-cal-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 2px 6px;
}

.entry-cal-title {
  font-size: 13px;
  font-weight: 500;
}

.entry-cal-nav {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
}

.entry-cal-nav:hover,
.entry-cal-nav:focus-visible {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.entry-cal-nav svg {
  width: 16px;
  height: 16px;
}

.entry-cal-weekdays,
.entry-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.entry-cal-weekday {
  text-align: center;
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.02em;
  padding-bottom: 2px;
}

.entry-cal-blank {
  height: 30px;
}

.entry-cal-day {
  appearance: none;
  display: inline-grid;
  place-items: center;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 12.5px;
  padding: 0;
}

.entry-cal-day:hover,
.entry-cal-day:focus-visible {
  background: var(--bg-subtle);
  outline: 0;
}

.entry-cal-day.today {
  color: var(--tomato);
  font-weight: 600;
}

.entry-cal-day.selected {
  background: var(--text);
  color: var(--bg);
}

#pomodoro-widget-root:empty {
  display: none;
}

.pomodoro-widget {
  --pomodoro-accent: var(--tomato);
  --pomodoro-bg: var(--tomato-bg);
  --pomodoro-soft: var(--tomato-soft);
  position: fixed;
  right: 28px;
  bottom: 24px;
  z-index: 55;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid color-mix(in oklch, var(--pomodoro-accent) 24%, var(--hairline));
  border-radius: 8px;
  background:
    linear-gradient(
      180deg,
      color-mix(in oklch, var(--pomodoro-bg) 88%, var(--bg)) 0%,
      color-mix(in oklch, var(--pomodoro-bg) 46%, var(--bg)) 115%
    );
  box-shadow:
    0 22px 52px color-mix(in oklch, black 16%, transparent),
    0 12px 34px color-mix(in oklch, var(--pomodoro-accent) 14%, transparent),
    inset 0 1px 0 color-mix(in oklch, white 28%, transparent);
  backdrop-filter: blur(16px);
  padding: 14px;
}

.pomodoro-widget[data-mode="break"] {
  --pomodoro-accent: var(--forest);
  --pomodoro-bg: var(--forest-bg);
  --pomodoro-soft: var(--forest-soft);
}

.pomodoro-widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.pomodoro-widget[data-dragging="true"] .pomodoro-widget-head,
body[data-pomodoro-widget-dragging] {
  cursor: grabbing;
}

body[data-pomodoro-widget-dragging] {
  user-select: none;
}

.pomodoro-widget-mode {
  min-width: 0;
  color: color-mix(in oklch, var(--pomodoro-accent) 72%, var(--text-secondary));
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.pomodoro-widget-sound-trigger {
  appearance: none;
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid color-mix(in oklch, var(--pomodoro-accent) 18%, var(--hairline));
  border-radius: 6px;
  background: color-mix(in oklch, var(--bg) 72%, var(--pomodoro-bg));
  color: color-mix(in oklch, var(--pomodoro-accent) 58%, var(--text-secondary));
  cursor: pointer;
  padding: 0;
}

.pomodoro-widget-sound-trigger:hover,
.pomodoro-widget-sound-trigger:focus,
.pomodoro-widget-sound-trigger[aria-expanded="true"] {
  border-color: color-mix(in oklch, var(--pomodoro-accent) 34%, var(--text-faint));
  color: var(--text);
  outline: 0;
}

.pomodoro-widget-sound-trigger[data-muted="true"] {
  color: var(--text-faint);
}

.pomodoro-widget-sound-trigger .lucide-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.1;
}

.pomodoro-widget-time {
  color: color-mix(in oklch, var(--pomodoro-accent) 28%, var(--text));
  font-family: var(--mono);
  font-size: 30px;
  line-height: 1;
  margin-top: 10px;
}

.pomodoro-widget-target {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
  margin-top: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pomodoro-widget[data-status="breathing"] {
  --pomodoro-breath-size: 136px;
  min-height: 132px;
  overflow: hidden;
}

.pomodoro-widget[data-status="breathing"] .pomodoro-widget-head {
  position: relative;
  z-index: 2;
}

.pomodoro-breath {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

.pomodoro-breath-circle {
  position: absolute;
  top: 50%;
  right: -28px;
  width: var(--pomodoro-breath-size);
  height: var(--pomodoro-breath-size);
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(
      circle at 34% 28%,
      color-mix(in oklch, white 48%, var(--pomodoro-soft)) 0%,
      color-mix(in oklch, var(--pomodoro-soft) 84%, var(--pomodoro-accent)) 42%,
      color-mix(in oklch, var(--pomodoro-accent) 86%, var(--pomodoro-soft)) 100%
    );
  transform-origin: center;
  animation: pomodoro-breathe-circle var(--pomodoro-breathe-duration, 8000ms) ease-in-out both;
}

.pomodoro-breath-label {
  position: relative;
  z-index: 1;
  color: color-mix(in oklch, var(--pomodoro-accent) 30%, var(--text));
  font-family: var(--mono);
  font-size: 30px;
  line-height: 1.05;
  margin-top: 28px;
  padding-right: 118px;
  text-align: left;
}

@keyframes pomodoro-breathe-circle {
  0% {
    opacity: 0.72;
    transform: translateY(-50%) scale(0.48);
  }

  50% {
    opacity: 1;
    transform: translateY(-50%) scale(1.2);
  }

  100% {
    opacity: 0.78;
    transform: translateY(-50%) scale(0.52);
  }
}

.pomodoro-widget-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pomodoro-widget-actions button {
  appearance: none;
  border: 1px solid color-mix(in oklch, var(--pomodoro-accent) 16%, var(--hairline));
  border-radius: 6px;
  background: color-mix(in oklch, var(--bg) 72%, var(--pomodoro-bg));
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 9px;
}

.pomodoro-widget-actions button.primary {
  border-color: color-mix(in oklch, var(--pomodoro-accent) 58%, var(--hairline));
  background: color-mix(in oklch, var(--pomodoro-soft) 62%, var(--bg));
  color: color-mix(in oklch, var(--pomodoro-accent) 35%, var(--text));
}

.pomodoro-widget-actions button:hover,
.pomodoro-widget-actions button:focus {
  border-color: var(--text-faint);
  color: var(--text);
  outline: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in oklch, var(--bg) 58%, transparent);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.goal-code-modal {
  width: min(430px, 100%);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 24px 64px color-mix(in oklch, black 18%, transparent);
  color: var(--text);
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-head h2 {
  font-size: 18px;
  line-height: 1.3;
}

.modal-close {
  appearance: none;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  line-height: 1;
}

.modal-close .lucide-icon {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.modal-close:hover,
.modal-close:focus {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 14px;
}

.modal-field span {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal-field input,
.modal-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  padding: 9px 10px;
}

.modal-field input,
.emoji-picker-trigger {
  height: 42px;
}

.modal-field textarea {
  resize: vertical;
}

.modal-field input:focus,
.modal-field textarea:focus {
  border-color: var(--text-faint);
  outline: 0;
}

.goal-code-primary-fields {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.goal-code-primary-fields .modal-field {
  margin-top: 0;
}

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

.pomodoro-settings-grid .modal-field {
  margin-top: 0;
}

.pomodoro-settings-modal input[type="number"],
.pomodoro-settings-modal select {
  width: 100%;
}

.pomodoro-settings-modal select {
  min-height: 34px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
}

.pomodoro-settings-modal select:focus {
  border-color: var(--text-faint);
  outline: 0;
}

.pomodoro-sound-field {
  grid-column: 1 / -1;
}

.pomodoro-history-modal {
  width: min(520px, 100%);
}

.pomodoro-history-entry {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  margin: -6px 0 14px;
}

.pomodoro-history-list {
  display: grid;
  max-height: min(420px, 58vh);
  overflow: auto;
}

.pomodoro-history-list[hidden] {
  display: none;
}

.pomodoro-history-menu .pomodoro-history-list {
  max-height: min(320px, 52vh);
}

.pomodoro-history-section {
  display: grid;
  border-bottom: 1px solid var(--hairline);
  padding: 8px 0;
}

.pomodoro-history-section:last-child {
  border-bottom: 0;
}

.pomodoro-history-section-title {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  padding: 0 0 5px;
  text-transform: uppercase;
}

.pomodoro-history-section-rows {
  display: grid;
}

.pomodoro-history-section .pomodoro-history-row {
  border-bottom: 0;
  padding: 6px 0;
}

.pomodoro-history-section .pomodoro-history-row + .pomodoro-history-row {
  border-top: 1px solid var(--hairline);
}

.pomodoro-history-empty {
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.35;
  padding: 6px 0;
}

.pomodoro-manual-form {
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 2px;
  padding-bottom: 12px;
}

.pomodoro-manual-form[data-standalone="true"] {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.pomodoro-manual-form-compact {
  display: grid;
  grid-template-columns: 46px auto;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 0;
}

.pomodoro-manual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.pomodoro-manual-grid .modal-field {
  margin-top: 0;
}

.pomodoro-manual-form input {
  font-size: 13px;
  height: 38px;
  padding: 7px 8px;
}

.pomodoro-manual-form-compact input {
  width: 46px;
  height: 30px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
  padding: 4px 7px;
}

.pomodoro-manual-form-compact input:focus {
  border-color: var(--text-faint);
  outline: 0;
}

.pomodoro-manual-submit {
  appearance: none;
  border: 1px solid var(--text);
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 9px 10px;
}

.pomodoro-manual-submit:hover,
.pomodoro-manual-submit:focus {
  outline: 0;
}

.pomodoro-manual-form-compact .modal-error {
  grid-column: 1 / -1;
  margin-top: 0;
  font-size: 11px;
}

.pomodoro-manual-actions {
  margin-top: 10px;
}

.pomodoro-history-menu .pomodoro-manual-form {
  padding: 2px 0 10px;
}

.pomodoro-history-menu .pomodoro-manual-form-compact {
  padding: 0;
}

.pomodoro-history-menu .pomodoro-manual-grid {
  gap: 8px;
}

.pomodoro-history-menu .modal-actions button {
  padding: 7px 10px;
}

.pomodoro-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--hairline);
  padding: 10px 0;
}

.pomodoro-history-row:last-child {
  border-bottom: 0;
}

.pomodoro-history-add {
  appearance: none;
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  align-items: center;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 8px;
  justify-content: flex-start;
  text-align: left;
}

.pomodoro-history-add:hover,
.pomodoro-history-add:focus {
  background: var(--bg-subtle);
  outline: 0;
}

.pomodoro-history-add-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  place-items: center;
  color: var(--text-secondary);
}

.pomodoro-history-add-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.pomodoro-history-add:hover .pomodoro-history-add-icon,
.pomodoro-history-add:focus .pomodoro-history-add-icon {
  color: var(--text);
}

.pomodoro-add-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 4px 0;
}

.pomodoro-add-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

.pomodoro-history-details {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.pomodoro-history-time {
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pomodoro-history-meta {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
}

.pomodoro-history-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.pomodoro-history-label {
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1;
  padding: 3px 6px;
}

.pomodoro-history-delete {
  appearance: none;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  flex: 0 0 auto;
  display: inline-grid;
  height: 26px;
  opacity: 0;
  padding: 0;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  width: 26px;
}

.pomodoro-history-delete svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.pomodoro-history-row:hover .pomodoro-history-delete,
.pomodoro-history-row:focus-within .pomodoro-history-delete,
.pomodoro-history-modal .pomodoro-history-delete {
  opacity: 1;
}

.pomodoro-history-delete:hover,
.pomodoro-history-delete:focus {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.pomodoro-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}

.pomodoro-check input {
  accent-color: var(--p4);
}

.emoji-field {
  position: relative;
  align-items: flex-start;
}

.name-field {
  min-width: 0;
}

.emoji-picker-trigger {
  appearance: none;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: inline-grid;
  width: 42px;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}

.emoji-picker-trigger:hover,
.emoji-picker-trigger:focus {
  border-color: var(--text-faint);
  outline: 0;
}

.emoji-picker-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 2;
  width: min(352px, calc(100vw - 72px));
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 18px 48px color-mix(in oklch, black 20%, transparent);
  overflow: hidden;
}

.emoji-picker-popover[hidden] {
  display: none;
}

emoji-picker {
  width: 100%;
  height: 340px;
  --background: var(--bg);
  --border-color: transparent;
  --button-hover-background: var(--bg-subtle);
  --button-active-background: var(--bg-subtle);
  --input-border-color: var(--hairline);
  --input-font-color: var(--text);
  --input-placeholder-color: var(--text-faint);
  --indicator-color: var(--text-secondary);
  --outline-color: var(--text-faint);
  --category-emoji-size: 1rem;
  --emoji-size: 1.25rem;
  --num-columns: 8;
}

.modal-error {
  margin-top: 12px;
  color: var(--p4);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.modal-actions button {
  appearance: none;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 8px 11px;
}

.modal-actions button:hover,
.modal-actions button:focus {
  border-color: var(--text-faint);
  outline: 0;
}

.modal-delete {
  margin-right: auto;
  color: var(--p4) !important;
}

.modal-delete[hidden] {
  display: none;
}

.modal-save {
  background: var(--text) !important;
  border-color: var(--text) !important;
  color: var(--bg) !important;
}

.confirm-modal {
  width: min(360px, 100%);
}

.confirm-modal-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.confirm-modal-message {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.confirm-modal-danger {
  background: var(--tomato) !important;
  border-color: var(--tomato) !important;
  color: #fff !important;
}

.entry a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
}

/* Links in editable lines are opened via the click handler; show the hand
   cursor instead of the contenteditable text caret. */
.entry-line a {
  cursor: pointer;
}

#metric-cards {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}

.metrics-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.metric-group-add {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 8px 10px;
}

.metric-group-add svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.1;
}

.metric-group-add:hover,
.metric-group-add:focus {
  background: var(--bg-subtle);
  border-color: var(--text-faint);
  outline: 0;
}

.metric-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metric-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.metric-group-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.metric-group-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.metric-group-name-input {
  width: auto;
  min-width: 0;
  max-width: min(100%, 320px);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  padding: 4px 6px;
  transform: translateX(-6px);
  field-sizing: content;
}

.metric-group-name-input:hover,
.metric-group-name-input:focus {
  border-color: var(--hairline);
  background: var(--bg-subtle);
  outline: 0;
}

.metric-group-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, visibility 0.14s ease;
  visibility: hidden;
}

.metric-group:hover .metric-group-actions,
.metric-group:focus-within .metric-group-actions {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.metric-group-action {
  appearance: none;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
}

.metric-group-action:hover,
.metric-group-action:focus {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.metric-group-action.danger:hover,
.metric-group-action.danger:focus {
  color: var(--p4);
}

.metric-group-action svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.1;
}

.metric-group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 96px;
  border-radius: 8px;
  transition: background 0.16s ease, box-shadow 0.16s ease, outline-color 0.16s ease;
}

.metric-group-grid[data-empty="true"] {
  grid-template-columns: minmax(0, 1fr);
}

.metric-group-grid[data-empty="true"] .metric-group-column[data-metric-column="1"] {
  display: none;
}

.metric-group-column {
  display: flex;
  min-height: 96px;
  flex-direction: column;
  gap: 8px;
  border-radius: 8px;
  transition: background 0.16s ease, box-shadow 0.16s ease, outline-color 0.16s ease;
}

body[data-metric-dragging] .metric-group-column:empty::before {
  content: "Drop charts here";
  display: grid;
  min-height: 96px;
  place-items: center;
  border: 1px dashed var(--hairline);
  border-radius: 8px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
}

.goal-code-page-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 24px;
}

.goal-code-page-add {
  appearance: none;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 8px 11px;
}

.goal-code-page-add:hover,
.goal-code-page-add:focus {
  background: var(--bg-subtle);
  border-color: var(--text-faint);
  outline: 0;
}

.goal-code-page-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}

.goal-code-page-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg);
  padding: 14px 16px;
}

.goal-code-page-summary {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.goal-code-page-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.goal-code-page-name {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.goal-code-page-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.45;
}

.goal-code-page-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.goal-code-page-action {
  appearance: none;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
}

.goal-code-page-action:hover,
.goal-code-page-action:focus {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.goal-code-page-action.danger:hover,
.goal-code-page-action.danger:focus {
  color: var(--p4);
}

.goal-code-page-action svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.1;
}

.metric-card {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  width: 100%;
  padding: 16px;
  cursor: grab;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.metric-card-head {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 14px;
}

.metric-card :is(.metric-table, .metric-table *, button, a, input, textarea, select, [contenteditable]) {
  cursor: auto;
}

.metric-card :is(button, a, input, textarea, select) {
  cursor: revert;
}

body[data-editing-blocked] .metric-card {
  cursor: default;
}

.metric-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.metric-title h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  min-width: 0;
}

.metric-now {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.metric-now-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.2;
}

.metric-now-target {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

.metric-chart-wrap {
  margin-top: 8px;
}

.metric-chart {
  margin-top: 0;
  position: relative;
  width: 100%;
  aspect-ratio: 560 / 170;
}

.metric-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.metric-switch {
  display: flex;
  flex: 0 0 auto;
  grid-column: 2;
  grid-row: 1;
  gap: 2px;
  width: fit-content;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 2px;
}

.metric-switch button {
  appearance: none;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  padding: 3px 9px;
}

.metric-switch button:hover {
  color: var(--text);
}

.metric-switch button.active {
  background: var(--bg-subtle);
  color: var(--text);
}

.metric-table {
  margin-top: 16px;
}

.metric-table table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 11.5px;
}

.metric-table th {
  border-bottom: 1px solid var(--hairline);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 6px 10px;
  text-align: right;
  text-transform: uppercase;
}

.metric-table td {
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
  padding: 6px 10px;
  text-align: right;
}

.metric-table th:first-child,
.metric-table td:first-child {
  padding-left: 0;
  text-align: left;
}

.metric-table th:last-child,
.metric-table td:last-child {
  padding-right: 0;
}

.metric-table tr:last-child td {
  border-bottom: 0;
}

.metric-table td.t-month {
  color: var(--text-secondary);
}

.metric-table td.t-ref {
  color: var(--text-faint);
}

.metric-table td.t-pos {
  color: var(--p2);
}

.metric-table td.t-neg {
  color: var(--p4);
}

.metric-actual-input {
  width: 86px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: right;
}

.metric-actual-input:hover,
.metric-actual-input:focus {
  border-bottom-color: var(--text-faint);
  outline: 0;
}

.metric-actual-input::placeholder {
  color: var(--text-faint);
}

.chart-grid {
  stroke: var(--hairline);
}

.chart-label {
  position: absolute;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
}

.chart-label[data-anchor="end"] {
  transform: translate(-100%, -50%);
}

.chart-label[data-anchor="middle"] {
  transform: translate(-50%, -50%);
}

.chart-label[data-anchor="axis-y"] {
  transform: translateY(-50%);
}

.chart-ref {
  fill: none;
  stroke: var(--text-faint);
  stroke-dasharray: 4 4;
  stroke-width: 1.5;
}

.chart-actual {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.chart-dot {
  fill: var(--bg);
  stroke-width: 1.5;
}

.chart-value {
  position: absolute;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
}

.chart-value[data-anchor="start"] {
  transform: translate(0, -100%);
}

.chart-value[data-anchor="end"] {
  transform: translate(-100%, -100%);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.leg-swatch {
  display: inline-block;
  width: 14px;
}

.leg-ref {
  height: 0;
  border-top: 2px dashed var(--text-faint);
}

.leg-actual {
  height: 2px;
  margin-left: 10px;
}

.metric-empty {
  margin-top: 14px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
}

@media (max-width: 800px) {
  .save-status {
    bottom: 16px;
    order: initial;
  }

  .layout {
    --layout-page-padding-x: 24px;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    max-width: 100%;
    overflow-x: clip;
    padding: 0 24px 100px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    left: auto;
    z-index: 20;
    display: flex;
    width: calc(100% + 48px);
    max-width: none;
    min-width: 0;
    flex-direction: column;
    gap: 0;
    height: auto;
    margin: 0 -24px 24px;
    padding: max(16px, env(safe-area-inset-top)) 24px 16px;
    border-bottom: 1px solid var(--hairline);
    background: color-mix(in oklch, var(--bg) 94%, transparent);
    backdrop-filter: blur(14px);
    overflow-x: clip;
  }

  main {
    grid-column: auto;
  }

  body[data-mobile-nav-open] {
    overflow: hidden;
  }

  .sidebar.nav-open {
    height: 100svh;
  }

  .mobile-nav-toggle {
    display: grid;
    flex: 0 0 auto;
  }

  .sidebar-nav-panel {
    display: none;
  }

  .sidebar.nav-open .sidebar-nav-panel {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    gap: 24px;
    padding-top: 24px;
  }

  .sidebar-scroll {
    flex: 1 1 auto;
    gap: 24px;
    overflow-y: auto;
    padding-bottom: 4px;
  }

  .top-nav-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    width: 100%;
  }

  .top-nav-actions {
    flex: 0 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .site-name {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .settings-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .theme-switcher {
    flex-wrap: wrap;
  }

  .goal-filter {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
  }

  .goal-code-heading {
    width: 100%;
  }

  .goal-code-list {
    width: 100%;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 2px;
    min-width: 0;
  }

  .goal-code-row {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 22px;
  }

  .goal-code-edit {
    opacity: 1;
    pointer-events: auto;
  }

  .filter-item {
    width: 100%;
    min-width: 0;
    padding: 4px 0;
  }

  .toc,
  .side-module {
    min-width: 0;
    width: 100%;
  }

  .toc-heading,
  .toc-row,
  .metric-row {
    max-width: 100%;
    min-width: 0;
  }

  .toc-row a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .toc-row-actions {
    opacity: 1;
    pointer-events: auto;
  }

  .metric-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, max-content);
    gap: 12px;
    padding: 4px 0;
  }

  .metric-name,
  .metric-target {
    min-width: 0;
  }

  .metric-target {
    justify-self: end;
    overflow-wrap: anywhere;
    text-align: right;
    white-space: normal;
  }

  .entry {
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 10px;
  }

  .entry .code {
    flex: 0 0 auto;
  }

  .entry-line {
    flex: 1 1 auto;
    font-size: 16px;
    min-width: 0;
  }

  .entry-side-controls {
    gap: 6px;
  }

  .entry-month-link-chip {
    min-width: 28px;
    padding: 0 6px;
  }

  .metric-card {
    padding: 16px;
  }

  .metrics-heading-row,
  .metric-group-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-group-name-input {
    width: auto;
    max-width: min(100%, 320px);
  }

  .metric-group-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-card-head {
    column-gap: 12px;
  }

  .metric-actual-input {
    width: 70px;
  }

  .pomodoro-widget {
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
  }

  .pomodoro-settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Notes ---------- */

.notes-sidebar-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notes-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border-radius: 5px;
  padding: 3px 6px;
  /* Pull rows into the section-toggle gutter so depth-0 chevrons sit in the
     same column as the section heading's disclosure triangle. */
  margin: 0 -6px 0 calc(-1px - var(--sidebar-toggle-track));
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
}

.notes-sidebar-item .notes-item-icon {
  flex: none;
  color: var(--text-faint);
  font-size: 14px;
}

.notes-sidebar-item .notes-item-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-sidebar-item:hover,
.notes-sidebar-item.active {
  background: var(--bg-subtle);
  color: var(--text);
}

/* Notes tree (sidebar) */

.notes-tree-folder {
  cursor: pointer;
  user-select: none;
}

.notes-tree-chevron {
  flex: none;
  font-size: 12px;
  color: var(--text-faint);
  transition: transform 0.12s ease;
}

.notes-tree-chevron.is-expanded {
  transform: rotate(90deg);
}

.notes-tree-spacer {
  flex: none;
  width: 12px;
}

.notes-sidebar-item.is-dragging {
  opacity: 0.45;
}

.notes-sidebar-item {
  transition: margin-top 0.12s ease;
}

.notes-sidebar-item.notes-tree-drop-target {
  background: color-mix(in oklch, var(--tomato) 14%, transparent);
  color: var(--text);
}

/* A row-height slot opens above the insertion point while dragging; keep the
   26px in sync with NOTES_TREE_DROP_GAP in app.js. */
.notes-sidebar-item.notes-tree-gap {
  margin-top: 26px;
}

.notes-tree-drop-outline {
  position: absolute;
  /* Rows overhang the list box via negative margins; keep both vertical
     borders a couple of pixels inside the sidebar's clip region (the list's
     right edge sits flush against it). */
  left: -20px;
  right: 2px;
  z-index: 1;
  pointer-events: none;
  border: 1.5px solid color-mix(in oklch, var(--tomato) 45%, transparent);
  border-radius: 8px;
}

/* Tint band over the destination folder's row, drawn inside the outline so
   it can't bleed past the borders. */
.notes-tree-drop-outline-head {
  position: absolute;
  top: 1px;
  left: 1px;
  right: 1px;
  border-radius: 6px;
  background: color-mix(in oklch, var(--tomato) 14%, transparent);
}

#notes-sidebar-body.notes-tree-drop-root {
  border-radius: 6px;
  background: color-mix(in oklch, var(--tomato) 7%, transparent);
}

.note-actions-popover.notes-tree-context-menu {
  position: fixed;
  top: auto;
  right: auto;
  z-index: 80;
}

.notes-tree-rename-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-radius: 4px;
  background: color-mix(in oklch, var(--text) 8%, transparent);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 1px 5px;
  margin-left: -5px;
  outline: 0;
}

.notes-tree-rename-input:focus {
  box-shadow: 0 0 0 1.5px color-mix(in oklch, var(--tomato) 45%, transparent);
}

.notes-index-empty {
  margin-top: 24px;
  color: var(--text-faint);
  font-size: 14px;
}

/* Note editor */

.note-editor {
  display: block;
}

.note-editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.note-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
}

.note-breadcrumb-link {
  color: var(--text-secondary);
  text-decoration: none;
}

.note-breadcrumb-link:hover {
  color: var(--text);
}

.note-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.note-actions-menu {
  position: relative;
  flex: none;
}

.note-actions-menu-button {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0;
}

.note-actions-menu-button svg {
  width: 18px;
  height: 18px;
}

.note-actions-menu-button:hover:not(:disabled),
.note-actions-menu.is-open .note-actions-menu-button {
  background: var(--bg-subtle);
  color: var(--text);
}

.note-actions-menu-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.note-title-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.note-title-action {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0;
}

.note-title-action svg {
  width: 18px;
  height: 18px;
}

.note-title-action:hover:not(:disabled),
.note-title-action:focus-visible {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.note-title-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.note-actions-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 168px;
  padding: 5px;
  border: 1px solid var(--hairline);
  border-radius: 9px;
  background: color-mix(in oklch, var(--bg) 94%, var(--bg-subtle));
  box-shadow: 0 14px 36px color-mix(in oklch, black 16%, transparent);
}

.note-actions-popover[hidden] {
  display: none;
}

.note-actions-item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 7px 9px;
  text-align: left;
}

.note-actions-item svg {
  width: 15px;
  height: 15px;
}

.note-actions-item-danger {
  color: var(--tomato);
}

.note-actions-item:hover,
.note-actions-item:focus {
  background: color-mix(in oklch, var(--text) 7%, transparent);
  outline: 0;
}

.note-actions-item-danger:hover,
.note-actions-item-danger:focus {
  background: color-mix(in oklch, var(--tomato) 12%, transparent);
}

.note-title-input {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  outline: 0;
  padding: 0;
}

.note-title-input::placeholder {
  color: var(--text-faint);
}

.note-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
}

.note-doc-sync-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
}

.note-meta > .note-doc-sync-status {
  justify-content: flex-end;
  min-width: 0;
  margin-top: 0;
  margin-left: auto;
  text-align: right;
}

.note-edited-at {
  flex: 0 0 auto;
}

.note-doc-sync-status[hidden] {
  display: none;
}

.note-doc-sync-status[data-state="offline"],
.note-doc-sync-status[data-state="error"],
.note-doc-sync-status[data-state="blocked"] {
  color: var(--tomato);
}

.note-doc-sync-status a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.floating-note-body > .note-doc-sync-status {
  margin: 6px 0 0;
}

.note-offline-prewarm {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 720px;
  height: 600px;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
}

.note-body {
  margin-top: 22px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}

.note-body.is-editable {
  cursor: text;
}

.note-body > * {
  margin: 0;
}

.note-body > * + * {
  margin-top: 14px;
}

.note-body h2,
.note-body h3,
.note-body h4,
.note-body h5,
.note-body h6 {
  display: block;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  margin-top: 26px;
}

.note-body h2 { font-size: 18px; }
.note-body h3 { font-size: 16px; }
.note-body h4,
.note-body h5,
.note-body h6 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.note-body ul,
.note-body ol {
  padding-left: 22px;
}

.note-body li + li {
  margin-top: 4px;
}

.note-body blockquote {
  border-left: 2px solid var(--hairline);
  padding-left: 14px;
  color: var(--text-secondary);
  font-style: italic;
}

.note-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-subtle);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 1px 5px;
}

.note-body a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 2px;
}

.note-body hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: 22px 0;
}

.note-body-placeholder {
  color: var(--text-faint);
}

.note-floating-placeholder {
  margin-top: 22px;
  padding: 20px;
  border: 1px dashed var(--hairline);
  border-radius: 10px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.note-floating-placeholder-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.floating-note {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  width: min(440px, calc(100vw - 32px));
  height: min(540px, calc(100vh - 40px));
  min-width: 300px;
  min-height: 240px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 24px 60px color-mix(in oklch, black 28%, transparent);
  overflow: hidden;
}

/* While dragging/resizing, suppress the panel's inner scroll and text selection
   so the gesture stays smooth and doesn't select note text. */
.floating-note[data-dragging="true"],
.floating-note[data-resizing="true"] {
  user-select: none;
}

body[data-floating-note-dragging] {
  cursor: grabbing;
  user-select: none;
}

body[data-floating-note-resizing] {
  cursor: nwse-resize;
  user-select: none;
}

.floating-note[data-minimized="true"] {
  height: auto;
  min-height: 0;
}

.floating-note[data-minimized="true"] .floating-note-resize {
  display: none;
}

/* Collapsed bars are pinned bottom-right and can't be dragged. */
.floating-note[data-minimized="true"] .floating-note-header {
  cursor: default;
}

.floating-note[data-minimized="true"] .floating-note-body {
  display: none;
}

.floating-note-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-subtle);
  cursor: grab;
  touch-action: none;
}

.floating-note[data-dragging="true"] .floating-note-header {
  cursor: grabbing;
}

/* The title stays a normal text field — only the surrounding bar drags. */
.floating-note-title {
  cursor: text;
}

.floating-note[data-minimized="true"] .floating-note-header {
  border-bottom: 0;
}

.floating-note-title {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  outline: 0;
  padding: 2px 0;
}

.floating-note-title::placeholder {
  color: var(--text-faint);
}

.floating-note-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.floating-note-control {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0;
}

.floating-note-control:hover,
.floating-note-control:focus {
  background: color-mix(in oklch, var(--text) 8%, transparent);
  color: var(--text);
  outline: 0;
}

.floating-note-control svg {
  width: 16px;
  height: 16px;
}

.floating-note-minimize svg {
  transition: transform 0.18s ease;
}

.floating-note[data-minimized="true"] .floating-note-minimize svg {
  transform: rotate(180deg);
}

.floating-note-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 16px 16px;
}

.floating-note-body .note-markdown-editor {
  margin-top: 6px;
  min-height: 100%;
}

/* Four-directional resize grips: edges + corners. They sit above the body but
   below the interactive header controls (which are raised via z-index) so the
   title field and window buttons stay fully clickable. */
.floating-note-resize {
  position: absolute;
  touch-action: none;
  z-index: 1;
}

.floating-note-resize-n { top: 0; left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.floating-note-resize-s { bottom: 0; left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.floating-note-resize-e { right: 0; top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.floating-note-resize-w { left: 0; top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.floating-note-resize-ne { top: 0; right: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.floating-note-resize-nw { top: 0; left: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.floating-note-resize-se { bottom: 0; right: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.floating-note-resize-sw { bottom: 0; left: 0; width: 12px; height: 12px; cursor: nesw-resize; }

/* Keep the title field and window buttons above the edge/corner grips. */
.floating-note-title,
.floating-note-controls {
  position: relative;
  z-index: 2;
}

@media (max-width: 640px) {
  .floating-note {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
    height: min(70vh, 540px);
  }
}

.note-markdown-editor {
  margin-top: 22px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  min-height: 200px;
}

.note-markdown-editor[data-readonly="true"] {
  cursor: default;
}

.note-markdown-editor .milkdown {
  --crepe-color-background: transparent;
  --crepe-color-on-background: var(--text);
  --crepe-color-surface: var(--bg);
  --crepe-color-surface-low: var(--bg-subtle);
  --crepe-color-on-surface: var(--text);
  --crepe-color-on-surface-variant: var(--text-secondary);
  --crepe-color-outline: var(--text-faint);
  --crepe-color-primary: var(--text);
  --crepe-color-secondary: var(--bg-subtle);
  --crepe-color-on-secondary: var(--text);
  --crepe-color-inverse: var(--text);
  --crepe-color-on-inverse: var(--bg);
  --crepe-color-inline-code: var(--text);
  --crepe-color-error: var(--tomato);
  --crepe-color-hover: var(--bg-subtle);
  --crepe-color-selected: color-mix(in oklch, var(--text) 14%, transparent);
  --crepe-color-inline-area: var(--bg-subtle);
  --crepe-font-title: inherit;
  --crepe-font-default: inherit;
  --crepe-font-code: var(--mono);
  --crepe-shadow-1: 0 16px 40px color-mix(in oklch, black 14%, transparent);
  background: transparent;
  color: var(--text);
  font-family: inherit;
}

.note-markdown-editor .milkdown .ProseMirror {
  min-height: 200px;
  padding: 0;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* y-prosemirror presence cursors. The label and color come from the ephemeral
   awareness state; no presence data is persisted. */
.note-markdown-editor .ProseMirror-yjs-cursor {
  position: relative;
  border-left: 1px solid;
  border-right: 1px solid;
  margin-left: -1px;
  margin-right: -1px;
  pointer-events: none;
  word-break: normal;
}

.note-markdown-editor .ProseMirror-yjs-cursor > div {
  position: absolute;
  top: -1.45em;
  left: -1px;
  z-index: 20;
  border-radius: 3px 3px 3px 0;
  color: white;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  padding: 2px 4px;
  white-space: nowrap;
  user-select: none;
}

.note-markdown-editor .milkdown .milkdown-block-handle {
  display: none;
}

.note-markdown-editor .milkdown .ProseMirror > * {
  margin: 0;
}

.note-markdown-editor .milkdown .ProseMirror > :where(
  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  ul,
  ol,
  blockquote,
  pre,
  hr,
  .milkdown-list-item-block
) + :where(
  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  ul,
  ol,
  blockquote,
  pre,
  hr,
  .milkdown-list-item-block
) {
  margin-top: 14px;
}

.note-markdown-editor .milkdown .ProseMirror p {
  font-size: inherit;
  line-height: inherit;
  padding: 0;
}

.note-markdown-editor .milkdown .note-image-block {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 16px 0;
  max-width: 100%;
  min-height: 42px;
  position: relative;
}

.note-markdown-editor .milkdown .note-image-block[data-align="left"] {
  align-items: flex-start;
}

.note-markdown-editor .milkdown .note-image-block[data-align="right"] {
  align-items: flex-end;
}

.note-markdown-editor .milkdown .note-image-block.is-empty {
  align-items: stretch;
}

.note-markdown-editor .milkdown .note-image-frame {
  border-radius: 6px;
  max-width: 100%;
  min-width: min(150px, 100%);
  overflow: visible;
  position: relative;
}

.note-markdown-editor .milkdown .note-image {
  border-radius: 6px;
  display: block;
  height: auto;
  max-width: 100%;
  width: 100%;
}

.note-markdown-editor .milkdown .note-image-toolbar {
  align-items: center;
  background: color-mix(in oklch, var(--bg) 96%, var(--bg-subtle));
  border: 1px solid var(--hairline);
  border-radius: 8px;
  box-shadow: 0 12px 30px color-mix(in oklch, black 14%, transparent);
  display: flex;
  gap: 2px;
  left: 50%;
  opacity: 0;
  padding: 3px;
  pointer-events: none;
  position: absolute;
  top: -12px;
  transform: translate(-50%, -100%);
  transition: opacity 0.16s ease;
  z-index: 3;
}

.note-markdown-editor .milkdown .note-image-block:hover .note-image-toolbar,
.note-markdown-editor .milkdown .note-image-block.selected .note-image-toolbar {
  opacity: 1;
  pointer-events: auto;
}

.note-markdown-editor .milkdown .note-image-control {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  height: 26px;
  margin: 0;
  padding: 0;
  place-items: center;
  width: 26px;
}

.note-markdown-editor .milkdown .note-image-control:hover,
.note-markdown-editor .milkdown .note-image-control:focus-visible,
.note-markdown-editor .milkdown .note-image-control.active {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.note-markdown-editor .milkdown .note-image-control:disabled,
.note-markdown-editor .milkdown .note-image-resize-handle:disabled {
  cursor: default;
  opacity: 0.42;
}

.note-markdown-editor .milkdown .note-image-control svg {
  color: currentColor;
  height: 15px;
  width: 15px;
}

.note-markdown-editor .milkdown .note-image-resize-handle {
  appearance: none;
  background: color-mix(in oklch, var(--text) 78%, transparent);
  border: 2px solid var(--bg);
  border-radius: 999px;
  box-shadow: 0 4px 12px color-mix(in oklch, black 16%, transparent);
  cursor: ew-resize;
  height: 34px;
  margin: 0;
  opacity: 0;
  padding: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.16s ease;
  width: 8px;
  z-index: 2;
}

.note-markdown-editor .milkdown .note-image-resize-left {
  left: -4px;
}

.note-markdown-editor .milkdown .note-image-resize-right {
  right: -4px;
}

.note-markdown-editor .milkdown .note-image-block:hover .note-image-resize-handle,
.note-markdown-editor .milkdown .note-image-block.selected .note-image-resize-handle {
  opacity: 1;
}

.note-markdown-editor .milkdown .note-image-caption {
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.35;
  max-width: 100%;
  outline: 0;
  padding: 2px 4px 4px;
  text-align: center;
}

.note-markdown-editor .milkdown .note-image-caption:focus {
  border-bottom-color: var(--hairline);
  color: var(--text);
}

.note-markdown-editor .milkdown .note-image-caption::placeholder {
  color: var(--text-faint);
}

.note-markdown-editor .milkdown .note-image-upload {
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  min-height: 46px;
  padding: 7px 8px;
}

.note-markdown-editor .milkdown .note-image-upload-icon {
  color: var(--text-faint);
  display: inline-grid;
  height: 26px;
  place-items: center;
  width: 26px;
}

.note-markdown-editor .milkdown .note-image-upload-icon svg {
  height: 17px;
  width: 17px;
}

.note-markdown-editor .milkdown .note-image-url-input {
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  min-width: 0;
  outline: 0;
}

.note-markdown-editor .milkdown .note-image-url-input::placeholder {
  color: var(--text-faint);
}

.note-markdown-editor .milkdown .ProseMirror h1,
.note-markdown-editor .milkdown .ProseMirror h2,
.note-markdown-editor .milkdown .ProseMirror h3,
.note-markdown-editor .milkdown .ProseMirror h4,
.note-markdown-editor .milkdown .ProseMirror h5,
.note-markdown-editor .milkdown .ProseMirror h6 {
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  margin-top: 26px;
  padding: 0;
}

.note-markdown-editor .milkdown .ProseMirror h1,
.note-markdown-editor .milkdown .ProseMirror h2 {
  font-size: 18px;
}

.note-markdown-editor .milkdown .ProseMirror h3 {
  font-size: 16px;
}

.note-markdown-editor .milkdown .ProseMirror h4,
.note-markdown-editor .milkdown .ProseMirror h5,
.note-markdown-editor .milkdown .ProseMirror h6 {
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.note-markdown-editor .milkdown .ProseMirror code {
  border: 1px solid var(--hairline);
  background: var(--bg-subtle);
  border-radius: 4px;
  color: var(--text);
  display: inline;
  font-family: var(--mono);
  font-size: 0.88em;
  line-height: inherit;
  padding: 1px 5px;
}

.note-markdown-editor .milkdown .ProseMirror pre {
  border: 1px solid var(--hairline);
  background: var(--bg-subtle);
  border-radius: 6px;
  padding: 10px 12px;
}

.note-markdown-editor .milkdown .ProseMirror pre code {
  border: 0;
  background: transparent;
  display: block;
  padding: 0;
}

.note-markdown-editor .milkdown .ProseMirror blockquote {
  border-left: 2px solid var(--hairline);
  box-sizing: border-box;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
  padding: 0 0 0 14px;
}

.note-markdown-editor .milkdown .ProseMirror blockquote::before {
  display: none;
}

.note-markdown-editor .milkdown .ProseMirror a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 2px;
}

.note-markdown-editor .milkdown .ProseMirror hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  background: transparent;
  height: auto;
  margin: 22px 0;
  padding: 0;
}

.note-markdown-editor .milkdown .milkdown-list-item-block li {
  gap: 8px;
}

.note-markdown-editor .milkdown .milkdown-list-item-block li .label-wrapper {
  color: var(--text);
  height: 24px;
  width: 18px;
}

.note-markdown-editor .milkdown .milkdown-list-item-block li .label-wrapper .label {
  height: 24px;
  padding: 0;
  width: 18px;
}

.note-markdown-editor .milkdown .milkdown-toolbar,
.note-markdown-editor .milkdown .milkdown-slash-menu,
.note-markdown-editor .milkdown .milkdown-link-preview > .link-preview,
.note-markdown-editor .milkdown .milkdown-link-edit > .link-edit,
.note-markdown-editor .milkdown .milkdown-code-block .list-wrapper {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: color-mix(in oklch, var(--bg) 96%, var(--bg-subtle));
  box-shadow: 0 16px 40px color-mix(in oklch, black 14%, transparent);
  color: var(--text);
  font-family: inherit;
}

.note-markdown-editor .milkdown .milkdown-toolbar {
  align-items: center;
  gap: 2px;
  overflow: visible;
  padding: 3px;
}

.note-markdown-editor .milkdown .milkdown-toolbar .toolbar-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  height: 26px;
  margin: 0;
  padding: 0;
  place-items: center;
  width: 26px;
}

.note-markdown-editor .milkdown .milkdown-toolbar .toolbar-item:hover,
.note-markdown-editor .milkdown .milkdown-toolbar .toolbar-item:focus,
.note-markdown-editor .milkdown .milkdown-toolbar .toolbar-item.active {
  background: var(--bg-subtle);
  color: var(--text);
  outline: 0;
}

.note-markdown-editor .milkdown .milkdown-toolbar .toolbar-item svg {
  color: currentColor;
  fill: currentColor;
  height: 15px;
  width: 15px;
}

.note-markdown-editor .milkdown .milkdown-toolbar .divider {
  background: var(--hairline);
  height: 18px;
  margin: 4px 3px;
  width: 1px;
}

.note-markdown-editor .milkdown .milkdown-slash-menu {
  border-radius: 10px;
  max-width: min(340px, calc(100vw - 24px));
  min-width: 250px;
  overflow: hidden;
  padding: 0;
}

.note-markdown-editor .milkdown .milkdown-slash-menu .tab-group {
  border-bottom: 1px solid var(--hairline);
  padding: 6px 6px 0;
}

.note-markdown-editor .milkdown .milkdown-slash-menu .tab-group ul {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  overflow-x: auto;
  padding: 0 0 5px;
}

.note-markdown-editor .milkdown .milkdown-slash-menu .tab-group ul li {
  border-radius: 5px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 6px 7px;
  text-transform: uppercase;
}

.note-markdown-editor .milkdown .milkdown-slash-menu .tab-group ul li:hover,
.note-markdown-editor .milkdown .milkdown-slash-menu .tab-group ul li.selected {
  background: var(--bg-subtle);
  color: var(--text);
}

.note-markdown-editor .milkdown .milkdown-slash-menu .menu-groups {
  max-height: min(310px, 52vh);
  overflow: auto;
  padding: 4px 6px 6px;
}

.note-markdown-editor .milkdown .milkdown-slash-menu .menu-groups .menu-group h6 {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.1;
  padding: 7px 6px 4px;
  text-transform: uppercase;
}

.note-markdown-editor .milkdown .milkdown-slash-menu .menu-groups .menu-group li {
  align-items: center;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 400;
  gap: 8px;
  justify-content: flex-start;
  line-height: 1.25;
  min-height: 30px;
  min-width: 0;
  padding: 6px 7px;
}

.note-markdown-editor .milkdown .milkdown-slash-menu .menu-groups .menu-group li.hover,
.note-markdown-editor .milkdown .milkdown-slash-menu .menu-groups .menu-group li.active {
  background: var(--bg-subtle);
  color: var(--text);
}

.note-markdown-editor .milkdown .milkdown-slash-menu .menu-groups .menu-group li svg {
  color: var(--text-faint);
  fill: currentColor;
  height: 15px;
  width: 15px;
}

.note-markdown-editor .milkdown .milkdown-slash-menu .menu-groups .menu-group li > span {
  font-size: inherit;
  font-style: normal;
  font-weight: 400;
  line-height: inherit;
}

.note-markdown-editor .milkdown .milkdown-slash-menu .menu-groups .menu-group + .menu-group::before {
  background: var(--hairline);
  height: 1px;
  margin: 4px 6px;
}

.note-markdown-editor .milkdown .milkdown-link-preview,
.note-markdown-editor .milkdown .milkdown-link-edit {
  z-index: 96;
}

.note-markdown-editor .milkdown .milkdown-link-preview > .link-preview,
.note-markdown-editor .milkdown .milkdown-link-edit > .link-edit {
  align-items: center;
  gap: 4px;
  height: 30px;
  justify-content: flex-start;
  padding: 3px 5px;
}

.note-markdown-editor .milkdown .milkdown-link-edit > .link-edit {
  padding-left: 8px;
}

.note-markdown-editor .milkdown .milkdown-link-preview > .link-preview > .link-display {
  color: var(--text);
  font-size: 12px;
  line-height: 22px;
  max-width: min(220px, 48vw);
  width: auto;
}

.note-markdown-editor .milkdown .milkdown-link-edit > .link-edit > .input-area {
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  height: 22px;
  line-height: 22px;
  outline: 0;
  width: min(210px, 46vw);
}

.note-markdown-editor .milkdown .milkdown-link-preview > .link-preview > .link-icon,
.note-markdown-editor .milkdown .milkdown-link-preview > .link-preview > .button,
.note-markdown-editor .milkdown .milkdown-link-edit > .link-edit > .button {
  border-radius: 5px;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-grid;
  height: 24px;
  line-height: 1;
  padding: 0;
  place-items: center;
  width: 24px;
}

.note-markdown-editor .milkdown .milkdown-link-preview > .link-preview > .link-icon:hover,
.note-markdown-editor .milkdown .milkdown-link-preview > .link-preview > .button:hover,
.note-markdown-editor .milkdown .milkdown-link-edit > .link-edit > .button:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.note-markdown-editor .milkdown .milkdown-link-preview > .link-preview > .link-icon > svg,
.note-markdown-editor .milkdown .milkdown-link-preview > .link-preview > .button > svg,
.note-markdown-editor .milkdown .milkdown-link-edit > .link-edit > .button > svg {
  color: currentColor;
  fill: currentColor;
  height: 15px;
  width: 15px;
}

.note-markdown-editor .milkdown .milkdown-code-block {
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--bg-subtle);
  margin: 8px 0;
  padding: 8px 10px 10px;
}

.note-markdown-editor .milkdown .milkdown-code-block.selected {
  outline: 0;
  box-shadow: inset 0 0 0 1px var(--text-faint);
}

.note-markdown-editor .milkdown .milkdown-code-block .cm-editor,
.note-markdown-editor .milkdown .milkdown-code-block .cm-gutters,
.note-markdown-editor .milkdown .milkdown-code-block .cm-panel {
  background: transparent;
}

.note-markdown-editor .milkdown .milkdown-code-block .cm-editor,
.note-markdown-editor .milkdown .milkdown-code-block .milkdown-code-block-placeholder {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
}

.note-markdown-editor .milkdown .milkdown-code-block .tools {
  align-items: center;
  gap: 8px;
}

.note-markdown-editor .milkdown .milkdown-code-block .tools .language-button,
.note-markdown-editor .milkdown .milkdown-code-block .tools .tools-button-group button {
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  height: 24px;
  line-height: 1;
  opacity: 0.72;
}

.note-markdown-editor .milkdown .milkdown-code-block .tools .language-button {
  gap: 4px;
  margin-bottom: 6px;
  padding: 0 4px 0 7px;
}

.note-markdown-editor .milkdown .milkdown-code-block .tools .tools-button-group {
  gap: 3px;
}

.note-markdown-editor .milkdown .milkdown-code-block .tools .tools-button-group button {
  padding: 0 7px;
}

.note-markdown-editor .milkdown .milkdown-code-block .tools .tools-button-group button:first-child,
.note-markdown-editor .milkdown .milkdown-code-block .tools .tools-button-group button:last-child {
  border-radius: 5px;
}

.note-markdown-editor .milkdown .milkdown-code-block:hover .language-button,
.note-markdown-editor .milkdown .milkdown-code-block:hover .tools-button-group > button,
.note-markdown-editor .milkdown .milkdown-code-block .tools .language-button:hover,
.note-markdown-editor .milkdown .milkdown-code-block .tools .tools-button-group button:hover {
  background: var(--bg);
  color: var(--text);
  opacity: 1;
}

.note-markdown-editor .milkdown .milkdown-code-block .tools .language-button .expand-icon,
.note-markdown-editor .milkdown .milkdown-code-block .tools .language-button .expand-icon svg,
.note-markdown-editor .milkdown .milkdown-code-block .tools .tools-button-group button svg {
  color: currentColor;
  fill: currentColor;
  height: 13px;
  width: 13px;
}

.note-markdown-editor .milkdown .milkdown-code-block .language-picker {
  padding-top: 4px;
  z-index: 98;
}

.note-markdown-editor .milkdown .milkdown-code-block .list-wrapper {
  border-radius: 8px;
  padding: 6px;
  width: min(240px, calc(100vw - 32px));
}

.note-markdown-editor .milkdown .milkdown-code-block .language-list {
  height: min(260px, 48vh);
}

.note-markdown-editor .milkdown .milkdown-code-block .language-list-item {
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
  gap: 7px;
  line-height: 1.25;
  min-height: 28px;
  padding: 5px 7px;
}

.note-markdown-editor .milkdown .milkdown-code-block .language-list-item:hover,
.note-markdown-editor .milkdown .milkdown-code-block .language-list-item:focus-visible {
  background: var(--bg-subtle);
  color: var(--text);
}

.note-markdown-editor .milkdown .milkdown-code-block .language-list-item .leading,
.note-markdown-editor .milkdown .milkdown-code-block .language-list-item .leading svg {
  height: 15px;
  width: 15px;
}

.note-markdown-editor .milkdown .milkdown-code-block .search-box {
  border: 1px solid var(--hairline);
  border-radius: 6px;
  gap: 6px;
  margin: 0 0 6px;
  outline: 0;
  padding: 5px 7px;
}

.note-markdown-editor .milkdown .milkdown-code-block .search-box:has(input:focus) {
  border-color: var(--text-faint);
  outline: 0;
}

.note-markdown-editor .milkdown .milkdown-code-block .search-box input {
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.3;
}

.note-markdown-editor .milkdown .milkdown-code-block .search-box .clear-icon,
.note-markdown-editor .milkdown .milkdown-code-block .search-box .clear-icon svg {
  color: var(--text-faint);
  fill: currentColor;
  height: 15px;
  width: 15px;
}

.note-linked-entries {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
}

.note-linked-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.note-linked-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 11px;
}

.note-linked-empty {
  margin-top: 14px;
  color: var(--text-faint);
  font-size: 14px;
}

.note-linked-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.note-linked-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  gap: 14px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}

.note-linked-date {
  flex: none;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.note-linked-row:hover .note-linked-date,
.note-linked-row:focus-within .note-linked-date {
  color: var(--text-secondary);
}

.note-linked-text {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.note-linked-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.note-linked-meta .code {
  width: 24px;
  min-width: 24px;
  height: 22px;
  font-size: 13px;
}

.note-linked-pomo {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.notes-back-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
}

.notes-back-link:hover {
  color: var(--text);
}

/* Inline note chips on day entries */

.entry[data-entry-kind="daily"] {
  flex-wrap: wrap;
  row-gap: 0;
}

.entry-note-chips {
  flex: 0 0 100%;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0;
  margin-top: 4px;
  padding-left: 44px;
}

.entry-note-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 220px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: color-mix(in oklch, var(--text) 5%, var(--bg-subtle));
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.1;
  padding: 3px 7px 3px 6px;
  text-decoration: none;
}

.entry-note-chip:hover {
  background: color-mix(in oklch, var(--text) 8%, var(--bg-subtle));
  color: var(--text);
}

.entry-note-chip-icon {
  flex: none;
  color: var(--text-faint);
  width: 12px;
  height: 12px;
}

.entry-note-chip-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Note link picker (# in a day entry) */

.note-link-menu {
  position: absolute;
  z-index: 95;
  width: 320px;
  max-width: calc(100vw - 24px);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: color-mix(in oklch, var(--bg) 96%, var(--bg-subtle));
  box-shadow: 0 16px 40px color-mix(in oklch, black 18%, transparent);
  padding: 6px;
}

.note-link-menu-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.note-link-menu-label {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 8px 4px;
}

.note-link-menu-item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  padding: 7px 8px;
}

.note-link-menu-item:hover,
.note-link-menu-item.active {
  background: var(--bg-subtle);
}

.note-link-menu-icon {
  flex: none;
  color: var(--text-faint);
  font-size: 14px;
  display: inline-grid;
  place-items: center;
  width: 16px;
}

.note-link-menu-create-icon {
  color: var(--tomato);
  font-weight: 500;
}

.note-link-menu-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-link-menu-linked {
  flex: none;
  color: var(--forest);
  font-family: var(--mono);
  font-size: 11px;
}

.note-link-menu-date {
  flex: none;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
}

.note-link-menu-empty {
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.35;
  padding: 8px;
}

.note-link-menu-hint {
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--hairline);
  margin: 6px -6px -6px;
  padding: 7px 12px;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1;
}

.note-link-menu-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.note-link-menu-key {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 0 5px;
  place-items: center;
}

.note-link-menu-action {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ---------- Note focus mode (typewriter) ---------- */

html[data-note-focus="true"] {
  scroll-behavior: auto;
}

html[data-note-focus="true"] .sidebar,
html[data-note-focus="true"] .note-editor-top,
html[data-note-focus="true"] .note-title-actions,
html[data-note-focus="true"] .note-meta,
html[data-note-focus="true"] .note-linked-entries,
html[data-note-focus="true"] #pomodoro-widget-root,
html[data-note-focus="true"] .floating-note {
  display: none;
}

html[data-note-focus="true"] .layout {
  display: block;
  max-width: 728px;
  padding: 0 24px;
}

html[data-note-focus="true"] main {
  grid-column: auto;
}

html[data-note-focus="true"] #view-note {
  padding: 38vh 0 55vh;
}

html[data-note-focus="true"] .note-title-input {
  color: var(--text-faint);
  transition: color 0.18s ease;
}

html[data-note-focus="true"] .note-title-input:focus {
  color: var(--text);
}

html[data-note-focus="true"] .note-markdown-editor {
  font-size: 16px;
  line-height: 1.75;
}

/* Paragraph contrast: dim every top-level block except the one holding the
   caret, and only while the editor actually has focus. */
html[data-note-focus="true"] .note-markdown-editor .ProseMirror > * {
  transition: opacity 0.18s ease;
}

html[data-note-focus="true"] .note-markdown-editor .ProseMirror.ProseMirror-focused > * {
  opacity: 0.4;
}

html[data-note-focus="true"] .note-markdown-editor .ProseMirror.ProseMirror-focused > .note-focus-active-block {
  opacity: 1;
}

.note-focus-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  /* Horizontal inset mirrors the focus-mode .layout column (max-width 728px,
     24px side padding) so the bar's ends align with the text edges. */
  padding: 10px max(24px, calc((100% - 680px) / 2));
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  border-top: 1px solid var(--hairline);
  /* Keep the fixed footer opaque so editor content scrolling beneath it can
     never show through or visually overlap the status controls. */
  background: var(--bg);
  z-index: 90;
}

.note-focus-bar > * {
  transition: opacity 0.18s ease;
}

.note-focus-bar[data-typing="true"] > * {
  opacity: 0.25;
}

.note-focus-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.note-focus-save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--forest);
}

.note-focus-bar[data-saving="true"] .note-focus-save-dot {
  background: var(--text-faint);
}

.note-focus-pomo {
  color: var(--tomato);
}

.note-focus-exit {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  border: 0;
  background: transparent;
  padding: 2px 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}

.note-focus-exit:hover,
.note-focus-exit:focus-visible {
  color: var(--text);
}

.note-focus-exit kbd {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--hairline);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
}

@media (max-width: 800px) {
  html[data-note-focus="true"] .layout {
    padding: 0 20px;
  }

  html[data-note-focus="true"] #view-note {
    padding: 30vh 0 45vh;
  }

  .note-focus-bar {
    gap: 16px;
    padding: 10px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .note-focus-bar,
  .note-focus-bar > *,
  html[data-note-focus="true"] .note-title-input,
  html[data-note-focus="true"] .note-markdown-editor .ProseMirror > * {
    transition: none;
  }
}
