/* =========================================================================
   VMindmap design system
   Signature motif: branch lines (curved connectors) — used in the hero demo,
   empty states and the editor. Everything else stays quiet and disciplined.
   Colors marked --primary/--secondary/--accent/--radius/--font are overridden
   by /branding.css (Admin → Branding).
   ========================================================================= */
:root {
  --primary: #4F46E5; --secondary: #0EA5E9; --accent: #F59E0B; --radius: 10px;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'PingFang SC', 'Hiragino Sans', 'Malgun Gothic', sans-serif;
  --display: 'Bricolage Grotesque', var(--font);
  --ink: #1B2238; --ink-2: #4A5372; --ink-3: #5E6782; --line: #E3E7F0; --line-2: #EEF1F7;
  --paper: #FBFCFE; --surface: #FFFFFF; --surface-2: #F4F6FB; --surface-3: #EBEEF6;
  --ok: #15803D; --warn: #B45309; --bad: #DC2626; --info: #2563EB; --mix-text: #1B2238;
  --shadow-1: 0 1px 2px rgba(27,34,56,.06), 0 1px 1px rgba(27,34,56,.04);
  --shadow-2: 0 8px 24px -8px rgba(27,34,56,.18), 0 2px 6px rgba(27,34,56,.06);
  --shadow-3: 0 24px 60px -20px rgba(27,34,56,.35);
  --r-s: calc(var(--radius) * .6); --r-m: var(--radius); --r-l: calc(var(--radius) * 1.6);
  --sidebar: 248px; --topbar: 56px;
  --st-not_started: #94A3B8; --st-planned: #6366F1; --st-in_progress: #0EA5E9; --st-on_hold: #F59E0B;
  --st-under_review: #A855F7; --st-completed: #16A34A; --st-cancelled: #64748B;
  --pr-critical: #DC2626; --pr-high: #EA580C; --pr-medium: #CA8A04; --pr-low: #64748B;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #E6E9F2; --mix-text: #FFFFFF; --ok: #22C55E; --warn: #F59E0B; --bad: #F87171; --ink-2: #B4BBD0; --ink-3: #949DB6; --line: #2A3148; --line-2: #222839;
  --paper: #121624; --surface: #181D2E; --surface-2: #1E2437; --surface-3: #262D44;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 10px 30px -10px rgba(0,0,0,.7); --shadow-3: 0 30px 70px -20px rgba(0,0,0,.8);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --ink: #E6E9F2; --mix-text: #FFFFFF; --ok: #22C55E; --warn: #F59E0B; --bad: #F87171; --ink-2: #B4BBD0; --ink-3: #949DB6; --line: #2A3148; --line-2: #222839;
    --paper: #121624; --surface: #181D2E; --surface-2: #1E2437; --surface-3: #262D44;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 10px 30px -10px rgba(0,0,0,.7); --shadow-3: 0 30px 70px -20px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; font-weight: 650; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; } h4 { font-size: .95rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .82rem; }
.muted { color: var(--ink-3); }
.hidden, [hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- controls */
.btn { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: .45em; height: 36px; padding: 0 14px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 .9rem var(--font); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: .83rem; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 1rem; border-radius: var(--r-m); }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn svg, .ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.sm svg { width: 16px; height: 16px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-s) 0 0 var(--r-s); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-s) var(--r-s) 0; }
.btn-group .btn.active { background: var(--surface-3); font-weight: 600; }

label { display: block; font-size: .84rem; font-weight: 550; margin: 0 0 6px; color: var(--ink-2); }
.input, input:not([type]), input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], input[type=color], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--ink);
  font: .92rem var(--font); transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
input[type=color] { padding: 3px; width: 48px; }
input:focus, select:focus, textarea:focus, .input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; vertical-align: -3px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 450; color: var(--ink); cursor: pointer; margin: 6px 0; }
.check input { margin-top: 3px; }
.field { margin-bottom: 16px; }
.field .hint { font-size: .78rem; color: var(--ink-3); margin-top: 5px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.spacer { flex: 1; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: .74rem; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge.ok { color: color-mix(in srgb, var(--ok) 75%, var(--mix-text)); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.badge.bad { color: color-mix(in srgb, var(--bad) 75%, var(--mix-text)); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: .76rem; font-weight: 600; white-space: nowrap;
  color: color-mix(in srgb, var(--sc, var(--ink-2)) 60%, var(--mix-text)); background: color-mix(in srgb, var(--sc, #94A3B8) 13%, transparent); }
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--sc); }
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; color: color-mix(in srgb, var(--pc) 62%, var(--mix-text)); }
.prio svg { width: 14px; height: 14px; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: .72rem; font-weight: 700; flex: none; background: color-mix(in srgb, var(--ac, #6366F1) 70%, #000); border: 2px solid var(--surface); }
.avatar.sm { width: 22px; height: 22px; font-size: .62rem; border-width: 1.5px; }
.avatar.lg { width: 40px; height: 40px; font-size: .9rem; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s; }
.progress.ok > i { background: var(--ok); }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 5px; font-size: .72rem; font-weight: 550; background: color-mix(in srgb, var(--secondary) 13%, transparent); color: color-mix(in srgb, var(--secondary) 75%, var(--ink)); }
.kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; font: .75rem ui-monospace, Menlo, monospace; color: var(--ink-2); background: var(--surface); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px; }
.card.flush { padding: 0; }
.card h3 { margin-bottom: .7em; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty svg.branch { width: 120px; height: 70px; margin-bottom: 10px; stroke: var(--line); fill: none; stroke-width: 2; }
.empty h3 { color: var(--ink); }

table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: .78rem; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.table-wrap { overflow: auto; }

/* ---------------------------------------------------------------- app shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; font: 700 1.12rem var(--display); color: var(--ink); text-decoration: none !important; }
.brand img { height: 30px; width: auto; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.nav-link { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: var(--r-s); color: var(--ink-2); font-weight: 500; font-size: .92rem; text-decoration: none !important; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); font-weight: 600; }
.nav-link .count { margin-left: auto; font-size: .72rem; background: var(--bad); color: #fff; border-radius: 9px; padding: 0 6px; line-height: 18px; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.nav-section { font-size: .74rem; color: var(--ink-3); padding: 8px 10px 4px; font-weight: 600; }
.sidebar .bottom { margin-top: auto; padding-top: 10px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar); display: flex; align-items: center; gap: 10px; padding: 0 22px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 1.12rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 24px 22px 60px; max-width: 1400px; width: 100%; }
.menu-toggle { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 280px; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow-3); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 25; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 18px 14px 80px; }
  .topbar { padding: 0 12px; }
}
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { margin: 0; font-size: 1.45rem; }
.page-head .lead { color: var(--ink-3); margin: 4px 0 0; }

/* dropdown / popover */
.dropdown { position: relative; display: inline-block; }
.menu { position: absolute; z-index: 200; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-2); padding: 5px; }
.menu.right { right: 0; }
.menu button, .menu a { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; color: var(--ink); font: .88rem var(--font); text-align: left; cursor: pointer; text-decoration: none !important; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu .sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu .label { font-size: .74rem; color: var(--ink-3); padding: 6px 10px 2px; font-weight: 600; }
.menu .danger { color: var(--bad); }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,20,35,.45); z-index: 1000; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-3); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .18s; }
.modal.wide { width: min(980px, 100%); }
.modal.xwide { width: min(1180px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; flex: 1; font-size: 1.1rem; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (max-width: 640px) { .modal-backdrop { place-items: end center; padding: 0; } .modal { border-radius: var(--r-l) var(--r-l) 0 0; max-height: 92vh; } }

/* toasts */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r-m); box-shadow: var(--shadow-2); font-size: .9rem; pointer-events: auto; max-width: 92vw; animation: pop .2s; display: flex; gap: 12px; align-items: center; }
.toast.error { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; color: var(--ink-3); font: 500 .9rem var(--font); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 7px; align-items: center; min-height: 42px; }
.tabs .active { color: var(--ink); border-bottom-color: var(--primary); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface); font: 500 .83rem var(--font); color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important; }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .n { font-size: .72rem; opacity: .7; }

.alert { padding: 11px 14px; border-radius: var(--r-s); font-size: .9rem; margin-bottom: 14px; border: 1px solid; }
.alert.error { background: color-mix(in srgb, var(--bad) 8%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }
.alert.ok { background: color-mix(in srgb, var(--ok) 8%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.alert.info { background: color-mix(in srgb, var(--info) 7%, transparent); border-color: color-mix(in srgb, var(--info) 25%, transparent); color: var(--info); }
.alert.warn { background: color-mix(in srgb, var(--warn) 9%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: color-mix(in srgb, var(--warn) 80%, var(--mix-text)); }
.alert a:not(.btn) { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---------------------------------------------------------------- dashboard / lists */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.map-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; display: flex; flex-direction: column; transition: border-color .12s, box-shadow .12s; }
.map-card:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); box-shadow: var(--shadow-2); }
.map-card .thumb { height: 120px; background: var(--surface-2); display: grid; place-items: center; border-bottom: 1px solid var(--line-2); }
.map-card .thumb svg { width: 86%; height: 90%; }
.map-card .body { padding: 11px 13px; display: flex; flex-direction: column; gap: 3px; }
.map-card .title { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; }
.map-card .title::after { content: ''; position: absolute; inset: 0; }
.map-card .meta { font-size: .78rem; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.map-card .actions { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 4px; }
.map-card .fav { color: var(--accent); }
.map-card .new { display: grid; place-items: center; height: 100%; min-height: 170px; color: var(--ink-3); font-weight: 600; border: 1.5px dashed var(--line); background: transparent; border-radius: var(--r-m); cursor: pointer; font-family: var(--font); gap: 6px; }
.map-card .new:hover { color: var(--primary); border-color: var(--primary); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 16px; }
.stat .v { font: 650 1.7rem/1.1 var(--display); }
.stat .l { font-size: .8rem; color: var(--ink-3); margin-top: 4px; }
.stat.bad .v { color: var(--bad); }
.stat.ok .v { color: var(--ok); }

.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.task-row:last-child { border-bottom: 0; }
.task-row .name { flex: 1; min-width: 0; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none !important; }
.task-row .code { font: 600 .76rem ui-monospace, Menlo, monospace; color: var(--ink-3); }
.task-row .due { font-size: .8rem; color: var(--ink-3); white-space: nowrap; }
.task-row .due.over { color: var(--bad); font-weight: 600; }

/* ---------------------------------------------------------------- auth */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
:root[data-theme="dark"] .auth-art { background: #0c0f1a; }
.auth-art svg.branches { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.auth-art h2 { font-size: 2.2rem; max-width: 12em; position: relative; color: #fff; }
.auth-art p { position: relative; color: #B4BBD0; max-width: 30em; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { font-size: 1.6rem; }
.auth-card .brand { padding-left: 0; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: .8rem; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.social-btns { display: grid; gap: 8px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* lang switcher */
.lang-menu { max-height: 340px; overflow: auto; }

/* ---------------------------------------------------------------- editor */
body.editor-body { overflow: hidden; height: 100vh; height: 100dvh; overscroll-behavior: none; }
.ed { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--paper); }
.ed-top { height: 54px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--surface); z-index: 40; flex: none; }
.ed-title { font: 650 1rem var(--display); border: 1px solid transparent; background: none; color: var(--ink); padding: 4px 8px; border-radius: 6px; max-width: 32vw; min-width: 80px; height: 34px; flex: 0 1 280px; text-overflow: ellipsis; }
@media (min-width: 761px) { .ed-top .ed-title { min-width: 150px; } }
/* labelled toolbar buttons give way (ellipsis, then icon only) before anything is pushed off screen */
.ed-top .btn.sm:not(.icon) { flex-shrink: 1; min-width: 36px; overflow: hidden; white-space: nowrap; }
.ed-top .btn.sm:not(.icon) > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ed-top .btn.sm > svg { flex: none; }
.ed-top .ed-save { flex-shrink: 1; min-width: 0; overflow: hidden; }
@media (max-width: 1500px) { .ed-top .ed-save { font-size: 0; gap: 0; } }
@media (max-width: 1440px) { .ed-font span { display: none; } }
@media (max-width: 1100px) { .ed-top > .btn.sm:not(.primary) > span, .ed-cat span { display: none; } }
.ed-top .ed-title { border-color: transparent; background: none; box-shadow: none; }
.ed-top .ed-title:not([readonly]):hover { border-color: var(--line); }
.ed-top .ed-title:not([readonly]):focus { border-color: var(--primary); outline: none; background: var(--surface); }
.ed-top .ed-title[readonly]:focus-visible { outline: 2px solid var(--primary); }
.ed-save { font-size: .76rem; color: var(--ink-3); white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.ed-save .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.ed-save.pending .dot { background: var(--warn); }
.ed-save.offline .dot { background: var(--bad); }
.ed-body { flex: 1; position: relative; display: flex; min-height: 0; }
.canvas { position: relative; flex: 1; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
  background-color: var(--paper); background-image: radial-gradient(circle, color-mix(in srgb, var(--ink-3) 22%, transparent) 1px, transparent 1.2px); background-size: 24px 24px; }
.canvas.panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; font-family: var(--map-font, inherit); }
.world.animate { transition: transform .45s cubic-bezier(.3,.7,.2,1); }
.links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.links path { fill: none; stroke-linecap: round; }
.nodes { position: absolute; left: 0; top: 0; }
.mnode { position: absolute; left: 0; top: 0; width: max-content; max-width: 300px; min-width: 40px; padding: 7px 12px; border-radius: 9px; background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--nc, var(--line)); font-size: 14px; line-height: 1.35; cursor: pointer; box-shadow: var(--shadow-1); white-space: normal; overflow-wrap: anywhere; transition: box-shadow .12s; touch-action: none; }
.mnode .txt { display: block; min-height: 1.35em; outline: none; }
.mnode .txt:empty::before { content: '\200b'; }
.mnode.root { font: 650 18px var(--map-font, var(--display)); padding: 12px 20px; background: var(--ink); color: var(--paper); border-color: var(--ink); border-radius: 14px; }
.mnode.l1 { font-weight: 600; font-size: 15px; padding: 9px 14px; }
.mnode.sel { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent), var(--shadow-1); border-color: var(--primary); }
.mnode.focus-dim { opacity: .18; }
.mnode.drop-target { box-shadow: 0 0 0 3px var(--accent); }
.mnode.editing { cursor: text; user-select: text; -webkit-user-select: text; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 45%, transparent); }
.mnode.remote-edit { outline: 2px dashed var(--ra, var(--secondary)); outline-offset: 3px; }
.mnode.shape-rect { border-radius: 2px; }
.mnode.shape-pill { border-radius: 999px; padding-left: 16px; padding-right: 16px; }
.mnode.shape-ellipse { border-radius: 50%; padding: 12px 22px; text-align: center; }
.mnode.shape-diamond { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); padding: 22px 34px; text-align: center; border: 0; background: color-mix(in srgb, var(--nc, var(--primary)) 16%, var(--surface)); }
.mnode.shape-hexagon { clip-path: polygon(12% 0, 88% 0, 100% 50%, 88% 100%, 12% 100%, 0 50%); padding: 9px 26px; border: 0; background: color-mix(in srgb, var(--nc, var(--primary)) 16%, var(--surface)); }
.mnode.shape-cloud { border-radius: 40% 45% 42% 48% / 55% 50% 60% 52%; padding: 12px 20px; }
.mnode.shape-underline { border: 0; border-bottom: 2.5px solid var(--nc, var(--line)); border-radius: 0; background: transparent; box-shadow: none; padding: 4px 4px 3px; }
.mnode.shape-none { border-color: transparent; background: transparent; box-shadow: none; }
.mnode.shape-underline.sel, .mnode.shape-none.sel { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.mnode .em { margin-right: 5px; }
.mnode .ic { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; stroke: currentColor; fill: none; stroke-width: 2; }
.mnode .img { display: block; max-width: 220px; max-height: 160px; border-radius: 6px; margin-bottom: 6px; pointer-events: none; }
.mnode .meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 5px; }
.mnode .meta:empty { display: none; }
.mnode .ind { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-3); }
.mnode.root .ind { color: #B4BBD0; }
.mnode .ind svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.mnode .tag { height: 17px; font-size: 10.5px; padding: 0 5px; }
.mnode .task { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 11.5px; }
.mnode.root .task { border-top-color: #3a4260; }
.mnode .task .ring { width: 18px; height: 18px; flex: none; }
.mnode .task .st { font-weight: 650; color: color-mix(in srgb, var(--sc) 60%, var(--mix-text)); }
.mnode .task .due { color: var(--ink-3); }
.mnode .task .due.over { color: var(--bad); font-weight: 650; }
.mnode .task .pd { width: 8px; height: 8px; border-radius: 2px; background: var(--pc); flex: none; }
.mnode .task .avatar { margin-left: auto; }
.mnode .coll { position: absolute; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; border: 1.5px solid var(--nc, var(--ink-3)); background: var(--surface);
  color: var(--ink-2); font: 700 10px/16px var(--font); text-align: center; cursor: pointer; padding: 0; z-index: 2; }
.mnode .coll.r { right: -24px; } .mnode .coll.l { left: -24px; }
.mnode .coll.b { top: auto; bottom: -24px; left: 50%; margin: 0 0 0 -10px; } .mnode .coll.t { top: -24px; left: 50%; margin: 0 0 0 -10px; }
.mnode .add { position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; display: none; place-items: center; cursor: pointer; z-index: 3; padding: 0; }
.mnode.sel:not(.editing) .add { display: grid; }
.mnode .add svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 2.5; }
.mnode .add.r { right: -30px; top: 50%; margin-top: -11px; } .mnode .add.l { left: -30px; top: 50%; margin-top: -11px; }
.mnode .add.b { bottom: -30px; left: 50%; margin-left: -11px; } .mnode .add.t { top: -30px; left: 50%; margin-left: -11px; }
.mnode .ccount { position: absolute; top: -9px; right: -9px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: #1b1300; font: 700 10px/18px var(--font); text-align: center; padding: 0 4px; }
.rubber { position: absolute; border: 1px solid var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); pointer-events: none; z-index: 30; }
.drop-line { position: absolute; height: 3px; background: var(--accent); border-radius: 2px; pointer-events: none; z-index: 30; }
.rcursor { position: absolute; z-index: 35; pointer-events: none; transition: transform .25s linear; }
.rcursor svg { width: 18px; height: 18px; fill: var(--rc); stroke: #fff; stroke-width: 1.2; }
.rcursor span { position: absolute; left: 14px; top: 14px; background: var(--rc); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }

.ed-zoom { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-1); z-index: 20; }
.ed-zoom .btn { border: 0; height: 34px; }
.ed-zoom span { font-size: .78rem; width: 44px; text-align: center; color: var(--ink-2); cursor: pointer; }
.ed-float { position: absolute; z-index: 25; display: flex; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-2); }
.ed-float .btn { height: 30px; min-width: 30px; padding: 0 7px; border: 0; }
.ed-float .btn.active { background: var(--surface-3); }
.ed-float .sw { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.mobile-bar { display: none; position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 24; gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-2); }
.mobile-bar .btn { height: 42px; width: 46px; border: 0; padding: 0; flex-direction: column; gap: 0; font-size: .62rem; }
@media (max-width: 760px), (pointer: coarse) { .mobile-bar { display: flex; } .ed-zoom { bottom: 80px; } }

.panel { width: 360px; flex: none; border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; z-index: 30; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 50px; }
.panel-head h3 { margin: 0; flex: 1; font-size: 1rem; }
.panel-body { flex: 1; overflow: auto; padding: 14px; }
.panel section { margin-bottom: 18px; }
.panel section > h4 { font-size: .8rem; color: var(--ink-3); font-family: var(--font); font-weight: 650; margin-bottom: 8px; }
@media (max-width: 760px) { .panel { position: absolute; inset: auto 0 0 0; width: 100%; height: 62%; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-3); } }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatches button.active { box-shadow: 0 0 0 2px var(--ink); }
.ico.flip { transform: rotate(180deg); }
@media (pointer: coarse) { .swatches button { width: 32px; height: 32px; } }
.cat-ic { display: inline-flex; } .cat-ic svg { width: 14px; height: 14px; }
.swatches button.none { background: linear-gradient(45deg, transparent 45%, var(--bad) 45%, var(--bad) 55%, transparent 55%), var(--surface); }
.picker-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.picker-grid button { height: 34px; border: 1px solid transparent; background: var(--surface-2); border-radius: 6px; cursor: pointer; font-size: 18px; display: grid; place-items: center; color: var(--ink-2); }
.picker-grid button:hover, .picker-grid button.active { border-color: var(--primary); }
.picker-grid svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.rich { min-height: 80px; max-height: 260px; overflow: auto; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); outline: none; font-size: .9rem; }
.rich:focus { border-color: var(--primary); }
.rich:empty::before { content: attr(data-placeholder); color: var(--ink-3); }
.rich-bar { display: flex; gap: 2px; margin-bottom: 4px; flex-wrap: wrap; align-items: center; }
.rich-bar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
/* v2: icons and pictures inside notes */
.rich img.ni, .note img.ni, .pv-note img.ni { width: 1.2em; height: 1.2em; vertical-align: -.22em; margin: 0 .1em; display: inline-block; }
.rich img.nimg, .note img.nimg, .pv-note img.nimg { display: block; max-width: 100%; height: auto; border-radius: 8px; margin: 6px 0; border: 1px solid var(--line-2); }
.note-rich { max-height: 420px; }
:root[data-theme="dark"] img.ni { filter: invert(1) brightness(1.7); }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] img.ni { filter: invert(1) brightness(1.7); } }
/* v2: icon picker */
.icon-picker input[type=search] { margin-bottom: 8px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; max-height: min(52vh, 460px); overflow-y: auto; padding: 2px; margin: 8px 0; }
.icon-cell { height: 46px; border: 1px solid transparent; border-radius: 8px; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.icon-cell:hover, .icon-cell:focus-visible { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.icon-cell.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.icon-cell svg { width: 22px; height: 22px; }
/* v2: map font and category */
.font-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; max-height: 60vh; overflow-y: auto; }
.font-opt { text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.font-opt b { font-size: 1.05rem; font-weight: 700; }
.font-opt span { font-size: .92rem; color: var(--ink-2); }
.font-opt:hover, .font-opt.active { border-color: var(--primary); }
.font-opt.active { box-shadow: inset 0 0 0 1px var(--primary); }
.ed-font b { font-family: var(--map-font, inherit); font-size: 1rem; }
.ed-font span, .ed-cat span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-cat { --cc: var(--ink-3); }
.ed-cat .dot, .cat-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cc); display: inline-block; flex: none; }
.ed-cat svg, .cat-chip svg { color: var(--cc); }
.cat-chip { --cc: var(--ink-3); align-self: flex-start; width: fit-content; display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: .76rem; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--cc) 12%, var(--surface)); color: color-mix(in srgb, var(--cc) 45%, var(--mix-text)); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cat-chip svg { width: 13px; height: 13px; }
.tag-input { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: var(--r-s); min-height: 38px; align-items: center; }
.tag-input input { border: 0; height: 26px; flex: 1; min-width: 80px; box-shadow: none !important; padding: 0 4px; }
.tag-input .tag button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font-size: 13px; line-height: 1; }
.att-list { display: flex; flex-direction: column; gap: 6px; }
.att { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r-s); font-size: .84rem; }
.att a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .size { color: var(--ink-3); font-size: .75rem; }

.comment { display: flex; gap: 9px; margin-bottom: 14px; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { display: flex; gap: 6px; align-items: baseline; font-size: .82rem; }
.comment .c-head b { font-weight: 650; }
.comment .c-text { font-size: .9rem; margin: 3px 0; overflow-wrap: anywhere; }
.comment .c-text .mention { color: var(--primary); font-weight: 600; background: color-mix(in srgb, var(--primary) 9%, transparent); border-radius: 4px; padding: 0 2px; }
.comment .c-actions { display: flex; gap: 10px; font-size: .76rem; }
.comment .c-actions button { background: none; border: 0; padding: 0; color: var(--ink-3); cursor: pointer; font: inherit; }
.comment .c-actions button:hover { color: var(--ink); }
.comment .replies { margin-top: 10px; padding-left: 4px; border-left: 2px solid var(--line-2); }
.comment.resolved { opacity: .55; }
.thread-target { font-size: .78rem; color: var(--ink-3); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.composer { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.composer .rich { border: 0; min-height: 60px; }
.composer .bar { display: flex; gap: 6px; padding: 6px; border-top: 1px solid var(--line-2); align-items: center; }
.mention-pop { position: fixed; z-index: 3000; }

/* presentation */
.present { position: fixed; inset: 0; background: var(--paper); display: flex; flex-direction: column; }
.present .canvas { cursor: default; background-image: none; flex: 1; min-height: 0; height: 100%; }
.present-bar { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); z-index: 50; }
.present-bar .count { font-size: .82rem; color: var(--ink-3); min-width: 60px; text-align: center; font-variant-numeric: tabular-nums; }
.present .mnode .coll, .present .mnode .add { display: none; }
.present .mnode { cursor: pointer; transition: opacity .35s, box-shadow .12s; }
.pv-track { height: 4px; background: var(--surface-3, var(--line)); flex-shrink: 0; }
.pv-bar { height: 100%; width: 0; background: var(--primary); transition: width .35s ease; }
.pv-caption { flex-shrink: 0; padding: 14px 24px 12px; border-bottom: 1px solid var(--line); background: var(--surface); max-height: 34vh; overflow: auto; }
.pv-crumbs { font-size: .78rem; color: var(--ink-3); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-title { font: 650 1.15rem/1.3 var(--map-font, var(--display, inherit)); color: var(--ink); }
.pv-note { margin-top: 6px; font-size: .95rem; line-height: 1.55; color: var(--ink-2); max-width: 72ch; }
.pv-note img { max-width: min(100%, 420px); height: auto; border-radius: 8px; }
.pv-note img.ni { width: 1.1em; height: 1.1em; vertical-align: -.15em; border-radius: 0; }
.present-bar #pv-focus.active { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.present-bar .btn:disabled { opacity: .35; }
@media (max-width: 600px) {
  .pv-caption { padding: 10px 16px 8px; max-height: 28vh; }
  .pv-title { font-size: 1rem; }
  .present-bar { bottom: 10px; max-width: calc(100vw - 20px); }
  .present-bar #pv-focus span { display: none; }
  .present-bar .btn { min-width: 42px; min-height: 42px; }
}

/* ---------------------------------------------------------------- action wizard */
.wiz-steps { display: flex; gap: 0; margin-bottom: 18px; counter-reset: step; overflow-x: auto; }
.wiz-steps li { list-style: none; flex: 1; min-width: 72px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .78rem; color: var(--ink-3); position: relative; text-align: center; }
.wiz-steps li::before { counter-increment: step; content: counter(step); width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-weight: 700; background: var(--surface); z-index: 1; }
.wiz-steps li::after { content: ''; position: absolute; top: 13px; left: 50%; width: 100%; height: 1.5px; background: var(--line); }
.wiz-steps li:last-child::after { display: none; }
.wiz-steps li.done::before { background: var(--primary); color: #fff; border-color: var(--primary); }
.wiz-steps li.cur { color: var(--ink); font-weight: 650; }
.wiz-steps li.cur::before { border-color: var(--primary); color: var(--primary); }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.opt { display: flex; gap: 11px; align-items: flex-start; padding: 13px; border: 1.5px solid var(--line); border-radius: var(--r-m); cursor: pointer; background: var(--surface); }
.opt:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.opt.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.opt.disabled { opacity: .45; pointer-events: none; }
.opt b { display: block; font-size: .92rem; }
.opt span { font-size: .8rem; color: var(--ink-3); }
.opt svg { width: 22px; height: 22px; flex: none; stroke: var(--primary); fill: none; stroke-width: 1.8; margin-top: 2px; }
.plan-tree { border: 1px solid var(--line); border-radius: var(--r-m); max-height: 46vh; overflow: auto; }
.plan-row { display: grid; grid-template-columns: 22px minmax(160px, 1fr) 120px 150px 30px; gap: 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line-2); }
.plan-row.group { background: var(--surface-2); font-weight: 600; }
.plan-row.off { opacity: .45; }
.plan-row input[type=text] { height: 30px; font-size: .86rem; }
.plan-row select { height: 30px; font-size: .82rem; padding: 0 6px; }
.plan-row .kind { font-size: .75rem; font-weight: 700; color: var(--ink-3); }
.plan-row .linked { font-size: .72rem; color: var(--ok); }
@media (max-width: 720px) { .plan-row { grid-template-columns: 22px 1fr 30px; } .plan-row .pr, .plan-row .as { display: none; } }

/* ---------------------------------------------------------------- project app */
body.project-body .content { max-width: none; padding: 0; }
.pj-head { padding: 16px 22px 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.pj-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pj-title h2 { margin: 0; font-size: 1.35rem; }
.pj-meta { display: flex; gap: 16px; align-items: center; font-size: .84rem; color: var(--ink-3); margin: 6px 0 10px; flex-wrap: wrap; }
.pj-meta .progress { width: 140px; }
.pj-tabs { margin: 0; border: 0; }
.pj-toolbar { display: flex; gap: 8px; align-items: center; padding: 12px 22px; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); }
.pj-toolbar input[type=search] { width: 220px; height: 34px; }
.pj-toolbar select { width: auto; height: 34px; }
.pj-view { padding: 16px 22px 60px; }
@media (max-width: 760px) { .pj-head, .pj-toolbar, .pj-view { padding-left: 12px; padding-right: 12px; } .pj-toolbar input[type=search] { width: auto; flex: 1 1 140px; min-width: 120px; } }
.pj-filters { display: contents; }
.pj-filter-toggle { display: none; }
@media (max-width: 760px) {
  .pj-filter-toggle { display: inline-flex; }
  .pj-filters { display: none; }
  .pj-toolbar.filters-open .pj-filters { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  .pj-toolbar.filters-open .pj-filters select { flex: 1 1 140px; }
  .pj-head .btn .lbl { display: none; }
  .pj-title h2 { font-size: 1.15rem; }
  .pj-meta { gap: 10px; margin: 4px 0 6px; }
  .pj-meta .progress { width: 90px; }
  .gantt .g-code { display: none; }
}

.tl-table td.editable { cursor: text; }
.tl-table td.editable:hover { box-shadow: inset 0 0 0 1px var(--line); border-radius: 4px; }
.tl-table .grp td { background: var(--surface-2); font-weight: 650; }
.tl-table .sub .tname { padding-left: 22px; }
.tl-table .tname a { color: var(--ink); font-weight: 500; }
.tl-table input, .tl-table select { height: 30px; font-size: .85rem; }
.tl-table th.sortable { cursor: pointer; }
.tl-table th.sortable:hover { color: var(--ink); }
.tl-table tr.overdue .due { color: var(--bad); font-weight: 600; }
@media (max-width: 760px) { .tl-table .hide-m { display: none; } }

.kanban { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 12px; min-height: 60vh; scroll-snap-type: x proximity; }
.kcol { width: 290px; flex: none; background: var(--surface-2); border-radius: var(--r-m); display: flex; flex-direction: column; max-height: calc(100vh - 260px); scroll-snap-align: start; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px; font-weight: 650; font-size: .88rem; }
.kcol-head .n { color: var(--ink-3); font-weight: 500; }
.kcol-head::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--sc); }
.kcol-body { padding: 0 8px 8px; overflow-y: auto; min-height: 60px; flex: 1; }
.kcol-body.over { background: color-mix(in srgb, var(--primary) 7%, transparent); border-radius: var(--r-m); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 11px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow-1); touch-action: none; }
.kcard:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.kcard.dragging { opacity: .4; }
.kcard .kc-top { display: flex; gap: 6px; align-items: center; font-size: .72rem; color: var(--ink-3); margin-bottom: 4px; }
.kcard .kc-name { font-weight: 550; font-size: .9rem; margin-bottom: 8px; color: var(--ink); }
.kcard .kc-foot { display: flex; align-items: center; gap: 8px; font-size: .76rem; color: var(--ink-3); }
.kcard .kc-foot .over { color: var(--bad); font-weight: 600; }
.kcard .progress { margin-bottom: 8px; height: 4px; }
.kghost { position: fixed; z-index: 3000; pointer-events: none; transform: rotate(2deg); box-shadow: var(--shadow-3); opacity: .95; }
@media (max-width: 760px) { .kcol { width: 82vw; } }

.gantt { display: grid; grid-template-columns: 300px 1fr; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); overflow: hidden; height: calc(100vh - 250px); min-height: 380px; }
.g-left { border-right: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.g-right { overflow: auto; position: relative; }
.g-head { height: 52px; flex: none; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: .76rem; color: var(--ink-3); }
.g-left .g-head { display: flex; align-items: flex-end; padding: 0 12px 8px; font-weight: 600; }
.g-rows { overflow: hidden; flex: 1; }
.g-row { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border-bottom: 1px solid var(--line-2); font-size: .84rem; white-space: nowrap; }
.g-row.grp { font-weight: 650; background: var(--surface-2); }
.g-row .tw { cursor: pointer; width: 16px; color: var(--ink-3); flex: none; }
.g-row .nm { overflow: hidden; text-overflow: ellipsis; flex: 1; cursor: pointer; }
.g-canvas { position: relative; }
.g-scale { position: sticky; top: 0; z-index: 5; height: 52px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.g-scale .top, .g-scale .bot { position: absolute; left: 0; height: 26px; display: flex; }
.g-scale .bot { top: 26px; }
.g-scale span { flex: none; font-size: .72rem; color: var(--ink-3); border-left: 1px solid var(--line); padding: 5px 5px 0; overflow: hidden; white-space: nowrap; }
.g-grid { position: absolute; left: 0; top: 52px; }
.g-grid .wk { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ink-3) 7%, transparent); }
.g-grid .today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .7; }
.g-grid .rowline { position: absolute; left: 0; right: 0; height: 1px; background: var(--line-2); }
.g-bar { position: absolute; height: 20px; border-radius: 5px; background: color-mix(in srgb, var(--sc, var(--primary)) 25%, var(--surface)); border: 1px solid var(--sc, var(--primary)); cursor: grab; overflow: hidden; touch-action: none; }
.g-bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--sc, var(--primary)); opacity: .75; }
.g-bar > b { position: relative; font-size: .7rem; font-weight: 600; padding: 0 6px; line-height: 18px; white-space: nowrap; color: var(--ink); }
.g-bar.crit { border: 2px solid var(--bad); box-shadow: 0 0 0 2px color-mix(in srgb, var(--bad) 18%, transparent); }
.g-bar.dim { opacity: .45; }
.g-bar.narrow { overflow: visible; }
.g-bar.narrow > b { position: absolute; left: 100%; top: 0; padding-left: 8px; color: var(--ink-2); pointer-events: none; }
.g-bar .rh { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.g-bar.summary { height: 8px; border-radius: 2px; background: var(--ink-2); border: 0; cursor: default; }
.g-bar.base { height: 5px; border: 0; background: var(--ink-3); opacity: .5; cursor: default; pointer-events: none; border-radius: 3px; }
.g-ms { position: absolute; width: 14px; height: 14px; transform: rotate(45deg); background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.g-ms-label { position: absolute; font-size: .72rem; font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.g-deps { position: absolute; left: 0; top: 52px; pointer-events: none; overflow: visible; }
.g-deps path { fill: none; stroke: var(--ink-3); stroke-width: 1.4; }
.g-deps path.bad { stroke: var(--bad); stroke-dasharray: 4 3; }
.g-link-handle { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); cursor: crosshair; display: none; z-index: 3; }
.g-bar:hover + .g-link-handle, .g-link-handle:hover { display: block; }
@media (max-width: 760px) { .gantt { grid-template-columns: 140px 1fr; } }

.cal { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); overflow: hidden; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px; font-size: .76rem; color: var(--ink-3); font-weight: 600; border-bottom: 1px solid var(--line); text-align: center; }
.cal-day { min-height: 112px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 5px; font-size: .78rem; position: relative; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: var(--surface-2); color: var(--ink-3); }
.cal-day.today .dn { background: var(--primary); color: #fff; border-radius: 10px; padding: 0 6px; }
.cal-day.off { background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--ink-3) 6%, transparent) 6px 12px); }
.cal-day.over { outline: 2px dashed var(--primary); outline-offset: -2px; }
.cal-ev[data-id] { touch-action: none; -webkit-user-drag: none; user-select: none; }
.cal-day .dn { font-weight: 600; display: inline-block; margin-bottom: 3px; }
.cal-ev { display: block; padding: 2px 6px; margin-bottom: 3px; border-radius: 4px; font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  background: color-mix(in srgb, var(--sc, var(--primary)) 16%, var(--surface)); border-left: 3px solid var(--sc, var(--primary)); color: var(--ink); }
.cal-ev.ms { --sc: var(--accent); font-weight: 650; }
.cal-week .cal-day { min-height: 360px; }
.cal-dayview { padding: 14px; }
@media (max-width: 760px) { .cal-day { min-height: 70px; } .cal-ev { font-size: .66rem; padding: 1px 3px; } }

.timeline-v { position: relative; padding: 10px 0 10px 28px; }
.timeline-v::before { content: ''; position: absolute; left: 9px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before { content: ''; position: absolute; left: -24px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--sc, var(--primary)); }
.tl-item.ms::before { border-radius: 2px; transform: rotate(45deg); border-color: var(--accent); }
.tl-item .when { font-size: .78rem; color: var(--ink-3); }
.tl-phase { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.tl-track { position: relative; height: 26px; background: var(--surface-2); border-radius: 6px; }
.tl-span { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; background: color-mix(in srgb, var(--primary) 30%, var(--surface)); border: 1px solid var(--primary); overflow: hidden; }
.tl-span > i { position: absolute; inset: 0 auto 0 0; background: var(--primary); opacity: .55; }
@media (max-width: 760px) { .tl-phase { grid-template-columns: 1fr; } }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .78rem; color: var(--ink-2); margin-top: 8px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); box-shadow: var(--shadow-3); z-index: 900; display: flex; flex-direction: column; animation: slide .2s; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.drawer-head .tn { flex: 1; font: 650 1.15rem var(--display); border: 1px solid transparent; padding: 4px 6px; border-radius: 6px; min-height: 34px; outline: none; }
.drawer-head .tn:hover { border-color: var(--line); }
.drawer-head .tn:focus { border-color: var(--primary); }
.drawer-body { flex: 1; overflow: auto; padding: 16px 18px; }
.props { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; align-items: center; margin-bottom: 18px; }
.props > label { margin: 0; font-weight: 500; color: var(--ink-3); }
.props input, .props select { height: 34px; }
.drawer-scrim { position: fixed; inset: 0; background: rgba(15,20,35,.2); z-index: 899; }
.hist { font-size: .8rem; color: var(--ink-2); padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.hist time { color: var(--ink-3); margin-left: 6px; }

/* ---------------------------------------------------------------- templates */
.tpl-card { cursor: pointer; }
.tpl-card .thumb { height: 140px; }
.tpl-card .cat { font-size: .74rem; color: var(--ink-3); }
.tpl-preview { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); padding: 12px; max-height: 50vh; overflow: auto; }
.tpl-preview ul { list-style: none; padding-left: 18px; margin: 2px 0; border-left: 1.5px solid var(--line); }
.tpl-preview > ul { border: 0; padding: 0; }
.tpl-preview li { padding: 2px 0; font-size: .88rem; }

/* ---------------------------------------------------------------- admin */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.admin-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 1px; }
.admin-nav a { padding: 7px 10px; border-radius: 6px; color: var(--ink-2); font-size: .88rem; text-decoration: none !important; }
.admin-nav a.active { background: var(--surface-3); color: var(--ink); font-weight: 600; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-menu-btn { display: none; }
.admin-group { display: contents; }
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .admin-menu { position: relative; z-index: 15; }
  .admin-menu-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 8px 14px; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-m); color: var(--ink); font: inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow-1); }
  .admin-menu-btn .amb-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .admin-menu-btn .amb-g { font-size: .76rem; color: var(--ink-3); font-weight: 600; }
  .admin-menu-btn .amb-s { font-weight: 650; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .admin-menu-btn .ico { width: 20px; height: 20px; transition: transform .15s; }
  .admin-menu.open .admin-menu-btn { border-color: var(--primary); }
  .admin-menu.open .admin-menu-btn .ico { transform: rotate(180deg); }
  .admin-nav { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px); max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-3); padding: 6px 8px 10px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 4px 14px; }
  .admin-menu.open .admin-nav { display: grid; }
  .admin-group { display: flex; flex-direction: column; }
  .admin-nav .nav-section { padding: 10px 10px 4px; }
  .admin-nav a { min-height: 44px; display: flex; align-items: center; font-size: .95rem; }
  .admin-layout .page-head h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* the top bar and the section switcher already name the page */
  .admin-layout .page-head { margin-bottom: 14px; }
  .admin-layout .page-head .lead { margin: 0; }
}
.kv { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 6px 14px; font-size: .88rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.ok-ic { color: var(--ok); font-weight: 700; } .bad-ic { color: var(--bad); font-weight: 700; }

/* ---------------------------------------------------------------- notifications */
.notif { display: flex; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line-2); text-decoration: none !important; color: var(--ink); }
.notif.unread { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.notif .nt { font-weight: 550; font-size: .88rem; }
.notif .nb { font-size: .8rem; color: var(--ink-3); }
.notif time { font-size: .74rem; color: var(--ink-3); }
.notif-pop { width: 360px; max-height: 70vh; overflow: auto; padding: 0; }
@media (max-width: 480px) { .notif-pop { width: 92vw; } }

/* print */
@media print { .sidebar, .topbar, .pj-toolbar, .ed-top { display: none !important; } .shell { display: block; } }
@media (max-width: 760px) { .hide-sm { display: none !important; } }

/* links inside running text are underlined, not only colored (WCAG 1.4.1) */
p a:not(.btn), .hint a, .auth-card p a, li > a.inline { text-decoration: underline; text-underline-offset: 2px; }

/* ---------------------------------------------------------------- phones, tablets and touch screens */
@media (max-width: 1100px) { .table td[style*="nowrap"] { white-space: normal !important; } .table td[style*="nowrap"] .btn { margin: 2px 0; } .table time { white-space: nowrap; } }
/*
   Touch: every control is at least 40 px (44 px for primary fields), form fields use 16 px text so iOS does not zoom on focus. */
.grow { flex: 1 1 200px; min-width: 0; }
.show-sm { display: none !important; }
@media (max-width: 760px) { .show-sm { display: inline-flex !important; } }
@media (pointer: coarse), (max-width: 760px) {
  .btn { height: 42px; }
  .btn.sm { height: 40px; padding: 0 12px; }
  .btn.icon { width: 42px; }
  .btn.sm.icon { width: 40px; }
  .chip { height: 40px; padding: 0 14px; }
  .badge { height: 24px; font-size: .78rem; }
  .avatar.sm { width: 26px; height: 26px; font-size: .75rem; }
  input[type=color] { height: 44px; width: 56px; }
  input[type=file] { min-height: 44px; padding: 10px 0; font-size: 16px; max-width: 100%; }
  .ed-zoom .btn { height: 42px; }
  .mnode .coll::after { content: ''; position: absolute; inset: -12px; }
  .lp-nav .brand, .topbar .brand { min-height: 44px; display: inline-flex; align-items: center; }
  .input, input:not([type]), input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], select { height: 44px; font-size: 16px; }
  textarea { font-size: 16px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .menu button, .menu a { min-height: 44px; font-size: .95rem; }
  .nav-link { min-height: 44px; }
  .ed-top .btn { height: 40px; }
  .ed-top .btn.icon { width: 40px; }
  .ed-title { height: 40px; font-size: 16px; }
  .auth-card .small a, .auth-card a.small { display: inline-flex; align-items: center; min-height: 40px; }
}
@media (max-width: 760px) {
  .ed-top { gap: 4px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
  .ed-top::-webkit-scrollbar { display: none; }
  .ed-title { flex: 1 1 auto; min-width: 0; max-width: none; text-overflow: ellipsis; }
  .ed-save { font-size: 0; gap: 0; }
  .ed-cta { position: fixed; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 45; height: 46px !important; padding: 0 18px !important; border-radius: 23px; box-shadow: var(--shadow-3); font-size: .95rem !important; }
  .content .row { flex-wrap: wrap; }
  .page-head h2 { font-size: 1.3rem; }
  .card { padding: 16px; }
  .card.flush { padding: 0; }
  .kv { grid-template-columns: minmax(96px, 40%) minmax(0, 1fr); }
  .kv dd { overflow-wrap: anywhere; }
  .admin-toolbar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; margin: 0 -2px; padding: 2px; }
  .admin-toolbar .chips::-webkit-scrollbar { display: none; }
  .admin-toolbar .chip { flex: none; }
  .admin-toolbar .spacer { display: none; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .v { font-size: 1.45rem; }
  /* tables marked .stack: one card per row */
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr.stack-head, .table.stack tr:has(> th) { display: none; }
  .table.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack tr:hover td { background: none; }
  .table.stack td { border: 0; padding: 4px 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; text-align: right; min-width: 0 !important; white-space: normal !important; overflow-wrap: anywhere; }
  .table.stack td::before { content: attr(data-label); flex: none; max-width: 45%; color: var(--ink-3); font-size: .8rem; font-weight: 600; text-align: left; }
  .table.stack td:first-child { display: block; text-align: left; font-size: 1rem; padding-bottom: 6px; }
  .table.stack td:first-child::before, .table.stack td[data-label=""]::before { display: none; }
  .table.stack td[data-label=""] { justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding-top: 10px; text-align: left; }
  .table.stack td > .row { flex: 1; max-width: 62%; }
  .table.stack td[colspan] { text-align: left; }
  .table-wrap:has(> .table.stack) { overflow: visible; }
  .modal-foot { flex-wrap: wrap; }
}
@media (max-width: 380px) {
  .stat-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .content { padding-left: 12px; padding-right: 12px; }
}

/* v3: sheets (tabs) */
.ed-sheets { display: flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 8px; border-top: 1px solid var(--line); background: var(--surface); position: relative; z-index: 21; }
.ed-sheets[hidden] { display: none; }
.sheet-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; min-width: 0; flex: 0 1 auto; align-self: stretch; align-items: stretch; }
.sheet-tab { --sc: var(--primary); position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 0 14px; border: 0; background: none; color: var(--ink-2);
  font: 500 .84rem var(--sans, inherit); cursor: pointer; white-space: nowrap; border-radius: 0 0 8px 8px; flex-shrink: 0; min-height: 40px; }
.sheet-tab::before { content: ''; position: absolute; left: 8px; right: 8px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--sc); opacity: .35; }
.sheet-tab:hover { background: var(--surface-2); color: var(--ink); }
.sheet-tab.active { background: var(--paper); color: var(--ink); font-weight: 650; box-shadow: inset 1px 0 0 var(--line), inset -1px 0 0 var(--line); }
.sheet-tab.active::before { opacity: 1; left: 0; right: 0; }
.sheet-tab.drop { box-shadow: inset 3px 0 0 var(--primary); }
.sheet-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.sheet-name { overflow: hidden; text-overflow: ellipsis; }
.sheet-link svg { width: 13px; height: 13px; stroke: var(--ink-3); fill: none; stroke-width: 2; display: block; }
.sheet-add { flex-shrink: 0; }
.sheet-back { margin-left: auto; flex-shrink: 1; min-width: 0; color: var(--ink-2); }
.sheet-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; }
.mnode .ind.ref { border: 0; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); border-radius: 6px; padding: 2px 5px; cursor: pointer; font: inherit; }
.mnode .ind.ref.map { background: color-mix(in srgb, var(--secondary, #7c3aed) 16%, transparent); color: var(--secondary, #7c3aed); }
.mnode.root .ind.ref { background: color-mix(in srgb, var(--paper) 22%, transparent); color: var(--paper); }
.mnode .ind.ref:hover { filter: brightness(.9); }
.ed-origin { max-width: 220px; color: var(--ink-2); }
.ed-origin span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg .btn.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--ink); }
@media (max-width: 760px), (pointer: coarse) {
  .ed.has-sheets .mobile-bar { bottom: 8px; }
  .sheet-tab { min-height: 44px; padding: 0 12px; max-width: 160px; }
  .ed-sheets { min-height: 44px; }
  .sheet-back span { display: none; }
}

/* admin: view the public site */
.topbar .view-site { flex-shrink: 0; }
@media (max-width: 600px) { .topbar .view-site span { display: none; } .topbar .view-site { min-width: 40px; min-height: 40px; padding: 0 9px; } }

/* v3: print branding settings */
.print-logo-row { gap: 10px; align-items: center; }
.print-logo-box { display: inline-flex; align-items: center; justify-content: center; min-width: 120px; height: 56px; padding: 6px 10px; border: 1px dashed var(--line); border-radius: var(--r-m); background: var(--surface-2); }
.print-logo-box img { max-height: 44px; max-width: 200px; object-fit: contain; }
.print-preview { --pp: var(--primary); position: relative; aspect-ratio: 210 / 150; max-width: 520px; background: #fff; color: #0f172a; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow-2); padding: 5% 6%; display: flex; flex-direction: column; font-size: 11px; }
.print-preview .pp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; border-bottom: 2px solid var(--pp); padding-bottom: 6px; color: #475569; }
.print-preview .pp-logo img { max-height: 26px; max-width: 160px; display: block; }
.print-preview .pp-logo b { color: var(--pp); font-size: 14px; }
.print-preview .pp-htext { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.print-preview .pp-body { flex: 1; padding: 14px 0; display: flex; flex-direction: column; gap: 7px; }
.print-preview .pp-title { color: var(--pp); font-size: 16px; margin-bottom: 4px; }
.print-preview .pp-body i { display: block; height: 7px; border-radius: 4px; background: #e2e8f0; }
.print-preview .pp-body i.short { width: 60%; }
.print-preview .pp-foot { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; border-top: 1px solid #e2e8f0; padding-top: 5px; font-size: 9.5px; color: #5b6576; }
.print-preview .pp-contact { text-align: center; }
@media (max-width: 600px) { .print-preview { font-size: 9px; } .print-preview .pp-foot { grid-template-columns: 1fr auto; } .print-preview .pp-contact { display: none; } }

/* v3: branded client report (/pd/{token}) */
.client-body { background: #f4f5f7; color: #0f172a; min-height: 100vh; display: flex; flex-direction: column; }
.client-body main { flex: 1; }
.cr-wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.cr-bar { background: #fff; border-bottom: 3px solid var(--brand); position: sticky; top: 0; z-index: 10; }
.cr-bar-in { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.cr-brand img { max-height: 40px; max-width: 220px; display: block; object-fit: contain; }
.cr-brand b { font: 700 1.2rem var(--display, inherit); color: var(--brand); }
.cr-pdf { border-color: var(--brand); color: var(--brand); background: #fff; }
.cr-pdf:hover { background: color-mix(in srgb, var(--brand) 8%, #fff); }
.cr-doc { background: #fff; margin-top: 28px; margin-bottom: 28px; padding: 48px 56px 32px; border-radius: 10px; box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 28px rgba(15,23,42,.06); max-width: 912px; }
.cr-hero { border-left: 6px solid var(--brand); padding-left: 22px; margin-bottom: 8px; }
.cr-kicker { color: #64748b; font-size: .9rem; margin: 0 0 6px; }
.cr-hero h1 { font: 700 clamp(1.7rem, 3.6vw, 2.5rem)/1.15 var(--display, inherit); margin: 0 0 10px; letter-spacing: -.01em; }
.cr-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; color: #334155; margin: 0; }
.cr-note { margin-top: 18px; padding: 16px 18px; background: color-mix(in srgb, var(--brand) 6%, #f8fafc); border-radius: 8px; color: #1e293b; line-height: 1.6; max-width: 70ch; }
.cr-sec { margin-top: 36px; }
.cr-sec h2 { font: 650 1.2rem var(--display, inherit); color: #0f172a; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; gap: 10px; }
.cr-sec h2::before { content: ''; width: 10px; height: 10px; border-radius: 2px; background: var(--brand); }
.cr-progress { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.cr-ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: radial-gradient(closest-side, #fff 76%, transparent 77%), conic-gradient(var(--brand) calc(var(--p) * 1%), #e8ebf0 0); }
.cr-ring b { font: 700 1.6rem var(--display, inherit); }
.cr-kpis { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; min-width: 240px; }
.cr-kpis div { padding: 10px 12px; border: 1px solid #e8ebf0; border-radius: 8px; }
.cr-kpis dt { font-size: .8rem; color: #64748b; }
.cr-kpis dd { margin: 2px 0 0; font: 700 1.35rem var(--display, inherit); }
.cr-kpis dd small { font-size: .85rem; color: #64748b; font-weight: 500; }
.cr-kpis dd.d { font-size: 1rem; }
.cr-kpis .bad dd { color: #dc2626; }
.cr-desc { margin-top: 16px; color: #334155; line-height: 1.6; }
.cr-range { color: #64748b; font-size: .88rem; margin: -6px 0 10px; }
.cr-gantt { display: flex; flex-direction: column; gap: 8px; }
.cr-g-row { display: grid; grid-template-columns: minmax(110px, 30%) 1fr 44px; gap: 12px; align-items: center; }
.cr-g-name { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-g-track { position: relative; height: 22px; background: #f1f4f8; border-radius: 4px; }
.cr-g-bar { --gc: var(--brand); position: absolute; top: 3px; bottom: 3px; border-radius: 4px; background: color-mix(in srgb, var(--gc) 26%, #fff); overflow: hidden; min-width: 6px; }
.cr-g-bar i { display: block; height: 100%; background: var(--gc); }
.cr-g-today { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #dc2626; }
.cr-g-pct { font-size: .82rem; color: #475569; text-align: right; font-variant-numeric: tabular-nums; }
.cr-g-ms .cr-g-track { background: none; border-top: 1px dashed #cbd5e1; height: 18px; border-radius: 0; }
.cr-g-dia { position: absolute; top: 2px; width: 12px; height: 12px; margin-left: -6px; transform: rotate(45deg); background: #fff; border: 2px solid var(--brand); }
.cr-g-dia.done { background: var(--brand); }
.cr-legend { font-size: .8rem; color: #64748b; margin: 8px 0 0; display: flex; align-items: center; gap: 6px; }
.cr-legend .today { width: 10px; height: 2px; background: #dc2626; display: inline-block; }
.cr-ms { list-style: none; margin: 0; padding: 0; position: relative; }
.cr-ms li { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid #eef1f5; }
.cr-ms time { color: #475569; font-size: .9rem; font-variant-numeric: tabular-nums; }
.cr-ms p { margin: 4px 0 0; color: #64748b; font-size: .9rem; }
.cr-badge { display: inline-block; font-size: .76rem; padding: 2px 9px; border-radius: 999px; background: #f1f5f9; color: #334155; white-space: nowrap; }
.cr-badge.st-completed { background: #dcfce7; color: #166534; }
.cr-badge.st-in_progress, .cr-badge.st-at_risk { background: color-mix(in srgb, var(--brand) 14%, #fff); color: color-mix(in srgb, var(--brand) 80%, #000); }
.cr-badge.st-blocked, .cr-badge.st-missed { background: #fee2e2; color: #991b1b; }
.cr-group { margin-bottom: 22px; }
.cr-group h3 { font-size: 1rem; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.cr-group h3 i { width: 10px; height: 10px; border-radius: 50%; }
.cr-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.cr-table th { text-align: left; font-size: .78rem; font-weight: 600; color: #64748b; padding: 8px 10px; border-bottom: 2px solid #e2e8f0; }
.cr-table td { padding: 9px 10px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
.cr-table td:first-child { padding-left: calc(10px + var(--d, 0) * 18px); }
.cr-table tr.sum td { font-weight: 600; background: #fafbfc; }
.cr-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cr-table .code { color: #64748b; font-size: .82rem; }
.cr-table .over { color: #dc2626; font-weight: 600; }
.cr-mini { display: inline-block; width: 46px; height: 5px; border-radius: 3px; background: #e8ebf0; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.cr-mini i { display: block; height: 100%; background: var(--brand); }
.cr-ro { margin-top: 30px; }
.cr-foot { padding: 22px 0 34px; color: #475569; font-size: .88rem; }
.cr-contact { display: flex; flex-wrap: wrap; gap: 4px 16px; color: #334155; }
.cr-made { margin: 10px 0 0; font-size: .8rem; }
.cr-made a { color: #1e293b; text-decoration: underline; }
.cr-empty { text-align: center; padding: 80px 24px; }
@media (max-width: 720px) {
  .cr-wrap { padding: 0 16px; }
  .cr-doc { margin: 0; border-radius: 0; padding: 26px 16px 20px; box-shadow: none; }
  .cr-pdf span { display: none; }
  .cr-pdf { min-width: 44px; min-height: 44px; }
  .cr-hero { padding-left: 14px; border-left-width: 4px; }
  .cr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
  .cr-progress { gap: 18px; }
  .cr-ring { width: 108px; height: 108px; }
  .cr-g-row { grid-template-columns: 1fr 40px; }
  .cr-g-name { grid-column: 1 / -1; }
  .cr-ms li { grid-template-columns: 1fr auto; }
  .cr-ms time { grid-column: 1 / -1; }
  .cr-table thead { display: none; }
  .cr-table, .cr-table tbody, .cr-table tr, .cr-table td { display: block; width: 100%; }
  .cr-table tr { padding: 8px 0; border-bottom: 1px solid #eef1f5; }
  .cr-table td { border: 0; padding: 3px 0 !important; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .cr-table td::before { content: attr(data-label); color: #64748b; font-size: .8rem; text-align: left; flex-shrink: 0; }
  .cr-table td:first-child { text-align: left; font-weight: 600; padding-left: calc(var(--d, 0) * 12px) !important; }
  .cr-table td:first-child::before { display: none; }
}
@media print { .cr-bar, .cr-foot .cr-made { display: none; } .client-body { background: #fff; } .cr-doc { box-shadow: none; margin: 0; } }
.client-cta { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.client-cta h3 { margin: 0 0 4px; }
.client-share .check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; }
.client-share .row input[type=text] { flex: 1; min-width: 200px; }
.client-brand { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 14px; }
.client-brand summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
