/* ===== Reset & Variables ===== */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --red:#E53E3E;--red-bg:#FFF5F5;--red-border:#FED7D7;
  --orange:#DD6B20;--orange-bg:#FFFAF0;--orange-border:#FEEBC8;
  --blue:#3182CE;--blue-bg:#EBF8FF;--blue-border:#BEE3F8;
  --green:#38A169;--green-bg:#F0FFF4;
  --gray-50:#F7FAFC;--gray-100:#EDF2F7;--gray-200:#E2E8F0;
  --gray-300:#CBD5E0;--gray-400:#A0AEC0;--gray-500:#718096;
  --gray-600:#4A5568;--gray-700:#2D3748;--gray-800:#1A202C;--gray-900:#171923;
  --radius:12px;--radius-sm:8px;
  --shadow:0 1px 3px rgba(0,0,0,.08),0 4px 12px rgba(0,0,0,.04);
  --shadow-lg:0 4px 24px rgba(0,0,0,.12);
}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;background:var(--gray-50);color:var(--gray-800);line-height:1.6;min-height:100vh}

/* ===== Header ===== */
.app-header{display:flex;align-items:center;justify-content:space-between;padding:0 24px;height:56px;background:#fff;border-bottom:1px solid var(--gray-200);position:sticky;top:0;z-index:100}
.header-left{display:flex;align-items:center;gap:24px}
.logo{display:flex;align-items:center;gap:8px;font-size:18px;font-weight:700;cursor:pointer}
.logo-dot{width:8px;height:8px;border-radius:50%;background:var(--green);animation:pulse 2s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.4}}
.nav-links{display:flex;gap:4px}
.nav-link{padding:6px 14px;border-radius:6px;font-size:14px;text-decoration:none;color:var(--gray-600);transition:all .2s}
.nav-link:hover,.nav-link.router-link-active{background:var(--gray-100);color:var(--gray-900)}
.header-right{display:flex;align-items:center;gap:16px;font-size:13px;color:var(--gray-500)}
.sys-status{color:var(--green);font-weight:500}
.sys-status::before{content:'';display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--green);margin-right:6px;animation:pulse 2s infinite}

/* ===== Main ===== */
.main-content{max-width:1200px;margin:0 auto;padding:24px 20px}

/* ===== Stats Grid ===== */
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:24px}
.stat-card{background:#fff;border-radius:var(--radius);padding:20px;box-shadow:var(--shadow);display:flex;align-items:center;gap:14px;transition:all .2s}
.stat-card:hover{box-shadow:var(--shadow-lg);transform:translateY(-1px)}
.stat-icon{width:44px;height:44px;border-radius:var(--radius-sm);display:flex;align-items:center;justify-content:center;font-size:20px;flex-shrink:0}
.stat-icon.red{background:var(--red-bg);color:var(--red)}
.stat-icon.orange{background:var(--orange-bg);color:var(--orange)}
.stat-icon.blue{background:var(--blue-bg);color:var(--blue)}
.stat-icon.green{background:var(--green-bg);color:var(--green)}
.stat-num{font-size:26px;font-weight:700;line-height:1.2}
.stat-label{font-size:13px;color:var(--gray-500);margin-top:2px}

/* ===== Tabs ===== */
.tabs{display:flex;gap:4px;background:var(--gray-100);padding:4px;border-radius:var(--radius-sm);margin-bottom:20px;width:fit-content}
.tab{padding:8px 20px;border-radius:6px;font-size:14px;font-weight:500;cursor:pointer;border:none;background:transparent;color:var(--gray-600)}
.tab.active{background:#fff;color:var(--gray-900);box-shadow:0 1px 3px rgba(0,0,0,.1)}
.tab .badge{display:inline-block;min-width:18px;padding:1px 7px;border-radius:10px;font-size:11px;font-weight:600;margin-left:6px;color:#fff}
.tab .badge.red{background:var(--red)}.tab .badge.orange{background:var(--orange)}.tab .badge.blue{background:var(--blue)}

/* ===== Alert List ===== */
.alert-item{background:#fff;border-radius:var(--radius);padding:16px 20px;box-shadow:var(--shadow);cursor:pointer;transition:all .2s;display:flex;align-items:center;gap:14px;border-left:4px solid transparent;margin-bottom:10px}
.alert-item:hover{box-shadow:var(--shadow-lg)}
.alert-item.high{border-left-color:var(--red)}.alert-item.medium{border-left-color:var(--orange)}.alert-item.low{border-left-color:var(--blue)}
.alert-level-tag{font-size:12px;font-weight:700;padding:3px 10px;border-radius:20px;white-space:nowrap}
.alert-level-tag.high{background:var(--red-bg);color:var(--red)}
.alert-level-tag.medium{background:var(--orange-bg);color:var(--orange)}
.alert-level-tag.low{background:var(--blue-bg);color:var(--blue)}
.alert-body{flex:1;min-width:0}
.alert-title{font-size:15px;font-weight:600;margin-bottom:4px}
.alert-meta{font-size:13px;color:var(--gray-500);display:flex;gap:16px;flex-wrap:wrap}
.alert-chevron{color:var(--gray-400);font-size:18px}
.alert-item .btn-primary.btn-sm{flex-shrink:0;margin-left:4px}
.empty-state{text-align:center;padding:60px 20px;color:var(--gray-400)}
.empty-state .empty-icon{font-size:48px;margin-bottom:12px}

/* ===== Back Button ===== */
.back-btn{display:inline-flex;align-items:center;gap:6px;font-size:14px;color:var(--gray-600);cursor:pointer;border:none;background:none;padding:8px 0;margin-bottom:16px;font-weight:500}
.back-btn:hover{color:var(--gray-900)}
.section-title{font-size:17px;font-weight:600;margin-bottom:4px}
.section-subtitle{font-size:13px;color:var(--gray-500);margin-bottom:20px}

/* ===== Session Layout ===== */
.session-layout{display:grid;grid-template-columns:1fr 380px;gap:20px;align-items:start}
@media(max-width:900px){.session-layout{grid-template-columns:1fr}}
.chat-panel{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.chat-header{padding:14px 18px;border-bottom:1px solid var(--gray-100);font-weight:600;font-size:14px}
.chat-body{padding:16px 18px;max-height:500px;overflow-y:auto;display:flex;flex-direction:column;gap:12px}
.chat-msg{max-width:85%;padding:10px 14px;border-radius:var(--radius-sm);font-size:14px;line-height:1.6;position:relative}
.chat-msg.sharer{background:var(--gray-100);align-self:flex-start;border-bottom-left-radius:2px}
.chat-msg.participant{background:#E8F5E9;align-self:flex-end;border-bottom-right-radius:2px}
.chat-msg.flagged{box-shadow:0 0 0 2px var(--orange)}
.chat-msg.flagged-high{box-shadow:0 0 0 2px var(--red)}
.msg-speaker{font-size:12px;color:var(--gray-500);margin-bottom:3px;font-weight:500}
.msg-time{font-size:11px;color:var(--gray-400);margin-top:4px}
.flag-dot{position:absolute;top:-3px;right:-3px;width:10px;height:10px;border-radius:50%}
.flag-dot.warn{background:var(--orange)}.flag-dot.high{background:var(--red)}

/* ===== Analysis Panel ===== */
.analysis-panel{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);padding:18px;font-size:14px}
.analysis-panel h3{font-size:15px;font-weight:600;margin-bottom:14px;padding-bottom:10px;border-bottom:1px solid var(--gray-100)}
.as-section{margin-bottom:16px}
.as-label{font-size:11px;font-weight:600;text-transform:uppercase;color:var(--gray-500);letter-spacing:.5px;margin-bottom:6px}
.bar{height:8px;background:var(--gray-100);border-radius:4px;overflow:hidden;margin-bottom:4px}
.bar .fill{height:100%;border-radius:4px;transition:width .6s}
.fill.red{background:var(--red)}.fill.orange{background:var(--orange)}.fill.green{background:var(--green)}
.bar-row{display:flex;justify-content:space-between;font-size:12px;margin-bottom:6px}
.bar-row .val{font-weight:600}
.signal-tag{display:inline-block;padding:3px 10px;border-radius:20px;font-size:11px;font-weight:500;margin:2px}
.signal-tag.danger{background:var(--red-bg);color:var(--red);border:1px solid var(--red-border)}
.signal-tag.warn{background:var(--orange-bg);color:var(--orange);border:1px solid var(--orange-border)}
.signal-tag.info{background:var(--blue-bg);color:var(--blue);border:1px solid var(--blue-border)}

/* ===== Alert Detail ===== */
.alert-detail-header{padding:22px;border-radius:var(--radius);margin-bottom:20px;display:flex;align-items:flex-start;gap:14px}
.alert-detail-header.high{background:var(--red-bg);border:1px solid var(--red-border)}
.alert-detail-header.medium{background:var(--orange-bg);border:1px solid var(--orange-border)}
.alert-detail-header.low{background:var(--blue-bg);border:1px solid var(--blue-border)}
.alert-badge{font-size:13px;font-weight:700;padding:4px 12px;border-radius:20px;color:#fff;white-space:nowrap}
.alert-badge.high{background:var(--red)}.alert-badge.medium{background:var(--orange)}.alert-badge.low{background:var(--blue)}
.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:20px}
@media(max-width:768px){.detail-grid{grid-template-columns:1fr}}
.detail-card{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);padding:18px;font-size:14px}
.detail-card h4{font-size:14px;font-weight:600;margin-bottom:10px;color:var(--gray-700)}
.quote-block{background:var(--gray-50);border-left:3px solid var(--gray-300);padding:10px 14px;border-radius:0 var(--radius-sm) var(--radius-sm) 0;font-size:13px;line-height:1.7;margin:8px 0}
.quote-block.highlight{border-left-color:var(--orange);background:var(--orange-bg)}
.action-suggestion{background:var(--green-bg);border:1px solid #C6F6D5;padding:14px;border-radius:var(--radius-sm);font-size:13px;line-height:1.7;margin-top:10px}

/* ===== Buttons ===== */
.btn-row{display:flex;gap:10px;margin-top:20px;flex-wrap:wrap}
.btn{padding:9px 20px;border-radius:var(--radius-sm);font-size:13px;font-weight:600;cursor:pointer;border:none;display:inline-flex;align-items:center;gap:6px;transition:all .2s}
.btn-primary{background:var(--gray-900);color:#fff}.btn-primary:hover{background:#000}
.btn-success{background:var(--green);color:#fff}.btn-success:hover{background:#2F855A}
.btn-outline{background:#fff;color:var(--gray-700);border:1px solid var(--gray-300)}.btn-outline:hover{background:var(--gray-50)}
.btn-ghost{background:transparent;color:var(--gray-600)}.btn-ghost:hover{background:var(--gray-100)}
.btn-sm{padding:5px 12px;font-size:12px}
.btn-danger{background:var(--red);color:#fff}

/* ===== User Profile ===== */
.profile-header-card{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);padding:22px;display:flex;align-items:center;gap:18px;margin-bottom:20px}
.profile-avatar{width:60px;height:60px;border-radius:50%;background:linear-gradient(135deg,#667EEA,#764BA2);display:flex;align-items:center;justify-content:center;color:#fff;font-size:22px;font-weight:700;flex-shrink:0}
.profile-meta-row{font-size:13px;color:var(--gray-500);display:flex;gap:20px;flex-wrap:wrap;margin-top:4px}
.risk-badge{padding:10px 18px;border-radius:var(--radius-sm);font-weight:600;font-size:13px;text-align:center}
.risk-badge.high-risk{background:var(--red-bg);color:var(--red)}.risk-badge.mid-risk{background:var(--orange-bg);color:var(--orange)}.risk-badge.low-risk{background:var(--green-bg);color:var(--green)}
/* Timeline */
.timeline{position:relative;padding-left:26px}
.timeline::before{content:'';position:absolute;left:9px;top:4px;bottom:4px;width:2px;background:var(--gray-200)}
.tl-item{position:relative;margin-bottom:18px}
.tl-item::before{content:'';position:absolute;left:-21px;top:6px;width:10px;height:10px;border-radius:50%;background:var(--gray-300)}
.tl-item.high::before{background:var(--red)}.tl-item.medium::before{background:var(--orange)}.tl-item.low::before{background:var(--gray-300)}
.tl-date{font-size:11px;color:var(--gray-500);margin-bottom:3px}
.tl-content{font-size:13px;color:var(--gray-800)}
.tl-tag{display:inline-block;padding:2px 8px;border-radius:10px;font-size:10px;font-weight:600;margin-left:6px}

/* ===== Input Form ===== */
.form-card{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);padding:22px;margin-bottom:20px}
.form-card h3{font-size:16px;font-weight:600;margin-bottom:16px;padding-bottom:10px;border-bottom:1px solid var(--gray-100)}
.form-group{margin-bottom:14px}
.form-group label{display:block;font-size:13px;font-weight:600;color:var(--gray-700);margin-bottom:4px}
.form-group input,.form-group textarea,.form-group select{width:100%;padding:8px 12px;border:1px solid var(--gray-300);border-radius:var(--radius-sm);font-size:14px;font-family:inherit;transition:border-color .2s}
.form-group input:focus,.form-group textarea:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px rgba(49,130,206,.1)}
.form-row{display:flex;gap:12px}
.form-row>*{flex:1}
.msg-list{max-height:300px;overflow-y:auto;border:1px solid var(--gray-200);border-radius:var(--radius-sm);padding:12px}
.msg-item{display:flex;gap:10px;padding:8px 0;border-bottom:1px solid var(--gray-100);font-size:13px}
.msg-item:last-child{border-bottom:none}
.msg-item .mi-speaker{font-weight:600;color:var(--gray-700);white-space:nowrap;min-width:60px}
.msg-item .mi-text{flex:1;color:var(--gray-800)}
.msg-item .mi-del{cursor:pointer;color:var(--gray-400);font-size:16px}.msg-item .mi-del:hover{color:var(--red)}
.badge-count{display:inline-block;min-width:22px;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:600;background:var(--blue);color:#fff;text-align:center}

/* ===== Session Card ===== */
.session-card{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);padding:16px 20px;cursor:pointer;transition:all .2s;display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;border:1px solid transparent}
.session-card:hover{box-shadow:var(--shadow-lg);border-color:var(--blue-border)}
.session-card .sc-info{flex:1}
.session-card .sc-title{font-weight:600;font-size:15px;margin-bottom:4px}
.session-card .sc-meta{font-size:13px;color:var(--gray-500);display:flex;gap:16px}

/* ===== Toast ===== */
.toast{position:fixed;bottom:30px;left:50%;transform:translateX(-50%);background:var(--gray-900);color:#fff;padding:12px 24px;border-radius:24px;font-size:14px;font-weight:500;z-index:999;opacity:0;pointer-events:none;transition:opacity .3s}
.toast.show{opacity:1}

/* ===== Upload Area ===== */
.upload-area{border:2px dashed var(--gray-300);border-radius:var(--radius);cursor:pointer;transition:all .2s;min-height:140px;display:flex;align-items:center;justify-content:center}
.upload-area:hover{border-color:var(--blue);background:var(--blue-bg)}

/* ===== Responsive ===== */
@media(max-width:768px){
  .stats-grid{grid-template-columns:repeat(2,1fr)}
  .app-header{padding:0 12px}
  .nav-links{display:none}
}
