  /* ---------------- Base ---------------- */
  :root {
    --paper: #ECE6DA;
    --paper-2: #F3EEE3;
    --ink: #1C1B18;
    --ink-soft: #4A4741;
    --ink-mute: #8A857B;
    --line: #D7CFBF;
    --line-soft: #E4DCCC;
    --panel: #FBF7EE;
    --panel-2: #FFFFFF;
    --accent: #1F3A52;
    --accent-warm: #B8522E;
    --danger: #B8522E;
    --shadow-sm: 0 1px 2px rgba(28,27,24,0.06), 0 1px 3px rgba(28,27,24,0.04);
    --shadow-md: 0 4px 14px rgba(28,27,24,0.08), 0 2px 4px rgba(28,27,24,0.04);
    --shadow-lg: 0 20px 40px rgba(28,27,24,0.12), 0 6px 14px rgba(28,27,24,0.06);
    --note-shadow: 0 1px 2px rgba(28,27,24,0.08), 0 6px 14px rgba(28,27,24,0.10);
    --note-shadow-hover: 0 2px 3px rgba(28,27,24,0.08), 0 12px 24px rgba(28,27,24,0.14);
    --radius: 6px;
    --radius-lg: 12px;
    --font-display: 'Manrope', ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-ui: 'Geist', ui-sans-serif, system-ui, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, monospace;

    /* Brand hues — the four crayons that flow through the brand gradient */
    --hue-yellow: #F4C842;
    --hue-pink:   #F08FB6;
    --hue-blue:   #7AAFE8;
    --hue-green:  #5DB07F;

    /* Crayon stripe colors (lighter pastels used on the logo mark) */
    --crayon-yellow: #FDE68A;
    --crayon-pink:   #FBCFE8;
    --crayon-blue:   #BFDBFE;
    --crayon-green:  #BBF7D0;
    --crayon-orange: #FED7AA;

    /* The signature brand gradient — yellow → pink → blue → green */
    --gradient-brand: linear-gradient(100deg,
      var(--hue-yellow) 0%,
      var(--hue-pink)   34%,
      var(--hue-blue)   68%,
      var(--hue-green)  100%);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; overflow: hidden; }

  /* ---------------- Page layer system ---------------- */
  .page {
    position: absolute;
    inset: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  .page.page-hidden {
    display: none;
  }
  .page.page-enter { opacity: 0; transform: translateY(8px); }
  .page.page-exit { opacity: 0; transform: translateY(-8px); }

  /* ---------------- Tour page ---------------- */
  .page-tour {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper);
    background-image:
      radial-gradient(at 10% 30%, rgba(253, 230, 138, 0.28), transparent 55%),
      radial-gradient(at 90% 70%, rgba(191, 219, 254, 0.28), transparent 55%);
    overflow-y: auto;
    padding: 40px 24px;
  }
  .tour-wrap {
    width: 100%;
    max-width: 680px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 28px 56px rgba(28, 27, 24, 0.14), 0 8px 20px rgba(28, 27, 24, 0.06);
    overflow: hidden;
    position: relative;
  }
  .tour-skip {
    position: absolute;
    top: 16px;
    right: 18px;
    font-size: 12px;
    color: var(--ink-mute);
    padding: 4px 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
    z-index: 2;
  }
  .tour-skip:hover { background: var(--line-soft); color: var(--ink); }
  .tour-slides {
    position: relative;
    min-height: 480px;
  }
  .tour-slide {
    position: absolute;
    inset: 0;
    padding: 48px 52px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateX(20px);
  }
  .tour-slide.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }
  .tour-visual {
    height: 220px;
    width: 100%;
    max-width: 520px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--paper);
    position: relative;
    overflow: hidden;
    padding: 20px;
  }
  .tour-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.015em;
    margin-bottom: 10px;
  }
  .tour-body {
    font-size: 14.5px;
    color: var(--ink-soft);
    line-height: 1.55;
    max-width: 480px;
  }
  .tour-body kbd {
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--paper);
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid var(--line-soft);
    color: var(--ink);
  }
  .tour-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px 22px;
    border-top: 1px solid var(--line-soft);
    gap: 16px;
  }
  .tour-back, .tour-next {
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 90px;
  }
  .tour-back {
    color: var(--ink-soft);
    background: transparent;
  }
  .tour-back:hover { background: var(--line-soft); color: var(--ink); }
  .tour-next {
    color: var(--paper-2);
    background: var(--ink);
  }
  .tour-next:hover { background: #000; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
  .tour-dots {
    display: flex;
    gap: 8px;
  }
  .tour-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--line);
    transition: all 0.2s;
  }
  .tour-dot.active {
    background: var(--ink);
    width: 22px;
    border-radius: 4px;
  }

  /* Tour mini visuals — stylized mock-ups */
  .tv-sidebar {
    width: 180px;
    height: 180px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 12px;
    text-align: left;
    font-size: 10px;
    margin-right: 16px;
  }
  .tv-sidebar-group {
    font-weight: 600;
    color: var(--ink);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 10px;
    margin-bottom: 4px;
  }
  .tv-sidebar-group:first-child { margin-top: 0; }
  .tv-sidebar-board {
    font-size: 11px;
    color: var(--ink-soft);
    padding: 3px 6px;
    margin-left: 10px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .tv-sidebar-board::before {
    content: '';
    width: 3px; height: 3px;
    border-radius: 50%;
    background: var(--ink-mute);
  }
  .tv-sidebar-board.active {
    background: var(--ink);
    color: var(--paper-2);
  }
  .tv-sidebar-board.active::before { background: var(--paper-2); }

  .tv-arrow {
    font-size: 22px;
    color: var(--ink-mute);
  }

  .tv-canvas {
    width: 260px;
    height: 180px;
    background:
      radial-gradient(circle, rgba(28,27,24,0.1) 1px, transparent 1px) 0 0/14px 14px,
      var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    position: relative;
  }
  .tv-note {
    position: absolute;
    width: 58px;
    height: 58px;
    border-radius: 2px;
    padding: 6px;
    font-size: 7.5px;
    line-height: 1.2;
    color: #1C1B18;
    box-shadow: 0 1px 2px rgba(28,27,24,0.08), 0 4px 10px rgba(28,27,24,0.1);
    overflow: hidden;
  }
  .tv-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 6px;
    font-weight: 600;
    color: white;
    border: 1.5px solid rgba(255,255,255,0.85);
    box-shadow: 0 1px 2px rgba(28,27,24,0.2);
  }
  .tv-emoji {
    position: absolute;
    font-size: 14px;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
  }
  .tv-label {
    position: absolute;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 10px;
    letter-spacing: -0.01em;
    color: var(--ink);
  }

  .tv-chat {
    width: 280px;
    height: 180px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    font-size: 11px;
    box-shadow: var(--shadow-md);
  }
  .tv-chat-msg {
    max-width: 85%;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.35;
  }
  .tv-chat-msg.user {
    align-self: flex-end;
    background: var(--ink);
    color: var(--paper-2);
    border-radius: 10px 10px 2px 10px;
  }
  .tv-chat-msg.assistant {
    align-self: flex-start;
    color: var(--ink-soft);
    padding-left: 2px;
  }
  .tv-chat-action {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    font-size: 9.5px;
    color: var(--ink-soft);
    font-family: var(--font-mono);
  }
  .tv-chat-action svg { color: #2F6B4E; }

  .tv-m-key {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 14px;
    padding: 8px 12px;
    background: var(--ink);
    color: var(--paper-2);
    border-radius: 999px;
    font-size: 11px;
  }
  .tv-m-key kbd {
    font-family: var(--font-mono);
    background: rgba(255,255,255,0.15);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
  }
  .tv-m-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #F87171;
  }

  .tv-welcome {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .tv-welcome-text {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.01em;
  }
  .tv-welcome-text em { font-style: normal; font-weight: 600; }
  body {
    font-family: var(--font-ui);
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-size: 14px;
    line-height: 1.5;
  }

  button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
  input, textarea { font-family: inherit; color: inherit; background: none; border: none; outline: none; resize: none; }

  /* ---------------- Layout ---------------- */
  .app {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    width: 100vw;
    transition: grid-template-columns 0.36s cubic-bezier(0.32, 0.72, 0.28, 1);
  }
  .app.sidebar-collapsed {
    grid-template-columns: 0 1fr;
  }

  /* ---------------- Sidebar ---------------- */
  .sidebar {
    background: var(--panel);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(0);
    opacity: 1;
    /* Delay opacity fade-in slightly so the FAB has time to clear out first when
       the sidebar reappears. Transform slide and grid-column expansion run from t=0
       so the layout starts changing immediately and only the visual reveal waits. */
    transition:
      transform 0.36s cubic-bezier(0.32, 0.72, 0.28, 1),
      opacity 0.24s ease 0.12s;
  }
  .app.sidebar-collapsed .sidebar {
    transform: translateX(-12px);
    opacity: 0;
    pointer-events: none;
    /* When collapsing, fade out without delay so the FAB can take over cleanly */
    transition:
      transform 0.36s cubic-bezier(0.32, 0.72, 0.28, 1),
      opacity 0.2s ease;
  }

  /* Floating "open sidebar" button — appears when sidebar is collapsed.
     Visibility is animated (opacity + visibility) rather than toggled via display,
     so the fade actually runs. The two marks (sidebar header + FAB) hand off
     cleanly: when collapsing, sidebar fades first, then FAB appears; when
     reopening, FAB fades first, then sidebar appears. They never crossfade. */
  .sidebar-fab {
    position: fixed;
    top: 9px;
    left: 16px;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    padding: 0;
    /* Hidden state by default — sidebar starts open */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* Disappear path: fast in-place fade. Visibility flips at end of fade. */
    transition:
      opacity 0.14s ease,
      visibility 0s linear 0.14s,
      box-shadow 0.2s ease,
      border-color 0.2s ease,
      transform 0.2s ease;
  }
  /* When sidebar collapses → FAB visible. Delay the fade-in so the sidebar
     has fully faded (and started sliding out) before the FAB asserts itself. */
  .app.sidebar-collapsed ~ .sidebar-fab {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
      opacity 0.22s cubic-bezier(0.22, 0.61, 0.36, 1) 0.22s,
      visibility 0s linear 0.22s,
      box-shadow 0.2s ease,
      border-color 0.2s ease,
      transform 0.2s ease;
  }
  .sidebar-fab:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: var(--shadow-lg);
    border-color: var(--ink-soft);
    /* Use the spring only on hover, where the overshoot reads as responsive */
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  }
  .sidebar-fab:active {
    transform: translateY(0) scale(0.96);
  }
  /* Fade the FAB while user is actively working on canvas */
  .app.sidebar-collapsed ~ .sidebar-fab.idle-hidden {
    opacity: 0;
    transform: translateX(-8px);
    pointer-events: none;
  }
  /* Sidebar FAB has a tighter, smaller mark — overrides only the box dimensions
     and stripe widths. Stripe colors and proportional heights cascade from the
     canonical .brand-mark rules above. */
  .sidebar-fab .brand-mark {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    gap: 1px;
    padding: 3px 2px;
  }
  .sidebar-fab .brand-mark i { width: 2.5px; }

  .brand {
    padding: 20px 22px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line-soft);
  }
  .brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--ink);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.5px;
    padding: 4px 3px;
    flex-shrink: 0;
  }
  .brand-mark i {
    display: block;
    width: 3px;
    border-radius: 1px;
  }
  .brand-mark i:nth-child(1) { background: #FDE68A; height: 72%; }
  .brand-mark i:nth-child(2) { background: #FBCFE8; height: 82%; }
  .brand-mark i:nth-child(3) { background: #BFDBFE; height: 68%; }
  .brand-mark i:nth-child(4) { background: #BBF7D0; height: 78%; }
  .brand-mark i:nth-child(5) { background: #FED7AA; height: 65%; }

  /* Size modifiers — only the box dimensions and stripe width change.
     Stripe colors and proportional heights are inherited from the rules above. */
  .brand-mark--md {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    gap: 2px;
    padding: 5px 4px;
  }
  .brand-mark--md i { width: 4px; }

  .brand-mark--lg {
    width: 48px;
    height: 48px;
    border-radius: 11px;
    gap: 2px;
    padding: 6px 5px;
  }
  .brand-mark--lg i { width: 5px; }
  .brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.015em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-name em {
    font-style: normal;
    font-weight: 700;
  }

  .sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 14px 10px 10px;
  }
  .sidebar-scroll::-webkit-scrollbar { width: 8px; }
  .sidebar-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

  .sidebar-section-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-mute);
    padding: 8px 12px 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .icon-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    color: var(--ink-mute);
    transition: all 0.15s ease;
  }
  .icon-btn:hover { background: var(--line-soft); color: var(--ink); }

  .group {
    margin-bottom: 4px;
  }
  .group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px 7px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
  }
  .group-header:hover { background: var(--line-soft); }
  .group-caret {
    width: 14px;
    height: 14px;
    transition: transform 0.15s ease;
    color: var(--ink-mute);
    flex-shrink: 0;
  }
  .group.collapsed .group-caret { transform: rotate(-90deg); }
  .group-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    letter-spacing: -0.005em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .group-name[contenteditable="true"] {
    outline: none;
    background: var(--panel-2);
    box-shadow: inset 0 0 0 1.5px var(--accent);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: -5px;
  }
  .group-actions {
    display: none;
    gap: 2px;
    align-items: center;
  }
  .group-header:hover .group-actions { display: flex; }

  .group-boards {
    padding-left: 24px;
    overflow: hidden;
    max-height: 800px;
    transition: max-height 0.2s ease;
  }
  .group.collapsed .group-boards { max-height: 0; }

  .board-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 8px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    color: var(--ink-soft);
    transition: background 0.15s ease;
    position: relative;
  }
  .board-item:hover { background: var(--line-soft); }
  .board-item.active { background: var(--ink); color: var(--paper-2); }
  .board-item.active .board-dot { background: var(--paper-2); }
  .board-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ink-mute);
    flex-shrink: 0;
  }
  .board-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .board-name[contenteditable="true"] {
    outline: none;
    background: var(--panel-2);
    color: var(--ink);
    box-shadow: inset 0 0 0 1.5px var(--accent);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: -5px;
  }
  .board-actions {
    display: none;
    gap: 2px;
  }
  .board-item:hover .board-actions { display: flex; }
  .board-item.active .board-actions .icon-btn { color: rgba(255,255,255,0.6); }
  .board-item.active .board-actions .icon-btn:hover { background: rgba(255,255,255,0.1); color: white; }

  /* Proposal item — nested under its parent board */
  .proposal-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px 5px 8px;
    margin-left: 18px;
    margin-top: 1px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--ink-mute);
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
  }
  /* Connector line — a thin branch from the parent board */
  .proposal-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 0;
    bottom: 50%;
    width: 1px;
    background: var(--line);
  }
  .proposal-item::after {
    content: '';
    position: absolute;
    left: -7px;
    top: 50%;
    width: 9px;
    height: 1px;
    background: var(--line);
  }
  .proposal-item:hover {
    background: var(--line-soft);
    color: var(--ink-soft);
  }
  .proposal-item.active {
    background: #263B4C;
    color: #F1F4F7;
  }
  .proposal-item.active .proposal-item-icon { color: #9FC2BD; }
  .proposal-item-icon {
    width: 12px;
    height: 12px;
    color: var(--ink-mute);
    flex-shrink: 0;
  }
  .proposal-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .proposal-item-badge {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #3B726D;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(59, 114, 109, 0.08);
    font-family: var(--font-mono);
  }
  .proposal-item.active .proposal-item-badge {
    color: #9FC2BD;
    background: rgba(159, 194, 189, 0.12);
  }

  /* Drag & drop */
  .board-item[draggable="true"] { cursor: grab; }
  .board-item.dragging {
    opacity: 0.35;
    cursor: grabbing;
  }
  .board-item.drop-before::before {
    content: '';
    position: absolute;
    left: 4px;
    right: 8px;
    top: -3px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(31, 58, 82, 0.12);
  }
  .board-item.drop-before::after {
    content: '';
    position: absolute;
    left: 2px;
    top: -5px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    z-index: 3;
    pointer-events: none;
  }
  .group.drop-target {
    background: rgba(31, 58, 82, 0.04);
    border-radius: 8px;
    transition: background 0.15s ease;
  }
  .group.drop-target > .group-header {
    background: rgba(31, 58, 82, 0.07);
  }
  .group.drop-target.drop-at-end > .group-boards::after {
    content: '';
    display: block;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    margin: 2px 8px 4px 0;
    box-shadow: 0 0 0 2px rgba(31, 58, 82, 0.12);
  }

  .add-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 8px;
    margin-top: 2px;
    border-radius: 5px;
    font-size: 12.5px;
    color: var(--ink-mute);
    transition: all 0.15s ease;
    width: 100%;
    text-align: left;
  }
  .add-inline:hover { background: var(--line-soft); color: var(--ink); }

  .sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--line-soft);
  }
  .collabs-row {
    display: flex;
    align-items: center;
    gap: -4px;
    margin-bottom: 10px;
  }
  .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    border: 2px solid var(--panel);
    margin-left: -6px;
    letter-spacing: 0.02em;
  }
  .avatar:first-child { margin-left: 0; }
  .collabs-count {
    font-size: 11.5px;
    color: var(--ink-mute);
    margin-left: 6px;
  }

  /* Profile trigger tile at top of sidebar footer */
  .profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 10px 10px;
    margin-bottom: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: var(--panel-2);
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
    text-align: left;
  }
  .profile-trigger:hover {
    border-color: var(--line);
    background: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
  }
  .profile-trigger-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  }
  .profile-trigger-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }
  .profile-trigger-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.005em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .profile-trigger-sub {
    font-size: 11px;
    color: var(--ink-mute);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .profile-trigger-chevron {
    color: var(--ink-mute);
    flex-shrink: 0;
    transition: transform 0.15s;
  }
  .profile-trigger:hover .profile-trigger-chevron {
    transform: translateX(2px);
    color: var(--ink);
  }

  /* Profile modal */
  .profile-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    margin: 4px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: 0.02em;
    position: relative;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-md);
  }
  .profile-avatar-preview:hover { transform: scale(1.03); box-shadow: var(--shadow-lg); }
  .profile-avatar-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(28,27,24,0.45) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z'></path><circle cx='12' cy='13' r='4'></circle></svg>") center no-repeat;
    opacity: 0;
    transition: opacity 0.15s ease;
  }
  .profile-avatar-preview:hover::after { opacity: 1; }
  .profile-avatar-upload-hint {
    text-align: center;
    font-size: 11.5px;
    color: var(--ink-mute);
    margin-top: 8px;
  }
  .profile-section {
    margin-top: 18px;
  }
  .profile-label {
    display: block;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 6px;
  }
  .profile-color-row {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .profile-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s ease;
    box-shadow: inset 0 0 0 1px rgba(28,27,24,0.1);
    border: none;
    padding: 0;
  }
  .profile-color-swatch:hover { transform: scale(1.1); }
  .profile-color-swatch.selected {
    box-shadow: inset 0 0 0 1px rgba(28,27,24,0.1), 0 0 0 2px var(--ink);
  }
  .profile-color-swatch.disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }
  .profile-color-swatch.disabled:hover { transform: none; }
  .profile-color-note {
    font-size: 11px;
    color: var(--ink-mute);
    margin-top: 8px;
  }
  .profile-readonly {
    padding: 9px 12px;
    background: var(--paper);
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--ink-soft);
    font-family: var(--font-mono);
    letter-spacing: -0.005em;
  }
  .profile-remove-image-btn {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--danger);
    padding: 4px 8px;
    border-radius: 4px;
    display: none;
  }
  .profile-remove-image-btn:hover { background: rgba(184,82,46,0.08); }
  .profile-remove-image-btn.visible { display: inline-block; }

  /* Attribution toggle */
  .attr-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px 9px 11px;
    margin-top: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--panel-2);
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
  }
  .attr-toggle:hover {
    border-color: var(--line);
    background: white;
  }
  .attr-toggle-icon {
    width: 14px;
    height: 14px;
    color: var(--ink-soft);
    flex-shrink: 0;
    transition: color 0.15s;
  }
  .attr-toggle-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
    min-width: 0;
  }
  .attr-toggle-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.005em;
    line-height: 1.2;
  }
  .attr-toggle-sub {
    font-size: 10.5px;
    color: var(--ink-mute);
    margin-top: 2px;
    line-height: 1.2;
  }
  .attr-toggle-switch {
    position: relative;
    width: 28px;
    height: 16px;
    background: var(--line);
    border-radius: 999px;
    transition: background 0.2s ease;
    flex-shrink: 0;
  }
  .attr-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  }
  .attr-toggle.on .attr-toggle-switch {
    background: var(--ink);
  }
  .attr-toggle.on .attr-toggle-switch::after {
    transform: translateX(12px);
  }
  .attr-toggle.on .attr-toggle-icon { color: var(--ink); }

  /* ---------------- Workspace ---------------- */
  .workspace {
    position: relative;
    overflow: hidden;
    background: var(--paper);
  }

  .topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
    pointer-events: none;
    transition: padding-left 0.36s cubic-bezier(0.32, 0.72, 0.28, 1);
  }
  .app.sidebar-collapsed .topbar {
    padding-left: 68px;
  }
  .topbar > * { pointer-events: auto; }

  .board-title-wrap {
    display: flex;
    align-items: baseline;
    gap: 10px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 18px;
    box-shadow: var(--shadow-sm);
  }
  .board-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.01em;
    outline: none;
    min-width: 30px;
  }
  .board-title[contenteditable="true"]:focus {
    background: var(--panel-2);
    box-shadow: inset 0 0 0 1.5px var(--accent);
    border-radius: 4px;
    padding: 0 4px;
    margin: 0 -4px;
  }

  .topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .invite-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px 9px 12px;
    background: var(--ink);
    color: var(--paper-2);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
  }
  .invite-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }

  /* ---------------- Canvas ---------------- */
  .canvas-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    cursor: default;
    background-color: var(--paper);
    background-image: radial-gradient(circle, rgba(28,27,24,0.12) 1px, transparent 1px);
    background-size: 22px 22px;
    background-position: 0 0;
  }
  .canvas-viewport.panning { cursor: grabbing; }
  .canvas-viewport.pan-ready { cursor: grab; }
  .canvas-viewport.tool-note { cursor: crosshair; }
  .canvas-viewport.tool-text { cursor: text; }
  .canvas-viewport.tool-dot { cursor: crosshair; }

  .canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 6000px;
    height: 6000px;
    transform-origin: 0 0;
    will-change: transform;
  }

  /* Post-it note */
  .note {
    position: absolute;
    width: 180px;
    min-height: 180px;
    padding: 18px 16px 16px;
    border-radius: 2px;
    box-shadow: var(--note-shadow);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    font-size: 14.5px;
    line-height: 1.4;
    color: #1C1B18;
    display: flex;
    flex-direction: column;
    user-select: none;
    /* subtle paper texture feel */
    background-image: linear-gradient(135deg, rgba(255,255,255,0.25), transparent 60%);
  }
  .note:hover { box-shadow: var(--note-shadow-hover); }
  .note.selected {
    box-shadow: var(--note-shadow-hover), 0 0 0 2px var(--accent);
  }
  .note.dragging {
    cursor: grabbing !important;
    z-index: 1000;
    box-shadow: var(--note-shadow-hover);
  }
  .note-text {
    flex: 1;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 100%;
    cursor: text;
  }
  .note-text:empty::before {
    content: attr(data-placeholder);
    color: rgba(28,27,24,0.35);
    pointer-events: none;
  }
  .note-text[contenteditable="true"] { user-select: text; }
  .note.editing { cursor: default; }
  .note:not(.editing) .note-text { pointer-events: none; }

  /* Slight organic rotation — set per note in JS */
  .note[data-rot="1"] { transform: rotate(-1.2deg); }
  .note[data-rot="2"] { transform: rotate(0.8deg); }
  .note[data-rot="3"] { transform: rotate(-0.5deg); }
  .note[data-rot="4"] { transform: rotate(1.5deg); }
  .note[data-rot="5"] { transform: rotate(-1.8deg); }
  .note.dragging[data-rot] { transform: rotate(0deg) scale(1.02); }

  /* Author avatar on notes */
  .note-author {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9.5px;
    font-weight: 600;
    color: white;
    font-family: var(--font-ui);
    letter-spacing: 0.02em;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(28, 27, 24, 0.25);
    z-index: 2;
    user-select: none;
    pointer-events: auto;
    cursor: default;
    transition: transform 0.15s ease;
  }
  .note-author:hover { transform: scale(1.15); }

  /* Text label (for grouping) */
  .text-label {
    position: absolute;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    outline: none;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 60px;
    line-height: 1.2;
    cursor: move;
    user-select: none;
    transition: background 0.15s;
  }
  .text-label.selected {
    background: rgba(255,255,255,0.6);
    box-shadow: 0 0 0 1.5px var(--accent);
  }
  .text-label.editing {
    cursor: text;
    user-select: text;
    background: rgba(255,255,255,0.85);
    box-shadow: 0 0 0 1.5px var(--accent);
  }
  .text-label:empty::before {
    content: attr(data-placeholder);
    color: var(--ink-mute);
    opacity: 0.5;
  }

  /* Dot voting sticker */
  .dot {
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: grab;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
    user-select: none;
    font-family: var(--font-ui);
  }
  .dot:hover { transform: scale(1.1); }
  .dot.dragging { cursor: grabbing; transform: scale(1.15); z-index: 1001; }

  /* Plain colored dot (anonymous mode fallback) */
  .dot--plain {
    box-shadow: 0 2px 4px rgba(28,27,24,0.2), inset 0 -2px 4px rgba(0,0,0,0.15), inset 0 1px 2px rgba(255,255,255,0.3);
  }
  .dot--plain.selected { box-shadow: 0 2px 4px rgba(28,27,24,0.2), inset 0 -2px 4px rgba(0,0,0,0.15), inset 0 1px 2px rgba(255,255,255,0.3), 0 0 0 2px var(--accent); }

  /* Author avatar-style dot */
  .dot--author {
    box-shadow: 0 2px 4px rgba(28,27,24,0.22), inset 0 -2px 4px rgba(0,0,0,0.14), inset 0 1px 2px rgba(255,255,255,0.25);
    border: 1.5px solid rgba(255,255,255,0.85);
  }
  .dot--author.selected { box-shadow: 0 2px 4px rgba(28,27,24,0.22), 0 0 0 2px var(--accent); }
  .dot-initials {
    font-size: 9px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.02em;
    pointer-events: none;
    text-shadow: 0 1px 1px rgba(0,0,0,0.15);
  }

  /* Emoji sticker — borderless, just the emoji on the canvas */
  .dot--emoji {
    background: transparent;
    font-size: 22px;
    line-height: 1;
    box-shadow: none;
  }
  .dot--emoji.selected {
    background: rgba(255,255,255,0.6);
    box-shadow: 0 0 0 2px var(--accent);
  }
  .dot-emoji {
    pointer-events: none;
    filter: drop-shadow(0 1.5px 2px rgba(28,27,24,0.25));
  }

  /* ---------------- Toolbar ---------------- */
  .toolbar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px;
    box-shadow: var(--shadow-md);
    z-index: 20;
  }
  .tool {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--ink-soft);
    transition: all 0.15s ease;
    position: relative;
  }
  .tool:hover { background: var(--line-soft); color: var(--ink); }
  .tool.active {
    background: var(--ink);
    color: var(--paper-2);
  }
  .tool-sep {
    width: 1px;
    height: 22px;
    background: var(--line);
    margin: 0 4px;
  }
  .tool-label {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--paper-2);
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 11.5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    font-weight: 400;
  }
  .tool-label kbd {
    font-family: var(--font-mono);
    font-size: 10px;
    background: rgba(255,255,255,0.15);
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
  }
  .tool:hover .tool-label { opacity: 1; }

  .color-tool {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    position: relative;
  }
  .color-tool:hover { background: var(--line-soft); }
  .color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1.5px rgba(28,27,24,0.08), 0 1px 2px rgba(0,0,0,0.06);
    transition: transform 0.15s ease;
  }
  .color-tool:hover .color-swatch { transform: scale(1.08); }

  /* Color picker popover */
  .color-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    box-shadow: var(--shadow-lg);
    display: none;
    width: 240px;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }
  .color-popover.open {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  .color-popover-title {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 10px;
  }
  .color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 14px;
  }
  .color-chip {
    aspect-ratio: 1;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s ease;
    box-shadow: inset 0 0 0 1px rgba(28,27,24,0.08);
    position: relative;
  }
  .color-chip:hover { transform: scale(1.1); }
  .color-chip.selected {
    box-shadow: inset 0 0 0 1px rgba(28,27,24,0.08), 0 0 0 2px var(--ink);
  }
  .color-chip.selected::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231C1B18' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'></polyline></svg>") center/12px no-repeat;
  }
  .color-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
  }
  .color-custom label {
    font-size: 12px;
    color: var(--ink-soft);
    flex: 1;
  }
  .color-custom input[type="color"] {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: none;
    border: 1px solid var(--line);
    padding: 2px;
  }
  .color-custom input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; border-radius: 4px; overflow: hidden; }
  .color-custom input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

  /* Vote sticker tool — same shape as color picker but also a .tool button */
  .vote-tool-combined {
    position: relative;
  }
  .vote-tool-combined.active .vote-preview {
    box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.25), 0 1px 2px rgba(0,0,0,0.2);
  }
  .vote-preview {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1.5px rgba(28,27,24,0.08), 0 1px 2px rgba(0,0,0,0.06);
    transition: transform 0.15s ease;
    line-height: 1;
    color: white;
    font-weight: 600;
    font-size: 8px;
    letter-spacing: 0.02em;
    background: #FFFFFF;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  }
  .vote-preview.is-author { color: white; }
  .vote-preview.is-emoji { font-size: 15px; color: inherit; background: transparent; box-shadow: none; }
  .vote-tool-combined:hover .vote-preview { transform: scale(1.08); }

  .vote-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    box-shadow: var(--shadow-lg);
    display: none;
    width: 240px;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }
  .vote-popover.open {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  .vote-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 12px;
  }
  .vote-chip {
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: inset 0 0 0 1px rgba(28,27,24,0.08);
    background: var(--panel-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--ink);
    position: relative;
  }
  .vote-chip:hover { transform: scale(1.1); background: var(--panel); }
  .vote-chip.selected {
    box-shadow: inset 0 0 0 1px rgba(28,27,24,0.08), 0 0 0 2px var(--ink);
  }
  .vote-chip-author {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.02em;
    border: 1.5px solid rgba(255,255,255,0.8);
  }
  .vote-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
  }
  .vote-custom label {
    font-size: 11px;
    color: var(--ink-mute);
    font-weight: 500;
    letter-spacing: 0.01em;
    flex-shrink: 0;
  }
  .vote-custom input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
    background: var(--panel-2);
    text-align: center;
    transition: border-color 0.15s;
    outline: none;
  }
  .vote-custom input:focus {
    border-color: var(--accent);
  }

  /* ---------------- Zoom controls ---------------- */
  .zoom-controls {
    position: absolute;
    bottom: 24px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px;
    box-shadow: var(--shadow-sm);
    z-index: 20;
  }
  .zoom-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--ink-soft);
    transition: all 0.15s;
  }
  .zoom-btn:hover { background: var(--line-soft); color: var(--ink); }
  .zoom-level {
    min-width: 48px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--ink-soft);
    font-family: var(--font-mono);
  }

  /* ---------------- Undo button (bottom-left) ---------------- */
  .undo-btn {
    position: absolute;
    bottom: 24px;
    left: 20px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px 8px 11px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    z-index: 20;
  }
  .undo-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: var(--ink);
    border-color: var(--ink-soft);
  }
  .undo-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }
  .undo-btn svg { flex-shrink: 0; }
  .undo-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: var(--ink);
    color: var(--paper-2);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    font-weight: 400;
    letter-spacing: 0.01em;
  }
  .undo-tooltip kbd {
    font-family: var(--font-mono);
    font-size: 10px;
    background: rgba(255,255,255,0.15);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    letter-spacing: 0.03em;
  }
  .undo-btn:hover:not(:disabled) .undo-tooltip { opacity: 1; }

  /* ---------------- Voice indicator ---------------- */
  /* ---------------- Journey progress bar ----------------
     Pinned just under the topbar, centered. Always visible while on the canvas;
     hidden on the proposal/auth/tour pages. Uses brand hue tokens to color the
     active segment so the bar stays visually consistent with the rest of the brand. */
  .journey-bar {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 7px;
    box-shadow: var(--shadow-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--ink-mute);
    z-index: 45;
    pointer-events: auto;
    user-select: none;
  }
  .journey-step {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px 4px 8px;
    border-radius: 999px;
    transition: all 0.2s ease;
    cursor: default;
  }
  .journey-step-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--line);
    flex-shrink: 0;
    transition: all 0.2s ease;
  }
  /* Completed steps — small filled dot in green to signal "done" positively */
  .journey-step.is-done .journey-step-dot {
    background: #2F6B4E;
    box-shadow: 0 0 0 3px rgba(47, 107, 78, 0.16);
  }
  .journey-step.is-done { color: var(--ink-soft); }
  /* Current step — filled in the lead brand hue with a soft halo */
  .journey-step.is-current {
    background: var(--ink);
    color: var(--paper-2);
  }
  .journey-step.is-current .journey-step-dot {
    background: var(--hue-yellow);
    box-shadow: 0 0 0 3px rgba(244, 200, 66, 0.22);
  }
  /* Future steps stay muted */
  .journey-step.is-future { color: var(--ink-mute); }
  /* Connector line between steps */
  .journey-connector {
    width: 12px;
    height: 1px;
    background: var(--line);
    flex-shrink: 0;
  }
  /* Hide on non-app/non-proposal pages (auth, tour) */
  .journey-bar:empty { display: none; }


    position: absolute;
    top: 72px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--ink);
    color: var(--paper-2);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 15;
  }
  .voice-indicator.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
  }
  .voice-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #F87171;
    position: relative;
  }
  .voice-pulse::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: #F87171;
    opacity: 0.4;
    animation: pulse 1.5s ease-out infinite;
  }
  @keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(2); opacity: 0; }
  }
  .voice-transcript {
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(255,255,255,0.7);
  }
  .voice-transcript:empty::before { content: 'Listening for "new note"…'; }
  .voice-close {
    margin-left: 4px;
    color: rgba(255,255,255,0.5);
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.15s;
  }
  .voice-close:hover { color: white; background: rgba(255,255,255,0.1); }

  /* ---------------- Modal ---------------- */
  .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28,27,24,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .modal-backdrop.open { display: flex; opacity: 1; }
  .modal {
    background: var(--panel-2);
    border-radius: 16px;
    width: 460px;
    max-width: calc(100vw - 32px);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: scale(0.96) translateY(10px);
    transition: transform 0.2s ease;
  }
  .modal-backdrop.open .modal { transform: scale(1) translateY(0); }
  .modal-header {
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--line-soft);
  }
  .modal-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.01em;
  }
  .modal-subtitle {
    font-size: 13px;
    color: var(--ink-mute);
    margin-top: 4px;
  }
  .modal-body { padding: 20px 28px; }
  .modal-footer {
    padding: 14px 28px 22px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }

  .tabs {
    display: flex;
    gap: 2px;
    background: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 16px;
    width: fit-content;
  }
  .tab {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--ink-soft);
    font-weight: 500;
    transition: all 0.15s;
  }
  .tab.active { background: var(--panel-2); color: var(--ink); box-shadow: var(--shadow-sm); }

  .field-group {
    display: flex;
    gap: 8px;
  }
  .text-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13.5px;
    background: var(--panel-2);
    transition: all 0.15s;
  }
  .text-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(31,58,82,0.1);
  }

  .btn {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .btn-primary { background: var(--ink); color: var(--paper-2); }
  .btn-primary:hover { background: #000; }
  .btn-secondary { background: var(--line-soft); color: var(--ink); }
  .btn-secondary:hover { background: var(--line); }
  .btn-ghost { color: var(--ink-soft); }
  .btn-ghost:hover { background: var(--line-soft); color: var(--ink); }

  .invite-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
  }
  .invite-list-title {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 2px;
  }
  .invite-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--line-soft);
  }
  .invite-row:last-child { border-bottom: none; }
  .invite-contact {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  .invite-name { font-size: 13px; font-weight: 500; }
  .invite-meta { font-size: 11.5px; color: var(--ink-mute); }
  .invite-status {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 500;
  }
  .invite-status.pending { background: #FEF3C7; color: #854D0E; }
  .invite-status.accepted { background: #D1FAE5; color: #065F46; }

  /* ---------------- Help toast ---------------- */
  .toast {
    position: absolute;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--ink);
    color: var(--paper-2);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 12.5px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 560px;
    white-space: nowrap;
  }
  .toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  .toast kbd {
    font-family: var(--font-mono);
    font-size: 10.5px;
    background: rgba(255,255,255,0.15);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.03em;
  }
  .toast-action {
    color: #F4D38A;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 5px;
    margin-left: 4px;
    transition: background 0.15s;
    cursor: pointer;
    border: none;
    background: rgba(244, 211, 138, 0.08);
    pointer-events: auto; /* override parent's pointer-events: none so the button is actually clickable */
  }
  .toast-action:hover {
    background: rgba(244, 211, 138, 0.2);
  }

  /* ---------------- Canvas empty state ---------------- */
  .empty-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    color: var(--ink-mute);
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .empty-hint.show { opacity: 1; }
  .empty-hint-title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 500;
    color: var(--ink);
    opacity: 0.4;
    letter-spacing: -0.025em;
    margin-bottom: 8px;
  }
  .empty-hint-sub {
    font-size: 13px;
    letter-spacing: 0.01em;
  }
  .empty-hint-sub kbd {
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--line-soft);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--ink);
  }

  /* ---------------- SVG icons reset ---------------- */
  svg { display: block; }

  /* ---------------- Context-aware cursor while typing in note ---------------- */
  .note[contenteditable="false"] * { pointer-events: none; }

  /* Scrollbar styling for modal body */
  .invite-list::-webkit-scrollbar { width: 6px; }
  .invite-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

  /* ============================================================
     ROLE-BASED FEATURES
     ============================================================ */

  /* Wider modal for the multi-tab profile */
  .modal--wide { width: 540px; max-width: calc(100vw - 32px); }

  /* Sidebar "Invite teammates" link — sits just under the collaborators row */
  .invite-teammates-link {
    width: 100%;
    margin-top: 10px;
    padding: 9px 12px;
    background: var(--panel-2);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
  }
  .invite-teammates-link:hover {
    border-color: var(--line);
    background: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
  }
  .invite-teammates-link svg {
    color: var(--ink-soft);
    flex-shrink: 0;
  }
  .invite-teammates-count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.04em;
    color: var(--ink-mute);
    padding: 2px 7px;
    background: var(--paper);
    border-radius: 999px;
    border: 1px solid var(--line-soft);
  }
  .invite-teammates-link.is-empty .invite-teammates-count {
    background: rgba(184, 82, 46, 0.06);
    border-color: rgba(184, 82, 46, 0.2);
    color: #B8522E;
  }

  /* Profile Account-tab teammate list */
  .profile-teammate-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .profile-teammate-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    font-size: 12.5px;
  }
  .profile-teammate-avatar {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    margin-left: 0;
    font-size: 10px;
    border: 1.5px solid white;
  }
  .profile-teammate-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }
  .profile-teammate-name {
    color: var(--ink);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .profile-teammate-contact {
    color: var(--ink-mute);
    font-size: 11px;
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .profile-teammate-empty {
    margin-top: 10px;
    padding: 14px;
    text-align: center;
    color: var(--ink-mute);
    font-size: 12.5px;
    background: var(--paper);
    border: 1px dashed var(--line);
    border-radius: 8px;
  }

  /* Your data — export / import / reset */
  .profile-data-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    line-height: 1.5;
    background: rgba(47, 107, 78, 0.06);
    border: 1px solid rgba(47, 107, 78, 0.2);
    color: var(--ink);
  }
  .profile-data-status::before {
    content: '';
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2F6B4E;
    box-shadow: 0 0 0 3px rgba(47, 107, 78, 0.18);
  }
  .profile-data-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
  }
  .profile-data-btn {
    flex: 1;
    min-width: 130px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
  }
  .profile-data-btn svg { color: var(--ink-soft); }
  .profile-data-danger {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
  }
  .profile-data-reset-btn {
    background: transparent;
    border: none;
    color: var(--ink-mute);
    font-family: var(--font-ui);
    font-size: 11.5px;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: underline;
    transition: color 0.15s ease;
  }
  .profile-data-reset-btn:hover { color: #B8522E; }

  /* Profile modal tabs */
  .profile-tabs {
    display: flex;
    gap: 0;
    padding: 0 28px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--panel);
  }
  .profile-tab {
    padding: 12px 16px;
    background: transparent;
    border: none;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-mute);
    cursor: pointer;
    position: relative;
    transition: color 0.15s ease;
  }
  .profile-tab::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
  }
  .profile-tab:hover { color: var(--ink); }
  .profile-tab.active {
    color: var(--ink);
  }
  .profile-tab.active::after { opacity: 1; }
  .profile-pane { display: none; }
  .profile-pane.is-active { display: block; }

  /* Account-tab: role card */
  .role-card {
    padding: 14px 16px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 12px;
  }
  .role-card-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    background: var(--paper);
    border: 1px solid var(--line);
    padding: 3px 8px;
    border-radius: 999px;
    margin-bottom: 8px;
  }
  html.role-admin    .role-card-badge { background: var(--ink); color: var(--paper-2); border-color: var(--ink); }
  html.role-client   .role-card-badge { background: var(--hue-green); color: var(--ink); border-color: transparent; }
  html.role-prospect .role-card-badge { background: var(--hue-yellow); color: var(--ink); border-color: transparent; }
  .role-card-body {
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.5;
  }

  /* Locked banner — shown above payment & invoices when the account isn't a client yet */
  .payment-locked-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
    background: rgba(228, 180, 115, 0.08);
    border: 1px solid rgba(228, 180, 115, 0.25);
    border-radius: 12px;
    font-size: 13px;
    color: var(--ink);
    line-height: 1.5;
  }
  .payment-locked-icon {
    flex-shrink: 0;
    color: #B8522E;
    padding-top: 1px;
  }
  /* Hide the locked banner when contract is signed */
  html.contract-signed .payment-locked-banner { display: none; }
  /* Grey out the payment/invoice content when not a client */
  html:not(.contract-signed) .payment-locked-overlay-wrap {
    opacity: 0.45;
    pointer-events: none;
    filter: saturate(0.4);
  }

  /* Stripe-styled card input */
  .stripe-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    padding: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }
  .stripe-card:focus-within {
    border-color: #635BFF;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.12);
  }
  .stripe-card-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 12px;
  }
  .stripe-card-icon {
    flex-shrink: 0;
    margin-right: 10px;
    display: flex;
    align-items: center;
  }
  .stripe-card-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    padding: 12px 0;
    font-family: var(--font-mono);
    font-size: 14px;
    background: transparent;
    color: var(--ink);
    letter-spacing: 0.02em;
  }
  .stripe-card-input::placeholder { color: var(--ink-mute); }
  .stripe-card-input-sm { flex: 0 0 90px; padding-left: 10px; border-left: 1px solid var(--line-soft); }
  .stripe-card-input-sm:first-of-type { border-left: 1px solid var(--line-soft); }
  .stripe-footnote { margin-top: 14px; }
  .stripe-footnote strong { color: #635BFF; }

  /* Invoice list */
  .invoice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .invoice-row {
    display: grid;
    grid-template-columns: 80px 1fr auto auto;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    font-size: 13px;
  }
  .invoice-date {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-mute);
    letter-spacing: 0.04em;
  }
  .invoice-desc {
    color: var(--ink);
    font-weight: 500;
  }
  .invoice-amount {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
  }
  .invoice-status {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    color: #2F6B4E;
    background: rgba(47, 107, 78, 0.1);
    border: 1px solid rgba(47, 107, 78, 0.2);
  }
  .invoice-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--ink-mute);
    font-size: 13px;
    background: var(--paper);
    border: 1px dashed var(--line);
    border-radius: 12px;
  }

  /* Invite-limit banner inside the invite modal */
  .invite-limit-banner {
    padding: 10px 14px;
    margin-bottom: 16px;
    background: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    font-size: 12.5px;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .invite-limit-banner.is-full {
    background: rgba(184, 82, 46, 0.06);
    border-color: rgba(184, 82, 46, 0.2);
    color: var(--ink);
  }
  .invite-limit-banner.is-admin {
    background: rgba(31, 58, 82, 0.06);
    border-color: rgba(31, 58, 82, 0.2);
    color: var(--ink);
  }
  .invite-limit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper-2);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
  }
  .invite-limit-banner.is-full .invite-limit-icon { background: #B8522E; }
  .invite-limit-banner.is-admin .invite-limit-icon { background: #1F3A52; }

  /* Admin-only: account switcher in sidebar */
  .admin-account-switcher {
    padding: 12px 12px 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--line-soft);
  }
  html:not(.role-admin) .admin-account-switcher { display: none; }
  .admin-account-switcher-label {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #B8522E;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .admin-account-switcher-label::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #B8522E;
    box-shadow: 0 0 0 2px rgba(184, 82, 46, 0.18);
  }
  .admin-account-switcher select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel-2);
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
    outline: none;
  }
  .admin-account-switcher select:focus { border-color: var(--ink-soft); }
  .admin-account-switcher-meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--ink-mute);
    line-height: 1.4;
  }

  /* ============================================================
     PROPOSAL PAGE
     Full-screen overlay that hosts the generated/example proposal.
     Kept white even in the warm-paper app to match deliverable tone.
     ============================================================ */
  .page-proposal {
    background: #fafaf8;
    overflow-y: auto;
    z-index: 40;
  }
  .proposal-topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(250, 250, 248, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(38, 59, 76, 0.08);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .proposal-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px 8px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .proposal-back:hover {
    color: var(--ink);
    background: rgba(28, 27, 24, 0.04);
    border-color: rgba(28, 27, 24, 0.1);
    transform: translateX(-2px);
  }
  .proposal-crumb {
    margin-left: auto;
    font-family: var(--font-ui);
    font-size: 11.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6a7078;
    font-weight: 500;
  }
  .proposal-crumb strong {
    color: #263b4c;
    font-weight: 600;
  }
  .proposal-actions {
    display: flex;
    gap: 6px;
  }
  .proposal-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: transparent;
    border: 1px solid rgba(38, 59, 76, 0.15);
    border-radius: 6px;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .proposal-action-btn:hover {
    color: var(--ink);
    background: rgba(28, 27, 24, 0.04);
    border-color: rgba(38, 59, 76, 0.3);
  }

  .proposal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    min-height: 400px;
    text-align: center;
    font-family: var(--font-ui);
  }
  .proposal-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(38, 59, 76, 0.1);
    border-top-color: #263b4c;
    border-radius: 50%;
    animation: proposalSpin 0.9s linear infinite;
    margin-bottom: 24px;
  }
  @keyframes proposalSpin { to { transform: rotate(360deg); } }
  .proposal-loading-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    color: #263b4c;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
  }
  .proposal-loading-sub {
    font-size: 13.5px;
    color: #6a7078;
    max-width: 360px;
    line-height: 1.55;
  }
  .proposal-loading-steps {
    margin-top: 20px;
    font-size: 12px;
    color: #9aa0a8;
    font-family: 'Geist Mono', ui-monospace, monospace;
    letter-spacing: 0.02em;
  }
  .proposal-error {
    max-width: 480px;
    margin: 80px auto;
    padding: 32px;
    background: white;
    border: 1px solid rgba(184, 82, 46, 0.25);
    border-radius: 12px;
    text-align: center;
    font-family: var(--font-ui);
  }
  .proposal-error h3 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    color: #263b4c;
    margin-bottom: 8px;
  }
  .proposal-error p {
    font-size: 13.5px;
    color: #6a7078;
    line-height: 1.55;
    margin-bottom: 16px;
  }

  /* ============================================================
     PROPOSAL DOCUMENT — ported from proposal-template.html
     Every selector below is scoped inside .cb-doc to avoid
     clashing with the app's own styles. CSS custom properties
     from the original template are redeclared on .cb-doc.
     ============================================================ */
  .cb-doc {
    --cb-ink:          #1a1a1a;
    --cb-ink-soft:     #3a3f46;
    --cb-ink-muted:    #6a7078;
    --cb-ink-faint:    #9aa0a8;
    --cb-navy:         #263b4c;
    --cb-navy-tint:    #f1f4f7;
    --cb-navy-line:    #d7dde3;
    --cb-teal:         #3b726d;
    --cb-teal-tint:    #eff5f4;
    --cb-teal-soft:    #9fc2bd;
    --cb-slate:        #5772a1;
    --cb-slate-tint:   #eef1f7;
    --cb-ochre:        #a57b3f;
    --cb-ochre-tint:   #f8f2e6;
    --cb-paper:        #ffffff;
    --cb-paper-warm:   #fafaf8;
    --cb-rule:         #d7dbe0;
    --cb-rule-soft:    #e8ebee;
    --cb-font-sans:    "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --cb-font-serif:   "Source Serif 4", ui-serif, Georgia, "Times New Roman", serif;

    max-width: 48rem;
    margin: 0 auto 80px;
    background: var(--cb-paper);
    font-family: var(--cb-font-sans);
    font-weight: 400;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--cb-ink);
    box-shadow: 0 1px 0 rgba(38,59,76,0.04), 0 12px 32px -12px rgba(38,59,76,0.08);
    font-feature-settings: "kern", "liga", "onum";
  }
  .cb-doc *, .cb-doc *::before, .cb-doc *::after { box-sizing: border-box; }
  .cb-doc h1, .cb-doc h2, .cb-doc h3, .cb-doc h4 {
    font-family: var(--cb-font-sans);
    color: var(--cb-navy);
    letter-spacing: -0.01em;
    margin: 0;
  }
  .cb-doc p { margin: 0 0 1rem 0; }
  .cb-doc p:last-child { margin-bottom: 0; }
  .cb-doc strong { font-weight: 600; color: var(--cb-ink); }
  .cb-doc em { font-style: italic; }
  .cb-doc ul { margin: 0 0 1rem 0; padding-left: 1.25rem; }
  .cb-doc ul li { margin-bottom: 0.5rem; }
  .cb-doc ul li::marker { color: var(--cb-ink-muted); }

  .cb-page {
    position: relative;
    padding: 2rem 3rem 3rem;
    border-bottom: 1px solid var(--cb-rule-soft);
  }
  .cb-page:last-child { border-bottom: none; }

  .cb-runhead {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--cb-rule);
    margin-bottom: 3rem;
    font-size: 0.75rem;
    color: var(--cb-ink-soft);
    letter-spacing: 0.01em;
  }
  .cb-runhead__left { display: flex; gap: 0.5rem; align-items: baseline; }
  .cb-runhead__left strong { color: var(--cb-ink); font-weight: 700; }
  .cb-runhead__sep { color: var(--cb-ink-faint); }
  .cb-runhead__right { color: var(--cb-ink-soft); text-align: right; }

  .cb-runfoot {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--cb-rule);
    margin-top: 3rem;
    font-size: 0.75rem;
    color: var(--cb-ink-soft);
  }
  .cb-runfoot strong { color: var(--cb-ink); font-weight: 600; }
  .cb-confidential {
    color: var(--cb-ochre);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.65rem;
  }

  /* Cover */
  .cb-cover__prepared-for {
    font-size: 0.8125rem;
    color: var(--cb-ink-muted);
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
  }
  .cb-cover__client {
    font-family: var(--cb-font-sans);
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.05;
    color: var(--cb-navy);
    letter-spacing: -0.02em;
    margin: 0 0 1rem 0;
  }
  .cb-cover__rule {
    height: 3px;
    background: var(--cb-navy);
    margin: 0.5rem 0 2rem 0;
  }
  .cb-cover__title {
    font-family: var(--cb-font-sans);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--cb-navy);
    letter-spacing: -0.015em;
    max-width: 32ch;
    margin: 0 0 3rem 0;
  }

  /* Section headings */
  .cb-section-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--cb-navy);
    letter-spacing: -0.015em;
    margin: 0 0 0.5rem 0;
  }
  .cb-section-rule {
    height: 1px;
    background: var(--cb-rule);
    margin: 0.5rem 0 1.5rem 0;
  }
  .cb-section-sub {
    font-size: 0.9375rem;
    color: var(--cb-ink-soft);
    margin: 0 0 1.5rem 0;
  }
  .cb-heading-teal {
    color: var(--cb-teal);
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
  }
  .cb-heading-slate {
    color: var(--cb-slate);
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
  }
  .cb-exec-title {
    color: var(--cb-teal);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
  }

  /* TOC */
  .cb-toc { margin-top: 1rem; }
  .cb-toc__row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--cb-rule-soft);
  }
  .cb-toc__row--section > .cb-toc__label { font-weight: 700; color: var(--cb-ink); }
  .cb-toc__row--step { padding-left: 1.5rem; }
  .cb-toc__row--step .cb-toc__label { color: var(--cb-ink-soft); font-weight: 400; }
  .cb-toc__label { flex: 0 1 auto; }
  .cb-toc__dots {
    flex: 1 1 auto;
    border-bottom: 1px dotted var(--cb-rule);
    margin: 0 0.5rem;
    transform: translateY(-4px);
  }
  .cb-toc__page {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    color: var(--cb-ink-muted);
    font-size: 0.8125rem;
  }

  /* Table */
  .cb-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    font-size: 0.9375rem;
  }
  .cb-table thead th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid var(--cb-navy);
    font-weight: 700;
    color: var(--cb-navy);
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
  }
  .cb-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--cb-rule-soft);
    vertical-align: top;
  }
  .cb-table tbody tr:last-child td { border-bottom: 1px solid var(--cb-rule); }
  .cb-table__phase { font-weight: 700; color: var(--cb-ink); white-space: nowrap; }
  .cb-table__phase--baseline { color: var(--cb-ink-muted); }
  .cb-table__lift {
    color: var(--cb-teal);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .cb-table__cumulative {
    color: var(--cb-navy);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  /* Callouts */
  .cb-callout {
    border-left: 3px solid var(--cb-slate);
    background: var(--cb-navy-tint);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 2px 2px 0;
  }
  .cb-callout__title {
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
  }
  .cb-callout__body { color: var(--cb-ink-soft); font-size: 0.9375rem; }
  .cb-callout--teal { border-color: var(--cb-teal); background: var(--cb-teal-tint); }
  .cb-callout--teal .cb-callout__title { color: var(--cb-teal); }
  .cb-callout--slate { border-color: var(--cb-slate); background: var(--cb-slate-tint); }
  .cb-callout--slate .cb-callout__title { color: var(--cb-slate); }
  .cb-callout--ochre { border-color: var(--cb-ochre); background: var(--cb-ochre-tint); }
  .cb-callout--ochre .cb-callout__title { color: var(--cb-ochre); }

  /* Phase hero */
  .cb-phase { margin: 4rem 0 1.5rem 0; }
  .cb-phase__hero {
    border-left: 5px solid var(--cb-navy);
    background: var(--cb-navy-tint);
    padding: 1rem 1.5rem;
  }
  .cb-phase__eyebrow {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--cb-slate);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-right: 0.5rem;
  }
  .cb-phase__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cb-navy);
    display: inline;
    letter-spacing: -0.01em;
  }
  .cb-phase__meta {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    font-size: 0.8125rem;
  }
  .cb-phase__meta-label { color: var(--cb-ink-muted); letter-spacing: 0.02em; }
  .cb-phase__meta-value { color: var(--cb-ink); font-weight: 600; }
  .cb-phase__intro {
    color: var(--cb-ink-soft);
    margin: 1.5rem 0;
    font-size: 0.9375rem;
  }

  /* Step card */
  .cb-step {
    margin-bottom: 1.5rem;
    border: 1px solid var(--cb-rule);
    border-radius: 2px;
    overflow: hidden;
    background: var(--cb-paper);
    break-inside: avoid;
  }
  .cb-step__head {
    border-left: 4px solid var(--cb-slate);
    padding: 0.75rem 1rem;
    background: var(--cb-paper);
    border-bottom: 1px solid var(--cb-rule-soft);
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
  }
  .cb-step__num {
    color: var(--cb-slate);
    font-weight: 700;
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
  }
  .cb-step__title {
    color: var(--cb-ink);
    font-weight: 700;
    font-size: 0.9375rem;
  }
  .cb-step__body { padding: 0; }
  .cb-step__row {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--cb-rule-soft);
    align-items: start;
  }
  .cb-step__row:last-child { border-bottom: none; }
  .cb-step__label {
    color: var(--cb-ink-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: right;
    padding-top: 2px;
  }
  .cb-step__content {
    color: var(--cb-ink);
    font-size: 0.9375rem;
  }
  .cb-step__content p { margin-bottom: 0.5rem; }
  .cb-step__content ul { margin: 0.25rem 0 0 0; padding-left: 1rem; }
  .cb-step__content ul li { margin-bottom: 0.25rem; font-size: 0.9rem; }

  /* Tasks summary */
  .cb-tasks__section { margin-bottom: 1.5rem; }
  .cb-tasks__section-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--cb-navy);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--cb-navy-line);
  }
  .cb-tasks__row {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--cb-rule-soft);
    align-items: baseline;
  }
  .cb-tasks__step {
    color: var(--cb-slate);
    font-weight: 700;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
  }
  .cb-tasks__task { color: var(--cb-ink); font-size: 0.9375rem; }

  /* Roadmap full_automation */
  .cb-full-auto { margin-top: 2rem; }
  .cb-full-auto__title {
    color: var(--cb-slate);
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
  }
  .cb-full-auto ul { padding-left: 1.25rem; }
  .cb-full-auto ul li { margin-bottom: 0.5rem; color: var(--cb-ink-soft); }

  /* Closing */
  .cb-closing {
    padding: 2rem 0;
    border-top: 3px solid var(--cb-navy);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--cb-ink-soft);
  }
  .cb-closing p { margin: 0; }
  .cb-closing strong { color: var(--cb-navy); font-weight: 700; }

  @media (max-width: 720px) {
    .cb-page { padding: 1.5rem 1.25rem 2rem; }
    .cb-step__row { grid-template-columns: 1fr; gap: 0.25rem; }
    .cb-step__label { text-align: left; font-size: 0.75rem; }
    .cb-cover__client { font-size: 2rem; }
    .cb-cover__title { font-size: 1.5rem; }
    .cb-section-title { font-size: 1.5rem; }
  }

  /* ============================================================
     PRINT STYLES — for window.print() and Save-as-PDF.
     Strip every UI surface that isn't the proposal document itself,
     and let the paginated <section class="cb-page"> blocks fall onto
     real pages. The cb-doc retains its full styling — only the chrome
     gets removed.
     ============================================================ */
  @media print {
    /* Ensure colors and gradients render on paper (not the default desaturate) */
    * {
      -webkit-print-color-adjust: exact !important;
      print-color-adjust: exact !important;
      color-adjust: exact !important;
    }

    /* Hide every non-document surface */
    .nav,
    .sidebar,
    .sidebar-fab,
    .topbar,
    .journey-bar,
    .toolbar,
    .zoom-controls,
    .undo-btn,
    .voice-indicator,
    .chat-panel,
    .toast,
    .modal-backdrop,
    .welcome-banner,
    .empty-hint,
    .proposal-topbar,
    .canvas-viewport,
    #appPage,
    #tourPage {
      display: none !important;
    }

    /* The proposal page should fill the print area without its full-screen overlay chrome */
    body, html {
      background: white !important;
      overflow: visible !important;
    }
    #proposalPage {
      position: static !important;
      overflow: visible !important;
      background: white !important;
      padding: 0 !important;
      margin: 0 !important;
    }
    #proposalPage.page-hidden {
      /* Don't hide while printing — the user invoked print FROM this page */
      display: block !important;
    }

    /* Strip the document's own card chrome — let it flow as paper */
    .cb-doc {
      max-width: none !important;
      margin: 0 !important;
      box-shadow: none !important;
      background: white !important;
    }

    /* One section per page break */
    .cb-page {
      page-break-after: always;
      break-after: page;
      border-bottom: none !important;
      padding: 0.75in 0.6in !important;
      min-height: 9.5in;
    }
    .cb-page:last-child {
      page-break-after: auto;
      break-after: auto;
    }

    /* Step cards shouldn't split mid-card across page breaks */
    .cb-step,
    .cb-callout,
    .cb-tasks__row {
      break-inside: avoid;
      page-break-inside: avoid;
    }
  }

  /* Proposal launcher modal overrides */
  .proposal-launch-opts {
    display: grid;
    gap: 10px;
    margin-top: 8px;
  }
  .proposal-launch-opt {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    width: 100%;
  }
  .proposal-launch-opt:hover {
    border-color: var(--ink-soft);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
  }
  .proposal-launch-opt[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
  }
  .proposal-launch-opt[disabled]:hover {
    border-color: var(--line);
    box-shadow: none;
  }
  .proposal-launch-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .proposal-launch-icon-gen { background: #F4E7D1; color: #8B6B2E; }
  .proposal-launch-icon-ex  { background: #E4ECF4; color: #263B4C; }
  .proposal-launch-body { flex: 1; min-width: 0; }
  .proposal-launch-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2px;
  }
  .proposal-launch-sub {
    font-size: 12.5px;
    color: var(--ink-mute);
    line-height: 1.45;
  }

  /* ---------------- AI Assistant Button + Chat Panel ---------------- */
  .ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px 9px 12px;
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
  }
  .ai-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--ink-soft);
  }
  .ai-btn.active {
    background: var(--ink);
    color: var(--paper-2);
    border-color: transparent;
  }
  /* The sparkle carries the brand identity — pink at rest, golden-yellow when active.
     Both pulled directly from the brand hue palette. */
  .ai-btn-sparkle { color: var(--hue-pink); }
  .ai-btn.active .ai-btn-sparkle { color: var(--hue-yellow); }

  /* ---------------- Draft Proposal button ---------------- */
  .draft-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px 9px 12px;
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
  }
  .draft-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--ink-soft);
  }
  .draft-btn svg { color: var(--ink-soft); }
  .draft-btn.has-proposal {
    background: linear-gradient(135deg, #F1F4F7 0%, #E4ECF4 100%);
    border-color: rgba(38, 59, 76, 0.2);
    color: #263B4C;
  }
  .draft-btn.has-proposal svg { color: #3B726D; }
  .draft-btn.has-proposal:hover {
    border-color: #263B4C;
  }
  .draft-btn-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3B726D;
    box-shadow: 0 0 0 2px rgba(59, 114, 109, 0.2);
    display: inline-block;
    flex-shrink: 0;
    margin-left: 2px;
  }

  .chat-panel {
    position: absolute;
    top: 64px;
    right: 12px;
    bottom: 80px;
    width: 380px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translateX(calc(100% + 24px));
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0.28, 1), opacity 0.25s ease;
    z-index: 30;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }
  .chat-panel.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
  .chat-header {
    padding: 14px 16px 12px 14px;
    border-bottom: 1px solid var(--line-soft);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
  }
  .chat-header-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hue-yellow);
    flex-shrink: 0;
  }
  .chat-header-title {
    flex: 1;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.01em;
  }
  .chat-header-title em {
    font-style: normal;
    color: var(--ink-soft);
    font-weight: 700;
  }
  .chat-header-sub {
    font-size: 10.5px;
    font-family: var(--font-mono);
    color: var(--ink-mute);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-right: 2px;
  }
  .chat-close {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: var(--ink-mute);
    transition: all 0.15s;
  }
  .chat-close:hover { background: var(--line-soft); color: var(--ink); }

  .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
  }
  .chat-messages::-webkit-scrollbar { width: 6px; }
  .chat-messages::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

  .chat-welcome {
    padding: 10px 4px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .chat-welcome-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
  }
  .chat-welcome-text {
    color: var(--ink-soft);
    font-size: 13.5px;
    line-height: 1.5;
  }
  .chat-input-cues {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    margin-bottom: 6px;
  }
  .chat-input-cue {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px 4px 8px;
    background: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    font-size: 11px;
    color: var(--ink-soft);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
  }
  .chat-input-cue svg { color: var(--ink-mute); flex-shrink: 0; }
  .chat-input-cue kbd {
    font-family: var(--font-mono);
    font-size: 9.5px;
    background: var(--line-soft);
    padding: 1px 4px;
    border-radius: 3px;
    margin: 0 1px;
  }

  .chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 12px;
  }
  .chat-suggestion {
    padding: 11px 13px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    font-size: 12.8px;
    line-height: 1.4;
    color: var(--ink-soft);
    text-align: left;
    transition: all 0.15s ease;
    background: var(--panel);
    cursor: pointer;
    width: 100%;
  }
  .chat-suggestion:hover {
    border-color: var(--ink-soft);
    color: var(--ink);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    background: var(--panel-2);
  }
  .chat-suggestion-label {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-mute);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 3px;
    font-family: var(--font-mono);
  }

  .chat-msg {
    max-width: 88%;
    font-size: 13.5px;
    line-height: 1.5;
    animation: msgIn 0.22s ease;
    word-wrap: break-word;
  }
  @keyframes msgIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .chat-msg.user {
    align-self: flex-end;
    background: var(--ink);
    color: var(--paper-2);
    padding: 9px 13px;
    border-radius: 14px 14px 4px 14px;
    white-space: pre-wrap;
  }
  .chat-msg.assistant {
    align-self: flex-start;
    color: var(--ink);
    max-width: 100%;
    white-space: pre-wrap;
    padding: 2px 0;
  }
  .chat-action {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px 5px 8px;
    background: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    font-size: 11.5px;
    color: var(--ink-soft);
    font-family: var(--font-mono);
    animation: msgIn 0.22s ease;
    max-width: 100%;
  }
  .chat-action svg { color: #2F6B4E; flex-shrink: 0; }
  .chat-action.error { color: var(--danger); border-color: rgba(184, 82, 46, 0.2); background: rgba(184, 82, 46, 0.06); }
  .chat-action.error svg { color: var(--danger); }

  .chat-thinking {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 4px;
  }
  .chat-thinking span {
    width: 6px;
    height: 6px;
    background: var(--ink-mute);
    border-radius: 50%;
    animation: bounce 1.2s ease infinite;
  }
  .chat-thinking span:nth-child(2) { animation-delay: 0.15s; }
  .chat-thinking span:nth-child(3) { animation-delay: 0.3s; }
  @keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30% { transform: translateY(-4px); opacity: 1; }
  }

  .chat-input-wrap {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--line-soft);
    background: var(--panel);
    flex-shrink: 0;
  }
  .chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 8px 8px 14px;
    transition: all 0.15s;
  }
  .chat-input-row:focus-within {
    border-color: var(--ink-soft);
    box-shadow: 0 0 0 3px rgba(28,27,24,0.04);
  }

  /* Push-to-talk listening state */
  .chat-input-row.listening {
    border-color: #DC2626;
    background: rgba(248, 113, 113, 0.04);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
  }
  .chat-ptt-badge {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 9px;
    background: var(--ink);
    color: var(--paper-2);
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    letter-spacing: 0.01em;
    z-index: 5;
  }
  .chat-input-row.listening .chat-ptt-badge { display: inline-flex; }
  .chat-ptt-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #F87171;
    position: relative;
  }
  .chat-ptt-badge-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: #F87171;
    opacity: 0.4;
    animation: pulse 1.3s ease-out infinite;
  }
  .chat-ptt-badge kbd {
    font-family: var(--font-mono);
    font-size: 10px;
    background: rgba(255,255,255,0.15);
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.02em;
  }
  .chat-input-row { position: relative; }
  .chat-input-row.listening .chat-input::placeholder { color: #DC2626; opacity: 0.7; }
  .chat-input {
    flex: 1;
    font-size: 13.5px;
    line-height: 1.4;
    min-height: 22px;
    max-height: 120px;
    resize: none;
    padding: 4px 0;
    font-family: var(--font-ui);
    overflow-y: auto;
  }
  .chat-input::placeholder { color: var(--ink-mute); }
  .chat-send {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--paper-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
  }
  .chat-send:hover:not(:disabled) { background: #000; transform: translateY(-1px); }
  .chat-send:disabled { opacity: 0.3; cursor: not-allowed; }

  /* Attach button — sits at the start of the input row, opens the file picker */
  .chat-attach-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--ink-mute);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
  }
  .chat-attach-btn:hover {
    background: var(--line-soft);
    color: var(--ink);
  }
  .chat-attach-btn:active {
    transform: scale(0.94);
  }

  /* Attachment chip — appears above the input when a file is staged */
  .chat-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 12px;
    margin-bottom: 8px;
    background: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    font-size: 12px;
    color: var(--ink-soft);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
  }
  .chat-attachment[hidden] { display: none; }
  .chat-attachment-icon {
    color: var(--ink-mute);
    flex-shrink: 0;
  }
  .chat-attachment-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink);
  }
  .chat-attachment-remove {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--ink-mute);
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
  }
  .chat-attachment-remove:hover {
    background: var(--line);
    color: var(--ink);
  }

  /* When a file is being dragged over the chat panel */
  .chat-panel.chat-dragover {
    box-shadow: var(--shadow-lg), 0 0 0 3px var(--hue-yellow);
  }

  .chat-hint {
    font-size: 10.5px;
    color: var(--ink-mute);
    margin-top: 8px;
    padding: 0 4px;
    text-align: center;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
  }
  .chat-hint kbd {
    font-family: var(--font-mono);
    font-size: 10px;
    background: var(--line-soft);
    padding: 1px 4px;
    border-radius: 3px;
    color: var(--ink-soft);
  }


/* =====================================================================
   CSP-strict utility classes
   These replace inline style="..." attributes so the CSP can drop
   'unsafe-inline' from style-src. Added by the security hardening pass.
   ===================================================================== */

/* Generic utilities */
.u-dim          { opacity: 0.6; }
.u-invisible    { visibility: hidden; }
.u-full-width   { width: 100%; }
.u-mt-10        { margin-top: 10px; }
.u-mt-20        { margin-top: 20px; }
.u-mt-2rem      { margin-top: 2rem; }
.u-mw-160       { max-width: 160px; }
.u-ml-0         { margin-left: 0; }
.u-ink-mute     { color: var(--ink-mute); font-weight: 400; }

/* Sidebar collaborators label gets a tighter top padding than the default */
.sidebar-section-label--collabs { padding: 0 0 8px; }

/* SVG icon inside the "Invite teammates" button - small inline alignment tweak */
.profile-invite-icon { margin-right: 6px; vertical-align: -2px; }

/* Default color swatch background (user changes this via the picker; JS will
   override .style.background at runtime, so this is just the initial paint) */
.color-swatch--default { background: #FDE68A; }

/* Tour preview (page-tour) decorative card on slide 1.
   Each .tv-* element below is a static, hardcoded position in the mini whiteboard
   illustration. Uses class-based positioning instead of inline style. */
.tour-preview-caption {
  font-size: 12px;
  color: var(--ink-soft);
  max-width: 180px;
  text-align: left;
  line-height: 1.5;
}
.tv-label--pp1     { left: 12px;  top: 10px; }
.tv-label--pp2     { left: 12px;  top: 128px; }
.tv-note--pp1      { background: #FDE68A; left: 14px;  top: 32px;  transform: rotate(-1.5deg); }
.tv-note--pp2      { background: #BFDBFE; left: 82px;  top: 38px;  transform: rotate(1deg); }
.tv-note--pp3      { background: #FBCFE8; left: 150px; top: 28px;  transform: rotate(-0.8deg); }
.tv-note--pp4      {
  background: #BBF7D0; left: 14px; top: 146px; transform: rotate(1.3deg);
  width: 66px; height: 28px; font-size: 7px; padding: 5px;
}
.tv-dot--pp1       { background: #B85A3C; left: 28px; top: 92px; }
.tv-dot--pp2       { background: #2F6B4E; left: 42px; top: 96px; }
.tv-emoji--pp1     { left: 96px;  top: 94px; }
.tv-emoji--pp2     { left: 164px; top: 90px; }

/* Access fail-closed overlay (shown when /cdn-cgi/access/get-identity fails
   in production). Replaces inline styles in showAccessError so the CSP can
   stay strict. Inlined-looking styling is deliberate so it works even if
   most of the page hasn't applied. */
.access-error-backdrop {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  background: #ECE6DA; padding: 32px;
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  color: #1C1B18;
}
.access-error-card {
  max-width: 440px;
  text-align: center;
}
.access-error-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.access-error-body {
  font-size: 14px;
  line-height: 1.55;
  color: #4A4741;
  margin-bottom: 20px;
}
.access-error-body strong {
  color: #1C1B18;
}
.access-error-btn {
  padding: 10px 20px;
  background: #1C1B18;
  color: #F3EEE3;
  border: none;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}
