/* ================================================================
   Page: Search
   ================================================================ */

@layer components {
  .search-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-8) 0;
  }

  .search-title {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--space-6);
    text-align: center;
  }

  .search-subtitle {
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: var(--space-8);
  }

  .search-box-wrapper {
    position: relative;
    margin-bottom: var(--space-4);
    background: var(--color-surface-raised);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-full);
    padding: var(--space-1) var(--space-1) var(--space-1) var(--space-6);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: stretch;
    min-height: 64px;
    overflow: visible;
  }

  .search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: var(--font-size-lg);
    padding: 0.9rem 0;
    resize: none;
    min-height: 24px;
    max-height: 15rem;
    background: transparent;
    line-height: 1.5;
    overflow-y: hidden;
    font-family: inherit;
    color: var(--color-text);
  }

  .search-btn {
    background: var(--color-accent-ink);
    color: white;
    border: none;
    padding: 0 2.2rem;
    height: 50px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    align-self: center;
    margin-left: var(--space-2);
    font-family: inherit;
    font-size: 1rem;
  }

  .search-btn:hover {
    background: var(--color-accent-ink-hover);
  }

  .search-hint {
    max-width: 800px;
    margin: calc(-1 * var(--space-2)) auto var(--space-4);
    font-size: var(--font-size-sm);
    color: var(--color-error);
    text-align: center;
    min-height: 1.2em;
  }

  .search-toggle {
    margin-bottom: var(--space-12);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    background: var(--color-surface-sunken);
    padding: var(--space-3);
    border-radius: var(--radius-full);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--color-border);
  }

  .search-toggle-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
  }

  /* Mention menu */
  .mention-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 320px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    margin-bottom: 12px;
    overflow: hidden;
  }

  .mention-menu.active {
    display: block;
  }

  .mention-menu-header {
    padding: var(--space-4);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-tertiary);
    letter-spacing: 0.05em;
  }

  .mention-item {
    padding: var(--space-3) var(--space-5);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: background 0.2s;
    font-size: var(--font-size-sm);
    border-left: 4px solid transparent;
  }

  .mention-item:first-child {
    border-left-color: var(--color-accent);
  }

  .mention-item:hover {
    background: var(--color-surface);
  }

  .mention-item-icon {
    font-size: var(--font-size-lg);
  }

  .mention-item-name {
    font-weight: 600;
    color: var(--color-text);
  }

  .mention-item-type {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    display: block;
  }

  .mention-item > div {
    display: flex;
    flex-direction: column;
  }

  /* AI result card */
  .ai-result-card {
    border: 1px solid var(--color-accent);
    background: var(--color-surface-raised);
    padding: var(--space-8);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
  }

  .ai-result-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-6);
    justify-content: space-between;
  }

  .ai-result-title {
    margin: 0;
    font-size: var(--font-size-2xl);
    color: var(--color-accent-ink);
  }

  .search-loading-state {
    margin-bottom: var(--space-8);
    background: var(--color-surface-sunken);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
  }

  .search-result-item {
    margin-bottom: var(--space-4);
    padding: var(--space-5);
    cursor: pointer;
  }

  .search-result-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2);
  }

  .search-result-item-title {
    margin: 0;
    color: var(--color-primary);
    font-size: var(--font-size-lg);
  }

  .search-result-item-date {
    font-size: 0.75rem;
    background: var(--color-surface-sunken);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    flex-shrink: 0;
  }

  .search-result-item-snippet {
    margin: var(--space-2) 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
  }

  .search-result-item-committee {
    margin-top: var(--space-3);
    font-size: 0.75rem;
    color: var(--color-accent-ink);
    font-weight: 600;
  }

  #document-results {
    margin-top: var(--space-8);
  }

  .search-section-header {
    margin-bottom: var(--space-6);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-2);
  }

  .search-section-subheader {
    margin-bottom: var(--space-4);
    color: var(--color-text-tertiary);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
  }

  .search-error {
    color: var(--color-error);
  }

  .search-loading-flex {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
  }

  .search-loading-text {
    color: var(--color-text-secondary);
    font-style: italic;
  }

  .ai-loading-steps {
    list-style-type: none;
    padding-left: 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
  }

  .ai-loading-steps li {
    margin-bottom: var(--space-1);
    padding-left: 1.2em;
    position: relative;
  }

  .ai-loading-steps li::before {
    position: absolute;
    left: 0;
  }

  .ai-loading-steps li.ai-step-done {
    color: var(--color-text-tertiary);
  }

  .ai-loading-steps li.ai-step-done::before {
    content: "\2713";
  }

  .ai-loading-steps li.ai-step-active {
    color: var(--color-text);
    font-weight: 500;
  }

  .ai-loading-steps li.ai-step-active::before {
    content: "\25CF";
    animation: pulse-dot 1s ease-in-out infinite;
  }

  @keyframes pulse-dot {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
  }

  .ai-error {
    color: var(--color-error);
    font-style: italic;
  }

  .ai-rate-limit-notice {
    text-align: center;
    padding: var(--space-6) var(--space-4);
  }

  .ai-rate-limit-notice p {
    margin-bottom: var(--space-3);
  }

  .ai-rate-limit-notice .btn {
    margin-top: var(--space-3);
  }

  .ai-expand-btn {
    display: block;
    margin-top: var(--space-3);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-accent-ink);
    cursor: pointer;
    font-size: var(--font-size-sm);
    padding: var(--space-2) var(--space-4);
    width: 100%;
    text-align: center;
    transition: background 0.15s, color 0.15s;
  }

  .ai-expand-btn:hover {
    background: var(--color-accent-ink);
    color: #fff;
  }

  .about-block-note {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
  }

  .ai-result-title-group {
    display: flex;
    align-items: center;
  }

  .ai-result-icon {
    font-size: 1.5rem;
    margin-right: var(--space-3);
  }

  .ai-content {
    line-height: 1.8;
    font-size: var(--font-size-base);
    color: var(--color-text);
  }

  .cited-source-bubble {
    margin-top: 0.1rem;
    margin-right: var(--space-4);
    flex-shrink: 0;
    cursor: default;
    transform: none;
    box-shadow: none;
  }

  /* Landing sections (anonymous only) */
  .landing-section {
    max-width: 800px;
    margin: var(--space-16) auto 0;
    padding: 0 var(--space-4);
  }

  .about-block {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    padding: var(--space-8) var(--space-10);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-16);
    box-shadow: var(--shadow-sm);
  }

  .about-block h2 {
    margin: 0 0 var(--space-4);
    font-size: 1.5rem;
  }

  .about-block p {
    font-size: var(--font-size-base);
    line-height: 1.7;
    color: var(--color-text-secondary);
  }

  .about-block p:last-child {
    margin-bottom: 0;
  }

  /* MCP section */
  .mcp-section {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-12) var(--space-10);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-12);
  }

  .mcp-eyebrow {
    display: inline-block;
    background: var(--color-accent-light);
    color: var(--color-accent-ink);
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
  }

  .mcp-section h2 {
    font-size: var(--font-size-3xl);
    margin: 0 0 var(--space-3);
    font-weight: 400;
    line-height: 1.25;
  }

  .mcp-section .lead {
    font-size: var(--font-size-base);
    line-height: 1.65;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
  }

  .mcp-explainer {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
  }

  .mcp-explainer h3 {
    font-size: 1rem;
    margin: 0 0 var(--space-3);
    color: var(--color-primary);
    font-weight: 700;
    font-family: var(--font-body);
  }

  .mcp-explainer p {
    font-size: var(--font-size-sm);
    line-height: 1.65;
    color: var(--color-text-secondary);
    margin: 0;
  }

  .mcp-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-8);
  }

  .mcp-feature {
    padding: var(--space-5);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
  }

  .mcp-feature .icon {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-2);
    display: block;
  }

  .mcp-feature h4 {
    margin: 0 0 var(--space-1);
    font-size: var(--font-size-sm);
    font-weight: 700;
  }

  .mcp-feature p {
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--color-text-secondary);
  }

  .mcp-examples {
    background: var(--color-primary);
    color: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
  }

  .mcp-examples h3 {
    margin: 0 0 var(--space-4);
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    font-family: var(--font-body);
  }

  .mcp-examples ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .mcp-examples li {
    padding: var(--space-2) 0;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-primary-light);
  }

  .mcp-examples li:last-child {
    border-bottom: none;
  }

  .mcp-examples li::before {
    content: '\201C';
    color: var(--color-accent-ink);
    margin-right: 0.25rem;
  }

  .mcp-examples li::after {
    content: '\201D';
    color: var(--color-accent-ink);
    margin-left: 0.25rem;
  }

  .mcp-cta {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    align-items: center;
  }

  .mcp-cta-primary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    background: var(--color-accent-ink);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-size-sm);
    transition: opacity 0.2s, transform 0.2s;
  }

  .mcp-cta-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    color: white;
  }

  .mcp-cta-secondary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-size-sm);
  }

  .mcp-cta-secondary:hover {
    color: var(--color-accent-ink);
  }

  .mcp-clients {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    align-items: center;
  }

  .mcp-clients strong {
    color: var(--color-text);
    margin-right: var(--space-2);
  }

  .mcp-client-pill {
    background: var(--color-surface-sunken);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-lg);
    color: var(--color-text-secondary);
    font-weight: 500;
  }

  @media (max-width: 600px) {
    .mcp-section {
      padding: var(--space-8) var(--space-6);
    }
    .about-block {
      padding: var(--space-6);
    }
    .mcp-section h2 {
      font-size: 1.5rem;
    }
  }

  /* F3 — "Bekijk volledige kalender" link in mention-menu / future sidebar-picker[meeting] */
  .sidebar-calendar-link {
    display: block;
    text-align: center;
    padding-top: var(--space-3);
    padding-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    border-top: 1px solid var(--color-border-subtle);
    margin-top: var(--space-2);
    transition: color 0.15s;
  }

  .sidebar-calendar-link:hover {
    color: var(--color-accent-ink);
  }
}

/* ================================================================
   Chat Workbench (Phase 7+) — two-state landing (initial ↔ chat)
   Oatmeal-aligned typography + warm civic palette (WS8a locked).
   ================================================================ */
@layer components {

  /* Shell */
  .chat-workbench {
    position: relative;
  }

  /* Sidebar — hidden by default; opened by .is-open class (toggled via JS).
     Tight Oatmeal-style column. Uses class-based visibility (reliable) rather
     than [hidden] attribute. */
  .chat-sidebar {
    position: fixed;
    /* Sit BELOW the sticky site-header, not over it. Nav height ~ 4.5rem at
       desktop padding. Reduced on mobile where padding is tighter. */
    top: 4.5rem;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--color-surface-raised);
    border-right: 1px solid var(--color-border-subtle);
    border-top: 1px solid var(--color-border-subtle);
    z-index: var(--z-nav);
    overflow-y: auto;
    padding: var(--space-5) var(--space-5) var(--space-6);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    gap: var(--space-4);
    transform: translateX(-100%);
    transition: transform 200ms cubic-bezier(.4,0,.2,1);
    display: none;
    font-size: var(--font-size-sm);
  }
  @media (max-width: 768px) {
    .chat-sidebar { top: 4rem; }
  }

  .chat-sidebar.is-open {
    display: flex;
    transform: translateX(0);
  }

  .chat-sidebar-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border-subtle);
  }

  .chat-sidebar-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    margin: 0;
  }

  .chat-sidebar-close {
    background: none;
    border: none;
    font-size: var(--font-size-xl);
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0 var(--space-1);
    line-height: 1;
  }

  .chat-sidebar-close:hover { color: var(--color-text); }

  .sidebar-picker h3 {
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: var(--letter-spacing-widest);
    text-transform: uppercase;
    margin: 0 0 var(--space-2) 0;
    color: var(--color-text-secondary);
  }

  .sidebar-picker input[type="search"] {
    width: 100%;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-1);
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    background: var(--color-surface);
  }

  .sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  /* Soft fade + divider at the bottom of scrollable lists so users know the
     list scrolls and where it ends inside the sidebar column. */
  .sidebar-picker[data-picker="meeting"] .sidebar-list {
    border-bottom: 1px solid var(--color-border-subtle);
    padding-bottom: var(--space-2);
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
  }

  .sidebar-list-static { max-height: none; }

  .sidebar-list li { margin: 0; padding: 0; }

  .sidebar-list button {
    width: 100%;
    text-align: left;
    padding: var(--space-1) var(--space-2);
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    line-height: var(--line-height-snug);
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: background 120ms;
  }

  .sidebar-list button:hover {
    background: var(--color-surface-sunken);
  }

  .meeting-date-pill {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    min-width: 38px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
  }

  .meeting-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-empty {
    padding: var(--space-3);
    color: var(--color-text-tertiary);
    font-size: var(--font-size-xs);
    text-align: center;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: color-mix(in oklab, var(--color-primary) 40%, transparent);
    z-index: calc(var(--z-nav) - 1);
    pointer-events: none;
  }

  /* Chip rail (attached context) */
  .chip-rail {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
    margin-bottom: var(--space-2);
  }

  .chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    cursor: pointer;
    font-family: var(--font-body);
    color: var(--color-text);
    transition: background 120ms;
  }

  .chip:hover {
    background: var(--color-surface-sunken);
  }

  .chip-close {
    font-size: var(--font-size-base);
    line-height: 1;
    color: var(--color-text-secondary);
  }

  /* Quick-action chips (below search box in initial state, below composer in chat state) */
  .quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
    margin-top: var(--space-4);
  }

  .quick-action {
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-raised);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 120ms;
  }

  .quick-action:hover {
    background: var(--color-surface-sunken);
    border-color: var(--color-border-strong);
  }

  /* On hero (dark background), make quick-actions legible */
  .landing-hero-content .quick-action {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--color-text-on-dark);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .landing-hero-content .quick-action:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--color-accent);
  }

  .landing-hero-content .chip {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--color-text-on-dark);
  }

  /* Chat thread: fill the viewport on small screens; cap comfortably on
     desktop. Using min() means we scale smoothly from 100% at narrow
     widths up to the hard cap at large displays — no awkward "stuck at
     48rem on a 780px window" gap between breakpoints. */
  .chat-thread {
    max-width: min(100%, 80rem);
    width: 100%;
    margin: 0 auto;
    padding: var(--space-8) var(--space-5) var(--space-32);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }

  .chat-turn {
    display: flex;
    flex-direction: column;
  }

  .chat-turn-user { align-items: flex-end; }
  .chat-turn-assistant { align-items: flex-start; }

  .chat-bubble {
    max-width: 85%;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-xl);
    line-height: var(--line-height-body);
    font-size: var(--font-size-base);
  }

  .chat-bubble-user {
    background: var(--color-primary);
    color: var(--color-text-on-dark);
    border-bottom-right-radius: var(--radius-sm);
  }

  .chat-bubble-assistant {
    background: var(--color-surface-raised);
    color: var(--color-text);
    border: 1px solid var(--color-border-subtle);
    border-bottom-left-radius: var(--radius-sm);
    max-width: 100%;
  }

  .chat-bubble-text {
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  .chat-turn-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-xs);
    opacity: 0.9;
  }

  .chat-turn-chips span {
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
  }

  .chat-bubble-content {
    max-width: 95ch;
  }

  .chat-result-artifacts {
    margin-top: var(--space-4);
    width: min(100%, 72rem);
  }

  .chat-result-artifacts nd-motie-table {
    display: block;
  }

  .chat-steps {
    margin: 0 0 var(--space-3) 0;
    padding: 0;
    list-style: none;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
  }

  /* Inherit the 1.2em left-padding from .ai-loading-steps li so the animated
     ::before dot has room and doesn't overlap the label text. */
  .chat-steps li {
    padding: var(--space-1) 0 var(--space-1) 1.2em;
    opacity: 0.6;
  }

  .chat-steps .ai-step-active { opacity: 1; }
  .chat-steps .ai-step-done { opacity: 0.45; text-decoration: none; }

  /* Stop button on a streaming answer (ADR-0035 Phase 2 resumable chat) */
  .chat-stop-btn {
    margin-top: var(--space-3);
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    background: transparent;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-full);
    cursor: pointer;
  }
  .chat-stop-btn:hover { color: var(--color-text); border-color: var(--color-text-secondary); }
  .chat-stop-btn[disabled] { opacity: 0.5; cursor: default; }

  .ai-muted { color: var(--color-text-secondary); font-style: italic; }

  /* Composer (follow-up input in chat state) — in-flow, NOT fixed.
     Fixed-bottom caused three problems: hid the footer, overlapped content
     short-answer state, and made the page feel dead-empty below the chat.
     Now the composer sits naturally after the last bubble; footer follows. */
  .chat-composer {
    padding: var(--space-6) var(--space-5) var(--space-4);
    margin: 0 auto;
    max-width: min(100%, 80rem);
    width: 100%;
  }

  .chat-composer[hidden] { display: none; }

  .chat-composer-inner {
    max-width: min(100%, 80rem);
    margin: 0 auto;
  }

  .chat-composer .chip-rail-chat { margin-bottom: var(--space-2); }

  .chat-input-wrapper {
    margin-bottom: var(--space-2);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
  }

  .chat-input { color: var(--color-text); }
  .chat-input::placeholder { color: var(--color-text-tertiary); }

  .chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .chat-quick-actions .quick-action {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
  }

  .chat-reset {
    margin-left: auto;
  }

  /* In chat state, hide hero + demo + nudges + legacy document-results */
  .chat-workbench[data-state="chat"] .landing-hero-image,
  .chat-workbench[data-state="chat"] .demo-answer-card,
  .chat-workbench[data-state="chat"] #account-nudge,
  .chat-workbench[data-state="chat"] #mcp-nudge,
  .chat-workbench[data-state="chat"] #document-results,
  .chat-workbench[data-state="chat"] #search-hint {
    display: none;
  }

  /* Chat thread padding-bottom now modest — composer sits below in-flow */
  .chat-workbench[data-state="chat"] .chat-thread {
    padding-bottom: var(--space-6);
  }

  /* Chat state layout: body becomes a flex column spanning the viewport so
     the composer + footer always sit at the bottom edge regardless of how
     short the thread is. Long threads scroll naturally. */
  body.chat-active {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
  }
  body.chat-active main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    padding-top: var(--space-4);
    padding-bottom: 0;
  }
  body.chat-active .chat-workbench,
  body.chat-active .chat-workbench-main {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    padding-top: 0;
  }
  /* Release the 800px .search-container cap in chat state so chat-thread +
     composer can fill up to their own 64rem (1024px) cap. Without this,
     the parent bottlenecks children to 800px regardless of child rules.
     Covers both state flags — data-state="chat" flips immediately on
     submit; body.chat-active follows slightly later. */
  body.chat-active .search-container,
  .chat-workbench[data-state="chat"].chat-workbench-main,
  .chat-workbench[data-state="chat"] .search-container,
  .search-container.chat-workbench-main:has(.chat-thread:not([hidden])) {
    max-width: 100%;
  }
  body.chat-active .chat-thread {
    flex: 1 0 auto;
  }
  body.chat-active .chat-composer {
    margin-top: auto; /* pushes composer toward the viewport bottom when thread short */
    padding-bottom: var(--space-2);
  }
  body.chat-active .site-footer {
    flex-shrink: 0;
    margin-top: 0;
    padding-block: var(--space-6);
  }

  /* Mobile */
  @media (max-width: 768px) {
    .chat-sidebar {
      width: 100%;
      max-width: 100%;
    }
    .chat-bubble {
      max-width: 92%;
    }
    .chat-composer {
      padding: var(--space-3);
    }
  }

  /* ────────────────────────────────────────────────────────────────
     Claude-style composer (Oatmeal-scale typography + warm borders)
     Used in two places: hero (initial state) + pinned (chat state)
     ──────────────────────────────────────────────────────────────── */
  .claude-composer {
    position: relative;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 200ms, border-color 200ms;
  }

  .claude-composer:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-accent) 20%, transparent);
  }

  .claude-composer__input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    resize: none;
    font-family: var(--font-body);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-body);
    color: var(--color-text);
    padding: 0;
    min-height: 3.25rem;
    max-height: 16rem;
    overflow-y: auto;
  }

  .claude-composer__input::placeholder {
    color: var(--color-text-tertiary);
  }

  .claude-composer__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .claude-composer__right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .claude-composer__attach,
  .claude-composer__send,
  .claude-composer__reset {
    font-family: var(--font-body);
    cursor: pointer;
    transition: background 150ms, transform 150ms, color 150ms;
  }

  .claude-composer__attach {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-full);
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: var(--font-size-xl);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .claude-composer__attach:hover {
    background: var(--color-surface-sunken);
    color: var(--color-text);
  }

  .claude-composer__reset {
    background: transparent;
    border: none;
    padding: var(--space-1) var(--space-3);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    border-radius: var(--radius-full);
  }

  .claude-composer__reset:hover {
    background: var(--color-surface-sunken);
    color: var(--color-text);
  }

  .claude-composer__send {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    background: var(--color-accent-ink);
    color: var(--color-text-on-dark);
    border: none;
    font-size: var(--font-size-xl);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
  }

  .claude-composer__send:hover {
    background: var(--color-accent-ink-hover);
    transform: translateY(-1px);
  }

  .claude-composer__send:active {
    transform: translateY(0);
  }

  /* Hero variant: big, centered, frosted-glass on skyline */
  .claude-composer--hero {
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
    background: color-mix(in oklab, white 18%, transparent);
    border-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 8px 32px rgba(4, 40, 37, 0.18);
  }

  .claude-composer--hero .claude-composer__input {
    color: var(--color-text-on-dark);
  }

  .claude-composer--hero .claude-composer__input::placeholder {
    color: rgba(255, 255, 255, 0.7);
  }

  .claude-composer--hero .claude-composer__attach {
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.85);
  }

  .claude-composer--hero .claude-composer__attach:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-text-on-dark);
  }

  /* Pinned variant: compact, near the page edge. Width tracks .chat-thread
     so the composer visually belongs to the thread above it. */
  .claude-composer--pinned {
    max-width: min(100%, 80rem);
    margin: 0 auto;
    padding: var(--space-3) var(--space-4) var(--space-2);
  }

  .claude-composer--pinned .claude-composer__input {
    font-size: var(--font-size-base);
    min-height: 2.75rem;
  }

  /* Mention menu anchoring inside Claude composer — pop up above the textarea
     so it works in both hero and pinned-composer positions. */
  .claude-composer .mention-menu {
    left: var(--space-4);
    right: var(--space-4);
    width: auto;
    bottom: calc(100% + var(--space-2));
    max-width: none;
  }

  /* Past meetings in sidebar: slightly muted so upcoming jumps out first
     (list itself is sorted desc so today/recent-past are on top anyway). */
  .sidebar-list button.is-past .meeting-label {
    color: var(--color-text-secondary);
  }
  .sidebar-list button.is-past .meeting-date-pill {
    opacity: 0.7;
  }

  /* ──── Subscription teaser on landing ──── */
  .subscription-teaser {
    max-width: 40rem;
    margin: var(--space-10) auto var(--space-6);
    padding: var(--space-6) var(--space-8);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
  }
  .subscription-teaser-kicker {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: var(--letter-spacing-widest);
    text-transform: uppercase;
    color: var(--color-accent-ink);
    margin: 0 0 var(--space-2);
  }
  .subscription-teaser-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-xl);
    line-height: var(--line-height-snug);
    letter-spacing: var(--letter-spacing-display);
    color: var(--color-text);
    margin: 0 0 var(--space-2);
  }
  .subscription-teaser-lede {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-4);
    line-height: var(--line-height-body);
  }
  .subscription-teaser-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
  }
  .chat-workbench[data-state="chat"] .subscription-teaser { display: none; }

  /* ──── /abonnement pricing page ──── */
  .pricing-page {
    max-width: var(--container-2xl);
    margin: 0 auto;
    padding: var(--space-10) var(--space-6) var(--space-16);
  }
  .pricing-intro {
    text-align: center;
    max-width: 40rem;
    margin: 0 auto var(--space-12);
  }
  .pricing-kicker {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: var(--letter-spacing-widest);
    text-transform: uppercase;
    color: var(--color-accent-ink);
    margin: 0 0 var(--space-3);
  }
  .pricing-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-5xl);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-display);
    color: var(--color-text);
    margin: 0 0 var(--space-4);
  }
  .pricing-lede {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-body);
    color: var(--color-text-secondary);
    max-width: 40ch;
    margin: 0 auto;
  }
  .pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }
  @media (max-width: 900px) {
    .pricing-grid { grid-template-columns: 1fr; }
  }
  .pricing-card {
    position: relative;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }
  .pricing-card--highlight {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-accent) 18%, transparent);
  }
  .pricing-card--soon {
    opacity: 0.72;
    border-style: dashed;
  }
  .pricing-card-badge {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    font-size: var(--font-size-xs);
    letter-spacing: var(--letter-spacing-widest);
    text-transform: uppercase;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--color-accent-ink);
    color: var(--color-text-on-dark);
  }
  .pricing-card-badge--soon {
    background: var(--color-text-secondary);
  }
  .pricing-grid--three {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  }
  .pricing-cta.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
  }
  .tier-option--disabled {
    opacity: 0.55;
    cursor: not-allowed;
  }
  .pricing-card-name {
    font-family: var(--font-heading);
    font-size: var(--font-size-3xl);
    letter-spacing: var(--letter-spacing-display);
    margin: 0;
    color: var(--color-primary);
  }
  .pricing-card-price {
    font-family: var(--font-heading);
    font-size: var(--font-size-5xl);
    line-height: 1;
    margin: 0;
    color: var(--color-text);
  }
  .pricing-card-price small {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    font-weight: 500;
  }
  .pricing-card-audience {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-2);
  }
  .pricing-card-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }
  .pricing-card-list li {
    position: relative;
    padding-left: var(--space-5);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-body);
    color: var(--color-text);
  }
  .pricing-card-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--color-accent-ink);
    font-weight: 600;
  }
  .pricing-cta {
    margin-top: auto;
    align-self: flex-start;
  }
  .pricing-note {
    max-width: 40rem;
    margin: var(--space-12) auto 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    text-align: center;
    line-height: var(--line-height-body);
  }

  /* Two-tier variant (WS8f Profiel upgrade) */
  .pricing-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 60rem;
    margin-left: auto;
    margin-right: auto;
  }
  @media (max-width: 900px) {
    .pricing-grid--two { grid-template-columns: 1fr; }
  }

  .pricing-card-price-strike {
    font-family: var(--font-heading);
    color: var(--color-text-tertiary);
    text-decoration: line-through;
    margin-right: var(--space-2);
    font-size: 0.65em;
  }

  .pricing-card-note {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: var(--line-height-body);
    margin: 0 0 var(--space-2);
  }

  .pricing-cta-form {
    margin-top: auto;
  }

  .pricing-cta.is-current {
    opacity: 0.75;
    pointer-events: none;
  }

  .pricing-faq {
    max-width: 48rem;
    margin: var(--space-16) auto 0;
  }
  .pricing-faq-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-3xl);
    letter-spacing: var(--letter-spacing-display);
    text-align: center;
    color: var(--color-text);
    margin: 0 0 var(--space-6);
  }
}
