    /* ─── RESET & VARIABLES ─────────────────────────────────────────── */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg-deep:       #09090b;
      --bg-base:       #0f0f12;
      --bg-surface:    #16161a;
      --bg-elevated:   #1e1e24;
      --bg-hover:      #252530;

      --border-subtle: #1f1f28;
      --border-mid:    #2a2a38;
      --border-accent: #3a3a50;

      --text-primary:  #e8e8f0;
      --text-secondary:#8888aa;
      --text-muted:    #55556a;
      --text-dim:      #333344;

      --accent-primary: #5b6af0;
      --accent-glow:    rgba(91, 106, 240, 0.15);
      --accent-hover:   #6e7df5;

      --status-tisax:   #f0a05b;
      --status-iso:     #5bf0c0;
      --status-c5:      #8b5bf0;
      --status-done:    #5bf05b;
      --status-warn:    #f0c05b;
      --status-danger:  #f05b5b;

      --font-display: 'Syne', sans-serif;
      --font-body:    'DM Sans', sans-serif;
      --font-mono:    'DM Mono', monospace;

      --nav-width: 240px;
      --header-h:  52px;
      --radius:    6px;
      --radius-lg: 10px;
    }

    html, body {
      height: 100%;
      background: var(--bg-deep);
      color: var(--text-primary);
      font-family: var(--font-body);
      font-size: 14px;
      line-height: 1.6;
      -webkit-font-smoothing: antialiased;
    }

    /* ─── AUTH SCREEN ───────────────────────────────────────────────── */
    #auth-screen {
      position: fixed; inset: 0;
      display: flex; align-items: center; justify-content: center;
      background: var(--bg-deep);
      z-index: 1000;
    }

    .auth-card {
      width: 380px;
      background: var(--bg-surface);
      border: 1px solid var(--border-mid);
      border-radius: var(--radius-lg);
      padding: 40px;
      position: relative;
      overflow: hidden;
    }

    .auth-card::before {
      content: '';
      position: absolute;
      top: -60px; left: -60px;
      width: 200px; height: 200px;
      background: radial-gradient(circle, rgba(91,106,240,0.12) 0%, transparent 70%);
      pointer-events: none;
    }

    .auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
    .auth-logo-mark {
      width: 32px; height: 32px;
      background: var(--accent-primary);
      border-radius: 4px;
      display: flex; align-items: center; justify-content: center;
      font-family: var(--font-mono);
      font-size: 13px; font-weight: 500;
      color: #fff; letter-spacing: -0.5px;
    }
    .auth-logo-text { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
    .auth-logo-text span { color: var(--accent-primary); }
    .auth-headline { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 6px; }
    .auth-sub { color: var(--text-secondary); font-size: 13px; margin-bottom: 28px; }
    .auth-field { margin-bottom: 14px; }
    .auth-field label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
    .auth-field input { width: 100%; background: var(--bg-elevated); border: 1px solid var(--border-mid); border-radius: var(--radius); padding: 10px 12px; color: var(--text-primary); font-family: var(--font-body); font-size: 14px; transition: border-color 0.15s; outline: none; }
    .auth-field input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-glow); }
    .auth-btn { width: 100%; padding: 11px; background: var(--accent-primary); color: #fff; border: none; border-radius: var(--radius); font-family: var(--font-body); font-size: 14px; font-weight: 500; cursor: pointer; margin-top: 8px; transition: background 0.15s, transform 0.1s; }
    .auth-btn:hover { background: var(--accent-hover); }
    .auth-btn:active { transform: scale(0.99); }
    .auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .auth-notice { margin-top: 20px; padding: 12px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius); font-size: 12px; color: var(--text-muted); text-align: center; }
    .auth-tabs { display:flex; gap:4px; margin-bottom:24px; background:var(--bg-elevated); border:1px solid var(--border-subtle); border-radius:var(--radius); padding:3px; }
    .auth-tab { flex:1; padding:8px; background:transparent; border:none; border-radius:6px; font-family:var(--font-body); font-size:13px; font-weight:500; color:var(--text-muted); cursor:pointer; transition:all 0.15s; }
    .auth-tab.active { background:var(--bg-surface); color:var(--text-primary); box-shadow:0 1px 3px rgba(0,0,0,0.3); }
    .auth-notice strong { color: var(--text-secondary); }
    .auth-msg { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; display: none; }
    .auth-msg.success { display: block; background: rgba(91, 240, 192, 0.08); border: 1px solid rgba(91, 240, 192, 0.2); color: var(--status-iso); }
    .auth-msg.error { display: block; background: rgba(240, 91, 91, 0.08); border: 1px solid rgba(240, 91, 91, 0.2); color: var(--status-danger); }

    /* ─── MAIN APP LAYOUT ───────────────────────────────────────────── */
    #app { display: none; height: 100vh; overflow: hidden; }
    #app.visible { display: flex; flex-direction: column; }

    .header { height: var(--header-h); background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; padding: 0 20px; gap: 16px; flex-shrink: 0; z-index: 10; }
    .header-logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
    .logo-mark { width: 26px; height: 26px; background: var(--accent-primary); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: #fff; }
    .logo-name { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
    .logo-name span { color: var(--accent-primary); }
    .header-sep { width: 1px; height: 20px; background: var(--border-mid); flex-shrink: 0; }
    .header-breadcrumb { font-size: 13px; color: var(--text-secondary); font-family: var(--font-mono); flex: 1; }
    .header-breadcrumb strong { color: var(--text-primary); font-weight: 400; }
    .header-actions { display: flex; align-items: center; gap: 8px; }
    .header-badge { display: flex; align-items: center; gap: 5px; padding: 3px 10px; background: var(--bg-elevated); border: 1px solid var(--border-mid); border-radius: 20px; font-size: 11px; color: var(--text-secondary); }
    .badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--status-done); animation: pulse 2s infinite; }
    @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
    .header-user { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-primary); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: #fff; cursor: pointer; border: none; transition: opacity 0.15s; }
    .header-user:hover { opacity: 0.8; }

    .body-wrap { display: flex; flex: 1; overflow: hidden; }

    /* ─── SIDEBAR ───────────────────────────────────────────────────── */
    .sidebar { width: var(--nav-width); background: var(--bg-surface); border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0; }
    .sidebar::-webkit-scrollbar { width: 4px; }
    .sidebar::-webkit-scrollbar-track { background: transparent; }
    .sidebar::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }
    .nav-section { padding: 16px 8px 8px; }
    .nav-section-label { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-dim); padding: 0 8px; margin-bottom: 4px; }
    .nav-item { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: var(--radius); cursor: pointer; color: var(--text-secondary); font-size: 13px; transition: background 0.1s, color 0.1s; border: none; background: none; width: 100%; text-align: left; position: relative; }
    .nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
    .nav-item.active { background: var(--accent-glow); color: var(--text-primary); }
    .nav-item.active::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; background: var(--accent-primary); border-radius: 0 2px 2px 0; }
    .nav-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
    .nav-badge { margin-left: auto; background: var(--status-danger); color: #fff; font-size: 10px; font-weight: 500; padding: 1px 6px; border-radius: 10px; font-family: var(--font-mono); }
    .nav-standard-group { border-radius: var(--radius); overflow: hidden; }
    .nav-standard-header { display: flex; align-items: center; gap: 9px; padding: 7px 8px; cursor: pointer; color: var(--text-secondary); font-size: 13px; transition: background 0.1s, color 0.1s; border: none; background: none; width: 100%; text-align: left; }
    .nav-standard-header:hover { background: var(--bg-hover); color: var(--text-primary); }
    .nav-standard-header.open { background: var(--bg-hover); color: var(--text-primary); }
    .nav-standard-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .nav-chevron { margin-left: auto; font-size: 10px; transition: transform 0.2s; color: var(--text-muted); }
    .nav-standard-header.open .nav-chevron { transform: rotate(90deg); }
    .nav-standard-sub { display: none; padding-left: 24px; padding-bottom: 4px; }
    .nav-standard-sub.open { display: block; }
    .nav-sub-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--radius); cursor: pointer; color: var(--text-muted); font-size: 12px; transition: background 0.1s, color 0.1s; border: none; background: none; width: 100%; text-align: left; }
    .nav-sub-item:hover { background: var(--bg-hover); color: var(--text-secondary); }
    .nav-sub-item.active { color: var(--text-primary); background: var(--accent-glow); }
    .nav-divider { height: 1px; background: var(--border-subtle); margin: 8px 8px; }
    .nav-status-pill { margin-left: auto; font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; padding: 2px 6px; border-radius: 3px; }
    .pill-active   { background: rgba(91,240,91,0.1);  color: var(--status-done); }
    .pill-building { background: rgba(240,160,91,0.1); color: var(--status-tisax); }
    .pill-planned  { background: rgba(139,91,240,0.1); color: var(--status-c5); }
    .pill-template { background: rgba(91,240,192,0.1); color: var(--status-iso); }

    /* ─── MAIN CONTENT ──────────────────────────────────────────────── */
    .main { flex: 1; overflow-y: auto; background: var(--bg-base); display: flex; flex-direction: column; }
    .main::-webkit-scrollbar { width: 6px; }
    .main::-webkit-scrollbar-track { background: transparent; }
    .main::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
    .view { display: none; padding: 32px; flex: 1; }
    .view.active { display: block; }

    .page-header { margin-bottom: 28px; }
    .page-eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
    .page-title { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.5px; color: var(--text-primary); }
    .page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

    /* ─── DASHBOARD ─────────────────────────────────────────────────── */
    .stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }

    .stat-card {
      background: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-lg);
      padding: 18px 20px;
      position: relative;
      overflow: hidden;
      cursor: pointer;
      transition: border-color 0.15s, transform 0.1s;
    }
    .stat-card:hover { border-color: var(--border-accent); transform: translateY(-1px); }
    .stat-card::after { content: ''; position: absolute; top: 0; right: 0; width: 60px; height: 60px; background: radial-gradient(circle at top right, var(--accent-glow) 0%, transparent 70%); }
    .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; }
    .stat-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 1; color: var(--text-primary); }
    .stat-delta { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); }
    .stat-delta.up { color: var(--status-done); }
    .stat-delta.warn { color: var(--status-warn); }

    .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
    .grid-3-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

    .card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; }
    .card-head { padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; }
    .card-title { font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: -0.1px; }
    .card-action { font-size: 11px; color: var(--accent-primary); cursor: pointer; border: none; background: none; font-family: var(--font-body); }
    .card-action:hover { text-decoration: underline; }
    .card-body { padding: 14px 18px; }

    .esc-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
    .esc-item:last-child { border-bottom: none; }
    .esc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--status-danger); flex-shrink: 0; margin-top: 5px; }
    .esc-dot.resolved { background: var(--status-done); }
    .esc-content { flex: 1; min-width: 0; }
    .esc-title { font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .esc-meta { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }
    .esc-tag { padding: 2px 8px; border-radius: 3px; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; flex-shrink: 0; }

    .standard-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
    .std-tile { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 20px; cursor: pointer; transition: border-color 0.15s, transform 0.1s; position: relative; overflow: hidden; }
    .std-tile::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 20% 80%, var(--tile-glow, transparent) 0%, transparent 60%); pointer-events: none; }
    .std-tile:hover { border-color: var(--border-accent); transform: translateY(-1px); }
    .std-tile-tisax  { --tile-glow: rgba(240,160,91,0.08); }
    .std-tile-iso    { --tile-glow: rgba(91,240,192,0.08); }
    .std-tile-c5     { --tile-glow: rgba(139,91,240,0.08); }
    .std-tile-icon { font-size: 22px; margin-bottom: 10px; }
    .std-tile-name { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: -0.2px; margin-bottom: 4px; }
    .std-tile-desc { font-size: 11px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5; }
    .std-tile-footer { display: flex; align-items: center; justify-content: space-between; }
    .std-progress-bar { flex: 1; height: 3px; background: var(--border-mid); border-radius: 2px; margin-right: 10px; overflow: hidden; }
    .std-progress-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }
    .std-pct { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

    /* ─── BOARD CHAT ─────────────────────────────────────────────────── */
    .chat-wrap { display: flex; flex-direction: column; height: calc(100vh - var(--header-h) - 80px); max-height: 700px; }
    .agents-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
    .agent-pill { display: flex; align-items: center; gap: 6px; padding: 5px 12px; background: var(--bg-elevated); border: 1px solid var(--border-mid); border-radius: 20px; font-size: 12px; color: var(--text-secondary); }
    .agent-pill.active { border-color: var(--accent-primary); color: var(--text-primary); background: var(--accent-glow); }
    .chat-messages { flex: 1; overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 16px; }
    .chat-messages::-webkit-scrollbar { width: 4px; }
    .chat-messages::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }
    .msg-group { display: flex; flex-direction: column; gap: 8px; }
    .msg-agent-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
    .msg-bubble { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg); padding: 12px 14px; font-size: 13px; line-height: 1.6; max-width: 85%; }
    .msg-bubble.user { background: var(--accent-glow); border-color: rgba(91,106,240,0.2); border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg); margin-left: auto; color: var(--text-primary); }
    .msg-bubble .msg-actions { display: flex; gap: 6px; margin-top: 10px; }
    .msg-action-btn { padding: 3px 10px; border-radius: 4px; font-size: 11px; cursor: pointer; border: 1px solid var(--border-mid); background: var(--bg-hover); color: var(--text-secondary); font-family: var(--font-body); transition: all 0.1s; }
    .msg-action-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
    .msg-action-btn.esc { border-color: rgba(240,91,91,0.3); color: var(--status-danger); }
    .msg-action-btn.esc:hover { background: rgba(240,91,91,0.1); }

    /* ─── MARKDOWN RENDERING ────────────────────────────────────────── */
    .md-content { line-height: 1.65; }
    .md-content p { margin-bottom: 8px; }
    .md-content p:last-child { margin-bottom: 0; }
    .md-content ul, .md-content ol { padding-left: 18px; margin-bottom: 8px; }
    .md-content li { margin-bottom: 3px; }
    .md-content strong { color: var(--text-primary); font-weight: 600; }
    .md-content em { color: var(--text-secondary); font-style: italic; }
    .md-content h1, .md-content h2, .md-content h3, .md-content h4 {
      font-family: var(--font-display); font-weight: 600;
      margin: 14px 0 6px; color: var(--text-primary); line-height: 1.3;
    }
    .md-content h1 { font-size: 16px; }
    .md-content h2 { font-size: 14px; }
    .md-content h3 { font-size: 13px; color: var(--text-secondary); }
    .md-content h4 { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
    .md-content code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-deep); padding: 1px 5px; border-radius: 3px; color: var(--accent-primary); }
    .md-content pre { background: var(--bg-deep); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 12px; margin: 8px 0; overflow-x: auto; }
    .md-content pre code { background: none; padding: 0; }
    .md-content blockquote { border-left: 2px solid var(--accent-primary); padding-left: 10px; color: var(--text-secondary); margin: 8px 0; font-style: italic; }
    .md-content hr { border: none; border-top: 1px solid var(--border-subtle); margin: 10px 0; }
    .md-content table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12px; }
    .md-content th { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border-mid); color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; }
    .md-content td { padding: 6px 10px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
    .md-content a { color: var(--accent-primary); text-decoration: underline; }

    /* RAG badge */
    .rag-badge {
      font-size: 11px; color: var(--status-iso);
      padding: 4px 0 8px 4px;
      display: flex; align-items: center; gap: 5px;
    }

    .chat-input-row { display: flex; gap: 8px; }
    .chat-input { flex: 1; background: var(--bg-surface); border: 1px solid var(--border-mid); border-radius: var(--radius); padding: 10px 14px; color: var(--text-primary); font-family: var(--font-body); font-size: 13px; outline: none; transition: border-color 0.15s; resize: none; height: 42px; }
    .chat-input:focus { border-color: var(--accent-primary); }
    .chat-send-btn { padding: 10px 18px; background: var(--accent-primary); color: #fff; border: none; border-radius: var(--radius); font-family: var(--font-body); font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.15s; white-space: nowrap; }
    .chat-send-btn:hover { background: var(--accent-hover); }

    /* ─── MAPPING VIEW ──────────────────────────────────────────────── */
    .mapping-filters { display: flex; gap: 8px; margin-bottom: 16px; }
    .filter-btn { padding: 5px 14px; border-radius: 20px; font-size: 12px; cursor: pointer; border: 1px solid var(--border-mid); background: none; color: var(--text-secondary); font-family: var(--font-body); transition: all 0.1s; }
    .filter-btn.active, .filter-btn:hover { border-color: var(--accent-primary); color: var(--text-primary); background: var(--accent-glow); }
    .setup-step {
      font-size: 11px;
      padding: 5px 10px;
      border-radius: 5px;
      background: var(--bg-deep);
      color: var(--text-muted);
      transition: color 0.3s;
    }
    .mapping-table { width: 100%; border-collapse: collapse; font-size: 12px; }
    .mapping-table th { text-align: left; padding: 8px 12px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border-subtle); }
    .mapping-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); vertical-align: top; }
    .mapping-table tr:hover td { background: var(--bg-hover); }
    .ref-code { font-family: var(--font-mono); font-size: 11px; color: var(--accent-primary); }
    .status-chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 3px; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }
    .chip-mapped  { background: rgba(91,240,91,0.1);  color: var(--status-done); }
    .chip-partial { background: rgba(240,192,91,0.1); color: var(--status-warn); }
    .chip-gap     { background: rgba(240,91,91,0.1);  color: var(--status-danger); }

    /* ─── CONTROL CHAT DRAWER ───────────────────────────────────────── */
    .ctrl-chat-overlay {
      position: fixed; inset: 0;
      background: rgba(9,9,11,0.5);
      z-index: 490;
      opacity: 0; pointer-events: none;
      transition: opacity 0.2s;
    }
    .ctrl-chat-overlay.open { opacity: 1; pointer-events: all; }

    .ctrl-chat-panel {
      position: fixed; top: 0; right: 0;
      width: 500px; max-width: 95vw; height: 100vh;
      background: var(--bg-surface);
      border-left: 1px solid var(--border-mid);
      z-index: 500;
      display: flex; flex-direction: column;
      transform: translateX(100%);
      transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    }
    .ctrl-chat-panel.open { transform: translateX(0); }

    .ctrl-chat-head {
      padding: 14px 16px;
      border-bottom: 1px solid var(--border-subtle);
      display: flex; align-items: center; gap: 10px;
      flex-shrink: 0;
    }
    .ctrl-chat-head-title {
      flex: 1;
      font-family: var(--font-display); font-size: 13px; font-weight: 700;
      letter-spacing: -0.2px;
    }
    .ctrl-chat-close {
      width: 28px; height: 28px; border-radius: 5px;
      background: none; border: 1px solid var(--border-mid);
      color: var(--text-secondary); cursor: pointer; font-size: 16px;
      display: flex; align-items: center; justify-content: center;
      transition: all 0.1s;
    }
    .ctrl-chat-close:hover { border-color: var(--status-danger); color: var(--status-danger); }

    .ctrl-chat-context {
      padding: 12px 16px;
      border-bottom: 1px solid var(--border-subtle);
      background: var(--bg-elevated);
      flex-shrink: 0;
    }
    .ctrl-chat-ctx-row {
      display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
      margin-bottom: 8px;
    }
    .ctrl-chat-ctx-box {
      background: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius);
      padding: 8px 10px;
    }
    .ctrl-chat-ctx-label {
      font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px;
      color: var(--text-muted); margin-bottom: 3px;
    }
    .ctrl-chat-ctx-ref {
      font-family: var(--font-mono); font-size: 11px;
      color: var(--accent-primary); margin-bottom: 2px;
    }
    .ctrl-chat-ctx-title {
      font-size: 11px; color: var(--text-secondary);
      line-height: 1.4;
    }
    .ctrl-chat-ctx-meta {
      display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
    }
    .ctrl-chat-ctx-badge {
      font-size: 10px; padding: 2px 8px; border-radius: 10px;
      border: 1px solid; white-space: nowrap;
    }

    .ctrl-chat-messages {
      flex: 1; overflow-y: auto;
      padding: 14px 16px;
      display: flex; flex-direction: column; gap: 14px;
    }
    .ctrl-chat-messages::-webkit-scrollbar { width: 4px; }
    .ctrl-chat-messages::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

    .ctrl-chat-input-wrap {
      padding: 12px 16px;
      border-top: 1px solid var(--border-subtle);
      display: flex; gap: 8px;
      flex-shrink: 0;
    }
    .ctrl-chat-input {
      flex: 1;
      background: var(--bg-elevated); border: 1px solid var(--border-mid);
      border-radius: var(--radius); padding: 9px 12px;
      color: var(--text-primary); font-family: var(--font-body); font-size: 13px;
      outline: none; resize: none; height: 40px;
      transition: border-color 0.15s;
    }
    .ctrl-chat-input:focus { border-color: var(--accent-primary); }
    .ctrl-chat-send {
      padding: 9px 16px;
      background: var(--accent-primary); color: #fff; border: none;
      border-radius: var(--radius); font-family: var(--font-body);
      font-size: 12px; font-weight: 500; cursor: pointer;
      white-space: nowrap; transition: background 0.15s;
    }
    .ctrl-chat-send:hover { background: var(--accent-hover); }

    .ctrl-chat-btn {
      padding: 3px 8px; border-radius: 4px; font-size: 10px;
      cursor: pointer; border: 1px solid var(--border-mid);
      background: var(--bg-elevated); color: var(--accent-primary);
      font-family: var(--font-body); transition: all 0.1s;
      white-space: nowrap;
    }
    .ctrl-chat-btn:hover { background: var(--accent-glow); border-color: var(--accent-primary); }

    /* ─── ACTIVATE BUTTON ───────────────────────────────────────────── */
    .std-lib-activate-btn {
      font-size: 11px; padding: 4px 12px; border-radius: 5px;
      background: var(--accent-primary); color: #fff; border: none;
      cursor: pointer; font-family: var(--font-body); font-weight: 500;
      transition: background 0.15s;
    }
    .std-lib-activate-btn:hover { background: var(--accent-hover); }
    .std-lib-activate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

    /* ─── KNOWLEDGE EXCHANGE ────────────────────────────────────────── */
    .ke-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding: 16px 20px; background: rgba(240,91,91,0.05); border: 1px solid rgba(240,91,91,0.15); border-radius: var(--radius-lg); }
    .ke-icon { font-size: 24px; }
    .ke-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
    .ke-sub { font-size: 12px; color: var(--text-muted); }
    .escalation-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); margin-bottom: 12px; overflow: hidden; }
    .esc-card-head { padding: 14px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-subtle); }
    .esc-card-body { padding: 14px 18px; }
    .esc-card-actions { display: flex; gap: 8px; padding: 12px 18px; background: var(--bg-elevated); border-top: 1px solid var(--border-subtle); }

    .btn { padding: 7px 16px; border-radius: var(--radius); font-size: 12px; font-weight: 500; cursor: pointer; border: 1px solid; font-family: var(--font-body); transition: all 0.1s; }
    .btn-primary { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff; }
    .btn-primary:hover { background: var(--accent-hover); }
    .btn-ghost { background: none; border-color: var(--border-mid); color: var(--text-secondary); }
    .btn-ghost:hover { border-color: var(--border-accent); color: var(--text-primary); }
    .btn-danger { background: rgba(240,91,91,0.1); border-color: rgba(240,91,91,0.3); color: var(--status-danger); }

    /* ─── PROJECT PLAN ──────────────────────────────────────────────── */
    .proj-columns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
    .btn-pp-filter { padding:4px 10px;border-radius:6px;border:1px solid var(--border-mid);background:none;color:var(--text-muted);cursor:pointer;font-size:11px;white-space:nowrap }
.btn-pp-filter.active { border-color:var(--accent-primary);background:rgba(91,106,240,.15);color:var(--accent-primary) }
.pp-phase-head td { background:var(--bg-deep);font-size:11px;font-weight:600;color:var(--text-secondary);padding:8px 12px;letter-spacing:.3px }
.proj-col-head {
    .col-build    { background: rgba(91,240,91,0.08);  color: var(--status-done); }
    .col-decide   { background: rgba(240,192,91,0.08); color: var(--status-warn); }
    .col-content  { background: rgba(91,106,240,0.08); color: var(--accent-primary); }
    .col-expert   { background: rgba(240,91,91,0.08);  color: var(--status-danger); }
    .proj-item { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; cursor: pointer; transition: border-color 0.1s, transform 0.1s; }
    .proj-item:hover { border-color: var(--border-accent); transform: translateY(-1px); }
    .proj-item-title { font-size: 12px; color: var(--text-primary); margin-bottom: 6px; line-height: 1.4; }
    .proj-item-meta { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

    /* ─── ADMIN ─────────────────────────────────────────────────────── */
    .admin-section { margin-bottom: 24px; }
    .admin-section-title { font-family: var(--font-display); font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--text-secondary); }
    .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
    .form-field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 5px; }
    .form-field input, .form-field select { width: 100%; background: var(--bg-elevated); border: 1px solid var(--border-mid); border-radius: var(--radius); padding: 8px 10px; color: var(--text-primary); font-family: var(--font-body); font-size: 13px; outline: none; transition: border-color 0.15s; }
    .form-field input:focus, .form-field select:focus { border-color: var(--accent-primary); }

    /* ─── EMPTY STATE ───────────────────────────────────────────────── */
    .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-muted); text-align: center; }
    .empty-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.4; }
    .empty-title { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
    .empty-sub { font-size: 12px; }

    /* ─── TOAST ─────────────────────────────────────────────────────── */
    #toast { position: fixed; bottom: 20px; right: 20px; background: var(--bg-elevated); border: 1px solid var(--border-mid); border-radius: var(--radius); padding: 10px 16px; font-size: 13px; color: var(--text-primary); z-index: 9999; transform: translateY(20px); opacity: 0; transition: all 0.2s; pointer-events: none; }
    #toast.show { transform: translateY(0); opacity: 1; }

    /* ─── LOADING ───────────────────────────────────────────────────── */
    .loading-dots { display: inline-flex; gap: 3px; }
    .loading-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); animation: dot-bounce 1.2s infinite; }
    .loading-dots span:nth-child(2) { animation-delay: 0.2s; }
    .loading-dots span:nth-child(3) { animation-delay: 0.4s; }
    @keyframes dot-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.3; } 40% { transform: translateY(-4px); opacity: 1; } }

    /* ─── STANDARDS LIBRARY (dark theme) ───────────────────────────── */
    .std-lib-stats-row { display: flex; gap: 24px; }
    .std-lib-stat-num { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--accent-primary); line-height: 1; }
    .std-lib-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
    .std-lib-filter { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
    .std-lib-filter-btn { padding: 6px 16px; border-radius: 20px; border: 1px solid var(--border-mid); background: none; font-size: 12px; color: var(--text-secondary); cursor: pointer; transition: all 0.15s; font-family: var(--font-body); }
    .std-lib-filter-btn.active { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }
    .std-lib-filter-btn:hover:not(.active) { border-color: var(--accent-primary); color: var(--text-primary); }
    .std-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
    .std-lib-card {
      background: var(--bg-surface); border: 1px solid var(--border-subtle);
      border-radius: var(--radius-lg); padding: 20px;
      position: relative; overflow: hidden; transition: all 0.2s;
    }
    .std-lib-card.is-active { cursor: pointer; }
    .std-lib-card.is-active:hover { border-color: var(--border-accent); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
    .std-lib-card.is-draft { opacity: 0.6; }
    .std-lib-card-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
    .std-lib-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; margin-top: 8px; }
    .std-lib-card-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
    .std-lib-badge { padding: 3px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
    .std-lib-badge-active { background: rgba(91,240,91,0.12); color: var(--status-done); border: 1px solid rgba(91,240,91,0.2); }
    .std-lib-badge-draft  { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border-subtle); }
    .std-lib-card-name { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
    .std-lib-card-desc { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; min-height: 32px; }
    .std-lib-card-footer { display: flex; align-items: center; justify-content: space-between; }
    .std-lib-card-meta { font-size: 11px; color: var(--text-muted); }
    .std-lib-card-meta b { color: var(--accent-primary); }
    .std-lib-card-action { font-size: 11px; font-weight: 600; color: var(--accent-primary); }

    /* ─── MANAGEMENT SYSTEM (dark theme) ───────────────────────────── */
    .mgmt-pills { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
    .mgmt-std-pill { padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; color: #fff; }
    .mgmt-domain-section { margin-bottom: 32px; }
    .mgmt-domain-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); }
    .mgmt-domain-icon { font-size: 20px; }
    .mgmt-domain-title { font-size: 15px; font-weight: 700; color: var(--text-primary); flex: 1; }
    .mgmt-domain-count { font-size: 11px; color: var(--text-muted); background: var(--bg-elevated); padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border-mid); }
    .mgmt-control-list { display: flex; flex-direction: column; gap: 8px; }
    .mgmt-control-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 12px 16px; transition: border-color 0.15s; }
    .mgmt-control-card:hover { border-color: var(--border-accent); }
    .mgmt-control-ref { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px; display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-family: var(--font-mono); }
    .mgmt-primary-star { background: rgba(240,192,91,0.12); color: var(--status-warn); padding: 1px 6px; border-radius: 4px; font-size: 10px; border: 1px solid rgba(240,192,91,0.2); }
    .mgmt-control-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
    .mgmt-control-also { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
    .mgmt-also-label { font-size: 11px; color: var(--text-muted); }
    .mgmt-also-pill { padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; border: 1px solid; }
    .mgmt-overlap-type { font-size: 10px; opacity: 0.7; margin-left: 2px; }

    /* Shared spinner */
    .prism-loading { text-align: center; padding: 60px 20px; color: var(--text-muted); }
    .prism-spinner { width: 32px; height: 32px; border: 3px solid var(--border-mid); border-top-color: var(--accent-primary); border-radius: 50%; animation: prism-spin 0.8s linear infinite; margin: 0 auto 12px; }
    @keyframes prism-spin { to { transform: rotate(360deg); } }

    /* ─── RESPONSIVE ────────────────────────────────────────────────── */
    @media (max-width: 1000px) {
      .stats-row { grid-template-columns: repeat(2, 1fr); }
      .standard-tiles { grid-template-columns: repeat(2, 1fr); }
      .proj-columns { grid-template-columns: repeat(2, 1fr); }
      .std-lib-grid { grid-template-columns: repeat(2, 1fr); }
    }
