/* bqfff app shell — shared by every bqfff.page app. Needs tokens.css + fonts.css. */
*,*::before,*::after{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font-body);font-size:14px;line-height:1.5;-webkit-text-size-adjust:100%}
a{color:var(--link)}
button{font:inherit;cursor:pointer;color:inherit}
:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
h1,h2,h3{font-family:var(--font-display);font-weight:600;line-height:1.15;margin:0;letter-spacing:-.01em}
p{margin:0}
.mono{font-family:var(--font-mono);font-size:.9em}
.muted{color:var(--muted)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
[hidden]{display:none!important}

/* Brand-kit components */
.dl-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:var(--control-h);padding:0 18px;border-radius:var(--radius-control);border:1px solid transparent;font-family:var(--font-display);font-weight:600;font-size:14px;letter-spacing:.01em;white-space:nowrap;text-decoration:none;background:transparent;transition:background .12s,border-color .12s,color .12s,transform .06s}
.dl-btn:active:not(:disabled){transform:translateY(1px)}
.dl-btn:disabled{opacity:.4;cursor:not-allowed}
.dl-primary{background:var(--blue);color:#fff}.dl-primary:hover:not(:disabled){background:var(--blue-hover)}
.dl-outline{color:var(--text);border-color:var(--line-strong)}.dl-outline:hover:not(:disabled){background:var(--hover);border-color:var(--muted)}
.dl-ghost{color:var(--muted)}.dl-ghost:hover:not(:disabled){background:var(--hover);color:var(--text)}
.dl-danger{background:var(--danger);color:#fff}.dl-danger:hover:not(:disabled){background:var(--danger-hover)}
.dl-sm{height:var(--control-h-sm);padding:0 12px;font-size:13px}
.dl-icon{width:var(--control-h);padding:0}
.dl-sm.dl-icon{width:var(--control-h-sm)}
.dl-input{height:var(--control-h);padding:0 14px;border:1px solid var(--input-border);border-radius:var(--radius-control);background:var(--input);color:var(--text);font:inherit;width:100%}
.dl-input::placeholder{color:var(--muted)}
.dl-input:hover{border-color:var(--muted)}
.dl-input:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px rgba(41,98,255,.35)}
.dl-label{font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.dl-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-card);padding:20px;min-width:0}
.dl-pill{display:inline-flex;align-items:center;gap:6px;height:22px;padding:0 9px;border-radius:var(--radius-pill);font-size:12px;font-weight:600}
.pill-live{background:var(--pill-live-bg);color:var(--pill-live)}
.pill-draft{background:var(--pill-draft-bg);color:var(--pill-draft)}
.pill-ok{background:var(--success-soft-bg);color:var(--success-soft)}
.pill-err{background:var(--danger-soft-bg);color:var(--danger-soft)}

/* Placeholder mark (same as the homepage) */
.ph-tag{display:inline-flex;align-items:center;height:18px;padding:0 5px;border:1px dashed var(--slash);border-radius:4px;font-family:var(--font-mono);font-size:10px;font-weight:500;line-height:1;color:var(--slash);vertical-align:middle;white-space:nowrap;cursor:help}
.ph{position:relative;border:1px dashed var(--slash);border-radius:calc(var(--radius-card) + 8px);padding:30px 8px 8px}
.ph::before{content:"PH · " attr(data-ph);position:absolute;top:8px;left:12px;right:12px;font-family:var(--font-mono);font-size:11px;line-height:1.2;color:var(--slash);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Logo pieces */
.ink{fill:var(--ink)}
.slash{fill:var(--slash)}

/* ---------- Shell ---------- */
.app{display:grid;grid-template-rows:56px 1fr;height:100vh;height:100dvh}
.bar{display:flex;align-items:center;gap:8px;padding:0 12px 0 16px;border-bottom:1px solid var(--line);background:var(--surface);min-width:0}
.bar-brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--text);flex:none}
.bar-brand svg{display:block}
.bar-app{font-family:var(--font-display);font-weight:600;font-size:15px}
.bar-sep{color:var(--slash);font-family:var(--font-mono);font-size:13px}
.bar-nav{display:flex;gap:2px;margin-left:16px;overflow-x:auto;scrollbar-width:none;min-width:0}
.bar-nav::-webkit-scrollbar{display:none}
.bar-nav a{display:flex;align-items:center;height:36px;padding:0 10px;border-radius:var(--radius-control);color:var(--muted);text-decoration:none;font-size:13px;font-weight:500;white-space:nowrap}
.bar-nav a:hover{background:var(--hover);color:var(--text)}
.bar-nav a[aria-current="page"]{background:var(--nav-active-bg);color:var(--nav-active);font-weight:600}
.bar-end{margin-left:auto;display:flex;align-items:center;gap:6px;flex:none}
.bar-user{border:none;background:transparent;display:flex;align-items:center;gap:8px;height:36px;font-size:13px;color:var(--strong);padding:0 8px 0 4px;border-radius:var(--radius-pill);text-decoration:none}
.bar-user:hover{background:var(--hover);color:var(--text)}
.bar-user[aria-current="page"]{background:var(--nav-active-bg);color:var(--nav-active)}
.avatar{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--blue-soft-bg);color:var(--blue-soft);font-family:var(--font-display);font-weight:600;font-size:12px;text-transform:uppercase}
.theme .i-moon{display:none}
[data-theme="light"] .theme .i-sun{display:none}
[data-theme="light"] .theme .i-moon{display:block}
@media (max-width:860px){.bar-nav{display:none}.bar-user .uname{display:none}}
.bar-menu{display:none}
@media (max-width:860px){.bar-menu{display:inline-flex}}
.navsheet{position:fixed;top:56px;right:8px;z-index:40;display:flex;flex-direction:column;gap:2px;min-width:220px;padding:6px;background:var(--surface-raised);border:1px solid var(--line);border-radius:var(--radius-card);box-shadow:0 12px 32px rgba(0,0,0,.35)}
.navsheet a{display:flex;align-items:center;height:40px;padding:0 12px;border-radius:var(--radius-control);color:var(--text);text-decoration:none}
.navsheet a:hover{background:var(--hover)}
.navsheet a[aria-current="page"]{background:var(--nav-active-bg);color:var(--nav-active)}

/* ---------- File workspace (Documents, Notes, Sheets) ---------- */
.work{display:grid;grid-template-columns:272px 1fr;min-height:0}
.files{display:flex;flex-direction:column;gap:12px;min-height:0;padding:16px 12px;border-right:1px solid var(--line);background:var(--surface)}
.files-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 4px}
.files-head h1{font-size:18px}
.files .dl-input{height:var(--control-h-sm)}
.file-list{list-style:none;margin:0;padding:0;overflow-y:auto;flex:1;min-height:0;display:flex;flex-direction:column;gap:2px}
.file-list button{display:flex;flex-direction:column;align-items:flex-start;gap:1px;width:100%;padding:8px 12px;border:none;border-radius:8px;background:transparent;text-align:left;color:var(--text)}
.file-list button:hover{background:var(--hover)}
.file-list button[aria-current="true"]{background:var(--nav-active-bg);color:var(--nav-active)}
.file-list .fname{font-weight:500;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.file-list .fmeta{font-size:12px;color:var(--muted)}
.file-list button[aria-current="true"] .fmeta{color:var(--nav-active);opacity:.8}
.file-empty{padding:12px;color:var(--muted);font-size:13px}
.usage{padding:10px 4px 0;border-top:1px solid var(--line);font-size:12px;color:var(--muted);display:flex;flex-direction:column;gap:6px}
.meter{height:4px;border-radius:2px;background:var(--line);overflow:hidden}
.meter i{display:block;height:100%;background:var(--blue);border-radius:2px}

.editor{display:flex;flex-direction:column;min-width:0;min-height:0}
.ed-head{display:flex;align-items:center;gap:8px;padding:10px 16px;border-bottom:1px solid var(--line);min-width:0}
.ed-title{flex:1;min-width:0;height:40px;padding:0 10px;margin-left:-10px;border:1px solid transparent;border-radius:var(--radius-control);background:transparent;color:var(--text);font-family:var(--font-display);font-weight:600;font-size:18px}
.ed-title:hover{border-color:var(--line)}
.ed-title:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px rgba(41,98,255,.35)}
.ed-status{font-size:12px;color:var(--muted);white-space:nowrap}
.ed-status.err{color:var(--danger-soft)}
.ed-back{display:none}
.ed-body{flex:1;min-height:0;overflow:auto;position:relative}
.ed-empty{flex:1;display:grid;place-items:center;padding:32px;text-align:center}
.ed-empty-inner{display:flex;flex-direction:column;align-items:center;gap:14px;max-width:340px}
.ed-empty svg{color:var(--slash)}
.ed-empty p{color:var(--muted)}

@media (max-width:760px){
  .work{grid-template-columns:1fr}
  .files{border-right:none}
  .work.has-open .files{display:none}
  .work:not(.has-open) .editor{display:none}
  .ed-back{display:inline-flex}
}

/* Toasts */
.toast{position:fixed;left:50%;bottom:20px;transform:translateX(-50%);z-index:50;padding:10px 16px;border-radius:var(--radius-control);background:var(--text);color:var(--bg);font-size:13px;font-weight:500;box-shadow:0 8px 24px rgba(0,0,0,.3)}

.navsheet form{margin:0}
.navsheet button{display:flex;align-items:center;width:100%;height:40px;padding:0 12px;border:none;border-radius:var(--radius-control);background:transparent;color:var(--text);font:inherit;text-align:left}
.navsheet button:hover{background:var(--hover)}
.menu-who{display:flex;flex-direction:column;padding:8px 12px 10px;margin-bottom:4px;border-bottom:1px solid var(--line);font-size:13px}
.menu-who span{color:var(--muted)}
