/* App-Poster styles, following the Web App Design Playbook: semantic tokens
   in light and dark, Barlow, quiet surfaces and a lime accent. Bootstrap's
   variables are mapped onto the tokens so existing markup inherits them. */

@font-face { font-family: Barlow; src: url("/static/fonts/Barlow-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Barlow; src: url("/static/fonts/Barlow-SemiBold.ttf") format("truetype"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: Barlow; src: url("/static/fonts/Barlow-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

/* ---- Tokens -------------------------------------------------------------- */
:root, [data-bs-theme="light"] {
  --shell: #f6f6f8;
  --frame: #e9e9ef;
  --surface: #ffffff;
  --surface-2: #f1f1f5;
  --line: #e3e3ea;
  --text: #1d1d27;
  --muted: #6b6b7d;
  --accent: #3f6212;
  --accent-bg: #eef8d8;
  --accent-line: #cfe6a8;
  --btn-bg: #b4f932;
  --btn-hover: #a3e635;
  --btn-text: #14170d;
  --focus: #3f6212;
  --ok: #3f7d14; --ok-bg: #eef8d8; --ok-line: #cfe6a8;
  --warn: #8a4f00; --warn-bg: #fff6e6; --warn-line: #f1d6a6;
  --bad: #c22f25; --bad-bg: #fff0ee; --bad-line: #f4c4bf;
  --info: #1f5fa8; --info-bg: #edf4fd; --info-line: #c5daf3;
  --code-bg: #fbfbfd;
  --shadow: 0 6px 24px rgb(20 20 40 / 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --gutter: 6px;

  --bs-body-font-family: Barlow, "Segoe UI", Inter, Arial, sans-serif;
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.45;
  --bs-body-bg: var(--shell);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--muted);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--line);
  --bs-border-color-translucent: var(--line);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 63, 98, 18;
  --bs-link-hover-color: var(--text);
  --bs-link-hover-color-rgb: 29, 29, 39;
  --bs-primary: #3f6212;
  --bs-primary-rgb: 63, 98, 18;
  --bs-code-color: var(--text);
  --bs-focus-ring-color: rgb(63 98 18 / 0.35);
  color-scheme: light;
}
[data-bs-theme="dark"] {
  --shell: #0d0d0e;
  --frame: #050506;
  --surface: #18181a;
  --surface-2: #202022;
  --line: #303033;
  --text: #f1f1f1;
  --muted: #a0a0a5;
  --accent: #b4f932;
  --accent-bg: #242c1a;
  --accent-line: #3e5320;
  --btn-bg: #b4f932;
  --btn-hover: #c6ff5a;
  --btn-text: #111111;
  --focus: #b4f932;
  --ok: #b4f932; --ok-bg: #1f2716; --ok-line: #3e5320;
  --warn: #e6a23c; --warn-bg: #2a2112; --warn-line: #5a4316;
  --bad: #ff7a6e; --bad-bg: #2b1513; --bad-line: #5c2622;
  --info: #8fbaf0; --info-bg: #142033; --info-line: #2a4466;
  --code-bg: #121214;
  --shadow: none;

  --bs-body-bg: var(--shell);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--muted);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--line);
  --bs-border-color-translucent: var(--line);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 180, 249, 50;
  --bs-link-hover-color: var(--text);
  --bs-link-hover-color-rgb: 241, 241, 241;
  --bs-primary: #b4f932;
  --bs-primary-rgb: 180, 249, 50;
  --bs-code-color: var(--text);
  --bs-focus-ring-color: rgb(180 249 50 / 0.35);
  color-scheme: dark;
}

/* ---- Base ---------------------------------------------------------------- */
body { font-family: var(--bs-body-font-family); background: var(--shell); color: var(--text); font-synthesis: none; }
h1, h2, h3, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.text-body-secondary { color: var(--muted) !important; }
a { text-underline-offset: 2px; }
code { color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; font-size: .85em; overflow-wrap: anywhere; }
pre code { border: 0; padding: 0; background: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible, .form-check-input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: none; }
/* Lucide icons from the sprite: the stroke style must be set here because a
   sprite's root attributes do not apply through <use>. */
.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.2em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 1.5rem; height: 1.5rem; }
.visually-hidden-focusable:focus { position: fixed !important; top: 8px; left: 8px; z-index: 2000; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); }
::selection { background: var(--btn-bg); color: var(--btn-text); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ---- Buttons ------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font-weight: 700; border-radius: var(--radius-sm);
  --bs-btn-padding-y: .5rem; --bs-btn-padding-x: 1rem; }
.btn-sm { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .7rem; --bs-btn-font-size: .875rem; }
.btn-primary {
  --bs-btn-bg: var(--btn-bg); --bs-btn-border-color: var(--btn-bg); --bs-btn-color: var(--btn-text);
  --bs-btn-hover-bg: var(--btn-hover); --bs-btn-hover-border-color: var(--btn-hover); --bs-btn-hover-color: var(--btn-text);
  --bs-btn-active-bg: var(--btn-hover); --bs-btn-active-border-color: var(--btn-hover); --bs-btn-active-color: var(--btn-text);
  --bs-btn-disabled-bg: var(--btn-bg); --bs-btn-disabled-border-color: var(--btn-bg); --bs-btn-disabled-color: var(--btn-text);
}
.btn-outline-primary, .btn-outline-secondary, .btn-secondary, .btn-light {
  --bs-btn-bg: var(--surface-2); --bs-btn-border-color: var(--line); --bs-btn-color: var(--text);
  --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--muted); --bs-btn-hover-color: var(--text);
  --bs-btn-active-bg: var(--frame); --bs-btn-active-border-color: var(--muted); --bs-btn-active-color: var(--text);
  --bs-btn-disabled-bg: var(--surface-2); --bs-btn-disabled-border-color: var(--line); --bs-btn-disabled-color: var(--muted);
}
.btn-outline-danger, .btn-danger {
  --bs-btn-bg: var(--surface-2); --bs-btn-border-color: var(--bad-line); --bs-btn-color: var(--bad);
  --bs-btn-hover-bg: var(--bad-bg); --bs-btn-hover-border-color: var(--bad); --bs-btn-hover-color: var(--bad);
  --bs-btn-active-bg: var(--bad-bg); --bs-btn-active-border-color: var(--bad); --bs-btn-active-color: var(--bad);
}
.btn-warning {
  --bs-btn-bg: var(--warn-bg); --bs-btn-border-color: var(--warn-line); --bs-btn-color: var(--warn);
  --bs-btn-hover-bg: var(--warn-bg); --bs-btn-hover-border-color: var(--warn); --bs-btn-hover-color: var(--warn);
}
.btn-link { --bs-btn-color: var(--accent); --bs-btn-hover-color: var(--text); font-weight: 600; }
.btn-icon { --bs-btn-padding-x: .45rem; --bs-btn-padding-y: .45rem; background: transparent; border: 1px solid transparent; color: var(--muted); }
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn.is-busy, .htmx-request.btn { pointer-events: none; opacity: .75; }
.btn.is-busy::after { content: ""; width: .9em; height: .9em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Forms --------------------------------------------------------------- */
.form-control, .form-select { background-color: var(--surface-2); border-color: var(--line); color: var(--text); border-radius: var(--radius-sm); }
.form-control:focus, .form-select:focus { background-color: var(--surface-2); color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }
.form-control::placeholder { color: var(--muted); opacity: .8; }
.form-control[readonly] { background-color: var(--code-bg); }
.form-label { font-weight: 600; font-size: .9rem; }
.form-text { color: var(--muted); }
.form-check-input { background-color: var(--surface-2); border-color: var(--muted); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
[data-bs-theme="dark"] .form-check-input:checked { --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23111' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e"); }
.form-switch .form-check-input:checked { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e"); }
.input-group-text { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.required::after { content: " *"; color: var(--bad); }

/* ---- Surfaces ------------------------------------------------------------ */
.card { --bs-card-bg: var(--surface); --bs-card-border-color: var(--line); --bs-card-border-radius: var(--radius); --bs-card-cap-bg: var(--surface-2); }
.shadow-sm { box-shadow: var(--shadow) !important; }
.panel-body .card { --bs-card-bg: var(--surface-2); box-shadow: none !important; border-color: transparent; }
.panel-body .card .card { --bs-card-bg: var(--surface); border-color: var(--line); }
.panel-body .card .form-control, .panel-body .card .form-select { background-color: var(--surface); }
.list-group { --bs-list-group-bg: transparent; --bs-list-group-border-color: var(--line); --bs-list-group-color: var(--text); }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--line); --bs-table-hover-bg: var(--surface); --bs-table-hover-color: var(--text); }
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--line); --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--surface-2);
  --bs-dropdown-link-hover-color: var(--text); --bs-dropdown-link-active-bg: var(--accent-bg); --bs-dropdown-link-active-color: var(--text); --bs-dropdown-border-radius: var(--radius-sm);
  --bs-dropdown-header-color: var(--muted); box-shadow: 0 10px 30px rgb(0 0 0 / 0.14); z-index: 1060; }
.dropdown-item { display: flex; align-items: center; gap: .55rem; border-radius: 6px; }
.dropdown-menu { padding: .35rem; }
.offcanvas { --bs-offcanvas-bg: var(--surface); --bs-offcanvas-color: var(--text); }
.breadcrumb { --bs-breadcrumb-divider-color: var(--muted); --bs-breadcrumb-item-active-color: var(--muted); font-size: .85rem; margin-bottom: .75rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }

/* ---- Alerts -------------------------------------------------------------- */
.alert { border-radius: var(--radius-sm); display: flex; gap: .6rem; align-items: flex-start; }
.alert > .icon { margin-top: .15rem; }
.alert > .alert-body { flex: 1; min-width: 0; }
.alert-success { --bs-alert-bg: var(--ok-bg); --bs-alert-border-color: var(--ok-line); --bs-alert-color: var(--text); --bs-alert-link-color: var(--text); }
.alert-success > .icon { color: var(--ok); }
.alert-warning { --bs-alert-bg: var(--warn-bg); --bs-alert-border-color: var(--warn-line); --bs-alert-color: var(--text); --bs-alert-link-color: var(--text); }
.alert-warning > .icon { color: var(--warn); }
.alert-danger { --bs-alert-bg: var(--bad-bg); --bs-alert-border-color: var(--bad-line); --bs-alert-color: var(--text); --bs-alert-link-color: var(--text); }
.alert-danger > .icon { color: var(--bad); }
.alert-info { --bs-alert-bg: var(--info-bg); --bs-alert-border-color: var(--info-line); --bs-alert-color: var(--text); --bs-alert-link-color: var(--text); }
.alert-info > .icon { color: var(--info); }
.alert .btn-close { margin-left: auto; }
.text-warning-emphasis { color: var(--warn) !important; }
.text-danger-emphasis, .text-danger { color: var(--bad) !important; }
.text-success-emphasis, .text-success { color: var(--ok) !important; }
.text-info-emphasis { color: var(--info) !important; }
.border-danger-subtle { border-color: var(--bad-line) !important; }
.border-warning-subtle { border-color: var(--warn-line) !important; }
.border-success-subtle { border-color: var(--ok-line) !important; }
.border-primary-subtle { border-color: var(--accent-line) !important; }

/* ---- Status chips (color + dot + text, never color alone) ---------------- */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); white-space: nowrap; line-height: 1.4; }
.chip::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.chip-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.chip-bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.chip-info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.chip-muted { color: var(--muted); }
[data-bs-theme="light"] .chip-ok { color: #2f5c0f; }

/* ---- Site shell (public pages, sign-in) ---------------------------------- */
.site-header { position: sticky; top: 0; z-index: 1030; background: color-mix(in srgb, var(--shell) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .inner { max-width: 1160px; margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; gap: .75rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--btn-bg); display: inline-grid; place-items: center; color: var(--btn-text); flex-shrink: 0; }
.brand-mark .icon { width: 16px; height: 16px; }
.site-main { max-width: 1160px; margin: 0 auto; padding: 1.5rem 1rem 3rem; width: 100%; flex: 1; }
.site-footer { border-top: 2px solid var(--btn-bg); background: var(--surface); margin-top: auto; }
.site-footer .inner { max-width: 1160px; margin: 0 auto; padding: 2rem 1rem 1.25rem; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 1.5rem; }
.footer-grid h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .6rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: .35rem; }
.footer-grid a { color: var(--text); text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; color: var(--muted); font-size: .875rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }
body.site { display: flex; flex-direction: column; min-height: 100vh; }

.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center; padding: 2.5rem 0 2rem; }
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.6rem); letter-spacing: -0.035em; line-height: 1.04; margin-bottom: 1rem; }
.hero .lead { color: var(--muted); font-size: 1.2rem; max-width: 34rem; }
.rolling { display: inline-block; color: var(--accent); transition: filter .3s, opacity .3s, transform .3s, width .3s; white-space: nowrap; }
.rolling.out { filter: blur(6px); opacity: 0; transform: translateY(-0.35em); }
.rolling.in { filter: blur(6px); opacity: 0; transform: translateY(0.35em); }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 1.25rem; box-shadow: var(--shadow); }
.flow { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.flow li { display: flex; gap: .75rem; align-items: center; background: var(--surface-2); border-radius: var(--radius-sm); padding: .75rem .85rem; }
.flow-icon { width: 2.25rem; height: 2.25rem; border-radius: 10px; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.feature .flow-icon { margin-bottom: .75rem; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1rem; } .feature-grid { grid-template-columns: 1fr; } }
.auth-wrap { display: grid; place-items: center; padding: 2rem 0; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 2rem; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 620px; }
.legal { max-width: 70ch; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; }
.legal h2 { margin-top: 1.75rem; }
@media (max-width: 760px) { .legal, .auth-card { padding: 1.25rem; } }

/* ---- Workspace shell ----------------------------------------------------- */
body.workspace { background: var(--frame); }
.ws { --nav-w: 232px; --aside-w: 40%; display: flex; height: 100vh; height: 100dvh; padding: var(--gutter); gap: 0; }
.panel { background: var(--surface); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ws-nav { width: var(--nav-w); flex-shrink: 0; }
.ws-main { flex: 1 1 auto; min-width: 360px; }
.ws-aside { width: var(--aside-w); flex-shrink: 0; min-width: 280px; }
.panel-head { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem .7rem 1rem; min-height: 56px; border-bottom: 1px solid transparent; flex-shrink: 0; }
.panel-head h1, .panel-head h2 { font-size: 1.2rem; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-head .head-icon { color: var(--accent); }
.panel-head .spacer { flex: 1; }
.panel-body { flex: 1; overflow-y: auto; padding: .5rem 1rem 1.25rem; min-height: 0; overscroll-behavior: contain; }
.panel-body.scrolled-head { border-top: 1px solid var(--line); }
.ws-sep { flex: 0 0 var(--gutter); cursor: col-resize; position: relative; touch-action: none; border-radius: 4px; }
.ws-sep::after { content: ""; position: absolute; top: 50%; left: 50%; width: 4px; height: 36px; transform: translate(-50%, -50%); border-radius: 4px; background: transparent; transition: background .15s; }
.ws-sep:hover::after, .ws-sep:focus-visible::after, .ws-sep.dragging::after { background: var(--btn-bg); }
.ws-sep:focus-visible { outline-offset: -1px; }
.ws.resizing, .ws.resizing * { cursor: col-resize !important; user-select: none; }

/* Sidebar */
.nav-head { display: flex; align-items: center; gap: .5rem; padding: .8rem .75rem .6rem; }
.nav-head .brand { font-size: 1.05rem; min-width: 0; }
.nav-head .brand span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-head .collapse-btn { margin-left: auto; }
.logo-btn { position: relative; padding: 0; border: 0; background: none; border-radius: 8px; }
.logo-btn .expand-icon { display: none; }
.nav-list { list-style: none; padding: .25rem .6rem; margin: 0; flex: 1; overflow-y: auto; }
.nav-list a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-weight: 600; margin-bottom: 2px; white-space: nowrap; }
.nav-list a .icon { color: var(--muted); }
.nav-list a:hover { background: var(--surface-2); }
.nav-list a[aria-current="page"] { background: var(--accent-bg); color: var(--text); }
.nav-list a[aria-current="page"] .icon { color: var(--accent); }
.nav-list .nav-sep { height: 1px; background: var(--line); margin: .5rem .7rem; }
.nav-foot { display: flex; align-items: center; gap: .25rem; padding: .6rem .75rem; border-top: 1px solid var(--line); }
.nav-foot-right { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav-foot-right > span { display: contents; }
.ws.nav-collapsed { --nav-w: 60px; }
.ws.nav-collapsed .nav-head { justify-content: center; padding-inline: 0; }
.ws.nav-collapsed .nav-head .brand .name, .ws.nav-collapsed .nav-head .collapse-btn, .ws.nav-collapsed .nav-list .label { display: none; }
.ws.nav-collapsed .nav-list { padding-inline: .45rem; }
.ws.nav-collapsed .nav-list a { justify-content: center; padding-inline: 0; }
.ws.nav-collapsed .nav-foot { flex-direction: column; padding-inline: 0; }
.ws.nav-collapsed .nav-foot-right { flex-direction: column; margin-left: 0; }
.ws.nav-collapsed .logo-btn:hover .brand-mark, .ws.nav-collapsed .logo-btn:focus-visible .brand-mark { display: none; }
.ws.nav-collapsed .logo-btn:hover .expand-icon, .ws.nav-collapsed .logo-btn:focus-visible .expand-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; color: var(--text); }
.ws.nav-collapsed #sep-nav { pointer-events: none; }
.ws:not(.nav-collapsed) .logo-btn { pointer-events: none; }
.ws:not(.nav-collapsed) .logo-btn .brand-mark { display: inline-grid; }

/* Right panel collapsed into a rail */
.ws.aside-collapsed .ws-aside { width: 52px; min-width: 52px; }
.ws.aside-collapsed .ws-aside .panel-body, .ws.aside-collapsed .ws-aside .panel-head h2, .ws.aside-collapsed #sep-aside { display: none; }
.ws.aside-collapsed .ws-aside .panel-head { justify-content: center; padding-inline: 0; }
.ws.aside-collapsed .aside-collapse .when-open, .ws:not(.aside-collapsed) .aside-collapse .when-closed { display: none; }

/* Mobile bottom navigation */
.ws-bottom { display: none; }
@media (max-width: 1000px) {
  .ws { height: auto; min-height: 100vh; flex-wrap: wrap; align-content: flex-start; }
  .ws-main { min-width: 0; flex: 1 1 calc(100% - var(--nav-w) - var(--gutter)); }
  .ws-main .panel-body, .ws-aside .panel-body { overflow: visible; }
  .ws-nav { position: sticky; top: var(--gutter); height: calc(100vh - 2 * var(--gutter)); }
  .ws-aside { width: 100% !important; min-width: 0 !important; margin-top: var(--gutter); margin-left: calc(var(--nav-w) + var(--gutter)); flex-basis: calc(100% - var(--nav-w) - var(--gutter)); }
  #sep-aside { display: none; }
  .ws.aside-collapsed .ws-aside .panel-body { display: block; }
  .ws.aside-collapsed .ws-aside .panel-head h2 { display: block; }
  .aside-collapse, .aside-reopen { display: none !important; }
}
@media (max-width: 760px) {
  .ws { padding: 0; display: block; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .ws-nav, .ws-sep { display: none !important; }
  .ws-main, .ws-aside { border-radius: 0; margin: 0 !important; width: 100% !important; }
  .ws-aside { border-top: 6px solid var(--frame); }
  .ws-bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; background: var(--surface); border-top: 1px solid var(--line);
    padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); justify-content: space-around; }
  .ws-bottom a, .ws-bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .4rem .2rem; min-height: 52px;
    font-size: .72rem; font-weight: 600; color: var(--muted); text-decoration: none; background: none; border: 0; border-radius: var(--radius-sm); }
  .ws-bottom a[aria-current="page"] { color: var(--text); background: var(--accent-bg); }
  .ws-bottom .icon { width: 1.35rem; height: 1.35rem; }
  .btn, .form-control, .form-select { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .panel-head { position: sticky; top: 0; z-index: 5; background: var(--surface); }
}
.offcanvas .nav-list a { padding: .75rem .8rem; }

/* ---- Workspace components ------------------------------------------------ */
.page-intro { color: var(--muted); max-width: 70ch; }
.section-title { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 .6rem; display: flex; align-items: center; gap: .5rem; }
.section-title:first-child { margin-top: .25rem; }
.empty { text-align: center; padding: 2rem 1rem; background: var(--surface-2); border-radius: var(--radius); color: var(--muted); }
.empty .empty-icon { width: 3rem; height: 3rem; border-radius: 14px; background: var(--surface); color: var(--accent); display: inline-grid; place-items: center; margin-bottom: .75rem; }
.empty .empty-icon .icon { width: 1.5rem; height: 1.5rem; }
.empty p { max-width: 46ch; margin: 0 auto .9rem; }
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.channel-card { background: var(--surface-2); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.channel-card .top { display: flex; align-items: flex-start; gap: .6rem; }
.platform-icon { width: 2.25rem; height: 2.25rem; border-radius: 10px; background: var(--surface); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; color: var(--accent); }
.channel-card .name { font-weight: 700; overflow-wrap: anywhere; }
.channel-card .meta { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.channel-card .actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; }
.post-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.post-list li { background: var(--surface-2); border-radius: var(--radius-sm); padding: .75rem .9rem; }
.post-list a.title { color: var(--text); text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
.post-list a.title:hover { text-decoration: underline; }
.kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: .35rem .75rem; font-size: .9rem; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.aside-section { margin-bottom: 1.25rem; }
.aside-section h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .5rem; }
.progress-steps { list-style: none; padding: 0; margin: 0; }
.progress-steps li { display: flex; gap: .6rem; align-items: center; padding: .45rem 0; }
.progress-steps .dot { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: var(--muted); font-size: .75rem; font-weight: 700; flex-shrink: 0; }
.progress-steps li.done .dot { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.progress-steps li.active .dot { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-text); }
.progress-steps li.active { font-weight: 700; }
.preview-box { background: var(--surface-2); border-radius: var(--radius-sm); padding: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 4rem; }
.counter-list { list-style: none; padding: 0; margin: 0; }
.counter-list li { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.counter-list li.over { color: var(--bad); font-weight: 700; }

/* ---- Existing components ------------------------------------------------- */
.steps { display: flex; gap: .5rem; padding: 0; margin: 0; list-style: none; counter-reset: step; flex-wrap: wrap; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .9rem; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1px solid var(--line); font-size: .8rem; }
.steps li.active { color: var(--text); font-weight: 700; }
.steps li.active::before { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-text); }
.steps li.done::before { content: "✓"; background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.step-num { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--btn-bg); color: var(--btn-text); font-size: .9rem; margin-right: .35rem; font-weight: 700; }
.post-preview { white-space: pre-wrap; overflow-wrap: anywhere; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: .6rem; border: 1px solid var(--line); }
pre.code { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem; font-size: .8rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.test-row td { border-bottom-width: 0; }
.test-row div:empty { display: none; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
.spinner-border { color: var(--muted); }
.copy-group input { min-width: 0; }
.checklist { list-style: none; padding-left: 0; }
.checklist > li { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .6rem; }
.checklist > li > .form-check-input { flex-shrink: 0; margin-top: .2rem; }
.checklist > li > div { min-width: 0; flex: 1; }
.readiness-list { list-style: none; padding-left: 0; margin-bottom: 0; }
.readiness-list > li { display: flex; gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.readiness-list > li:first-child { border-top: 0; }
.ready-icon { flex-shrink: 0; display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; margin-top: .05rem; }
.ready-icon .icon { width: .95rem; height: .95rem; }
.ready-ok { background: var(--ok-bg); color: var(--ok); }
.ready-warn { background: var(--warn-bg); color: var(--warn); }
.ready-fail { background: var(--bad-bg); color: var(--bad); }
.ready-todo { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
.opacity-50 { opacity: .55 !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Theme toggle shows the theme it switches to. */
[data-bs-theme="light"] .theme-light-icon, [data-bs-theme="dark"] .theme-dark-icon { display: none; }
/* Secondary buttons on tinted cards use the panel surface so they stand out. */
.channel-card .btn-outline-secondary, .post-list .btn-outline-secondary, .empty .btn-outline-secondary, .panel-body .card .btn-outline-secondary { --bs-btn-bg: var(--surface); --bs-btn-hover-bg: var(--surface); }

/* Tooltip for the collapsed menu and icon-only buttons (title + description). */
.nav-tip { position: fixed; z-index: 1080; max-width: 250px; padding: .55rem .75rem; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
  pointer-events: none; opacity: 0; transform: translate(-4px, -50%); transition: opacity .12s, transform .12s; }
.nav-tip.show { opacity: 1; transform: translate(0, -50%); }
.nav-tip::before { content: ""; position: absolute; left: -6px; top: 50%; width: 10px; height: 10px; background: inherit;
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: translateY(-50%) rotate(45deg); }
.nav-tip .tip-title { font-weight: 700; font-size: .9rem; }
.nav-tip .tip-desc { color: var(--muted); font-size: .82rem; margin-top: .1rem; }
[data-bs-theme="dark"] .nav-tip { background: #1d1d20; }
