/* PBOS — Crisp Forest & Sand. All colors are tokens; no external dependencies. */
@font-face{font-family:Outfit;src:local("Outfit");font-display:swap}
@font-face{font-family:Geist;src:local("Geist");font-display:swap}
@font-face{font-family:"Geist Mono";src:local("Geist Mono");font-display:swap}
:root{
  --primary:#004635;--primary-c:#1F5E4B;--on-primary:#fff;--secondary:#974818;
  --surface:#F9FAF7;--low:#F3F4F1;--lowest:#fff;--hover:#ECEEEA;--text:#191C1A;--muted:#505A54;
  --outline:#BFC9C3;--error:#BA1A1A;--ok:#1F7A4F;--warn:#9A6200;--sel:#DCEBE4;
  --font-h:Outfit,"Segoe UI",system-ui,sans-serif;--font:Geist,"Segoe UI",system-ui,-apple-system,sans-serif;--mono:"Geist Mono",ui-monospace,Menlo,Consolas,monospace;
  --r:6px;--pad:24px;--row:44px;
}
:root[data-theme=dark]{
  --primary:#8CD5BA;--primary-c:#1F5E4B;--on-primary:#00382A;--secondary:#FFB68F;
  --surface:#101412;--low:#181C1A;--lowest:#1D211F;--hover:#262B28;--text:#E1E3DF;--muted:#A9B3AD;
  --outline:#404944;--error:#FFB4AB;--ok:#7FD8A8;--warn:#F0BE63;--sel:#1F3A30;
}
:root[data-density=compact]{--pad:16px;--row:34px}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{font:14px/1.45 var(--font);background:var(--surface);color:var(--text);font-variant-numeric:tabular-nums;-webkit-font-smoothing:antialiased}
h1,h2,h3{font-family:var(--font-h);margin:0;font-weight:600;letter-spacing:-.01em}
h1{font-size:24px}h2{font-size:18px}h3{font-size:15px}
button,input,select,textarea{font:inherit;color:inherit}
a{color:var(--primary);text-decoration:none}a:hover{text-decoration:underline}
.mono{font-family:var(--mono);font-size:12px}
.muted{color:var(--muted)}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
svg.i{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
:focus-visible{outline:2px solid var(--primary);outline-offset:1px}

/* shell */
#app{display:grid;grid-template-columns:240px 1fr;height:100%}
#side{background:var(--low);border-right:1px solid var(--outline);display:flex;flex-direction:column;overflow:auto}
.brand{height:56px;display:flex;align-items:center;gap:10px;padding:0 16px;font:600 18px var(--font-h);color:var(--primary)}
.brand .logo{width:28px;height:28px;border-radius:6px;background:var(--primary-c);color:#fff;display:grid;place-items:center;font-size:14px}
nav{padding:8px;display:flex;flex-direction:column;gap:2px}
nav .grp{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);padding:14px 10px 4px}
nav a{display:flex;align-items:center;gap:10px;padding:7px 10px;border-radius:var(--r);color:var(--text);transition:background .1s}
nav a:hover{background:var(--hover);text-decoration:none}
nav a.on{background:var(--sel);color:var(--primary);font-weight:600}
nav a .n{margin-left:auto;font-size:12px;color:var(--muted)}
.dot{width:10px;height:10px;border-radius:50%;flex:none}
#main{display:flex;flex-direction:column;min-width:0;height:100%}
#top{height:56px;border-bottom:1px solid var(--outline);display:flex;align-items:center;gap:12px;padding:0 var(--pad);background:var(--surface);flex:none}
#top .search{flex:1;max-width:520px}
#view{flex:1;overflow:auto;padding:var(--pad)}
.menu-btn{display:none}
@media(max-width:860px){
  #app{grid-template-columns:1fr}
  #side{position:fixed;z-index:40;inset:0 auto 0 0;width:260px;transform:translateX(-100%);transition:transform .15s}
  body.nav-open #side{transform:none}
  body.nav-open::after{content:"";position:fixed;inset:0;background:#0006;z-index:30}
  .menu-btn{display:inline-flex}
  #top .hide-s{display:none}
}

/* controls */
.btn{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 12px;border-radius:var(--r);border:1px solid var(--outline);background:var(--lowest);cursor:pointer;white-space:nowrap;transition:background .1s}
.btn:hover{background:var(--hover)}
.btn.pri{background:var(--primary-c);border-color:var(--primary-c);color:#fff}
.btn.pri:hover{background:var(--primary)}
:root[data-theme=dark] .btn.pri{background:var(--primary);color:var(--on-primary)}
.btn.dan{color:var(--error);border-color:var(--error)}
.btn.ghost{border-color:transparent;background:transparent}
.btn.ghost:hover{background:var(--hover)}
.btn.sm{height:28px;padding:0 8px;font-size:13px}
.btn.ic{width:34px;padding:0;justify-content:center}.btn.sm.ic{width:28px}
.btn[disabled]{opacity:.5;pointer-events:none}
.inp,select.inp,textarea.inp{width:100%;min-height:34px;padding:6px 10px;border:1px solid var(--outline);border-radius:var(--r);background:var(--lowest)}
textarea.inp{resize:vertical;min-height:80px}
.inp:focus{border-color:var(--primary);outline:none;box-shadow:0 0 0 1px var(--primary)}
.inp.bad{border-color:var(--error)}
.err{color:var(--error);font-size:12px;margin-top:3px}
.help{color:var(--muted);font-size:12px;margin-top:3px}
label.f{display:block;font-weight:500;margin-bottom:4px;font-size:13px}
.req{color:var(--error)}
.field{margin-bottom:14px}
.grid{display:grid;grid-template-columns:repeat(12,1fr);gap:0 16px}
.w-full{grid-column:span 12}.w-half{grid-column:span 6}.w-third{grid-column:span 4}
@media(max-width:640px){.w-half,.w-third{grid-column:span 12}}
.sect{grid-column:span 12;font:600 13px var(--font-h);color:var(--muted);text-transform:uppercase;letter-spacing:.05em;margin:8px 0 10px;padding-bottom:4px;border-bottom:1px solid var(--outline)}
.chk{display:flex;align-items:center;gap:8px;cursor:pointer}
.chk input{width:16px;height:16px;accent-color:var(--primary)}
.opts{display:flex;flex-wrap:wrap;gap:8px 16px}

/* surfaces */
.card{background:var(--lowest);border:1px solid var(--outline);border-radius:8px;padding:var(--pad)}
.pagehead{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.pagehead .sp{flex:1;min-width:0}
.pagehead p{margin:2px 0 0;color:var(--muted)}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:12px}
.seg{display:inline-flex;border:1px solid var(--outline);border-radius:var(--r);overflow:hidden}
.seg button{border:0;background:var(--lowest);height:32px;padding:0 10px;cursor:pointer;display:flex;align-items:center;gap:6px}
.seg button.on{background:var(--sel);color:var(--primary);font-weight:600}
.chip{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 10px;border-radius:13px;border:1px solid var(--outline);background:var(--lowest);font-size:12px;cursor:pointer}
.chip.on{background:var(--sel);border-color:var(--primary);color:var(--primary)}
.badge{display:inline-flex;align-items:center;gap:5px;padding:1px 8px;border-radius:10px;font-size:12px;background:var(--low);border:1px solid var(--outline);white-space:nowrap}
.badge i{width:7px;height:7px;border-radius:50%;display:block}
.stats{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px;margin-bottom:16px}
.stat b{display:block;font:600 28px var(--font-h)}
.two{display:grid;grid-template-columns:2fr 1fr;gap:16px}
@media(max-width:960px){.two{grid-template-columns:1fr}}
.empty{text-align:center;padding:48px 16px;color:var(--muted)}
.empty h3{color:var(--text);margin-bottom:6px}

/* table */
.tw{overflow:auto;border:1px solid var(--outline);border-radius:8px;background:var(--lowest)}
table{border-collapse:collapse;width:100%}
th{position:sticky;top:0;background:var(--low);text-align:left;font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);padding:0 12px;height:36px;border-bottom:1px solid var(--outline);white-space:nowrap}
th.s{cursor:pointer;user-select:none}th.s:hover{color:var(--text)}
td{padding:0 12px;height:var(--row);border-bottom:1px solid var(--outline);max-width:320px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
tr:last-child td{border-bottom:0}
tbody tr{cursor:pointer;transition:background .1s}tbody tr:hover{background:var(--hover)}
td.act{width:1%;white-space:nowrap}
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px}
.rc{background:var(--lowest);border:1px solid var(--outline);border-radius:8px;padding:16px;cursor:pointer;transition:background .1s;display:flex;flex-direction:column;gap:8px}
.rc:hover{background:var(--hover)}
.rc h3{display:flex;gap:8px;align-items:center}
.rc dl{margin:0;display:grid;grid-template-columns:auto 1fr;gap:4px 12px;font-size:13px}
.rc dt{color:var(--muted)}.rc dd{margin:0;overflow:hidden;text-overflow:ellipsis}
.board{display:flex;gap:12px;align-items:flex-start;overflow:auto;padding-bottom:8px}
.col{flex:0 0 280px;background:var(--low);border:1px solid var(--outline);border-radius:8px;padding:10px;min-height:120px}
.col.over{outline:2px dashed var(--primary)}
.col h3{display:flex;align-items:center;gap:8px;margin-bottom:10px;font-size:14px}
.col .rc{margin-bottom:8px;padding:12px}
.star{color:var(--secondary)}.star svg{fill:currentColor}
.rate{color:var(--secondary);letter-spacing:1px}
.swatch{display:inline-block;width:14px;height:14px;border-radius:3px;border:1px solid var(--outline);vertical-align:-2px;margin-right:6px}

/* tabs / detail */
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--outline);margin:16px 0}
.tabs button{border:0;background:none;padding:8px 14px;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;color:var(--muted)}
.tabs button.on{color:var(--primary);border-color:var(--primary);font-weight:600}
dl.kv{display:grid;grid-template-columns:200px 1fr;gap:10px 16px;margin:0}
dl.kv dt{color:var(--muted)}dl.kv dd{margin:0;word-break:break-word}
@media(max-width:640px){dl.kv{grid-template-columns:1fr}}
.tl{list-style:none;margin:0;padding:0}
.tl li{display:flex;gap:10px;padding:8px 0;border-bottom:1px solid var(--outline)}
.tl li:last-child{border:0}
.md h1,.md h2,.md h3{margin:.8em 0 .4em}.md pre{background:var(--low);padding:10px;border-radius:var(--r);overflow:auto}
.md code{font-family:var(--mono);background:var(--low);padding:1px 4px;border-radius:3px}.md pre code{padding:0}
.md blockquote{border-left:3px solid var(--outline);margin:0;padding-left:12px;color:var(--muted)}
.rte{min-height:100px;padding:8px 10px;border:1px solid var(--outline);border-radius:0 0 var(--r) var(--r);background:var(--lowest)}
.rte-bar{display:flex;gap:4px;border:1px solid var(--outline);border-bottom:0;border-radius:var(--r) var(--r) 0 0;padding:4px;background:var(--low)}
.split{display:grid;grid-template-columns:1fr 1fr;gap:12px}
@media(max-width:640px){.split{grid-template-columns:1fr}}
.thumb{max-width:100%;max-height:220px;border-radius:var(--r);border:1px solid var(--outline)}
.att{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--outline);border-radius:var(--r);margin-bottom:6px;background:var(--lowest)}
.att .sp{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.drop{border:2px dashed var(--outline);border-radius:8px;padding:18px;text-align:center;color:var(--muted);cursor:pointer}
.drop.over{border-color:var(--primary);background:var(--sel)}

/* builder */
.frow{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--outline);border-radius:var(--r);background:var(--lowest);margin-bottom:6px}
.frow.drag{opacity:.4}.frow.over{border-color:var(--primary);border-style:dashed}
.frow .grab{cursor:grab;color:var(--muted)}
.frow .sp{flex:1;min-width:0}
.frow.hid{opacity:.6}

/* modal / toast / palette */
#modal{position:fixed;inset:0;background:#0007;display:none;align-items:flex-start;justify-content:center;padding:6vh 12px;z-index:60;overflow:auto}
#modal.on{display:flex}
.dlg{background:var(--lowest);border:1px solid var(--outline);border-radius:8px;width:min(640px,100%);box-shadow:0 12px 40px #0004;animation:in .2s ease-out}
.dlg.wide{width:min(860px,100%)}.dlg.sm{width:min(420px,100%)}
@keyframes in{from{opacity:0;transform:translateY(8px)}}
.dlg>header{display:flex;align-items:center;padding:14px 20px;border-bottom:1px solid var(--outline)}
.dlg>header h2{flex:1}
.dlg>.body{padding:20px;max-height:68vh;overflow:auto}
.dlg>footer{display:flex;gap:8px;justify-content:flex-end;padding:12px 20px;border-top:1px solid var(--outline);background:var(--low);border-radius:0 0 8px 8px}
#toasts{position:fixed;bottom:16px;right:16px;display:flex;flex-direction:column;gap:8px;z-index:80}
.toast{background:var(--text);color:var(--surface);padding:10px 14px;border-radius:var(--r);display:flex;gap:12px;align-items:center;animation:in .2s}
.toast button{background:none;border:0;color:inherit;text-decoration:underline;cursor:pointer}
.pal-list{max-height:50vh;overflow:auto;margin-top:8px}
.pal-item{display:flex;gap:10px;align-items:center;padding:8px 10px;border-radius:var(--r);cursor:pointer}
.pal-item.on,.pal-item:hover{background:var(--sel)}
kbd{font:11px var(--mono);border:1px solid var(--outline);border-radius:4px;padding:1px 5px;background:var(--low)}
.colorrow{display:flex;gap:6px;flex-wrap:wrap}
.colorrow button{width:24px;height:24px;border-radius:50%;border:2px solid transparent;cursor:pointer}
.colorrow button.on{border-color:var(--text)}
.orow{display:flex;gap:8px;align-items:center;margin-bottom:6px}
.orow input[type=color]{width:34px;height:34px;padding:2px;border:1px solid var(--outline);border-radius:var(--r);background:var(--lowest)}
@media print{#side,#top{display:none}#app{display:block}}
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
