/* Devdwell CMS — app styles
   Warm paper, ink and a single ember accent. Geist for UI, Geist Mono for code. */

:root {
  --paper: #f3f0ea;
  --paper-2: #efece5;
  --surface: #ffffff;
  --side: #f1eee8;
  --ink: #0b0b0c;
  --ink-2: #3b3a36;
  --muted: #6e6b64;
  --faint: #a09d96;
  --line: #e6e2da;
  --line-2: #d6d1c7;
  --accent: #2fc7a6;
  --accent-ink: #0b7a68;
  --accent-soft: #dff5ee;
  --ok: #17784b;
  --ok-soft: #e2f2e8;
  --warn: #9a5b00;
  --warn-soft: #fcf0d9;
  --err: #c2372b;
  --err-soft: #fbe9e7;
  --focus: 0 0 0 3px rgba(47, 199, 166, .3);
  --r: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 18, .06);
  --shadow: 0 1px 2px rgba(20, 20, 18, .05), 0 6px 20px -6px rgba(20, 20, 18, .1);
  --shadow-lg: 0 24px 60px -12px rgba(20, 20, 18, .28), 0 2px 8px rgba(20, 20, 18, .06);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --sans: "Schibsted Grotesk", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; font-feature-settings: "ss01", "cv11"; }
::selection { background: #ffd8c7; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; transition: text-decoration-color .15s; }
a:hover { text-decoration-color: var(--ink); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.022em; font-weight: 600; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
code, kbd, .mono { font-family: var(--mono); font-size: .9em; }
kbd { border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 11px; color: var(--muted); background: var(--surface); }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ico { flex: none; }
[hidden] { display: none !important; }

/* motion */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(12px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
.main.enter > * { animation: rise .45s var(--ease-out) both; }
.stagger > * { animation: rise .5s var(--ease-out) both; }
.stagger > *:nth-child(2) { animation-delay: .04s; } .stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .12s; } .stagger > *:nth-child(5) { animation-delay: .16s; }
.stagger > *:nth-child(6) { animation-delay: .2s; } .stagger > *:nth-child(n+7) { animation-delay: .24s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* utilities */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sm { font-size: 12.5px; }
.strong { font-weight: 600; }
.row { display: flex; align-items: center; gap: 12px; }
.gap-sm { gap: 8px; }
.gap { gap: 16px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.min0 { min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.center-row { justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.center { align-items: center; }
.sm-gap { gap: 10px; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.link { background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; font: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--ink); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, box-shadow .15s, transform .15s var(--ease), color .15s; }
.btn:hover { background: #faf9f6; border-color: #c8c2b6; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:focus-visible, .icon-btn:focus-visible, .input:focus, .nav-link:focus-visible, .user-chip:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #faf8f4; box-shadow: var(--shadow-sm); }
.btn.primary:hover:not(:disabled) { background: #2a2925; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover:not(:disabled) { background: #3ad4b2; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(20, 20, 18, .05); }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-soft); border-color: #f0c9c4; }
.modal-foot .btn.danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; gap: 5px; }
.btn.lg { height: 44px; font-size: 15px; padding: 0 18px; border-radius: 11px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; flex: none; transition: background .15s, color .15s; }
.icon-btn:hover:not(:disabled) { background: rgba(20, 20, 18, .06); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 6px; }
.icon-btn.on { background: var(--accent-soft); color: var(--accent-ink); border-color: #ffd3c0; }
.icon-btn.danger:hover:not(:disabled) { color: var(--err); background: var(--err-soft); }

/* inputs */
.input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; transition: border-color .15s, box-shadow .15s; }
.input:hover:not(:focus) { border-color: #c8c2b6; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
select.input { padding-right: 30px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6b64' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center; }
.input.narrow { max-width: 220px; }
.input.auto { width: auto; }
.input.sm { height: 30px; font-size: 13px; }
.input.mono { font-family: var(--mono); font-size: 13px; }
.input.code { background: #faf8f4; tab-size: 2; }
.input::placeholder { color: #b5b1a8; }
input[type="color"] { width: 42px; height: 38px; padding: 3px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.end { justify-content: flex-end; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 4px; }
.req { color: var(--accent); }
.help { font-size: 12.5px; color: var(--muted); }
.field-err { font-size: 12.5px; color: var(--err); animation: rise .25s var(--ease-out); }
.field-err:empty { display: none; }
.field.has-err > .input, .field.has-err .rte, .field.has-err .media-field .drop-btn, .field.has-err .md-src { border-color: var(--err); }
.with-counter { position: relative; }
.with-counter .input { padding-right: 64px; }
.counter { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.affix { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; background: var(--surface); max-width: 100%; transition: border-color .15s, box-shadow .15s; }
.affix:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.affix > span { display: grid; place-items: center; padding: 0 10px; background: var(--paper); color: var(--muted); font-size: 13px; }
.affix .input { border: 0; border-radius: 0; box-shadow: none !important; }
.inline-sel { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 36px; height: 21px; border-radius: 99px; background: #d4cfc5; position: relative; transition: background .2s var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .25s var(--ease-out); }
.switch input:checked + .track { background: var(--ink); }
.switch input:checked + .track::after { transform: translateX(15px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }
.switch-label { font-size: 13.5px; }
.radios, .check-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.radio, .check-row { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: 9px; cursor: pointer; background: var(--surface); font-size: 13.5px; transition: border-color .15s, background .15s; }
.radio:has(input:checked), .check-row:has(input:checked) { border-color: var(--ink); background: #faf9f6; }

/* pills, chips */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 23px; padding: 0 9px; border-radius: 99px; background: var(--paper-2); color: var(--ink-2); font-size: 12px; font-weight: 550; white-space: nowrap; }
.pill.xs { height: 18px; padding: 0 7px; font-size: 11px; }
.pill.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #a8a39a; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.ok::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(23, 120, 75, .15); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.warn::before { background: #e08a00; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; border-radius: 7px; background: var(--paper-2); color: var(--ink); font-size: 13px; animation: pop .2s var(--ease-out); }
.chip.sm { height: 20px; padding: 0 7px; font-size: 11.5px; }
.chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; width: 20px; height: 20px; border-radius: 5px; font-size: 15px; line-height: 1; }
.chip-x:hover { background: rgba(20, 20, 18, .08); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .1); }
.swatch-row { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; }
.thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--paper-2); flex: none; display: inline-grid; place-items: center; color: var(--faint); vertical-align: middle; }
.thumbs { display: inline-flex; gap: 4px; align-items: center; }
.thumbs .thumb { width: 28px; height: 28px; }

/* toasts */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: #faf8f4; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .3s var(--ease-out); max-width: 540px; }
.toast.ok .ico { color: #8ee0b5; }
.toast.err { background: #a52a20; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .35s var(--ease); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(20, 20, 18, .36); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 500; animation: fade .2s ease; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .28s var(--ease-out); }
.modal.lg { width: min(720px, 100%); }
.modal.xl { width: min(980px, 100%); }
.modal.pal { width: min(600px, 100%); align-self: start; margin-top: 12vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 6px 24px; }
.modal-body { padding: 12px 24px 22px; overflow: auto; }
.modal.pal .modal-body { padding: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); }

.menu-pop { position: absolute; z-index: 600; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; animation: pop .18s var(--ease-out); transform-origin: top right; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 7px; font: inherit; color: var(--ink); cursor: pointer; text-align: left; transition: background .12s; }
.menu-item:hover { background: var(--paper); }
.menu-item .ico { color: var(--muted); }
.menu-item.danger, .menu-item.danger .ico { color: var(--err); }

/* loading */
.loading { display: grid; place-items: center; min-height: 100vh; }
.loading.sm { min-height: 160px; grid-column: 1 / -1; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--ink); animation: spin .7s linear infinite; }

/* brand */
.logo { display: inline-block; flex: none; }
.logo svg { display: block; }
.wordmark { font-weight: 650; letter-spacing: -.035em; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 520px) 1fr; }
.auth-card { padding: 56px clamp(24px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; gap: 18px; background: var(--surface); }
.auth-card > * { animation: rise .5s var(--ease-out) both; }
.auth-card > *:nth-child(2) { animation-delay: .05s; } .auth-card > *:nth-child(3) { animation-delay: .1s; } .auth-card > *:nth-child(n+4) { animation-delay: .15s; }
.auth-card h1 { font-size: 30px; }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; color: var(--ink) !important; text-decoration: none !important; margin-bottom: 18px; }
.auth-brand.sm { margin: 0; font-size: 18px; }
.form-msg { font-size: 13px; color: var(--err); background: var(--err-soft); padding: 9px 12px; border-radius: 9px; animation: rise .25s var(--ease-out); }
.form-msg.info { color: var(--ink-2); background: var(--paper); }
.form-msg:empty { display: none; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; background: var(--paper); color: var(--ink-2); line-height: 1.5; border: 1px solid var(--line); }
.note .ico { margin-top: 2px; color: var(--accent); }
.note.warn { background: var(--warn-soft); color: #6d4300; border-color: #f2ddb1; margin-bottom: 18px; }
.note.warn .ico { color: var(--warn); }
.auth-art { position: relative; overflow: hidden; background: var(--ink); }
.auth-art::before { content: ""; position: absolute; width: 46vmin; height: 46vmin; border-radius: 50%; background: var(--accent); left: 50%; bottom: 26%; transform: translate(-50%, 50%); animation: sunrise 1.6s var(--ease-out) both; }
.auth-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26%; background: var(--ink); border-top: 3px solid var(--paper); }
@keyframes sunrise { from { transform: translate(-50%, 100%); } }
.art-card { position: absolute; z-index: 1; background: rgba(251, 250, 247, .97); border-radius: 14px; padding: 16px 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); display: flex; flex-direction: column; gap: 4px; animation: float-in .9s var(--ease-out) both; }
@keyframes float-in { from { opacity: 0; transform: translateY(22px); } }
.art-card.a1 { top: 16%; left: 12%; width: 220px; animation-delay: .35s; }
.art-card.a1 span { color: var(--muted); font-size: 13px; }
.art-card.a2 { top: 30%; left: 46%; animation-delay: .5s; }
.art-card.a2 code { color: var(--accent-ink); }
.art-card.a3 { top: 46%; left: 20%; flex-direction: row; align-items: center; gap: 8px; font-weight: 600; color: var(--ok); animation-delay: .65s; }

/* top layout (projects) */
.topbar { display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 28px; background: rgba(246, 244, 239, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 36px 64px; }
.container.narrow { max-width: 680px; }
.container.narrow-ish { max-width: 840px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.page-head p { margin-top: 6px; max-width: 640px; }
.help-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); text-decoration: none; padding: 4px 10px 4px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); transition: color .15s, border-color .15s; }
.help-link:hover { color: var(--ink); border-color: var(--line-2); }
.help-link .ico { color: var(--accent); }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.proj-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; color: var(--ink); text-decoration: none !important; transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .2s; font: inherit; cursor: pointer; padding: 0; text-align: left; animation: rise .5s var(--ease-out) both; }
.proj-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--line-2); }
.proj-cover { height: 104px; display: grid; place-items: center; position: relative; overflow: hidden; background: hsl(var(--h) 28% 90%); }
.proj-cover::after { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; background: hsl(var(--h) 45% 72%); bottom: -70px; right: 22px; transition: transform .5s var(--ease-out); }
.proj-card:hover .proj-cover::after { transform: translateY(-10px); }
.proj-cover span { position: relative; z-index: 1; font-size: 26px; font-weight: 650; letter-spacing: -.03em; color: hsl(var(--h) 35% 22%); }
.proj-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.proj-card.new { align-items: center; justify-content: center; gap: 8px; min-height: 216px; border-style: dashed; border-width: 1.5px; color: var(--muted); background: transparent; font-weight: 600; }
.proj-card.new:hover { color: var(--ink); border-color: var(--ink); background: var(--surface); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--ink); transition: border-color .15s, background .15s, transform .2s var(--ease); }
.tpl:hover { border-color: var(--line-2); transform: translateY(-1px); }
.tpl.on { border-color: var(--ink); background: #faf9f6; }
.tpl-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--paper); border: 1px solid var(--line); color: var(--ink); margin-bottom: 4px; }
.tpl.on .tpl-ico { background: var(--accent); color: #fff; border-color: var(--accent); }

/* shell */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; background: var(--side); border-right: 1px solid var(--line); }
.side-top { display: flex; align-items: center; gap: 8px; }
.brand-sm { display: grid; place-items: center; text-decoration: none !important; transition: transform .3s var(--ease-out); }
.brand-sm:hover { transform: rotate(-6deg); }
.proj-switch { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; justify-content: space-between; height: 36px; padding: 0 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; font: inherit; font-weight: 650; color: var(--ink); cursor: pointer; transition: background .15s, border-color .15s; }
.proj-switch:hover { background: var(--surface); border-color: var(--line); }
.search-btn { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; color: var(--faint); font: inherit; cursor: pointer; transition: border-color .15s, color .15s; }
.search-btn:hover { border-color: var(--line-2); color: var(--muted); }
.side-nav { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -4px; padding: 0 4px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 16px 10px 6px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none !important; font-weight: 500; transition: background .15s, color .15s; }
.nav-link .ico { color: var(--faint); transition: color .15s; }
.nav-link:hover { background: rgba(20, 20, 18, .045); color: var(--ink); }
.nav-link.active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); }
.nav-link.active::before { content: ""; position: absolute; left: -4px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent); animation: fade .3s; }
.nav-link.active .ico { color: var(--ink); }
.count { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.side-foot { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.mode { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; width: fit-content; text-decoration: none !important; }
.mode i { width: 7px; height: 7px; border-radius: 50%; }
.mode.cloud { background: var(--ok-soft); color: var(--ok); }
.mode.cloud i { background: var(--ok); }
.mode.local { background: var(--warn-soft); color: var(--warn); }
.mode.local i { background: #e08a00; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px; border: 0; background: transparent; border-radius: 10px; font: inherit; color: var(--ink); cursor: pointer; text-align: left; width: 100%; transition: background .15s; }
.user-chip:hover { background: rgba(20, 20, 18, .05); }
.user-chip.compact { width: auto; padding: 4px 8px 4px 4px; font-weight: 550; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #faf8f4; font-size: 12px; font-weight: 650; flex: none; }
.main { min-width: 0; }

/* overview */
.overview-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 28px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.ov-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; align-items: start; }
.checklist { display: flex; flex-direction: column; }
.check-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); text-decoration: none !important; color: var(--ink); transition: background .15s; }
.check-item:first-child { border-top: 0; }
.check-item:hover { background: #fcfbf9; }
.check-dot { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; color: #fff; transition: background .3s var(--ease), border-color .3s; }
.check-item.done .check-dot { background: var(--ok); border-color: var(--ok); }
.check-item.done .check-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.check-title { font-weight: 600; }
.progress { height: 6px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .8s var(--ease-out); }
.recent { display: flex; flex-direction: column; }
.recent a { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: background .15s; }
.recent a:first-child { border-top: 0; }
.recent a:hover { background: #fcfbf9; }

/* toolbar / table */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search-wrap { position: relative; display: flex; align-items: center; min-width: 240px; }
.search-wrap > .ico { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.search-wrap .input { padding-left: 33px; }
.bulk { display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin-bottom: 12px; border-radius: 11px; background: var(--ink); color: #faf8f4; animation: pop .25s var(--ease-out); }
.bulk .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #faf8f4; }
.bulk .btn:hover { background: rgba(255, 255, 255, .16); }
.bulk .btn.danger { color: #ffb4a8; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: #faf8f4; white-space: nowrap; user-select: none; }
.table th.sortable { cursor: pointer; transition: color .15s; }
.table th.sortable:hover, .table th.on { color: var(--ink); }
.table th .ico { vertical-align: -2px; margin-left: 3px; }
.table td { padding: 11px 14px; border-bottom: 1px solid #efece6; vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background .12s; animation: fade .35s ease both; }
.table tbody tr:hover { background: #fcfbf9; }
.table tbody tr.sel { background: var(--accent-soft); }
.table tr:last-child td { border-bottom: 0; }
.table .chk { width: 40px; padding-right: 0; }
.table.ref tr { cursor: default; animation: none; }
.table.ref td:first-child { width: 34%; }
.table.ref code { color: var(--accent-ink); background: var(--accent-soft); padding: 2px 6px; border-radius: 5px; font-size: 12px; word-break: break-word; }
.title-cell { display: flex; align-items: center; gap: 12px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); width: 15px; height: 15px; }
.empty { padding: 52px 20px; text-align: center; color: var(--muted); }
.empty.sm { padding: 24px; }
.empty.wide { grid-column: 1 / -1; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface); }
.big-ico { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; background: var(--accent-soft); color: var(--accent-ink); }
.welcome { text-align: center; padding: 70px 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card.pad, .card .pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head .ico { color: var(--muted); }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.kv > span:first-child { color: var(--muted); }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 32px 0 12px; }
.danger-zone { border-color: #efcdc8; }

/* editor */
.editor { display: flex; flex-direction: column; min-height: 100vh; }
.editor-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 28px; background: rgba(246, 244, 239, .88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.editor-head h1 { font-size: 19px; max-width: 52vw; }
.crumbs { font-size: 12px; color: var(--muted); font-weight: 500; }
.save-state { font-size: 12.5px; color: var(--faint); white-space: nowrap; transition: color .2s; }
.save-state[data-s="dirty"] { color: var(--warn); }
.save-state[data-s="saving"]::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; border: 1.5px solid var(--line-2); border-top-color: var(--ink); animation: spin .6s linear infinite; vertical-align: -1px; }
.save-state[data-s="error"] { color: var(--err); }
.save-state[data-s="saved"]::before { content: "✓ "; color: var(--ok); }
.status-line { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.editor-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; padding: 26px 28px 80px; max-width: 1240px; width: 100%; margin: 0 auto; }
.editor-form { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 30px; }
.editor-side { position: sticky; top: 92px; align-self: start; display: flex; flex-direction: column; gap: 12px; }
.versions { max-height: 320px; overflow: auto; }
.version { display: flex; align-items: center; gap: 8px; padding: 9px 14px 9px 18px; border-bottom: 1px solid #f1eee8; font-size: 13px; }
.version:last-child { border-bottom: 0; }

.fields { display: flex; flex-wrap: wrap; gap: 24px 18px; }
.fields > .field { flex: 1 1 100%; }
.fields > .field.w-half { flex: 1 1 calc(50% - 9px); min-width: 220px; }
.fields > .field.w-third { flex: 1 1 calc(33.33% - 12px); min-width: 170px; }
.group-box { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #faf8f4; }
.group-box .fields { gap: 16px; }

.tags-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 38px; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); cursor: text; transition: border-color .15s, box-shadow .15s; }
.tags-box:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.tag-input { flex: 1; min-width: 120px; border: 0; outline: 0; font: inherit; height: 26px; background: transparent; }

.drop-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 96px; border: 1.5px dashed var(--line-2); border-radius: 12px; background: #faf8f4; color: var(--muted); font: inherit; font-weight: 550; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.drop-btn:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.media-preview { display: flex; gap: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; align-items: flex-start; animation: fade .3s; }
.media-preview .thumb { width: 150px; height: 110px; border-radius: 9px; }
.media-meta { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.media-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-field { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gal-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4 / 3; animation: pop .25s var(--ease-out); }
.gal-item .thumb { width: 100%; height: 100%; border-radius: 0; }
.gal-tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: center; gap: 2px; padding: 4px; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); opacity: 0; transition: opacity .15s; }
.gal-item:hover .gal-tools, .gal-item:focus-within .gal-tools { opacity: 1; }
.gal-tools .icon-btn { color: #fff; }
.gal-tools .icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .2); color: #fff; }
.gal-add { aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1.5px dashed var(--line-2); border-radius: 10px; background: #faf8f4; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s; }
.gal-add:hover { border-color: var(--ink); color: var(--ink); }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.ref-field { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ref-chip { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: #faf8f4; animation: pop .2s var(--ease-out); }
.ref-chip .ico { color: var(--muted); }
.ref-chip.missing { color: var(--err); }

.list-field { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.list-field > .btn { align-self: flex-start; }
.list-item { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); transition: box-shadow .2s, border-color .2s; animation: fade .25s; }
.list-item.open { border-color: var(--line-2); box-shadow: var(--shadow); }
.list-head { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 12px; cursor: pointer; }
.list-head > .ico { color: var(--faint); }
.list-body { padding: 16px 18px 18px; border-top: 1px solid var(--line); background: #fcfbf9; border-radius: 0 0 11px 11px; animation: rise .3s var(--ease-out); }
.block-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* rich text */
.rte { border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); overflow: clip; transition: border-color .15s, box-shadow .15s; }
.rte:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.rte-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 5px 6px; border-bottom: 1px solid var(--line); background: #faf8f4; position: sticky; top: 64px; z-index: 2; }
.rte-bar.src > :not(.src-toggle):not(.grow) { opacity: .35; pointer-events: none; }
.rte-btn { min-width: 30px; height: 30px; padding: 0 7px; border: 0; background: transparent; border-radius: 7px; color: var(--ink-2); font: inherit; font-size: 13.5px; cursor: pointer; display: inline-grid; place-items: center; transition: background .12s; }
.rte-btn:hover { background: var(--paper-2); }
.rte-bar.src .src-toggle { background: var(--accent-soft); color: var(--accent-ink); }
.rte-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; }
.rte-block { height: 30px; border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--ink-2); border-radius: 7px; padding: 0 6px; cursor: pointer; }
.rte-block:hover { background: var(--paper-2); }
.rte-area { min-height: 200px; padding: 16px 20px; outline: none; }
.rte-src { border: 0; border-radius: 0; box-shadow: none !important; }
.prose { line-height: 1.72; font-size: 15.5px; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 22px; margin: 1.3em 0 .4em; }
.prose h3 { font-size: 18px; margin: 1.2em 0 .4em; }
.prose h4 { font-size: 15.5px; margin: 1em 0 .4em; }
.prose p { margin: 0 0 .85em; }
.prose blockquote { margin: 1em 0; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.prose pre { background: var(--ink); color: #eeebe4; padding: 12px 14px; border-radius: 9px; font-family: var(--mono); font-size: 13px; overflow: auto; }
.prose img, .prose iframe { max-width: 100%; height: auto; border-radius: 9px; }
.prose iframe { aspect-ratio: 16 / 9; width: 100%; }
.prose a { text-decoration-color: var(--accent); }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line-2); padding: 7px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--paper); font-weight: 600; }
.prose code { background: var(--paper-2); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
.prose pre code { background: none; padding: 0; color: inherit; }

/* markdown field */
.md-field { display: flex; flex-direction: column; gap: 8px; }
.md-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.md-src { font-family: var(--mono); font-size: 13.5px; line-height: 1.7; resize: vertical; min-height: 220px; }
.md-field > .rte, .md-field > .md-src { animation: fade .25s; }

/* pickers */
.pick-list { max-height: 420px; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; font: inherit; color: var(--ink); text-align: left; cursor: pointer; transition: background .12s; }
.pick-row:hover { background: var(--paper); }
.pick-row.on { background: var(--accent-soft); border-color: #ffd3c0; }
.check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); display: grid; place-items: center; background: var(--surface); color: #fff; flex: none; }
.pick-row.on .check { background: var(--ink); border-color: var(--ink); }

/* media */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
.asset-grid.compact { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); max-height: 56vh; overflow: auto; padding: 2px; }
.asset { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px 8px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); font: inherit; color: var(--ink); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .2s, transform .2s var(--ease); min-width: 0; animation: rise .4s var(--ease-out) both; }
.asset:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-2px); }
.asset.on { border-color: var(--ink); box-shadow: var(--focus); }
.asset-prev { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(#f1eee8 0 25%, #fff 0 50%) 0 0 / 16px 16px; display: grid; place-items: center; margin-bottom: 4px; }
.asset-prev .thumb { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; background: transparent; object-fit: contain; }
.file-ico { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.asset-name { font-size: 13px; font-weight: 550; }
.asset-check { position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; animation: pop .2s var(--ease-out); }
.drop-target { min-height: calc(100vh - 20px); }
.dragging { outline: 2px dashed var(--accent); outline-offset: -10px; background: rgba(255, 90, 31, .04); border-radius: 16px; }
.detail { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.detail-prev { display: grid; place-items: center; background: repeating-conic-gradient(#f1eee8 0 25%, #fff 0 50%) 0 0 / 16px 16px; border-radius: 12px; min-height: 240px; overflow: hidden; }
.detail-prev img, .detail-prev video { max-width: 100%; max-height: 60vh; display: block; }

/* content types (model) */
.model-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.model-side { border-right: 1px solid var(--line); padding: 16px 12px; background: #faf8f4; }
.model-list { display: flex; flex-direction: column; gap: 2px; }
.model-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none !important; transition: background .15s; }
.model-item .ico { color: var(--faint); }
.model-item:hover { background: var(--paper); }
.model-item.active { background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); }
.model-item.active .ico { color: var(--ink); }
.model-item.add { color: var(--ink); font-weight: 600; margin-top: 6px; }
.model-item.add .ico { color: var(--accent); }
.model-main { min-width: 0; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.fl { display: flex; flex-direction: column; gap: 8px; }
.fl.nested { padding: 12px; background: #f9f8f5; border: 1px solid var(--line); border-radius: 12px; }
.fl-item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: box-shadow .2s, border-color .2s; animation: fade .3s; }
.fl-item:hover { border-color: var(--line-2); }
.fl-item.open { border-color: var(--ink); box-shadow: var(--shadow); }
.fl-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; cursor: pointer; }
.fl-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--paper); border: 1px solid var(--line); color: var(--ink); flex: none; }
.fl-body { padding: 16px 18px 18px; border-top: 1px solid var(--line); animation: rise .3s var(--ease-out); }
.specific { padding-top: 14px; border-top: 1px dashed var(--line); }
.add-field { display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border: 1.5px dashed var(--line-2); border-radius: 12px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.add-field:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.ft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.ft { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font: inherit; color: var(--ink); text-align: left; cursor: pointer; transition: border-color .15s, transform .2s var(--ease); }
.ft > span:last-child { display: flex; flex-direction: column; }
.ft:hover { border-color: var(--ink); transform: translateY(-1px); }
.block-def { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }

/* add to website */
.code-wrap { position: relative; }
.code-block { margin: 0; padding: 16px 18px; background: var(--ink); color: #eeebe4; border-radius: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; overflow: auto; white-space: pre; max-height: 460px; }
.copy-btn { position: absolute; top: 8px; right: 8px; background: #2a2925; color: #eeebe4; border-color: #3d3b36; }
.copy-btn:hover { background: #36342f !important; border-color: #4a4842 !important; }
.step { display: flex; gap: 14px; align-items: flex-start; margin-top: 8px; }
.step-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 650; font-size: 13px; flex: none; }
.step p { margin-top: 2px; }
.api-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.preview-frame { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-top: 6px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--paper-2); }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font: inherit; font-weight: 550; color: var(--muted); cursor: pointer; transition: background .2s var(--ease), color .2s, box-shadow .2s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg.sm { padding: 2px; border-radius: 9px; }
.seg.sm button { padding: 5px 11px; font-size: 13px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }

/* palette */
.pal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--faint); }
.pal-input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 16px; color: var(--ink); background: transparent; }
.pal-list { max-height: 400px; overflow: auto; padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 9px; background: transparent; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.pal-item .ico { color: var(--faint); }
.pal-item.on { background: var(--paper); }
.pal-item.on .ico { color: var(--accent); }

/* responsive */
@media (max-width: 1100px) {
  .editor-body { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .api-split, .ov-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .nav-label { display: none; }
  .nav-link.active::before { display: none; }
  .side-foot { flex-direction: row; align-items: center; }
  .model-layout { grid-template-columns: 1fr; }
  .model-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .container { padding: 22px 18px 50px; }
  .editor-head { padding: 10px 16px; flex-wrap: wrap; }
  .editor-body { padding: 16px; }
  .editor-form { padding: 20px; }
  .grid2, .grid3, .detail { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .rte-bar { top: 0; }
}

/* ===================== Devdwell brand ===================== */
:root {
  --paper: #f3f0ea;
  --paper-2: #ebe7df;
  --surface: #ffffff;
  --side: #0b0b0c;
  --ink: #0b0b0c;
  --ink-2: #3a3833;
  --muted: #5e5a52;
  --faint: #8f8a80;
  --line: #e2ddd3;
  --line-2: #d2ccc0;
  --accent: #2fc7a6;
  --accent-ink: #0b7a68;
  --accent-soft: #dff5ee;
  --teal: #0e9e93;
  --coral: #ff6b57;
  --g: #2fc7a6;
  --g-wide: #2fc7a6;
  --g-soft: #dff5ee;
  --focus: 0 0 0 3px rgba(47, 199, 166, .3);
  --sans: "Schibsted Grotesk", -apple-system, "Segoe UI", system-ui, sans-serif;
  --display: "Outfit", "Schibsted Grotesk", -apple-system, system-ui, sans-serif;
}
body { font-family: var(--sans); }
::selection { background: #bff0e2; }
h1, h2, .wordmark, .stat b, .proj-cover span, .overview-hero h1 { font-family: var(--display); font-weight: 500; letter-spacing: -.035em; }
h3 { font-family: var(--display); font-weight: 500; letter-spacing: -.02em; }
.wordmark { font-weight: 500; letter-spacing: -.03em; }
.cms-tag { font: 600 10px/1 var(--sans); letter-spacing: .08em; padding: 4px 6px; border-radius: 6px; background: var(--accent); color: var(--ink); margin-left: 6px; }

/* buttons */
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 600; box-shadow: none; }
.btn.primary:hover:not(:disabled) { background: #3ad4b2; border-color: #3ad4b2; box-shadow: 0 10px 24px -14px rgba(47, 199, 166, .9); }
.btn.primary:disabled { background: #d7ebe5; border-color: #d7ebe5; color: #5e7a72; opacity: 1; }
.switch input:checked + .track { background: var(--teal); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--teal); }

/* dark sidebar, like Devdwell */
.side { background: var(--side); border-right: 0; color: #e8e4dc; }
.side .proj-switch { color: #f3f0ea; }
.side .proj-switch:hover { background: rgba(243, 240, 234, .08); border-color: transparent; }
.side .search-btn { background: rgba(243, 240, 234, .06); border-color: rgba(243, 240, 234, .1); color: #8f8a80; }
.side .search-btn:hover { border-color: rgba(243, 240, 234, .2); color: #bebab2; }
.side .search-btn kbd { background: transparent; border-color: rgba(243, 240, 234, .2); color: #8f8a80; }
.side .nav-label { color: #6e6a62; }
.side .nav-link { color: #bebab2; }
.side .nav-link .ico { color: #6e6a62; }
.side .nav-link:hover { background: rgba(243, 240, 234, .06); color: #f3f0ea; }
.side .nav-link.active { background: rgba(243, 240, 234, .1); color: #fff; box-shadow: none; }
.side .nav-link.active .ico { color: var(--accent); }
.side .nav-link.active::before { background: var(--accent); }
.side .count { color: #6e6a62; }
.side .side-foot { border-color: rgba(243, 240, 234, .08); }
.side .user-chip { color: #f3f0ea; }
.side .user-chip:hover { background: rgba(243, 240, 234, .06); }
.side .user-chip .faint { color: #8f8a80; }
.side .mode.cloud { background: rgba(47, 199, 166, .14); color: var(--accent); }
.avatar { background: var(--teal); color: #fff; }

/* overview */
.overview-hero { padding: 30px 32px; border-radius: 22px; background: var(--ink); color: #f3f0ea; }
.overview-hero .muted { color: #bebab2; }
.overview-hero h1 { font-size: 34px; }
.overview-hero .btn:not(.primary) { background: rgba(243, 240, 234, .08); border-color: rgba(243, 240, 234, .18); color: #f3f0ea; }
.overview-hero .btn:not(.primary):hover { background: rgba(243, 240, 234, .14); }
.overview-hero .help-link { background: transparent; border-color: rgba(243, 240, 234, .25); color: #e8e4dc; }
.stat b { font-size: 32px; color: var(--ink); }
.check-item.done .check-dot { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.progress > i { background: var(--accent); }
.step-n { background: var(--ink); }
.big-ico { background: var(--accent-soft); color: var(--accent-ink); }
.bulk { background: var(--ink); }
.toast { background: var(--ink); }
.toast.ok .ico { color: var(--accent); }
.fl-item.open { border-color: var(--ink); box-shadow: var(--shadow); }
.pick-row.on { background: var(--accent-soft); border-color: #b9e9dc; }
.pick-row.on .check, .asset-check { background: var(--ink); border-color: var(--ink); }
.asset.on { border-color: var(--teal); }
.tpl.on { border-color: var(--ink); background: #faf8f4; }
.tpl.on .tpl-ico { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.help-link .ico { color: var(--teal); }
.save-state[data-s="saved"]::before { color: var(--teal); }
.code-block { background: #121214; }
.copy-btn { background: #1d1d20; border-color: #2e2e32; }
.nav-link.active::before { background: var(--accent); }

/* sign-in artwork: the Devdwell mark on ink */
.auth-art { background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3CclipPath id='c'%3E%3Cpath d='M19 6 H32 V43 A13 13 0 0 1 19 56 H6 V19 A13 13 0 0 1 19 6 Z'/%3E%3C/clipPath%3E%3Cpath d='M19 6 H32 V43 A13 13 0 0 1 19 56 H6 V19 A13 13 0 0 1 19 6 Z' fill='%230E9E93'/%3E%3Cpath d='M37 26 H56 V56 H37 A15 15 0 0 1 37 26 Z' fill='%23FF6B57'/%3E%3Cg clip-path='url(%23c)'%3E%3Cpath d='M37 26 H56 V56 H37 A15 15 0 0 1 37 26 Z' fill='%230B3A48'/%3E%3C/g%3E%3C/svg%3E") no-repeat 82% 88% / 38vmin; }
.auth-art::before, .auth-art::after { display: none; }
.art-card { background: #faf8f4; }
.art-card.a2 code { color: var(--accent-ink); }

/* project covers: website preview image, or a calm neutral tile */
.proj-cover { height: 150px; background: #e9e4da; }
.proj-cover::after { display: none; }
.proj-cover span { color: #0b3a48; font-size: 34px; text-shadow: none; }
.proj-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.proj-card:hover .proj-cover img { transform: scale(1.03); }
.proj-cover .site-chip { position: absolute; left: 10px; bottom: 10px; z-index: 2; font-size: 11.5px; font-weight: 600; color: #f3f0ea; background: rgba(11, 11, 12, .72); backdrop-filter: blur(6px); padding: 3px 9px; border-radius: 99px; }
.proj-card.new:hover { border-color: var(--ink); }

/* ===================== Writer (Webflow-style rich text) ===================== */
.wr { display: flex; flex-direction: column; gap: 8px; }
.wr-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wr-hint { font-size: 12px; color: var(--faint); }
.wr-count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.wr-stage { position: relative; }
.wr-canvas { border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.wr-canvas:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 199, 166, .18); }
.wr-area { min-height: 220px; padding: 22px 26px 26px 26px; outline: none; font-size: 16px; line-height: 1.75; }
.wr-area.is-empty::before { content: "Start writing… Select text to format it, or click + on an empty line to add images, video and more."; position: absolute; color: #a8a399; pointer-events: none; max-width: 80%; }
.wr-area h1 { font-size: 30px; margin: .9em 0 .35em; }
.wr-area h5 { font-size: 15px; margin: 1em 0 .4em; }
.wr-area h6 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 1em 0 .4em; }
.wr-area figure { margin: 1.1em 0; }
.wr-area img { cursor: pointer; transition: box-shadow .2s; }
.wr-area img.wr-selected { box-shadow: 0 0 0 3px #2fc7a6; }
.wr-area hr { border: 0; height: 2px; background: var(--line-2); opacity: 1; border-radius: 2px; margin: 1.6em 0; }
.wr-area li > p { margin: 0; }
.md-src { font-family: var(--mono); font-size: 13.5px; line-height: 1.75; resize: vertical; min-height: 240px; padding: 18px 20px; }

.wb { position: absolute; z-index: 30; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px; background: #141416; color: #fff; box-shadow: 0 16px 40px -10px rgba(26, 20, 48, .55), 0 0 0 1px rgba(255, 255, 255, .06); animation: pop .18s var(--ease-out); white-space: nowrap; }
.wb::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; margin-left: -5px; background: #141416; transform: rotate(45deg); border-radius: 2px; }
.wb-tools, .wb-link { display: flex; align-items: center; gap: 2px; }
.wb-link { gap: 6px; padding: 0 4px 0 8px; }
.wb-btn { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #e9e5f5; font: inherit; font-size: 14.5px; cursor: pointer; transition: background .12s, color .12s; }
.wb-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.wb-btn.on { background: var(--accent); color: var(--ink); }
.wb-sep { width: 1px; height: 18px; background: rgba(255, 255, 255, .14); margin: 0 4px; }
.wb-num { font-weight: 700; font-size: 13px; }
.wb-quote { font-family: Georgia, serif; font-size: 22px; line-height: 1; margin-top: 6px; }
.wb-tx { font-size: 14px; font-weight: 600; }
.wb-tx sub { font-size: 9px; }
.wb-hr { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; }
.wb-style-wrap { position: relative; }
.wb-style { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.wb-style:hover { background: rgba(255, 255, 255, .14); }
.wb-menu { position: absolute; top: 40px; left: 0; min-width: 180px; padding: 5px; background: #141416; border-radius: 12px; box-shadow: 0 16px 40px -10px rgba(26, 20, 48, .6); animation: pop .15s var(--ease-out); }
.wb-mi { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; color: #e9e5f5; font: inherit; cursor: pointer; }
.wb-mi:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.wb-mi.s-h1 { font-size: 20px; font-weight: 700; } .wb-mi.s-h2 { font-size: 18px; font-weight: 700; } .wb-mi.s-h3 { font-size: 16px; font-weight: 650; }
.wb-mi.s-h4, .wb-mi.s-h5, .wb-mi.s-h6 { font-size: 14px; font-weight: 650; } .wb-mi.s-blockquote { font-style: italic; } .wb-mi.s-pre { font-family: var(--mono); font-size: 12.5px; }
.wb-link-input { width: 260px; height: 32px; border: 0; outline: 0; background: transparent; color: #fff; font: inherit; font-size: 13.5px; }
.wb-link-input::placeholder { color: #8f8a80; }
.wb-img { padding-left: 10px; gap: 8px; }

.wr-plus { position: absolute; left: -40px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; z-index: 20; animation: pop .2s var(--ease-out); transition: transform .25s var(--ease-out), background .2s, color .2s, border-color .2s; }
.wr-plus:hover { background: var(--accent); color: var(--ink); border-color: var(--accent); transform: rotate(90deg); }
.wr-insert { position: absolute; left: -6px; z-index: 31; margin-top: 38px; width: 300px; max-height: 360px; overflow: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .18s var(--ease-out); }
.wr-ins { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.wr-ins:hover { background: var(--paper); }
.wr-ins-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--g-soft); color: var(--accent-ink); flex: none; }
.wr-ins b { display: block; font-size: 14px; }
.wr-ins small { display: block; color: var(--muted); font-size: 12px; }
@media (max-width: 860px) { .wr-plus { left: 6px; } .wr-area { padding-left: 46px; } .wr-hint { display: none; } }

/* ===================== Project tabs ===================== */
#app.with-tabs { padding-top: 42px; }
.tabs { position: fixed; top: 0; left: 0; right: 0; height: 42px; z-index: 60; display: flex; align-items: flex-end; gap: 4px; padding: 0 10px 0 8px; background: #050506; border-bottom: 1px solid #050506; }
.tab-home { display: grid; place-items: center; width: 34px; height: 32px; margin-bottom: 5px; border-radius: 9px; transition: background .15s; flex: none; }
.tab-home:hover, .tab-home.on { background: rgba(243, 240, 234, .1); }
.tab-list { display: flex; align-items: flex-end; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tab-list::-webkit-scrollbar { display: none; }
.tab { position: relative; display: flex; align-items: center; gap: 8px; height: 34px; min-width: 120px; max-width: 220px; padding: 0 8px 0 10px; border-radius: 10px 10px 0 0; color: #a8a399; text-decoration: none !important; font-size: 13px; font-weight: 550; transition: background .15s, color .15s; animation: tab-in .3s var(--ease-out); }
@keyframes tab-in { from { opacity: 0; transform: translateY(6px); } }
.tab:hover { background: rgba(243, 240, 234, .07); color: #f3f0ea; }
.tab.on { background: var(--ink); color: #f3f0ea; box-shadow: none; }
.tab.on::before { content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--g); }
.tab.on::after { display: none; }
.tab.drag { opacity: .4; }
.tab.over { box-shadow: inset 2px 0 0 #2fc7a6; }
.tab-ic { width: 18px; height: 18px; border-radius: 5px; flex: none; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; background: hsl(var(--h) 35% 38%); object-fit: cover; }
.tab-ic.img { background: #fff; }
.tab-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-x { width: 20px; height: 20px; border-radius: 6px; border: 0; background: transparent; color: #8f8a80; display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s, background .15s, color .15s; flex: none; }
.tab:hover .tab-x, .tab.on .tab-x { opacity: 1; }
.tab-x:hover { background: rgba(243, 240, 234, .12); color: #fff; }
.tab-add { width: 30px; height: 30px; margin: 0 0 6px 2px; border-radius: 8px; border: 0; background: transparent; color: #8f8a80; display: grid; place-items: center; cursor: pointer; flex: none; transition: background .15s, color .15s, transform .25s var(--ease-out); }
.tab-add:hover { background: rgba(243, 240, 234, .1); color: #fff; transform: rotate(90deg); }
.with-tabs .side { top: 42px; height: calc(100vh - 42px); }
.with-tabs .shell { min-height: calc(100vh - 42px); }
.with-tabs .editor-head, .with-tabs .topbar { top: 42px; }
.with-tabs .editor-side { top: 134px; }
.with-tabs .model-layout { min-height: calc(100vh - 42px); }
@media (max-width: 860px) { .with-tabs .side { top: auto; height: auto; } }

/* logo blocks take the text colour of where they sit */
.logo { color: var(--ink); }
.side .logo, .tabs .logo, .auth-art .logo { color: #f3f0ea; }
.auth-art { background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='2' y='2' width='12.5' height='12.5' rx='3.6' fill='%23f3f0ea'/%3E%3Crect x='2' y='17.5' width='12.5' height='12.5' rx='3.6' fill='%23f3f0ea'/%3E%3Crect x='17.5' y='17.5' width='12.5' height='12.5' rx='3.6' fill='%23f3f0ea'/%3E%3Ccircle cx='23.75' cy='8.25' r='6.25' fill='%232fc7a6'/%3E%3C/svg%3E") no-repeat 80% 86% / 34vmin; }

/* ===================== Projects page ===================== */
.top-nav { display: flex; gap: 4px; margin-left: 22px; }
.top-nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: 14px; transition: background .15s, color .15s; }
.top-nav a:hover { color: var(--ink); background: rgba(11, 11, 12, .05); }
.top-nav a.on { color: var(--ink); background: #fff; box-shadow: 0 0 0 1px var(--line); }
.seg.sm button .ico { margin-right: 2px; }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 600; background: #fff; color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; max-width: 100%; text-decoration: none !important; }
.tag .ico { flex: none; opacity: .75; }
.tag.ghost { background: var(--paper); border-color: transparent; color: var(--ink-2); font-weight: 550; }
.tag.domain { background: #eef6ff; border-color: #d3e5fb; color: #1f5fae; }
.tag.domain:hover { background: #e2efff; border-color: #b9d4f6; }
.tag.muted-tag { background: transparent; border-style: dashed; color: var(--faint); font-weight: 500; }
.tag.ok { background: #e3f6ef; border-color: #c4ebdc; color: #0b7a68; }
.tag.warn { background: #fff4dc; border-color: #f6e0ad; color: #8a5a00; }
.tag.ok-soft { background: #effaf6; border-color: transparent; color: #0b7a68; }
.tag.warn-soft { background: #fff8e8; border-color: transparent; color: #8a5a00; }
.tag .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.tag .dot.gray { background: #b5b1a8; }
.tag.ok .dot { box-shadow: 0 0 0 3px rgba(47, 199, 166, .2); }

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.pcard { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; color: var(--ink); text-decoration: none !important; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s; animation: rise .45s var(--ease-out) both; }
.pcard:hover { transform: translateY(-3px); box-shadow: 0 22px 44px -24px rgba(11, 11, 12, .35); border-color: var(--line-2); }
.pc-cover { position: relative; aspect-ratio: 1200 / 630; background: radial-gradient(120% 120% at 0% 0%, hsl(var(--h) 30% 94%), hsl(var(--h) 22% 88%)); overflow: hidden; border-bottom: 1px solid var(--line); }
.pc-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: hsl(var(--h) 30% 28%); }
.pc-fallback b { font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.pc-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.pcard:hover .pc-img { transform: scale(1.03); }
.pc-badges { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; }
.pc-badges .tag { box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .25); }
.pc-menu { position: absolute; right: 10px; top: 10px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); opacity: 0; transition: opacity .15s; }
.pcard:hover .pc-menu, .pc-menu:focus-visible { opacity: 1; }
.pc-body { padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.pc-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pc-title h3 { font-size: 17px; margin: 0; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-desc { font-size: 13.5px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.pc-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }
.pc-foot span { display: inline-flex; align-items: center; gap: 5px; }
.p-fav { border-radius: 6px; flex: none; object-fit: contain; background: #fff; }
.p-fav.fb { display: inline-grid; place-items: center; background: hsl(var(--h) 35% 38%); color: #fff; font-size: 11px; font-weight: 700; }
.pc-fallback .p-fav { border-radius: 12px; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .3); font-size: 20px; }
.pnew { align-items: center; justify-content: center; gap: 8px; min-height: 320px; border: 1.5px dashed var(--line-2); background: transparent; cursor: pointer; font: inherit; }
.pnew:hover { border-color: var(--ink); background: #fff; }
.p-empty { padding: 70px 20px; }
.ptable td, .ptable th { white-space: nowrap; }
.ptable .num { text-align: right; font-variant-numeric: tabular-nums; }
.ptable td:first-child { max-width: 340px; }
.pr-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ok-text { color: #0b7a68; font-weight: 600; }
.warn-text { color: #8a5a00; font-weight: 600; }
.table-wrap.flat { border: 0; border-radius: 0; }

/* ===================== Profile ===================== */
.avatar.xl { width: 84px; height: 84px; font-size: 30px; font-weight: 600; box-shadow: 0 0 0 4px #fff, 0 10px 30px -10px rgba(0, 0, 0, .35); }
.pf-hero { display: flex; align-items: center; gap: 24px; padding: 28px 30px; border-radius: 22px; background: #fff; border: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.pf-hero h1 { font-size: 28px; margin: 0 0 4px; }
.pf-sub { color: var(--muted); margin-bottom: 10px; }
.pf-stats { display: grid; grid-template-columns: repeat(4, auto); gap: 4px; background: var(--paper); border-radius: 14px; padding: 6px; }
.pf-stats div { display: flex; flex-direction: column; align-items: center; padding: 8px 16px; border-radius: 10px; background: #fff; min-width: 76px; }
.pf-stats b { font-family: var(--display); font-size: 22px; font-weight: 600; }
.pf-stats span { font-size: 12px; color: var(--muted); }
.pf-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.pf-nav { position: sticky; top: 120px; display: flex; flex-direction: column; gap: 2px; }
.pf-nav a, .pf-out { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none !important; font-weight: 550; font-size: 14px; border: 0; background: transparent; font-family: inherit; cursor: pointer; text-align: left; transition: background .15s; }
.pf-nav a:hover, .pf-out:hover { background: rgba(11, 11, 12, .05); }
.pf-nav a.on { background: #fff; box-shadow: 0 0 0 1px var(--line); color: var(--ink); }
.pf-nav a.on .ico { color: var(--teal); }
.pf-out { color: var(--err); }
.pf-panel { display: flex; flex-direction: column; gap: 18px; animation: rise .35s var(--ease-out) both; }
.pf-panel h3 { margin: 0 0 2px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); transition: transform .15s; }
.sw:hover { transform: scale(1.1); }
.sw.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.pref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pref { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font: inherit; text-align: left; color: var(--ink); transition: border-color .15s; }
.pref:hover { border-color: var(--line-2); }
.pref.on { border-color: var(--teal); background: #f4fbf9; }
@media (max-width: 860px) { .pf-layout { grid-template-columns: 1fr; } .pf-nav { position: static; flex-direction: row; overflow-x: auto; } .pf-nav hr { display: none; } .pf-stats { grid-template-columns: repeat(2, auto); } .top-nav { display: none; } }

/* ===================== Accessibility & responsive fixes ===================== */
:root { --faint: #6b675f; --muted: #57534b; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-app { position: fixed; left: 12px; top: -60px; z-index: 1000; background: var(--ink); color: #fff !important; padding: 10px 16px; border-radius: 10px; font-weight: 600; text-decoration: none; transition: top .15s; }
.skip-app:focus { top: 12px; }
main:focus { outline: none; }
:focus-visible { outline: 3px solid #0b7a6f; outline-offset: 2px; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-link:focus-visible, .tab-link:focus-visible, .tab-x:focus-visible, .tab-add:focus-visible, a:focus-visible { outline: 3px solid #0b7a6f; outline-offset: 2px; box-shadow: none; }
.side :focus-visible, .tabs :focus-visible { outline-color: #2fc7a6; }
/* headings that used to be h3 */
.card h2, .step h2, .pc-title h2, .pf-panel h2, .welcome h2, .danger-zone h2, .model-main h2:not(.section-title h2) { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.pc-title h2 { font-size: 17px; }
.modal-head h2 { font-size: 18px; margin: 0; }
.section-title h2 { font-size: 18px; }
/* contrast */
.avatar { background: #0b7a6f; color: #fff; }
.side .nav-label, .side .count, .side .nav-link .ico { color: #9a958b; }
.side .search-btn { color: #a8a399; }
.side .user-chip .faint { color: #a8a399; }
.tag.muted-tag { color: #6b675f; }
.help-link { color: #57534b; }
/* tabs: link + close button as siblings */
.tab { padding: 0; gap: 0; }
.tab-link { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 100%; padding: 0 4px 0 10px; color: inherit; text-decoration: none !important; border-radius: 10px 0 0 0; }
.tab-x { width: 24px; height: 24px; margin-right: 6px; }
.tab-x:focus-visible { opacity: 1; }
.tab .tab-x { opacity: .55; }
.tab:hover .tab-x, .tab.on .tab-x, .tab-x:focus-visible { opacity: 1; }
/* responsive: let grids shrink instead of overflowing */
.shell, .api-split, .pf-layout, .ov-grid, .editor-body, .model-layout, .detail { min-width: 0; }
.shell { grid-template-columns: 256px minmax(0, 1fr); }
.api-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pf-layout { grid-template-columns: 230px minmax(0, 1fr); }
.ov-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.code-wrap, .code-block { min-width: 0; max-width: 100%; }
.table-wrap { max-width: 100%; }
.toolbar > * { min-width: 0; }
@media (max-width: 1100px) { .api-split, .ov-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .shell, .pf-layout, .model-layout { grid-template-columns: minmax(0, 1fr); }
  .side { gap: 8px; padding: 10px; }
  .side-nav { margin: 0; padding: 0; }
  .side-foot { flex-wrap: wrap; }
  .side-foot .user-chip { width: auto; flex: 1; min-width: 0; }
  .pf-nav { overflow-x: auto; scrollbar-width: none; }
  .pf-nav a, .pf-out { white-space: nowrap; }
  .pf-hero { padding: 20px; gap: 16px; }
  .pf-stats { width: 100%; grid-template-columns: repeat(4, 1fr); }
  .pf-stats div { min-width: 0; padding: 8px 4px; }
  .search-wrap { min-width: 0; flex: 1 1 200px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .editor-head h1 { max-width: none; }
  .tab { min-width: 96px; }
}
@media (max-width: 520px) {
  .user-chip.compact > span:not(.avatar) { display: none; }
  .topbar .cms-tag { display: none; }
  .container { padding: 18px 14px 40px; }
  .page-head .btn { width: 100%; }
  .pgrid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat b { font-size: 24px; }
  .overview-hero { padding: 20px; }
  .overview-hero h1 { font-size: 26px; }
  .pf-stats { grid-template-columns: repeat(2, 1fr); }
  .editor-form { padding: 16px; }
  .modal-body { padding: 10px 16px 18px; }
  .modal-foot { padding: 12px 16px; flex-wrap: wrap; }
  .seg.sm button { padding: 5px 8px; }
}
.table-wrap { position: relative; }
.row-link { display: block; color: inherit; text-decoration: none; }
.row-link:hover { text-decoration: underline; }
.table.ref { table-layout: fixed; }
.table.ref td { overflow-wrap: anywhere; }
.modal { min-width: 0; }
.pal-input { min-width: 0; width: 100%; }
@media (max-width: 860px) { .card > .table.ref, section.card:has(> .table.ref) { overflow-x: auto; } }
@media (max-width: 520px) {
  .editor-head { flex-wrap: wrap; row-gap: 8px; }
  .editor-head > .grow { flex-basis: calc(100% - 50px); }
  .editor-head .btn.primary { margin-left: auto; }
  .table.ref td:first-child { width: 45%; }
}
.affix, .affix .input, .row > .grow, .row > .input { min-width: 0; }
.media-preview { flex-wrap: wrap; }
@media (max-width: 520px) { .media-preview .thumb { width: 100%; height: 160px; } .wr-head { gap: 8px; } }
