:root {
  --paper: #fff;
  --canvas: #fbfcfa;
  --sidebar: #f2f5f0;
  --ink: #28382f;
  --muted: #89938b;
  --line: #e7ece5;
  --green: #477653;
  --green-dark: #315a3c;
  --pale: #e7efe3;
  --warm: #e9b969;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  color: var(--ink);
  font-size: 14px;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  overflow: hidden;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
}
button:disabled {
  opacity: 0.3;
  cursor: default;
}
button:focus-visible {
  outline: 2px solid #8da982;
  outline-offset: 2px;
}
input,
textarea,
select {
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: #90ad84 !important;
}
button:hover {
  background: #edf2e9;
}
button {
  transition: background 0.15s;
}
#app {
  display: flex;
  height: 100vh;
}
.sidebar {
  width: 232px;
  min-width: 232px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 52px 16px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  margin-bottom: 30px;
  font-weight: 650;
  font-size: 21px;
  letter-spacing: 2px;
}
.brandmark {
  background: var(--green-dark);
  color: #fff;
  border-radius: 11px;
  width: 39px;
  height: 43px;
  display: grid;
  place-items: center;
  font-family: serif;
  font-size: 24px;
}
.brand small {
  display: block;
  letter-spacing: 1px;
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 5px;
}
.search-trigger {
  width: 100%;
  height: 36px;
  background: #e9eee5;
  border: 1px solid #e2e8dc;
  border-radius: 7px;
  text-align: left;
  color: #7c887b;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}
.search-trigger > span {
  font-size: 21px;
}
.search-trigger kbd {
  margin-left: auto;
}
kbd {
  font-family: inherit;
  font-size: 10px;
  color: #939d92;
}
nav {
  margin: 22px 0 23px;
  display: grid;
  gap: 4px;
}
nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 7px;
  height: 39px;
  padding: 0 12px;
  text-align: left;
  color: #677367;
}
nav button.active {
  background: #e2eadc;
  color: var(--green-dark);
  font-weight: 600;
}
.nav-icon {
  font-size: 19px;
  width: 19px;
  text-align: center;
  font-weight: 400;
}
#doc-count {
  margin-left: auto;
  background: #e7ece1;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
}
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  color: #939b90;
  font-size: 11px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.section-label button {
  font-size: 18px;
  color: #829078;
  border-radius: 4px;
}
#doc-list {
  overflow: auto;
  flex: 1;
}
.doc-link {
  width: 100%;
  display: flex;
  gap: 10px;
  text-align: left;
  align-items: center;
  padding: 11px 12px;
  border-radius: 7px;
  margin: 2px 0;
  color: #66715f;
  font-size: 13px;
}
.doc-link.active {
  background: #e2eadc;
  color: #365a3c;
}
.doc-link .doc-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-symbol {
  font-size: 15px;
  color: #90a081;
}
.sidebar-bottom {
  margin-top: 16px;
}
.quick-button {
  border: 1px solid #d9e2d1;
  background: #fbfdf8;
  border-radius: 8px;
  width: 100%;
  padding: 11px;
  text-align: left;
  color: var(--green-dark);
  font-size: 13px;
}
.quick-button kbd {
  float: right;
  line-height: 18px;
}
.settings-button {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #7c8677;
  padding: 17px 10px 11px;
  width: 100%;
  font-size: 12px;
}
.version {
  margin-left: auto;
  font-size: 10px;
}
.local-badge {
  font-size: 10px;
  color: #9ca492;
  padding: 0 10px;
  letter-spacing: 0.4px;
}
i {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: #75916a;
  border-radius: 50%;
  margin-right: 6px;
}
main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 54px;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px 0;
  gap: 12px;
}
#breadcrumb {
  font-size: 11px;
  color: #929b90;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#breadcrumb span {
  padding: 0 11px;
  color: #bec5b8;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
#save-status {
  font-size: 10px;
  color: #95a08e;
  margin-right: 12px;
}
#save-status.error {
  color: #aa594b;
}
#save-status.error i {
  background: #aa594b;
}
.icon-btn {
  font-size: 22px;
  border-radius: 5px;
  width: 29px;
  height: 29px;
  color: #839179;
}
.outline-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 11px;
  background: white;
  margin-left: 7px;
}
.outline-button span {
  padding-left: 10px;
  color: #8c9983;
}
#content {
  overflow: auto;
  flex: 1;
  position: relative;
  background: var(--paper);
}
.page {
  padding: 16px 28px 24px;
  max-width: 1240px;
  margin: 0 auto;
}
.eyebrow {
  color: #809578;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 10px;
  margin-bottom: 12px;
}
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.doc-title {
  font-size: 24px;
  font-weight: 650;
  border: 1px solid transparent;
  background: transparent;
  letter-spacing: -0.8px;
  padding: 0;
  width: 100%;
  height: 36px;
  border-radius: 4px;
}
.meta-line {
  display: flex;
  align-items: center;
  gap: 15px;
  color: #a3ac9d;
  font-size: 11px;
  margin: 7px 0 28px;
}
.tag {
  font-size: 10px;
  background: #f0f4eb;
  color: #7d936c;
  border-radius: 4px;
  padding: 3px 8px;
}
.view-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  background: #f0f3ed;
  border-radius: 7px;
  padding: 3px;
  white-space: nowrap;
}
.view-tabs button {
  padding: 7px 13px;
  font-size: 12px;
  color: #819175;
  border-radius: 5px;
}
.view-tabs button.active {
  background: #fff;
  color: #466939;
  box-shadow: 0 1px 4px #253e2110;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 5px 0;
  margin: 10px 0 12px;
  min-height: 40px;
}
.editor-toolbar button {
  width: 30px;
  height: 28px;
  border-radius: 5px;
  color: #77846e;
  font-size: 14px;
}
.editor-toolbar .wide-tool {
  width: auto;
  font-size: 11px;
  padding: 0 9px;
}
.tool-sep {
  height: 17px;
  width: 1px;
  background: var(--line);
  margin: 0 7px;
}
.toolbar-tip {
  margin-left: auto;
  color: #aab2a3;
  font-size: 10px;
}
.outline {
  min-height: 290px;
  padding-bottom: 12px;
}
.node-row {
  display: flex;
  align-items: flex-start;
  position: relative;
  min-height: 39px;
  border-radius: 5px;
  padding: 4px 5px 4px 0;
  margin: 1px 0;
}
.node-row.selected {
  background: #f5f8f0;
}
.node-row:hover {
  background: #f7f9f3;
}
.fold-btn {
  width: 22px;
  min-width: 22px;
  height: 29px;
  font-size: 13px;
  color: #98a38e;
  padding: 0;
}
.node-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a9b59e;
  display: block;
  margin: auto;
}
.fold-btn.has-children {
  color: #829475;
}
.node-text {
  resize: none;
  overflow: hidden;
  flex: 1;
  width: 100%;
  min-height: 28px;
  line-height: 27px;
  padding: 0 4px;
  border: 0 !important;
  background: none;
  display: block;
  font-size: 15px;
  letter-spacing: 0.05px;
}
.node-main {
  flex: 1;
  min-width: 0;
}
.node-row.is-bold .node-text {
  font-weight: 650;
}
.node-row.is-highlight .node-text {
  background: #fff0be;
  border-radius: 4px;
}
.node-row.is-done .node-text {
  text-decoration: line-through;
  color: #a5ae9d;
}
.node-check {
  accent-color: #6a875b;
  margin: 7px 8px 0 2px;
  width: 15px;
  height: 15px;
}
.note-field {
  font-size: 12px;
  color: #8b9881;
  border-left: 2px solid #dce5d4;
  padding: 3px 8px;
  margin: 4px 0 4px 4px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.node-note-btn {
  opacity: 0;
  color: #9aa58e;
  font-size: 11px;
  line-height: 28px;
}
.node-row:hover .node-note-btn {
  opacity: 1;
}
.add-line {
  color: #a1ae95;
  padding: 10px 22px;
  border-radius: 5px;
  font-size: 12px;
  text-align: left;
  width: 100%;
  margin-top: 8px;
}
.editor-footer {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #abb4a3;
}
.footer-hint {
  display: flex;
  gap: 15px;
}
.leaf-stamp {
  color: #a0af90;
  font-size: 16px;
}
.page-heading {
  font-size: 24px;
  letter-spacing: -0.5px;
  margin: 0;
  font-weight: 650;
}
.page-description {
  margin: 8px 0 12px;
  font-size: 13px;
  line-height: 1.8;
  color: #8a9781;
}
.primary {
  background: var(--green) !important;
  color: white !important;
  padding: 10px 17px;
  border-radius: 7px;
  font-size: 12px;
  white-space: nowrap;
}
.primary:hover {
  background: #365b3e !important;
}
.subheading {
  font-size: 13px;
  font-weight: 600;
  margin: 18px 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.empty-state {
  border: 1px dashed #dce4d4;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  color: #98a38c;
  line-height: 2;
  font-size: 12px;
  background: #fcfdf9;
}
.empty-state strong {
  display: block;
  color: #637659;
  font-size: 15px;
}
.note-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.note-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  text-align: left;
  background: #fff;
  min-height: 110px;
}
.note-card h3 {
  font-size: 16px;
  margin: 10px 0;
  font-weight: 600;
}
.note-card p {
  margin: 0;
  font-size: 12px;
  color: #8f9b85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-card small {
  font-size: 10px;
  color: #a6b099;
}
.today-banner {
  background: linear-gradient(105deg, #eef4e8, #f9faf3);
  border: 1px solid #e5ecd9;
  border-radius: 13px;
  padding: 25px 29px;
  margin: 26px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.today-banner p {
  font-size: 12px;
  color: #889679;
  margin: 8px 0 0;
}
.today-banner strong {
  font-size: 18px;
  font-weight: 500;
}
.banner-art {
  font-family: serif;
  font-size: 64px;
  color: #a7bb91;
  line-height: 1;
  transform: rotate(-15deg);
}
.event-row {
  display: flex;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 18px 4px;
  width: 100%;
  text-align: left;
}
.event-time {
  width: 87px;
  font-size: 13px;
  color: #708364;
}
.event-copy {
  flex: 1;
}
.event-copy strong {
  font-size: 14px;
  font-weight: 500;
}
.event-copy small {
  display: block;
  color: #96a28a;
  margin-top: 6px;
  font-size: 11px;
}
.event-arrow {
  color: #a3af97;
}
#content.calendar-content { overflow: hidden; min-height: 0; }
.page.calendar-page {
  height: 100%; max-width: none; padding: 12px 28px 10px;
  display: flex; flex-direction: column; gap: 12px; min-height: 0;
}
.calendar-controls { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.calendar-controls input { border: 1px solid var(--line); border-radius: 5px; padding: 7px; font-size: 12px; }
.calendar-controls .view-tabs { margin-left: auto; }
.calendar-wrap {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}
.calendar-head { display: grid; background: #fbfcf9; border-bottom: 1px solid var(--line); padding-left: 62px; flex: 0 0 48px; }
.day-heading { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 6px 2px; color: #8c9a81; font-size: 10px; border-left: 1px solid var(--line); }
.day-heading strong { display: inline-grid; place-items: center; font-size: 18px; font-weight: 500; color: #758566; width: 29px; height: 29px; border-radius: 50%; }
.day-heading.is-today strong { background: var(--green); color: white; }
.calendar-body { position: relative; padding-left: 62px; flex: 1; min-height: 0; display: flex; }
.time-labels { position: absolute; inset: 0 auto 0 0; width: 62px; display: grid; grid-template-rows: repeat(11,minmax(0,1fr)); }
.time-label { display: flex; align-items: flex-start; justify-content: center; padding-top: 3px; color: #8a9880; font-size: 10px; border-bottom: 1px solid #edf0e8; }
.time-label:first-child,.time-label:last-child { align-items: center; padding-top: 0; background: #f4f7f0; }
.day-column { flex: 1; min-width: 0; display: grid; grid-template-rows: minmax(0,1fr) minmax(0,9fr) minmax(0,1fr); border-left: 1px solid var(--line); }
.work-column { position: relative; min-height: 0; background-image: linear-gradient(to bottom,transparent calc(100% - 1px),#edf0e8 calc(100% - 1px)); background-size: 100% calc(100% / 9); }
.work-column:hover { background-color: #fafcf6; }
.calendar-cap { min-width: 0; min-height: 0; width: 100%; padding: 2px 5px; background: #f4f7f0; border-bottom: 1px solid var(--line); text-align: left; overflow: hidden; font-size: 10px; color: #789169; }
.calendar-cap:last-child { border-top: 1px solid var(--line); border-bottom: 0; }
.calendar-cap > span, .calendar-cap > small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 14px; }
.calendar-cap > small { font-size: 9px; color: #89967e; }
.calendar-cap:not(.has-events) { text-align: center; color: #b1bea7; }
.calendar-cap:hover { background: #e9f0e2; }
.cal-event { position: absolute; text-align: left; background: #e5efdf; border-left: 3px solid #81a16e; border-radius: 4px; padding: 2px 4px; overflow: hidden; font-size: 9px; color: #57704a; min-height: 18px; max-height: 100%; }
.cal-event strong { display: block; font-size: 11px; font-weight: 500; line-height: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event > span { display: block; line-height: 12px; white-space: nowrap; }
.cal-event.is-short { display: flex; align-items: center; gap: 3px; }
.cal-event.is-short strong { flex: 1; min-width: 0; font-size: 10px; }
.cal-event.is-short > span { flex: 0 0 auto; font-size: 9px; }
.calendar-page .calendar-hint { flex: 0 0 auto; margin: 0; font-size: 10px; line-height: 16px; }
.cap-events { max-height: 55vh; overflow: auto; }
@media (max-height: 720px) {
  .page.calendar-page { padding: 12px 22px; gap: 8px; }
  .calendar-head { flex-basis: 40px; }
}
.map-shell {
  background: radial-gradient(#dfe7d8 1px, transparent 1px);
  background-size: 18px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 470px;
  overflow: auto;
  position: relative;
}
.map-stage {
  display: flex;
  align-items: center;
  gap: 46px;
  padding: 50px;
  min-width: max-content;
  min-height: 100%;
  position: relative;
  isolation: isolate;
}
.map-root {
  border-radius: 10px;
  background: var(--green);
  color: white;
  padding: 20px 25px;
  width: 180px;
  flex-shrink: 0;
  line-height: 1.5;
  box-shadow: 0 7px 24px #4f714421;
  position: relative;
}
.map-forest, .map-children {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
.map-children { margin-left: 34px; }
.map-branch { display: flex; align-items: center; position: relative; }
.map-node {
  border: 1px solid #dce6d2;
  background: #fff;
  border-radius: 7px;
  padding: 12px 16px;
  width: 185px;
  flex-shrink: 0;
  text-align: left;
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 2px 8px #48613908;
  position: relative;
  word-break: break-word;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.map-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; overflow: visible; }
.map-links path { fill: none; stroke: #91ad7d; stroke-width: 1.5; }
.map-node.is-dragging { opacity: .4; }
.map-shell.is-dragging, .map-shell.is-dragging .map-node { cursor: grabbing; }
.map-node.drop-child, .map-root.drop-child { outline: 3px solid #4c8059; outline-offset: 3px; }
.map-node.drop-before:before, .map-node.drop-after:after {
  content: ''; position: absolute; left: -5px; right: -5px; height: 4px;
  background: #4c8059; border-radius: 4px;
}
.map-node.drop-before:before { top: -8px; }
.map-node.drop-after:after { bottom: -8px; }
.map-node.drop-invalid { outline: 2px dashed #b06759; outline-offset: 3px; }
.map-drag-ghost {
  position: fixed; z-index: 2000; pointer-events: none; width: 310px;
  padding: 12px 16px; border: 1px solid #91ad7d; border-radius: 10px;
  background: #fffffff5; color: #29432e; box-shadow: 0 8px 28px #22382226;
  font-size: 13px; line-height: 1.6;
}
.map-drag-ghost strong { display: block; max-height: 42px; overflow: hidden; }
.map-drag-status { font-size: 11px; margin-top: 5px; }
.map-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0;
  color: #9da991;
  font-size: 11px;
}
.map-controls button {
  border: 1px solid var(--line);
  border-radius: 5px;
  width: 28px;
  height: 27px;
}
.map-controls span:last-child {
  margin-left: auto;
}
.settings-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 14px 0;
  padding: 16px;
}
.settings-group h3 {
  font-size: 14px;
  margin: 0 0 12px;
}
.settings-group p {
  font-size: 12px;
  line-height: 1.9;
  color: #8b9780;
  word-break: break-all;
}
.settings-group .outline-button {
  margin: 0 8px 0 0;
}
.danger {
  color: #a15f52 !important;
}
.popover {
  position: fixed;
  right: 27px;
  top: 50px;
  width: 230px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 15px 45px #3245291f;
  z-index: 8;
  padding: 8px;
}
.popover b {
  display: block;
  font-size: 10px;
  color: #9ba78e;
  padding: 10px;
  font-weight: 400;
}
.popover button {
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: 5px;
  font-size: 12px;
}
.popover button span {
  float: right;
  color: #a8b29c;
  font-size: 10px;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
}
dialog {
  width: 500px;
  max-height: 85vh;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0;
  box-shadow: 0 25px 100px #25362329;
  color: var(--ink);
}
dialog::backdrop {
  background: #283c2d28;
  backdrop-filter: blur(3px);
}
.modal-content {
  padding: 28px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-header h2 {
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.5px;
}
.modal-header button {
  color: #96a18b;
  font-size: 21px;
}
.field {
  display: block;
  font-size: 11px;
  color: #859577;
  margin: 16px 0 7px;
}
.field input,
.field textarea,
.field select {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid #dfe7d7;
  border-radius: 6px;
  background: #fbfcf9;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 42px;
  min-width: 0;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23556650' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  text-overflow: ellipsis;
}
.field textarea {
  resize: vertical;
  min-height: 90px;
}
.form-row {
  display: flex;
  gap: 13px;
}
.form-row .field {
  flex: 1;
  min-width: 0;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 23px;
}
.modal-footer .danger {
  margin-right: auto;
}
.hint {
  font-size: 11px;
  color: #9aa88e;
  line-height: 1.8;
  margin: 13px 0;
}
.error-text {
  color: #a15f52;
  font-size: 12px;
  line-height: 1.8;
}
.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
}
.search-results {
  margin-top: 14px;
  max-height: 350px;
  overflow: auto;
}
.search-result {
  width: 100%;
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.search-result strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
}
.search-result small {
  display: block;
  color: #a1ad96;
  font-size: 11px;
  line-height: 1.5;
  margin-top: 5px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: calc(50% + 100px);
  transform: translate(-50%, 12px);
  background: #344d37;
  color: #fff;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 20;
  max-width: 600px;
  line-height: 1.6;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
[hidden] {
  display: none !important;
}
@media (max-width: 1050px) {
  .sidebar {
    width: 205px;
    min-width: 205px;
  }
  .page {
    padding: 16px 22px 20px;
  }
  .toolbar-tip {
    display: none;
  }
  .topbar {
    padding-left: 25px;
    padding-right: 25px;
  }
  .doc-title {
    font-size: 23px;
  }
}

/* Month cells share the calendar's available height. Overflow opens a day list. */
.month-label { font-size: 15px; white-space: nowrap; }
.calendar-controls .primary { white-space: nowrap; }
.month-weekdays { display: flex; flex: 0 0 32px; height: 32px; align-items: center; text-align: center; color: #8c9a81; background: #fbfcf9; font-size: 11px; }
.month-weekdays > span { flex: 1; min-width: 0; line-height: 16px; }
.month-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); }
.month-cell { min-height: 0; min-width: 0; padding: 3px 5px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); overflow: hidden; }
.month-cell:nth-child(7n) { border-right: 0; }
.month-cell:hover { background: #fafcf6; }
.month-cell.outside-month { background: #f8faf5; }
.month-cell.outside-month .month-date { color: #a8b29e; }
.month-cell-head { height: 25px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.month-date { font-size: 12px; min-width: 25px; height: 25px; padding: 0 5px; border-radius: 14px; color: #6b7b5f; }
.month-cell.is-today .month-date { background: var(--green); color: white; }
.month-add { font-size: 12px; color: #99ab8c; width: 23px; height: 23px; border-radius: 4px; }
.month-add:hover, .month-date:hover { background: #e6eedf; }
.month-event { display: flex; width: 100%; height: 18px; margin-bottom: 2px; align-items: center; gap: 4px; padding: 0 4px; background: #e5efdf; color: #57704a; border-radius: 3px; text-align: left; }
.month-event span { font-size: 9px; flex-shrink: 0; }
.month-event strong { min-width: 0; font-size: 10px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month-more { width: 100%; height: 18px; text-align: left; font-size: 10px; color: var(--green); padding: 0 4px; }
.month-more:hover { text-decoration: underline; }
.month-event[hidden], .month-more[hidden] { display: none; }
@media (max-width: 1050px) { .calendar-controls { gap: 5px; } .month-label { font-size: 13px; } .calendar-controls .primary { padding: 8px 10px; } }

.calendar-sync { font-size: 10px; color: var(--green); padding: 0 5px 0 0; text-decoration: underline; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.checkbox-field { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.checkbox-field input { width: 16px; height: 16px; margin: 0; padding: 0; flex: 0 0 16px; }

/* Library organization */
.section-actions { display: flex; gap: 3px; align-items: center; }
.section-actions button:first-child { font-size: 13px; padding: 5px; }
.folder-row { display: flex; align-items: center; border-radius: 7px; min-height: 38px; }
.folder-row.active { background: var(--pale); }
.folder-toggle { flex: 0 0 23px; padding: 7px 0; color: var(--muted); }
.folder-name { min-width: 0; flex: 1; display: flex; gap: 6px; align-items: center; text-align: left; padding: 9px 0; font-size: 13px; }
.folder-name > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-name small { color: var(--muted); font-size: 10px; margin-left: auto; }
.folder-more { padding: 6px; color: var(--muted); }
.folder-children { margin-left: 12px; border-left: 1px solid #dce5d7; padding-left: 3px; }
.folder-empty { display: block; font-size: 11px; color: var(--muted); padding: 8px 16px; }
.unfiled-label { color: var(--muted); font-size: 11px; text-align: left; padding: 12px 10px 4px; }
.library-actions { display: flex; gap: 8px; flex-shrink: 0; }
.folder-filters { display: flex; gap: 7px; flex-wrap: wrap; margin: 18px 0; }
.folder-filters button { border: 1px solid var(--line); border-radius: 16px; padding: 6px 13px; font-size: 12px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-filters .active { background: var(--pale); color: var(--green-dark); border-color: #cadbc1; }
.context-menu { position: fixed; z-index: 100; width: 212px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; background: #fff; border: 1px solid #dce5d7; border-radius: 10px; box-shadow: 0 10px 35px #243c252b; padding: 6px; }
.context-menu[hidden] { display: none; }
.context-menu:focus { outline: none; }
.context-title { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.context-menu button { display: block; width: 100%; text-align: left; border-radius: 5px; padding: 9px 10px; font-size: 13px; }
.context-menu button:focus { outline: none; background: var(--pale); }
.context-menu .danger { color: #a34e48; }
.note-card { min-width: 0; }
.note-card h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* Compact all-day summaries stay above the time grid in day/week views. */
.day-heading { flex-direction: column; gap: 2px; min-width: 0; }
.day-date { display: flex; align-items: center; justify-content: center; gap: 7px; }
.calendar-head.has-holidays { flex-basis: 66px; }
.holiday-labels { display: flex; align-items: center; justify-content: center; gap: 3px; width: 100%; min-width: 0; padding: 0 4px; }
.holiday-label { color: #a27d50; font-size: 10px; line-height: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; border-radius: 3px; padding: 0 3px; }
.holiday-more { flex: 0 0 auto; color: #a27d50; font-size: 10px; line-height: 17px; padding: 0 2px; }
.holiday-label:hover, .holiday-more:hover { background: #f4eee3; }
.calendar-allday { display: flex; flex: 0 0 auto; background: #fbfcf9; border-bottom: 1px solid var(--line); }
.allday-label { flex: 0 0 62px; display: grid; place-items: center; font-size: 10px; color: #8a9880; }
.allday-columns { display: grid; flex: 1; min-width: 0; }
.allday-cell { min-width: 0; border-left: 1px solid var(--line); padding: 3px 4px; display: flex; flex-direction: column; gap: 2px; }
.allday-event, .allday-more { display: block; text-align: left; width: 100%; min-width: 0; height: 20px; flex: 0 0 20px; line-height: 20px; padding: 0 5px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 3px; }
.allday-event { background: #eaf0e4; color: #57704a; }
.allday-event:hover { background: #dfead6; }
.allday-more { color: var(--green); }
.allday-more:hover { text-decoration: underline; }
.calendar-head.has-holidays .day-heading { justify-content: flex-start; }

/* Clear library identities, whole-note drops, and explicit branch selection. */
.library-icon { width: 19px; height: 19px; flex: 0 0 19px; vertical-align: middle; }
.folder-name > .library-icon { color: #a08043; }
.note-card .library-icon { width: 16px; height: 16px; }
[data-doc].library-dragging { opacity: .4; }
.library-drop-before { box-shadow: 0 -3px 0 #4c8059 !important; }
.library-drop-after { box-shadow: 0 3px 0 #4c8059 !important; }
.library-drop-inside { outline: 2px solid #4c8059; background: #e4eddf; }
.selection-label { color: var(--green); font-size: 11px; }
.editor-toolbar { flex-wrap: wrap; }
.map-node { text-align: left; padding: 12px 16px; cursor: grab; }
.map-node.selected { border-color: #769575; box-shadow: 0 0 0 2px #76957533; }
.map-node-tools { display: flex; align-items: center; gap: 8px; height: 22px; margin-bottom: 5px; color: #95a18b; }
.map-node-tools > button:last-child { margin-left: auto; }
.map-grip { cursor: grab; font-size: 20px; }
.map-text { width: 100%; background: transparent; padding: 0; line-height: 1.6; resize: none; cursor: text; min-height: 28px; border: 0; outline: none; font: inherit; }
.map-text.is-bold { font-weight: 600; }
.map-task { font-size: 11px; color: var(--muted); }
.node-images { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.node-images figure { position: relative; margin: 0; max-width: 100%; }
.image-preview { padding: 0; display: block; border-radius: 8px; overflow: hidden; background: #f3f5ef; }
.image-preview img { display: block; width: auto; height: auto; max-width: min(380px,100%); max-height: 240px; object-fit: contain; }
.map-node .image-preview img { max-width: 100%; max-height: 130px; }
.remove-image { position: absolute; right: 4px; top: 4px; background: #ffffffed; width: 23px; height: 23px; border-radius: 50%; padding: 0; opacity: 0; }
figure:hover .remove-image, .remove-image:focus-visible { opacity: 1; }
.large-image { display: block; max-width: 100%; max-height: 65vh; margin: auto; object-fit: contain; }
.map-text { user-select: text; -webkit-user-select: text; touch-action: auto; }

.outline .node-text:focus, .map-shell:focus { outline: none; }
.outline .node-text { white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; user-select: text; -webkit-user-select: text; }
.outline .node-text:empty::before, .outline .node-text:has(> br:only-child)::before { content: attr(data-placeholder); color: #9ca793; pointer-events: none; }
.outline [contenteditable="false"] { user-select: none; -webkit-user-select: none; }
.outline .node-text::selection { background: #bbd4ea; }

/* Keep selection on glyphs, without WebKit's block-gap bands or a second row highlight. */
.outline.precise-selection::selection,
.outline.precise-selection *::selection { background: transparent; }
::highlight(zhiji-text-selection) { background-color: #bfd4e6; color: #28372e; }
.outline.has-text-selection .node-row.selected,
.outline.has-text-selection .node-row:hover { background: transparent; }

/* Compact page chrome gives the editor and canvas the remaining window space. */
.document-page { max-width: none; }
.document-page .title-row { gap: 16px; }
.doc-title { flex: 1; min-width: 0; }
.doc-summary { display: flex; gap: 12px; color: var(--muted); font-size: 11px; flex-shrink: 0; white-space: nowrap; }
.editor-toolbar { flex-wrap: wrap; }
.editor-toolbar > button, .editor-toolbar > .tool-sep { flex-shrink: 0; }
.editor-toolbar .selection-label { margin-left: 4px; }
#content.map-content { overflow: hidden; min-height: 0; }
.mindmap-page { height: 100%; min-height: 0; display: flex; flex-direction: column; padding-bottom: 12px; }
.mindmap-page > .title-row, .mindmap-page > .editor-toolbar, .mindmap-page > .map-controls { flex-shrink: 0; }
.mindmap-page .map-shell { height: auto; flex: 1; min-height: 0; }
.mindmap-page .map-controls { margin: 8px 0 0; }
.today-summary { color: #73846d; }
.folder-filters { margin: 12px 0; }
.sidebar .brand { margin-bottom: 18px; }
.sidebar nav { margin: 14px 0 16px; }
@media (max-width: 1050px) {
  .document-page .title-row { gap: 10px; }
  .doc-summary { gap: 8px; font-size: 10px; }
  .editor-toolbar { gap: 3px; }
  .tool-sep { margin-left: 4px; margin-right: 4px; }
}

.library-page .page-heading { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-count { margin-left: 10px; color: var(--muted); font-size: 13px; font-weight: 400; letter-spacing: 0; }
.library-actions { flex-shrink: 0; }

/* Compact mindmap cards: text is selectable only after an explicit edit gesture. */
.map-stage { width: max-content; min-width: 100%; justify-content: center; padding: 32px; gap: 36px; }
.map-node { display: flex; flex-direction: column; width: max-content; min-width: 72px; max-width: 240px; padding: 8px 12px; font-size: 13px; line-height: 1.55; border-radius: 8px; }
.map-label { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 214px; }
.map-node.is-bold .map-label, .map-node.is-bold .map-text { font-weight: 600; }
.map-node.is-highlight { background: #fff4cd; }
.map-node.is-done .map-label { text-decoration: line-through; color: #889387; }
.map-node:not(.is-editing), .map-node:not(.is-editing) * { user-select: none; -webkit-user-select: none; cursor: grab; }
.map-node.is-editing { cursor: text; }
.map-node.is-editing .map-text { min-height: 22px; padding: 0; line-height: 1.55; font-size: 13px; }
.map-badges { display: flex; gap: 7px; font-size: 10px; color: #8b9882; margin-top: 2px; }
.map-node .node-images { gap: 5px; margin-top: 6px; max-width: 214px; }
.map-node .node-images figure { max-width: 96px; }
.map-node .image-preview img { max-height: 64px; max-width: 96px; }
.map-forest, .map-children { gap: 12px; }
.map-children { margin-left: 30px; }
.map-root { width: max-content; min-width: 120px; max-width: 240px; padding: 12px 18px; overflow-wrap: anywhere; user-select: none; -webkit-user-select: none; }
.layout-left { flex-direction: row-reverse; }
.layout-left .map-branch, .map-left .map-branch { flex-direction: row-reverse; }
.layout-left .map-children, .map-left .map-children { margin-left: 0; margin-right: 30px; }
.layout-down { flex-direction: column; }
.layout-down .map-forest, .layout-down .map-children { flex-direction: row; align-items: flex-start; gap: 20px; }
.layout-down .map-branch { flex-direction: column; }
.layout-down .map-children { margin: 30px 0 0; }
.layout-down .map-node.drop-before::before { inset: -4px auto -4px -8px; height: auto; width: 3px; }
.layout-down .map-node.drop-after::after { inset: -4px -8px -4px auto; height: auto; width: 3px; }
.map-dragging, .map-dragging * { user-select: none !important; -webkit-user-select: none !important; cursor: grabbing !important; }
.map-node.map-drag-ghost { position: fixed; z-index: 2000; pointer-events: none; margin: 0; opacity: .96; box-shadow: 0 8px 20px #253c2924; }
.map-drag-status { position: fixed; z-index: 2001; pointer-events: none; max-width: 280px; margin: 0; padding: 6px 10px; background: #fff; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; color: #526b4d; box-shadow: 0 3px 14px #253c2914; }
.map-shell { cursor: grab; }
.map-shell.is-panning { cursor: grabbing; }
.map-controls { flex-wrap: wrap; gap: 6px; }
.map-layout-control { display: flex; align-items: center; gap: 6px; color: #65765e; }
.map-layout-control select { width: 96px; min-height: 28px; padding: 3px 7px; font-size: 11px; }
#map-zoom { width: 100px; accent-color: var(--green); }
.map-controls .map-percent { width: 44px; font-size: 11px; }
.map-controls .map-help { margin-left: auto; font-size: 10px; }
@media(max-width:1050px) { .map-controls .map-help { flex-basis: 100%; text-align: right; } #map-zoom { width: 80px; } }

/* One rounded icon family, with distinct folder and document creation silhouettes. */
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 21px; flex: 0 0 21px; }
.nav-icon .library-icon { width: 21px; height: 21px; flex-basis: 21px; }
.doc-symbol { display: inline-flex; align-items: center; }
.doc-symbol .library-icon { width: 18px; height: 18px; flex-basis: 18px; }
.section-actions { gap: 6px; }
.section-actions button, .section-actions button:first-child { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 5px; border-radius: 7px; }
.section-actions [data-ui-icon] { display: inline-flex; }
.section-actions .library-icon { width: 20px; height: 20px; flex-basis: 20px; }
.section-actions [data-action="new-folder"] { color: #957640; }
.section-actions [data-action="new-doc"] { color: #4a7453; }
.section-actions button:hover { background: #e5ebdf; }
.library-actions > button { display: inline-flex; align-items: center; gap: 7px; }
.library-actions .library-icon { width: 18px; height: 18px; flex-basis: 18px; }

.folder-row[data-folder-draggable] { cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.folder-row.library-dragging { opacity: .4; }
.folder-row.library-drop-before { box-shadow: 0 -3px 0 #4c8059; }
.folder-row.library-drop-after { box-shadow: 0 3px 0 #4c8059; }
.library-drop-invalid { outline: 2px dashed #b06759; outline-offset: -2px; }
.folder-dragging .section-label { outline: 1px dashed #9bae90; outline-offset: 3px; border-radius: 4px; background: #edf3e7; }
#library-drop-status { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 2000; max-width: 75vw; pointer-events: none; padding: 9px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 18px #253c2920; font-size: 12px; color: var(--green-dark); }
.folder-children .folder-group { min-width: 140px; }
.note-card > small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.folder-dragging, .folder-dragging * { user-select: none !important; -webkit-user-select: none !important; cursor: grabbing !important; }
.folder-drag-ghost { position: fixed; z-index: 2000; margin: 0; pointer-events: none; background: #f6f8f2; border-radius: 6px; box-shadow: 0 6px 20px #253c2930; }

/* Compact handoff: destinations, then optional local connection settings. */
.handoff-title { margin: 0 0 8px; font-weight: 600; overflow-wrap: anywhere; }
.handoff-targets { display: grid; gap: 8px; margin-top: 20px; }
.handoff-target { display: flex; align-items: center; justify-content: space-between; text-align: left; width: 100%; padding: 13px 16px; border: 1px solid var(--line, #dce4d5); border-radius: 10px; background: #fafbf7; color: inherit; }
.handoff-target:hover { background: #edf2e7; }
.handoff-target strong { display: block; font-size: 15px; }
.handoff-target small { display: block; margin-top: 3px; color: #7f8c79; }
.handoff-options { margin-top: 18px; font-size: 13px; }
.handoff-options summary { cursor: pointer; color: #7f8c79; }
.handoff-options .field { margin-top: 12px; }
.handoff-images { font-size: 13px; padding: 0 0 12px; }

/* Browser synchronization uses the existing modal and editor layout. */
.sync-conflict { border-top: 1px solid var(--line, #dfe6dc); margin-top: 18px; padding-top: 12px; }
.sync-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sync-preview { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; padding: 10px; }
.sync-preview small { display: block; opacity: .75; }
.sync-preview img { display: block; max-width: 100%; max-height: 180px; margin: 6px 0; }
.sync-recovery { position: fixed; z-index: 10000; top: 80px; right: 28px; width: min(440px, calc(100vw - 56px)); padding: 24px; border: 1px solid #d2dacb; border-radius: 16px; background: #fffef9; box-shadow: 0 12px 50px #25302130; }
.sync-recovery button { margin: 8px 8px 0 0; }
