/* ==========================================================================
   Cobinar shared design system
   Squared corners everywhere except things that are inherently round
   (avatar, status dots, pill badges). Deeper orange. Hard offset shadows
   stay as the signature element, now paired with a hover lift + press-down
   so interactive elements feel tactile instead of flat.
   ========================================================================== */

:root {
  --orange:    #D9720F;
  --orange-d:  #B85D08;
  --orange-l:  #FBEAD3;
  --orange-g:  rgba(217,114,15,0.18);

  --white:  #FBF8F0;
  --off:    #EFE9DC;
  --s1:     #F2EEE4;
  --s2:     #E4DDCB;
  --s3:     #A79C86;
  --s4:     #6F6553;
  --s5:     #3A342A;
  --s6:     #14110F;

  --text:   #14110F;
  --text2:  #4A4438;
  --text3:  #857A64;
  --border: #14110F;

  --green:   #2F6B4F; --green-l: #E1EDE5;
  --red:     #B23A22; --red-l:   #F7E2DB;
  --amber:   #A9700B; --amber-l: #FBEBCB;

  --r:      0px;     /* square by default */
  --r-full: 999px;   /* avatar, dots, badges */
  --bw:     2px;
  --bw-lg:  3px;

  --shadow:    4px 4px 0 var(--border);
  --shadow-sm: 3px 3px 0 var(--border);
  --shadow-lg: 7px 7px 0 var(--border);

  --ease:   cubic-bezier(0.16,1,0.3,1);
  --spring: cubic-bezier(.34,1.56,.64,1);

  --pill-ov-bg:   #FBEBCB; --pill-ov-ic:   #A9700B;
  --pill-work-bg: #DCE6F2; --pill-work-ic: #2C5A96;
  --pill-page-bg: #DCEAE0; --pill-page-ic: #2B6B49;
  --pill-stor-bg: #E2DCEF; --pill-stor-ic: #5B4696;
  --pill-data-bg: #DDEAE6; --pill-data-ic: #1F6E63;
  --pill-vault-bg: #F2DCE0; --pill-vault-ic: #99334A;
  --pill-wb-bg:    #EDE0D4; --pill-wb-ic:    #8A5A3B;
  --pill-search-bg: #DCEEF2; --pill-search-ic: #1D6E82;
}

* { box-sizing: border-box; }
html, body { min-height: 100vh; margin: 0; font-family: 'Public Sans', system-ui, sans-serif; font-size: 15px; line-height: 1.65; color: var(--text); background: var(--off); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: 'Space Grotesk', sans-serif; margin: 0; }
button, input, select { font-family: inherit; }
a { color: inherit; }
svg { display: block; }
.icon { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon.solid { fill: currentColor; stroke: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .62rem 1.15rem; border: var(--bw) solid var(--border); border-radius: var(--r);
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: .82rem;
  cursor: pointer; background: var(--white); color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .14s var(--ease), box-shadow .14s var(--ease), background .14s var(--ease), color .14s var(--ease);
}
.btn .icon { width: 15px; height: 15px; }
.btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--border); }
.btn:active { transform: translate(2px,2px); box-shadow: 0 0 0 0 var(--border); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: var(--shadow-sm) !important; }
.btn-primary { background: var(--orange); color: var(--white); border-color: var(--border); }
.btn-primary:hover { background: var(--orange-d); }
.btn-secondary { background: var(--white); color: var(--text); }
.btn-secondary:hover { background: var(--s1); }
.btn-ghost { border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--s1); transform: none; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Layout shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 234px; flex-shrink: 0; background: var(--white); border-right: var(--bw) solid var(--border);
  display: flex; flex-direction: column; position: relative; z-index: 40;
  transition: transform .28s var(--ease), width .28s var(--ease);
}
.sb-brand { display: flex; align-items: center; gap: .55rem; padding: 1rem 1.1rem; border-bottom: var(--bw) solid var(--border); transition: padding .2s var(--ease); }
.sb-brand img { width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0; }
.sb-brand-text { font-family: 'Space Grotesk', sans-serif; font-size: .95rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; }
.sb-close { display: none; margin-left: auto; }
.sb-nav { flex: 1; padding: .9rem .65rem; overflow-y: auto; overflow-x: hidden; }
.sb-section { font-family: 'IBM Plex Mono', monospace; font-size: .63rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text3); padding: 0 .5rem; margin: 1rem 0 .5rem; white-space: nowrap; overflow: hidden; }
.sb-section:first-child { margin-top: 0; }
.sb-item {
  display: flex; align-items: center; gap: .65rem; width: 100%; padding: .5rem .6rem; border: none;
  background: none; border-radius: var(--r); font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: .85rem;
  color: var(--text2); cursor: pointer; text-align: left; text-decoration: none; margin-bottom: .15rem;
  transition: background .14s var(--ease), color .14s var(--ease), transform .14s var(--ease);
  position: relative; white-space: nowrap; overflow: hidden;
}
.sb-item:hover { background: var(--s1); color: var(--text); transform: translateX(2px); }
.sb-item.active { background: var(--orange); color: var(--white); }
.sb-item.active .pill { background: rgba(255,255,255,.22) !important; color: var(--white) !important; }
.sb-item .pill { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sb-item .pill .icon { width: 15px; height: 15px; }
.sb-item .ext { margin-left: auto; opacity: .55; }
.sb-item .ext .icon { width: 13px; height: 13px; }
.sb-item-label { overflow: hidden; text-overflow: ellipsis; transition: opacity .15s var(--ease); }
.sb-foot { padding: .9rem 1.1rem; border-top: var(--bw) solid var(--border); font-family: 'IBM Plex Mono', monospace; font-size: .68rem; color: var(--text3); display: flex; align-items: center; gap: .5rem; white-space: nowrap; overflow: hidden; }

/* Desktop-only persistent collapse (mirrors Cloudflare's dashboard rail) —
   the SAME #hamburger button drives this at desktop widths; at mobile
   widths (see the max-width media query below) it drives the off-canvas
   overlay instead. Scoped to min-width so it never fights that overlay
   behavior. See toggleSidebar() in the script for which one runs. */
@media (min-width: 861px) {
  .sidebar.collapsed { width: 68px; }
  .sidebar.collapsed .sb-brand { padding: 1rem .65rem; justify-content: center; }
  .sidebar.collapsed .sb-brand-text,
  .sidebar.collapsed .sb-section,
  .sidebar.collapsed .sb-item-label,
  .sidebar.collapsed .sb-item .ext,
  .sidebar.collapsed .sb-foot span:not(.dot) { display: none; }
  .sidebar.collapsed .sb-item { justify-content: center; padding: .5rem; }
  .sidebar.collapsed .sb-foot { justify-content: center; }
}

.dot { width: 7px; height: 7px; border-radius: var(--r-full); flex-shrink: 0; }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.backdrop { display: none; position: fixed; inset: 0; background: rgba(20,17,15,.45); z-index: 30; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--white); border-bottom: var(--bw) solid var(--border); }
.topbar-row { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1.4rem; gap: 1rem; }
.hamburger { display: flex; }
.crumbs { display: flex; align-items: center; gap: .4rem; font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: .86rem; flex-wrap: wrap; }
.crumbs a { color: var(--text3); text-decoration: none; transition: color .12s; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs .sep { color: var(--s3); }
.crumbs .current { color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.icon-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: var(--bw) solid var(--border); border-radius: var(--r); background: var(--white); cursor: pointer;
  padding: 0; appearance: none; -webkit-appearance: none;
  transition: transform .14s var(--ease), box-shadow .14s var(--ease), background .14s;
}
.icon-btn .icon { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--s1); transform: translate(-1px,-1px); box-shadow: 2px 2px 0 var(--border); }
.icon-btn:active { transform: translate(1px,1px); box-shadow: none; }
.avatar {
  width: 32px; height: 32px; border-radius: var(--r-full); background: var(--text); color: var(--orange);
  display: flex; align-items: center; justify-content: center; font-family: 'Space Grotesk', sans-serif;
  font-size: .78rem; font-weight: 700; border: var(--bw) solid var(--text); box-shadow: 0 0 0 2px var(--orange);
  overflow: hidden;
  padding: 0; appearance: none; -webkit-appearance: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.urlbar-row { display: flex; align-items: center; gap: .5rem; padding: 0 1.4rem .75rem; }
.urlbar {
  flex: 1; display: flex; align-items: center; gap: .5rem; background: var(--s1); border: 1.5px solid var(--s2);
  border-radius: var(--r); padding: .4rem .7rem; font-family: 'IBM Plex Mono', monospace; font-size: .72rem;
  color: var(--text2); overflow-x: auto; white-space: nowrap;
}
.urlbar .icon { width: 12px; height: 12px; color: var(--text3); flex-shrink: 0; }
.urlbar .placeholder { color: var(--text3); font-style: italic; }
.urlbar-copy {
  flex-shrink: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--s2); border-radius: var(--r); background: var(--white); cursor: pointer; transition: background .12s;
}
.urlbar-copy .icon { width: 13px; height: 13px; }
.urlbar-copy:hover { background: var(--s1); }

main { flex: 1; padding: 1.6rem; overflow-y: auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.page-head p { color: var(--text2); font-size: .88rem; max-width: 52ch; }

.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem; margin-bottom: 1.3rem; }
.stat-card {
  background: var(--white); border: var(--bw) solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 1rem 1.1rem; transition: transform .16s var(--ease), box-shadow .16s var(--ease);
}
.stat-card:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--border); }
.stat-label { font-family: 'IBM Plex Mono', monospace; font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); margin-bottom: .5rem; }
.stat-val { font-family: 'Space Grotesk', sans-serif; font-size: 1.55rem; font-weight: 700; }
.stat-sub { font-size: .76rem; color: var(--text3); margin-top: .2rem; }

.panel { background: var(--white); border: var(--bw) solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.panel + .panel { margin-top: 1rem; }

.wb-palette { flex:none; width:200px; background:var(--white); border:var(--bw) solid var(--border); box-shadow:var(--shadow); padding:.8rem; position:sticky; top:1rem; align-self:flex-start; }
.wb-palette-head { font-family:'IBM Plex Mono',monospace; font-size:.66rem; font-weight:600; text-transform:uppercase; letter-spacing:.07em; color:var(--text3); margin-bottom:.6rem; }
.wb-pal-item { display:flex; align-items:center; gap:.6rem; padding:.6rem; border:1px solid var(--s2); margin-bottom:.5rem; cursor:grab; background:var(--s1); }
.wb-pal-item:hover { border-color:var(--border); }
.wb-pal-item:active { cursor:grabbing; }
.wb-pal-text { font-size:.82rem; }

.wb-empty { display:flex; align-items:center; justify-content:center; min-height:140px; border:2px dashed var(--s2); color:var(--text3); font-size:.85rem; }
.wb-title-input { flex:1; border:none; background:transparent; font-size:.95rem; font-weight:600; color:var(--text); padding:.2rem; min-width:0; }
.wb-title-input:focus { outline:1px dashed var(--s2); }
.wb-publish-row { display:flex; gap:.8rem; align-items:flex-end; flex-wrap:wrap; margin-top:1rem; }

/* Every placed element is directly selectable/draggable — outline carries
   the selection/hover/drag-target state without needing a separate
   wrapper element around each one. */
[data-el-id] { cursor:pointer; outline:2px solid transparent; outline-offset:3px; }
[data-el-id]:hover { outline-color:var(--s2); }
[data-el-id].selected { outline-color:var(--orange); }
[data-el-id].drag-over { outline-color:var(--orange); outline-style:dashed; }
.el-section-empty, .el-image-empty { display:flex; align-items:center; justify-content:center; min-height:70px; border:2px dashed var(--s2); color:var(--text3); font-size:.8rem; }

table { width: 100%; border-collapse: collapse; font-size: .86rem; }
thead th { text-align: left; padding: .75rem 1.1rem; background: var(--s6); color: var(--white); font-family: 'IBM Plex Mono', monospace; font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
tbody td { padding: .8rem 1.1rem; border-top: 1px solid var(--s2); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--orange-l); }
.cell-name { font-weight: 600; font-family: 'Space Grotesk', sans-serif; text-decoration: none; }
a.cell-name { cursor: pointer; }
a.cell-name:hover { text-decoration: underline; color: var(--orange-d); }
.cell-mono { font-family: 'IBM Plex Mono', monospace; font-size: .78rem; color: var(--text2); }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .55rem; border-radius: var(--r-full); font-family: 'IBM Plex Mono', monospace; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.badge-active { background: var(--green-l); color: var(--green); }
.badge-error  { background: var(--red-l); color: var(--red); }
.badge-paused { background: var(--s1); color: var(--text3); }
.badge-amber  { background: var(--amber-l); color: var(--amber); }
.badge-new    { background: var(--orange-l); color: var(--orange-d); }

.sb-item .badge-new { margin-left: auto; font-size: .6rem; padding: .12rem .4rem; }
.sb-item.active .badge-new { background: rgba(255,255,255,.3); color: var(--white); }

.state-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem; padding: 3rem 1.5rem; text-align: center; }
.state-box p { color: var(--text2); font-size: .88rem; max-width: 42ch; }
.state-box .state-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: .95rem; }
.state-box .icon { width: 26px; height: 26px; color: var(--text3); }

.skeleton-row { display: flex; gap: 1rem; padding: .9rem 1.1rem; border-top: 1px solid var(--s2); }
.skeleton-row:first-child { border-top: none; }
.skel { height: 14px; border-radius: 3px; flex: 1; background: linear-gradient(90deg, var(--s1) 25%, var(--s2) 37%, var(--s1) 63%); background-size: 400% 100%; animation: shimmer 1.5s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.fade-in { animation: fadeIn .3s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.code-note { margin-top: .9rem; font-family: 'IBM Plex Mono', monospace; font-size: .72rem; color: var(--text3); background: var(--s1); border: 1px solid var(--s2); border-radius: var(--r); padding: .6rem .8rem; }

/* ---------- Detail views (project / bucket / collection / service pages) ---------- */
.detail-back {
  display: inline-flex; align-items: center; gap: .35rem; font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem; font-weight: 600; color: var(--text3); text-decoration: none; margin-bottom: .9rem;
  transition: color .12s;
}
.detail-back:hover { color: var(--orange-d); }

.btn-sm { padding: .42rem .75rem; font-size: .74rem; }
.btn-sm .icon { width: 13px; height: 13px; }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }

.link-box {
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
  background: var(--white); border: var(--bw) solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow); padding: .75rem .9rem; margin-bottom: 1.1rem;
}
.link-box > .icon { width: 16px; height: 16px; color: var(--orange-d); flex-shrink: 0; }
.link-box code { flex: 1 1 220px; font-family: 'IBM Plex Mono', monospace; font-size: .8rem; color: var(--text2); overflow-x: auto; white-space: nowrap; }
.link-box-actions { display: flex; gap: .4rem; flex-shrink: 0; }

.dropzone {
  border: var(--bw-lg) dashed var(--s3); border-radius: var(--r); background: var(--white);
  padding: 1.7rem 1.2rem; text-align: center; cursor: pointer; margin-bottom: .6rem;
  transition: border-color .14s var(--ease), background .14s var(--ease), transform .14s var(--ease);
}
.dropzone:hover { border-color: var(--orange); background: var(--orange-l); }
.dropzone.drag { border-color: var(--orange); background: var(--orange-l); transform: scale(0.99); }
.dropzone > .icon { width: 24px; height: 24px; color: var(--text3); margin: 0 auto .5rem; }
.dropzone p { font-size: .85rem; color: var(--text2); margin: 0; }
.dropzone .hint { font-size: .76rem; color: var(--text3); margin-top: .3rem; }
.dropzone .hint .btn-ghost { text-decoration: underline; font-weight: 600; }

.editor-shell { padding: 1rem 1.1rem; }
.editor-shell textarea, .code-editor {
  width: 100%; min-height: 260px; border: var(--bw) solid var(--border); border-radius: var(--r);
  font-family: 'IBM Plex Mono', monospace; font-size: .8rem; line-height: 1.6; padding: .85rem;
  resize: vertical; background: var(--s6); color: #E7E1D2; tab-size: 2;
}
.editor-shell textarea:focus, .code-editor:focus { outline: none; box-shadow: 0 0 0 3px var(--orange-g); }

/* CodeMirror replaces the plain textarea above via fromTextArea() — same
   border/radius as the textarea it replaces, so swapping one editor for
   the other (e.g. non-text file types that stay plain) doesn't shift
   the surrounding layout. */
.editor-shell .CodeMirror, .inline-form .CodeMirror {
  border: var(--bw) solid var(--border); border-radius: var(--r);
  font-family: 'IBM Plex Mono', monospace; font-size: .8rem; line-height: 1.6;
  height: 320px;
}
.editor-shell .CodeMirror-focused, .inline-form .CodeMirror-focused { box-shadow: 0 0 0 3px var(--orange-g); }
.CodeMirror pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like { padding: 0 .3rem; }
.editor-actions { display: flex; align-items: center; gap: .7rem; margin-top: .8rem; flex-wrap: wrap; }
.editor-status { font-size: .76rem; color: var(--text3); font-family: 'IBM Plex Mono', monospace; }

.doc-card { border-top: 1px solid var(--s2); padding: .9rem 1.1rem; }
.doc-card:first-child { border-top: none; }
.doc-card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .55rem; }
.doc-card-id { font-family: 'IBM Plex Mono', monospace; font-size: .7rem; color: var(--text3); }
.doc-card pre {
  margin: 0; font-family: 'IBM Plex Mono', monospace; font-size: .78rem; white-space: pre-wrap;
  word-break: break-word; color: var(--text2); max-height: 180px; overflow-y: auto; background: var(--s1);
  border: 1px solid var(--s2); border-radius: var(--r); padding: .6rem .7rem;
}

.inline-form { padding: 1rem 1.1rem; border-top: var(--bw) solid var(--border); background: var(--s1); }
.inline-form textarea {
  width: 100%; min-height: 130px; border: var(--bw) solid var(--border); border-radius: var(--r);
  font-family: 'IBM Plex Mono', monospace; font-size: .8rem; padding: .7rem; resize: vertical; background: var(--white);
}
.inline-form textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--orange-g); }
.inline-form-actions { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.inline-form-error { color: var(--red); font-size: .78rem; margin-top: .5rem; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,17,15,.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 1.2rem; z-index: 300;
}
.modal {
  width: 100%; max-width: 420px; background: var(--white); border: var(--bw) solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 1.7rem 1.6rem;
}
.modal h2 { margin: 0 0 .35rem; font-family: 'Space Grotesk', sans-serif; font-size: 1.15rem; }
.modal .modal-sub { margin: 0 0 1.2rem; font-size: .82rem; color: var(--text3); }
.modal .modal-error { color: var(--red); font-size: .78rem; min-height: 1.1em; margin: -.3rem 0 .3rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .4rem; }

/* ---------- Auth pages ---------- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1.2rem; background: radial-gradient(circle at 20% 20%, var(--orange-g), transparent 55%), var(--off); }
.auth-card { width: 100%; max-width: 380px; background: var(--white); border: var(--bw) solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 2rem 1.9rem; }
.auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.6rem; }
.auth-brand img { width: 30px; height: 30px; border-radius: 7px; }
.auth-brand span { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.05rem; }
.auth-title { font-size: 1.3rem; font-weight: 700; margin-bottom: .3rem; }
.auth-sub { color: var(--text2); font-size: .85rem; margin-bottom: 1.5rem; }
.field { margin-bottom: .9rem; }
.field label { display: block; font-family: 'IBM Plex Mono', monospace; font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); margin-bottom: .35rem; }
.field-input-wrap { position: relative; }
.field input {
  width: 100%; padding: .65rem .8rem; border: var(--bw) solid var(--border); border-radius: var(--r);
  font-size: .88rem; background: var(--white); color: var(--text); transition: box-shadow .14s var(--ease);
}
.field input:focus { outline: none; box-shadow: 0 0 0 3px var(--orange-g); }
.select-input {
  width: 100%; padding: .65rem .8rem; border: var(--bw) solid var(--border); border-radius: var(--r);
  font-size: .88rem; background: var(--white); color: var(--text); transition: box-shadow .14s var(--ease);
  font-family: inherit; cursor: pointer;
}
.select-input:focus { outline: none; box-shadow: 0 0 0 3px var(--orange-g); }
.checkbox-field { display: flex; align-items: center; gap: .45rem; font-family: 'Space Grotesk', sans-serif; font-size: .84rem; font-weight: 600; color: var(--text2); cursor: pointer; user-select: none; }
.checkbox-field input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--orange); cursor: pointer; }
.field-toggle { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text3); padding: .2rem; }
.field-toggle .icon { width: 16px; height: 16px; }
.form-error { display: flex; align-items: flex-start; gap: .5rem; background: var(--red-l); color: var(--red); border: 1.5px solid var(--red); border-radius: var(--r); padding: .6rem .75rem; font-size: .8rem; margin-bottom: 1rem; }
.form-error .icon { width: 15px; height: 15px; margin-top: .1rem; flex-shrink: 0; }
.divider { display: flex; align-items: center; gap: .7rem; margin: 1.3rem 0; color: var(--text3); font-size: .72rem; font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--s2); }
.btn-google { background: var(--white); color: var(--text); }
.auth-switch { text-align: center; font-size: .82rem; color: var(--text2); margin-top: 1.3rem; }
.auth-switch button { background: none; border: none; color: var(--orange-d); font-weight: 600; cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); width: 250px; }
  .sidebar.open { transform: translateX(0); }
  .sb-close { display: inline-flex; }
  .backdrop.open { display: block; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  main { padding: 1.1rem; }
  .page-head { flex-direction: column; }
  thead th:nth-child(n+4), tbody td:nth-child(n+4) { display: none; }
}
@media (max-width: 480px) {
  .grid-stats { grid-template-columns: 1fr; }
  .auth-card { padding: 1.6rem 1.3rem; }
}

/* ---------- usage charts + upgrade modal (added for plans/quota/billing) ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 1.6rem 0 .7rem; }
.section-head h2 { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 1rem; }
.usage-grid { grid-template-columns: repeat(2, 1fr); }
.usage-card { position: relative; }
.usage-limit { font-size: .72rem; color: var(--text3); font-weight: 500; }
.usage-limit-inline { font-size: .68rem; margin-left: .35rem; }
.usage-over { color: var(--red); }
.usage-warn { margin-top: .5rem; font-size: .72rem; color: var(--red); background: var(--red-tint, rgba(178,58,34,.08)); border-left: 3px solid var(--red); padding: .4rem .6rem; }
.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 36px; margin-top: .6rem; }
.spark-bar { flex: 1; min-width: 2px; background: var(--orange); border-radius: 1px 1px 0 0; opacity: .85; }
.spark-dim .spark-bar { background: var(--text3); }
.usage-locked .usage-lock-body { display: grid; justify-items: center; gap: .4rem; padding: .4rem 0 .1rem; text-align: center; }
.usage-locked .usage-lock-body p { margin: 0; font-size: .78rem; color: var(--text3); }
.upgrade-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin: 1rem 0 1.3rem; }
.upgrade-plan { border: var(--bw) solid var(--border); border-radius: var(--r); padding: .9rem; text-align: center; display: grid; gap: .5rem; }
.upgrade-plan-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; }
.upgrade-plan-price { font-size: .82rem; color: var(--text3); }
#upgradePaymentElement { margin: .3rem 0 1rem; min-height: 180px; }
@media (max-width: 720px) { .usage-grid { grid-template-columns: 1fr; } }

/* ---------- Full-window Workbench editor mode (host-level) ----------
   Opening a page in Workbench hides the dashboard's own header/sidebar so
   the editor can use the entire window — see enterEditorFullscreen /
   exitEditorFullscreen (index.html) and paintEditor() in workbench.js.
   Only chrome AROUND the editor is touched here; .wb-editor-shell itself
   (below) is laid out identically whether or not this class is present. */
body.editor-fullscreen { overflow: hidden; }
body.editor-fullscreen .sidebar, body.editor-fullscreen .topbar { display: none; }
body.editor-fullscreen .app, body.editor-fullscreen .main-col { height: 100vh; }
body.editor-fullscreen main#main { padding: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
body.editor-fullscreen #sectionBody { flex: 1; min-height: 0; display: flex; flex-direction: column; }


/* Workbench's own .wb-*/.cm-* rules now live inside assets/js/workbench.js
   itself (see injectWorkbenchStyles, called from mountList) — self-
   contained styling per-module, same pattern assets/js/search.js already
   uses (its own injectStyles()). This file keeps only the shared :root
   tokens workbench.js's injected rules reference via var(...), plus the
   body.editor-fullscreen rules just above, which the HOST shell (this
   page, not workbench.js) applies when it hides its own sidebar/topbar —
   kept here rather than moved, since that's this shell's own layout
   response, not workbench.js's rendered content. */
