:root {
  --bg: #f1efe8;
  --panel: #f7f5ef;
  --panel-soft: #f3f1eb;
  --text: #20241f;
  --muted: #777a72;
  --line: #dcd9d0;
  --line-soft: #e8e5dc;
  --accent: #245b43;
  --accent-dark: #194a35;
  --accent-soft: #e6ebe4;
  --danger: #b42318;
  --success: #0f766e;
  --warning-bg: #fff7ed;
  --notebook-link: #3b6f9f;
  --notebook-link-hover: #27597f;
  --shadow: 0 12px 28px rgba(32, 36, 31, 0.06);
  --shadow-soft: 0 5px 14px rgba(32, 36, 31, 0.045);
  --control-height: 36px;
  --control-height-compact: 32px;
  --control-radius: 7px;
}

/* Mobile goals: selected quiet action-flow direction */

.goal-section-number,
.goal-section-chevron,
.goal-row-mobile-link,
.goal-row-mobile-priority,
.goal-row-mobile-state,
.goal-row-mobile-chevron,
.goal-detail-page {
  display: none;
}

@media (max-width: 1040px) {
  .shell.shell-goals {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0 0 calc(70px + env(safe-area-inset-bottom, 0px));
    background-color: #f4f3ee;
    background-image: none;
    color: #202923;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  }

  .shell-goals > .topbar.is-module-landing {
    position: sticky;
    top: 0;
    z-index: 8;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 56px;
    margin: 0;
    padding: 7px 12px 6px 16px;
    border-bottom: 1px solid #dee1da;
    background: rgba(244, 243, 238, 0.98);
    backdrop-filter: none;
  }

  .shell-goals > .topbar.is-module-landing .topbar-title {
    gap: 8px;
    align-items: baseline;
  }

  .shell-goals > .topbar.is-module-landing .module-page-title {
    color: #202923;
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-size: 27px;
    font-weight: 650;
    letter-spacing: 0.04em;
  }

  .shell-goals > .topbar.is-module-landing .module-page-meta {
    color: #7a817b;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
  }

  .shell-goals > .topbar.is-module-landing .top-actions.is-mobile-menu,
  .shell-goals > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main {
    gap: 8px;
  }

  .shell-goals > .topbar.is-module-landing .top-action-keep {
    display: none !important;
  }

  .shell-goals > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #2d6249;
    box-shadow: none;
    color: #fff;
    font-size: 20px;
  }

  .shell-goals > .topbar.is-module-landing .top-action-primary span:not(.top-action-icon) {
    display: none;
  }

  .shell-goals > .topbar.is-module-landing .top-action-icon {
    font-size: 24px;
  }

  .shell-goals > .topbar.is-module-landing .top-actions.is-mobile-menu.is-menu-ready .top-actions-more {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid #dee1da;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.34);
    color: #5f6862;
    font-size: 20px;
  }

  .shell-goals > .topbar.is-module-landing .top-actions-more-icon {
    transform: rotate(90deg);
  }

  .shell-goals .focus-layout,
  .shell-goals .goal-overview {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .shell-goals .goal-category-index,
  .shell-goals .focus-rail {
    display: none;
  }

  .shell-goals .goal-reorder-status {
    position: fixed;
    top: 62px;
    right: 14px;
    bottom: auto;
    z-index: 20;
  }

  .shell-goals .goal-section,
  .shell-goals .goal-section:first-child {
    margin: 0;
  }

  .shell-goals .goal-section details,
  .shell-goals .goal-section.is-primary details {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .shell-goals .goal-section > details > summary {
    grid-template-columns: minmax(0, 1fr) auto 20px;
    gap: 9px;
    min-height: 54px;
    padding: 0 16px;
    border-bottom: 1px solid #dee1da;
    color: #344039;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0;
  }

  .shell-goals .goal-section.is-primary > details > summary {
    min-height: 52px;
    border-bottom-color: #d3d9d2;
    color: #2d6249;
  }

  .shell-goals .goal-section-heading {
    display: flex;
    gap: 0;
    align-items: baseline;
    min-width: 0;
  }

  .shell-goals .goal-section-number {
    display: none;
  }

  .shell-goals .goal-section > details > summary strong {
    min-width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #7a817b;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    font-size: 13px;
    font-style: normal;
    font-weight: 600;
    opacity: 1;
  }

  .shell-goals .goal-section-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #68716b;
    font-size: 20px;
    transition: transform 160ms ease;
  }

  .shell-goals .goal-section > details[open] > summary .goal-section-chevron {
    transform: rotate(180deg);
  }

  .shell-goals [data-goal-section="daily"] > details > summary,
  .shell-goals [data-goal-section="pending"] > details > summary,
  .shell-goals [data-goal-section="medium"] > details > summary,
  .shell-goals [data-goal-section="long"] > details > summary {
    color: #344039;
  }

  .shell-goals .goal-list {
    display: grid;
    gap: 0;
    padding: 0 16px;
  }

  .shell-goals .goal-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    min-height: 51px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid #dee1da;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .shell-goals .goal-row:last-of-type {
    border-bottom: 1px solid #dee1da;
  }

  .shell-goals .goal-row::before,
  .shell-goals .goal-row:hover::before,
  .shell-goals .goal-row:focus-within::before {
    display: none;
    content: none;
  }

  .shell-goals .goal-row:hover,
  .shell-goals .goal-row:focus-within,
  .shell-goals .goal-row.is-current:hover,
  .shell-goals .goal-row.is-current:focus-within,
  .shell-goals .goal-row.is-current {
    background: transparent;
    box-shadow: none;
  }

  .shell-goals .goal-row > .goal-inline-detail {
    display: none;
  }

  .shell-goals .goal-row-mobile-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 18px;
    grid-template-areas: "title state chevron";
    gap: 10px;
    align-items: center;
    min-width: 0;
    min-height: 51px;
    padding: 0 2px 0 8px;
    color: #202923;
    text-decoration: none;
  }

  .shell-goals .goal-row-mobile-link.has-priority-icon {
    grid-template-columns: 14px minmax(0, 1fr) auto 18px;
    grid-template-areas: "priority title state chevron";
    column-gap: 8px;
  }

  .shell-goals .goal-row-mobile-priority {
    grid-area: priority;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    font-size: 14px;
    line-height: 1;
  }

  .shell-goals .goal-row-mobile-priority.is-high {
    color: #b85c50;
  }

  .shell-goals .goal-row-mobile-priority.is-medium {
    color: #55769b;
  }

  .shell-goals .goal-row-mobile-priority.is-low {
    color: #8b918b;
  }

  .shell-goals .goal-row-mobile-link h2 {
    grid-area: title;
    display: block;
    min-width: 0;
    width: auto;
    overflow: hidden;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .shell-goals .goal-row-mobile-link h2 .goal-title-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .shell-goals .goal-row-mobile-link h2 .doing-now-icon {
    display: none;
  }

  .shell-goals .goal-row-mobile-state {
    grid-area: state;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 20px;
    line-height: 1;
  }

  .shell-goals .goal-row-mobile-state i {
    font-size: 20px;
  }

  .shell-goals .goal-row-mobile-state.is-doing {
    color: #d81e06;
  }

  .shell-goals .goal-row-mobile-chevron {
    grid-area: chevron;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #7a817b;
    font-size: 20px;
  }

  .shell-goals .goal-list > .empty {
    margin: 0;
    padding: 16px 9px 18px;
    border: 0;
    background: transparent;
    color: #788078;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  }

  .goals-sort-mode .shell-goals .goal-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .goals-sort-mode .shell-goals .goal-row-mobile-link {
    pointer-events: none;
  }

  .goals-sort-mode .shell-goals .goal-drag-handle {
    align-self: center;
    width: 34px;
    min-height: 34px;
    border: 0;
    background: transparent;
    color: #66756b;
  }

  .shell-goals + .module-nav {
    gap: 0;
    min-height: 62px;
    padding: 4px 8px calc(3px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #dee1da;
    background: rgba(248, 247, 242, 0.98);
    box-shadow: none;
    backdrop-filter: none;
  }

  .shell-goals + .module-nav a,
  .shell-goals + .module-nav a.is-active {
    position: relative;
    gap: 2px;
    min-height: 52px;
    padding: 4px 2px 3px;
    border-radius: 0;
    background: transparent;
    color: #737b75;
    font-size: 11px;
    font-weight: 600;
  }

  .shell-goals + .module-nav a.is-active {
    color: #2d6249;
  }

  .shell-goals + .module-nav a.is-active::after {
    position: absolute;
    right: 34%;
    bottom: 1px;
    left: 34%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    content: "";
  }

  .shell-goals + .module-nav .module-nav-icon {
    width: 21px;
    height: 21px;
    font-size: 20px;
  }

  .shell-goals ~ .goal-hover-tooltip {
    max-width: calc(100vw - 32px);
    padding: 12px 14px;
    border-color: rgba(54, 70, 59, 0.18);
    background: #f8f7f2;
    box-shadow: 0 14px 34px rgba(38, 49, 42, 0.16);
    color: #334038;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.65;
  }

  .shell-goals:has(.goal-detail-page) {
    min-height: 100vh;
    padding: 0;
    background-position: center top;
  }

  .shell-goals:has(.goal-detail-page) > .topbar,
  .shell-goals:has(.goal-detail-page) + .module-nav {
    display: none;
  }

  .goal-detail-page {
    display: block;
    min-height: 100vh;
  }

  .shell-goals .goal-detail-desktop {
    display: none;
  }

  .goal-reading-topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    min-height: 56px;
    padding: 5px 10px;
    border-bottom: 1px solid rgba(54, 70, 59, 0.14);
    background: rgba(247, 243, 234, 0.9);
    backdrop-filter: blur(14px);
  }

  .goal-reading-topbar > strong {
    color: #33433a;
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-align: center;
  }

  .goal-reading-back,
  .goal-reading-more {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #3f5146;
    font-size: 24px;
    text-decoration: none;
  }

  .goal-reading-more {
    font-size: 20px;
  }

  .goal-reading-more:hover,
  .goal-reading-more:focus-visible,
  .goal-detail-sheet-head button:hover,
  .goal-detail-sheet-head button:focus-visible {
    background: rgba(45, 98, 73, 0.08);
    color: #2d6249;
  }

  .goal-reading-more:focus-visible,
  .goal-detail-sheet-head button:focus-visible {
    outline: 2px solid rgba(45, 98, 73, 0.24);
    outline-offset: 2px;
  }

  .goal-reading-paper {
    width: 100%;
    padding: 22px 16px 56px;
  }

  .goal-reading-folio {
    display: flex;
    gap: 10px;
    align-items: baseline;
    margin: 0 0 13px;
    color: #687b6f;
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
  }

  .goal-reading-folio span {
    font-style: italic;
  }

  .goal-reading-paper > h2 {
    display: flex;
    gap: 7px;
    align-items: center;
    margin: 0 0 19px;
    color: #25322b;
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-size: clamp(26px, 7.2vw, 31px);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.025em;
  }

  .goal-reading-time {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: -2px 0 20px;
    padding: 10px 0;
    border-top: 1px solid rgba(54, 70, 59, 0.12);
    border-bottom: 1px solid rgba(54, 70, 59, 0.12);
  }

  .goal-reading-time.has-reminder {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .goal-reading-time > div {
    min-width: 0;
    padding: 3px 6px;
  }

  .goal-reading-time > div + div {
    border-left: 1px solid rgba(54, 70, 59, 0.1);
  }

  .goal-reading-time dt {
    display: flex;
    gap: 4px;
    align-items: center;
    margin: 0 0 3px;
    color: #7a857e;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  .goal-reading-time dd {
    margin: 0;
    color: #3d4a42;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    font-size: clamp(11px, 2.6vw, 13px);
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
    letter-spacing: -0.015em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .goal-reading-content {
    color: #303a34;
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-size: 17px;
    line-height: 1.78;
    overflow-wrap: anywhere;
  }

  .goal-reading-content > :first-child {
    margin-top: 0;
  }

  .goal-reading-content p,
  .goal-reading-content ul,
  .goal-reading-content ol,
  .goal-reading-content blockquote,
  .goal-reading-content pre {
    margin-block: 0 1em;
  }

  .goal-detail-sheet {
    inset: auto 0 0;
    width: min(100%, 620px);
    max-width: none;
    max-height: var(--goal-detail-sheet-max-height, 86vh);
    margin: auto auto 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #26322b;
    overflow: visible;
  }

  .goal-detail-sheet::backdrop {
    background: rgba(22, 29, 25, 0.42);
    backdrop-filter: blur(2px);
  }

  .goal-detail-sheet-panel {
    max-height: var(--goal-detail-sheet-max-height, 86vh);
    padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0;
    background: #f8f5ed;
    box-shadow: 0 -18px 44px rgba(26, 34, 29, 0.18);
    overflow: auto;
  }

  .goal-sheet-edit {
    padding: 10px 2px 4px;
  }

  .goal-sheet-edit .goal-compact-form {
    gap: 9px;
  }

  .goal-sheet-edit .form-grid:first-of-type,
  .goal-sheet-edit .form-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .goal-sheet-edit .form-grid:first-of-type {
    gap: 10px;
  }

  .goal-sheet-edit .goal-compact-form > label,
  .goal-sheet-edit .form-grid:first-of-type > label,
  .goal-sheet-edit .goal-time-fields > label {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 7px;
    align-items: center;
    min-width: 0;
  }

  .goal-sheet-edit .form-grid:first-of-type > label {
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px;
  }

  .goal-sheet-edit .goal-compact-form label > span {
    align-self: center;
    color: #68746d;
    font-size: 13px;
    line-height: 1.25;
    white-space: nowrap;
  }

  .goal-sheet-edit .goal-compact-form :is(input, select) {
    min-width: 0;
    min-height: 42px;
    padding: 7px 9px;
    font-size: 15px;
  }

  .goal-sheet-edit .goal-description-field {
    align-items: start;
  }

  .goal-sheet-edit .goal-description-field > span {
    padding-top: 9px;
  }

  .goal-sheet-edit .goal-description-field textarea {
    min-width: 0;
    min-height: 132px;
    height: 132px;
    padding: 8px 9px;
    font-size: 15px;
    line-height: 1.55;
  }

  .goal-sheet-edit .tag-picker {
    max-height: 68px;
    margin: -3px 0 0 51px;
    overflow-y: auto;
  }

  .goal-detail-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0 2px 12px;
    border-bottom: 1px solid rgba(54, 70, 59, 0.14);
  }

  .goal-detail-sheet-head span {
    color: #7b857f;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
  }

  .goal-detail-sheet-head h2 {
    margin: 2px 0 0;
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-size: 22px;
    line-height: 1.2;
  }

  .goal-detail-sheet-head button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #56635b;
    font-size: 21px;
  }

  .goal-sheet-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 8px 0;
  }

  .goal-sheet-meta > div {
    min-width: 0;
    padding: 10px 6px;
    border-bottom: 1px solid rgba(54, 70, 59, 0.1);
  }

  .goal-sheet-meta dt {
    margin-bottom: 3px;
    color: #7d8781;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
  }

  .goal-sheet-meta dd {
    margin: 0;
    color: #344038;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .goal-sheet-tags {
    padding: 4px 6px 12px;
  }

  .goal-sheet-tags h3 {
    margin: 0 0 7px;
    color: #7d8781;
    font-size: 11px;
    letter-spacing: 0.05em;
  }

  .goal-sheet-actions {
    display: grid;
    gap: 0;
    margin-top: 8px;
    border-top: 1px solid rgba(54, 70, 59, 0.14);
  }

  .goal-sheet-actions form {
    margin: 0;
  }

  .goal-sheet-action,
  .goal-sheet-actions button.goal-sheet-action {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    min-height: 50px;
    padding: 0 7px;
    border: 0;
    border-bottom: 1px solid rgba(54, 70, 59, 0.1);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #34453b;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
  }

  .goal-sheet-action i {
    width: 22px;
    color: #63756a;
    font-size: 20px;
    text-align: center;
  }

  .goal-sheet-action.danger,
  .goal-sheet-actions button.goal-sheet-action.danger,
  .goal-sheet-action.danger i {
    color: #b64f48;
  }
}

@media (max-width: 375px) {
  .shell-goals > .topbar.is-module-landing {
    padding-right: 8px;
    padding-left: 13px;
  }

  .shell-goals > .topbar.is-module-landing .module-page-title {
    font-size: 26px;
  }

  .shell-goals > .topbar.is-module-landing .module-page-meta {
    font-size: 11px;
  }

  .shell-goals .goal-section > details > summary {
    padding-right: 15px;
    padding-left: 13px;
  }

  .shell-goals .goal-list {
    padding-inline: 13px;
  }

  .goal-reading-paper {
    padding-inline: 13px;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  width: 100%;
  max-width: 100%;
  color-scheme: light;
  background: var(--bg);
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

@supports (scrollbar-gutter: stable) {
  html {
    overflow-y: auto;
  }
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

body.is-body-scroll-locked {
  position: fixed;
  top: var(--body-scroll-lock-top, 0);
  right: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
}

a {
  color: inherit;
}

.shell {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 52px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.topbar-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.module-page-meta,
.top-action-icon {
  display: none;
}

.top-actions-more-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.top-actions-menu-icon {
  display: none;
}

.top-actions-menu-label-added {
  display: inline;
}

.brand-lockup {
  width: max-content;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #f4f7fb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.top-actions-main,
.top-actions-system {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  min-width: 0;
}

.top-actions-system {
  padding-left: 2px;
  border-left: 1px solid var(--line-soft);
}

@media (min-width: 1041px) {
  .top-actions-system {
    display: none;
  }
}

.top-actions .top-actions-more,
.top-actions .top-actions-menu {
  display: none;
}

.top-actions .button,
.top-actions button {
  width: auto;
  min-height: 34px;
  padding: 7px 11px;
  border-color: transparent;
  border-radius: 5px;
  font-size: 13px;
  box-shadow: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.top-actions form {
  margin: 0;
}

.top-actions .button.secondary,
.top-actions button.secondary {
  background: transparent;
  color: #596579;
}

.top-actions .button.secondary:hover,
.top-actions button.secondary:hover {
  background: rgba(255, 255, 255, 0.66);
  color: var(--text);
}

.top-actions .button:not(.secondary),
.top-actions button:not(.secondary),
.top-actions button[aria-pressed="true"] {
  border-color: rgba(37, 99, 235, 0.18);
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(24, 33, 50, 0.07);
}

.top-actions .button:not(.secondary):hover,
.top-actions button:not(.secondary):hover,
.top-actions button[aria-pressed="true"]:hover {
  background: #ffffff;
  color: var(--accent-dark);
}

.topbar-system {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #f4f7fb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.density-icon-toggle {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.density-icon-toggle:hover,
.density-icon-toggle:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.density-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}

.goal-sections-toggle {
  width: 34px;
  min-width: 34px;
  padding-inline: 0;
  justify-content: center;
}

.goal-sections-toggle-icon {
  display: block;
  width: 18px;
  height: 18px;
}

.goal-sections-toggle > .top-actions-menu-label-added {
  display: none;
}

@media (min-width: 1041px) {
  .goal-sections-toggle-mobile {
    display: none !important;
  }
}

@media (min-width: 1041px) {
  .density-toggle-fallback {
    display: none !important;
  }
}

.topbar-side {
  display: flex;
  flex-direction: row-reverse;
  gap: 8px;
  align-items: center;
  justify-content: end;
}

.desktop-module-nav {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid #d5ddeb;
  border-radius: 8px;
  background: #eaf0f8;
  box-shadow: 0 5px 16px rgba(24, 33, 50, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.desktop-module-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 80px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.74);
  color: #334155;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.desktop-module-nav a::before {
  display: block;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: currentColor;
  content: "";
}

.desktop-module-nav a[data-module="goals"]::before {
  border: 2px solid currentColor;
  border-radius: 999px;
  box-shadow: inset 0 0 0 4px #ffffff, inset 0 0 0 6px currentColor;
}

.desktop-module-nav a[data-module="notes"]::before {
  border: 2px solid currentColor;
  border-radius: 5px;
  background:
    linear-gradient(currentColor, currentColor) 5px 5px / 7px 2px no-repeat,
    linear-gradient(currentColor, currentColor) 5px 10px / 6px 2px no-repeat;
}

.desktop-module-nav a[data-module="knowledge"]::before,
.desktop-module-nav a[data-module="notebooks"]::before {
  border: 2px solid currentColor;
  border-radius: 4px;
  background:
    linear-gradient(currentColor, currentColor) 4px 4px / 7px 2px no-repeat,
    linear-gradient(currentColor, currentColor) 4px 9px / 9px 2px no-repeat,
    linear-gradient(currentColor, currentColor) 4px 14px / 6px 2px no-repeat;
}

.desktop-module-nav a[data-module="calendar"]::before {
  border: 2px solid currentColor;
  border-radius: 5px;
  background:
    linear-gradient(currentColor, currentColor) 0 5px / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 4px 0 / 2px 5px no-repeat,
    linear-gradient(currentColor, currentColor) 11px 0 / 2px 5px no-repeat;
}

.desktop-module-nav a:hover {
  border-color: rgba(37, 99, 235, 0.28);
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: 0 4px 12px rgba(24, 33, 50, 0.07);
  transform: translateY(-1px);
}

.desktop-module-nav a.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.2);
}

.desktop-module-nav a.is-active[data-module="goals"]::before {
  box-shadow: inset 0 0 0 4px var(--accent), inset 0 0 0 6px currentColor;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 27px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
}

p {
  overflow-wrap: anywhere;
}

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

.summary div,
.panel,
.goal-row,
.note-card,
.knowledge-card,
.detail-card,
.login-card,
.rail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary div {
  padding: 12px;
}

.summary strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.summary span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.focus-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.focus-rail {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 12px;
}

.rail-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.rail-panel-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.rail-panel-head h2 {
  font-size: 15px;
}

.rail-panel-head span,
.rail-panel-head a,
.rail-hint,
.rail-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.rail-panel-head a {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.rail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rail-metrics div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
}

.rail-metrics strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.rail-metrics span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rail-priority-meter {
  display: flex;
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.rail-priority-segment {
  min-width: 0;
}

.rail-priority-high {
  background: #e11d48;
}

.rail-priority-medium {
  background: var(--accent);
}

.rail-priority-low {
  background: #94a3b8;
}

.rail-today-list {
  display: grid;
  gap: 8px;
}

.rail-quote-list {
  display: grid;
  gap: 8px;
}

.rail-quote {
  margin: 0;
  padding: 10px 11px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid rgba(37, 99, 235, 0.42);
  border-radius: 8px;
  background: var(--panel-soft);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.rail-quote[data-hover-tooltip] {
  cursor: help;
}

.rail-quote[data-hover-tooltip]:hover,
.rail-quote[data-hover-tooltip]:focus-visible {
  border-color: rgba(37, 99, 235, 0.28);
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(24, 33, 50, 0.07);
  outline: none;
}

.rail-quote p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55;
}

.rail-quote cite {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.3;
  text-align: right;
}

.rail-goal {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.rail-goal:hover,
.rail-goal:focus-within {
  border-color: rgba(37, 99, 235, 0.28);
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(24, 33, 50, 0.07);
}

.rail-goal a {
  display: grid;
  gap: 6px;
  padding: 10px;
  color: inherit;
  text-decoration: none;
}

.rail-goal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.rail-goal h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.rail-goal small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.rail-goal-relation {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.rail-day-link {
  justify-self: start;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.rail-day-link:hover {
  color: var(--accent-dark);
}

.rail-hint,
.rail-empty {
  margin: 0;
}

.rail-note-list {
  display: grid;
  gap: 8px;
}

.rail-note {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.rail-note:hover,
.rail-note:focus-within {
  border-color: rgba(37, 99, 235, 0.28);
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(24, 33, 50, 0.07);
}

.rail-note a {
  display: grid;
  gap: 8px;
  padding: 10px;
  color: inherit;
  text-decoration: none;
}

.rail-note p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.rail-note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mini-calendar {
  display: grid;
  gap: 8px;
}

.mini-calendar-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

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

.mini-calendar-weekdays span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.mini-calendar-day {
  display: grid;
  min-width: 0;
  min-height: 34px;
  place-items: center;
  padding: 4px 2px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.mini-calendar-day.is-outside-month {
  color: #a8b0bf;
}

.mini-calendar-day.is-today {
  border-color: rgba(37, 99, 235, 0.46);
  background: var(--accent-soft);
  color: var(--accent);
}

.mini-calendar-day b {
  display: flex;
  gap: 2px;
  align-items: center;
  min-height: 8px;
  margin-top: 3px;
}

.mini-calendar-day .priority-dot {
  width: 5px;
  height: 5px;
}

.goal-section {
  margin-top: 10px;
}

.goal-section:first-child {
  margin-top: 0;
}

.goal-section details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.goal-section.is-primary details {
  border-color: rgba(37, 99, 235, 0.4);
}

.goal-section > details > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 50px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.goal-section > details > summary::-webkit-details-marker {
  display: none;
}

.goal-section > details > summary strong {
  min-width: 32px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  text-align: center;
}

.goal-list {
  display: grid;
  gap: 0;
  padding: 0 14px 10px;
}

.goal-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 0 11px 14px;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.goal-index-row {
  grid-template-columns: minmax(0, 1fr);
}

.goal-row.is-current {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.04), transparent 34%);
}

.goal-row.is-completed {
  color: var(--muted);
  opacity: 0.82;
}

.goal-row.is-completed h2 {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.goal-row:hover,
.goal-row:focus-within {
  background: rgba(237, 244, 255, 0.68);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.goal-row.is-current:hover,
.goal-row.is-current:focus-within {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.1), rgba(237, 244, 255, 0.52) 44%, transparent);
}

.goal-row::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: var(--priority-color, var(--accent));
  content: "";
}

.goal-row-main {
  display: block;
  min-width: 0;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.goal-inline-detail,
.note-inline-detail {
  min-width: 0;
}

.goal-inline-detail > summary,
.note-inline-detail > summary {
  list-style: none;
}

.goal-inline-detail > summary::-webkit-details-marker,
.note-inline-detail > summary::-webkit-details-marker {
  display: none;
}

.goal-inline-detail[open] > summary,
.note-inline-detail[open] > summary {
  margin-bottom: 12px;
}

.inline-edit-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
}

.inline-edit-form {
  gap: 12px;
}

.note-inline-meta-fields {
  display: grid;
  grid-template-columns: minmax(100px, 0.65fr) minmax(150px, 1.35fr) auto;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.note-inline-meta-fields label {
  min-width: 0;
}

.note-inline-tag-head {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  min-height: 24px;
}

.note-inline-tag-head > span {
  flex: 0 0 auto;
}

.note-inline-tag-head .tag-picker {
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.note-inline-tag-head .tag-picker::-webkit-scrollbar {
  display: none;
}

.note-inline-pin-field {
  min-height: 44px;
  padding: 0 8px;
  white-space: nowrap;
}

@media (max-width: 1040px) {
  .note-inline-meta-fields {
    grid-template-columns: minmax(82px, 0.7fr) minmax(0, 1.3fr) auto;
    gap: 6px;
  }

  .note-inline-pin-field {
    padding-inline: 2px;
  }
}

.goal-inline-title-fields,
.goal-inline-meta-fields {
  display: grid;
  gap: 8px;
  align-items: start;
}

.goal-inline-title-fields {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}

.goal-inline-meta-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.goal-inline-title-fields label,
.goal-inline-meta-fields label {
  min-width: 0;
}

.goal-inline-tag-field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.goal-inline-tag-head {
  display: flex;
  min-width: 0;
  min-height: 24px;
  gap: 8px;
  align-items: center;
}

.goal-inline-tag-head .tag-picker {
  min-width: 0;
  margin-top: 0;
}

.inline-primary-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-secondary-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.inline-secondary-actions .button,
.inline-secondary-actions button {
  width: 100%;
}

.goal-inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.goal-inline-actions > form {
  display: flex;
  min-width: 0;
}

.goal-inline-actions > button,
.goal-inline-actions > form > button {
  width: 100%;
  min-width: 0;
}

@media (max-width: 1040px) {
  .goal-inline-actions > form:last-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1041px) {
  .goal-inline-actions {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.goal-row h2 {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.goal-title-text {
  min-width: 0;
}

.goal-row h2 .goal-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doing-now-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: #d81e06;
}

.doing-now-glyph {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.goal-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.goal-index-row .goal-row-main > .meta-row {
  margin: 6px 0 0;
}

.goal-index-row .goal-row-main > p {
  margin-top: 6px;
}

.goal-complete-form {
  display: flex;
  align-items: center;
  justify-content: center;
}

.goal-complete-button {
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-color: #99f6e4;
  border-radius: 999px;
  background: #f0fdfa;
  color: var(--success);
  font-size: 15px;
  line-height: 1;
}

.goal-complete-button:hover {
  border-color: var(--success);
  background: #ccfbf1;
  color: #0f766e;
}

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

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: var(--success);
  font-weight: 800;
}

.muted-status {
  background: #f1f5f9;
  color: #475569;
}

.trash-retention {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: #b45309;
  font-weight: 800;
}

.priority-badge {
  display: inline-flex;
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 800;
  justify-content: center;
}

.priority-high {
  background: #fff1f2;
  color: #be123c;
}

.priority-medium {
  background: var(--accent-soft);
  color: var(--accent);
}

.priority-low {
  background: #f1f5f9;
  color: #475569;
}

.goal-row.priority-row-high {
  --priority-color: #dc2626;
}

.goal-row.priority-row-medium {
  --priority-color: #2563eb;
}

.goal-row.priority-row-low {
  --priority-color: #8a929d;
}

.history-goal-row.priority-row-high {
  --priority-color: #dc2626;
}

.history-goal-row.priority-row-medium {
  --priority-color: #2563eb;
}

.history-goal-row.priority-row-low {
  --priority-color: #8a929d;
}

.goal-row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(64px, 1fr));
  gap: 6px;
}

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

.goal-create-dialog {
  width: min(720px, calc(100% - 32px));
  max-width: none;
  max-height: var(--goal-create-dialog-max-height, min(90vh, 820px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(24, 33, 50, 0.24);
}

.goal-create-dialog::backdrop {
  background: rgba(24, 33, 50, 0.42);
  backdrop-filter: blur(3px);
}

.goal-create-dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: var(--goal-create-dialog-max-height, min(90vh, 820px));
}

.goal-create-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.goal-create-dialog-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.goal-create-dialog-head h2,
.goal-create-dialog-head p {
  margin: 0;
}

.goal-create-dialog-head h2 {
  font-size: 18px;
  line-height: 1.3;
}

.goal-create-dialog-head p {
  color: var(--muted);
  font-size: 12px;
}

.goal-create-dialog-close {
  flex: 0 0 auto;
  width: 34px;
  min-width: 34px;
  padding-inline: 0;
  font-size: 20px;
}

.goal-create-dialog-body {
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.goal-row-actions {
  width: 140px;
}

.goal-row-actions .button,
.goal-row-actions button {
  width: 100%;
  white-space: nowrap;
}

.detail-card {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.detail-head h2 {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  font-size: 23px;
}

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

.detail-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.detail-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.detail-section p {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.markdown-body {
  display: grid;
  gap: 10px;
  color: var(--text);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

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

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--text);
  line-height: 1.35;
}

.markdown-body h1 {
  font-size: 22px;
}

.markdown-body h2 {
  font-size: 19px;
}

.markdown-body h3,
.markdown-body h4 {
  font-size: 16px;
}

.markdown-body p {
  margin: 0;
  color: var(--text);
  white-space: normal;
}

.markdown-body [data-notebook-align="center"] {
  text-align: center;
}

.markdown-body [data-notebook-align="right"] {
  text-align: right;
}

.markdown-body [data-notebook-align="center"] > .notebook-markdown-image {
  margin-right: auto;
  margin-left: auto;
}

.markdown-body [data-notebook-align="right"] > .notebook-markdown-image {
  margin-right: 0;
  margin-left: auto;
}

.shell-notebooks .markdown-body a:not(.notebook-markdown-image) {
  color: var(--notebook-link);
  text-decoration-color: color-mix(in srgb, var(--notebook-link) 62%, transparent);
  text-underline-offset: 0.15em;
}

.shell-notebooks .markdown-body a:not(.notebook-markdown-image):hover,
.shell-notebooks .markdown-body a:not(.notebook-markdown-image):focus-visible {
  color: var(--notebook-link-hover);
  text-decoration-color: currentColor;
}

.markdown-body ul,
.markdown-body ol {
  display: grid;
  gap: 6px;
  padding-left: 22px;
}

.markdown-task-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  list-style: none;
}

.markdown-task-item input {
  flex: 0 0 auto;
  width: 16px;
  min-height: 16px;
  margin: 5px 0 0;
  accent-color: var(--accent);
}

.notebook-visual-editor .markdown-task-item > span {
  flex: 1 1 auto;
  min-width: 0;
}

.markdown-body :is(ul, ol) :is(ul, ol) {
  margin: 6px 0 0;
}

.markdown-task-item > :is(ul, ol) {
  flex: 0 0 calc(100% - 24px);
  margin-left: 24px;
}

.markdown-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94em;
}

.markdown-body th,
.markdown-body td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: var(--panel-soft);
  font-weight: 800;
}

.markdown-body :is(th, td).is-align-center {
  text-align: center;
}

.markdown-body :is(th, td).is-align-right {
  text-align: right;
}

.markdown-body blockquote {
  margin-block: 14px;
  margin-inline: 0;
  padding-inline-start: 14px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.markdown-body > blockquote {
  margin-inline: 0;
}

.markdown-body blockquote p {
  color: inherit;
}

.markdown-body blockquote > :first-child {
  margin-top: 0;
}

.markdown-body blockquote > :last-child {
  margin-bottom: 0;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  white-space: pre;
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #334155;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 0.92em;
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
}

.notebook-code-block,
.notebook-code-editor-block {
  width: 100%;
  margin: 18px 0;
  border: 1px solid var(--notebook-rule, var(--line));
  border-radius: 6px;
  background: var(--notebook-surface, var(--panel));
  color: var(--notebook-ink-soft, var(--text));
  overflow: hidden;
}

.notebook-code-block-head,
.notebook-code-editor-head {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 14px;
  border-bottom: 1px solid var(--notebook-rule, var(--line));
  background: color-mix(in srgb, var(--notebook-surface, var(--panel)) 88%, var(--notebook-paper, var(--panel-soft)));
}

.notebook-code-block-head strong,
.notebook-code-block-title-empty {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--notebook-ink, var(--text));
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notebook-code-block-title-empty {
  color: var(--notebook-faint, var(--muted));
  font-weight: 500;
}

.notebook-code-block-language {
  flex: 0 0 auto;
  color: var(--notebook-muted, var(--muted));
  font-family: Inter, "Noto Sans SC", sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.notebook-code-block-language-select {
  flex: 0 1 132px;
  width: auto;
  min-width: 104px;
  max-width: 148px;
  min-height: 28px;
  padding: 3px 24px 3px 7px;
  border: 1px solid var(--notebook-rule, var(--line));
  border-radius: 3px;
  background: var(--notebook-surface, var(--panel));
  color: var(--notebook-muted, var(--muted));
  font-family: Inter, "Noto Sans SC", sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.notebook-code-block-language-select:focus-visible {
  border-color: var(--notebook-blue, var(--accent));
  outline: 2px solid color-mix(in srgb, var(--notebook-blue, var(--accent)) 18%, transparent);
  outline-offset: 1px;
}

.notebook-code-block-head button,
.notebook-code-editor-head button,
.notebook-code-editor-menu summary {
  flex: 0 0 auto;
  width: auto;
  min-width: 42px;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--notebook-muted, var(--muted));
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.notebook-code-block-head button:hover,
.notebook-code-block-head button:focus-visible,
.notebook-code-editor-head button:hover,
.notebook-code-editor-head button:focus-visible,
.notebook-code-editor-menu summary:hover,
.notebook-code-editor-menu summary:focus-visible {
  border-color: var(--notebook-rule, var(--line));
  background: var(--notebook-surface, var(--panel));
  color: var(--notebook-blue, var(--accent));
  outline: none;
}

.notebook-code-block-head button {
  min-width: auto;
  min-height: 28px;
  padding: 3px 7px;
}

.notebook-code-block-body {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  overflow: auto;
}

.notebook-code-block[style] .notebook-code-block-body {
  max-height: var(--notebook-code-height);
}

.notebook-code-block-body .notebook-code-line-numbers,
.notebook-code-editor-lines {
  display: flex;
  flex-direction: column;
  align-items: end;
  padding: 14px 10px 14px 6px;
  border-right: 1px solid var(--notebook-rule, var(--line));
  background: color-mix(in srgb, var(--notebook-paper, var(--panel-soft)) 42%, transparent);
  color: var(--notebook-faint, var(--muted));
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  line-height: 1.65;
  user-select: none;
}

.notebook-code-block-body pre {
  min-width: max-content;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.notebook-code-block-body pre code,
.notebook-code-editor-highlight,
.notebook-code-editor-input {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 4;
}

.notebook-code-block-body pre code {
  padding: 0;
  background: transparent;
  color: var(--notebook-ink-soft, var(--text));
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-link { color: #7c3aed; }
.hljs-string,
.hljs-title,
.hljs-name,
.hljs-type,
.hljs-attribute,
.hljs-symbol,
.hljs-bullet,
.hljs-addition,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable { color: #0f766e; }
.hljs-comment,
.hljs-quote,
.hljs-deletion,
.hljs-meta { color: #7b8188; }
.hljs-number,
.hljs-regexp,
.hljs-built_in,
.hljs-builtin-name,
.hljs-params { color: #b45309; }
.hljs-function .hljs-title,
.hljs-class .hljs-title { color: #1455cc; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

.notebook-content-source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
}

.notebook-visual-editor {
  display: grid;
  gap: 0;
  align-content: start;
  min-height: 56vh;
  border: 0;
  border-radius: 0;
  background: var(--notebook-surface, var(--panel));
  overflow: visible;
  cursor: text;
}

.notebook-visual-editor[hidden],
.notebook-editor-mode-markdown .notebook-visual-editor,
.notebook-editor-mode-visual textarea[name="content"][hidden] {
  display: none !important;
}

.notebook-editor-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.notebook-editor-mode-switch {
  display: inline-flex;
  gap: 6px;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.notebook-editor-mode-switch button {
  min-height: 32px;
  padding: 5px 13px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--notebook-muted, var(--muted));
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

.notebook-editor-mode-switch button.is-active,
.notebook-editor-mode-switch button[aria-pressed="true"] {
  background: var(--notebook-surface, var(--panel));
  color: var(--notebook-blue, var(--accent-dark));
  box-shadow: 0 1px 3px rgb(15 23 42 / 12%);
}

.notebook-editor-mode-switch button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--notebook-blue, var(--accent)) 38%, transparent);
  outline-offset: 1px;
}

.notebook-editor-mode-hint {
  color: var(--notebook-muted, var(--muted));
  font-size: 12px;
  font-weight: 650;
}

.notebook-visual-editor.markdown-body {
  display: block;
  min-height: 56vh;
  padding: 10px 10px clamp(18px, 3vw, 34px);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  caret-color: var(--notebook-blue, var(--accent));
}

.notebook-visual-editor.markdown-body:focus {
  outline: none;
}

.notebook-visual-editor.markdown-body > :first-child {
  margin-top: 0;
}

.notebook-visual-editor.markdown-body > :last-child {
  margin-bottom: 0;
}

.notebook-visual-editor.markdown-body a:not(.notebook-markdown-image) {
  cursor: text;
}

.notebook-visual-editor-incompatible {
  position: relative;
  opacity: 0.78;
  cursor: not-allowed;
}

.notebook-visual-editor-incompatible::before,
.notebook-visual-protected-block::before {
  display: block;
  margin-bottom: 8px;
  color: var(--notebook-muted, var(--muted));
  font-size: 12px;
  font-weight: 700;
  content: "此段需切到 Markdown 模式编辑";
}

.notebook-visual-protected-block {
  padding: 10px 12px;
  border: 1px dashed var(--notebook-rule, var(--line));
  border-radius: 6px;
  background: var(--notebook-surface-soft, var(--panel-soft));
}

.notebook-visual-editor .markdown-table-wrap,
.notebook-visual-editor .notebook-code-editor-block {
  position: relative;
}

.notebook-visual-editor .markdown-table-wrap {
  cursor: default;
}

.notebook-visual-editor .markdown-table-wrap :is(th, td) {
  cursor: text;
}

.notebook-visual-table-tools {
  position: sticky;
  left: 0;
  z-index: 1;
  display: flex;
  width: max-content;
  min-width: 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 6px;
  padding: 2px 0;
}

.notebook-visual-table-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.notebook-visual-table-tool-group + .notebook-visual-table-tool-group {
  padding-left: 8px;
  border-left: 1px solid var(--notebook-rule, var(--line));
}

.notebook-visual-table-tool-label {
  margin-right: 1px;
  color: var(--notebook-muted, var(--muted));
  font-size: 11px;
  font-weight: 700;
}

.notebook-visual-table-action {
  display: inline-flex;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--notebook-rule, var(--line));
  border-radius: 4px;
  background: var(--notebook-surface, var(--panel));
  color: var(--notebook-text, var(--ink));
  font-size: 16px;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.notebook-visual-table-action:focus-visible {
  border-color: var(--notebook-blue, var(--accent));
  background: color-mix(in srgb, var(--notebook-blue, var(--accent)) 7%, var(--notebook-surface, var(--panel)));
}

@media (hover: hover) and (pointer: fine) {
  .notebook-visual-table-action:hover {
    border-color: var(--notebook-blue, var(--accent));
    background: color-mix(in srgb, var(--notebook-blue, var(--accent)) 7%, var(--notebook-surface, var(--panel)));
  }
}

.notebook-visual-table-action:active {
  transform: scale(0.97);
}

.notebook-visual-table-action.is-danger {
  color: var(--danger, #b42318);
}

.notebook-visual-table-action:disabled {
  opacity: 0.42;
  cursor: default;
  transform: none;
}

.notebook-visual-editor :where(th, td)[contenteditable="true"]:focus {
  outline: 2px solid color-mix(in srgb, var(--notebook-blue, var(--accent)) 34%, transparent);
  outline-offset: -2px;
}

.notebook-visual-block-remove,
.notebook-visual-image-remove,
.notebook-code-editor-remove {
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--notebook-rule, var(--line));
  border-radius: 5px;
  background: var(--notebook-surface, var(--panel));
  color: var(--notebook-muted, var(--muted));
  font-size: 12px;
  font-weight: 700;
}

.notebook-visual-block-remove {
  position: sticky;
  left: 100%;
  margin-top: 8px;
}

.notebook-visual-image {
  margin: 0;
  cursor: default;
}

.notebook-visual-image-frame {
  position: relative;
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  margin: 14px 0;
  vertical-align: top;
  line-height: 0;
  cursor: default;
  isolation: isolate;
}

.notebook-visual-image-frame[data-notebook-image-width] {
  width: var(--notebook-image-width);
}

.notebook-visual-image-frame .notebook-markdown-image {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
}

.notebook-visual-image-frame .notebook-markdown-image img {
  width: 100%;
  max-width: none;
  height: auto;
}

.notebook-visual-image-frame:focus {
  outline: none;
}

.notebook-visual-image-frame.is-selected::after,
.notebook-visual-image-frame:focus-visible::after {
  position: absolute;
  inset: -3px;
  z-index: 2;
  border: 2px solid var(--notebook-blue, var(--accent));
  border-radius: 12px;
  pointer-events: none;
  content: "";
}

.notebook-visual-image-view,
.notebook-visual-image-frame .notebook-visual-image-remove,
.notebook-visual-image-size,
.notebook-visual-image-handle {
  visibility: hidden;
  opacity: 0;
}

.notebook-visual-image-frame.is-selected :where(
  .notebook-visual-image-view,
  .notebook-visual-image-remove,
  .notebook-visual-image-size,
  .notebook-visual-image-handle
),
.notebook-visual-image-frame:focus-visible :where(
  .notebook-visual-image-view,
  .notebook-visual-image-remove,
  .notebook-visual-image-size,
  .notebook-visual-image-handle
) {
  visibility: visible;
  opacity: 1;
}

.notebook-visual-image-view,
.notebook-visual-image-frame .notebook-visual-image-remove {
  position: absolute;
  top: 8px;
  z-index: 4;
  width: auto !important;
  min-width: 0 !important;
  min-height: 30px !important;
  padding: 4px 9px !important;
  border: 1px solid rgb(255 255 255 / 70%) !important;
  border-radius: 5px !important;
  background: rgb(21 23 26 / 82%) !important;
  color: #ffffff !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  box-shadow: 0 2px 10px rgb(15 23 42 / 24%) !important;
  backdrop-filter: blur(6px);
}

.notebook-visual-image-view {
  left: 8px;
}

.notebook-visual-image-frame .notebook-visual-image-remove {
  right: 8px;
  margin: 0 !important;
}

.notebook-visual-image-size {
  position: absolute;
  right: 50%;
  bottom: 8px;
  z-index: 4;
  padding: 4px 7px;
  border-radius: 4px;
  background: rgb(21 23 26 / 78%);
  color: #ffffff;
  font-family: var(--font-sans, sans-serif);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  transform: translateX(50%);
  pointer-events: none;
}

.notebook-visual-image-handle {
  position: absolute;
  z-index: 5;
  width: 20px;
  height: 20px;
  touch-action: none;
}

.notebook-visual-image-handle::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border: 2px solid var(--notebook-blue, var(--accent));
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgb(15 23 42 / 25%);
  transform: translate(-50%, -50%);
  content: "";
}

.notebook-visual-image-handle.is-nw { top: -11px; left: -11px; cursor: nwse-resize; }
.notebook-visual-image-handle.is-ne { top: -11px; right: -11px; cursor: nesw-resize; }
.notebook-visual-image-handle.is-e { top: 50%; right: -11px; cursor: ew-resize; transform: translateY(-50%); }
.notebook-visual-image-handle.is-se { right: -11px; bottom: -11px; cursor: nwse-resize; }
.notebook-visual-image-handle.is-sw { bottom: -11px; left: -11px; cursor: nesw-resize; }
.notebook-visual-image-handle.is-w { top: 50%; left: -11px; cursor: ew-resize; transform: translateY(-50%); }

.notebook-visual-image-frame :where(button, [data-notebook-image-resize]) {
  transition: opacity 120ms ease;
}

.notebook-code-editor-head .notebook-code-editor-remove {
  flex: 0 0 auto;
}

@media (max-width: 1040px) {
  .notebook-editor-mode-row {
    gap: 8px;
  }

  .notebook-editor-mode-switch {
    width: auto;
  }

  .notebook-editor-mode-hint {
    display: none;
  }

  .notebook-visual-editor.markdown-body {
    min-height: 60vh;
    padding: 10px 10px 28px;
  }

  .notebook-visual-block-remove,
  .notebook-visual-image-remove,
  .notebook-code-editor-remove {
    min-height: 36px;
  }

  .notebook-visual-table-action {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
  }

  .notebook-visual-image-view,
  .notebook-visual-image-frame .notebook-visual-image-remove {
    min-height: 36px !important;
  }

  .notebook-visual-image-handle {
    width: 26px;
    height: 26px;
  }

  .notebook-visual-image-handle.is-nw { top: -14px; left: -14px; }
  .notebook-visual-image-handle.is-ne { top: -14px; right: -14px; }
  .notebook-visual-image-handle.is-e { right: -14px; }
  .notebook-visual-image-handle.is-se { right: -14px; bottom: -14px; }
  .notebook-visual-image-handle.is-sw { bottom: -14px; left: -14px; }
  .notebook-visual-image-handle.is-w { left: -14px; }
}

.notebook-markdown-segment {
  align-self: start;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--notebook-ink-soft, var(--text));
  font: inherit;
  line-height: 1.85;
  overflow: hidden;
  resize: none;
}

.notebook-markdown-segment:focus,
.notebook-markdown-segment:focus-visible {
  outline: none;
  box-shadow: none;
}

.notebook-markdown-segment::placeholder {
  color: var(--notebook-faint, var(--muted));
}

.notebook-code-editor-block {
  width: calc(100% - 24px);
  margin: 14px 12px;
  border-radius: 5px;
  cursor: default;
}

.notebook-code-editor-block.is-collapsed .notebook-code-editor-body,
.notebook-code-editor-block.is-collapsed .notebook-code-resize-handle {
  display: none;
}

.notebook-code-editor-block.is-collapsed .notebook-code-editor-head {
  border-bottom: 0;
}

.notebook-code-editor-head input,
.notebook-code-editor-head select {
  min-height: 34px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
}

.notebook-code-editor-head input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 6px;
  color: var(--notebook-ink, var(--text));
  font-weight: 600;
}

.notebook-code-editor-head select {
  flex: 0 1 148px;
  width: 148px;
  padding: 4px 28px 4px 8px;
  color: var(--notebook-ink-soft, var(--text));
}

.notebook-code-editor-head :is(input, select):focus-visible {
  outline: 1px solid var(--notebook-rule, var(--line));
  outline-offset: 0;
}

.notebook-code-collapse {
  display: grid;
  flex: 0 0 28px !important;
  width: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  place-items: center;
}

.notebook-code-collapse i {
  font-size: 18px;
  line-height: 1;
}

.notebook-code-editor-copy {
  min-width: auto !important;
  min-height: 28px !important;
  padding: 3px 7px !important;
}

.notebook-code-editor-menu {
  position: relative;
}

.notebook-code-editor-menu summary {
  display: grid;
  place-items: center;
  list-style: none;
}

.notebook-code-editor-menu summary::-webkit-details-marker {
  display: none;
}

.notebook-code-editor-menu[open] {
  z-index: 3;
}

.notebook-code-editor-menu[open] > button {
  position: absolute;
  z-index: 2;
  right: 0;
  width: 150px;
  min-height: 38px;
  border: 1px solid var(--notebook-rule, var(--line));
  background: var(--notebook-surface, var(--panel));
  color: var(--notebook-ink-soft, var(--text));
  text-align: left;
  white-space: nowrap;
}

.notebook-code-editor-menu[open] > button:nth-of-type(1) {
  top: calc(100% + 4px);
  border-radius: 4px 4px 0 0;
}

.notebook-code-editor-menu[open] > button:nth-of-type(2) {
  top: calc(100% + 41px);
  border-radius: 0 0 4px 4px;
  color: var(--notebook-red, var(--danger));
}

.notebook-code-editor-body {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  height: var(--notebook-code-height, 220px);
  min-height: 140px;
  overflow: hidden;
}

.notebook-code-editor-lines {
  overflow: hidden;
}

.notebook-code-editor-stage {
  position: relative;
  min-width: 0;
  height: var(--weekly-viewport-height, 100dvh);
  background: var(--notebook-surface, var(--panel));
  overflow: hidden;
}

.notebook-code-editor-highlight,
.notebook-code-editor-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  white-space: pre;
  overflow: auto;
}

.notebook-code-editor-highlight {
  background: transparent;
  color: var(--notebook-ink-soft, var(--text));
  pointer-events: none;
}

.notebook-code-editor-input {
  z-index: 1;
  background: transparent;
  color: transparent;
  caret-color: var(--notebook-ink, var(--text));
  -webkit-text-fill-color: transparent;
  resize: none;
}

.notebook-code-editor-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--notebook-rule, var(--line));
}

.notebook-code-editor-input::selection {
  background: color-mix(in srgb, var(--notebook-blue, var(--accent)) 24%, transparent);
}

.notebook-code-resize-handle {
  position: relative;
  height: 14px;
  cursor: ns-resize;
  touch-action: none;
}

.notebook-code-resize-handle::after {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 64px;
  height: 4px;
  border-radius: 999px;
  background: var(--notebook-rule, var(--line));
  content: "";
  transform: translateX(-50%);
}

.notebook-code-resize-handle:focus-visible {
  outline: 1px solid var(--notebook-blue, var(--accent));
  outline-offset: -2px;
}

@media (forced-colors: active) {
  .notebook-code-editor-highlight {
    display: none;
  }

  .notebook-code-editor-input {
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
  }
}

.markdown-body hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
}

.notebook-markdown-image {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 14px 0;
  border-radius: 10px;
  cursor: zoom-in;
}

.notebook-markdown-image[data-notebook-image-width] {
  width: var(--notebook-image-width);
}

.notebook-markdown-image img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: min(72vh, 820px);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel-soft);
  object-fit: contain;
}

.notebook-markdown-image[data-notebook-image-width] img {
  width: 100%;
}

.detail-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  width: 100%;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  background: var(--accent);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: var(--accent-dark);
}

.button.secondary,
button.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}

.button.secondary:hover,
button.secondary:hover {
  background: #f4f7fb;
}

.button.danger,
button.danger {
  border-color: #fecdca;
  background: #ffffff;
  color: var(--danger);
}

.button.danger:hover,
button.danger:hover {
  background: #fff1f3;
}

.button.compact,
button.compact {
  width: auto;
  min-height: var(--control-height-compact);
  padding: 6px 10px;
  font-size: 13px;
}

/* Pure-icon controls must stay square when shared touch-height rules apply. */
.button.icon-only,
button.icon-only,
.button.compact:has(> i:only-child),
button.compact:has(> i:only-child),
.button.compact:has(> svg:only-child),
button.compact:has(> svg:only-child) {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
}

.confirm-dialog-open {
  overflow: hidden;
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(24, 33, 50, 0.34);
  opacity: 0;
  transition: opacity 140ms ease;
}

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

.confirm-backdrop.is-open {
  opacity: 1;
}

.confirm-dialog {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid rgba(180, 35, 24, 0.18);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 54px rgba(24, 33, 50, 0.2);
  transform: translateY(8px) scale(0.98);
  transition: transform 140ms ease;
}

.confirm-backdrop.is-open .confirm-dialog {
  transform: translateY(0) scale(1);
}

.confirm-dialog-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #fecdca;
  border-radius: 999px;
  background: #fff1f3;
  color: var(--danger);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.confirm-dialog-copy {
  min-width: 0;
}

.confirm-dialog-copy h2 {
  margin: 0;
  font-size: 18px;
}

.confirm-dialog-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.confirm-dialog-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.history-panel {
  padding: 0;
  overflow: hidden;
}

.history-panel-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  min-height: 54px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.history-panel-head h2 {
  font-size: 17px;
}

.history-panel-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.history-list {
  display: grid;
}

.history-goal-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px 12px 18px;
  border-top: 1px solid var(--line-soft);
}

.history-goal-row:first-child {
  border-top: 0;
}

.history-goal-row::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: var(--priority-color, var(--accent));
  content: "";
}

.history-goal-main {
  display: block;
  min-width: 0;
  color: inherit;
  cursor: pointer;
}

.history-goal-detail {
  min-width: 0;
}

.history-inline-panel {
  gap: 12px;
}

.history-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  align-items: center;
  margin: 0;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

.history-detail-meta > div {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.history-detail-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.history-detail-meta dd {
  margin: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.history-detail-meta-tags {
  flex: 1 1 140px;
}

.history-detail-meta-tags dd {
  min-width: 0;
  white-space: normal;
}

.history-detail-meta .tag-list {
  gap: 4px;
  margin: 0;
}

.history-detail-meta .tag {
  min-height: 22px;
  padding: 2px 7px;
  font-size: 12px;
}

@media (max-width: 430px) {
  .history-detail-meta {
    column-gap: 8px;
    font-size: 12px;
  }

  .history-detail-meta dt {
    font-size: 11px;
  }

  .history-detail-meta-tags {
    flex-basis: 116px;
  }
}

.history-detail-section {
  padding-top: 0;
  border-top: 0;
}

.history-goal-main > h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.history-goal-main > p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.history-goal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.history-goal-tags .tag {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-goal-tags.is-empty .tag {
  background: #f1f5f9;
  color: #64748b;
}

.history-row-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  gap: 6px;
  width: min(360px, 100%);
  margin-left: auto;
}

.history-row-actions .button,
.history-row-actions button {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 13px;
  white-space: nowrap;
}

.goal-row-actions .button.compact,
.goal-row-actions button.compact {
  width: 100%;
  min-height: 32px;
  padding: 6px;
}

.goals-simple-mode .summary {
  margin-bottom: 10px;
}

.goals-simple-mode .goal-list {
  gap: 4px;
}

.goals-simple-mode .goal-row {
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
}

.goals-simple-mode .goal-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 12px;
}

.goals-simple-mode .goal-row h2 {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goals-simple-mode .goal-row p,
.goals-simple-mode .goal-complete-form,
.goals-simple-mode .goal-row-actions {
  display: none;
}

.goals-simple-mode .goal-row .meta-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
  max-width: min(40vw, 240px);
  margin: 0;
  overflow: hidden;
  gap: 4px;
}

.goals-simple-mode .goal-row .meta-row > :not(.tag) {
  display: none;
}

.goals-simple-mode .goal-row .tag {
  flex: 0 1 auto;
  max-width: 120px;
  min-height: 22px;
  padding: 2px 7px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goals-simple-mode .week-goal-row .goal-row-main {
  grid-template-columns: minmax(0, 1fr);
}

.goals-simple-mode .week-goal-row .goal-row-main > .meta-row {
  display: none;
}

.goals-simple-mode .week-goal-row .goal-row-main > h2 {
  grid-row: 1;
  grid-column: 1;
  width: 100%;
  text-align: left;
}

.goals-simple-mode .history-list {
  gap: 4px;
}

.goals-simple-mode .history-goal-row {
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
}

.goals-simple-mode .history-goal-row::before {
  top: 8px;
  bottom: 8px;
}

.goals-simple-mode .history-goal-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 12px;
  min-height: 40px;
  padding: 9px 12px 9px 16px;
}

.goals-simple-mode .history-goal-main > h2 {
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goals-simple-mode .history-goal-main > p,
.goals-simple-mode .history-row-actions {
  display: none;
}

.goals-simple-mode .history-goal-main > .meta-row {
  grid-column: 2;
  grid-row: 1;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
}

.goals-simple-mode .history-goal-main > .meta-row > * {
  display: none;
}

.goals-simple-mode .history-goal-main > .meta-row > :is(.history-goal-category, .history-goal-time) {
  display: inline-flex;
}

.goals-simple-mode .history-goal-category {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.goals-simple-mode .history-goal-time {
  color: var(--muted);
}

.goals-simple-mode .history-goal-time::before {
  margin-right: 4px;
  content: "·";
}

.goals-simple-mode .history-goal-detail[open] .history-row-actions {
  display: grid;
}

.goals-simple-mode .history-goal-tags {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
  max-width: min(40vw, 240px);
  margin: 0;
  overflow: hidden;
  gap: 4px;
}

.goals-simple-mode .history-goal-tags .tag {
  flex: 0 1 auto;
  max-width: 120px;
  min-height: 22px;
  padding: 2px 7px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1040px) {
  .goals-simple-mode .history-goal-main {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 3px 8px;
    min-height: 54px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .goals-simple-mode .history-goal-main > h2 {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .goals-simple-mode .history-goal-main > .meta-row {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    overflow: hidden;
  }

  .goals-simple-mode .history-goal-time {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .goals-simple-mode .history-goal-tags {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (min-width: 1041px) and (hover: hover) and (pointer: fine) {
  .goals-simple-mode .goal-section,
  .goals-simple-mode .history-panel {
    position: relative;
    overflow: visible;
  }

  .goals-simple-mode .goal-section details {
    overflow: visible;
  }

  .goals-simple-mode:not(.goals-sort-mode) .goal-section:hover,
  .goals-simple-mode:not(.goals-sort-mode) .goal-section:focus-within,
  .goals-simple-mode .history-panel:hover,
  .goals-simple-mode .history-panel:focus-within {
    z-index: 60;
  }

  .goals-simple-mode:not(.goals-sort-mode) .goal-index-row[data-goal-tooltip]:hover,
  .goals-simple-mode:not(.goals-sort-mode) .goal-index-row[data-goal-tooltip]:focus-within,
  .goals-simple-mode .history-goal-row[data-goal-tooltip]:hover,
  .goals-simple-mode .history-goal-row[data-goal-tooltip]:focus-within {
    z-index: 70;
  }
}

.goal-hover-tooltip {
  position: fixed;
  z-index: 120;
  width: max-content;
  max-width: min(420px, calc(100vw - 80px));
  padding: 10px 12px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(24, 33, 50, 0.14);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
  pointer-events: none;
  white-space: pre-line;
}

.goal-hover-tooltip[hidden] {
  display: none;
}

.goal-drag-handle {
  display: none;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-color: var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  touch-action: none;
  cursor: grab;
}

.goal-drag-grip {
  display: block;
  width: 16px;
  height: 20px;
  fill: currentColor;
  pointer-events: none;
}

@media (min-width: 1041px) and (hover: hover) and (pointer: fine) {
  [data-goal-sort-toggle] {
    display: none;
  }
}

.goals-sort-mode .goal-row {
  grid-template-columns: 36px minmax(0, 1fr);
}

.goals-sort-mode .goal-drag-handle {
  display: inline-grid;
  place-items: center;
}

.goals-sort-mode .goal-row-actions {
  display: none;
}

.goals-sort-mode .goal-complete-form {
  display: none;
}

.goals-sort-mode .goal-row-main {
  pointer-events: none;
}

.goals-sort-mode .inline-edit-panel {
  display: none;
}

.goals-sort-mode .goal-inline-detail[open] > summary {
  margin-bottom: 0;
}

.goal-row.is-dragging {
  opacity: 0.92;
  box-shadow: 0 12px 28px rgba(24, 33, 50, 0.18);
  cursor: grabbing;
  user-select: none;
}

.goals-is-dragging,
.goals-is-dragging * {
  user-select: none;
  -webkit-user-select: none;
}

.goal-drop-placeholder {
  min-height: 42px;
  border: 1px dashed rgba(37, 99, 235, 0.55);
  border-radius: 8px;
  background: #eff6ff;
}

.goal-section.is-drop-target details {
  border-color: rgba(37, 99, 235, 0.68);
  background: #fbfdff;
}

.goals-sort-saving .goal-overview {
  cursor: progress;
}

.goal-reorder-status {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 130;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  box-shadow: var(--shadow-soft);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.goal-reorder-status.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.goal-reorder-status[data-state="saved"] {
  color: var(--success);
}

.goal-reorder-status[data-state="error"] {
  color: var(--danger);
}

.goals-sort-saving .goal-row {
  cursor: progress;
}

@media (max-width: 1040px) {
  .goal-reorder-status {
    right: 14px;
    bottom: auto;
    max-width: calc(100vw - 28px);
    white-space: nowrap;
  }
}

@media (pointer: fine) {
  .goal-overview .goal-row {
    cursor: grab;
  }

  .goal-overview .goal-row:active {
    cursor: grabbing;
  }
}

.calendar-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(76px, 1fr));
  gap: 4px;
  margin-bottom: 12px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.calendar-tabs a {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 5px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.calendar-tabs a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.calendar-range-strip {
  display: none;
}

.calendar-date-toggle {
  display: none;
}

.week-controls {
  display: grid;
  grid-template-columns: minmax(88px, auto) minmax(240px, 1fr) minmax(88px, auto) minmax(88px, auto);
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}

.week-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(88px, auto);
  gap: 6px;
}

.week-picker input {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1.2;
}

.week-picker button {
  width: 100%;
}

.week-controls > .button,
.week-picker button {
  min-height: 36px;
  padding: 6px 10px;
}

.week-board {
  display: grid;
  gap: 10px;
}

.week-day {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.week-day.is-today {
  border-color: rgba(37, 99, 235, 0.72);
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 42%);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.16), 0 10px 26px rgba(37, 99, 235, 0.1);
}

.week-day.is-today::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
  content: "";
}

.week-day-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.week-day.is-today .week-day-head {
  background: var(--accent-soft);
  border-bottom-color: rgba(37, 99, 235, 0.18);
}

.week-day-head div {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.week-day-head span {
  color: var(--muted);
  font-size: 13px;
}

.week-day-head b {
  min-width: 30px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  text-align: center;
}

.today-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.week-goal-list {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.week-row-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 140px;
}

.week-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 800;
}

.week-empty {
  margin: 0;
  padding: 8px 2px;
}

.calendar-long-ranges {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.calendar-long-ranges header,
.calendar-long-ranges > summary {
  display: grid;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.calendar-long-ranges header {
  grid-template-columns: minmax(0, 1fr) auto;
}

.calendar-long-ranges > summary {
  grid-template-columns: minmax(0, 1fr) auto auto;
  cursor: pointer;
  list-style: none;
}

.calendar-long-ranges > summary::-webkit-details-marker {
  display: none;
}

.calendar-long-ranges > summary::after {
  width: 7px;
  height: 7px;
  margin: 0 3px 3px 1px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: var(--muted);
  content: "";
  transform: rotate(45deg);
  transition: transform 140ms ease, margin 140ms ease;
}

.calendar-long-ranges[open] > summary::after {
  margin-top: 4px;
  margin-bottom: 0;
  transform: rotate(225deg);
}

.calendar-long-ranges:not([open]) > summary {
  border-bottom-color: transparent;
}

.calendar-long-ranges > summary:hover,
.calendar-long-ranges > summary:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.calendar-long-ranges h2 {
  font-size: 16px;
}

.calendar-long-ranges :where(header, summary) strong {
  min-width: 30px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  text-align: center;
}

.range-goal-list {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.range-goal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 28%);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: inherit;
  text-decoration: none;
}

.range-goal.is-completed {
  background: #f8fafc;
  opacity: 0.78;
}

.range-goal.is-completed h2 {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.range-goal.priority-row-high {
  border-left: 4px solid #e11d48;
}

.range-goal.priority-row-medium {
  border-left: 4px solid var(--accent);
}

.range-goal.priority-row-low {
  border-left: 4px solid #94a3b8;
}

.range-goal-main {
  min-width: 0;
}

.range-goal-main h2 {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 8px;
  border-radius: 999px;
}

.priority-fill-high {
  background: #e11d48;
}

.priority-fill-medium {
  background: var(--accent);
}

.priority-fill-low {
  background: #94a3b8;
}

.month-controls {
  display: grid;
  grid-template-columns: minmax(88px, auto) minmax(240px, 1fr) minmax(88px, auto) minmax(88px, auto);
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}

.month-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(88px, auto);
  gap: 6px;
}

.month-picker input,
.month-picker button,
.month-controls > .button {
  min-height: 36px;
  padding: 6px 10px;
}

.month-picker input {
  font-size: 14px;
  line-height: 1.2;
}

.month-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.month-weekdays div {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

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

.month-day {
  position: relative;
  min-width: 0;
  min-height: 118px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  overflow: hidden;
}

.month-day.is-outside-month {
  background: #f8fafc;
  color: var(--muted);
}

.month-day.is-today {
  border-color: rgba(37, 99, 235, 0.78);
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 48%);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.16), 0 10px 24px rgba(37, 99, 235, 0.1);
}

.month-day.is-today::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--accent);
  content: "";
}

.month-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
}

.month-date-wrap {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.month-date {
  font-weight: 900;
  line-height: 1;
}

.month-day.is-today .month-date {
  color: var(--accent);
}

.month-day-head b {
  min-width: 24px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.month-goals {
  display: grid;
  gap: 4px;
}

.month-goal {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 4px;
  align-items: center;
  min-height: 24px;
  padding: 3px 5px;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
}

.month-goal.is-completed {
  background: #f1f5f9;
  color: var(--muted);
}

.month-goal.is-completed span:nth-child(2) {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.month-goal span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-goal small {
  display: none;
}

.month-goal b {
  padding: 1px 4px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 11px;
  line-height: 1.2;
}

.month-goal .completed-badge {
  background: #e2e8f0;
  color: #475569;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.priority-dot-high {
  background: #e11d48;
}

.priority-dot-medium {
  background: var(--accent);
}

.priority-dot-low {
  background: #94a3b8;
}

.month-more {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-day-strip {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.calendar-day-strip a,
.calendar-day-strip strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 6px;
  text-decoration: none;
}

.calendar-day-strip a {
  color: var(--accent);
  font-size: 20px;
  font-weight: 900;
}

.calendar-day-strip strong {
  overflow: hidden;
  padding: 0 8px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-day-detail {
  display: grid;
  gap: 10px;
}

.calendar-day-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.calendar-day-head h2 {
  font-size: 18px;
}

.calendar-day-head a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.day-goal-list {
  padding: 0;
}

.day-empty {
  margin: 0;
}

.note-capture,
.note-filter-panel {
  margin-top: 12px;
}

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

.note-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.pinned-notes {
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}

.pinned-notes > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.pinned-notes > summary::-webkit-details-marker {
  display: none;
}

.pinned-notes > summary strong {
  min-width: 30px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  text-align: center;
}

.pinned-note-list {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}

.note-card {
  position: relative;
  padding: 12px;
  border-color: var(--line-soft);
  box-shadow: var(--shadow-soft);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.note-card.is-pinned {
  border-color: rgba(37, 99, 235, 0.34);
  background: #fbfdff;
}

.note-card:hover,
.note-card:focus-within {
  border-color: rgba(37, 99, 235, 0.32);
  background: #fbfdff;
  box-shadow: 0 8px 22px rgba(24, 33, 50, 0.08);
}

.note-card-main {
  min-width: 0;
}

.note-inline-detail {
  grid-column: 1 / -1;
}

.note-card-summary {
  display: block;
  cursor: pointer;
}

.note-excerpt-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.note-excerpt {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
}

.note-menu-toggle {
  width: auto;
  min-height: 32px;
  margin-left: auto;
  padding: 6px 10px;
}

.note-menu-popover {
  position: absolute;
  top: 44px;
  right: 10px;
  z-index: 4;
  display: grid;
  gap: 6px;
  min-width: 132px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

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

.note-menu-popover .button.compact,
.note-menu-popover button.compact {
  width: 100%;
  min-height: 32px;
  padding: 6px;
}

.note-meta {
  margin-bottom: 7px;
  padding-right: 0;
}

.deleted-note-actions {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.deleted-note-actions .button,
.deleted-note-actions button {
  width: 100%;
}

@media (min-width: 1041px) {
  .note-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
  }

  .note-menu-toggle {
    display: none;
  }

  .note-menu-popover,
  .note-menu-popover[hidden] {
    position: static;
    z-index: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    align-self: start;
    min-width: 248px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .deleted-note-actions {
    grid-template-columns: repeat(2, minmax(84px, 1fr));
    align-self: start;
    min-width: 180px;
    margin-top: 0;
  }
}

.knowledge-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}

.knowledge-main {
  min-width: 0;
}

.knowledge-filter-panel {
  padding: 14px;
}

.knowledge-filter {
  gap: 10px;
}

.knowledge-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.knowledge-card {
  padding: 0;
  box-shadow: var(--shadow-soft);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.knowledge-card:hover,
.knowledge-card:focus-within {
  border-color: rgba(37, 99, 235, 0.3);
  background: #fbfdff;
  box-shadow: 0 8px 22px rgba(24, 33, 50, 0.08);
}

.knowledge-card-main {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 13px 14px;
  color: inherit;
  text-decoration: none;
}

.knowledge-card-main h2 {
  font-size: 18px;
  line-height: 1.35;
}

.knowledge-meta {
  margin-bottom: 0;
}

.knowledge-excerpt {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.knowledge-rail {
  display: grid;
  gap: 12px;
}

.knowledge-rail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.knowledge-rail-list {
  display: grid;
  gap: 8px;
}

.knowledge-rail-link {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  color: inherit;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.knowledge-rail-link:hover,
.knowledge-rail-link:focus-visible {
  border-color: rgba(37, 99, 235, 0.28);
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(24, 33, 50, 0.07);
  outline: none;
}

.knowledge-rail-link span {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
}

.knowledge-rail-link small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.archived-knowledge-actions {
  display: grid;
  gap: 6px;
  padding: 0 14px 14px;
}

.archived-knowledge-actions .button,
.archived-knowledge-actions button {
  width: 100%;
}

.knowledge-form textarea {
  min-height: 360px;
}

.notebook-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}

.notebook-sidebar,
.notebook-main {
  min-width: 0;
}

.notebook-sidebar {
  display: grid;
  gap: 0;
}

.notebook-tree-shell {
  display: grid;
  gap: 0;
  min-height: 0;
  padding: 10px 0 12px;
  border-right: 1px solid var(--line-soft);
  background: var(--panel);
  overflow: visible;
}

.notebook-tree-library {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  color: var(--text);
}

.notebook-tree-library-mark {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 1px solid #8ab4f8;
  border-radius: 5px;
  background: linear-gradient(90deg, #7aa7f6 0 4px, #dbeafe 4px 100%);
}

.notebook-tree-library strong {
  overflow: hidden;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notebook-tree-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  padding: 10px 8px 8px;
}

.notebook-tree-search input {
  min-height: 34px;
  padding: 7px 10px;
  border-color: transparent;
  border-radius: 8px;
  background: #f4f5f5;
  color: var(--text);
  font-size: 14px;
}

.notebook-tree-search button,
.notebook-tree-search a {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #ffffff;
  color: #5f6368;
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.notebook-tree-search button:hover,
.notebook-tree-search button:focus-visible,
.notebook-tree-search a:hover,
.notebook-tree-search a:focus-visible {
  background: #f1f3f4;
  color: #202124;
  outline: none;
}

.notebook-tree-home,
.notebook-tree-titlebar {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  margin: 0 8px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}

.notebook-tree-home,
.notebook-tree-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}

.notebook-tree-home:hover,
.notebook-tree-home:focus-visible {
  background: #f1f3f4;
  outline: none;
}

.notebook-tree-home-icon,
.notebook-tree-title-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  color: #33373b;
  font-size: 18px;
  line-height: 1;
}

.notebook-tree-titlebar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.notebook-tree-title {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.notebook-tree-title-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.notebook-tree-title-action {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #7a7d80;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
}

.notebook-tree-title-action:hover,
.notebook-tree-title-action:focus-visible {
  background: #f1f3f4;
  color: #2b2f33;
  outline: none;
}

.notebook-tree-titlebar.is-notebook-drop-target {
  background: #edf2f7;
}

.notebook-tree-scroll {
  max-height: min(72vh, 760px);
  overflow-y: auto;
  padding: 4px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: #dddddd transparent;
}

.notebook-tree-scroll::-webkit-scrollbar {
  width: 10px;
}

.notebook-tree-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.notebook-tree-scroll::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #dcdcdc;
  background-clip: content-box;
}

.notebook-tree {
  margin: 0;
}

.notebook-tree,
.notebook-tree ul {
  display: grid;
  gap: 0;
  padding: 0;
  list-style: none;
}

.notebook-tree ul {
  margin: 0;
  padding-left: 18px;
}

.notebook-tree-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.notebook-tree-row {
  margin: 0 8px;
  padding: 0 6px;
}

.notebook-tree-link,
.notebook-tree-note-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 0;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.notebook-tree-note-link {
  color: #33373b;
  font-size: 14px;
}

.notebook-tree-row:hover,
.notebook-tree-row:focus-within,
.notebook-tree-row.is-current {
  background: #f1f3f4;
}

.notebook-tree-link:hover,
.notebook-tree-link:focus-visible,
.notebook-tree-note-link:hover,
.notebook-tree-note-link:focus-visible,
.notebook-tree-link.is-active {
  color: #202124;
  outline: none;
}

.notebook-tree-link span,
.notebook-tree-note-link span {
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notebook-tree-link.is-active span,
.notebook-tree-note-link.is-active span {
  font-weight: 800;
}

.notebook-tree-note-link span {
  font-weight: 500;
}

.notebook-tree-link small {
  display: none;
}

.notebook-tree-toggle,
.notebook-tree-toggle-spacer,
.notebook-tree-action {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: #555b60;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.notebook-tree-toggle {
  border: 0;
  cursor: pointer;
  transform: rotate(90deg);
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

.notebook-tree-toggle[aria-expanded="false"] {
  transform: rotate(0deg);
}

.notebook-tree-toggle-spacer {
  opacity: 0;
}

.notebook-tree-action {
  border: 0;
}

.notebook-tree-toggle:hover,
.notebook-tree-toggle:focus-visible,
.notebook-tree-action:hover,
.notebook-tree-action:focus-visible {
  border-color: rgba(37, 99, 235, 0.32);
  background: #e7e9eb;
  color: #202124;
  outline: none;
}

.notebook-tree-more {
  font-size: 19px;
}

.notebook-tree-actions {
  position: relative;
  display: flex;
  gap: 4px;
  align-items: center;
  opacity: 0;
  transition: opacity 120ms ease;
}

.notebook-tree-row:hover .notebook-tree-actions,
.notebook-tree-row:focus-within .notebook-tree-actions {
  opacity: 1;
}

.notebook-tree-actions form {
  display: contents;
}

.notebook-tree-menu {
  position: relative;
}

.notebook-tree-menu summary {
  list-style: none;
}

.notebook-tree-menu summary::-webkit-details-marker {
  display: none;
}

.notebook-tree-menu[open] > summary {
  background: #e7e9eb;
  color: #202124;
}

.notebook-tree-menu-popover {
  position: fixed;
  top: var(--notebook-menu-top, 0);
  left: var(--notebook-menu-left, 0);
  z-index: 1000;
  display: grid;
  min-width: 188px;
  padding: 6px 0;
  border: 1px solid #e6e8ea;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(20, 24, 30, 0.14);
}

.notebook-tree-menu-popover a,
.notebook-tree-menu-popover button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #303336;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
}

.notebook-tree-menu-popover a:hover,
.notebook-tree-menu-popover a:focus-visible,
.notebook-tree-menu-popover button:hover,
.notebook-tree-menu-popover button:focus-visible {
  background: #f5f6f7;
  color: #202124;
  outline: none;
  box-shadow: none;
}

.notebook-tree-menu-popover form {
  border-top: 1px solid #eceeef;
  margin-top: 6px;
  padding-top: 6px;
}

.notebook-tree-menu-popover form button {
  color: #202124;
}

.notebook-tree-empty {
  margin: 8px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.notebook-tree-titlebar.is-notebook-drop-target,
.notebook-tree-row.is-notebook-drop-target {
  border-color: transparent;
  background: #e9eef5;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.notebook-tree-item.is-notebook-drag-source > .notebook-tree-row {
  opacity: 0.42;
}

.notebook-tree-drag-ghost {
  position: fixed;
  z-index: 260;
  pointer-events: none;
  cursor: grabbing;
  border: 1px solid rgba(37, 99, 235, 0.34);
  background: var(--panel);
  box-shadow: 0 12px 26px rgba(24, 33, 50, 0.18);
}

.notebooks-is-dragging,
.notebooks-is-dragging * {
  cursor: grabbing !important;
  user-select: none;
}

@media (hover: none) {
  .notebook-tree-actions {
    opacity: 1;
  }
}

.notebook-head-panel,
.notebook-filter-panel,
.notebook-form-panel {
  padding: 14px;
}

.notebook-home-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

.notebook-home-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.notebook-home-list {
  display: grid;
  gap: 8px;
}

.notebook-home-note {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  color: inherit;
  text-decoration: none;
}

.notebook-home-note:hover,
.notebook-home-note:focus-visible {
  border-color: rgba(37, 99, 235, 0.28);
  background: #ffffff;
  outline: none;
}

.notebook-home-note span {
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 900;
}

.notebook-home-note small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.notebook-head-panel {
  display: grid;
  gap: 8px;
}

.notebook-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.notebook-breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.notebook-breadcrumbs a:hover,
.notebook-breadcrumbs a:focus-visible {
  color: var(--accent);
}

.notebook-head-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: end;
  justify-content: space-between;
}

.notebook-head-title h2 {
  font-size: 22px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.notebook-head-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.notebook-filter {
  gap: 10px;
}

.notebook-content-list,
.notebook-recent-list {
  display: grid;
  gap: 10px;
}

.notebook-content-list {
  margin-top: 12px;
}

.notebook-row {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.notebook-row:hover,
.notebook-row:focus-within {
  border-color: rgba(37, 99, 235, 0.28);
  background: #fbfdff;
  box-shadow: 0 8px 22px rgba(24, 33, 50, 0.08);
}

.notebook-row-main {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 13px 14px;
  color: inherit;
  text-decoration: none;
}

.notebook-row-main h2 {
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.notebook-meta {
  margin-bottom: 0;
}

.notebook-kind {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

.notebook-kind.note-kind {
  background: #eef2ff;
  color: #4338ca;
}

.notebook-excerpt {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.notebook-row-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(68px, 1fr));
  gap: 6px;
  padding: 0 14px 14px;
}

.notebook-row-actions form,
.notebook-row-actions .button,
.notebook-row-actions button {
  width: 100%;
}

.notebook-recent-link {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  color: inherit;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.notebook-recent-link:hover,
.notebook-recent-link:focus-visible {
  border-color: rgba(37, 99, 235, 0.28);
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(24, 33, 50, 0.07);
  outline: none;
}

.notebook-recent-link span {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.notebook-recent-link small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.notebook-empty {
  margin-top: 12px;
}

.notebook-note-form textarea {
  min-height: 420px;
}

.notebook-delete-form {
  display: flex;
  justify-content: flex-start;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.notebook-detail-actions form {
  display: contents;
}

.markdown-guide-intro {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.markdown-guide-intro p {
  margin: 0;
  color: var(--muted);
}

.markdown-guide-tips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.markdown-guide-tips span {
  display: inline-flex;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.markdown-guide-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.markdown-guide-example {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.markdown-guide-copy {
  display: grid;
  gap: 4px;
}

.markdown-guide-copy h2 {
  font-size: 18px;
}

.markdown-guide-copy p {
  margin: 0;
  color: var(--muted);
}

.markdown-guide-pair {
  display: grid;
  gap: 10px;
}

.markdown-guide-source,
.markdown-guide-preview {
  min-width: 0;
}

.markdown-guide-source h3,
.markdown-guide-preview h3 {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.markdown-guide-source pre {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow-x: auto;
}

.markdown-guide-source code {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  white-space: pre;
}

.markdown-guide-preview .markdown-body {
  min-height: 100%;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
}

@media (min-width: 1041px) {
  .knowledge-filter {
    grid-template-columns: minmax(0, 1.4fr) minmax(170px, 0.7fr) auto;
    align-items: end;
  }

  .notebook-filter {
    grid-template-columns: minmax(0, 1.4fr) minmax(170px, 0.7fr) auto;
    gap: 8px;
    align-items: center;
  }

  .notebook-filter-panel {
    padding: 8px 10px;
  }

  .notebook-filter > label {
    gap: 0;
  }

  .notebook-filter :where(input, select, .button, button) {
    height: 36px;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1.3;
  }

  .notebook-filter .form-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .knowledge-filter .form-actions,
  .notebook-filter .form-actions {
    align-self: center;
  }

  .notebook-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .notebook-row-actions {
    grid-template-columns: repeat(3, minmax(68px, 84px));
    align-self: start;
    min-width: 240px;
    padding: 13px 14px 13px 0;
  }

  .archived-knowledge-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
  }

  .archived-knowledge-actions {
    grid-template-columns: repeat(2, minmax(84px, 1fr));
    align-self: start;
    min-width: 180px;
    padding: 13px 14px 13px 0;
  }

  .markdown-guide-pair {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (min-width: 1041px) {
  .knowledge-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
  }

  .notebook-layout {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
  }

  .knowledge-rail,
  .notebook-sidebar {
    position: sticky;
    top: 16px;
  }
}

.importance,
.pin-label,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.importance-normal {
  background: #f1f5f9;
  color: #475569;
}

.importance-important {
  background: #fff7ed;
  color: #9a3412;
}

.importance-critical {
  background: #fff1f2;
  color: #be123c;
}

.pin-label {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -6px;
}

.tag {
  background: var(--tag-bg, #ecfdf5);
  color: var(--tag-fg, var(--success));
  text-decoration: none;
}

.tag-color-0 {
  --tag-bg: #ecfdf5;
  --tag-fg: #047857;
  --tag-hover-bg: #d1fae5;


}

.tag-color-1 {
  --tag-bg: #eff6ff;
  --tag-fg: #1d4ed8;
  --tag-hover-bg: #dbeafe;


}

.tag-color-2 {
  --tag-bg: #fffbeb;
  --tag-fg: #b45309;
  --tag-hover-bg: #fef3c7;


}

.tag-color-3 {
  --tag-bg: #fff1f2;
  --tag-fg: #be123c;
  --tag-hover-bg: #ffe4e6;


}

.tag-color-4 {
  --tag-bg: #eef2ff;
  --tag-fg: #4338ca;
  --tag-hover-bg: #e0e7ff;


}

.tag-color-5 {
  --tag-bg: #ecfeff;
  --tag-fg: #0e7490;
  --tag-hover-bg: #cffafe;


}

.tag-color-6 {
  --tag-bg: #f7fee7;
  --tag-fg: #4d7c0f;
  --tag-hover-bg: #ecfccb;


}

.tag-color-7 {
  --tag-bg: #fff7ed;
  --tag-fg: #c2410c;
  --tag-hover-bg: #ffedd5;


}

.tag-choice {
  width: auto;
  min-height: 28px;
  border-color: transparent;
  cursor: pointer;
}

.tag-choice:hover {
  background: var(--tag-hover-bg, #d1fae5);
}

.goal-detail .tag-list {
  margin-top: 0;
}

.panel {
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.placeholder {
  margin-top: 10px;
}

.placeholder p,
.empty {
  margin: 8px 0 0;
  color: var(--muted);
}

.form {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 6px;
}

label span,
.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.date-time-field {
  display: grid;
  gap: 6px;
}

.date-time-parts {
  display: grid;
  grid-template-columns: minmax(136px, 1fr) 76px 76px;
  gap: 8px;
}

.date-time-parts input,
.date-time-parts select {
  min-width: 0;
}

.goal-date-time-field input {
  min-width: 0;
}

.form-grid.goal-time-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.goal-reminder-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 1040px) {
  .form-grid.goal-time-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

.goal-compact-form {
  gap: 10px;
}

@media (min-width: 1041px) {
  .goal-compact-form label,
  .goal-compact-form .date-time-field {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
  }

  .goal-compact-form label span,
  .goal-compact-form .field-label {
    align-self: center;
    white-space: nowrap;
  }

  .goal-compact-form .goal-description-field {
    align-items: start;
  }

  .goal-compact-form .goal-description-field span {
    padding-top: 10px;
  }

  .goal-compact-form .tag-picker {
    padding-left: 72px;
  }

  .goal-compact-form .goal-inline-title-fields label,
  .goal-compact-form .goal-inline-meta-fields label {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    align-items: stretch;
  }

  .goal-compact-form .goal-inline-title-fields label span,
  .goal-compact-form .goal-inline-meta-fields label span {
    align-self: start;
  }

  .goal-compact-form .goal-inline-tag-field .tag-picker {
    padding-left: 0;
  }
}

.goal-compact-form input,
.goal-compact-form select {
  min-height: 42px;
  padding: 8px 10px;
}

.goal-compact-form textarea {
  min-height: 112px;
  padding: 8px 10px;
}

.goal-compact-form .date-time-parts {
  grid-template-columns: minmax(118px, 1fr) 64px 64px;
}

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

.check-row input {
  width: 20px;
  min-height: 20px;
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.module-nav {
  display: none;
}

.module-nav a {
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 9px 8px 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}

.module-nav a.is-active {
  color: var(--accent);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 22px;
}

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

.login-brand {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

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

.login-legal {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.login-legal a,
.privacy-shell a {
  color: var(--accent);
}

.privacy-shell {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.privacy-page-head {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.privacy-page-head h1,
.privacy-page-head p {
  margin: 0;
}

.privacy-page-head > p:last-child {
  color: var(--muted);
  font-size: 14px;
}

.privacy-back-link {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  font-weight: 800;
  text-decoration: none;
}

.privacy-policy {
  display: grid;
  gap: 26px;
  padding: 28px;
  line-height: 1.75;
}

.privacy-policy section {
  display: grid;
  gap: 10px;
}

.privacy-policy h2,
.privacy-policy h3,
.privacy-policy p,
.privacy-policy ul {
  margin: 0;
}

.privacy-policy h2 {
  font-size: 20px;
}

.privacy-policy h3 {
  margin-top: 4px;
  font-size: 16px;
}

.privacy-policy ul {
  display: grid;
  gap: 6px;
  padding-left: 22px;
}

@media (max-width: 1040px) {
  .privacy-shell {
    padding-top: 22px;
  }

  .privacy-policy {
    gap: 22px;
    padding: 20px;
  }
}

.alert {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: var(--warning-bg);
  color: #9a3412;
}

@media (max-width: 1040px) {
  .shell {
    width: min(100% - 28px, 920px);
  }

  .focus-layout {
    display: block;
  }

  .focus-rail {
    display: none;
  }
}

@media (max-width: 1040px) {

  .goal-inline-title-fields,
  .goal-inline-meta-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .shell {
    width: min(100% - 20px, 920px);
    padding-top: 12px;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .button,
  button {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 14px;
  }

  .button.compact,
  button.compact {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 13px;
  }

  .goal-row-actions .button.compact,
  .goal-row-actions button.compact,
  .history-row-actions .button,
  .history-row-actions button,
  .note-menu-popover .button.compact,
  .note-menu-popover button.compact {
    min-height: 36px;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .top-actions.is-mobile-menu {
    position: relative;
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    align-items: stretch;
    gap: 6px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .topbar-side {
    display: grid;
    gap: 10px;
    width: 100%;
    min-width: 0;
    justify-items: start;
  }

  .brand-lockup {
    display: none;
  }

  .module-page-title {
    display: none;
  }

  .desktop-module-nav {
    display: none;
  }

  .topbar-system {
    display: none;
  }

  .topbar-side > .account-menu {
    display: none;
  }

  .module-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 5px 10px calc(5px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 -8px 24px rgba(24, 33, 50, 0.08);
    backdrop-filter: blur(12px);
  }

  .module-nav a {
    gap: 3px;
    min-height: 54px;
    padding: 5px 8px 6px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1;
  }

  .module-nav a::before {
    display: block;
    width: 20px;
    height: 20px;
    color: currentColor;
    content: "";
  }

  .module-nav a[data-module="goals"]::before {
    border: 2px solid currentColor;
    border-radius: 999px;
    box-shadow: inset 0 0 0 4px #ffffff, inset 0 0 0 6px currentColor;
  }

  .module-nav a[data-module="notes"]::before {
    border: 2px solid currentColor;
    border-radius: 5px;
    background:
      linear-gradient(currentColor, currentColor) 5px 6px / 8px 2px no-repeat,
      linear-gradient(currentColor, currentColor) 5px 11px / 6px 2px no-repeat;
  }

  .module-nav a[data-module="knowledge"]::before,
  .module-nav a[data-module="notebooks"]::before {
    border: 2px solid currentColor;
    border-radius: 4px;
    background:
      linear-gradient(currentColor, currentColor) 5px 5px / 8px 2px no-repeat,
      linear-gradient(currentColor, currentColor) 5px 10px / 10px 2px no-repeat,
      linear-gradient(currentColor, currentColor) 5px 15px / 7px 2px no-repeat;
  }

  .module-nav a[data-module="calendar"]::before {
    border: 2px solid currentColor;
    border-radius: 5px;
    background:
      linear-gradient(currentColor, currentColor) 0 5px / 100% 2px no-repeat,
      linear-gradient(currentColor, currentColor) 5px 0 / 2px 5px no-repeat,
      linear-gradient(currentColor, currentColor) 13px 0 / 2px 5px no-repeat;
  }

  .module-nav a.is-active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .top-actions.is-mobile-menu .top-actions-main {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 0;
    grid-column: 1;
    grid-row: 1;
  }

  .top-actions.is-mobile-menu .top-actions-system {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
    padding-left: 0;
    border-left: 0;
  }

  .top-actions.is-mobile-menu .top-actions-system {
    display: none;
  }

  .top-actions.is-mobile-menu .top-actions-main > :not(.top-action-primary) {
    display: none;
  }

  .top-actions.is-mobile-menu .top-actions-main > .top-action-keep {
    display: inline-flex;
  }

  .top-actions.is-mobile-menu.has-keep-action .top-actions-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 62px;
    gap: 6px;
  }

  .top-actions.is-mobile-menu .top-actions-main .button,
  .top-actions.is-mobile-menu .top-actions-main button {
    width: 100%;
    min-width: 0;
  }

  .top-actions.is-mobile-menu .button,
  .top-actions.is-mobile-menu button {
    width: auto;
    min-height: 36px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: none;
    white-space: nowrap;
  }

  .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
    flex: 1 1 auto;
    order: -1;
    width: 100%;
    min-height: 40px;
    font-size: 14px;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
  }

  .top-actions.is-mobile-menu .top-actions-main .top-action-keep {
    flex: 0 0 62px;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding-inline: 6px;
    justify-content: center;
  }

  .top-actions.is-mobile-menu form {
    display: flex;
    width: auto;
  }

  .top-actions.is-mobile-menu form button {
    width: 100%;
  }

  .top-actions.is-mobile-menu .top-actions-system .button,
  .top-actions.is-mobile-menu .top-actions-system button {
    min-width: 0;
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 12px;
  }

  .top-actions.is-mobile-menu.is-menu-ready .top-actions-more {
    display: inline-flex;
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding-inline: 6px;
    justify-content: center;
    border-color: var(--line-soft);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    font-weight: 900;
  }

  .top-actions.is-mobile-menu.is-menu-ready .top-actions-more[aria-expanded="true"] {
    border-color: rgba(37, 99, 235, 0.28);
    background: var(--accent-soft);
    color: var(--accent);
  }

  .top-actions.is-mobile-menu .top-actions-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    display: grid;
    width: min(236px, 72vw);
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
  }

  .top-actions.is-mobile-menu .top-actions-menu[hidden] {
    display: none;
  }

  .top-actions.is-mobile-menu .top-actions-menu .button,
  .top-actions.is-mobile-menu .top-actions-menu button {
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    gap: 10px;
    border-radius: 7px;
    box-shadow: none;
  }

  .top-actions.is-mobile-menu .top-actions-menu .top-actions-menu-icon {
    display: block;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
  }

  .top-actions.is-mobile-menu .top-actions-menu .goal-sections-toggle-icon {
    display: none;
  }

  .top-actions.is-mobile-menu .top-actions-menu .top-actions-menu-label-added {
    display: inline;
  }

  .top-actions.is-mobile-menu .top-actions-menu :is(a, button) > i {
    display: none;
  }

  .top-actions.is-mobile-menu .top-actions-menu form {
    display: flex;
    width: 100%;
  }

  .top-actions.is-mobile-menu .button.secondary,
  .top-actions.is-mobile-menu button.secondary {
    border-color: var(--line-soft);
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
  }

  .top-actions.is-mobile-menu .button.secondary:hover,
  .top-actions.is-mobile-menu button.secondary:hover {
    background: #ffffff;
    color: var(--text);
  }

  .top-actions.is-mobile-menu .button:not(.secondary),
  .top-actions.is-mobile-menu button:not(.secondary) {
    border-color: rgba(37, 99, 235, 0.18);
    background: var(--accent);
    color: #ffffff;
  }

  .top-actions.is-mobile-menu .button:not(.secondary):hover,
  .top-actions.is-mobile-menu button:not(.secondary):hover {
    background: var(--accent-dark);
  }

  .confirm-backdrop {
    align-items: end;
    padding: 14px 10px calc(86px + env(safe-area-inset-bottom, 0px));
  }

  .confirm-dialog {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    padding: 15px;
  }

  .confirm-dialog-icon {
    width: 36px;
    height: 36px;
    font-size: 19px;
  }

  .confirm-dialog-copy h2 {
    font-size: 17px;
  }

  .confirm-dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .confirm-dialog-actions .button,
  .confirm-dialog-actions button {
    width: 100%;
  }

  .calendar-date-toggle {
    display: inline-flex;
  }

  .calendar-range-strip {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 4px;
    align-items: center;
    min-height: 38px;
    margin-bottom: 8px;
    padding: 3px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow-soft);
  }

  .calendar-range-strip a,
  .calendar-range-strip strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 30px;
    border-radius: 999px;
    text-decoration: none;
  }

  .calendar-range-strip a {
    color: var(--accent);
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
  }

  .calendar-range-strip strong {
    overflow: hidden;
    padding: 0 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .calendar-date-controls {
    display: none;
    margin-bottom: 10px;
  }

  .calendar-date-controls.is-open {
    display: block;
  }

  .summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary div {
    padding: 10px;
  }

  .summary strong {
    font-size: 23px;
  }

  .goal-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-right: 0;
  }

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

  .goals-simple-mode .goal-index-row {
    grid-template-columns: 1fr;
  }

  .goals-sort-mode .goal-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .goal-row-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .goals-sort-mode .goal-row-actions {
    display: none;
  }

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

  .week-picker {
    grid-column: 1 / -1;
    order: -1;
    grid-template-columns: minmax(0, 1fr) minmax(88px, 1fr);
  }

  .week-controls > .button,
  .week-picker button,
  .month-controls > .button,
  .month-picker button,
  .calendar-tabs a {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
  }

  .range-goal {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 9px;
  }

  .range-goal-main .meta-row {
    margin-bottom: 6px;
  }

  .range-track {
    height: 8px;
  }

  .calendar-tabs {
    display: grid;
  }

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

  .month-picker {
    grid-column: 1 / -1;
    order: -1;
    grid-template-columns: minmax(0, 1fr) minmax(88px, 1fr);
  }

  .month-weekdays,
  .month-grid {
    gap: 3px;
  }

  .month-weekdays div {
    font-size: 11px;
  }

  .month-day {
    min-height: 88px;
    padding: 4px;
    border-radius: 6px;
  }

  .month-day.is-today {
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
  }

  .month-day-head {
    margin-bottom: 4px;
  }

  .month-day .today-badge {
    display: none;
  }

  .month-date {
    font-size: 12px;
  }

  .month-day-head b {
    min-width: 18px;
    padding: 0 4px;
    font-size: 10px;
  }

  .month-goals {
    gap: 2px;
  }

  .month-goal {
    grid-template-columns: minmax(0, 1fr);
    min-height: 19px;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 10.5px;
  }

  .month-goal .priority-dot,
  .month-goal small,
  .month-goal b {
    display: none;
  }

  .month-goal span:nth-child(2) {
    width: 100%;
  }

  .month-more {
    font-size: 10px;
  }

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

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

  .history-panel-head,
  .history-goal-row {
    grid-template-columns: 1fr;
  }

  .history-panel-head {
    display: grid;
    gap: 2px;
  }

  .history-row-actions {
    width: 100%;
  }

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

  .inline-primary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-secondary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-secondary-actions .button {
    grid-column: 1 / -1;
  }

  .date-time-parts {
    grid-template-columns: minmax(132px, 1fr) 68px 68px;
    gap: 6px;
  }
}

@media (min-width: 1041px) {
  .detail-card {
    padding: 20px;
  }
}

@media (max-width: 1040px) {
}

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

