/* MindMap Studio styles */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #eef0f7;
  --border: #dde1ec;
  --text: #1f2633;
  --muted: #6b7385;
  --accent: #4f5bd5;
  --accent-hover: #3f4ac0;
  --accent-soft: #e6e8fd;
  --danger: #d14343;
  --success: #2f9e6e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 4px 16px rgba(20, 24, 40, .06);
  --shadow-lg: 0 10px 40px rgba(20, 24, 40, .18);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;

  /* mind map palette (matches the classic lavender / blue / mint look) */
  --mm-canvas: #fbfbfe;
  --mm-grid: #eceef6;
  --mm-link: #7c9fd6;
  --mm-d0-bg: #c5c9fb; --mm-d0-bd: #a8aef0;
  --mm-d1-bg: #bdd5f0; --mm-d1-bd: #9dbde3;
  --mm-d2-bg: #a5ddd0; --mm-d2-bd: #85c9b9;
  --mm-d3-bg: #f6e2a8; --mm-d3-bd: #e2c97f;
  --mm-d4-bg: #f6c9d8; --mm-d4-bd: #e4a5bb;
  --mm-text: #1d2433;
  --mm-toggle-bg: #c9dcf3;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b93535; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger-text { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon { padding: 6px 8px; min-width: 32px; }

.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}
.input:focus, .btn:focus-visible { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea.input { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 14px; }
.field > span { font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row-between { justify-content: space-between; }
.link { font-size: 14px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border); min-height: 58px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.brand-logo { width: 28px; height: 28px; }
.topbar .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }

/* ---------- tabs, forms, auth popup ---------- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 9px; padding: 4px; margin-bottom: 20px; }
.tab { border: 0; background: transparent; padding: 8px; border-radius: 7px; font: inherit; font-size: 14px; cursor: pointer; color: var(--muted); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 0 0 10px; }
.btn-block { width: 100%; padding: 11px; }
.btn-lg { padding: 12px 22px; font-size: 15.5px; border-radius: 10px; }
.modal-auth { max-width: 420px; padding: 26px 28px 24px; }
.modal-auth h2 { text-align: center; font-size: 20px; margin-bottom: 6px; }
.auth-intro { text-align: center; font-size: 13.5px; margin: 0 0 18px !important; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin: 16px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.auth-note { text-align: center; font-size: 12px !important; margin: 10px 0 0 !important; }

/* avatar + user menu */
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-block; }
.avatar-initial { display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; }
.auth-area { display: flex; align-items: center; gap: 8px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-2); }
.user-menu-name { font-size: 14px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { color: var(--muted); font-size: 11px; }
.user-menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; display: grid; }
.user-menu-who { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--surface-2); margin-bottom: 4px; font-size: 14px; }
.user-menu-who .muted { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.user-menu-list a, .user-menu-list button { text-align: left; padding: 8px 10px; border-radius: 6px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--text); text-decoration: none; cursor: pointer; }
.user-menu-list a:hover, .user-menu-list button:hover { background: var(--surface-2); }

/* account dialog */
.account-profile { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.account-profile .muted { font-size: 13.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.account-name { font-weight: 600; font-size: 16px; }
.account-h { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 0 8px; }
.method { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--surface-2); flex-wrap: wrap; }
.method-info { display: grid; gap: 2px; font-size: 14px; flex: 1; min-width: 200px; }
.method-info .muted { font-size: 13px; }
.method .google-btn { min-height: 40px; }
.pw-form { display: grid; gap: 8px; padding: 0 0 12px; }
.pw-form .btn { justify-self: start; }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: 260px 1fr; height: calc(100% - 58px); }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; overflow-y: auto; }
.sidebar-title { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.subject-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.subject-item { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.subject-item:hover { background: var(--surface-2); }
.subject-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.subject-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subject-item .count { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 1px 8px; }
.subject-item.active .count { background: #fff; }
.subject-item .item-actions { display: none; gap: 2px; }
.subject-item:hover .item-actions { display: flex; }
.subject-item:hover .count { display: none; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 2px 5px; border-radius: 5px; color: var(--muted); font-size: 13px; }
.icon-btn:hover { background: var(--border); color: var(--text); }

.main { padding: 24px 28px; overflow-y: auto; }
.main-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.main-head h1 { font-size: 22px; flex: 1; min-width: 160px; }
.main-head .search { max-width: 260px; }
.group { margin-bottom: 30px; }
.group-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-preview { height: 96px; background: linear-gradient(135deg, #eef0ff, #e8f6f1); display: grid; place-items: center; cursor: pointer; }
.card-preview svg { width: 120px; height: 70px; opacity: .9; }
.card-body { padding: 12px 14px 6px; flex: 1; cursor: pointer; }
.card-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; overflow-wrap: anywhere; }
.card-meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.chip-shared { background: #e3f5ec; color: var(--success); }
.card-actions { display: flex; gap: 4px; padding: 8px 10px 10px; border-top: 1px solid var(--surface-2); }
.card-actions .grow { flex: 1; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 8px; }
.empty .btn { margin-top: 16px; }

.template-options { display: grid; gap: 8px; }
.template-option { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; font-size: 14px; }
.template-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 24, 40, .38); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; padding: 22px 24px; max-height: 90vh; overflow-y: auto; }
.modal-wide { max-width: 640px; }
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.modal p { margin: 0 0 12px; line-height: 1.5; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions:empty { display: none; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; }
.toast { background: #222838; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow-lg); transition: opacity .3s; }
.toast-error { background: var(--danger); }
.toast-success { background: var(--success); }
.toast.out { opacity: 0; }
@keyframes fade { from { opacity: 0; } }

/* ---------- editor ---------- */
.editor-page { display: flex; flex-direction: column; height: 100%; }
.editor-bar { gap: 10px; flex-wrap: wrap; }
.title-input { border: 1px solid transparent; background: transparent; font: inherit; font-weight: 600; font-size: 16px; padding: 6px 8px; border-radius: 6px; min-width: 120px; max-width: 320px; flex: 1; color: var(--text); }
.title-input:hover { border-color: var(--border); }
.title-input:focus { border-color: var(--accent); outline: none; background: var(--surface); }
.details-btn { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.details-btn.warn { border-color: #e8b04a; background: #fff8e8; color: #8a5a00; }

/* sidebar tree (Category › Domain › Subject) */
.subject-item.depth-1 { padding-left: 22px; }
.subject-item.depth-2 { padding-left: 38px; font-size: 13.5px; }
.tree-toggle { border: 0; background: none; padding: 0; width: 14px; color: var(--muted); cursor: pointer; font-size: 11px; flex: none; }
.tree-toggle-space { width: 14px; flex: none; }
.card-desc { margin: 0 0 8px; font-size: 13px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chip-warn { background: #fff3d6; color: #8a5a00; }
.card-meta .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* new map / details form */
textarea.map-desc { font-family: var(--font); font-size: 14px; min-height: 64px; }
.classify { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
.classify .field { margin-bottom: 8px; }
.classify-hint { grid-column: 1 / -1; font-size: 12.5px; margin: -2px 0 12px; min-height: 0; }
.modal:has(.classify) { max-width: 620px; }
@media (max-width: 640px) { .classify { grid-template-columns: 1fr; } }

/* admin screen */
.admin { max-width: 1240px; margin: 0 auto; padding: 22px 24px 40px; }
.admin-head h1 { font-size: 24px; }
.admin-head p { margin: 4px 0 16px; }
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.admin-tabs .tab { border-radius: 8px 8px 0 0; padding: 9px 16px; }
.admin-tabs .tab.active { background: var(--surface); box-shadow: none; border: 1px solid var(--border); border-bottom-color: var(--surface); margin-bottom: -1px; }
.admin-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.admin-toolbar .grow { flex: 1; }
.admin-search { max-width: 260px; }
select.admin-filter { width: auto; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: 14px; }
.admin-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); padding: 9px 12px; }
.admin-table td { padding: 9px 12px; border-top: 1px solid var(--surface-2); vertical-align: middle; }
.admin-table tr.inactive td { color: var(--muted); }
.admin-table tr.inactive .name { text-decoration: line-through; }
.admin-table .num { width: 56px; color: var(--muted); font-variant-numeric: tabular-nums; }
.admin-table .name { font-weight: 600; }
.admin-table .desc { color: var(--muted); max-width: 380px; }
.admin-table .center { text-align: center; }
.admin-table .actions { white-space: nowrap; text-align: right; }
.admin-table .small, .muted.small { font-size: 12.5px; }
.admin-two { gap: 12px; margin: 0; }
.admin-two .field { flex: 1; }
.admin-active { align-content: start; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #cfd5e3; border-radius: 22px; transition: background .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:disabled + span { opacity: .55; cursor: default; }
.switch input:focus-visible + span { outline: 2px solid var(--accent-soft); }
.save-status { font-size: 13px; color: var(--muted); min-width: 110px; }
.save-status.error { color: var(--danger); }
.toolbar { display: flex; gap: 4px; padding: 6px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.toolbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
.canvas {
  position: relative; flex: 1; overflow: hidden; background-color: var(--mm-canvas);
  background-image: radial-gradient(var(--mm-grid) 1.2px, transparent 1.2px); background-size: 22px 22px;
}
.node-editor {
  position: absolute; z-index: 5; border: 2px solid var(--accent); border-radius: 6px; padding: 6px 10px;
  background: #fff; resize: none; overflow: hidden; line-height: 1.35; box-shadow: var(--shadow-lg); outline: none;
}
.shortcuts { position: absolute; left: 14px; bottom: 14px; background: rgba(255, 255, 255, .94); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 12.5px; color: var(--muted); box-shadow: var(--shadow); max-width: 300px; }
.shortcuts summary { cursor: pointer; font-weight: 600; color: var(--text); }
.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0 0; }
.shortcuts dt { font-family: ui-monospace, Consolas, monospace; color: var(--text); }
.shortcuts dd { margin: 0; }
.zoom-controls { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.zoom-controls .btn { width: 36px; height: 36px; padding: 0; box-shadow: var(--shadow); font-size: 16px; }

/* ---------- mind map SVG ---------- */
.mm-svg { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.mm-svg.panning { cursor: grabbing; }
.mm-link { fill: none; stroke: var(--mm-link); stroke-width: 1.6; transition: opacity .35s; }
.mm-stem { stroke: var(--mm-link); stroke-width: 1.6; transition: opacity .35s; }
.mm-node { cursor: pointer; transition: opacity .35s; }
.mm-box { fill: var(--mm-d2-bg); stroke: var(--mm-d2-bd); stroke-width: 1.2; transition: stroke .15s; }
.depth-0 .mm-box { fill: var(--mm-d0-bg); stroke: var(--mm-d0-bd); }
.depth-1 .mm-box { fill: var(--mm-d1-bg); stroke: var(--mm-d1-bd); }
.depth-3 .mm-box { fill: var(--mm-d3-bg); stroke: var(--mm-d3-bd); }
.depth-4 .mm-box { fill: var(--mm-d4-bg); stroke: var(--mm-d4-bd); }
.mm-text { fill: var(--mm-text); pointer-events: none; }
.mm-node:hover .mm-box { stroke: var(--accent); }
.mm-node.selected .mm-box { stroke: var(--accent); stroke-width: 2.6; }
.mm-toggle { cursor: pointer; transition: opacity .35s; }
.mm-toggle circle { fill: var(--mm-toggle-bg); stroke: var(--mm-d1-bd); stroke-width: 1; }
.mm-toggle path { fill: none; stroke: #33405e; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mm-toggle:hover circle { fill: var(--accent); stroke: var(--accent); }
.mm-toggle:hover path { stroke: #fff; }
.mm-note-btn { cursor: pointer; }
.mm-note-btn rect { fill: transparent; }
.mm-note-btn .page { fill: rgba(255, 255, 255, .75); stroke: #33405e; stroke-width: 1.3; stroke-linejoin: round; }
.mm-note-btn .lines { fill: none; stroke: #33405e; stroke-width: 1.2; stroke-linecap: round; }
.mm-note-btn:hover rect { fill: rgba(255, 255, 255, .6); }
.mm-note-btn:hover .page { fill: #fff; stroke: var(--accent); }
.mm-anim-btn { cursor: pointer; }
.mm-anim-btn rect { fill: transparent; }
.mm-anim-btn .disc { fill: var(--accent); transition: fill .15s; }
.mm-anim-btn .play { fill: #fff; }
.mm-anim-btn:hover .disc { fill: var(--accent-hover); }
.mm-video-btn { cursor: pointer; }
.mm-video-btn rect { fill: transparent; }
.mm-video-btn .screen { fill: #e5484d; transition: fill .15s; }
.mm-video-btn .play { fill: #fff; }
.mm-video-btn:hover .screen { fill: #c9363b; }
.dim { opacity: .28; }
.enter { animation: mm-enter .5s ease both; }
@keyframes mm-enter { from { opacity: 0; } }

/* ---------- presenter ---------- */
.present-page { height: 100%; overflow: hidden; background: radial-gradient(circle at 30% 20%, #f1f2ff 0, #fbfbfe 55%); }
.present-page .canvas { position: fixed; inset: 0; background-color: transparent; }
.present-title { position: fixed; top: 16px; left: 20px; z-index: 10; pointer-events: none; }
.present-title h1 { font-size: 18px; }
.present-title p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.present-bar {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 4px; background: rgba(34, 40, 56, .92); color: #fff;
  border-radius: 999px; padding: 6px 8px; box-shadow: var(--shadow-lg); transition: opacity .4s;
}
.present-bar.idle { opacity: 0; }
.present-bar button { background: transparent; border: 0; color: #fff; font: inherit; font-size: 14px; padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.present-bar button:hover { background: rgba(255, 255, 255, .14); }
.present-bar button:disabled { opacity: .35; cursor: default; background: transparent; }
.present-bar .step { font-size: 13px; padding: 0 10px; min-width: 64px; text-align: center; color: #c9cee0; font-variant-numeric: tabular-nums; }
.present-bar .sep { width: 1px; height: 18px; background: rgba(255, 255, 255, .2); margin: 0 4px; }
.progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--accent); z-index: 11; transition: width .4s; }
.present-error { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; }

/* ---------- topic notes ---------- */
.note-pop {
  position: fixed; z-index: 150; width: min(600px, calc(100vw - 32px)); max-height: min(75vh, 720px);
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop-in .16s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.note-pop-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px 18px; border-bottom: 1px solid var(--surface-2); cursor: move; user-select: none; -webkit-user-select: none; touch-action: none; flex: none; }
.note-pop-head h3 { flex: 1; font-size: 15px; overflow-wrap: anywhere; }
.note-pop-head .btn, .note-pop-head .icon-btn { cursor: pointer; }
.note-pop .note-content { padding: 12px 18px 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.note-pop.settled { animation: none; } /* pop-in plays once; never replays after a move/resize */
.note-pop.moving, .note-pop.resizing { box-shadow: 0 18px 60px rgba(20, 24, 40, .28); }
.note-pop.moving { opacity: .97; }
.note-pop.resizing, .note-pop.moving { user-select: none; -webkit-user-select: none; }
.pop-resize {
  position: absolute; right: 2px; bottom: 2px; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none; border-radius: 0 0 10px 0;
  background: linear-gradient(135deg, transparent 0 45%, #b6bdd0 45% 52%, transparent 52% 64%, #b6bdd0 64% 71%, transparent 71% 83%, #b6bdd0 83% 90%, transparent 90%);
}
.pop-resize:hover { background-color: var(--accent-soft); }
.note-content { font-size: 14.5px; line-height: 1.6; color: var(--text); overflow-wrap: break-word; }
.note-content > :first-child, .md > :first-child { margin-top: 0; }
.note-content > :last-child, .md > :last-child { margin-bottom: 0; }
.note-content code { font-family: ui-monospace, Consolas, monospace; font-size: .88em; background: var(--surface-2); padding: .15em .4em; border-radius: 4px; }

/* Markdown (GitHub-like) */
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 20px 0 10px; line-height: 1.3; font-weight: 650; }
.md h1 { font-size: 1.55em; padding-bottom: .25em; border-bottom: 1px solid var(--border); }
.md h2 { font-size: 1.3em; padding-bottom: .25em; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 1.15em; }
.md h4 { font-size: 1em; }
.md h5, .md h6 { font-size: .92em; color: var(--muted); }
.md ul, .md ol { margin: 0 0 12px; padding-left: 1.7em; }
.md li { margin: 3px 0; }
.md li > p { margin: 0 0 4px; }
.md li > ul, .md li > ol { margin: 4px 0 0; }
.md li:has(> input[type=checkbox]) { list-style: none; margin-left: -1.3em; }
.md li > input[type=checkbox] { margin: 0 .45em 0 0; vertical-align: -1px; }
.md blockquote { margin: 0 0 12px; padding: 4px 14px; color: var(--muted); border-left: 4px solid var(--border); }
.md blockquote > :last-child { margin-bottom: 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md img { max-width: 100%; border-radius: 6px; }
.md del { color: var(--muted); }
.md-table { overflow-x: auto; margin: 0 0 14px; }
.md table { border-collapse: collapse; font-size: .95em; min-width: 50%; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 12px; text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); font-weight: 600; }
.md tr:nth-child(even) td { background: #fafbfd; }
.md-plain { white-space: pre-wrap; }
.md-missing-img { color: var(--muted); font-style: italic; }
.md .code-block { margin: 4px 0 14px; }

/* full note reader */
.reader-backdrop { position: fixed; inset: 0; z-index: 300; background: rgba(20, 24, 40, .5); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.reader { width: min(1100px, 100%); height: 100%; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.reader-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px 14px 32px; border-bottom: 1px solid var(--border); }
.reader-head h2 { flex: 1; font-size: 19px; overflow-wrap: anywhere; }
.reader-body { flex: 1; overflow-y: auto; outline: none; }
.reader-content { max-width: 880px; margin: 0 auto; padding: 28px 32px 48px; }
.reader-content .note-content { font-size: 15.5px; line-height: 1.7; }
.reader-content .note-image img { max-height: 70vh; }
.reader-content.reader-wide { max-width: 1040px; }

/* ---------- topic videos ---------- */
.video-pop { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.video-pop-body { padding: 10px 12px 14px; flex: 1 1 auto; min-height: 0; display: flex; }
.video-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; background: #000; }
/* Resized (or full size): the player fills the window. */
.video-pop.sized .video-frame, .video-pop.video-full .video-frame { aspect-ratio: auto; height: 100%; }
/* The iframe would swallow the pointer while the window is dragged or resized. */
.note-pop.moving iframe, .note-pop.resizing iframe { pointer-events: none; }
.note-pop.video-full {
  left: 0 !important; top: 0 !important; width: 100vw !important; height: 100vh !important; max-height: none;
  border-radius: 0; border: 0; z-index: 250;
}
.note-pop.video-full .note-pop-head { cursor: default; }
.note-pop.video-full .video-pop-body { padding: 0; background: #000; }
.note-pop.video-full .video-frame { border-radius: 0; }
.note-pop.video-full .pop-resize { display: none; }
/* editor dialog */
.video-edit { display: grid; gap: 10px; }
.video-edit .video-link { font-family: ui-monospace, Consolas, monospace; font-size: 13px; resize: vertical; }
.video-status { margin: -4px 0 0; font-size: 13px; }
.video-status.ok { color: #1f8a4c; }
.video-status.bad { color: #c62f35; }
.video-preview .video-frame { max-height: 42vh; }
.video-empty { aspect-ratio: 16 / 9; max-height: 42vh; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); background: var(--surface-2); }

/* ---------- topic animations ---------- */
.anim-pop { width: min(680px, calc(100vw - 32px)); }
.anim-pop-body { padding: 10px 14px 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* Resized animation popup: the diagram grows with it (caption and controls keep their size). */
.anim-pop.sized .anim-pop-body { overflow: hidden; }
.anim-pop.sized .anim-player { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.anim-pop.sized .anim-stage { flex: 1; min-height: 0; display: flex; }
.anim-pop.sized .anim-svg { height: 100%; max-height: none; }
.anim-player { display: grid; gap: 10px; }
.anim-title { font-weight: 600; font-size: 14.5px; color: var(--muted); }
.anim-stage { background: var(--mm-canvas); border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.anim-svg { display: block; width: 100%; height: auto; max-height: 62vh; }
.anim-reader .anim-svg { max-height: 68vh; }
.anim-reader .anim-caption { font-size: 16px; }
.anim-caption { min-height: 44px; display: flex; gap: 10px; align-items: baseline; font-size: 14.5px; line-height: 1.45; padding: 0 2px; }
.anim-stepno { flex: none; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; }
.anim-controls { display: flex; align-items: center; gap: 4px; background: #222838; border-radius: 10px; padding: 6px 10px; color: #fff; }
.anim-btn { border: 0; background: transparent; color: #fff; width: 32px; height: 30px; border-radius: 6px; display: inline-grid; place-items: center; cursor: pointer; font: inherit; }
.anim-btn:hover { background: rgba(255, 255, 255, .14); }
.anim-speed { width: auto; padding: 0 8px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.anim-progress { position: relative; flex: 1; height: 8px; margin: 0 8px; border-radius: 4px; background: #4b5266; cursor: pointer; }
.anim-progress-fill { height: 100%; width: 0; border-radius: 4px; background: #7e8aff; }
.anim-tick { position: absolute; top: 0; width: 2px; height: 100%; background: #222838; transform: translateX(-1px); }

/* SVG drawing (inline in the player and the studio, so these classes apply) */
.anim-svg text, .studio-svg text { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; }
.anim-node { --fill: #bdd5f0; --edge: #9dbde3; --ink: #2f4f7f; }
.c-blue { --fill: #bdd5f0; --edge: #9dbde3; --ink: #2f4f7f; }
.c-green { --fill: #a5ddd0; --edge: #79c2ae; --ink: #1f6b57; }
.c-purple { --fill: #c5c9fb; --edge: #a2a8ef; --ink: #3f46a8; }
.c-yellow { --fill: #f6e2a8; --edge: #ddc070; --ink: #7a5a00; }
.c-pink { --fill: #f6c9d8; --edge: #e2a0b8; --ink: #8c2f53; }
.c-gray { --fill: #e3e6ee; --edge: #bfc5d3; --ink: #3e4658; }
.c-white { --fill: #ffffff; --edge: #cfd5e3; --ink: #3e4658; }
.anim-body { fill: var(--fill); stroke: var(--edge); stroke-width: 1.5; transition: fill .3s; }
.s-icon .anim-body { fill: transparent; stroke: transparent; }
.s-icon.no-icon .anim-body { stroke: var(--edge); stroke-dasharray: 4 4; }
.anim-node.pending .anim-body { fill: #fff; }
.s-icon.pending .anim-body { fill: transparent; }
.anim-node.source .anim-body { stroke: var(--accent); stroke-dasharray: 4 3; }
.anim-icon { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--ink); }
.anim-hl { fill: none; stroke: var(--accent); stroke-width: 3; opacity: 0; transition: opacity .25s; }
.anim-node.active .anim-hl { opacity: 1; }
.anim-node.done .anim-hl { opacity: 1; stroke: var(--success); }
.anim-node.pulse .anim-hl { animation: anim-pulse 1s ease-in-out infinite; }
@keyframes anim-pulse { 50% { stroke-width: 7; stroke-opacity: .45; } }
.anim-label { font-size: 14px; font-weight: 600; fill: var(--mm-text); text-anchor: middle; }
.anim-detail { font: 11.5px Consolas, ui-monospace, monospace; fill: var(--muted); text-anchor: middle; }
.anim-route { fill: none; stroke: #9fb0d4; stroke-width: 1.8; transition: stroke .2s; }
.anim-link.dashed .anim-route { stroke-dasharray: 6 5; }
.anim-arrow { fill: #8597c0; }
.anim-link.active .anim-route { stroke: var(--accent); }
.anim-link.active .anim-arrow { fill: var(--accent); }
.anim-link-label-bg { fill: #fff; stroke: #dfe3ee; }
.anim-link-label { font-size: 12px; fill: #4a5470; text-anchor: middle; }
.anim-token rect { fill: var(--accent); }
.anim-token text { font: 600 12px Consolas, ui-monospace, monospace; fill: #fff; text-anchor: middle; dominant-baseline: central; }

/* animation studio (visual diagram editor) */
.modal-studio { max-width: 1440px; width: 98vw; max-height: 97vh; padding: 14px 18px 12px; }
.modal-studio h2 { margin-bottom: 8px; }
.studio { display: grid; gap: 8px; }
.studio-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.studio-title { flex: 1; min-width: 200px; width: auto; padding: 6px 10px; }
.ae-check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
select.studio-speed, select.studio-template-select { width: auto; padding: 6px 8px; }
.studio-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px; background: var(--surface-2); border-radius: 10px; }
.studio-toolbar .grow { flex: 1; }
.studio-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.studio-tool { gap: 5px; background: var(--surface); }
.studio-tool:disabled { opacity: .45; }
.studio-tool.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.studio-main { display: grid; grid-template-columns: 148px minmax(0, 1fr) 300px; gap: 10px; height: clamp(340px, calc(97vh - 215px), 740px); }
.studio-palette { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.studio-pal-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 2px; }
.studio-pal-hint { font-size: 11.5px; margin: -2px 0 2px; line-height: 1.35; }
.studio-shapes { display: grid; gap: 4px; }
.studio-shape-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 4px 8px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text); text-align: left; }
.studio-shape-btn:hover, .studio-icon-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.studio-shape-pic svg { width: 34px; height: 20px; display: block; }
.studio-shape-pic rect, .studio-shape-pic circle, .studio-shape-pic polygon { fill: #bdd5f0; stroke: #9dbde3; stroke-width: 1.4; }
.studio-shape-pic .ghost { fill: none; stroke: #2f4f7f; stroke-width: 1.6; }
.studio-shape-pic path { stroke: #9aa3b8; stroke-width: 2; }
.studio-icons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.studio-icon-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 7px; padding: 4px 0; display: grid; place-items: center; cursor: pointer; }
.studio-icon-btn svg, .studio-icon-row svg { fill: none; stroke: #33405e; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.studio-stage { min-height: 0; display: grid; }
.studio-side { min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.studio-tabs { margin-bottom: 0; }
.studio-panel { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding: 2px 4px 4px 2px; }
.studio-panel-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.studio-field { display: grid; gap: 4px; font-size: 13px; }
.studio-field > span { font-weight: 600; color: var(--muted); font-size: 12px; }
.studio-field .input { padding: 6px 9px; font-size: 13.5px; }
.studio-mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px !important; }
.studio-seg { display: flex; flex-wrap: wrap; gap: 3px; }
.studio-seg button { flex: 1 0 auto; border: 1px solid var(--border); background: var(--surface); border-radius: 7px; padding: 5px 8px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text); }
.studio-seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.studio-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.studio-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--edge); background: var(--fill); cursor: pointer; }
.studio-swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.studio-icon-row { display: flex; align-items: center; gap: 8px; }
.studio-small { font-size: 12px; margin: 0; }
.studio-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.studio-wide { width: 100%; }
.studio-link-ends { margin: 0; font-size: 13.5px; }
.studio-curve { display: flex; gap: 8px; align-items: center; }
.studio-range { flex: 1; accent-color: var(--accent); }
.studio-tips { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: var(--text); }
.studio-canvas { position: relative; height: 100%; min-height: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; outline: none; background: #fbfbfe; }
.studio-canvas:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.studio-svg { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.studio-svg .anim-node { cursor: grab; }
.studio-canvas.dragging .anim-node { cursor: grabbing; }
.studio-canvas.connect-mode .anim-node { cursor: crosshair; }
.studio-svg .anim-node:hover .anim-body { stroke: var(--accent); }
.studio-svg .s-icon:hover .anim-body { stroke: var(--accent); stroke-dasharray: 4 4; }
.studio-svg .anim-node.selected .anim-hl, .studio-svg .anim-node.connecting .anim-hl { opacity: 1; stroke-dasharray: 6 4; }
.studio-svg .anim-node.connecting .anim-hl { stroke: var(--success); }
.anim-hit { fill: none; stroke: transparent; stroke-width: 16; cursor: pointer; }
.studio-svg .anim-link:hover .anim-route { stroke: var(--accent); }
.studio-svg .anim-link.selected .anim-route { stroke: var(--accent); stroke-width: 3; }
.studio-svg .anim-link.selected .anim-arrow { fill: var(--accent); }
.anim-connect-handle { cursor: crosshair; }
.anim-connect-handle circle { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.anim-connect-handle path { stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.anim-bend-handle { cursor: move; }
.anim-bend-handle circle { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.anim-rubber { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; pointer-events: none; }
.anim-canvas-bg { fill: #fbfbfe; }
.studio-hint { position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, .92); padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.studio-canvas.connect-mode .studio-hint { color: #fff; background: var(--accent); }
.studio-textedit { position: absolute; z-index: 5; display: grid; gap: 4px; padding: 6px; background: #fff; border: 2px solid var(--accent); border-radius: 10px; box-shadow: var(--shadow-lg); }
.studio-textedit .input { padding: 6px 9px; font-size: 14px; }
.studio-preview { min-height: 0; overflow-y: auto; }
.studio-preview .anim-svg { max-height: calc(97vh - 400px); min-height: 200px; }
.studio-steps { display: flex; flex-direction: column; gap: 8px; }
.studio-step { display: grid; gap: 6px; padding: 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.studio-step.focused { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.studio-step-head { display: flex; gap: 6px; align-items: center; }
.studio-step-head .grow { flex: 1; }
.studio-step-head .icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.studio-step-n { flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.studio-step .input { padding: 6px 9px; font-size: 13px; }
.code-block { margin: 6px 0 12px; border-radius: 8px; overflow: hidden; background: #1e2433; }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 4px 12px; background: #2a3145; color: #aab2c8; font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
.code-copy { border: 0; background: transparent; color: #aab2c8; font: inherit; font-size: 12px; padding: 3px 8px; border-radius: 4px; cursor: pointer; }
.code-copy:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.code-block code { background: none; padding: 0; color: #e6e9f2; font-size: 13px; line-height: 1.55; white-space: pre; }
.code-block pre code.hljs { background: none; padding: 0; display: inline; overflow: visible; color: #e6e9f2; }
.note-tabs { display: inline-grid; width: 200px; margin-bottom: 0; }
.nb-tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.note-preview { min-height: 300px; max-height: 62vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 14px 18px; }
.note-hint { font-size: 12.5px; margin: 10px 0 0 !important; }
.note-content .md + .md { margin-top: 12px; }
.note-image { margin: 6px 0 12px; }
.note-image img { display: block; max-width: 100%; max-height: 420px; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; }
.note-image figcaption { font-size: 12.5px; color: var(--muted); margin-top: 5px; text-align: center; }
.note-link {
  display: flex; align-items: center; gap: 12px; margin: 6px 0 12px; padding: 10px 14px; text-decoration: none;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); transition: border-color .15s;
}
.note-link:hover { border-color: var(--accent); }
.note-link-icon { font-size: 18px; }
.note-link-text { flex: 1; min-width: 0; display: grid; }
.note-link-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-link-text small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-link-go { color: var(--accent); font-size: 16px; }

/* block note editor */
.modal-xl { max-width: 860px; }
.nb-list { display: grid; gap: 12px; max-height: max(180px, calc(90vh - 300px)); overflow-y: auto; padding: 2px 4px 2px 0; }
.nb-card { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.nb-card:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nb-flash { animation: nb-flash .8s ease-out; }
@keyframes nb-flash { from { box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent); } }
.nb-head { display: flex; align-items: center; gap: 2px; padding: 5px 8px 5px 12px; border-bottom: 1px solid var(--surface-2); background: var(--bg); border-radius: 10px 10px 0 0; }
.nb-head .grow { flex: 1; }
.nb-head .icon-btn { padding: 4px 7px; display: inline-grid; place-items: center; }
.nb-head .icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.nb-type { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.nb-body { padding: 10px 12px 12px; display: grid; gap: 8px; }
.nb-body > div { display: grid; gap: 8px; }
.nb-body textarea { min-height: 70px; resize: vertical; }
.nb-text { font-family: var(--font) !important; font-size: 14px !important; line-height: 1.5; }
textarea.nb-code { background: #1e2433; color: #e6e9f2; border-color: #1e2433; line-height: 1.5; min-height: 120px; }
textarea.nb-code::placeholder { color: #8a93ab; }
.nb-row { display: flex !important; align-items: center; gap: 8px; flex-wrap: wrap; }
.nb-row .input[type=url] { flex: 1; min-width: 200px; width: auto; }
.nb-lang { width: 180px; padding: 5px 10px; font-size: 13px; }
.nb-status { font-size: 13px; }
.nb-drop {
  min-height: 110px; border: 2px dashed var(--border); border-radius: 10px; display: grid; place-items: center;
  background: var(--bg); text-align: center; padding: 10px; outline: none;
}
.nb-drop:focus, .nb-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.nb-drop.has-image { border-style: solid; padding: 6px; }
.nb-drop img { max-width: 100%; max-height: 260px; border-radius: 6px; }
.nb-drop-hint { display: grid; gap: 2px; color: var(--muted); font-size: 13.5px; }
.nb-drop-hint strong { color: var(--text); }
.nb-link-fields { display: grid; gap: 8px; }
.nb-add { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.nb-add .grow { flex: 1; }
.nb-empty { text-align: center; padding: 24px; }

/* ---------- marketplace home page ---------- */
.market { background: var(--bg); }
.site-header {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 20px; padding: 12px 32px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.site-header .spacer { flex: 1; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 14.5px; padding: 6px 10px; border-radius: 6px; }
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; max-width: 1180px; margin: 0 auto;
  padding: 64px 32px 48px;
}
.eyebrow { display: inline-block; font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; margin-bottom: 14px; }
.hero h1 { font-size: clamp(30px, 4.4vw, 48px); line-height: 1.1; letter-spacing: -.02em; margin-bottom: 16px; }
.hero-sub { font-size: 17px; line-height: 1.6; color: var(--muted); margin: 0 0 26px; max-width: 540px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-art { background: linear-gradient(135deg, #eef0ff, #e8f6f1); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.hero-art svg { width: 100%; height: auto; display: block; }
.section { max-width: 1180px; margin: 0 auto; padding: 32px 32px 48px; }
.section h2 { font-size: 26px; letter-spacing: -.01em; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.course-search { max-width: 280px; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.course-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.course-cover { aspect-ratio: 16 / 9; background: linear-gradient(135deg, #c5c9fb, #a5ddd0); display: grid; place-items: center; overflow: hidden; }
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-cover-letter { font-size: 44px; font-weight: 700; color: rgba(29, 36, 51, .55); }
.course-body { padding: 14px 16px 8px; flex: 1; }
.course-body h3 { font-size: 16.5px; margin-bottom: 2px; }
.course-creator { font-size: 13px; margin: 0 0 8px; }
.course-desc { font-size: 14px; line-height: 1.5; margin: 0; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.course-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 14px; }
.course-price { font-weight: 700; font-size: 16px; }
.course-empty { grid-column: 1 / -1; text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: 14px; padding: 48px 24px; }
.course-empty-icon { font-size: 38px; margin-bottom: 8px; }
.course-empty h3 { font-size: 19px; margin-bottom: 6px; }
.course-empty p { max-width: 460px; margin: 0 auto 16px; line-height: 1.55; }
.how h2 { margin-bottom: 20px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.step h3 { font-size: 16.5px; margin: 10px 0 6px; display: flex; gap: 8px; align-items: center; }
.step p { margin: 0; line-height: 1.55; font-size: 14.5px; }
.step-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.how-cta { text-align: center; margin-top: 28px; }
.site-footer { border-top: 1px solid var(--border); padding: 22px 32px; color: var(--muted); font-size: 13.5px; text-align: center; }

@media (max-width: 1100px) {
  .studio-tool span { display: none; }
  .studio-main { grid-template-columns: 1fr; height: auto; }
  .studio-palette { max-height: 150px; }
  .studio-shapes { grid-template-columns: repeat(5, 1fr); }
  .studio-icons { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); }
  .studio-canvas { height: 340px; }
  .studio-panel { max-height: 320px; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 40px 16px 24px; }
  .hero-art { display: none; }
  .site-header { padding: 10px 16px; gap: 10px; }
  .site-nav { display: none; }
  .section { padding: 24px 16px 36px; }
  .user-menu-name { display: none; }
}

@media (max-width: 760px) {
  .dash { grid-template-columns: 1fr; height: auto; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .main { padding: 18px 16px; }
  .shortcuts { display: none; }
  .toolbar .label { display: none; }
}

/* ---------- visibility, price, likes, subscriptions ---------- */
.vis-badge { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.vis-badge.is-private { background: var(--surface-2); color: var(--muted); }
.vis-badge.is-public { background: var(--accent-soft); color: var(--accent); }
.card-meta + .card-meta { margin-top: 6px; }
.card-meta .stat { white-space: nowrap; }
.card-by { font-size: 12.5px; color: var(--muted); margin: -2px 0 6px; }

.vis-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vis-option { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 10px; cursor: pointer; }
.vis-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.vis-option input { margin-top: 3px; }
.vis-option span { display: flex; flex-direction: column; gap: 2px; }
.vis-option small { color: var(--muted); font-size: 12px; }
.price-row { display: flex; align-items: center; gap: 6px; }
.price-prefix { font-weight: 600; color: var(--muted); }
input.price-input { max-width: 160px; }

.dash-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.dash-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; font: inherit; font-size: 14.5px; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.dash-tab:hover { color: var(--text); }
.dash-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.dash-tab .count { font-size: 11.5px; background: var(--surface-2); color: var(--muted); border-radius: 10px; padding: 1px 7px; margin-left: 4px; font-weight: 400; }

.market-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 18px; }
select.market-select { width: auto; min-width: 150px; max-width: 220px; }
.market-card { cursor: pointer; }
.market-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.course-cover { position: relative; }
.price-tag { position: absolute; top: 10px; right: 10px; background: rgba(255, 255, 255, .92); color: var(--success); font-weight: 700; font-size: 13px; padding: 3px 10px; border-radius: 12px; }
.price-tag.paid { color: var(--text); }
.price-tag.inline { position: static; background: var(--surface-2); font-size: 12px; padding: 2px 9px; }
.market-chip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 8px; }
.course-foot { gap: 8px; }
.course-foot .grow, .market-detail-actions .grow { flex: 1; }
.market-topics { font-size: 12.5px; }
.like-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--surface); border-radius: 16px; padding: 4px 10px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.like-btn:hover:not(:disabled) { border-color: #e2a0b8; color: #c2185b; }
.like-btn.liked { border-color: #f6c9d8; background: #fdeef3; color: #c2185b; }
.like-btn .heart { font-size: 15px; line-height: 1; }
.like-btn:disabled { cursor: default; opacity: .8; }
.market-detail .card-meta { margin-bottom: 12px; }
.market-desc { white-space: pre-wrap; line-height: 1.55; }
.market-outline h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 6px; }
.market-outline ul { margin: 0; padding-left: 20px; columns: 2; column-gap: 24px; }
.market-outline li { margin-bottom: 4px; break-inside: avoid; }
.pay-note { background: #fff8e6; border: 1px solid #f1dfa8; color: #7a5a00; border-radius: var(--radius); padding: 8px 12px; font-size: 13px; }
.market-detail-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.present-error .btn { margin-top: 12px; }
@media (max-width: 560px) {
  .vis-options { grid-template-columns: 1fr; }
  .market-outline ul { columns: 1; }
  select.market-select { flex: 1 1 140px; max-width: none; }
}

/* ---------- project management (/projects, /project/{id}) ---------- */
.active-nav { background: var(--accent-soft); color: var(--accent); }
.pm-main { max-width: 1280px; margin: 0 auto; padding: 22px 28px; }
.pm-totals { display: flex; gap: 10px; margin: 4px 0 10px; }
.pm-total { background: var(--surface-2); border-radius: 8px; padding: 6px 10px; display: grid; min-width: 90px; }
.pm-total span { font-size: 11.5px; color: var(--muted); }
.pm-total strong { font-size: 16px; }
.pm-chip-mine { background: #e3f5ec; color: var(--success); }
.pm-card .card-body { cursor: pointer; }
.pm-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pm-team .card-body { cursor: default; }
.pm-members { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.pm-members li { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 0; border-bottom: 1px solid var(--surface-2); }
.pm-members li .grow { flex: 1; }
.pm-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.pm-avatar.sm { width: 18px; height: 18px; font-size: 10px; }
.pm-add-member .input { flex: 1; }

/* The project screen is its own fixed full-window column, so elements that browser extensions
   append to <body> can't take space from it (they used to shrink the tree and panel). */
body.pm-page { height: 100%; overflow: hidden; }
.pm-shell { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.pm-title { display: flex; align-items: center; gap: 8px; min-width: 0; margin-left: 8px; }
.pm-title strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.pm-toolbar { gap: 6px; }
.pm-owner-tools { display: flex; align-items: center; gap: 4px; }
.pm-toolbar .icon-btn { font-size: 16px; padding: 3px 8px; }
.pm-toolbar .spacer { flex: 1; }
.pm-filter { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.pm-filter select.input { width: auto; padding: 4px 8px; font-size: 13px; }
.pm-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.pm-layout { flex: 1; display: flex; min-height: 0; }
.pm-canvas-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pm-canvas { flex: 1; overflow: hidden; touch-action: none; background: var(--mm-canvas); background-image: radial-gradient(var(--mm-grid) 1px, transparent 1px); background-size: 22px 22px; cursor: grab; position: relative; }
.pm-canvas.panning { cursor: grabbing; user-select: none; }
.pm-sizer { position: relative; }
.pm-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.pm-links { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.pm-link { fill: none; stroke: var(--mm-link); stroke-width: 1.6; }
.pm-link.dim { opacity: .25; }
.pm-node { position: absolute; max-width: 260px; min-width: 120px; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--mm-d2-bd); background: var(--mm-d2-bg); color: var(--mm-text); cursor: pointer; box-shadow: 0 1px 2px rgba(20, 24, 40, .06); transition: box-shadow .15s, opacity .15s; font-size: 13.5px; outline: none; }
.pm-node.depth-0 { background: var(--mm-d0-bg); border-color: var(--mm-d0-bd); font-size: 15px; padding: 10px 14px; }
.pm-node.depth-1 { background: var(--mm-d1-bg); border-color: var(--mm-d1-bd); }
.pm-node.depth-3 { background: var(--mm-d3-bg); border-color: var(--mm-d3-bd); }
.pm-node.depth-4 { background: var(--mm-d4-bg); border-color: var(--mm-d4-bd); }
.pm-node.leaf { background: #fff; }
.pm-node:hover { box-shadow: 0 2px 10px rgba(20, 24, 40, .12); }
.pm-node.selected { box-shadow: 0 0 0 3px var(--accent); }
.pm-node.mine { border-left: 5px solid var(--success); }
.pm-node.dim { opacity: .35; }
.pm-node-title { font-weight: 600; line-height: 1.3; overflow-wrap: break-word; min-width: 0; }
.pm-node-nums { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pm-num { font-size: 12px; background: rgba(255, 255, 255, .7); border: 1px solid rgba(0, 0, 0, .06); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.pm-num small { color: var(--muted); font-size: 10.5px; }
.pm-num.sum { font-weight: 700; background: rgba(255, 255, 255, .85); }
.pm-node.leaf .pm-num { background: var(--surface-2); }
.pm-node-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--muted); align-items: center; }
.pm-who { display: inline-flex; align-items: center; gap: 4px; }
.pm-who.none { color: #b07400; }
.pm-sprint { background: #eef0f7; border-radius: 6px; padding: 0 6px; }
.pm-toggle { position: absolute; right: -11px; top: 50%; transform: translateY(-50%); min-width: 22px; height: 22px; border-radius: 11px; border: 1px solid var(--mm-d1-bd); background: var(--mm-toggle-bg); font-size: 11px; font-weight: 700; color: var(--mm-text); cursor: pointer; padding: 0 5px; line-height: 1; }
.pm-c-blue { background: #d6e6fb !important; border-color: #8fb3e6 !important; }
.pm-c-green { background: #d4f1e6 !important; border-color: #79c2ae !important; }
.pm-c-purple { background: #e2e4fd !important; border-color: #a2a8ef !important; }
.pm-c-yellow { background: #fbefc8 !important; border-color: #ddc070 !important; }
.pm-c-pink { background: #fbe1ea !important; border-color: #e2a0b8 !important; }
.pm-c-gray { background: #eceef3 !important; border-color: #bfc5d3 !important; }
.pm-summary { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 16px; background: var(--surface); border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pm-summary strong { color: var(--text); }
.warn-text { color: #b07400; }

.pm-panel { width: 340px; flex: none; border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; padding: 16px 18px; }
.pm-path { font-size: 12px; color: var(--muted); margin-bottom: 6px; overflow-wrap: anywhere; }
input.pm-title-input { font-size: 17px; font-weight: 600; }
.pm-panel-title { font-size: 18px; margin: 0; overflow-wrap: anywhere; }
.pm-kind { font-size: 12px; color: var(--muted); margin: 6px 0 14px; }
.pm-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; background: var(--surface-2); }
.pm-box.editable { background: #f1faf6; border-color: #bfe5d4; }
.pm-box-title { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.pm-dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: 14px; }
.pm-dl dt { color: var(--muted); }
.pm-dl dd { margin: 0; font-weight: 700; text-align: right; }
.pm-value-row { display: grid; grid-template-columns: 1fr 120px 36px; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 13.5px; }
.pm-value-row .input { padding: 5px 8px; }
.pm-value-row em { font-style: normal; color: var(--muted); font-size: 12px; }
.pm-value-row.ro strong { text-align: right; }
.pm-hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.pm-hint.ok { color: var(--success); }
.pm-text { margin: 0; white-space: pre-wrap; font-size: 14px; }
.pm-swatches { display: flex; gap: 6px; }
.pm-swatch { width: 24px; height: 24px; border-radius: 6px; border: 1.5px solid var(--border); cursor: pointer; background: #fff; }
.pm-swatch.none { background: linear-gradient(135deg, #fff 45%, var(--danger) 47%, var(--danger) 53%, #fff 55%); }
.pm-swatch.on { box-shadow: 0 0 0 2px var(--accent); }
.pm-panel-actions .grow { flex: 1; }

.pm-sprint-row { display: grid; grid-template-columns: 1fr 150px 150px auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.pm-field-row { display: grid; grid-template-columns: 28px 1fr 90px 150px; gap: 8px; align-items: center; margin-bottom: 6px; }
.pm-field-row small { font-size: 11.5px; }
.pm-field-row .icon-btn { justify-self: start; }
input.pm-unit, select.pm-type { width: 100%; }
.pm-field-row.custom { grid-template-columns: 28px 1fr 90px 150px 28px; }
@media (max-width: 860px) {
  .pm-layout { flex-direction: column; }
  .pm-panel { width: auto; max-height: 45vh; border-left: 0; border-top: 1px solid var(--border); }
  .pm-sprint-row, .pm-field-row { grid-template-columns: 1fr 1fr; }
}

/* project management: camera view, notes, presenter */
.pm-canvas.pm-camera .pm-stage { will-change: transform; }
.pm-node-head { display: flex; align-items: flex-start; gap: 6px; }
.pm-node-head .pm-node-title { flex: 1; }
.pm-note-btn { border: 0; background: rgba(255, 255, 255, .75); border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 1; padding: 3px 4px; margin: -2px -4px 0 0; }
.pm-note-btn:hover { background: #fff; box-shadow: 0 0 0 1px var(--accent); }
.pm-note-preview { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; background: var(--surface); font-size: 13.5px; }
.pm-present-page .pm-present-canvas { position: fixed; inset: 0; background: transparent; background-image: none; cursor: grab; }
.pm-present-page .pm-node { font-size: 14.5px; }
.pm-present-page .pm-node.depth-0 { font-size: 17px; }
.pm-create-member { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; font-size: 13px; }
.pm-pass-row { margin-top: 0; }
.pm-pass-row .input { flex: 1; font-family: Consolas, monospace; }
.pm-credentials { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; white-space: pre-wrap; user-select: all; }
.pm-assign-list { margin-top: 10px; max-height: 50vh; overflow-y: auto; display: grid; gap: 2px; }
.pm-assign-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 4px; }
.pm-assign-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid transparent; background: none; border-radius: 8px; padding: 6px 8px; cursor: pointer; font: inherit; text-align: left; color: var(--text); }
.pm-assign-item:hover { background: var(--surface-2); }
.pm-assign-item.on { border-color: var(--accent); background: var(--accent-soft); }
.pm-assign-item .grow { flex: 1; }
/* estimated vs actual time: remaining (green) / exceeded (red) */
.pm-rem { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 7px; white-space: nowrap; display: inline-block; }
.pm-rem.ok { background: #dcf3e7; color: #17794b; border: 1px solid #a9dcc0; }
.pm-rem.over { background: #fde2e2; color: #b42318; border: 1px solid #f4b0b0; }
.pm-node.pm-over { box-shadow: inset 0 -3px 0 #e5484d; }
.pm-node.pm-over.selected { box-shadow: 0 0 0 3px var(--accent), inset 0 -3px 0 #e5484d; }
.pm-node.pm-ontrack { box-shadow: inset 0 -3px 0 #30a46c; }
.pm-node.pm-ontrack.selected { box-shadow: 0 0 0 3px var(--accent), inset 0 -3px 0 #30a46c; }
.pm-dl dd .pm-rem { font-size: 13px; }
.pm-rem-row .pm-rem { justify-self: end; }
.pm-est-row { display: flex; align-items: center; gap: 8px; }
.pm-est-row .input { max-width: 160px; }
.pm-est-row em { font-style: normal; color: var(--muted); font-size: 12px; }
.pm-total.ok { background: #dcf3e7; }
.pm-total.ok strong { color: #17794b; }
.pm-total.over { background: #fde2e2; }
.pm-total.over strong, .pm-total.over span { color: #b42318; }
/* task discussions */
.pm-comment-btn { border: 0; background: rgba(255, 255, 255, .75); border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 1; padding: 3px 5px; margin: -2px -4px 0 0; display: inline-flex; align-items: center; gap: 3px; position: relative; }
.pm-comment-btn:hover { background: #fff; box-shadow: 0 0 0 1px var(--accent); }
.pm-comment-btn.empty, .pm-comment-btn.locked { opacity: .45; }
.pm-comment-btn.empty:hover, .pm-comment-btn.locked:hover { opacity: 1; }
.pm-comment-count { font-size: 11px; font-weight: 700; color: var(--muted); }
.pm-comment-btn.unread { background: #fff4e5; box-shadow: 0 0 0 2px #f59e0b; animation: pm-ping 1.6s ease-in-out infinite; }
.pm-comment-btn.unread .pm-comment-count { color: #fff; background: #e5484d; border-radius: 9px; padding: 1px 5px; }
@keyframes pm-ping { 0%, 100% { box-shadow: 0 0 0 2px #f59e0b; } 50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, .25); } }
@media (prefers-reduced-motion: reduce) { .pm-comment-btn.unread { animation: none; } }
.pm-talk-row { margin: 0 0 14px; }
.pm-chat { display: flex; flex-direction: column; gap: 10px; }
.pm-chat-people { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; background: var(--surface-2); display: grid; gap: 6px; }
.pm-chat-people-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.pm-chat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-chat-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2px 8px 2px 3px; font-size: 13px; }
.pm-chat-chip small { color: var(--muted); font-size: 11px; }
.pm-chat-chip.r-owner { border-color: #c5c9fb; }
.pm-chat-chip.r-assignee { border-color: #a9dcc0; }
.pm-chat-x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 2px; }
.pm-chat-x:hover { color: var(--danger); }
select.pm-chat-add { width: auto; max-width: 100%; padding: 4px 8px; font-size: 13px; justify-self: start; }
.pm-chat-log { height: 46vh; min-height: 220px; overflow-y: auto; padding: 8px 4px; display: flex; flex-direction: column; gap: 6px; background: var(--mm-canvas); border-radius: var(--radius); border: 1px solid var(--border); }
.pm-chat-day { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 2px 10px; margin: 6px 0; }
.pm-chat-msg { display: flex; padding: 0 8px; }
.pm-chat-msg.mine { justify-content: flex-end; }
.pm-chat-bubble { max-width: 75%; background: #fff; border: 1px solid var(--border); border-radius: 12px 12px 12px 4px; padding: 6px 10px; box-shadow: 0 1px 1px rgba(20, 24, 40, .04); }
.pm-chat-msg.mine .pm-chat-bubble { background: #e6e8fd; border-color: #c5c9fb; border-radius: 12px 12px 4px 12px; }
.pm-chat-author { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.pm-chat-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.pm-chat-meta { display: flex; justify-content: flex-end; gap: 8px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.pm-chat-del { border: 0; background: none; color: var(--muted); font-size: 11px; cursor: pointer; padding: 0; opacity: 0; }
.pm-chat-bubble:hover .pm-chat-del { opacity: 1; }
.pm-chat-del:hover { color: var(--danger); }
.pm-chat-empty { text-align: center; margin: auto; padding: 20px; }
.pm-chat-compose { display: flex; gap: 8px; align-items: flex-end; }
textarea.pm-chat-input { flex: 1; resize: vertical; min-height: 44px; font-family: var(--font); font-size: 14px; }

/* ================================================================ project templates
   body.pm-theme-<name> on /project/{id} and /project/{id}/present (PMTree.applyTheme).
   Classic = the default look above. Line shape + progress bars come from PMTree.THEMES. */

/* estimate-vs-actual progress bar along the bottom of a card (Corporate, Midnight) */
.pm-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(16, 24, 40, .08); pointer-events: none; }
.pm-bar span { display: block; height: 100%; background: #12b76a; }
.pm-bar.over span { background: #f04438; }
.pm-node:has(.pm-bar) { overflow: hidden; }
.pm-theme-pick select.input { min-width: 120px; }

/* ---------------------------------------------------------------- Corporate */
body.pm-theme-corporate { --mm-canvas: #f3f5f8; --mm-grid: transparent; --mm-link: #a3acb9; }
.pm-theme-corporate .pm-canvas { background-image: none; }
.pm-theme-corporate .pm-node { background: #fff !important; border: 1px solid #dde2ea !important; border-radius: 6px; padding: 12px 14px 14px 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10) !important; overflow: hidden; min-width: 170px; }
.pm-theme-corporate .pm-node::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #2563eb; }
.pm-theme-corporate .pm-node.depth-2::before { background: #0d9488; }
.pm-theme-corporate .pm-node.depth-3::before { background: #7c3aed; }
.pm-theme-corporate .pm-node.depth-4::before { background: #d97706; }
.pm-theme-corporate .pm-node.depth-0 { background: #1e3a5f !important; border-color: #1e3a5f !important; color: #fff; }
.pm-theme-corporate .pm-node.depth-0::before { background: #f59e0b; }
.pm-theme-corporate .pm-node.depth-0 .pm-num, .pm-theme-corporate .pm-node.depth-0 .pm-num small { color: #dbe4f0 !important; }
.pm-theme-corporate .pm-node.mine { border-left: 1px solid #dde2ea; }
.pm-theme-corporate .pm-node.mine::before { background: #12b76a; }
.pm-theme-corporate .pm-node.selected { outline: 2px solid #2563eb; outline-offset: 2px; }
.pm-theme-corporate .pm-node-title { font-size: 14px; color: inherit; letter-spacing: .1px; }
.pm-theme-corporate .pm-node-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin-top: 8px; }
.pm-theme-corporate .pm-num { background: transparent !important; border: 0; padding: 0; font-size: 13px; font-weight: 600; color: #101828; display: grid; }
.pm-theme-corporate .pm-num small { text-transform: uppercase; font-size: 9.5px; letter-spacing: .06em; color: #667085; font-weight: 600; }
.pm-theme-corporate .pm-node .pm-rem { grid-column: 1 / -1; justify-self: start; border-radius: 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.pm-theme-corporate .pm-node-meta { border-top: 1px solid #eef1f5; padding-top: 6px; margin-top: 8px; }
.pm-theme-corporate .pm-node.depth-0 .pm-node-meta { border-color: rgba(255, 255, 255, .15); }
.pm-theme-corporate .pm-sprint { background: #eff4ff; color: #3538cd; border-radius: 4px; }
.pm-theme-corporate .pm-toggle { border-radius: 4px; background: #fff; border-color: #cfd6e1; color: #344054; }
.pm-theme-corporate .pm-link { stroke-width: 1.4; }
.pm-theme-corporate .pm-node.depth-0 .pm-bar { background: rgba(255, 255, 255, .2); }
.pm-theme-corporate .pm-node.pm-over, .pm-theme-corporate .pm-node.pm-ontrack { box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10) !important; }

/* ---------------------------------------------------------------- Midnight (whole screen dark) */
body.pm-theme-midnight { --bg: #0b1020; --surface: #0f172a; --surface-2: #1e293b; --border: #26324a; --text: #e5e7eb; --muted: #94a3b8;
  --accent: #818cf8; --accent-hover: #6366f1; --accent-soft: #1e1b4b; --mm-canvas: #0b1020; --mm-grid: #18213a; --mm-link: #6366f1;
  --mm-text: #e5e7eb; --mm-toggle-bg: #1e293b; color-scheme: dark; background: #0b1020; color: #e5e7eb; }
.pm-theme-midnight .pm-shell { background: #0b1020; }
.pm-theme-midnight .topbar, .pm-theme-midnight .toolbar, .pm-theme-midnight .pm-panel, .pm-theme-midnight .pm-summary { background: #0f172a !important; border-color: #1e293b !important; color: #e5e7eb; }
.pm-theme-midnight .brand, .pm-theme-midnight .pm-title strong { color: #f8fafc; }
.pm-theme-midnight .btn { background: #1e293b; color: #e5e7eb; border-color: #334155; }
.pm-theme-midnight .btn:hover { background: #273449; }
.pm-theme-midnight .btn-primary { background: #6366f1; border-color: #6366f1; color: #fff; }
.pm-theme-midnight .btn-danger { background: var(--danger); color: #fff; }
.pm-theme-midnight .input, .pm-theme-midnight select.input, .pm-theme-midnight textarea.input { background: #0b1020; color: #e5e7eb; border-color: #334155; }
.pm-theme-midnight .chip { background: #1e293b; color: #cbd5e1; }
.pm-theme-midnight .chip-shared { background: #0f2a22; color: #34d399; }
.pm-theme-midnight .pm-node { background: rgba(17, 24, 39, .94) !important; border: 1px solid #2b3550 !important; color: #e5e7eb; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45) !important; overflow: hidden; }
.pm-theme-midnight .pm-node.depth-0 { background: linear-gradient(135deg, #4f46e5, #7c3aed) !important; border: 0 !important; }
.pm-theme-midnight .pm-node.depth-1 { border-top: 2px solid #22d3ee !important; }
.pm-theme-midnight .pm-node.depth-2 { border-top: 2px solid #34d399 !important; }
.pm-theme-midnight .pm-node.depth-3 { border-top: 2px solid #f472b6 !important; }
.pm-theme-midnight .pm-node.selected { box-shadow: 0 0 0 2px #a5b4fc, 0 0 28px rgba(129, 140, 248, .55) !important; }
.pm-theme-midnight .pm-node.mine { border-left: 3px solid #34d399 !important; }
.pm-theme-midnight .pm-node.dim { opacity: .3; }
.pm-theme-midnight .pm-num { background: rgba(255, 255, 255, .06) !important; border-color: rgba(255, 255, 255, .08) !important; color: #f1f5f9; }
.pm-theme-midnight .pm-num small { color: #94a3b8; }
.pm-theme-midnight .pm-rem.ok { background: rgba(16, 185, 129, .14); color: #34d399; border-color: rgba(52, 211, 153, .45); }
.pm-theme-midnight .pm-rem.over { background: rgba(244, 63, 94, .14); color: #fb7185; border-color: rgba(251, 113, 133, .5); }
.pm-theme-midnight .pm-who, .pm-theme-midnight .pm-count { color: #94a3b8; }
.pm-theme-midnight .pm-sprint { background: #1e293b; color: #c7d2fe; }
.pm-theme-midnight .pm-avatar { background: #312e81; color: #c7d2fe; }
.pm-theme-midnight .pm-note-btn, .pm-theme-midnight .pm-comment-btn { background: rgba(255, 255, 255, .08); }
.pm-theme-midnight .pm-comment-btn.unread { background: rgba(245, 158, 11, .2); }
.pm-theme-midnight .pm-link { stroke-width: 2; opacity: .85; filter: drop-shadow(0 0 4px rgba(99, 102, 241, .6)); }
.pm-theme-midnight .pm-toggle { background: #1e293b; color: #e5e7eb; border-color: #4f46e5; }
.pm-theme-midnight .pm-box { background: #111a2e; border-color: #26324a; }
.pm-theme-midnight .pm-box.editable { background: #0f2a22; border-color: #1f5b45; }
.pm-theme-midnight .pm-bar { background: rgba(255, 255, 255, .08); height: 3px; }
.pm-theme-midnight .pm-bar span { background: linear-gradient(90deg, #10b981, #34d399); box-shadow: 0 0 8px #34d399; }
.pm-theme-midnight .pm-bar.over span { background: linear-gradient(90deg, #f43f5e, #fb7185); box-shadow: 0 0 8px #fb7185; }
.pm-theme-midnight .pm-chat-bubble { background: #1e293b; border-color: #334155; }
.pm-theme-midnight .pm-chat-msg.mine .pm-chat-bubble { background: #312e81; border-color: #4338ca; }
.pm-theme-midnight .pm-assign-item.on { background: #1e1b4b; }
.pm-theme-midnight .pm-c-blue, .pm-theme-midnight .pm-c-green, .pm-theme-midnight .pm-c-purple,
.pm-theme-midnight .pm-c-yellow, .pm-theme-midnight .pm-c-pink, .pm-theme-midnight .pm-c-gray { background: rgba(17, 24, 39, .94) !important; }
.pm-theme-midnight .pm-c-blue { border-color: #60a5fa !important; } .pm-theme-midnight .pm-c-green { border-color: #34d399 !important; }
.pm-theme-midnight .pm-c-purple { border-color: #a78bfa !important; } .pm-theme-midnight .pm-c-yellow { border-color: #fbbf24 !important; }
.pm-theme-midnight .pm-c-pink { border-color: #f472b6 !important; } .pm-theme-midnight .pm-c-gray { border-color: #94a3b8 !important; }

/* ---------------------------------------------------------------- Blueprint */
body.pm-theme-blueprint { --mm-link: rgba(255, 255, 255, .85); }
.pm-theme-blueprint .pm-canvas, .pm-theme-blueprint.pm-present-page { background-color: #123a7a; background-image:
  linear-gradient(rgba(255, 255, 255, .10) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .10) 1px, transparent 1px),
  linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 110px 110px, 110px 110px, 22px 22px, 22px 22px; }
.pm-theme-blueprint .pm-summary { background: #0e2f66; color: #cfe0ff; border-color: #1d4b96; }
.pm-theme-blueprint .pm-summary strong { color: #fff; }
.pm-theme-blueprint .pm-node { background: rgba(18, 58, 122, .88) !important; border: 1.5px solid rgba(255, 255, 255, .9) !important; border-radius: 2px; color: #fff; box-shadow: none !important; }
.pm-theme-blueprint .pm-node.depth-0 { border-width: 2.5px !important; background: rgba(255, 255, 255, .14) !important; }
.pm-theme-blueprint .pm-node.leaf { border-color: rgba(255, 255, 255, .75) !important; }
.pm-theme-blueprint .pm-node.selected { outline: 2px solid #ffd166; outline-offset: 3px; }
.pm-theme-blueprint .pm-node.mine { border-left: 4px solid #7cffb2 !important; }
.pm-theme-blueprint .pm-node.pm-over { border-color: #ff8a8a !important; }
.pm-theme-blueprint .pm-node-title { text-transform: uppercase; letter-spacing: .08em; font-size: 12.5px; }
.pm-theme-blueprint .pm-num { background: transparent !important; border: 1px dashed rgba(255, 255, 255, .45) !important; color: #fff; font-family: Consolas, 'Courier New', monospace; border-radius: 0; }
.pm-theme-blueprint .pm-num small { color: rgba(255, 255, 255, .7); font-family: 'Segoe UI', sans-serif; }
.pm-theme-blueprint .pm-node .pm-rem, .pm-theme-blueprint .pm-summary .pm-rem { background: transparent !important; border-radius: 0; font-family: Consolas, monospace; }
.pm-theme-blueprint .pm-node .pm-rem.ok, .pm-theme-blueprint .pm-summary .pm-rem.ok { color: #7cffb2; border: 1px solid #7cffb2; }
.pm-theme-blueprint .pm-node .pm-rem.over, .pm-theme-blueprint .pm-summary .pm-rem.over { color: #ff8a8a; border: 1px solid #ff8a8a; }
.pm-theme-blueprint .pm-who, .pm-theme-blueprint .pm-count, .pm-theme-blueprint .pm-who.none { color: rgba(255, 255, 255, .8); }
.pm-theme-blueprint .pm-sprint { background: rgba(255, 255, 255, .1); color: #fff; border-radius: 0; }
.pm-theme-blueprint .pm-node .pm-avatar.sm { background: rgba(255, 255, 255, .15); color: #fff; }
.pm-theme-blueprint .pm-note-btn, .pm-theme-blueprint .pm-comment-btn { background: rgba(255, 255, 255, .12); border-radius: 0; }
.pm-theme-blueprint .pm-link { stroke: rgba(255, 255, 255, .85); stroke-width: 1.4; stroke-dasharray: 6 4; }
.pm-theme-blueprint .pm-toggle { background: #123a7a; color: #fff; border: 1.5px solid #fff; border-radius: 0; }
.pm-theme-blueprint .pm-c-blue, .pm-theme-blueprint .pm-c-green, .pm-theme-blueprint .pm-c-purple,
.pm-theme-blueprint .pm-c-yellow, .pm-theme-blueprint .pm-c-pink, .pm-theme-blueprint .pm-c-gray { background: rgba(18, 58, 122, .88) !important; }

/* ---------------------------------------------------------------- presenter backgrounds */
.pm-present-page.pm-theme-corporate { background: #f3f5f8; }
.pm-present-page.pm-theme-midnight { background: radial-gradient(circle at 30% 20%, #151d3b 0, #0b1020 60%); }
.pm-present-page.pm-theme-midnight .present-title h1 { color: #f8fafc; }
.pm-present-page.pm-theme-blueprint .present-title h1 { color: #fff; }
.pm-present-page.pm-theme-blueprint .present-title p { color: #cfe0ff; }

/* ---------- roles, status / priority, people, timesheet ---------- */
select.pm-role-select { width: auto; padding: 3px 6px; font-size: 12.5px; }
.pm-add-member select.pm-role-select { flex: none; }
.pm-role-tag { font-size: 11px; font-weight: 600; border-radius: 10px; padding: 1px 8px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pm-role-tag.r-owner { background: #fff1d6; color: #8a5a00; } .pm-role-tag.r-developer { background: #e0ecff; color: #1d4ed8; }
.pm-role-tag.r-qa { background: #f3e8ff; color: #7e22ce; } .pm-role-tag.r-team_leader { background: #dcf3e7; color: #17794b; }
.pm-members li.pm-creator { background: var(--surface-2); border-radius: 6px; padding: 4px 6px; }

.pm-status, .pm-prio { font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; white-space: nowrap; border: 1px solid transparent; }
.pm-status.st-in_progress { background: rgba(100, 116, 139, .14); color: #475569; border-color: rgba(100, 116, 139, .3); }
.pm-status.st-development { background: rgba(37, 99, 235, .12); color: #1d4ed8; border-color: rgba(37, 99, 235, .3); }
.pm-status.st-qa { background: rgba(217, 119, 6, .13); color: #b45309; border-color: rgba(217, 119, 6, .35); }
.pm-status.st-completed { background: rgba(22, 163, 74, .13); color: #15803d; border-color: rgba(22, 163, 74, .35); }
.pm-prio.pr-low { color: #64748b; } .pm-prio.pr-medium { color: #2563eb; }
.pm-prio.pr-high { color: #c2410c; background: rgba(234, 88, 12, .1); } .pm-prio.pr-critical { color: #fff; background: #dc2626; }
.pm-node.pm-st-completed .pm-node-title::before { content: '✔ '; color: #16a34a; }
.pm-who.more { background: var(--surface-2); border-radius: 8px; padding: 0 6px; }
.pm-done-count { font-weight: 600; } .pm-done-count.all { color: #15803d; }
.pm-theme-midnight .pm-status.st-in_progress { color: #cbd5e1; } .pm-theme-midnight .pm-status.st-development { color: #93c5fd; }
.pm-theme-midnight .pm-status.st-qa { color: #fbbf24; } .pm-theme-midnight .pm-status.st-completed { color: #4ade80; }
.pm-theme-midnight .pm-prio.pr-low, .pm-theme-midnight .pm-prio.pr-medium { color: #94a3b8; }
.pm-theme-blueprint .pm-node .pm-status, .pm-theme-blueprint .pm-node .pm-prio:not(.pr-critical) { color: #fff; background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .5); border-radius: 0; }

.pm-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pm-status-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 34px; }
.pm-flow-hint { display: block; margin: -6px 0 12px; font-size: 12px; }
.pm-people { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pm-person { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 2px 8px 2px 3px; font-size: 13px; }
.pm-person.me { border-color: #a9dcc0; }
.pm-person.sprint { padding-left: 8px; }
.pm-person small { color: var(--muted); font-size: 11px; }
.pm-chip-x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 2px; }
.pm-chip-x:hover { color: var(--danger); }
select.pm-inline-select { width: auto; margin-top: 6px; padding: 4px 8px; font-size: 13px; }
.pm-ts-row { margin: 0 0 14px; align-items: center; }
.pm-check-box { width: 18px; height: 18px; border: 1.5px solid var(--border); border-radius: 4px; display: inline-grid; place-items: center; font-size: 12px; color: #fff; flex: none; }
.pm-assign-item.on .pm-check-box { background: var(--accent); border-color: var(--accent); }

.pm-ts { display: grid; gap: 12px; }
.pm-ts-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); }
.pm-ts-total { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pm-ts-total strong { font-size: 22px; }
.pm-ts-people { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-ts-people .pm-person strong { margin-left: 4px; }
.pm-ts-form { border: 1px solid #bfe5d4; background: #f1faf6; border-radius: var(--radius); padding: 10px 12px; }
.pm-theme-midnight .pm-ts-form { background: #0f2a22; border-color: #1f5b45; }
.pm-ts-form .field { margin-bottom: 8px; }
.pm-ts-times { display: grid; grid-template-columns: 140px 140px 1fr; gap: 10px; align-items: end; }
.pm-ts-hours { font-weight: 700; padding-bottom: 18px; color: var(--success); }
.pm-ts-hours.bad { color: var(--danger); }
#ts-desc { font-family: var(--font); font-size: 14px; resize: vertical; }
.pm-ts-log-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pm-ts-log { max-height: 38vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 8px; }
.pm-ts-day { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); padding: 8px 2px 4px; margin-top: 4px; }
.pm-ts-entry { display: grid; grid-template-columns: 22px 1fr auto 20px; gap: 8px; align-items: start; padding: 6px 2px; border-bottom: 1px dashed var(--surface-2); font-size: 13.5px; }
.pm-ts-entry.mine .pm-ts-main strong { color: var(--accent); }
.pm-ts-time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pm-ts-desc { color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; margin-top: 2px; }
.pm-ts-h { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .pm-two, .pm-ts-times { grid-template-columns: 1fr; } }
.pm-toolbar .pm-filter select.input { max-width: 150px; }
.pm-theme-pick select.input { min-width: 0; max-width: 140px; }

/* ---------- end-level task card (PMTree fillTask) ---------- */
.pm-node.pm-task { min-width: 230px; max-width: 290px; padding: 12px 14px; border-radius: 16px; border-color: #e3e7ef;
  box-shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 6px 16px rgba(20, 24, 40, .06); }
.pm-task .pm-tk-head { display: flex; align-items: center; gap: 10px; }
.pm-task .pm-tk-head .pm-node-title { flex: 1; font-size: 15px; font-weight: 700; }
.pm-task .pm-tk-note { width: 34px; height: 34px; margin: 0; padding: 0; border-radius: 10px; background: #f3f4f8; font-size: 17px; display: grid; place-items: center; flex: none; }
.pm-task .pm-comment-btn { margin: 0; padding: 4px 9px; border: 1px solid #e3e7ef; border-radius: 10px; background: #fff; font-size: 14px; gap: 5px; }
.pm-task .pm-comment-btn .pm-comment-count { font-size: 13px; color: var(--text); }
.pm-task .pm-comment-btn.unread .pm-comment-count { color: #fff; }
.pm-tk-stats { display: grid; gap: 8px; margin-top: 10px; }
.pm-tk-stats.n3 { grid-template-columns: repeat(3, 1fr); } .pm-tk-stats.n2 { grid-template-columns: repeat(2, 1fr); } .pm-tk-stats.n1 { grid-template-columns: 1fr; }
.pm-tk-stat { border-radius: 12px; padding: 7px 6px; text-align: center; display: grid; gap: 1px; background: #f4f5f9; }
.pm-tk-stat strong { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pm-tk-stat span { font-size: 11.5px; color: var(--muted); }
.pm-tk-stat.act { background: #eaf1fe; } .pm-tk-stat.act strong { color: #1d4ed8; }
.pm-tk-stat.left { background: #e7f6ee; } .pm-tk-stat.left strong, .pm-tk-stat.left span { color: #15803d; }
.pm-tk-stat.over { background: #fde8e8; } .pm-tk-stat.over strong, .pm-tk-stat.over span { color: #b42318; }
.pm-tk-stat.none strong { color: var(--muted); }
.pm-tk-extra { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pm-tk-sep { height: 1px; background: #eceff4; margin: 10px 0 8px; }
.pm-tk-flags { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.pm-tk-flags .pm-status, .pm-tk-flags .pm-prio { font-size: 12.5px; padding: 3px 10px; }
.pm-tk-flags .pm-prio { background: transparent; padding-left: 4px; }
.pm-tk-flags .pm-prio.pr-critical { background: #dc2626; padding-left: 10px; }
.pm-tk-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.pm-tk-avatars { display: flex; align-items: center; gap: 4px; padding-right: 10px; border-right: 1px solid #e3e7ef; }
.pm-tk-av { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.pm-tk-av.me { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #16a34a; }
.pm-tk-av.more { background: #eef0f5; color: var(--muted); font-size: 11px; }
.av-violet { background: #ede9fe; color: #6d28d9; } .av-blue { background: #dbeafe; color: #1d4ed8; } .av-pink { background: #fce7f3; color: #be185d; }
.av-green { background: #dcfce7; color: #15803d; } .av-amber { background: #fef3c7; color: #b45309; } .av-sky { background: #e0f2fe; color: #0369a1; }
.av-rose { background: #ffe4e6; color: #be123c; } .av-teal { background: #ccfbf1; color: #0f766e; }
.pm-tk-sprint { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-tk-sprint.none { color: var(--muted); font-size: 12px; }
.pm-task .pm-tk-avatars .pm-who.none { font-size: 12px; }
/* Partial view: only the header + hours */
.pm-cards-partial .pm-task .pm-tk-extra, .pm-cards-partial .pm-task .pm-tk-sep,
.pm-cards-partial .pm-task .pm-tk-flags, .pm-cards-partial .pm-task .pm-tk-foot { display: none; }
.pm-cards-partial .pm-node.pm-task { padding-bottom: 12px; }

/* task card in the templates */
.pm-theme-corporate .pm-node.pm-task { padding-left: 18px; border-radius: 8px; }
.pm-theme-corporate .pm-tk-stat { border-radius: 6px; }
.pm-theme-midnight .pm-node.pm-task { border-radius: 16px; }
.pm-theme-midnight .pm-task .pm-tk-note, .pm-theme-midnight .pm-tk-stat { background: rgba(255, 255, 255, .06); }
.pm-theme-midnight .pm-task .pm-comment-btn { background: rgba(255, 255, 255, .06); border-color: #334155; }
.pm-theme-midnight .pm-tk-stat strong { color: #f1f5f9; }
.pm-theme-midnight .pm-tk-stat.act { background: rgba(59, 130, 246, .16); } .pm-theme-midnight .pm-tk-stat.act strong { color: #93c5fd; }
.pm-theme-midnight .pm-tk-stat.left { background: rgba(16, 185, 129, .15); } .pm-theme-midnight .pm-tk-stat.left strong, .pm-theme-midnight .pm-tk-stat.left span { color: #34d399; }
.pm-theme-midnight .pm-tk-stat.over { background: rgba(244, 63, 94, .15); } .pm-theme-midnight .pm-tk-stat.over strong, .pm-theme-midnight .pm-tk-stat.over span { color: #fb7185; }
.pm-theme-midnight .pm-tk-sep { background: #26324a; } .pm-theme-midnight .pm-tk-avatars { border-color: #26324a; }
.pm-theme-midnight .pm-tk-av.me { box-shadow: 0 0 0 2px #111827, 0 0 0 3.5px #34d399; }
.pm-theme-blueprint .pm-node.pm-task { border-radius: 2px; }
.pm-theme-blueprint .pm-task .pm-tk-note, .pm-theme-blueprint .pm-task .pm-comment-btn { background: rgba(255, 255, 255, .12); border-radius: 0; border-color: rgba(255, 255, 255, .5); }
.pm-theme-blueprint .pm-task .pm-comment-btn .pm-comment-count { color: #fff; }
.pm-theme-blueprint .pm-tk-stat { background: transparent; border: 1px dashed rgba(255, 255, 255, .5); border-radius: 0; }
.pm-theme-blueprint .pm-tk-stat strong { color: #fff; font-family: Consolas, 'Courier New', monospace; }
.pm-theme-blueprint .pm-tk-stat span { color: rgba(255, 255, 255, .75); }
.pm-theme-blueprint .pm-tk-stat.left { border-color: #7cffb2; } .pm-theme-blueprint .pm-tk-stat.left strong, .pm-theme-blueprint .pm-tk-stat.left span { color: #7cffb2; }
.pm-theme-blueprint .pm-tk-stat.over { border-color: #ff8a8a; } .pm-theme-blueprint .pm-tk-stat.over strong, .pm-theme-blueprint .pm-tk-stat.over span { color: #ff8a8a; }
.pm-theme-blueprint .pm-tk-sep { background: rgba(255, 255, 255, .3); } .pm-theme-blueprint .pm-tk-avatars { border-color: rgba(255, 255, 255, .3); }
.pm-theme-blueprint .pm-tk-av { border-radius: 0; } .pm-theme-blueprint .pm-tk-sprint.none { color: rgba(255, 255, 255, .7); }

/* view controls float over the canvas (bottom-right), so the toolbar fits on one line */
.pm-canvas-wrap { position: relative; }
.pm-view-ctrls { position: absolute; right: 14px; bottom: 54px; z-index: 5; display: flex; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px 4px; box-shadow: var(--shadow); }
.pm-view-ctrls .icon-btn { font-size: 16px; padding: 4px 8px; }
.pm-view-ctrls .sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }

/* ---------- presenter: Single / Split ---------- */
.present-bar .layout-switch { display: inline-flex; background: rgba(255, 255, 255, .08); border-radius: 999px; padding: 2px; }
.present-bar .layout-switch button { padding: 5px 11px; font-size: 13px; }
.present-bar .layout-switch button.on { background: #fff; color: #1f2633; }
.present-page .canvas-right { left: 50%; }
.present-page.split-on #canvas { right: 50%; }
.present-page.split-on .canvas-right { display: block; border-left: 1px solid rgba(79, 91, 213, .18);
  background: linear-gradient(90deg, rgba(79, 91, 213, .035), transparent 120px); }
.split-close { position: absolute; top: 14px; right: 16px; z-index: 6; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); border-radius: 50%; width: 30px; height: 30px; cursor: pointer; font-size: 14px; box-shadow: var(--shadow); }
.split-close:hover { color: var(--text); }
