/* IdeaBucket — white notebook, minimal */
:root {
  --bg: #ffffff;
  --soft: #f7f6f3;
  --ink: #181715;
  --graphite: #3f3c37;
  --muted: #67635b;
  --line: #e4e1db;
  --line-strong: #c9c5bd;
  --dot: #d6d2ca;
  --red: #c4462f;
  --keep: #2f7a55;
  --park: #a87318;
  --t-yellow: #fdf5d6;
  --t-pink: #fcebe7;
  --t-blue: #e9f1f8;
  --t-green: #ebf4e5;
  --t-lilac: #f2eef9;
  --t-white: #ffffff;
  --hand: 'Mali', 'IBM Plex Sans Thai', cursive;
  --ui: 'IBM Plex Sans Thai', system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(31, 30, 28, .05), 0 4px 14px -6px rgba(31, 30, 28, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.6 var(--ui); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; top: -100px; left: 10px; background: var(--bg); padding: 10px 14px; z-index: 100; border: 1px solid var(--ink); border-radius: 8px; }
.skip:focus { top: 10px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
kbd { font: 12px/1 var(--ui); padding: 2px 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); background: var(--bg); }
.eyebrow { font: 500 13px/1.4 var(--ui); color: var(--muted); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; margin-left: 6px; border-radius: 9px; background: var(--soft); color: var(--graphite); font-size: 12px; font-weight: 600; }
.count:empty { display: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 14px; cursor: pointer; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; font-size: 14px; line-height: 1.3; text-align: center; transition: border-color .12s, background .12s; -webkit-tap-highlight-color: transparent; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #3a3835; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--soft); border-color: transparent; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13.5px; }
.btn.round { width: 34px; min-height: 34px; padding: 0; border-radius: 50%; }
.btn.full { width: 100%; margin-top: 8px; }
.btn.on-keep { border-color: var(--keep); color: var(--keep); background: var(--t-green); font-weight: 600; }
.btn.on-park { border-color: var(--park); color: var(--park); background: var(--t-yellow); font-weight: 600; }
.danger { color: var(--red) !important; }
.btn.dangerfill { background: var(--red); border-color: var(--red); color: #fff; }
.btn kbd { margin-left: 4px; }

/* segmented choice */
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; background: var(--soft); border-radius: 9px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 7px; padding: 6px 8px; min-height: 32px; font-size: 13.5px; color: var(--graphite); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--bg); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.seg.compact { flex: 0 0 auto; flex-wrap: nowrap; }

/* ---------- top bar ---------- */
.topbar { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brandmark { width: 28px; height: 28px; display: grid; place-items: center; background: var(--ink); color: #fff; font: 600 15px/1 var(--hand); border-radius: 7px; }
.brandname { font: 600 18px/1 var(--hand); }
.topactions { display: flex; align-items: center; gap: 4px; }
.topactions .btn { white-space: nowrap; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr) 340px; height: calc(100dvh - 56px); }

/* ---------- shelf ---------- */
.shelf { border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; background: var(--bg); }
.shelf > .btn { width: 100%; }
.shelfhead { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; padding: 6px 8px 0; }
#boards { display: flex; flex-direction: column; gap: 2px; overflow: auto; scrollbar-width: thin; }
.notebook { --nb: var(--red); display: block; position: relative; text-align: left; cursor: pointer; border: 0; background: transparent; padding: 8px 10px 8px 24px; border-radius: 8px; }
.notebook::before { content: ''; position: absolute; left: 10px; top: 15px; width: 6px; height: 6px; border-radius: 50%; background: var(--nb); }
.notebook:nth-child(5n+2) { --nb: #3e6b8c; }
.notebook:nth-child(5n+3) { --nb: var(--keep); }
.notebook:nth-child(5n+4) { --nb: #b8862a; }
.notebook:nth-child(5n+5) { --nb: #7b5c9a; }
.notebook:hover, .notebook.active { background: var(--soft); }
.nbtitle { display: block; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.notebook.active .nbtitle { font-weight: 600; }
.notebook small { display: block; color: var(--muted); font-size: 12.5px; }
.shelfnote { margin-top: auto; padding: 0 8px; }
.localnote { font-size: 12.5px; color: var(--muted); margin: 0; }

/* ---------- workspace ---------- */
main { min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.workhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 16px 24px 8px; }
.workhead h1 { font: 600 22px/1.35 var(--hand); margin: 2px 0 0; overflow-wrap: anywhere; }
.worktools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 0 16px 0 24px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 18px; align-self: stretch; }
.tabs button { border: 0; background: transparent; cursor: pointer; padding: 10px 0; font-size: 14.5px; color: var(--muted); box-shadow: inset 0 -2px 0 transparent; }
.tabs button.active { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }
.maptools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: auto; padding: 7px 0; }
.search { position: relative; display: flex; align-items: center; }
.search input { width: 150px; min-height: 32px; padding: 5px 44px 5px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); font-size: 14px; }
.search input:focus { border-color: var(--ink); background: var(--bg); outline: none; }
.searchcount { position: absolute; right: 10px; font-size: 12px; color: var(--muted); pointer-events: none; }
.filters { display: flex; gap: 2px; }
.chip { border: 0; background: transparent; border-radius: 7px; padding: 4px 7px; min-height: 30px; font-size: 13.5px; cursor: pointer; color: var(--muted); }
.chip:hover { background: var(--soft); color: var(--ink); }
.chip.active { background: var(--soft); color: var(--ink); font-weight: 600; }
.history { display: flex; }
.history .btn { min-width: 32px; padding: 4px 6px; }
.history .btn svg { display: block; }

/* ---------- board: dot-grid notebook page ---------- */
.maparea { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.board {
  --px: 0px; --py: 0px; --gs: 28px;
  position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--dot) 1.1px, transparent 1.4px);
  background-size: var(--gs) var(--gs);
  background-position: var(--px) var(--py);
}
.board:focus { outline: none; }
.board:focus-visible { box-shadow: inset 0 0 0 2px var(--line-strong); }
.board.panning, .board.dragging-card, .board.panning .card, .board.dragging-card .card { cursor: grabbing; }
.board.spacepan .card { cursor: grab; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.edge { fill: none; stroke: #b3aea4; stroke-width: 1.8; stroke-linecap: round; }
.edge.soft { stroke-dasharray: 2 5; }
.edge.link { stroke: var(--red); stroke-dasharray: 6 6; stroke-width: 1.4; opacity: .7; }

/* cards */
.card { --tone: var(--t-white); position: absolute; width: 224px; padding: 13px 14px 9px; transform: translate(-50%, -50%); background: var(--tone); border: 1px solid rgba(31, 30, 28, .14); border-radius: 10px; box-shadow: 0 1px 2px rgba(31, 30, 28, .04); cursor: pointer; transition: box-shadow .15s, opacity .2s; }
.tone-yellow { --tone: var(--t-yellow); }
.tone-pink { --tone: var(--t-pink); }
.tone-blue { --tone: var(--t-blue); }
.tone-green { --tone: var(--t-green); }
.tone-lilac { --tone: var(--t-lilac); }
.tone-white { --tone: var(--t-white); }
.clabel { display: block; font: 600 16px/1.5 var(--hand); color: var(--ink); overflow-wrap: anywhere; }
.cfoot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); min-height: 18px; }
.cfoot > span:first-child { display: inline-flex; gap: 6px; align-items: center; }
.stamp { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.stamp::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-keep .stamp { color: var(--keep); }
.st-park .stamp { color: var(--park); }
.st-park:not(.root) .clabel { color: var(--graphite); }
.ai { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; line-height: 15px; }
.card.collapsed { box-shadow: 0 1px 2px rgba(31, 30, 28, .04), 4px 4px 0 -1px var(--bg), 4px 4px 0 0 var(--line-strong); }
.card.collapsed .kids { color: var(--ink); font-weight: 600; }
.card.root { width: 270px; padding: 18px 18px 12px; background: var(--bg); border: 1.5px solid var(--ink); border-radius: 12px; }
.card.root .clabel { font-size: 19px; font-weight: 600; line-height: 1.4; }
.card:hover { box-shadow: var(--shadow); }
.card.selected { outline: 2px solid var(--ink); outline-offset: 3px; z-index: 3; box-shadow: var(--shadow); }
.card.dragging { z-index: 4; box-shadow: 0 16px 32px -12px rgba(31, 30, 28, .3); transition: none; }
.card.dim { opacity: .32; }
.card.match .clabel { background: linear-gradient(transparent 60%, rgba(255, 214, 64, .6) 60%); box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* ---------- motion ---------- */
.card { transition: box-shadow .15s, opacity .2s, translate .22s cubic-bezier(.2, .9, .3, 1.4); }
.card:hover { translate: 0 -2px; }
.board.panning .card, .board.dragging-card .card { translate: none; }
.card.ghost { pointer-events: none; z-index: 0; }
.card.just-selected { animation: selpop .34s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes selpop { from { outline-offset: 10px; outline-color: transparent; } }
/* AI cards land with a soft highlighter glow */
.card.fresh { animation: glow 1.6s ease-out; }
@keyframes glow {
  20% { box-shadow: 0 0 0 6px rgba(255, 206, 84, .5), var(--shadow); }
  100% { box-shadow: 0 0 0 16px rgba(255, 206, 84, 0), 0 1px 2px rgba(31, 30, 28, .04); }
}
/* status stamp: pressed onto the card */
.card.stamped .stamp { animation: stamp .5s cubic-bezier(.2, .9, .3, 1.4); transform-origin: left center; }
@keyframes stamp { 0% { transform: scale(2.4) rotate(-10deg); opacity: 0; } 55% { opacity: 1; } }
.card.stamped.st-keep::after { content: ''; position: absolute; inset: -1px; border-radius: inherit; border: 2px solid var(--keep); pointer-events: none; animation: ripple .75s ease-out forwards; }
@keyframes ripple { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(1.16); } }
.card.stamped.st-park { animation: settle .55s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes settle { 0% { translate: 0 -8px; rotate: -1.5deg; } 60% { translate: 0 1px; rotate: .4deg; } }
/* AI thinking on a card */
.card.thinking::before { content: ''; position: absolute; inset: -7px; border: 1.5px dashed var(--ink); border-radius: 15px; opacity: .45; pointer-events: none; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { inset: -12px; opacity: .12; } }
.think { display: inline-flex; gap: 3px; align-items: center; }
.think i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); animation: bob 1s ease-in-out infinite; }
.think i:nth-child(2) { animation-delay: .15s; }
.think i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 80%, 100% { transform: translateY(0); opacity: .3; } 40% { transform: translateY(-4px); opacity: 1; } }
/* overlays pop in */
.selbar { animation: pop .2s cubic-bezier(.2, .9, .3, 1.2); transform-origin: bottom center; }
.quickadd { animation: pop .22s cubic-bezier(.2, .9, .3, 1.2); transform-origin: top center; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.96); } }
.skel { display: grid; gap: 10px; margin-top: 16px; }
.skel i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--soft) 30%, #ecebe6 50%, var(--soft) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.skel i:nth-child(1) { height: 20px; width: 70%; }
.skel i:nth-child(3) { width: 88%; }
.skel i:nth-child(4) { width: 60%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* overlays */
.selbar { position: absolute; z-index: 6; display: flex; gap: 1px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.selbar button { border: 0; background: transparent; font-size: 13.5px; padding: 5px 9px; min-height: 30px; border-radius: 7px; cursor: pointer; white-space: nowrap; color: var(--graphite); }
.selbar button:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
.selbar button:disabled { opacity: .4; cursor: default; }
.selbar [data-sel="ai"] { color: var(--ink); font-weight: 600; }
.quickadd { position: absolute; z-index: 7; width: 290px; padding: 12px 14px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.quickadd input { width: 100%; border: 0; border-bottom: 1px solid var(--line-strong); background: transparent; font: 500 16px/1.5 var(--hand); padding: 3px 0; }
.quickadd input:focus { outline: none; border-bottom-color: var(--ink); }
.quickadd small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.maphint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2; margin: 0; padding: 4px 12px; max-width: calc(100% - 32px); text-align: center; font-size: 12.5px; color: var(--muted); background: rgba(255, 255, 255, .9); border-radius: 8px; pointer-events: none; transition: opacity .6s; }
.maphint.gone { opacity: 0; }
.legend { position: absolute; left: 16px; bottom: 14px; z-index: 2; display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); pointer-events: none; background: rgba(255, 255, 255, .85); padding: 3px 6px; border-radius: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.keep { background: var(--keep); }
.dot.park { background: var(--park); }
.line.link { width: 16px; border-top: 1.5px dashed var(--red); display: inline-block; }
.viewctl { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.minimap { width: 168px; height: 108px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: crosshair; touch-action: none; box-shadow: var(--shadow); }
.minimap svg { display: block; }
.mn { fill: var(--tone); stroke: rgba(31, 30, 28, .2); stroke-width: .6; }
.mn.sel { stroke: var(--ink); stroke-width: 1.4; }
.mview { fill: rgba(31, 30, 28, .04); stroke: var(--ink); stroke-width: 1; }
.zoom { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.zoom button { border: 0; background: transparent; min-width: 34px; min-height: 34px; padding: 0 8px; cursor: pointer; font-size: 15px; color: var(--graphite); }
.zoom button:hover { background: var(--soft); color: var(--ink); }
.zoom #zoomValue { min-width: 52px; font-size: 13px; }
.zoom [aria-pressed="false"] { opacity: .45; }

/* ---------- inspector ---------- */
.inspector { overflow: auto; padding: 20px 20px 32px; border-left: 1px solid var(--line); background: var(--bg); }
.sheet { padding: 2px 0 6px; }
.sheethead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sheet .eyebrow { display: inline-flex; align-items: center; gap: 7px; }
.sheet .eyebrow::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--tone, var(--bg)); border: 1px solid rgba(31, 30, 28, .2); }
.tag { font-size: 12px; padding: 1px 8px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--muted); }
.sheet h2 { font: 600 21px/1.45 var(--hand); margin: 8px 0 6px; overflow-wrap: anywhere; }
.note { font-size: 14.5px; line-height: 1.8; color: var(--graphite); white-space: pre-wrap; margin: 0 0 6px; overflow-wrap: anywhere; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.crumbs button { border: 0; background: none; padding: 1px 0; cursor: pointer; color: var(--muted); font-size: 13px; }
.crumbs button:hover { color: var(--ink); text-decoration: underline; }
.sheet > .btn { margin-left: -10px; }
.block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.sectiontitle { font-size: 14px; font-weight: 600; margin: 0 0 10px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.autorow { display: flex; gap: 8px; margin-top: 10px; }
.autorow .btn { flex: 1; }
.mode { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.loading { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; padding: 8px 10px; font-size: 13.5px; background: var(--soft); border-radius: 8px; color: var(--graphite); }
.loading::before { content: ''; width: 12px; height: 12px; flex: 0 0 auto; border: 2px solid var(--line-strong); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
.loading span { flex: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.small { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 8px 0 0; }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(31, 30, 28, .18); background: var(--tone); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--ink); }
.hintbox { margin-top: 20px; padding: 12px 14px; background: var(--soft); border-radius: 10px; }
.hintbox b { font-size: 13.5px; }
.hintbox p { font-size: 13px; color: var(--muted); margin: 4px 0 0; line-height: 1.7; }
.back { margin: -6px 0 10px -10px; }
.inspector > .sectiontitle { margin-top: 22px; }
.memoryitem { padding: 10px 0; border-bottom: 1px solid var(--line); }
.memoryitem b { font-weight: 600; }
.memoryitem p { margin: 4px 0; font-size: 14px; color: var(--graphite); }
.memoryitem small { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); }
.suggestion { background: var(--tone); padding: 14px; margin: 12px 0; border: 1px solid rgba(31, 30, 28, .08); border-radius: 10px; }
.suggestion h3 { font: 600 16.5px/1.45 var(--hand); margin: 0 0 6px; }
.suggestion p { font-size: 14px; margin: 6px 0; color: var(--graphite); line-height: 1.7; }

/* ---------- summary & concept: ruled notebook page ---------- */
.conceptarea { flex: 1; overflow: auto; padding: 28px 20px 48px; background: var(--soft); }
.paper { max-width: 760px; margin: 0 auto; padding: 40px 48px 40px 76px; background-color: var(--bg); border: 1px solid var(--line); border-radius: 4px; background-image: linear-gradient(to right, transparent 52px, rgba(196, 70, 47, .28) 52px, rgba(196, 70, 47, .28) 53px, transparent 53px); }
.paper h2 { font: 600 28px/1.35 var(--hand); margin: 2px 0 18px; }
.summary { padding: 18px 0 8px; border-top: 1px solid var(--line); }
.summary.empty > p:first-child { color: var(--graphite); margin-top: 0; }
.summary h3, .parthead { font-size: 14px; font-weight: 600; color: var(--muted); margin: 22px 0 8px; }
.parthead { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); }
.headline { font: 600 21px/1.5 var(--hand); margin: 0 0 8px; }
.essence { color: var(--graphite); line-height: 1.85; margin: 0; }
.theme { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.theme b { font-weight: 600; }
.theme p { margin: 4px 0 6px; color: var(--graphite); line-height: 1.75; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nodechip { border: 1px solid var(--line-strong); background: var(--bg); border-radius: 14px; padding: 2px 10px; font: 14px/1.6 var(--hand); cursor: pointer; text-align: left; }
.nodechip:hover { border-color: var(--ink); }
.summary ul, .summary ol { margin: 0; padding-left: 20px; color: var(--graphite); }
.summary li { margin: 4px 0; line-height: 1.75; }
.stale { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--t-yellow); border-radius: 8px; font-size: 13.5px; color: #6b5212; margin: 0 0 14px; }
.row { display: flex; gap: 6px; margin-top: 12px; }
.concept { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.concept .num { font: 600 16px/1.6 var(--hand); color: var(--muted); min-width: 26px; }
.concept h4 { font: 600 17px/1.45 var(--hand); margin: 0 0 4px; }
.concept p { margin: 4px 0; color: var(--graphite); white-space: pre-wrap; line-height: 1.75; }
.concept .why { color: var(--ink); }
.concept .btn { margin-left: -10px; }
.paper > .btn { margin-top: 22px; }

/* ---------- dialog ---------- */
dialog { width: min(560px, calc(100% - 32px)); max-height: 86dvh; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink); box-shadow: 0 24px 64px -16px rgba(31, 30, 28, .3); }
dialog::backdrop { background: rgba(31, 30, 28, .25); }
dialog h2 { font: 600 21px/1.4 var(--hand); margin: 4px 0 10px; }
dialog p, dialog li { font-size: 15px; line-height: 1.8; color: var(--graphite); }
dialog label { display: block; margin: 14px 0 6px; font-size: 14px; font-weight: 500; }
input:not([type=file]):not([type=search]), textarea, select { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); font-size: 15px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink); }
textarea { resize: vertical; min-height: 110px; line-height: 1.7; }
.quote { font: 500 16px/1.6 var(--hand); color: var(--ink) !important; padding-left: 12px; border-left: 2px solid var(--line-strong); }
.steps { padding-left: 20px; }
.dialogActions { display: flex; align-items: center; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.dialogActions .spacer { flex: 1; }
.warning { color: var(--red) !important; font-size: 14px; min-height: 1em; margin: 8px 0 0; }
.filegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 8px; }
.keys { width: 100%; border-collapse: collapse; font-size: 14px; }
.keys td { padding: 6px 4px; border-bottom: 1px solid var(--line); color: var(--graphite); vertical-align: top; }
.keys td:first-child { white-space: nowrap; padding-right: 14px; color: var(--ink); }

#toast { position: fixed; left: 50%; bottom: 84px; z-index: 30; transform: translateX(-50%); max-width: min(520px, calc(100% - 32px)); padding: 10px 16px; background: var(--ink); color: #fff; font-size: 14.5px; border-radius: 10px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4); display: none; }
#toast.show { display: block; }
#toast.show { animation: toastIn .34s cubic-bezier(.2, .9, .3, 1.25); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px) scale(.96); } }
dialog[open] { animation: dlgIn .26s cubic-bezier(.2, .9, .3, 1.15); }
dialog[open]::backdrop { animation: fadeIn .22s ease-out; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- members, sharing ---------- */
body.booting .app, body.booting .topactions { visibility: hidden; }
body.auth-mode .app, body.auth-mode .topactions { display: none; }
.authview { min-height: calc(100dvh - 56px); display: grid; place-items: center; padding: 32px 16px; background-color: var(--bg); background-image: radial-gradient(circle, var(--dot) 1.1px, transparent 1.4px); background-size: 28px 28px; }
.authcard { width: min(420px, 100%); padding: 32px 30px 24px; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px -28px rgba(31, 30, 28, .3); animation: dlgIn .4s cubic-bezier(.2, .9, .3, 1.15); }
.authbrand { display: flex; align-items: center; gap: 10px; }
.authcard h1 { font: 600 26px/1.35 var(--hand); margin: 18px 0 6px; }
.authlead { color: var(--graphite); margin: 0 0 20px; line-height: 1.75; }
.authtabs { margin-bottom: 4px; }
.authcard label { display: block; margin: 14px 0 6px; font-size: 14px; font-weight: 500; }
.authcard .btn.full { margin-top: 16px; min-height: 44px; font-size: 15px; }
.authfoot { text-align: center; margin-top: 16px; }
.account { width: 34px; height: 34px; margin-left: 6px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font: 600 15px/1 var(--hand); cursor: pointer; display: grid; place-items: center; }
.account:hover { background: #3a3835; }
.headactions { display: flex; gap: 6px; align-items: center; }
#shareButton svg { margin-right: 2px; }
.sharebanner, .sharedbanner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 24px 0; padding: 9px 14px; background: var(--t-blue); border-radius: 10px; font-size: 14px; color: var(--graphite); }
.sharedbanner b { color: var(--ink); }
body.readonly #newBoard, body.readonly #renameBoard, body.readonly #shareButton, body.readonly #memoryButton, body.readonly #fileButton,
body.readonly #summaryButton, body.readonly #tidyButton, body.readonly .history, body.readonly #selbar, body.readonly #quickadd,
body.readonly .shelfnote, body.readonly [data-action="summarize"], body.readonly [data-action="clear-summary"], body.readonly .concept .btn { display: none !important; }
body.readonly .card { cursor: pointer; }
.sharednb::before { background: var(--muted) !important; }
a.notebook { text-decoration: none; }
.quota { margin: 14px 0 4px; }
.quotabar { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.quotabar i { display: block; height: 100%; background: var(--ink); border-radius: 4px; transition: width .4s; }
.sharewho { font-size: 14px; margin: 0 0 6px; }
.shareopt { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.shareopt.col { flex-direction: column; align-items: stretch; gap: 8px; }
.shareopt b { font-size: 15px; }
.shareopt .small { margin-top: 2px; }
.switch { position: relative; flex: 0 0 auto; width: 46px; height: 26px; border-radius: 13px; border: 0; background: var(--line-strong); cursor: pointer; transition: background .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s cubic-bezier(.2, .9, .3, 1.3); }
.switch[aria-checked="true"] { background: var(--keep); }
.switch[aria-checked="true"] i { transform: translateX(20px); }
.inviterow { display: flex; gap: 8px; }
.inviterow input { flex: 1; min-width: 0; }
.invites { list-style: none; margin: 4px 0 0; padding: 0; }
.invites li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--graphite); text-decoration: underline; cursor: pointer; font-size: inherit; }
dialog > #dialogContent > label { margin-top: 16px; }

/* ---------- admin console ---------- */
body.admin-mode .app, body.admin-mode #memoryButton, body.admin-mode #fileButton, body.admin-mode #helpButton { display: none; }
.adminview { min-height: calc(100dvh - 56px); background: var(--soft); padding: 28px 24px 56px; }
.adminwrap { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
#userSearch { width: 210px; padding-right: 12px; }
@media (max-width: 600px) { #userSearch { width: 100%; } .userfilters .search { flex: 1 1 100%; } }
.adminhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.adminhead h1 { font: 600 28px/1.3 var(--hand); margin: 2px 0 0; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.stat b { font: 600 28px/1.25 var(--hand); }
.stat .small { margin: 0; }
.admingrid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
.panelcard { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; min-width: 0; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cardhead.wrap { flex-wrap: wrap; }
.cardhead h2 { font: 600 18px/1.4 var(--hand); margin: 0; display: flex; align-items: center; }
.cardhead .small { margin: 0; }
.barchart { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; align-items: end; height: 180px; padding-top: 18px; }
.bar { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar i { display: block; width: 100%; max-width: 28px; background: var(--line-strong); border-radius: 5px 5px 2px 2px; transform-origin: bottom; animation: grow .6s cubic-bezier(.2, .9, .3, 1.15) both; }
.bar i { animation-delay: calc(var(--d, 0) * 1s); }
.bar.today i { background: var(--ink); }
.bar:hover i { background: var(--graphite); }
@keyframes grow { from { transform: scaleY(0); } }
.bv { font-size: 12px; color: var(--graphite); min-height: 18px; }
.bl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.bs { position: absolute; top: -16px; font-size: 11px; font-weight: 600; color: var(--keep); }
.settingrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.panelcard .settingrow:first-of-type { border-top: 0; padding-top: 0; }
.settingrow b { font-size: 15px; }
.settingrow .small { margin-top: 2px; }
.inviterow.narrow { flex: 0 0 auto; }
.inviterow.narrow input { width: 90px; }
.userfilters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tablewrap { position: relative; overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.users th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.users td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users tr:last-child td { border-bottom: 0; }
.users tbody tr { transition: background .15s; }
.users tbody tr:hover { background: var(--soft); }
.users tr.off td { opacity: .55; }
.users tr.off td:last-child { opacity: 1; }
.users td .small { margin: 0; }
.who { display: flex; gap: 10px; align-items: center; }
.avatar { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--t-yellow); font: 600 14px/1 var(--hand); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 9px; background: var(--soft); border: 1px solid var(--line-strong); color: var(--graphite); vertical-align: 1px; }
.badge.red { background: var(--t-pink); border-color: rgba(196, 70, 47, .35); color: var(--red); }
.minibar { width: 84px; height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; margin-bottom: 3px; }
.minibar i { display: block; height: 100%; background: var(--ink); }
.minibar.full i { background: var(--red); }
.adminlog { list-style: none; margin: 0; padding: 0; }
.adminlog li { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; align-items: baseline; }
.adminlog li:last-child { border-bottom: 0; }
.adminlog .small { margin: 0; }
.muted { color: var(--muted); }
.dangerzone { margin-top: 18px; padding: 4px 14px; border: 1px solid rgba(196, 70, 47, .25); border-radius: 10px; }
.dangerzone .settingrow:first-child { border-top: 0; }
.tempbox { padding: 10px 0 12px; }
.tempbox label { margin-top: 0; }
#tempPw { font-family: ui-monospace, Menlo, monospace; letter-spacing: .04em; }
.switch.danger[aria-checked="true"] { background: var(--red); }
.switch:disabled { opacity: .4; cursor: default; }
.seg button:disabled { opacity: .4; cursor: default; }
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .admingrid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .adminview { padding: 18px 12px 40px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat b { font-size: 23px; }
  .panelcard { padding: 16px 14px; }
  .tablewrap { margin: 0 -14px; padding: 0 14px; }
  .adminlog li { grid-template-columns: 1fr; gap: 0; }
  .barchart { gap: 3px; }
  .settingrow { flex-wrap: wrap; }
}

/* ---------- responsive ---------- */
@media (min-width: 1600px) { .app { grid-template-columns: 240px minmax(0, 1fr) 380px; } }
@media (max-width: 1180px) {
  .app { grid-template-columns: minmax(0, 1fr) 310px; grid-template-rows: auto minmax(0, 1fr); }
  .shelf { grid-column: 1 / -1; flex-direction: row; align-items: center; padding: 8px 14px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .shelf > .btn { width: auto; white-space: nowrap; }
  .shelfhead, .shelfnote { display: none; }
  #boards { flex-direction: row; flex: 1; }
  .notebook { min-width: 160px; max-width: 220px; }
  .search input { width: 140px; }
}
@media (max-width: 760px) {
  .app { display: flex; flex-direction: column; height: auto; }
  .topbar { padding: 0 12px; }
  .topactions .btn { font-size: 13px; padding: 6px 8px; }
  .wide { display: none; }
  main { height: 80dvh; min-height: 500px; }
  .workhead { padding: 12px 16px 4px; }
  .workhead h1 { font-size: 19px; }
  .worktools { padding: 0 12px; }
  .summarybtn { margin-left: auto; }
  .maptools { width: 100%; margin: 0; padding: 4px 0 8px; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .filters { order: 3; width: 100%; overflow-x: auto; }
  .chip { white-space: nowrap; }
  .legend, .minimap, #miniToggle { display: none; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .conceptarea { padding: 12px 8px 32px; }
  .paper { padding: 26px 18px 28px 40px; background-image: linear-gradient(to right, transparent 26px, rgba(196, 70, 47, .28) 26px, rgba(196, 70, 47, .28) 27px, transparent 27px); }
  .paper h2 { font-size: 23px; }
  .filegrid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media (max-width: 480px) { body:not(.auth-mode) .topbar .brandname { display: none; } .account { margin-left: 2px; } }
