/* ============================================================
   INK MASTER STYLESHEET v2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@300;400;500&family=DM+Sans:wght@300;400;500&display=swap');

body {
    --ink: #0a0a0a;
    --ink-mid: #111111;
    --ink-soft: #1a1a1a;
    --paper: #e8e0d0;
    --paper-mid: #c8c0b0;
    --accent: #c8a96e;
    --accent-dim: rgba(200,169,110,0.12);
    --accent-glow: rgba(200,169,110,0.06);
    --rule: #2a2a2a;
    --dim: #a89880;
    --muted: #6b5f4f;
    --warning-bg: #fef3c7;
    --warning-fg: #92400e;
    --signal: #e8b84b;
    --green: #2ecc71;
    --red: #c0392b;
    --radius: 4px;
    --font-body: 'DM Sans', sans-serif;
    --font-display: 'DM Serif Display', serif;
    --font-mono: 'DM Mono', monospace;

}

/* --- RESET --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- TOPBAR --- */
.topbar {
    height: 52px;
    background: var(--ink-mid);
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-wordmark {
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--paper);
    letter-spacing: 0.04em;
    margin-right: 40px;
    flex-shrink: 0;
    overflow: hidden;
}
.topbar-wordmark span { color: var(--accent); }
.topbar-nav { display: flex; gap: 2px; flex: 1; }
.nav-btn {
    padding: 6px 16px;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--dim);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-block;
}
.nav-btn:hover { color: var(--paper); background: var(--ink-soft); }
.nav-btn.active { color: var(--accent); background: var(--accent-dim); }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.sector-badge {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid rgba(200,169,110,0.3);
    padding: 3px 8px;
    border-radius: 2px;
}
.user-label { font-family: var(--font-mono); font-size: 11px; color: var(--dim); }
.logout-btn {
    background: none;
    border: 1px solid var(--rule);
    color: var(--dim);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.logout-btn:hover { border-color: var(--muted); color: var(--paper); }

/* --- APP SHELL --- */
#app { display: none; flex-direction: column; min-height: 100vh; }
#app.visible { display: flex; }
.app-screen { background: var(--ink); min-height: 100vh; }
.main { flex: 1; display: flex; flex-direction: column; }
.view { display: none; flex: 1; flex-direction: column; padding: 32px 40px; box-sizing: border-box; }
.view.active { display: flex; }

/* --- LOGIN --- */
#login-screen, #pwchange-screen {
    position: fixed; inset: 0;
    background: var(--ink);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(255,255,255,0.015) 40px, rgba(255,255,255,0.015) 41px),
        repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(255,255,255,0.015) 40px, rgba(255,255,255,0.015) 41px);
}
    .login-screen { background: var(--ink); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
    .pwchange-screen { display: none; }
    #pwchange-screen.pwchange-screen { display: none; }
.login-box {
    width: 380px; padding: 48px;
    border: 1px solid var(--rule);
    background: var(--ink-mid);
    position: relative;
    border-radius: var(--radius);
}
.login-box::before {
    content: ''; position: absolute;
    top: -1px; left: 0; width: 60px; height: 2px;
    background: var(--accent);
}
.login-wordmark {
    font-family: var(--font-display);
    font-size: 28px; letter-spacing: 0.05em;
    color: var(--paper); margin-bottom: 6px;
}
.login-tagline {
    font-family: var(--font-mono); font-size: 10px;
    color: var(--dim); letter-spacing: 0.12em;
    text-transform: uppercase; margin-bottom: 40px;
}
.login-field { margin-bottom: 16px; }
.login-field label {
    display: block; font-family: var(--font-mono);
    font-size: 10px; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--dim); margin-bottom: 8px;
}
.login-field input {
    width: 100%; background: var(--ink);
    border: 1px solid var(--rule); border-radius: var(--radius);
    color: var(--paper); font-family: var(--font-mono);
    font-size: 13px; padding: 10px 14px;
    outline: none; transition: border-color 0.2s;
}
.login-field input:focus { border-color: var(--accent); }
.login-btn {
    width: 100%; margin-top: 24px; padding: 12px;
    background: var(--accent); color: var(--ink);
    border: none; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 11px;
    letter-spacing: 0.1em; text-transform: uppercase;
    cursor: pointer; font-weight: 500; transition: opacity 0.2s;
}
.login-btn:hover { opacity: 0.85; }
.login-error {
    margin-top: 12px; font-family: var(--font-mono);
    font-size: 11px; color: var(--red);
    text-align: center; min-height: 16px;
}

/* --- VIEW HEADERS --- */
.view-header { margin-bottom: 8px; }
.view-title {
    font-family: var(--font-display);
    font-size: 26px; color: var(--paper); margin-bottom: 4px;
}
.view-subtitle {
    font-family: var(--font-mono); font-size: 11px;
    color: var(--dim); letter-spacing: 0.06em;
}

/* --- QUERY VIEW --- */
.query-view {
    max-width: 860px; width: 100%;
    margin: 0 auto; padding: 40px 24px;
    flex-direction: column; gap: 24px;
}
.query-input-wrap {
    position: relative; display: flex;
    gap: 10px; align-items: flex-end;
}
.query-textarea {
    flex: 1; background: var(--ink-mid);
    border: 1px solid var(--rule); border-radius: var(--radius);
    color: var(--paper); font-family: var(--font-body);
    font-size: 14px; line-height: 1.6; padding: 14px 16px;
    resize: none; outline: none; min-height: 80px; max-height: 200px;
    transition: border-color 0.2s;
}
.query-textarea:focus { border-color: var(--accent); }
.query-textarea::placeholder { color: var(--muted); }
.query-submit {
    flex-shrink: 0; padding: 14px 22px;
    background: var(--accent); color: var(--ink);
    border: none; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 11px;
    letter-spacing: 0.1em; text-transform: uppercase;
    cursor: pointer; font-weight: 500; transition: opacity 0.2s;
    align-self: flex-end; height: 48px;
}
.query-submit:hover { opacity: 0.85; }
.query-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.result-block {
    background: var(--ink-mid); border: 1px solid var(--rule);
    border-radius: var(--radius); overflow: hidden;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.result-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--rule);
    background: var(--ink-soft);
}
.result-meta { font-family: var(--font-mono); font-size: 10px; color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; }
.result-actions { display: flex; gap: 8px; align-items: center; }
.translate-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 12px; background: none;
    border: 1px solid var(--rule); border-radius: var(--radius);
    color: var(--dim); font-family: var(--font-mono);
    font-size: 10px; letter-spacing: 0.08em;
    text-transform: uppercase; cursor: pointer; transition: all 0.15s;
}
.translate-btn:hover { border-color: var(--accent); color: var(--accent); }
.translate-btn.translating { opacity: 0.5; cursor: wait; }
.translate-icon { font-size: 13px; }
.lang-indicator {
    font-family: var(--font-mono); font-size: 9px;
    color: var(--accent); letter-spacing: 0.1em;
    background: var(--accent-dim); padding: 2px 6px; border-radius: 2px;
}
.result-body { padding: 20px; font-size: 14px; line-height: 1.75; color: var(--paper-mid); }
.result-body p { margin-bottom: 12px; }
.result-body p:last-child { margin-bottom: 0; }
.query-history { display: flex; flex-direction: column; gap: 16px; }
.query-bubble { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.query-bubble-text {
    background: var(--ink-soft); border: 1px solid var(--rule);
    border-radius: var(--radius); padding: 10px 14px;
    font-size: 13px; color: var(--paper); max-width: 80%; line-height: 1.5;
}
.loading-bar { height: 2px; background: var(--rule); border-radius: 1px; overflow: hidden; }
.loading-bar-inner {
    height: 100%; background: var(--accent); border-radius: 1px;
    animation: loadingPulse 1.2s ease-in-out infinite; width: 40%;
}
@keyframes loadingPulse { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state-icon { font-size: 32px; margin-bottom: 16px; opacity: 0.4; }
.empty-state-text { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; }
.example-queries { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 20px; }
.example-chip {
    padding: 6px 14px; background: var(--ink-mid);
    border: 1px solid var(--rule); border-radius: 20px;
    font-family: var(--font-mono); font-size: 11px;
    color: var(--dim); cursor: pointer; transition: all 0.15s;
}
.example-chip:hover { border-color: var(--accent); color: var(--accent); }

/* --- MONITOR VIEW --- */
.monitor-view {
    padding: 40px 24px; max-width: 1100px;
    width: 100%; margin: 0 auto; flex-direction: column; gap: 24px;
}
.monitor-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.monitor-search {
    flex: 1; min-width: 200px; background: var(--ink-mid);
    border: 1px solid var(--rule); border-radius: var(--radius);
    color: var(--paper); font-family: var(--font-body);
    font-size: 13px; padding: 9px 14px; outline: none; transition: border-color 0.2s;
}
.monitor-search:focus { border-color: var(--accent); }
.monitor-search::placeholder { color: var(--muted); }
.filter-btn {
    padding: 8px 14px; background: var(--ink-mid);
    border: 1px solid var(--rule); border-radius: var(--radius);
    color: var(--dim); font-family: var(--font-mono);
    font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.filter-btn:hover, .filter-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* --- STATS --- */
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: var(--rule); }
.stat-box { background: var(--ink); padding: 24px 32px; }
.stat-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.stat-value { font-family: var(--font-display); font-size: 36px; color: var(--paper); line-height: 1; margin-bottom: 4px; }
.stat-sub { font-size: 11px; color: var(--dim); }

/* --- ARTICLES --- */
.articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.article-card {
    background: var(--ink-mid); border: 1px solid var(--rule);
    border-radius: var(--radius); padding: 18px;
    display: flex; flex-direction: column; gap: 10px;
    transition: border-color 0.2s; position: relative; overflow: hidden;
}
.article-card::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: var(--rule); transition: background 0.2s;
}
.article-card:hover { border-color: var(--ink-soft); }
.article-card:hover::before { background: var(--accent); }
.article-source-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.article-source { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.article-date { font-family: var(--font-mono); font-size: 10px; color: var(--dim); }
.article-title { font-size: 14px; font-weight: 500; color: var(--paper); line-height: 1.45; }
.article-summary { font-size: 13px; color: var(--muted); line-height: 1.6; flex: 1; }
.article-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--rule); }
.article-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border-radius: 2px; background: var(--ink-soft); color: var(--dim); border: 1px solid var(--rule); }
.tag.high { background: rgba(192,57,43,0.1); color: #e74c3c; border-color: rgba(192,57,43,0.3); }
.tag.medium { background: rgba(232,184,75,0.1); color: var(--signal); border-color: rgba(232,184,75,0.3); }
.article-link { font-family: var(--font-mono); font-size: 10px; color: var(--dim); text-decoration: none; letter-spacing: 0.06em; transition: color 0.15s; flex-shrink: 0; }
.article-link:hover { color: var(--accent); }
.article-translate-btn { background: none; border: none; color: var(--dim); font-family: var(--font-mono); font-size: 10px; cursor: pointer; letter-spacing: 0.06em; transition: color 0.15s; padding: 0; }
.article-translate-btn:hover { color: var(--accent); }

/* --- BRIEF --- */
.brief-card { margin: 0 0 16px; background: var(--ink-mid); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px; max-height: none; overflow: visible; }
.brief-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.brief-text { font-size: 13px; line-height: 1.7; color: var(--paper); max-height: none; overflow: visible; }
.brief-footer { margin-top: 12px; font-family: var(--font-mono); font-size: 10px; color: var(--dim); }
#clientBrief, #clientBriefText { max-height: none !important; overflow: visible !important; }

/* --- STAKEHOLDER VIEW --- */
.stakeholder-view { padding: 40px 24px; max-width: 1100px; width: 100%; margin: 0 auto; flex-direction: column; gap: 24px; }
.stakeholder-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stakeholder-search { flex: 1; min-width: 200px; background: var(--ink-mid); border: 1px solid var(--rule); border-radius: var(--radius); color: var(--paper); font-family: var(--font-body); font-size: 13px; padding: 9px 14px; outline: none; transition: border-color 0.2s; }
.stakeholder-search:focus { border-color: var(--accent); }
.stakeholder-search::placeholder { color: var(--muted); }
.stakeholder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.stakeholder-card { background: var(--ink-mid); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; transition: border-color 0.2s; position: relative; }
.stakeholder-card:hover { border-color: var(--ink-soft); }
.stakeholder-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stakeholder-name { font-family: var(--font-display); font-size: 17px; color: var(--paper); line-height: 1.3; }
.stakeholder-name-zh { font-size: 13px; color: var(--dim); margin-top: 2px; font-family: var(--font-body); }
.stakeholder-role { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--accent); text-transform: uppercase; }
.stakeholder-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }
.stakeholder-tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- CONFIDENCE BADGES --- */
.confidence-badge { flex-shrink: 0; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; border-radius: 2px; }
.confidence-HIGH, .conf-high { background: rgba(192,57,43,0.15); color: #e74c3c; border: 1px solid rgba(192,57,43,0.3); }
.confidence-MEDIUM, .conf-medium { background: rgba(232,184,75,0.12); color: var(--signal); border: 1px solid rgba(232,184,75,0.3); }
.confidence-LOW, .conf-low { background: var(--ink-soft); color: var(--dim); border: 1px solid var(--rule); }
.conf-verified { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(200,169,110,0.3); }

/* --- RELATIONSHIPS --- */
.relationships { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--rule); padding-top: 12px; }
.relationships-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-bottom: 2px; }
.rel-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.rel-arrow { font-family: var(--font-mono); font-size: 10px; color: var(--accent); flex-shrink: 0; }
.rel-target { color: var(--paper-mid); }
.rel-type { font-family: var(--font-mono); font-size: 9px; color: var(--dim); letter-spacing: 0.06em; text-transform: uppercase; }

/* --- MEMO COMPONENTS --- */
.memo-card { background: var(--ink-mid); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 12px; cursor: pointer; transition: border-color 0.2s; width: 100%; box-sizing: border-box; }
.memo-card:hover { border-color: rgba(200,169,110,0.3); }
.memo-header { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
.memo-title { font-size: 14px; font-weight: 700; color: var(--paper); }
.memo-meta { font-size: 11px; color: var(--dim); margin-top: 4px; letter-spacing: 0.06em; }
.memo-body { padding: 0 20px 20px; display: none; }
.memo-body.open { display: block; }
.memo-section { margin-bottom: 16px; }
.memo-section-label { font-size: 10px; letter-spacing: 3px; color: #335566; margin-bottom: 8px; border-bottom: 1px solid var(--rule); padding-bottom: 4px; text-transform: uppercase; }
.memo-text { font-size: 13px; line-height: 1.8; color: var(--paper-mid); white-space: pre-wrap; width: 100%; word-wrap: break-word; }
.edit-btn { padding: 8px 20px; background: none; border: 1px solid rgba(200,169,110,0.3); color: var(--accent); cursor: pointer; font-size: 11px; letter-spacing: 0.1em; border-radius: var(--radius); margin-top: 8px; font-family: var(--font-mono); text-transform: uppercase; }
.edit-btn:hover { background: var(--accent-dim); }
.edit-title { width: 100%; font-size: 14px; font-weight: bold; color: var(--accent); background: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius); padding: 6px 8px; box-sizing: border-box; font-family: var(--font-body); }
.edit-conf-row { display: flex; }
.conf-edit-btn { flex: 1; padding: 7px 4px; border: 1px solid var(--rule); background: none; color: var(--dim); cursor: pointer; font-size: 10px; letter-spacing: 0.1em; border-radius: var(--radius); font-family: var(--font-mono); }
.conf-edit-btn:hover { background: var(--accent-dim); }
.conf-edit-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.edit-area { width: 100%; padding: 12px; background: var(--ink); border: 1px solid var(--rule); color: var(--paper); font-family: var(--font-body); font-size: 13px; border-radius: var(--radius); outline: none; resize: vertical; min-height: 120px; display: none; margin-top: 8px; }
.save-btn { padding: 8px 20px; background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent); cursor: pointer; font-size: 11px; letter-spacing: 0.1em; border-radius: var(--radius); margin-top: 8px; display: none; font-family: var(--font-mono); text-transform: uppercase; }
.save-btn:hover { background: rgba(200,169,110,0.2); }
.cancel-btn { padding: 8px 16px; background: none; border: 1px solid #666; color: #aaa; cursor: pointer; font-size: 11px; letter-spacing: 0.1em; border-radius: var(--radius); margin-top: 8px; font-family: var(--font-mono); text-transform: uppercase; }
.cancel-btn:hover { border-color: var(--paper); color: var(--paper); }
.delete-btn { padding: 8px 16px; background: none; border: 1px solid var(--red); color: var(--red); cursor: pointer; font-size: 11px; letter-spacing: 0.1em; border-radius: var(--radius); margin-top: 8px; margin-left: 8px; font-family: var(--font-mono); text-transform: uppercase; }
.delete-btn:hover { background: rgba(192,57,43,0.1); }
.promote-graph-btn { padding: 8px 20px; background: none; border: 1px solid var(--rule); color: var(--dim); cursor: pointer; font-size: 11px; letter-spacing: 0.1em; border-radius: var(--radius); margin-top: 8px; margin-left: 8px; font-family: var(--font-mono); text-transform: uppercase; }
.promote-graph-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.promote-graph-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.promote-graph-btn--done { border-color: var(--accent); color: var(--accent); }
.queue-count-badge { display: inline-block; background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent); border-radius: 10px; font-size: 0.65rem; padding: 1px 6px; margin-left: 4px; font-family: var(--font-mono); letter-spacing: 0.05em; }

/* --- INPUTS --- */
input, textarea, select {
    background: var(--ink-mid); border: 1px solid var(--rule);
    color: var(--paper); font-family: var(--font-body);
    font-size: 13px; border-radius: var(--radius);
    padding: 8px 12px; outline: none; transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }

/* --- MISC --- */
.divider { height: 1px; background: var(--rule); width: 100%; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--rule); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 6px rgba(46,204,113,0.6); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.no-results { grid-column: 1/-1; text-align: center; padding: 48px; font-family: var(--font-mono); font-size: 12px; color: var(--dim); letter-spacing: 0.06em; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink-mid); border: 1px solid var(--rule); border-left: 3px solid var(--accent); padding: 12px 18px; font-family: var(--font-mono); font-size: 11px; color: var(--paper); border-radius: var(--radius); z-index: 200; animation: toastIn 0.3s ease; letter-spacing: 0.04em; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.thdot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; animation: dotPulse 1.2s ease-in-out infinite; }
@keyframes dotPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.5); opacity: 0.3; } }
@keyframes inkDot { 0%,80%,100% { opacity:.15; transform:scale(.8); } 40% { opacity:1; transform:scale(1); } }

/* --- SCROLLBAR --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .articles-grid { grid-template-columns: 1fr; }
    .stakeholder-grid { grid-template-columns: 1fr; }
    .view { padding: 24px 20px; }
    .query-view, .stakeholder-view, .monitor-view { padding: 24px 20px; }
    .topbar-nav::-webkit-scrollbar { display: none; }  /* Safari + Chrome */
    .topbar-nav .nav-btn { flex-shrink: 0; }

    /* Mobile topbar: two-row layout */
    .topbar {
        height: auto;
        flex-wrap: wrap;
        padding: 8px 16px 0 16px;
        gap: 0;
    }
    .topbar-wordmark {
        margin-right: auto;
        font-size: 17px;
    }
    .topbar-right {
        gap: 8px;
    }
    /* OPS has more nav items — reduce nav btn padding on mobile */
    .topbar-nav .nav-btn {
        padding: 6px 10px;
        font-size: 10px;
    }
    /* Sector badge shorter on mobile */
    .sector-badge {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* Hide verbose right-side elements on mobile */
    .topbar-right .user-label,
    .topbar-right .status-dot {
        display: none;
    }
    /* Nav takes full width on second row */
    .topbar-nav {
        flex: 0 0 100%;
        width: 100%;
        margin-top: 4px;
        padding-bottom: 6px;
        border-top: 1px solid var(--rule);
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        min-width: 0;
    }
}


/* ── Report Builder §10.1 ──────────────────────────────────────── */

.report-builder {
    max-width: 720px; width: 100%;
    margin: 0 auto; padding: 40px 24px;
    display: flex; flex-direction: column; gap: 24px;
    font-family: var(--font-body);
}

/* Template loader row */
.report-template-row {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 4px;
}
.report-template-row .report-select {
    flex: 1; min-width: 0;
}

/* Report meta row (title / language / vertical) */
.report-meta-row {
    display: flex; flex-wrap: wrap; gap: 16px;
}
.report-field {
    display: flex; flex-direction: column; gap: 6px;
    flex: 1; min-width: 0;
}
.report-field--narrow {
    flex: 0 0 160px; min-width: 160px;
}

/* Labels */
.report-label {
    font-family: var(--font-mono); font-size: 11px;
    color: var(--dim); letter-spacing: 0.08em;
    text-transform: uppercase;
}
.report-label--inline {
    display: inline-block; margin-right: 10px;
}

/* Inputs — shared shell */
.report-input,
.report-select,
.report-textarea {
    font-family: var(--font-body); font-size: 14px;
    color: var(--paper); background: var(--ink-mid);
    border: 1px solid var(--rule); border-radius: var(--radius);
    padding: 10px 12px; box-sizing: border-box;
    width: 100%;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.report-textarea { resize: vertical; line-height: 1.5; min-height: 72px; }
.report-input:focus,
.report-select:focus,
.report-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.report-input::placeholder,
.report-textarea::placeholder { color: var(--muted); }

/* Buttons — secondary (ghost) */
.report-secondary-btn,
.report-add-btn {
    font-family: var(--font-mono); font-size: 11px;
    color: var(--paper); background: transparent;
    border: 1px solid var(--rule); border-radius: var(--radius);
    padding: 8px 14px; letter-spacing: 0.08em; text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.report-secondary-btn:hover,
.report-add-btn:hover {
    border-color: var(--accent); color: var(--accent);
    background: var(--accent-glow);
}

/* Sections header (label + add button) */
.report-sections-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 8px; padding-top: 16px;
    border-top: 1px solid var(--rule);
}

/* Sections list + empty state */
.report-sections-list {
    display: flex; flex-direction: column; gap: 10px;
}
.report-sections-empty {
    font-family: var(--font-mono); font-size: 12px;
    color: var(--muted); font-style: italic;
    padding: 18px; text-align: center;
    border: 1px dashed var(--rule); border-radius: var(--radius);
}

/* Section row card */
.report-section-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px; background: var(--ink-soft);
    border: 1px solid var(--rule); border-radius: var(--radius);
}

/* Stacked ↑↓ controls on the left */
.report-section-controls {
    display: flex; flex-direction: column; gap: 4px;
    flex-shrink: 0;
}
.report-move-btn {
    font-family: var(--font-mono); font-size: 12px;
    color: var(--paper); background: var(--ink-mid);
    border: 1px solid var(--rule); border-radius: var(--radius);
    padding: 4px 8px; cursor: pointer; line-height: 1;
    transition: border-color 0.12s ease, color 0.12s ease;
}
.report-move-btn:hover:not(:disabled) {
    border-color: var(--accent); color: var(--accent);
}
.report-move-btn:disabled { opacity: 0.35; cursor: default; }

/* Section body (type select + config) */
.report-section-body {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 10px;
}
.report-section-config {
    display: flex; align-items: center; gap: 10px;
    margin-top: 2px;
}
.report-section-config .report-select { flex: 0 0 auto; min-width: 140px; }
.report-section-config .report-textarea { flex: 1; min-width: 0; }

/* Remove ✕ button */
.report-remove-btn {
    color: var(--dim); background: transparent;
    border: none; padding: 4px 6px; cursor: pointer;
    font-size: 14px; line-height: 1; flex-shrink: 0;
    transition: color 0.12s ease;
}
.report-remove-btn:hover { color: var(--red); }

/* Actions row */
.report-actions {
    display: flex; align-items: center; gap: 16px;
    margin-top: 8px; padding-top: 16px;
    border-top: 1px solid var(--rule);
}
.report-generate-btn {
    font-family: var(--font-mono); font-size: 12px;
    color: var(--ink); background: var(--accent);
    border: 1px solid var(--accent); border-radius: var(--radius);
    padding: 12px 22px; font-weight: 600;
    letter-spacing: 0.1em; text-transform: uppercase;
    cursor: pointer;
    transition: background 0.12s ease, transform 0.08s ease;
}
.report-generate-btn:hover:not(:disabled) { background: var(--paper-mid); }
.report-generate-btn:disabled {
    opacity: 0.5; cursor: not-allowed;
}
.report-status {
    font-family: var(--font-mono); font-size: 12px;
    color: var(--dim);
}

/* Error block */
.report-error {
    font-family: var(--font-body); font-size: 13px;
    color: var(--red); background: rgba(192, 57, 43, 0.08);
    border-left: 3px solid var(--red); border-radius: var(--radius);
    padding: 10px 14px; margin-top: 4px;
}

/* Mobile: stack meta + section rows */
@media (max-width: 720px) {
    .report-builder { padding: 24px 16px; gap: 18px; }
    .report-meta-row { flex-direction: column; }
    .report-field--narrow { flex: 1 1 auto; min-width: 0; }
    .report-section-config { flex-direction: column; align-items: stretch; }
    .report-section-config .report-select { width: 100%; }
}
/* ── end Report Builder ────────────────────────────────────────── */


/* ── §10.2 Templates List ─────────────────────────────── */
.report-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; border-bottom: 2px solid var(--rule); padding-bottom: 0; }
.report-tab-btn { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; padding: 0.4rem 1rem; font-size: 0.9rem; cursor: pointer; color: var(--dim); }
.report-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.report-tab-btn:hover:not(.active) { color: var(--ink-mid); }
.report-templates-pane { padding-top: 0.5rem; }
.templates-empty { color: var(--dim); font-style: italic; margin-top: 2rem; text-align: center; }
.templates-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.templates-table th { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 2px solid var(--rule); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.templates-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); font-size: 0.9rem; vertical-align: middle; }
.templates-action-btn { background: none; border: 1px solid var(--ink-mid); border-radius: 3px; padding: 0.2rem 0.6rem; font-size: 0.8rem; cursor: pointer; margin-right: 0.3rem; color: var(--accent); }
.templates-action-btn:hover { background: var(--ink-mid); }
.templates-action-btn.danger { color: var(--red); border-color: var(--red); }
.templates-action-btn.danger:hover { background: var(--red); color: #fff; }
.templates-row-error { color: var(--red); font-size: 0.8rem; display: block; margin-top: 0.2rem; }
.tpl-edit-cell { padding: 0 !important; background: var(--ink-mid); }
.tpl-edit-panel { padding: 1rem 1.2rem; border-top: 1px solid var(--rule); }
.tpl-edit-meta { margin-bottom: 1rem; }
.tpl-edit-label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.tpl-edit-name { margin-top: 0.2rem; }
.tpl-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.tpl-sections-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.tpl-scope-select { flex: 1; }
.tpl-commentary-input { flex: 1; min-height: 80px; resize: vertical; }
.tpl-edit-footer { display: flex; align-items: center; gap: 0.75rem; justify-content: flex-end; padding-top: 0.75rem; border-top: 1px solid var(--rule); }
.tpl-save-error { color: var(--red); font-size: 0.85rem; flex: 1; }
@media (max-width: 720px) {
  .templates-table th:nth-child(3), .templates-table td:nth-child(3) { display: none; }
}
/* ── end Templates List ────────────────────────────────── */

/* ── §10.4 Analyst Profile ────────────────────────────── */
.profile-loading { color: var(--dim); font-style: italic; margin-top: 2rem; text-align: center; }
.profile-form { max-width: 680px; display: flex; flex-direction: column; gap: 2rem; padding-top: 0.5rem; }
.profile-section { display: flex; flex-direction: column; gap: 1rem; }
.profile-section-title { margin: 0 0 0.25rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); border-bottom: 1px solid var(--rule); padding-bottom: 0.4rem; }
.profile-label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.profile-input { margin-top: 0.1rem; }
.profile-textarea { resize: vertical; min-height: 80px; }
.profile-disclaimer-row { display: flex; gap: 0.75rem; align-items: flex-start; }
.profile-disclaimer-row .profile-textarea { flex: 1; }
.profile-reset-btn { background: none; border: 1px solid var(--rule); border-radius: 3px; padding: 0.25rem 0.6rem; font-size: 0.78rem; cursor: pointer; color: var(--dim); white-space: nowrap; margin-top: 0.1rem; }
.profile-reset-btn:hover { border-color: var(--ink-mid); color: var(--accent); }
.profile-logo-preview { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.profile-logo-preview img { max-height: 60px; max-width: 200px; object-fit: contain; border: 1px solid var(--rule); border-radius: 3px; padding: 0.25rem; background: #fff; }
.profile-logo-remove { background: none; border: 1px solid var(--red); border-radius: 3px; padding: 0.2rem 0.6rem; font-size: 0.8rem; cursor: pointer; color: var(--red); }
.profile-logo-remove:hover { background: var(--red); color: #fff; }
.profile-no-logo { color: var(--dim); font-style: italic; font-size: 0.85rem; margin: 0 0 0.5rem; }
.profile-logo-drop { border: 1px dashed var(--rule); border-radius: 4px; padding: 1.2rem; text-align: center; font-size: 0.85rem; color: var(--dim); cursor: pointer; transition: border-color 0.15s; }
.profile-logo-drop.dragging { border-color: var(--accent); color: var(--accent); }
.profile-logo-drop:hover { border-color: var(--ink-mid); }
.profile-logo-hint { font-size: 0.75rem; color: var(--dim); margin: 0.25rem 0 0; }
.profile-link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: inherit; padding: 0; text-decoration: underline; }
.profile-footer { display: flex; align-items: center; gap: 1rem; justify-content: flex-end; padding-top: 0.5rem; border-top: 1px solid var(--rule); }
.profile-save-error { color: var(--red); font-size: 0.85rem; flex: 1; }
.profile-save-ok { color: var(--accent); font-size: 0.85rem; flex: 1; }
@media (max-width: 720px) {
  .profile-disclaimer-row { flex-direction: column; }
  .profile-reset-btn { align-self: flex-start; }
}
/* ── end Analyst Profile ───────────────────────────────── */

/* ── §10.3 Report History ─────────────────────────────── */
.report-history-pane { padding-top: 0.5rem; }
.history-empty { color: var(--dim); font-style: italic; margin-top: 2rem; text-align: center; }
.history-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.history-table th { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 2px solid var(--rule); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.history-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); font-size: 0.9rem; vertical-align: middle; }
.history-date { white-space: nowrap; color: var(--dim); font-size: 0.82rem; }
.history-title { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-num { text-align: center; }
.history-status.success { color: var(--accent); }
.history-status.failed  { color: var(--red); cursor: default; }
@media (max-width: 720px) {
  .history-table th:nth-child(4), .history-table td:nth-child(4) { display: none; }
}
/* ── end Report History ────────────────────────────────── */

/* ── Client Management ────────────────────────────────── */
.clients-empty { color: var(--dim); font-style: italic; margin-top: 2rem; text-align: center; }
.clients-empty.red { color: var(--red); }
.clients-pane-toolbar { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }
.clients-inline-form { display: flex; flex-direction: column; gap: 0.75rem; max-width: 720px; margin-bottom: 1rem; padding: 1rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--ink-mid); }
.clients-form-row { display: flex; gap: 1rem; }
.clients-form-row .profile-label { flex: 1; }
.clients-form-footer { display: flex; align-items: center; gap: 0.75rem; justify-content: flex-end; padding-top: 0.5rem; border-top: 1px solid var(--rule); }
.clients-error { color: var(--red); font-size: 0.85rem; flex: 1; }
.clients-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.clients-table th { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 2px solid var(--rule); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.clients-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); font-size: 0.9rem; vertical-align: middle; }
.clients-actions-cell { white-space: nowrap; }
.clients-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.clients-badge.green  { background: rgba(100,200,100,0.15); color: #6dc96d; }
.clients-badge.red    { background: rgba(200,80,80,0.15);   color: var(--red); }
.clients-badge.accent { background: rgba(180,150,80,0.15);  color: var(--accent); }
.clients-badge.dim    { background: rgba(120,120,120,0.15); color: var(--dim); }
.clients-expired { color: var(--red); }
.clients-vertical-checks { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
.clients-vertical-check-label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.88rem; cursor: pointer; padding: 0.25rem 0.6rem; border: 1px solid var(--rule); border-radius: 3px; }
.clients-vertical-check-label:hover { border-color: var(--ink-mid); }
.clients-vertical-check-label input { cursor: pointer; }
@media (max-width: 720px) {
  .clients-form-row { flex-direction: column; }
  .clients-table th:nth-child(5), .clients-table td:nth-child(5) { display: none; }
}
/* ── end Client Management ─────────────────────────────── */

/* ── Stakeholder Edit ─────────────────────────────────── */
.stakeholder-placeholder { color: var(--dim); font-style: italic; margin: 2rem 0; text-align: center; }
.stk-edit-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 0.75rem 0; margin-bottom: 0.5rem; border-bottom: 1px solid var(--rule); }
.stk-toolbar-group { display: flex; align-items: center; gap: 0.4rem; }
.stk-toolbar-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); margin-right: 0.3rem; }
.stk-filter-btn { background: none; border: 1px solid var(--rule); border-radius: 3px; color: var(--dim); padding: 0.25rem 0.6rem; font-size: 0.82rem; cursor: pointer; }
.stk-filter-btn:hover { border-color: var(--ink-mid); color: var(--accent); }
.stk-filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.stk-search-input { flex: 1; min-width: 180px; max-width: 300px; padding: 0.3rem 0.6rem; background: var(--ink-mid); border: 1px solid var(--rule); color: var(--paper); border-radius: 3px; font-size: 0.85rem; }
.stk-edit-table-wrap { overflow-x: auto; }
.stk-edit-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.85rem; }
.stk-edit-table th { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 2px solid var(--rule); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); white-space: nowrap; }
.stk-edit-table td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.stk-loading { color: var(--dim); font-style: italic; text-align: center; padding: 1.5rem 0; }
.stk-edit-input { background: var(--ink-mid); border: 1px solid var(--rule); color: var(--paper); padding: 0.2rem 0.4rem; border-radius: 3px; font-size: 0.82rem; max-width: 180px; }
.stk-vert-group { display: flex; gap: 0.5rem; }
.stk-vert-check { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.82rem; }
.stk-edit-btn, .stk-save-btn, .stk-cancel-btn { background: none; border: 1px solid var(--rule); border-radius: 3px; padding: 0.2rem 0.55rem; font-size: 0.78rem; cursor: pointer; color: var(--dim); }
.stk-edit-btn:hover, .stk-save-btn:hover { border-color: var(--accent); color: var(--accent); }
.stk-cancel-btn:hover { border-color: var(--ink-mid); color: var(--paper); }
.stk-actions-cell { white-space: nowrap; }
.stk-row-error { color: var(--red); font-size: 0.78rem; margin-top: 0.25rem; }
@media (max-width: 720px) {
  .stk-edit-toolbar { flex-direction: column; align-items: stretch; }
  .stk-search-input { max-width: none; }
}
/* ── end Stakeholder Edit ─────────────────────────────── */

/* ── Influence Map (Phase 4B) ─────────────────────────── */
#influence-goal-bar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.5rem 0 0.4rem;
  margin-bottom: 0.3rem;
}
#influence-goal-input {
  flex: 1;
  background: var(--ink-mid);
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--paper);
  font-family: var(--font-body, inherit);
  font-size: 0.9rem;
  padding: 0.55rem 0.8rem;
  outline: none;
  transition: border-color 0.15s;
}
#influence-goal-input:focus {
  border-color: var(--accent);
}
#influence-find-btn {
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: 3px;
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
#influence-find-btn:hover { opacity: 0.85; }
#influence-goal-status {
  font-size: 0.85rem;
  color: var(--dim);
  padding: 0.4rem 0 0.6rem;
  min-height: 1.4em;
}
#influence-canvas {
  width: 100%;
  height: calc(100vh - 240px);
  min-height: 480px;
  background: #0a0a0a;
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.influence-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.4rem;
  animation: influence-spin 0.9s linear infinite;
}
@keyframes influence-spin {
  to { transform: rotate(360deg); }
}
.influence-rank-badge {
  display: inline-block;
  background: var(--accent);
  color: #0a0a0a;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.4rem;
}
/* Modal */
#influence-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}
.influence-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}
.influence-modal-card {
  position: relative;
  background: var(--ink-mid);
  border: 1px solid var(--rule);
  border-radius: 6px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.25rem 1.4rem;
  color: var(--paper);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.influence-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.influence-modal-close:hover { color: var(--paper); }
.influence-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--paper);
  margin-bottom: 0.3rem;
}
.influence-modal-meta {
  font-size: 0.85rem;
  color: var(--dim);
  margin-bottom: 0.9rem;
  text-transform: capitalize;
}
.influence-modal-section {
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--rule);
}
.influence-modal-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 0.2rem;
}
.influence-modal-toggle {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--dim);
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}
.influence-modal-toggle:hover { border-color: var(--accent); color: var(--accent); }
.influence-modal-action {
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: 3px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.influence-modal-action:hover { opacity: 0.85; }
@media (max-width: 720px) {
  #influence-goal-bar { flex-direction: column; align-items: stretch; }
  #influence-find-btn { width: 100%; }
  #influence-canvas { height: calc(100vh - 340px); }
}
/* ── end Influence Map ────────────────────────────────── */

/* ── i18n language toggle button ──────────────────────── */
.lang-toggle-btn {
  background: none;
  border: 1px solid var(--rule);
  color: var(--dim);
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  cursor: pointer;
  text-transform: uppercase;
}
.lang-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
/* ── end i18n ─────────────────────────────────────────── */

/* ── Memo write UI — Section A form chrome ──────── */
.memo-form-inner { max-width: 700px; margin: 0 auto; width: 100%; }
.memo-field-group { margin-bottom: 20px; position: relative; }
.memo-field-label { display: block; font-size: 11px; letter-spacing: 3px; color: var(--dim); margin-bottom: 8px; text-transform: uppercase; font-family: var(--font-mono); }
.memo-input,
.memo-textarea,
.memo-select { width: 100%; padding: 12px 16px; background: var(--ink-mid); border: 1px solid var(--accent-dim); color: var(--paper); font-size: 14px; border-radius: var(--radius); box-sizing: border-box; font-family: var(--font-body); }
.memo-textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.memo-input:focus,
.memo-textarea:focus,
.memo-select:focus { outline: none; border-color: var(--accent); }
.memo-divider { border: none; border-top: 1px solid var(--accent-dim); margin: 24px 0; }
.memo-form-actions { display: flex; gap: 10px; margin-top: 24px; }
.memo-form-actions .btn-secondary { flex: 1; }
.memo-form-actions .btn-primary { flex: 2; }
.memo-status { margin-top: 16px; text-align: center; font-size: 13px; min-height: 18px; color: var(--dim); }

/* Generic primary/secondary buttons (no codebase convention existed for these names) */
.btn-primary { padding: 14px 20px; background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent); cursor: pointer; font-size: 13px; letter-spacing: 3px; border-radius: var(--radius); font-family: var(--font-mono); text-transform: uppercase; }
.btn-primary:hover:not(:disabled) { background: rgba(200,169,110,0.2); }
.btn-primary:disabled { opacity: 0.5; cursor: wait; }
.btn-secondary { padding: 14px 20px; background: transparent; border: 1px solid var(--rule); color: var(--paper); cursor: pointer; font-size: 13px; letter-spacing: 3px; border-radius: var(--radius); font-family: var(--font-mono); text-transform: uppercase; }
.btn-secondary:hover:not(:disabled) { border-color: var(--paper); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 11px; letter-spacing: 0.1em; }

/* Confidence buttons in memo form (conf-btn / conf-btn-row) — matches existing memo-conf-btn vibe */
.conf-btn-row { display: flex; gap: 8px; }
.conf-btn { flex: 1; padding: 10px; border: 1px solid var(--accent-dim); background: none; color: var(--dim); cursor: pointer; font-size: 11px; letter-spacing: 2px; border-radius: var(--radius); font-family: var(--font-mono); }
.conf-btn:hover { border-color: var(--accent); color: var(--accent); }
.conf-btn.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

/* ── Memo write UI — Section E, C, G ─────────────── */
.memo-ai-block { background: var(--ink-soft); border: 1px solid var(--rule); border-radius: 6px; padding: 12px; min-height: 80px; }
.memo-ai-placeholder { color: var(--dim); font-style: italic; font-size: 13px; }
.memo-ai-content { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.memo-ai-spinner { color: var(--dim); font-size: 13px; font-style: italic; }
.memo-band-ops { background: var(--accent-dim); color: var(--paper-mid); font-size: 11px; font-weight: 600; letter-spacing: 0.05em; padding: 4px 8px; border-radius: 3px; margin-bottom: 8px; display: inline-block; }
.memo-band-client { background: var(--ink-soft); color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: 0.05em; padding: 4px 8px; border-radius: 3px; margin-bottom: 8px; display: inline-block; }
.memo-synthesis-actions { display: flex; gap: 8px; }
.memo-entity-search-wrap { position: relative; }
.memo-entity-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--ink-mid); border: 1px solid var(--rule); border-radius: 4px; z-index: 100; max-height: 200px; overflow-y: auto; }
.memo-entity-result { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.memo-entity-result:hover { background: var(--ink-soft); }
.memo-entities-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.memo-entity-chip { display: flex; align-items: center; gap: 6px; background: var(--ink-soft); border: 1px solid var(--rule); border-radius: 4px; padding: 4px 8px; font-size: 12px; }
.memo-entity-chip input { border: none; background: transparent; font-size: 12px; color: var(--paper-mid); width: 140px; }
.memo-entity-chip button { background: none; border: none; cursor: pointer; color: var(--dim); font-size: 14px; padding: 0 2px; }
.memo-p1-error { background: rgba(192,57,43,0.15); border: 1px solid rgba(192,57,43,0.4); border-radius: 4px; padding: 10px 12px; margin-top: 8px; font-size: 13px; }
.memo-p1-error ul { margin: 6px 0 0 16px; }
.memo-field-optional { font-weight: 400; color: var(--dim); font-size: 11px; }

/* Editorial modal */
.editorial-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.editorial-modal { background: var(--ink-mid); border-radius: 8px; padding: 24px; max-width: 680px; width: 90%; max-height: 80vh; overflow-y: auto; }
.editorial-modal-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.editorial-modal-summary { font-size: 13px; color: var(--paper-mid); margin-bottom: 16px; }
.editorial-issue-row { border: 1px solid var(--rule); border-radius: 6px; padding: 12px; margin-bottom: 10px; }
.editorial-issue-row.resolved { border-color: rgba(46,204,113,0.4); background: rgba(46,204,113,0.08); }
.editorial-severity { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; padding: 2px 6px; border-radius: 3px; margin-right: 6px; }
.editorial-severity.CRITICAL { background: #fca5a5; color: #7f1d1d; }
.editorial-severity.HIGH { background: #fed7aa; color: #7c2d12; }
.editorial-severity.MEDIUM { background: #fef08a; color: #713f12; }
.editorial-severity.LOW { background: #e5e7eb; color: #374151; }
.editorial-excerpt { font-style: italic; font-size: 12px; color: var(--dim); margin: 6px 0; }
.editorial-description { font-size: 13px; margin-bottom: 8px; }
.editorial-rewrite { background: var(--ink-soft); border-radius: 4px; padding: 8px; font-size: 12px; margin-bottom: 8px; }
.editorial-issue-actions { display: flex; gap: 8px; align-items: center; }
.editorial-override-block { margin-top: 8px; }
.editorial-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; border-top: 1px solid var(--rule); padding-top: 16px; }

/* ── Memo confidence matrix ─────────────────────── */
.memo-conf-matrix { width:100%; border-collapse:collapse; font-size:12px; margin-bottom:4px; }
.memo-conf-matrix th { text-align:left; color:var(--dim); font-weight:600; font-size:11px; letter-spacing:0.04em; padding:5px 12px; border-bottom:1px solid var(--rule); }
.memo-conf-matrix td { padding:6px 12px; vertical-align:top; border-bottom:1px solid rgba(42,42,42,0.5); }
.memo-conf-matrix tr:last-child td { border-bottom:none; }
.conf-badge-verified { color:var(--accent); font-weight:700; font-size:11px; white-space:nowrap; width:80px; }
.conf-badge-high { color:var(--green); font-weight:700; font-size:11px; white-space:nowrap; width:80px; }
.conf-badge-medium { color:var(--signal); font-weight:700; font-size:11px; white-space:nowrap; width:80px; }
.conf-badge-low { color:var(--dim); font-weight:700; font-size:11px; white-space:nowrap; width:80px; }

/* ── Monitor vertical badges ─────────────────────── */
.article-vertical-badge { display:inline-block; font-size:10px; font-weight:700; letter-spacing:0.05em; padding:2px 6px; border-radius:3px; margin-right:4px; }
.article-vertical-badge--tobacco { background:rgba(200,169,110,0.15); color:var(--accent); }
.article-vertical-badge--pharma { background:rgba(46,204,113,0.12); color:var(--green); }
