﻿/* ==========================================
   Custody Node · App styles (auth + dashboard)
   Light Enterprise — Zen Edition
   Mirrors landing page design tokens
   ========================================== */

/* ── Tokens ──────────────────────────────── */
:root {
  --font:      'Inter', system-ui, sans-serif;
  --mono:      'JetBrains Mono', monospace;
  --bg:        #f8f9fc;
  --bg-dark:   #f0f2f8;
  --bg-card:   #ffffff;
  --bg-card2:  #f4f6fb;
  --border:    #dde2ee;
  --border-s:  #e8ebf5;
  --text:      #1a2340;
  --text-m:    #5a6888;
  --text-d:    #9aa3bc;
  --accent:    #1e52d8;
  --accent-l:  #4472ef;
  --green:     #0ea151;
  --yellow:    #b07d10;
  --red:       #c42b2b;
  --radius:    8px;
  --radius-l:  14px;
  --t:         .18s ease;
  --sidebar:   248px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* ── Logo ────────────────────────────────── */
.logo { display: inline-flex; align-items: center; gap: 0.45em; font-weight: 800; font-size: 1.05rem; letter-spacing: -.5px; }
.logo-slash { font-family: var(--mono); font-size: 1.05em; font-weight: 700; color: #0ea58a; letter-spacing: -0.08em; line-height: 1; flex-shrink: 0; }
.logo-icon { width: 1.1em; height: 1.1em; margin-right: 0.35em; color: var(--accent); flex-shrink: 0; }
.logo-main { color: var(--text); }
.logo-ai   { color: var(--accent); }
.badge-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ══════════════════════════════════════════
   AUTH PAGES
   ══════════════════════════════════════════ */
.auth-page { min-height: 100vh; display: flex; }
.auth-layout { display: flex; width: 100%; min-height: 100vh; }

/* LEFT brand panel */
.auth-brand {
  flex: 0 0 42%;
  background: linear-gradient(160deg, #f0f2f8 0%, #e8ecf6 60%, #dce4f2 100%);
  border-right: 1px solid var(--border);
  padding: 48px;
  display: flex; align-items: center;
  position: relative; overflow: hidden;
}
.auth-brand::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(30,82,216,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30,82,216,0.055) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
}
.auth-brand::after {
  content: '';
  position: absolute; bottom: -80px; right: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(30,82,216,.1) 0%, transparent 70%);
  pointer-events: none;
}
.auth-brand-inner { position: relative; z-index: 1; max-width: 380px; }
.auth-logo { font-size: 1.25rem; margin-bottom: 48px; display: block; }
.auth-brand-title { font-size: 1.45rem; font-weight: 800; letter-spacing: -.5px; margin-bottom: 12px; line-height: 1.35; color: var(--text); }
.auth-brand-sub { font-size: .88rem; color: var(--text-m); line-height: 1.65; margin-bottom: 32px; }
.auth-features { display: flex; flex-direction: column; gap: 14px; margin-bottom: 36px; }
.af-item { display: flex; align-items: center; gap: 10px; font-size: .83rem; color: var(--text-m); }
.af-icon { flex-shrink: 0; display: flex; align-items: center; }
.af-icon svg { width: 15px; height: 15px; stroke: var(--accent); }
.auth-brand-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: rgba(14,161,81,.07); border: 1px solid rgba(14,161,81,.22);
  border-radius: 100px; font-size: .72rem; color: var(--green); font-family: var(--mono);
}

/* RIGHT form panel */
.auth-form-panel {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px;
  background: var(--bg-card);
}
.auth-form-inner { width: 100%; max-width: 400px; }
.auth-form-header { margin-bottom: 30px; }
.auth-form-header h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.5px; margin-bottom: 6px; color: var(--text); }
.auth-form-header p { font-size: .85rem; color: var(--text-m); }

/* Form elements */
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .78rem; font-weight: 600; color: var(--text-m); display: flex; justify-content: space-between; align-items: center; }
.forgot-link { font-size: .74rem; color: var(--accent); }
.forgot-link:hover { text-decoration: underline; }
.form-group input, .form-group select, .form-group textarea {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px;
  color: var(--text); font-size: .88rem;
  transition: border-color var(--t), box-shadow var(--t); outline: none;
  -webkit-appearance: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30,82,216,.1);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-d); }
.form-group select option { background: white; color: var(--text); }
.input-pw-wrap { position: relative; }
.input-pw-wrap input { width: 100%; padding-right: 44px; }
.pw-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-d); padding: 4px; transition: color var(--t); }
.pw-toggle:hover { color: var(--text-m); }
.pw-toggle svg { width: 18px; height: 18px; display: block; }
.pw-strength { height: 3px; background: var(--border); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.pw-bar { height: 100%; width: 0; transition: width .3s, background .3s; border-radius: 2px; }
.field-error { font-size: .72rem; color: var(--red); min-height: 16px; }
.form-alert { padding: 10px 14px; border-radius: var(--radius); font-size: .83rem; border: 1px solid; margin-bottom: 4px; }
.form-alert.error { background: rgba(196,43,43,.07); border-color: rgba(196,43,43,.25); color: var(--red); }
.form-alert.success { background: rgba(14,161,81,.07); border-color: rgba(14,161,81,.22); color: var(--green); }
.hidden { display: none !important; }
.form-legal { font-size: .72rem; color: var(--text-d); text-align: center; line-height: 1.5; }
.form-legal a { color: var(--accent); }

.btn-auth {
  width: 100%; padding: 12px; border: none; border-radius: var(--radius);
  background: var(--accent); color: white; font-size: .88rem; font-weight: 600;
  cursor: pointer; transition: all var(--t); display: flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: .2px;
}
.btn-auth:hover { background: var(--accent-l); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(30,82,216,.25); }
.btn-auth:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-switch { text-align: center; font-size: .83rem; color: var(--text-m); margin-top: 20px; }
.auth-switch a { color: var(--accent); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════ */
.dashboard-page { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  width: var(--sidebar); flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform var(--t);
}
.sidebar-header {
  padding: 20px 20px 16px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border-s);
}
.sidebar-close { display: none; background: none; border: none; color: var(--text-m); cursor: pointer; font-size: 1rem; }
.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.snav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 6px; font-size: .83rem; color: var(--text-m);
  transition: all var(--t); cursor: pointer;
}
.snav-item:hover { background: rgba(30,82,216,.06); color: var(--text); }
.snav-item.active {
  background: rgba(30,82,216,.09); color: var(--accent);
  border-left: 2px solid var(--accent); padding-left: 10px; font-weight: 600;
}
.snav-icon { display: flex; align-items: center; }
.snav-icon svg { width: 16px; height: 16px; }
.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border-s);
  display: flex; flex-direction: column; gap: 10px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.su-avatar {
  width: 34px; height: 34px; border-radius: 6px;
  background: rgba(30,82,216,.1); display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: var(--accent); flex-shrink: 0;
  border: 1px solid rgba(30,82,216,.2);
}
.su-info { display: flex; flex-direction: column; }
.su-name { font-size: .82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; color: var(--text); }
.su-plan { font-size: .66rem; color: var(--text-d); text-transform: uppercase; font-family: var(--mono); letter-spacing: .5px; }
.sidebar-logout {
  width: 100%; padding: 8px; border: 1px solid var(--border);
  border-radius: 7px; background: transparent; color: var(--text-m);
  font-size: .78rem; cursor: pointer; transition: all var(--t);
}
.sidebar-logout:hover { border-color: var(--red); color: var(--red); }

/* ── Topbar (mobile) ─────────────────────── */
.topbar {
  display: none; height: 56px;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  padding: 0 16px; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 90;
}
.topbar-menu { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.topbar-menu span { display: block; width: 20px; height: 2px; background: var(--text-m); border-radius: 1px; }
.topbar-badge { font-size: .68rem; font-family: var(--mono); color: var(--green); display: flex; align-items: center; gap: 5px; }

/* ── Main content ────────────────────────── */
.dashboard-main { margin-left: var(--sidebar); flex: 1; padding: 28px 36px; min-height: 100vh; display: flex; flex-direction: column; align-items: center; }
.dashboard-main .view.active { width: 100%; max-width: 960px; }
.view { display: none; }
.view.active { display: block; }
.view-header { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border-s); }
.view-header h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.4px; display: flex; align-items: center; gap: 10px; margin-bottom: 6px; color: var(--text); }
.view-badge {
  font-size: .62rem; font-weight: 700; padding: 3px 9px;
  background: rgba(30,82,216,.08); border: 1px solid rgba(30,82,216,.2);
  border-radius: 4px; color: var(--accent); letter-spacing: .5px;
  text-transform: uppercase; vertical-align: middle; font-family: var(--mono);
}
.view-sub { font-size: .85rem; color: var(--text-m); }

/* ── Room layout ─────────────────────────── */
.room-layout { display: flex; flex-direction: column; gap: 20px; max-width: 860px; margin: 0 auto; }

/* Upload zone */
.upload-zone {
  border: 1px dashed var(--border); border-radius: var(--radius-l);
  padding: 32px 24px; text-align: center;
  transition: border-color var(--t), background var(--t);
  cursor: pointer; background: var(--bg-dark);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent); background: rgba(30,82,216,.04); border-style: solid;
}
.uz-icon { font-size: 2.2rem; margin-bottom: 10px; }
.uz-title { font-size: .95rem; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.uz-sub { font-size: .78rem; color: var(--text-m); margin-bottom: 16px; }
.uz-preview {
  display: flex; align-items: center; gap: 14px; padding: 8px 14px;
  background: rgba(30,82,216,.05); border-radius: var(--radius);
  border: 1px solid rgba(30,82,216,.15);
}
.uzp-icon { font-size: 1.3rem; }
.uzp-info { display: flex; flex-direction: column; flex: 1; text-align: left; }
.uzp-name { font-size: .85rem; font-weight: 600; color: var(--text); }
.uzp-size { font-size: .72rem; color: var(--text-m); font-family: var(--mono); }
.uzp-remove { background: none; border: none; cursor: pointer; color: var(--text-d); font-size: .9rem; padding: 4px; transition: color var(--t); }
.uzp-remove:hover { color: var(--red); }

/* Analysis type selector */
.analysis-config {
  background: var(--bg-card); border: 1px solid var(--border);
  border-top: 2px solid rgba(30,82,216,.25); border-radius: var(--radius-l); padding: 18px 20px;
}
.config-label {
  font-size: .66rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-m); margin-bottom: 10px; display: block;
}
.analysis-types { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.at-btn {
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--text-m); font-size: .78rem; cursor: pointer;
  transition: all var(--t); font-weight: 500;
}
.at-btn:hover { border-color: rgba(30,82,216,.35); color: var(--text); }
.at-btn.active { background: rgba(30,82,216,.08); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.qa-wrap { margin-top: 10px; }
.qa-wrap textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 13px; color: var(--text); font-size: .85rem;
  resize: vertical; outline: none; transition: border-color var(--t);
}
.qa-wrap textarea:focus { border-color: var(--accent); }
.btn-run {
  width: 100%; padding: 12px; border: none; border-radius: 8px;
  background: var(--accent); color: white; font-size: .88rem; font-weight: 600;
  cursor: pointer; margin-top: 16px; transition: all var(--t); letter-spacing: .2px;
}
.btn-run:hover:not(:disabled) { background: var(--accent-l); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(30,82,216,.25); }
.btn-run:disabled { opacity: .45; cursor: not-allowed; }
.btn-outline-sm {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--text-m); font-size: .78rem; cursor: pointer;
  transition: all var(--t); font-weight: 500;
}
.btn-outline-sm:hover { border-color: var(--accent); color: var(--text); background: rgba(30,82,216,.05); }

/* Pipeline */
.pipeline {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-l); padding: 16px 20px; margin-bottom: 14px; overflow-x: auto;
}
.pipe-step { flex: 1; min-width: 200px; }
.pipe-node { display: flex; align-items: center; gap: 12px; }
.pipe-node-icon { font-size: 1.4rem; flex-shrink: 0; }
.pipe-node-info { flex: 1; }
.pn-name { display: block; font-size: .87rem; font-weight: 700; color: var(--text); }
.pn-tier { display: block; font-size: .67rem; color: var(--text-m); font-family: var(--mono); }
.pipe-status { display: flex; align-items: center; gap: 6px; font-size: .68rem; font-family: var(--mono); }
.pipe-status .ps-dot { width: 7px; height: 7px; border-radius: 50%; }
.pipe-status.idle .ps-dot { background: var(--text-d); }
.pipe-status.running .ps-dot { background: var(--yellow); animation: pulse-dot 1s infinite; }
.pipe-status.done .ps-dot { background: var(--green); }
.pipe-status.error .ps-dot { background: var(--red); }
.pipe-status.idle .ps-text { color: var(--text-d); }
.pipe-status.running .ps-text { color: var(--yellow); }
.pipe-status.done .ps-text { color: var(--green); }
.pipe-status.error .ps-text { color: var(--red); }
.pipe-meta { font-size: .67rem; color: var(--text-d); margin-top: 6px; font-family: var(--mono); }
.pipe-arrow { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 16px; flex-shrink: 0; }
.pipe-arrow-line {
  height: 2px; width: 48px; background: var(--border); border-radius: 1px;
  position: relative; overflow: hidden;
}
.pipe-arrow-line::after {
  content: ''; position: absolute; width: 10px; height: 4px;
  background: var(--accent); top: -1px; border-radius: 2px;
  animation: pipe-flow 1.2s linear infinite; opacity: 0;
}
.pipe-arrow-line.active::after { opacity: 1; }
@keyframes pipe-flow { from{left:-10px} to{left:100%} }
.pipe-arrow-label { font-size: .6rem; color: var(--text-d); font-family: var(--mono); }

/* PII banner */
.pii-banner {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px;
  background: rgba(30,82,216,.05); border: 1px solid rgba(30,82,216,.18);
  border-left: 3px solid var(--accent); border-radius: 8px; margin-bottom: 14px;
}
.pii-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.pii-text strong { display: block; font-size: .83rem; font-weight: 700; margin-bottom: 2px; color: var(--text); }
.pii-text span { font-size: .78rem; color: var(--text-m); }

/* Report card */
.report-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-l); overflow: hidden; margin-bottom: 20px;
}
.report-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border-s);
  background: var(--bg-dark);
}
.report-model-badge {
  font-size: .65rem; font-family: var(--mono); font-weight: 600; padding: 3px 10px;
  border-radius: 4px; background: rgba(30,82,216,.08); color: var(--accent);
  border: 1px solid rgba(30,82,216,.18); letter-spacing: .3px;
}
.report-copy {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 12px; font-size: .74rem; color: var(--text-m); cursor: pointer; transition: all var(--t);
}
.report-copy:hover { border-color: var(--accent); color: var(--text); }
.report-body { padding: 20px; min-height: 100px; }
.report-loading { display: flex; align-items: center; gap: 12px; color: var(--text-m); font-size: .84rem; }
.typing-dots { display: flex; gap: 4px; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: td 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes td { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-6px);opacity:1} }
.report-text { font-size: .86rem; line-height: 1.75; color: var(--text-m); white-space: pre-wrap; }
.report-text strong { color: var(--text); }

/* Chat */
.chat-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-l); overflow: hidden;
}
.chat-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border-s);
  background: var(--bg-dark); font-size: .82rem; font-weight: 600; color: var(--text);
}
.chat-model-toggle { display: flex; align-items: center; gap: 8px; }
.toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .75rem; color: var(--text-m); font-weight: 400; }
.toggle-slider { width: 34px; height: 18px; background: var(--border); border-radius: 9px; position: relative; transition: background var(--t); }
.toggle-slider::after { content: ''; position: absolute; width: 12px; height: 12px; background: white; border-radius: 50%; top: 3px; left: 3px; transition: left var(--t); }
input[type="checkbox"]:checked + .toggle-slider { background: var(--accent); }
input[type="checkbox"]:checked + .toggle-slider::after { left: 19px; }
input[type="checkbox"] { display: none; }
.chat-messages {
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
  max-height: 320px; overflow-y: auto;
}
.chat-msg { display: flex; flex-direction: column; gap: 4px; max-width: 80%; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.assistant { align-self: flex-start; }
.cm-role { font-size: .64rem; font-family: var(--mono); color: var(--text-d); text-transform: uppercase; }
.cm-bubble { padding: 10px 13px; border-radius: 10px; font-size: .83rem; line-height: 1.65; }
.chat-msg.user .cm-bubble { background: rgba(30,82,216,.09); border: 1px solid rgba(30,82,216,.22); color: var(--text); }
.chat-msg.assistant .cm-bubble { background: var(--bg-dark); border: 1px solid var(--border); color: var(--text-m); white-space: pre-wrap; }
.cm-model { font-size: .63rem; color: var(--text-d); font-family: var(--mono); }
.chat-input-row {
  display: flex; gap: 10px; padding: 12px 16px;
  border-top: 1px solid var(--border-s); background: var(--bg-dark);
}
.chat-input {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; padding: 9px 12px; color: var(--text); font-size: .84rem;
  resize: none; outline: none; transition: border-color var(--t); max-height: 120px;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send-btn {
  width: 36px; height: 36px; border-radius: 6px; border: none;
  background: var(--accent); color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background var(--t), box-shadow var(--t);
}
.chat-send-btn:hover { background: var(--accent-l); box-shadow: 0 2px 10px rgba(30,82,216,.25); }

/* ── Document list ────────────────────────── */
.doc-list, .analysis-list { display: flex; flex-direction: column; gap: 8px; }
.list-loading { padding: 24px; text-align: center; font-size: .84rem; color: var(--text-d); }
.doc-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color var(--t), box-shadow var(--t);
}
.doc-item:hover { border-color: rgba(30,82,216,.28); box-shadow: 0 2px 8px rgba(30,82,216,.06); }
.doc-item-icon { font-size: 1.3rem; flex-shrink: 0; }
.doc-item-info { flex: 1; }
.doc-item-name { font-size: .87rem; font-weight: 600; margin-bottom: 3px; color: var(--text); }
.doc-item-meta { font-size: .72rem; color: var(--text-d); font-family: var(--mono); }
.doc-item-actions { display: flex; gap: 8px; }
.action-btn {
  padding: 5px 12px; border-radius: 5px; border: 1px solid var(--border);
  background: transparent; font-size: .74rem; color: var(--text-m); cursor: pointer; transition: all var(--t);
}
.action-btn:hover { border-color: var(--accent); color: var(--text); background: rgba(30,82,216,.06); }
.action-btn.danger:hover { border-color: var(--red); color: var(--red); background: rgba(196,43,43,.05); }

/* Analysis item */
.analysis-item {
  padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: border-color var(--t), box-shadow var(--t);
}
.analysis-item:hover { border-color: rgba(30,82,216,.28); box-shadow: 0 2px 8px rgba(30,82,216,.06); }
.ai-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.ai-title { font-size: .87rem; font-weight: 600; color: var(--text); }
.ai-status {
  font-size: .63rem; font-family: var(--mono); padding: 2px 8px;
  border-radius: 3px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.ai-status.completed { background: rgba(14,161,81,.1); color: var(--green); border: 1px solid rgba(14,161,81,.2); }
.ai-status.processing { background: rgba(176,125,16,.1); color: var(--yellow); border: 1px solid rgba(176,125,16,.2); }
.ai-status.failed { background: rgba(196,43,43,.1); color: var(--red); border: 1px solid rgba(196,43,43,.2); }
.ai-meta { font-size: .72rem; color: var(--text-d); font-family: var(--mono); }

/* Audit table */
.audit-stats { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.audit-stat {
  padding: 14px 20px; background: var(--bg-card); border: 1px solid var(--border);
  border-top: 2px solid rgba(30,82,216,.25); border-radius: var(--radius); min-width: 120px;
}
.ast-val { font-size: 1.6rem; font-weight: 800; font-family: var(--mono); display: block; color: var(--text); letter-spacing: -1px; }
.ast-lbl { font-size: .65rem; color: var(--text-m); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.audit-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.audit-table { width: 100%; border-collapse: collapse; font-size: .81rem; }
.audit-table th {
  text-align: left; padding: 9px 14px; font-size: .66rem; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-m); border-bottom: 1px solid var(--border);
  background: var(--bg-dark); font-weight: 700;
}
.audit-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-s); color: var(--text-m); }
.audit-table tr:last-child td { border-bottom: none; }
.audit-table tr:hover td { background: rgba(30,82,216,.03); }
.audit-action {
  font-family: var(--mono); font-size: .68rem; padding: 2px 8px; border-radius: 3px;
  background: rgba(30,82,216,.08); color: var(--accent); font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px; border: 1px solid rgba(30,82,216,.15);
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 900px) {
  .auth-brand { display: none; }
  .auth-form-panel { padding: 40px 24px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .topbar { display: flex; }
  .dashboard-main { margin-left: 0; padding: 20px 16px; }
}
@media (max-width: 600px) {
  .form-row-2 { grid-template-columns: 1fr; }
  .analysis-types { gap: 6px; }
  .at-btn { font-size: .75rem; padding: 7px 10px; }
  .pipeline { flex-direction: column; align-items: flex-start; }
  .pipe-arrow { transform: rotate(90deg); }
}

/* ══════════════════════════════════════════
   CHAT PROXY VIEW
   ══════════════════════════════════════════ */

/* Legend bar */
.chat-proxy-legend {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 18px; border: 1px solid var(--border);
  border-radius: var(--radius-l); background: var(--bg-card);
  margin-bottom: 18px; max-width: 860px; margin-left: auto; margin-right: auto;
}
.cpl-step { display: flex; align-items: center; gap: 10px; }
.cpl-icon { font-size: 1.3rem; }
.cpl-name { display: block; font-size: .83rem; font-weight: 700; color: var(--text); }
.cpl-desc { display: block; font-size: .68rem; color: var(--text-m); font-family: var(--mono); }
.cpl-arrow { font-size: 1.2rem; color: var(--text-d); padding: 0 4px; }
.cpl-spacer { flex: 1; }
.cpl-note { font-size: .68rem; color: var(--accent); font-family: var(--mono);
  background: rgba(30,82,216,.06); border: 1px solid rgba(30,82,216,.15);
  padding: 3px 10px; border-radius: 20px; }

/* Chat wrap */
.proxy-chat-wrap {
  max-width: 860px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-l);
  overflow: hidden; display: flex; flex-direction: column; min-height: 420px;
  margin: 0 auto;
}
.proxy-chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 20px; max-height: 540px;
}
.pcm-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 60px 20px; color: var(--text-d); text-align: center; flex: 1;
}
.pcm-empty span { font-size: 2.2rem; }
.pcm-empty p { font-size: .85rem; }

/* User message */
.pcm-user { align-self: flex-end; max-width: 70%; }
.pcm-user-bubble {
  background: rgba(30,82,216,.09); border: 1px solid rgba(30,82,216,.22);
  border-radius: 12px 12px 2px 12px;
  padding: 10px 14px; font-size: .86rem; line-height: 1.65; color: var(--text);
}
.pcm-user-meta { font-size: .62rem; font-family: var(--mono); color: var(--text-d); text-align: right; margin-top: 4px; }

/* AI message */
.pcm-ai { align-self: flex-start; max-width: 88%; width: 100%; }
.pcm-ai-pipeline {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0; background: var(--bg-dark);
}
.pcm-pipe-node {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px; border: 1px solid;
  font-size: .68rem; font-family: var(--mono); transition: all .3s;
}
.pcm-pipe-node.step1         { background: rgba(176,125,16,.07); border-color: rgba(176,125,16,.3); color: var(--yellow); }
.pcm-pipe-node.step1.done    { background: rgba(14,161,81,.07);  border-color: rgba(14,161,81,.3);  color: var(--green); }
.pcm-pipe-node.step2         { background: rgba(30,82,216,.07);  border-color: rgba(30,82,216,.3);  color: var(--accent); }
.pcm-pipe-node.step2.done    { background: rgba(14,161,81,.07);  border-color: rgba(14,161,81,.3);  color: var(--green); }
.pcm-pipe-node.idle          { background: var(--bg); border-color: var(--border); color: var(--text-d); }
.ppn-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.ppn-dot.pulse { animation: pulse-dot 1s infinite; }
.pcm-pipe-arrow { color: var(--text-d); font-size: .9rem; }

.pcm-ai-body {
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius); background: var(--bg-card); overflow: hidden;
}
.pcm-ai-thinking {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; color: var(--text-d); font-size: .82rem;
}
.pcm-ai-text {
  padding: 14px 16px; font-size: .86rem; line-height: 1.75;
  color: var(--text-m); white-space: pre-wrap;
}
.pcm-proxy-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px; border-top: 1px solid var(--border-s);
  cursor: pointer; background: var(--bg-dark); font-size: .72rem; color: var(--text-m);
  user-select: none; transition: background var(--t);
}
.pcm-proxy-toggle:hover { background: rgba(30,82,216,.04); color: var(--text); }
.pcm-proxy-content {
  padding: 12px 16px; border-top: 1px solid var(--border-s);
  font-size: .73rem; color: var(--text-m); white-space: pre-wrap;
  font-family: var(--mono); line-height: 1.6; background: rgba(0,0,0,.015);
}

/* Input row */
.proxy-chat-input-row {
  display: flex; gap: 10px; padding: 12px 16px;
  border-top: 1px solid var(--border); background: var(--bg-dark); align-items: flex-end;
}
.proxy-chat-input {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; font-size: .85rem; color: var(--text);
  resize: none; outline: none; transition: border-color var(--t), box-shadow var(--t);
  max-height: 140px; min-height: 42px; line-height: 1.5;
}
.proxy-chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30,82,216,.08); }
.proxy-send-btn {
  width: 40px; height: 40px; border-radius: 8px; border: none;
  background: var(--accent); color: white; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t), box-shadow var(--t);
}
.proxy-send-btn:hover:not(:disabled) { background: var(--accent-l); box-shadow: 0 2px 10px rgba(30,82,216,.3); }
.proxy-send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ══════════════════════════════════════════
   PROFILE VIEW
   ══════════════════════════════════════════ */

.profile-layout { max-width: 640px; display: flex; flex-direction: column; gap: 16px; margin: 0 auto; }
.profile-card {
  display: flex; align-items: center; gap: 20px;
  padding: 24px; background: var(--bg-card);
  border: 1px solid var(--border); border-top: 2px solid var(--accent);
  border-radius: var(--radius-l);
}
.pc-avatar {
  width: 64px; height: 64px; border-radius: 14px;
  background: rgba(30,82,216,.1); display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; font-weight: 800; color: var(--accent); flex-shrink: 0;
  border: 1.5px solid rgba(30,82,216,.2);
}
.pc-name { font-size: 1.15rem; font-weight: 800; color: var(--text); margin-bottom: 3px; }
.pc-email { font-size: .82rem; color: var(--text-m); margin-bottom: 8px; }
.pc-plan-badge {
  display: inline-flex; padding: 3px 10px; border-radius: 20px;
  font-size: .68rem; font-family: var(--mono); font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  background: rgba(14,161,81,.08); border: 1px solid rgba(14,161,81,.22); color: var(--green);
}

.profile-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.ps-stat {
  padding: 16px 18px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; flex-direction: column; gap: 4px;
}
.pss-val { font-size: 1.5rem; font-weight: 800; font-family: var(--mono); color: var(--text); letter-spacing: -1px; }
.pss-lbl { font-size: .66rem; text-transform: uppercase; letter-spacing: .8px; color: var(--text-m); font-weight: 600; }

.profile-edit-card {
  padding: 22px 24px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-l);
}
.pec-title { font-size: .95rem; font-weight: 700; margin-bottom: 18px; color: var(--text); }
.profile-form { display: flex; flex-direction: column; gap: 14px; }

.profile-meta-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.pmc-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 16px; border-bottom: 1px solid var(--border-s); font-size: .82rem;
}
.pmc-row:last-child { border-bottom: none; }
.pmc-row span:first-child { color: var(--text-m); font-weight: 500; }
.pmc-row span:last-child { color: var(--text); font-family: var(--mono); font-size: .78rem; font-weight: 600; }