/* The Field Guide 0.2: what base.css and features.css do not already cover. Buttons never move or shrink on click; nothing in a dialog clips its notices. */

.v2-badge { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); font: 500 12px var(--mono); }
.v2-badge .ico { width: 14px; height: 14px; }

/* One size for every control in a bar: 32px. Labels sit centred with their icon. */
.btn.sm { height: 32px; padding: 0 12px; gap: 7px; font-size: 13px; }
.btn.sm .ico { width: 16px; height: 16px; flex: none; }
.btn > span { line-height: 1; }
.v2-ib { width: 32px; height: 32px; }
.v2-ib .ico { width: 17px; height: 17px; }
.g-tabs-acts { gap: 6px; }
.v2-seg { padding: 2px; }
.v2-seg button { height: 28px; padding: 0 12px; gap: 6px; font-size: 12.5px; }
.v2-seg .seg-marker { top: 2px; height: 28px; }
.v2-seg button .ico { width: 15px; height: 15px; }
.v2-acts { display: flex; align-items: center; gap: 8px; }
.v2-full { width: 100%; justify-content: center; }
.v2-textbtn { display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; color: var(--accent-text); font-size: 13px; font-weight: 600; transition: color .15s; }
.v2-textbtn:hover { color: var(--text); }
.v2-textbtn .ico { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.v2-textbtn:hover .ico[data-ico="arrow-right"] { transform: translateX(2px); }

/* The type or kind picker of the new document and new space dialogs: tiles, one chosen, its line under them */
.v2-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.v2-types.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.v2-type { display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 12px; border-radius: var(--r-in); border: 1px solid var(--line-2); background: var(--input); color: var(--text-2); font-size: 13.5px; font-weight: 600; text-align: left; transition: border-color .15s, background-color .15s, color .15s, box-shadow .15s; }
.v2-type .ico { width: 17px; height: 17px; flex: none; color: var(--muted); transition: color .15s; }
.v2-type span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-type:hover { border-color: var(--line-3); color: var(--text); }
.v2-type.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); }
.v2-type.is-on .ico { color: var(--accent-text); }
.v2-type-about { display: block; min-height: 18px; margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.v2-where { display: flex; align-items: flex-start; gap: 9px; margin: 2px 0 0; padding: 10px 12px; border-radius: var(--r-in); background: var(--hover); color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.v2-where .ico { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--accent-text); }
.v2-where b { color: var(--text-2); font-weight: 600; }
@media (max-width: 640px) { .v2-types.is-three { grid-template-columns: minmax(0, 1fr); } }
.v2-textbtn .ico:first-child:not(:last-child) { color: var(--muted); }

/* The shared mark, as in 0.1: the type icon in the share colour, a small share badge */
.dico.is-shared > .ico { color: #5fd4c4; }
.ft-item.is-on .dico.is-shared > .ico { color: #8fe6da; }

/* Space and document headers */
.v2-desc { margin: 2px 0 14px; color: var(--text-2); font-size: 15px; line-height: 1.55; max-width: 760px; }
.pv .v2-desc { margin: 10px 0 22px; }
.v2-sub { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.v2-sub .ico { width: 15px; height: 15px; }
.v2-docmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 24px; }
.v2-meta-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.v2-meta-item .ico { width: 15px; height: 15px; }
.v2-shared-pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: rgba(95, 212, 196, .12); color: #8fe6da; font-size: 12.5px; font-weight: 600; }
.v2-shared-pill .ico { width: 14px; height: 14px; }

/* Tables */
.g-trow.v2-group { grid-template-columns: minmax(200px, 1fr) minmax(240px, 1.6fr) 140px; }
.v2-clip { display: block !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

/* Details: sections instead of tabs */
.v2-info { padding: 4px 16px 24px; }
.v2-sec { display: grid; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.v2-sec.is-last { border-bottom: 0; }
.v2-sec h4 { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.v2-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.v2-space-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--text); font-size: 12.5px; font-weight: 500; transition: background-color .15s; }
button.v2-space-chip:hover { background: color-mix(in srgb, var(--c) 22%, transparent); }
.v2-space-chip .ico { width: 14px; height: 14px; color: var(--c); }
.v2-quiet { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13px; line-height: 1.5; }
.v2-quiet .ico { flex: none; width: 15px; height: 15px; margin-top: 2px; }
.v2-kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; font-size: 13px; color: var(--muted); }
.v2-kv > span { display: inline-flex; align-items: center; gap: 8px; }
.v2-kv > span .ico { width: 15px; height: 15px; }
.v2-kv > b { display: grid; justify-items: end; color: var(--text); font-weight: 600; text-align: right; }
.v2-kv > b small { color: var(--muted); font-size: 11.5px; font-weight: 500; }
.v2-kv-btn { width: calc(100% + 16px); margin: 0 -8px; padding: 0 8px; border-radius: var(--r-btn); transition: background-color .15s, color .15s; }
.v2-kv-btn:hover { background: var(--hover); color: var(--text); }
.v2-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.v2-switch-row > span { display: grid; font-size: 13px; }
.v2-switch-row small { color: var(--muted); font-size: 12px; }
.v2-person { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.v2-person .ico { width: 16px; height: 16px; color: var(--muted); }
.v2-dd .gi-pick { width: 100%; }
.v2-dd .gi-pick > span { flex: 1; }
.v2-dd .dd-menu { min-width: 100%; }
.v2-dd-inline { position: relative; }
.v2-dd-inline .dd-menu { left: auto; right: 0; min-width: 170px; transform-origin: top right; }
.v2-dd-item { align-items: flex-start; white-space: normal; }
.v2-dd-item > .ico:first-child { margin-top: 2px; }
.v2-dd-item > span { display: grid; gap: 2px; }
.v2-dd-item small { color: var(--muted); font-size: 12px; line-height: 1.4; }

/* Folded lists (links, the store's operations) */
.v2-fold { display: flex; align-items: center; gap: 8px; width: calc(100% + 16px); min-height: 32px; margin: 0 -8px; padding: 0 8px; border-radius: var(--r-btn); color: var(--text-2); font-size: 13px; text-align: left; transition: background-color .15s; }
.v2-fold:hover:not(:disabled) { background: var(--hover); }
.v2-fold:disabled { color: var(--muted); }
.v2-fold > .ico { width: 14px; height: 14px; color: var(--muted); transition: transform .2s var(--ease); }
.v2-fold:disabled > .ico { opacity: .4; }
.v2-fold.is-open > .ico { transform: rotate(90deg); }
.v2-fold > span { flex: 1; }
.v2-fold > b { color: var(--muted); font: 500 12px var(--mono); }
.v2-fold-body { display: grid; gap: 2px; }
.v2-fold-body[hidden], .v2-moves[hidden] { display: none; }
.v2-link { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 8px 0 22px; border-radius: var(--r-btn); font-size: 13px; text-align: left; transition: background-color .15s; }
.v2-link:hover { background: var(--hover); }
.v2-link > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-link.is-ghost { color: var(--muted); }
.v2-hist { display: flex; align-items: flex-start; gap: 10px; padding: 4px 0; }
.v2-hist > i { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--hover-strong); color: var(--muted); font-style: normal; }
.v2-hist > i .ico { width: 14px; height: 14px; }
.v2-hist > span { display: grid; flex: 1; min-width: 0; font-size: 13px; }
.v2-hist b { font-weight: 500; overflow-wrap: anywhere; }
.v2-hist small { color: var(--muted); font-size: 11.5px; }
.dlg-body .v2-hist { padding: 8px 0; }
.dlg-body .v2-hist + .v2-hist { border-top: 1px solid var(--line); }

/* Dialogs: picking spaces, a new parent */
.v2-picks-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 6px; padding: 0 10px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.v2-picks-head .v2-textbtn { text-transform: none; letter-spacing: 0; font-size: 13px; }
.v2-picks { display: grid; gap: 2px; }
.v2-pick { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 4px 10px 4px calc(10px + var(--d) * 20px); border-radius: var(--r-btn); text-align: left; cursor: pointer; transition: background-color .15s; }
.v2-pick:hover { background: var(--hover); }
.v2-pick > span { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.v2-pick > span .ico { width: 16px; height: 16px; flex: none; color: var(--c); }
.v2-pick b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .15s; }
.v2-pick small { color: var(--muted); font-size: 12px; }
.v2-pick:not(.is-on) b { color: var(--text-2); }
.v2-target > .ico { width: 16px; height: 16px; color: var(--accent-text); opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s var(--ease); }
.v2-target.is-on { background: var(--hover-strong); }
.v2-target.is-on > .ico { opacity: 1; transform: none; }
.v2-preview, .v2-warn { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-btn); border: 1px solid var(--line-2); background: var(--panel-2); font-size: 13px; line-height: 1.5; }
.v2-preview .ico, .v2-warn .ico { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--accent-text); }
.v2-preview.is-bad .ico, .v2-warn .ico { color: var(--warn); }
.v2-warn { margin-top: 8px; border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }

.v2-disclose { margin-top: 8px; }
.v2-moves { display: grid; gap: 6px; margin-top: 4px; padding: 10px 12px; border-radius: var(--r-btn); background: var(--code); overflow: hidden; }
.v2-moves > div { display: grid; gap: 2px; }
.v2-moves > div + div { padding-top: 6px; border-top: 1px solid var(--line); }
.v2-moves > div > span { display: flex; align-items: center; gap: 6px; }
.v2-moves code { font: 12px var(--mono); color: var(--text); overflow-wrap: anywhere; }
.v2-moves code.was { color: var(--muted); }
.v2-moves .ico { width: 14px; height: 14px; color: var(--muted); }
.v2-op { color: var(--accent-text); font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.v2-note { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.v2-note .ico { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--accent-text); }
.g-code { margin: 8px 0; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--code); font: 13px/1.6 var(--mono); color: var(--text-2); overflow-x: auto; white-space: pre; }
dialog.dlg:focus { outline: none; }

@media (max-width: 760px) {
	.g-trow.v2-group { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
	.g-trow.v2-group > :nth-child(3), .g-thead.v2-group > :nth-child(2) { display: none; }
	.pv-head .v2-acts { width: 100%; }
	.pv-head .v2-acts .btn { flex: 1; justify-content: center; }
}

/* Markdown tables in a document */
.g-tablewrap { margin: 10px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.g-mdtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.g-mdtable th, .g-mdtable td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.g-mdtable th { color: var(--muted); font-weight: 600; background: var(--panel-2); }
.g-mdtable tr:last-child td { border-bottom: 0; }

/* Filter hits carry their spaces under the title */
.ft-hit > span { display: grid; min-width: 0; }
.ft-hit small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Edit mode: the title and the description are fields that look like what they edit */
input.v2-title-in { display: block; }
input.v2-title-in:hover { background: var(--hover); }
.v2-desc-in { display: block; width: 100%; margin: 2px 0 14px -6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-size: 15px; line-height: 1.55; max-width: 766px; outline: none; transition: background-color .15s; }
.v2-desc-in:hover { background: var(--hover); }
.v2-desc-in:focus { background: var(--hover); box-shadow: 0 0 0 2px var(--accent-soft); }
.v2-desc-in::placeholder { color: var(--muted); }

/* Links: coloured, brighter on hover, never underlined */
.wikilink, .wikilink.is-ghost { border-bottom: 0; text-decoration: none; }
.g-body a { text-decoration: none; }

/* Fields draw their own focus (border and glow): no second ring from :focus-visible */
input:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible { outline: none; }

/* A document's title and description take the same box in View and Edit */
.g-note .v2-desc { margin-left: -6px; padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; outline: none; transition: background-color .15s; }
.v2-desc.is-editable:hover, .v2-desc.is-editable:focus { background: var(--hover); }
.v2-desc.is-editable:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.v2-desc.is-editable:empty::before { content: attr(data-placeholder); color: var(--muted); }

/* Open tabs: a fade on the side that has more, and a thin bar laid over the line under them (no room taken) */
@property --fl { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --fr { syntax: "<length>"; inherits: false; initial-value: 0px; }
.g-tabs { position: relative; }
.g-tablist { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; --fl: 0px; --fr: 0px; mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%); transition: --fl .2s, --fr .2s; }
.g-tablist::-webkit-scrollbar { display: none; }
.g-tabbar { position: absolute; bottom: -4px; height: 8px; z-index: 2; opacity: 0; pointer-events: none; transition: opacity .2s; }
.g-tabbar.is-on { opacity: 1; pointer-events: auto; cursor: pointer; }
.g-tabbar span { position: absolute; left: 0; bottom: 3px; height: 3px; border-radius: 3px; background: var(--thumb); transition: height .15s, bottom .15s, background-color .15s; }
.g-tabbar:hover span, .g-tabbar.is-drag span { bottom: 2px; height: 5px; background: var(--line-3); }
.g-tablist.fade-l { --fl: 32px; }
.g-tablist.fade-r { --fr: 32px; }

/* The text's placeholder while a document loads: lines where the first paragraph's lines will be */
.g-body-ph { display: grid; gap: 15px; padding-top: 15px; }
.g-body-ph br { display: none; }
.g-body-ph .ph:nth-child(5) { margin-top: 12px; }

/* The tree row a right-click menu is open for: the whole row, chevron and all, like a chosen row */
.ft-row.is-ctx { background: var(--hover); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); }

/* Collapse all, beside the Spaces label: there while something is open */
.ft-collapse { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; height: 22px; padding: 0 7px; border-radius: 6px; font-family: "Noto Sans", system-ui, sans-serif; font-size: 11.5px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); opacity: 0; pointer-events: none; transition: opacity .18s, background-color .15s, color .15s; }
.ft-collapse.is-on { opacity: 1; pointer-events: auto; }
.ft-collapse:hover { background: var(--hover); color: var(--text); }
.ft-collapse .ico { width: 13px; height: 13px; }
