:root {
  color-scheme: light;
  font-family: "Inter", system-ui, sans-serif;
  color: #202b25;
  background: #f9faf6;
  --paper: #fff;
  --surface: #edf0e9;
  --ink: #202b25;
  --muted: #5a655e;
  --green: #205840;
  --line: #d8dfd6;
  --hover: #e4ebe2;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
a { color: var(--green); }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button, select, input, textarea { outline-offset: 3px; }
button { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .75rem; }
button:hover { background: var(--hover); }
button:disabled { opacity: .5; cursor: wait; }
.primary { color: white; background: var(--green); border-color: var(--green); }
.primary:hover { background: #164331; }
.danger { color: #9b332b; }
input, textarea, select { border: 1px solid var(--line); background: var(--paper); border-radius: 7px; padding: .55rem .7rem; min-width: 0; }
textarea { resize: vertical; }
[hidden] { display: none !important; }
.auth { display: grid; min-height: 100dvh; place-items: center; padding: 1.25rem; background: radial-gradient(ellipse at 30% 20%, #dce9da, #f9faf6 60%); }
.auth form { width: min(100%, 25rem); padding: 2rem; display: grid; gap: 1rem; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 18px 60px #273c2810; }
.auth label { display: grid; gap: .35rem; }
.auth h1 { margin: .6rem 0; font: 500 2.2rem Georgia, serif; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; background: var(--green); color: white; width: 2rem; height: 2rem; border-radius: 10px 10px 10px 2px; font: italic 1.25rem Georgia, serif; }
.app { display: grid; grid-template-columns: 258px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; overflow: auto; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem .9rem; }
.sidebar .brand { padding: 0 .35rem .3rem; }
.sidebar label { display: grid; gap: .4rem; padding: 0 .25rem; font-size: .82rem; }
.section-title { color: var(--muted); font-size: .76rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.row, .actions, .topbar { display: flex; align-items: center; gap: .45rem; }
.actions { flex-wrap: wrap; }
.between { justify-content: space-between; }
.tree { display: grid; align-content: start; gap: .15rem; flex: 1; }
.tree button { text-align: start; background: transparent; border-color: transparent; width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tree button:hover, .tree button[aria-current] { background: var(--hover); }
.tree button[aria-current] { color: var(--green); font-weight: 650; }
.topbar { position: sticky; top: 0; z-index: 3; justify-content: space-between; flex-wrap: wrap; padding: .75rem clamp(.8rem, 3vw, 2rem); border-bottom: 1px solid var(--line); background: #f9faf6f5; }
.topbar .path { flex: 1; min-width: 8rem; font-size: .86rem; overflow-wrap: anywhere; }
.mobile-toggle { display: none; }
.document { max-width: 58rem; margin: 0 auto; padding: clamp(1.5rem, 6vw, 4.3rem) clamp(1rem, 5vw, 3rem) 5rem; }
.document .workspace-title { margin: 0 0 .4rem; }
.title-input, .document h1 { width: 100%; font: 500 clamp(2.2rem, 5.8vw, 4rem)/1.04 Georgia, serif; margin: 0 0 1.4rem; padding: .25rem 0; border: 0; background: transparent; letter-spacing: -.045em; overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 2.5rem 0; }
.document section > h2 { font-size: .9rem; margin: 1rem 0; }
.blocks { display: grid; gap: .35rem; margin-block: 1.6rem .7rem; }
.block { display: grid; grid-template-columns: 2rem minmax(0,1fr); gap: .35rem; align-items: start; }
.block-body { display: flex; gap: .5rem; align-items: baseline; background: var(--block-bg,transparent); color: var(--block-ink,inherit); border-radius: 6px; padding-inline: .4rem; min-width: 0; }
.block-menu { position: relative; }
.block-menu > summary { display: grid; place-items: center; cursor: pointer; width: 2rem; min-height: 2rem; border-radius: 7px; color: var(--muted); list-style: none; }
.block-menu > summary:hover, .block-menu[open] > summary { background: var(--hover); }
.block-menu summary::-webkit-details-marker { display: none; }
.popup { z-index: 5; position: absolute; inset: 2rem auto auto 0; display: grid; gap: .55rem; background: var(--paper); min-width: 15rem; max-width: calc(100vw - 3rem); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 30px #16291922; padding: .75rem; }
.popup label { display: grid; gap: .25rem; font-size: .83rem; }
.block textarea { display: block; width: 100%; padding: .3rem .15rem; border: 0; border-radius: 0; background: transparent; color: inherit; resize: none; overflow: hidden; min-height: 2rem; line-height: 1.5; }
.block[data-type="heading1"] textarea { font: 500 2rem/1.25 Georgia, serif; }
.block[data-type="heading2"] textarea { font: 500 1.65rem/1.3 Georgia, serif; }
.block[data-type="heading3"] textarea { font-size: 1.2rem; font-weight: 700; }
.block[data-type="quote"] .block-body { border-left: 3px solid var(--green); padding-left: .65rem; }
.block[data-type="code"] .block-body, .block[data-type="table"] .block-body, .block[data-type="math"] .block-body { background: var(--block-bg,#eff3ee); font-family: ui-monospace, monospace; }
.block hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.info-section { margin-top: 1.5rem; border-top: 1px solid var(--line); padding: .75rem 0; }
.info-section > summary { cursor: pointer; font-weight: 650; color: var(--muted); }
.info-section > :not(summary) { margin-top: .8rem; }
.property, .attachment { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: .45rem 0; }
.property > :nth-child(2) { flex: 1; }
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem; width: min(95%, 40rem); max-height: 90dvh; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #18291f65; }
dialog form { display: grid; gap: .85rem; }
dialog form > label { display: grid; gap: .35rem; }
dialog h2 { margin: 0; font: 500 1.65rem Georgia, serif; }
dialog textarea { min-height: 8rem; }
.ai-output { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: .9rem; }
#status:not(:empty) { position: fixed; z-index: 6; bottom: 1rem; right: 1rem; width: max-content; max-width: calc(100% - 2rem); border-radius: 9px; padding: .65rem .85rem; color: white; background: #214a38; box-shadow: 0 4px 20px #17291f33; }
#status[data-error="true"] { background: #872f2b; }
.read-only article { padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.read-only article :is(p,pre,blockquote) { white-space: pre-wrap; overflow-wrap: anywhere; }
.read-only article pre { padding: .85rem; background: var(--block-bg,#eff3ee); border-radius: 8px; }
.read-only article blockquote { border-left: 3px solid var(--green); margin-left: 0; padding-left: .85rem; }
@media (max-width: 720px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .mobile-toggle { display: inline-block; }
  .sidebar { position: fixed; z-index: 4; width: min(85vw, 280px); translate: -100% 0; visibility: hidden; box-shadow: 0 0 25px #17291f33; }
  .sidebar[data-open] { translate: 0 0; visibility: visible; }
  .sidebar-close { display: block; }
  .topbar { padding-inline: .7rem; }
  .document { padding-top: 1.8rem; }
  .property input { width: 42%; }
}
.block-input { position: relative; width: 100%; }
.slash-menu { inset: calc(100% + .3rem) auto auto 0; max-height: 13rem; overflow: auto; gap: .2rem; }
.slash-menu button { text-align: start; }
.block[data-type="callout"] .block-body { background: var(--block-bg,#eff3ee); }
.block[data-type="heading4"] textarea, .block[data-type="heading5"] textarea, .block[data-type="heading6"] textarea { font-weight: 700; }
.dialog-content { display: grid; gap: .8rem; }
.dialog-content p { margin: 0; }
.read-only .public-block { color: var(--block-ink,inherit); background: var(--block-bg,transparent); border-radius: 6px; }
.read-only article img { display: block; max-width: 100%; height: auto; }
.read-only article pre { background: var(--block-bg,#eff3ee); }
.read-only article hr { border: 0; border-top: 1px solid var(--line); }
.read-only article li { white-space: pre-wrap; }
.table-container { overflow: auto; }
.table-container table { border-collapse: collapse; min-width: 100%; }
.table-container :is(th,td) { padding: .45rem .65rem; border: 1px solid var(--line); text-align: start; }
.invite-list .attachment a { overflow-wrap: anywhere; }
.copy-field { position: fixed; left: -10000px; }
.formula { overflow-x: auto; max-width: 100%; }
.formula:not(:empty) { padding: .2rem .5rem; }
.save-state { border-color: transparent; background: transparent; }
.tree-empty { color: var(--muted); padding: .55rem .7rem; }
