:root {
  --bg-1: #eef4ff;
  --bg-2: #f8fbff;
  --text: #12284a;
  --muted: #5d7398;
  --primary: #2766d9;
  --primary-strong: #1f55b6;
  --panel: rgba(255, 255, 255, 0.92);
  --border: #d4e2fb;
  --level-0: #edf4ff;
  --level-1: #d1e2ff;
  --level-2: #a6c7ff;
  --level-3: #78aaf5;
  --level-4: #4e88e9;
  --level-5: #1f62d5;
  --activity-cell-size: 15px;
  --activity-gap: 3px;
  --danger: #af2c2c;
  --shadow: 0 18px 36px rgba(18, 40, 74, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  /* Match every page edge to the canvas exposed during elastic overscroll. */
  background-color: var(--bg-1);
  overflow-y: scroll;
  scrollbar-gutter: stable;
  overflow-anchor: none;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg-1);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  overflow-anchor: none;
}

.app-shell {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px clamp(12px, 2.6vw, 20px) 40px;
  overflow-anchor: none;
}

.app-shell * {
  overflow-anchor: none;
}

.top-bar {
  position: relative;
  z-index: 5;
  background: transparent;
  overflow-anchor: none;
}

.top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px clamp(12px, 2.6vw, 20px) 0;
  flex-wrap: nowrap;
  min-height: 56px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 40px;
}

.app-brand-mark {
  display: block;
  flex: 0 0 auto;
}

.top-bar-main {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 62px;
}

.tracker-tabs {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: clamp(4px, 0.75vw, 8px);
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  min-height: 62px;
  padding: clamp(4px, 0.55vw, 6px);
  border-radius: clamp(18px, 1.7vw, 22px);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(144, 176, 230, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 12px 28px rgba(18, 40, 74, 0.08);
  backdrop-filter: blur(10px);
}

.tracker-tab {
  margin: 0;
  flex: 0 1 auto;
  height: 48px;
  min-width: 0;
  border-radius: clamp(14px, 1.35vw, 16px);
  padding: 12px clamp(10px, 0.5rem + 0.9vw, 18px);
  min-height: 48px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent;
  color: #56709a;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(13px, 0.65rem + 0.55vw, 15px);
  font-weight: 700;
  letter-spacing: 0.01em;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.tracker-tab:hover:enabled {
  background: rgba(234, 242, 255, 0.92);
  color: #1f4f99;
}

.tracker-tab.is-active {
  background: linear-gradient(135deg, #2d6ee3, #1f56bb);
  color: #fff;
  box-shadow: 0 12px 22px rgba(31, 86, 187, 0.24);
}

.tracker-tab.is-active:hover:enabled {
  background: linear-gradient(135deg, #2766d9, #194aa5);
  color: #fff;
}

.tracker-view {
  min-width: 0;
}

.support-footer {
  margin: 18px 0 8px;
  display: flex;
  justify-content: center;
}

.bmc-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  opacity: 0.9;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.bmc-link:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.bmc-image {
  width: 170px;
  height: 37px;
  display: block;
  border-radius: 10px;
  box-shadow: 0 3px 2px rgba(190, 190, 190, 0.5);
}

h2 {
  margin: 0;
  font-size: 27px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(3px);
  margin-bottom: 12px;
  overflow-anchor: none;
}

.pace-card { padding: 18px 20px; }
.pace-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pace-summary-row h2 { margin: 0; font-size: 20px; }
.pace-chart-legend { display: flex; gap: 14px; color: #536b8d; font-size: 11px; }
.pace-chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.pace-chart-legend i { display: inline-block; width: 18px; border-top: 2px solid var(--primary); }
.pace-chart-legend .pace-target-swatch { border-top-color: #74849c; border-top-style: dashed; }
.pace-chart { position: relative; width: 100%; min-width: 0; }
.pace-plot { display: block; width: 100%; overflow: visible; border-radius: 6px; touch-action: pan-y; }
.pace-plot:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.pace-axis-label { font-family: "Manrope", sans-serif; font-size: 11px; fill: #536b8d; }
.pace-grid-line { stroke: #e9eef7; stroke-width: 1; }
.pace-actual-area { fill: url(#pace-area-gradient); }
.pace-actual-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.pace-target-line { fill: none; stroke: #8291a7; stroke-width: 1.5; stroke-dasharray: 4 5; stroke-linejoin: round; }
.pace-partial-line { stroke-dasharray: 3 5; opacity: .55; }
.pace-partial-dot { fill: #fff; stroke: var(--primary); stroke-width: 1.75; }
.pace-actual-dot { fill: var(--primary); }
.pace-target-dot { fill: #74849c; }
.pace-hover-guide { stroke: #a0b2cd; stroke-width: 1; }
.pace-actual-marker { fill: var(--primary); stroke: #fff; stroke-width: 1.5; }
.pace-target-marker { fill: #fff; stroke: #74849c; stroke-width: 1.5; }
.pace-tooltip { position: absolute; z-index: 3; pointer-events: none; min-width: 170px; max-width: 220px; display: grid; gap: 4px; padding: 10px 12px; background: #fff; border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 5px 18px #12284a12; color: #536b8d; font-size: 12px; font-variant-numeric: tabular-nums; }
.pace-tooltip strong { color: var(--text); font-size: 12px; font-weight: 600; }
.pace-chart-wrap > .panel-note { margin: 14px 0 8px; }
.pace-card .form-message:empty { display: none; }
.pace-card .form-message { color: var(--muted); }
@media (max-width: 480px) {
  .pace-card { padding: 16px; }
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
  margin-bottom: 12px;
}

.section-heading h2 {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
}

#account-modal .section-heading {
  margin-bottom: 6px;
  align-items: center;
}

#account-modal .modal-card {
  width: min(700px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.overview-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 14px;
}

.overview-current-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  container-type: inline-size;
  container-name: overview-block;
}

.overview-current-block > p {
  white-space: nowrap;
}

.overview-current-block > .panel-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-label {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.stat-value {
  margin: 4px 0 2px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 40px;
  line-height: 1;
  letter-spacing: 0.03em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.panel-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.progress-track {
  width: 100%;
  height: 13px;
  background: #e6efff;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4a8eff, #2766d9);
  transition:
    width 0.3s ease,
    background 0.25s ease;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.input-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
}

textarea {
  resize: vertical;
  line-height: 1.4;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(39, 102, 217, 0.22);
  outline-offset: 1px;
}

button {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 15px;
  min-height: 42px;
  line-height: 1.2;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

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

.secondary-button,
.ghost-button {
  background: #e9f1ff;
  color: #1a4489;
}

.danger-button {
  background: #ffe8e8;
  color: #8a1f1f;
}

.secondary-button:hover:enabled,
.ghost-button:hover:enabled {
  background: #dce9ff;
}

.danger-button:hover:enabled {
  background: #ffd8d8;
}

.ghost-button {
  white-space: nowrap;
}

.header-account-btn {
  min-width: 0;
  min-height: 40px;
  height: 40px;
  padding: 6px 10px;
  gap: 6px;
  border-radius: 8px;
  background: transparent;
  color: #35507a;
  font-size: 15px;
  line-height: 28px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 120ms ease, color 120ms ease;
}

.header-account-btn:hover:enabled,
.header-account-btn:focus-visible,
.header-account-btn[aria-expanded="true"] {
  background: #e9f1ff;
  color: #1a4489;
}

.header-account-btn.is-signed-out {
  color: var(--primary);
}

/* Keep neighboring card shadows from tinting white surfaces. */
#deep-work-view > .panel,
#deep-work-view .goal-card {
  background: #fff;
  box-shadow: none;
  backdrop-filter: none;
}

.form-message {
  min-height: 0;
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.form-message:empty {
  display: none;
}

.form-message.is-success {
  color: #1d4f9b;
}

.toast-message {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  width: min(440px, calc(100vw - 32px));
  margin: 0;
  padding: 12px 16px;
  border: 1px solid #f0ccd3;
  border-radius: 16px;
  background: rgba(255, 252, 253, 0.97);
  box-shadow: 0 18px 36px rgba(21, 35, 59, 0.18);
  color: #b33e55;
  font-weight: 600;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.toast-message.is-success {
  border-color: #c8dcff;
  background: rgba(247, 251, 255, 0.97);
  color: #1d4f9b;
}

.leaderboard-note {
  color: var(--muted);
}

.leaderboard-note.is-error {
  color: var(--danger);
}

.leaderboard-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
}

.leaderboard-range-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: #1b4f99;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  min-height: 36px;
}

.leaderboard-range-btn:hover:enabled {
  background: #f5f9ff;
}

.leaderboard-range-btn.is-active {
  background: #1f63d4;
  border-color: #1f63d4;
  color: #fff;
}

.leaderboard-range-btn.is-active:hover:enabled {
  background: #1a56b9;
  border-color: #1a56b9;
}

.auth-panel {
  margin-bottom: 16px;
}

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

.auth-status-pill {
  margin-left: 0;
}

.auth-status-pill.is-in {
  background: #dcecff;
  color: #14458f;
}

.auth-status-pill.is-out {
  background: #edf3ff;
  color: #4a628a;
}

.auth-status-pill.is-loading {
  background: #eef2f8;
  color: #5c6f8e;
}

.auth-status-pill.is-setup {
  background: #fff0dc;
  color: #8c5b17;
}

.auth-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 12px 28px rgba(20, 54, 108, 0.08);
}

.auth-signed-out-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.auth-signed-out-hero {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid #d5e5ff;
  background: radial-gradient(
      circle at top right,
      rgba(39, 102, 217, 0.14),
      transparent 42%
    ),
    linear-gradient(180deg, #f8fbff, #f1f7ff);
}

.auth-signed-out-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #173868;
}

.auth-signed-out-form-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid #d9e7ff;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

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

.auth-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.auth-signed-out-form-shell .auth-actions {
  margin-top: 0;
}

.auth-signed-out-form-shell .auth-actions button {
  flex: 1 1 180px;
  min-height: 46px;
}

.auth-signed-in {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-signed-in-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  background: radial-gradient(
      circle at top right,
      rgba(39, 102, 217, 0.12),
      transparent 42%
    ),
    linear-gradient(180deg, #f8fbff, #f1f7ff);
  border: 1px solid #d5e5ff;
}

.auth-user-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.auth-avatar {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ecf4ff, #d9e9ff);
  border: 1px solid #8fb2ea;
  color: #17478f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  flex-shrink: 0;
}

.auth-user-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.auth-meta-label {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6b7280;
}

.auth-user-email {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-signed-in-note {
  margin: 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-section {
  padding: 14px 0;
}

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

.auth-user-section {
  padding-top: 0;
  padding-bottom: 16px;
}

.auth-summary-section {
  padding-top: 16px;
  padding-bottom: 16px;
}

.auth-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.auth-summary-card {
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f7faff);
  border: 1px solid #d9e7ff;
}

.auth-summary-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6980a5;
}

.auth-summary-value {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #153b78;
}

.auth-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 0;
}

.auth-footer .text-danger-btn {
  min-height: 44px;
  min-width: 132px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-footer-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.text-danger-btn {
  background: linear-gradient(180deg, #fff8f8, #fff1f1);
  border: 1px solid #e7c3c3;
  padding: 10px 16px;
  font-weight: 700;
  color: #a04343;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(175, 44, 44, 0.08);
}

.text-danger-btn:hover:enabled {
  background: linear-gradient(180deg, #fff2f2, #ffeaea);
}

.account-title {
  font-size: 28px;
  font-weight: 700;
}

.goal-shell {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 10px;
}

.goal-shell-header {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.goal-shell-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #1c3764;
}

.goal-shell-header .panel-note {
  max-width: 56ch;
}

.goal-grid {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 12px;
  overflow-anchor: none;
}

.goal-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px 16px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.goal-card.is-active {
  border-color: #8ab2f5;
  background: #fff;
}

.goal-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  /* Compensate for the extra line-box space around the heading and menu. */
  margin-bottom: -4px;
}

.goal-top-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.goal-title {
  margin: 0;
  font-size: 18px;
  min-width: 0;
  min-height: 1.2em;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

.goal-inline-status {
  grid-column: 1 / -1;
  justify-self: start;
  font-size: 12px;
  font-weight: 700;
  color: #1a4a94;
  background: #e9f1ff;
  border: 1px solid #bfd5fb;
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}

.goal-popout-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 11px;
  padding: 0;
  background: #e9f1ff;
  color: #1a4489;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.goal-popout-btn:hover:enabled {
  background: #dce9ff;
}

.goal-popout-icon {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}

.goals-section {
  margin-bottom: 12px;
}

.goals-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.new-goal-button {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 14px;
  color: var(--primary-strong);
  background: transparent;
}

.new-goal-button:hover:enabled {
  background: #e9f1ff;
}

.goal-menu {
  position: relative;
}

.goal-menu-toggle {
  position: relative;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.goal-menu-toggle::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
}

.goal-menu-toggle:hover:enabled,
.goal-menu-toggle:focus-visible,
.goal-menu-toggle[aria-expanded="true"] {
  background: #e9f1ff;
  color: #1a4489;
}

.goal-menu:has(.goal-menu-toggle[aria-expanded="true"]) {
  z-index: 4;
}

.goal-menu-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 150px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(18, 40, 74, .1);
}

.goal-menu-item {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  justify-content: flex-start;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  background: transparent;
}

.goal-menu-item:hover:enabled {
  background: #eef4ff;
}

.goal-menu-remove {
  color: var(--danger);
}

.goal-menu-remove:hover:enabled {
  background: #fff1f1;
}

.goals-section .empty-state {
  position: relative;
  margin: 0;
  padding-top: 14px;
  padding-bottom: 14px;
  background: #fff;
}

.goal-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  min-height: 1.4em;
  white-space: normal;
  overflow-wrap: anywhere;
}

.goal-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.goal-input-wrap {
  margin: 0;
}

.goal-input-wrap textarea {
  display: block;
}

.goal-field-label {
  font-size: 14px;
}

.goal-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e6efff;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  margin: 0;
}

.goal-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #8eb8ff, #3677e8);
  transition:
    width 0.25s ease,
    background 0.25s ease;
}

.progress-track.is-energized,
.goal-progress-track.is-energized {
  box-shadow:
    0 0 0 1px rgba(104, 198, 255, 0.9),
    0 0 6px rgba(104, 198, 255, 0.35);
}

.goal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  flex-wrap: wrap;
}

.goal-actions button {
  min-width: 102px;
}

.goal-actions .goal-popout-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
}

.goal-form-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  padding-top: 2px;
}

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

.todo-text-field {
  min-width: 0;
}

.todo-form-actions {
  display: flex;
  align-items: center;
}

.habit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 12px 24px rgba(20, 54, 108, 0.06);
}

.habit-entry-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.habit-text-field {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.habit-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 10px;
  min-height: 40px;
  margin-bottom: 10px;
}

.habit-heading h2 {
  min-width: 0;
  display: flex;
  align-items: center;
  margin: 0;
  min-height: 40px;
  white-space: nowrap;
  font-size: 34px;
  line-height: 40px;
}

.habit-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  align-self: center;
  justify-self: end;
}

.habit-heading-actions button {
  min-height: 40px;
  padding: 10px 12px;
  font-size: 14px;
  white-space: nowrap;
}

.habit-toggle-icon {
  display: none;
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  line-height: 1;
}

.habit-toggle-btn[aria-expanded="true"] {
  background: #1a56b9;
}

.habit-week-summary {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  overflow-anchor: none;
}

.habit-week-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.habit-week-chip.is-today .habit-week-label {
  color: #2e63be;
}

.habit-week-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #61779e;
}

.habit-week-circle {
  width: min(44px, 100%);
  height: auto;
  aspect-ratio: 1;
  border-radius: 999px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ffffff, #f6faff);
  box-shadow: 0 10px 18px rgba(39, 102, 217, 0.08);
  font-size: 14px;
}

.habit-week-circle svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(-90deg);
  overflow: visible;
}

.habit-week-ring-track,
.habit-week-ring-progress {
  fill: none;
  stroke-width: 6;
}

.habit-week-ring-track {
  stroke: #dfe8f7;
}

.habit-week-ring-progress {
  stroke: #316ddd;
  transition:
    stroke-dashoffset 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    stroke 0.25s ease;
}

.habit-week-circle.is-today {
  box-shadow:
    0 10px 18px rgba(39, 102, 217, 0.08),
    0 0 0 2px rgba(39, 102, 217, 0.16);
}

.habit-week-circle.is-full {
  box-shadow:
    0 10px 18px rgba(39, 102, 217, 0.1),
    0 0 0 1px rgba(39, 102, 217, 0.1);
}

.habit-week-ratio {
  font-size: 11px;
  font-weight: 700;
  color: #6e84a6;
}

.habit-week-chip.is-today .habit-week-ratio {
  color: #5679ad;
}

.habit-edit-btn.is-active {
  background: #dce9ff;
  color: #174995;
}

.habit-modal-card {
  width: min(760px, 100%);
  max-height: min(88vh, 820px);
}

.habit-modal-close-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 10px;
  align-self: flex-start;
}

.habit-modal-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.habit-ideas-section {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: radial-gradient(
      circle at top right,
      rgba(39, 102, 217, 0.08),
      transparent 42%
    ),
    linear-gradient(180deg, #ffffff, #f8fbff);
}

.habit-ideas-header {
  margin-bottom: 12px;
}

.habit-ideas-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.habit-ideas-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.habit-idea-chip {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid #d0def7;
  background: #fff;
  color: #153c7f;
  font-size: 13px;
  font-weight: 700;
  justify-content: flex-start;
  text-align: left;
  box-shadow: 0 1px 0 rgba(39, 102, 217, 0.04);
}

.habit-idea-chip:hover:enabled {
  background: #f5f9ff;
  border-color: #b9cef2;
}

.habit-idea-chip.is-selected {
  background: linear-gradient(135deg, #2d6ee3, #1f56bb);
  border-color: #1f56bb;
  color: #fff;
  box-shadow: 0 12px 22px rgba(31, 86, 187, 0.18);
}

.habit-modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.habit-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
  overflow-anchor: none;
}

.habit-list .empty-state {
  grid-column: 1 / -1;
}

.habit-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 11px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow: 0 1px 0 rgba(39, 102, 217, 0.04);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
  cursor: pointer;
}

.habit-row:hover {
  border-color: #bfd2f4;
  box-shadow: 0 8px 18px rgba(39, 102, 217, 0.08);
}

.habit-row:focus-visible {
  outline: none;
  border-color: #7fa8ec;
  box-shadow:
    0 0 0 3px rgba(39, 102, 217, 0.16),
    0 8px 18px rgba(39, 102, 217, 0.08);
}

.habit-row.is-complete {
  background: linear-gradient(180deg, #fbfdff, #f3f8ff);
}

.habit-row.is-solid {
  border-color: #89ace8;
}

.habit-row.is-editing {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.habit-check-indicator {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  border: 2px solid #bdd0ef;
  border-radius: 999px;
  background: #fff;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

.habit-check-indicator::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 999px;
  background: transparent;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.habit-row:hover .habit-check-indicator {
  background: #f5f9ff;
  border-color: #92b2e5;
}

.habit-check-indicator.is-complete {
  border-color: #4d83e7;
  background: #edf4ff;
}

.habit-check-indicator.is-complete::after {
  background: #2e6ddf;
}

.habit-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.habit-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.habit-row-title {
  margin: 0;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.habit-row-streak {
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e9f1ff;
  color: #1d4f9a;
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.habit-row-bottom {
  display: block;
}

.habit-row-progress-track {
  height: 6px;
  border-radius: 999px;
  background: #e4e8ee;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.habit-row-progress-track.is-complete {
  background: linear-gradient(90deg, #a4adb7, #7a8490);
}

.habit-row-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a4adb7, #7a8490);
  transition:
    width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.25s ease;
}

.habit-row.is-complete .habit-row-progress-track.is-complete {
  background: linear-gradient(90deg, #8eb8ff, #316ddd);
}

.habit-row.is-complete .habit-row-progress-fill {
  background: linear-gradient(90deg, #8eb8ff, #316ddd);
}

.habit-manage-card {
  width: min(560px, 100%);
  max-height: min(80vh, 700px);
  background: #ffffff;
  border: 1px solid #dfe6ef;
  box-shadow: 0 16px 30px rgba(10, 29, 60, 0.14);
}

.habit-manage-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.habit-manage-edit-mode-btn {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 10px;
  box-shadow: none;
}

.habit-manage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.habit-manage-row {
  display: grid;
  grid-template-columns: minmax(108px, 136px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e3e9f1;
  border-radius: 12px;
  background: #ffffff;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    opacity 0.16s ease;
}

.habit-manage-row.is-draggable {
  cursor: grab;
}

.habit-manage-row.is-draggable:hover {
  border-color: #d3deee;
  background: #fbfcfe;
}

.habit-manage-row.is-draggable:active {
  cursor: grabbing;
}

.habit-manage-row.is-dragging {
  opacity: 0.65;
  transform: scale(0.995);
}

.habit-manage-row.is-drag-source-hidden {
  display: none;
}

.habit-manage-drop-slot {
  border-radius: 12px;
  border: 1px dashed #c8d7ec;
  background: #f7faff;
  transition:
    height 0.16s ease,
    opacity 0.16s ease;
}

.habit-manage-main-row {
  min-width: 0;
  display: flex;
  align-items: center;
}

.habit-manage-title {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: #24364f;
}

.habit-manage-input {
  width: 100%;
  border: 1px solid #d9e3f1;
  border-radius: 8px;
  background: #ffffff;
  color: #17345a;
  box-sizing: border-box;
  height: 30px;
  padding: 0 8px;
  margin: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  box-shadow: none;
}

.habit-manage-input:focus {
  outline: none;
  border-color: #7ea6e7;
  box-shadow: 0 0 0 3px rgba(49, 109, 221, 0.12);
}

.habit-manage-history {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.habit-manage-day-btn {
  min-width: 0;
  min-height: 32px;
  padding: 0 6px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fafcff;
  color: #52657f;
  font: inherit;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    opacity 0.16s ease;
}

.habit-manage-day-btn:hover:enabled {
  border-color: #c7d4e6;
  background: #f4f8fd;
}

.habit-manage-day-btn:focus-visible {
  outline: none;
  border-color: #7ea6e7;
  box-shadow: 0 0 0 3px rgba(49, 109, 221, 0.14);
}

.habit-manage-day-btn.is-complete {
  border-color: #1f55b6;
  background: linear-gradient(135deg, #2d6ee3, #1f56bb);
  color: #ffffff;
}

.habit-manage-day-btn.is-pending {
  opacity: 0.58;
}

.habit-manage-day-btn:disabled {
  cursor: wait;
}

.habit-manage-day-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.9;
}

.habit-manage-day-btn.is-complete .habit-manage-day-label {
  color: #ffffff;
}

.habit-manage-day-btn.is-complete .habit-manage-day-date {
  color: #ffffff;
}

.habit-manage-delete {
  min-height: 28px;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
  white-space: nowrap;
}

.todo-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-anchor: none;
}

.todo-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-tree-node {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-tree-node.is-subtask {
  margin-left: 18px;
}

.todo-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 14px;
  padding-left: 12px;
  border-left: 1px dashed #c9d9f3;
}

.todo-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.todo-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.todo-item:hover {
  border-color: #bfd2f4;
  box-shadow: 0 8px 18px rgba(39, 102, 217, 0.08);
}

.todo-item:focus-visible {
  outline: none;
  border-color: #7fa8ec;
  box-shadow:
    0 0 0 3px rgba(39, 102, 217, 0.16),
    0 8px 18px rgba(39, 102, 217, 0.08);
}

.todo-item.is-complete {
  background: #f7f9fc;
  border-color: #dbe5f6;
}

.todo-item.is-draggable {
  cursor: grab;
}

.todo-item.is-draggable:active {
  cursor: grabbing;
}

.todo-item.is-dragging {
  opacity: 0.54;
  border-style: dashed;
  background: #f8fbff;
  box-shadow: 0 12px 24px rgba(39, 102, 217, 0.14);
}

.todo-item.is-nest-target {
  border-color: #8fb1e8;
  background: linear-gradient(180deg, #f9fbff, #eef5ff);
  box-shadow: 0 10px 18px rgba(39, 102, 217, 0.12);
}

.todo-check-indicator {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 2px solid #bdd0ef;
  border-radius: 999px;
  background: #fff;
  position: relative;
  flex-shrink: 0;
  appearance: none;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.todo-check-indicator::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 999px;
  background: transparent;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.todo-item:hover .todo-check-indicator,
.todo-check-indicator:hover {
  background: #f5f9ff;
  border-color: #92b2e5;
}

.todo-check-indicator:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(46, 109, 223, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.todo-check-indicator.is-complete {
  border-color: #4d83e7;
  background: #edf4ff;
}

.todo-check-indicator.is-complete::after {
  background: #2e6ddf;
}

.todo-body {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.todo-text {
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
}

.todo-item.is-complete .todo-text {
  color: var(--muted);
  text-decoration: line-through;
}

.todo-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.todo-goal-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: #eef4ff;
  color: #1d4f9b;
  font-size: 12px;
  font-weight: 700;
}

.todo-goal-pill.is-subtask-pill {
  background: #f1f5fb;
  color: #5b6d8d;
}

.todo-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  flex-shrink: 0;
}

.todo-actions button {
  min-width: 0;
}

.todo-completed {
  border-top: 1px solid #dbe4f5;
  padding-top: 10px;
}

.todo-completed summary {
  cursor: pointer;
  color: #1b3d77;
  font-weight: 700;
  list-style: none;
}

.todo-completed summary::-webkit-details-marker {
  display: none;
}

.todo-completed summary::after {
  content: "+";
  margin-left: 8px;
}

.todo-completed[open] summary::after {
  content: "-";
}

.todo-completed .todo-items {
  margin-top: 10px;
}

.goal-card.is-plan-target {
  border-color: #2e6ddf;
  box-shadow: 0 0 0 3px rgba(46, 109, 223, 0.12);
}

.goal-card.is-drop-target {
  border-color: #2e6ddf;
  box-shadow: 0 0 0 3px rgba(46, 109, 223, 0.16);
  background: #f8fbff;
}

.goal-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.goal-status:empty {
  display: none;
}

.goal-card .input-stack {
  gap: 6px;
}

.goal-card textarea {
  min-height: 58px;
  padding: 8px 12px;
}

.empty-state {
  padding: 16px;
  border: 1px dashed #a7c1ee;
  border-radius: 14px;
  color: var(--muted);
  background: #f6f9ff;
}

.status-pill {
  margin: 0;
  width: fit-content;
  border-radius: 999px;
  background: #e6efff;
  color: #1a4489;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 13px;
}

.timer-readout {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 58px;
  line-height: 1;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.activity-layout {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.section-heading.section-heading-activity {
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  /* Text line boxes add space here; use a smaller gap for visual balance. */
  margin-bottom: 6px;
}

.heatmap-weekday-labels {
  display: grid;
  grid-template-rows: repeat(7, var(--activity-cell-size));
  gap: var(--activity-gap);
  padding-top: 24px;
}

.heatmap-weekday-label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  line-height: 1;
}

.heatmap-weekday-label.is-empty {
  visibility: hidden;
}

.heatmap-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
}

.heatmap-month-labels {
  --heatmap-weeks: 5;
  display: grid;
  grid-template-columns: repeat(
    var(--heatmap-weeks),
    var(--activity-cell-size)
  );
  gap: var(--activity-gap);
  height: 18px;
  margin-bottom: 6px;
  width: max-content;
}

.heatmap-month-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  line-height: 18px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heatmap-grid {
  --heatmap-weeks: 5;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--activity-cell-size));
  grid-template-columns: repeat(
    var(--heatmap-weeks),
    var(--activity-cell-size)
  );
  gap: var(--activity-gap);
  width: max-content;
}

.heat-cell {
  width: var(--activity-cell-size);
  height: var(--activity-cell-size);
  border-radius: 3px;
  border: 1px solid #cfdef8;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.heat-cell.is-goal-met {
  box-shadow: inset 0 0 0 1px rgba(12, 47, 107, 0.28);
}

.level-0 {
  background: var(--level-0);
}

.level-1 {
  background: var(--level-1);
}

.level-2 {
  background: var(--level-2);
}

.level-3 {
  background: var(--level-3);
}

.level-4 {
  background: var(--level-4);
}

.level-5 {
  background: var(--level-5);
}

.legend {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

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

.activity-average {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.activity-footer .legend {
  margin-left: auto;
  gap: 4px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #cfe0ff;
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-anchor: none;
}

.section-heading.sessions-heading {
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
}

.manual-session-toggle {
  padding: 6px 10px;
  min-height: 36px;
  gap: 5px;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 8px;
}

.manual-session-toggle:hover:enabled {
  background: #e9f1ff;
}

.manual-session-toggle span {
  font-size: 18px;
  font-weight: 400;
}

body:has(.manual-session-dialog[open]) {
  overflow: hidden;
}

.manual-session-dialog {
  width: min(420px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 24px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(18, 40, 74, 0.2);
}

.manual-session-dialog::backdrop {
  background: rgba(8, 25, 54, 0.32);
}

.manual-session-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.manual-session-heading h2 {
  font-size: 22px;
}

.manual-session-heading .modal-icon-btn {
  min-height: 36px;
  background: transparent;
  border: 0;
}

#manual-session-description {
  margin: 4px 0 22px;
  color: var(--muted);
  font-size: 14px;
}

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

.manual-session-wide {
  grid-column: 1 / -1;
}

.manual-session-form .input-stack,
.manual-session-form input,
.manual-session-form select {
  min-width: 0;
  width: 100%;
}

.manual-session-duration {
  position: relative;
}

.manual-session-duration input {
  padding-right: 48px;
  appearance: textfield;
  -moz-appearance: textfield;
}

.manual-session-duration input::-webkit-inner-spin-button,
.manual-session-duration input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.manual-session-duration > span {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 400;
  pointer-events: none;
}

.manual-session-optional {
  color: var(--muted);
  font-weight: 400;
}

.manual-session-form .form-message {
  margin: 0;
}

.manual-session-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.manual-session-actions .ghost-button {
  background: transparent;
  color: var(--muted);
}

.manual-session-actions .ghost-button:hover:enabled {
  background: #edf4ff;
}

@media (max-width: 460px) {
  .manual-session-dialog { padding: 20px; }
  .manual-session-form input, .manual-session-form select { font-size: 16px; }
}

@media (max-width: 360px) {
  .manual-session-form { grid-template-columns: minmax(0, 1fr); }
}

.session-card {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.session-card:last-child {
  padding-bottom: 0;
}

.session-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 8px;
  margin-bottom: 6px;
}

.session-title {
  margin: 0;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: #173868;
  overflow-wrap: anywhere;
}

.session-duration {
  margin: 0;
  color: var(--primary-strong);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.session-time {
  margin: 0 0 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.session-delete {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 6px;
  justify-content: flex-start;
  gap: 8px;
  background: transparent;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.session-delete:hover:enabled,
.session-delete:focus-visible {
  background: #fff1f1;
}

.session-actions {
  position: relative;
  width: 28px;
  height: 24px;
}

.session-actions-toggle {
  position: absolute;
  top: -2px;
  right: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  transition: background-color 120ms ease, color 120ms ease;
}

.session-actions-toggle::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
}

.session-actions-toggle:hover,
.session-actions-toggle:focus-visible,
.session-actions-toggle[aria-expanded="true"] {
  background: #e9f1ff;
  color: #1a4489;
}

.session-actions-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 3;
  min-width: 142px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(18, 40, 74, 0.1);
}

.session-list-toggle {
  display: block;
  margin: 12px auto 0;
}

.session-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-line {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 6px;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #35507a;
  overflow-wrap: anywhere;
}

.session-line-label {
  color: var(--muted);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 25, 54, 0.32);
  backdrop-filter: blur(3px);
  padding: 20px;
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal-card {
  width: min(980px, 100%);
  max-height: min(90vh, 860px);
  overflow: auto;
  margin: 0;
  border-radius: 22px;
  box-shadow: 0 24px 48px rgba(10, 29, 60, 0.22);
}

#leaderboard-modal .modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.modal-close-btn {
  background: #1f63d4;
  color: #fff;
  border: 1px solid #1f63d4;
  min-width: 82px;
}

.modal-close-btn:hover:enabled {
  background: #1a56b9;
  border-color: #1a56b9;
}

.modal-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(17, 24, 39, 0.14);
  background: #f8fbff;
  color: #4b6897;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-icon-btn:hover:enabled {
  background: #f1f6ff;
  border-color: rgba(17, 24, 39, 0.18);
}

.leaderboard-layout {
  display: grid;
  grid-template-columns: minmax(250px, 330px) 1fr;
  gap: 14px;
}

.leaderboard-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.leaderboard-column-title {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.01em;
  text-transform: none;
  color: #4f6d9a;
  font-weight: 700;
}

.leaderboard-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 64vh;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #b6caee transparent;
}

.leaderboard-list::-webkit-scrollbar {
  width: 8px;
}

.leaderboard-list::-webkit-scrollbar-track {
  background: transparent;
}

.leaderboard-list::-webkit-scrollbar-thumb {
  background: #b6caee;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
  background: #9db8e7;
  background-clip: padding-box;
}

.leaderboard-item-btn {
  width: 100%;
  text-align: left;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 11px 12px;
  color: var(--text);
  transition: border-color 0.2s ease;
}

.leaderboard-item-btn:hover:enabled {
  border-color: #8ab2f5;
}

.leaderboard-item-btn.is-rank-1 {
  border-color: #e4cc7c;
  background: linear-gradient(180deg, #fffdf6, #fff8e9);
}

.leaderboard-item-btn.is-rank-2 {
  border-color: #cfd7e3;
  background: linear-gradient(180deg, #fbfcff, #f2f6fc);
}

.leaderboard-item-btn.is-rank-3 {
  border-color: #dfbf9d;
  background: linear-gradient(180deg, #fffaf7, #fff2e8);
}

.leaderboard-item-btn.is-selected {
  border-color: #3d7ce8;
  box-shadow: 0 0 0 1px #3d7ce8 inset;
}

.leaderboard-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.leaderboard-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.leaderboard-rank {
  font-weight: 800;
  color: #1c4f9c;
  background: #e6f0ff;
  border: 1px solid #bfd5fb;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.leaderboard-item-btn.is-rank-1 .leaderboard-rank:not(.is-trophy) {
  border-color: #e4cc7c;
  background: #fdf2cb;
  color: #936f18;
}

.leaderboard-item-btn.is-rank-2 .leaderboard-rank:not(.is-trophy) {
  border-color: #cfd7e3;
  background: #eef2f8;
  color: #4f6077;
}

.leaderboard-item-btn.is-rank-3 .leaderboard-rank:not(.is-trophy) {
  border-color: #dfbf9d;
  background: #f8e7d7;
  color: #8d5b29;
}

.leaderboard-rank.is-trophy {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #1c4f9c;
}

.leaderboard-rank.is-trophy.is-rank-1 {
  color: #bf8c12;
}

.leaderboard-rank.is-trophy.is-rank-2 {
  color: #6c7f9a;
}

.leaderboard-rank.is-trophy.is-rank-3 {
  color: #9a632d;
}

.leaderboard-trophy-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.leaderboard-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #aac5ef;
  background: #dceaff;
  color: #1f4f95;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.leaderboard-name {
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-total {
  font-size: 18px;
  font-weight: 800;
  color: #2e4f82;
  white-space: nowrap;
}

.leaderboard-item-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.public-profile {
  height: 520px;
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.public-profile h3 {
  margin: 0 0 6px;
}

.public-profile .panel-note {
  margin-bottom: 6px;
}

.public-profile .leaderboard-profile-stats {
  margin-bottom: 2px;
}

.leaderboard-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.leaderboard-profile-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.leaderboard-profile-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #aac5ef;
  background: #dceaff;
  color: #1f4f95;
  font-size: 18px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.leaderboard-profile-text {
  min-width: 0;
}

.leaderboard-profile-text h3 {
  margin: 0;
  font-size: 28px;
  line-height: 1.04;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-follow-btn {
  min-width: 98px;
  border: 1px solid #9ebcf0;
  background: #eaf2ff;
  color: #1a4a94;
  padding: 8px 14px;
}

.leaderboard-follow-btn:hover:enabled {
  background: #dce9ff;
}

.leaderboard-follow-btn.is-following {
  background: #fff;
  border-color: #8fb0e8;
}

.leaderboard-follow-btn.is-following:hover:enabled {
  background: #f5f9ff;
}

.leaderboard-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.leaderboard-badge {
  border-radius: 999px;
  border: 1px solid #bfd5fb;
  background: #edf4ff;
  color: #1d4f95;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.leaderboard-strip-title {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5773a2;
}

.leaderboard-mini-heatmap {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 8px;
}

.mini-heat-cell {
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  border: 1px solid #cfe0fb;
  background: var(--level-0);
}

.mini-level-0 {
  background: var(--level-0);
}

.mini-level-1 {
  background: var(--level-1);
}

.mini-level-2 {
  background: var(--level-2);
}

.mini-level-3 {
  background: var(--level-3);
}

.mini-level-4 {
  background: var(--level-4);
}

.mini-level-5 {
  background: var(--level-5);
  border-color: #5a89dd;
}

.public-session-list {
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b6caee transparent;
}

.public-session-list::-webkit-scrollbar {
  width: 8px;
}

.public-session-list::-webkit-scrollbar-track {
  background: transparent;
}

.public-session-list::-webkit-scrollbar-thumb {
  background: #b6caee;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.public-session-list::-webkit-scrollbar-thumb:hover {
  background: #9db8e7;
  background-clip: padding-box;
}

.public-session-item {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  padding: 12px;
}

.public-session-item p {
  margin: 0;
}

.public-session-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}

.public-session-goal {
  font-weight: 700;
  color: #2c4f82;
}

.public-session-duration {
  font-size: 14px;
  color: #153665;
}

.public-session-date {
  color: var(--muted);
}

.leaderboard-empty {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #f7faff;
  color: var(--muted);
  min-height: 72px;
  display: flex;
  align-items: center;
}

.activity-tooltip {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  background: #1e232b;
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 12px 24px rgba(8, 20, 44, 0.28);
  max-width: 220px;
  text-align: center;
}

.activity-tooltip-time,
.activity-tooltip-date {
  margin: 0;
  line-height: 1.25;
  font-size: 13px;
}

.activity-tooltip-time {
  font-weight: 700;
}

.activity-tooltip-date {
  margin-top: 3px;
  color: #b7c2d7;
}

.popup-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 12px;
}

.popup-card {
  width: min(100%, 300px);
  margin: 0 auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popup-goal {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.popup-plan {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.popup-actions {
  margin-top: 2px;
}

.popup-card .timer-readout {
  font-size: 44px;
}

.popup-actions button {
  flex: 1;
  min-height: 40px;
}

@media (max-width: 800px) {
  .goal-card {
    padding: 14px 16px 16px;
    border-radius: 16px;
  }

  .panel {
    padding: 14px 12px;
    border-radius: 16px;
  }

  .todo-check-indicator {
    margin-top: 0;
  }

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

  .leaderboard-layout {
    grid-template-columns: 1fr;
  }

  .leaderboard-toolbar {
    flex-wrap: wrap;
  }

  .modal-overlay {
    padding: 10px;
  }

  .public-profile {
    height: 460px;
    min-height: 460px;
  }
}

@media (max-width: 760px) {
  .section-heading {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .section-heading h2 {
    white-space: normal;
  }

}

@media (max-width: 460px) {
  .habit-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 8px;
    row-gap: 8px;
  }

  .habit-heading h2 {
    display: flex;
    min-height: 40px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    font-size: clamp(20px, 5.8vw, 34px);
    line-height: 1;
  }

  .habit-heading-actions {
    justify-self: end;
  }
}

@media (max-width: 560px) {
  .goal-form,
  .auth-grid,
  .todo-form {
    grid-template-columns: 1fr;
  }

  .overview-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .todo-form-actions {
    width: 100%;
  }

  .todo-form-actions button {
    width: 100%;
  }

  .auth-signed-out-card {
    gap: 12px;
    padding: 14px;
  }

  .auth-signed-out-hero {
    padding: 14px 16px;
  }

  .auth-signed-out-title {
    font-size: 22px;
  }

  .auth-signed-out-form-shell {
    padding: 14px;
  }

  .auth-actions {
    flex-direction: column;
  }

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

  .auth-summary-grid {
    gap: 8px;
  }

  .auth-summary-card {
    padding: 12px 10px;
    border-radius: 14px;
  }

  .auth-summary-label {
    margin-bottom: 5px;
    font-size: 11px;
  }

  .auth-summary-value {
    font-size: 21px;
  }

  .habit-modal-card {
    max-height: min(92vh, 820px);
  }

  .habit-entry-row {
    flex-wrap: wrap;
  }

  .habit-form {
    padding: 14px;
  }

  .habit-modal-actions {
    width: 100%;
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .habit-modal-actions button {
    flex: 1 1 140px;
  }

  .habit-manage-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 8px 9px;
  }

  .habit-manage-history {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .habit-manage-day-btn {
    min-height: 30px;
  }
}

@container overview-block (max-width: 190px) {
  .stat-value {
    font-size: 36px;
  }
}

@container overview-block (max-width: 170px) {
  .panel-label {
    font-size: 11px;
  }

  .stat-value {
    font-size: 32px;
    letter-spacing: 0.01em;
  }

  .panel-note {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .overview-row {
    gap: 12px;
    margin-bottom: 10px;
  }

  .overview-panel .progress-track {
    margin-top: 0;
  }
}

@media (max-width: 360px) {
  .overview-panel {
    padding-inline: 8px;
  }

  .overview-row {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 8px;
  }
}

.app-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.035em; line-height: 28px; white-space: nowrap; }
#deep-work-view > .panel > .section-heading h2 { font-size: 20px; font-weight: 600; }
@media (max-width: 600px) {
  .app-title { font-size: 20px; }
  .top-bar-inner { gap: 8px; }
  .app-brand { gap: 8px; }
  #deep-work-view > .panel > .section-heading h2 { font-size: 18px; }
}

@media (max-width: 380px) {
  .app-title { font-size: 18px; }
  .app-brand-mark { width: 24px; height: 24px; }
}
