:root {
  --page: #eef3f8;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --surface-3: #edf4f8;
  --ink: #102033;
  --text: #1f2f43;
  --muted: #6d7d8f;
  --border: #dce5ee;
  --border-strong: #c3d2df;
  --line: #e7eef5;
  --nav: #0e1c2e;
  --nav-2: #16283d;
  --cyan: #1fb6d8;
  --cyan-soft: #e7f8fb;
  --teal: #19a994;
  --green: #25a36f;
  --amber: #d88a16;
  --red: #d34a5f;
  --violet: #7068d9;
  --shadow: 0 20px 48px rgba(19,41,67,.12);
  --shadow-sm: 0 10px 24px rgba(19,41,67,.08);
  --shadow-xs: 0 2px 8px rgba(19,41,67,.06);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --sidebar-w: 200px;
}

.pilot-knowledge { margin-top:14px; padding:13px 14px; border-radius:8px; font-size:13px; line-height:1.65; }
.pilot-knowledge strong, .pilot-knowledge small { display:block; }
.pilot-knowledge small { margin-top:7px; color:#64748b; }
.pilot-knowledge-short { font-weight:700; margin-top:6px; }
.pilot-knowledge-full { white-space:pre-wrap; margin-top:5px; }
.pilot-sales-script { background:#eef8fb; border:1px solid #cce7ef; }
.pilot-fact-knowledge { background:#fff8e8; border:1px solid #f2dfae; }
.pilot-fact-knowledge a { display:inline-block; margin-top:7px; color:#0f7490; text-decoration:underline; }
.pilot-editor-toolbar{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:24px}.pilot-outline-editor label{display:block;font-size:12px;font-weight:700;color:#64748b;margin:12px 0}.pilot-outline-editor input,.pilot-outline-editor textarea{display:block;width:100%;margin-top:6px;border:1px solid #dbe0e6;border-radius:8px;padding:10px 12px;background:#fff;color:#18202a;font:inherit}.pilot-outline-editor textarea{min-height:76px;resize:vertical}.pilot-edit-stage{padding:18px;margin:22px 0;background:#f8fafc;border:1px solid #e3e8ed;border-radius:12px}.pilot-edit-item{padding:16px;margin-top:14px;background:#fff;border:1px solid #e5e9ee;border-radius:9px}.pilot-editor-check{display:flex!important;align-items:center;gap:8px}.pilot-editor-check input{display:inline-block;width:auto;margin:0}.pilot-editor-footer{display:flex;justify-content:flex-end;gap:10px;margin-top:22px}
.pilot-fact-editor{margin-top:12px;padding-top:10px;border-top:1px solid #edf0f2}.pilot-fact-editor summary{cursor:pointer;color:#0f7490;font-size:12px;font-weight:700}.pilot-fact-editor select,.pilot-fact-editor>input{width:100%;margin-top:8px;border:1px solid #dbe0e6;border-radius:7px;padding:8px}.pilot-fact-editor label{display:block;margin:8px 0;font-size:12px;color:#64748b}
.modal-overlay{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(15,23,42,.55)}.modal{display:flex;flex-direction:column;width:min(100%,760px);max-height:88vh;background:#fff;border-radius:14px;box-shadow:0 30px 80px rgba(15,23,42,.25)}.modal-header,.modal-footer{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 22px;border-bottom:1px solid #e6e8eb}.modal-footer{justify-content:flex-end;border-top:1px solid #e6e8eb;border-bottom:0}.modal-header h2{margin:0 0 3px}.modal-body{padding:20px 24px}.modal-close{border:0;background:transparent;font-size:28px;color:#64748b;cursor:pointer}.pilot-consent-modal{max-width:760px;max-height:88vh}.pilot-consent-content{overflow:auto;line-height:1.75}.pilot-consent-content li{margin-bottom:9px}.pilot-consent-modal .modal-header small{color:#64748b}

/* ==================== ForePilot 领航系统 ==================== */
.pilot-summary-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-bottom:18px}.pilot-list-card{margin-bottom:16px}.pilot-emphasized{border-color:rgba(34,211,238,.35)}
.pilot-meeting-row{width:100%;display:flex;align-items:center;justify-content:space-between;padding:14px 4px;border:0;border-bottom:1px solid var(--border);background:transparent;color:var(--text);cursor:pointer;text-align:left}.pilot-meeting-row:last-child{border-bottom:0}.pilot-meeting-row:hover{color:var(--cyan)}.pilot-meeting-row span{display:flex;gap:5px;flex-direction:column}.pilot-meeting-row small{color:var(--muted)}.pilot-meeting-meta{align-items:flex-end}.pilot-customer-row{width:100%;display:flex;justify-content:space-between;padding:10px 0;border:0;border-bottom:1px solid var(--border);background:transparent;color:var(--text);text-align:left;cursor:pointer}.pilot-customer-row:hover{color:var(--cyan)}.pilot-customer-row span{color:var(--muted)}.pilot-contact-editor{padding:16px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface-2);display:grid;gap:12px}.pilot-contact-editor+.pilot-contact-editor{margin-top:12px}
.pilot-create-card{margin-bottom:18px}.pilot-consent{display:flex;align-items:flex-start;gap:8px;font-size:13px;line-height:1.6;color:var(--muted)}.pilot-consent input{margin-top:5px}.pilot-consent a{color:var(--cyan)}.pilot-list-card .badge{font-size:12px;color:var(--muted)}.status-pill{display:inline-flex!important;padding:3px 8px;border-radius:999px;background:var(--cyan-soft);color:#08758d;font-size:11px;font-weight:700}
.pilot-workspace{min-height:calc(100vh - 48px);background:#f7f8fa;color:#18202a;border-radius:14px;overflow:hidden}.pilot-topbar{height:72px;background:#fff;border-bottom:1px solid #e6e8eb;display:grid;grid-template-columns:minmax(260px,1fr) auto minmax(260px,1fr);align-items:center;padding:0 22px;gap:18px}.pilot-topbar>div:last-child{text-align:right}.pilot-back{display:block;border:0;background:transparent;color:#65707d;padding:0 0 5px;cursor:pointer}.pilot-status-line{display:flex;flex-direction:column;align-items:center;font-size:12px;color:#65707d}.pilot-status-line span:first-child{font-weight:700;color:#18202a}.pilot-status-line i{display:inline-block;width:7px;height:7px;background:#16a34a;border-radius:50%;margin-right:5px}.pilot-status-line i.error{background:#dc2626}.pilot-transcript-strip{height:48px;background:#fff;border-bottom:1px solid #e6e8eb;padding:8px 22px;display:grid;grid-template-columns:auto minmax(180px,1fr) minmax(180px,320px) auto;gap:10px;align-items:center;font-size:13px}.pilot-live-label{font-weight:700;color:#64748b}.pilot-transcript-strip input{height:32px;border:1px solid #dbe0e6;border-radius:7px;padding:0 10px}.pilot-transcript-strip button{height:32px;border:0;background:#173f5f;color:#fff;border-radius:7px;padding:0 14px;cursor:pointer}.pilot-layout{display:grid;grid-template-columns:310px minmax(0,1fr);height:calc(100vh - 168px)}.pilot-profile{background:#fff;border-right:1px solid #e6e8eb;padding:24px;overflow:auto}.pilot-profile h2{margin:7px 0 20px}.pilot-profile-placeholder{font-size:13px;line-height:1.7;color:#64748b}.pilot-profile textarea{width:100%;min-height:130px;border:1px solid #dbe0e6;border-radius:8px;padding:10px;margin:10px 0;background:#fbfcfd}.pilot-transcript-history{margin-top:12px;max-height:260px;overflow:auto}.pilot-transcript-history p{font-size:12px;line-height:1.5;border-bottom:1px solid #edf0f2;padding:7px 0}.pilot-transcript-history small{display:block;color:#83909d}.pilot-document{overflow:auto;padding:44px 7vw 90px}.pilot-doc-inner{max-width:850px;margin:auto}.pilot-doc-kicker{font-size:12px;letter-spacing:.12em;color:#7c8995;text-transform:uppercase}.pilot-doc-inner>h1{font-family:Georgia,'Noto Serif SC',serif;font-size:32px;margin:8px 0}.pilot-prep-summary{color:#64748b;line-height:1.7;margin-bottom:35px}.pilot-stage{margin-bottom:34px}.pilot-stage-head{display:flex;flex-direction:column;border-bottom:1px solid #dce1e6;padding-bottom:10px;margin-bottom:16px}.pilot-stage-head span{font-size:20px;font-weight:700}.pilot-stage-head small{color:#7c8995;margin-top:4px}.pilot-item{position:relative;border-left:3px solid #d9dee4;padding:13px 18px;margin:8px 0;background:rgba(255,255,255,.58);cursor:pointer;border-radius:0 9px 9px 0}.pilot-item.focus{background:#fff;border-left-color:#0f7490;box-shadow:0 10px 32px rgba(20,47,68,.1);padding:24px}.pilot-item.answered{opacity:.68}.pilot-item-status{font-size:11px;font-weight:700;color:#0f7490;text-transform:uppercase}.pilot-item h3{font-size:18px;margin:5px 0}.pilot-item.focus h3{font-size:26px}.pilot-goal{font-size:13px;color:#778491}.pilot-short-prompt{font-size:16px;font-weight:700;margin:14px 0 7px}.pilot-script{font-family:Georgia,'Noto Serif SC',serif;font-size:16px;line-height:1.9;color:#263441;white-space:pre-wrap}.pilot-item.focus .pilot-script{font-size:19px}.pilot-known{margin-top:14px;padding:10px;background:#eff8f5;border-radius:7px;color:#335b50}
@media(max-width:1279px){.pilot-layout{grid-template-columns:270px minmax(0,1fr)}.pilot-document{padding-left:4vw;padding-right:4vw}.pilot-topbar{grid-template-columns:1fr auto 1fr}}
.pilot-document{padding-left:5vw;padding-right:5vw}
.pilot-doc-inner{width:min(100%,980px);max-width:none;margin:0}
.pilot-stage-head{padding:10px 0;transition:background .18s,color .18s,padding .18s}
.pilot-stage.active>.pilot-stage-head{padding:22px 24px;background:#173f5f;color:#fff;border:0;border-radius:12px;box-shadow:0 14px 32px rgba(23,63,95,.22)}
.pilot-stage.active>.pilot-stage-head span{font-size:25px}
.pilot-stage.active>.pilot-stage-head small{color:rgba(255,255,255,.78);font-size:14px}
.pilot-next-move{display:flex;flex-direction:column;gap:5px;margin-top:12px;padding:12px 14px;background:#eaf2f8;border-left:4px solid #173f5f;border-radius:7px;color:#173f5f}
.pilot-next-move strong{font-size:12px}.pilot-next-move span{line-height:1.65}
.pilot-summary{max-width:980px;margin-left:0;margin-right:0}
.pilot-summary{max-width:850px;margin:0 auto 38px;padding:24px;background:#fff;border:1px solid #dce5ee;border-radius:12px;box-shadow:0 8px 24px rgba(20,47,68,.07)}.pilot-summary h2{margin:6px 0 12px}.pilot-summary>p{line-height:1.8;color:#435363}.pilot-summary-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:18px}.pilot-summary-columns div{background:#f6f8fa;border-radius:8px;padding:12px}.pilot-summary-columns ul{padding-left:18px;margin-top:7px;color:#586777;line-height:1.7}.pilot-fact-list{margin:14px 0}.pilot-fact{display:grid;gap:3px;padding:9px 0;border-bottom:1px solid #edf0f2}.pilot-fact strong{font-size:12px}.pilot-fact span{font-size:13px;line-height:1.5}.pilot-fact small{color:#8a96a2}.pilot-fact.current{border-left:2px solid #19a994;padding-left:8px}.pilot-stage-head{cursor:pointer}.pilot-regenerate{margin-top:12px;border:0;background:transparent;color:#0f7490;font-size:12px;font-weight:700;cursor:pointer}.pilot-regenerate:hover{text-decoration:underline}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(20,184,166,.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(31,182,216,.03) 1px, transparent 1px),
    linear-gradient(135deg, #eef3f8 0%, #f8fbfd 48%, #eef5f7 100%);
  background-size: 72px 72px, 72px 72px, auto;
  min-height: 100vh;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 12% 0%, rgba(31,182,216,.12), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(25,169,148,.08), transparent 26%);
  opacity: .7;
}

/* ===== Auth Pages ===== */
.auth-container {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px;
  position: relative; z-index: 1;
}
.auth-card {
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(220,229,238,.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%; max-width: 440px; padding: 40px 36px;
  transition: box-shadow .3s, transform .25s;
}
.auth-card:hover { box-shadow: 0 24px 56px rgba(19,41,67,.15); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--nav), var(--cyan));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; color: white; font-weight: 800;
}
.auth-logo h2 { margin-top: 12px; font-size: 22px; color: var(--ink); letter-spacing: 0; }
.auth-logo p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  font-size: 14px; color: var(--text); background: var(--surface); transition: .2s;
  font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(31,182,216,.1);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-xs); padding: 11px 20px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: .2s; border: 1px solid var(--border); text-decoration: none;
  font-family: inherit; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--nav), var(--cyan)); color: white; border: none; box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.btn-secondary { background: white; color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #f8fafc; }
.btn-outline { background: transparent; color: var(--cyan); border-color: var(--cyan); }
.btn-outline:hover:not(:disabled) { background: var(--cyan-soft); }
.btn-danger { background: #fff0f2; color: var(--red); border-color: #fac8d0; }
.btn-danger:hover:not(:disabled) { background: #ffe4e6; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-xs); }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--muted); }
.auth-footer a { color: var(--cyan); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }
.toast {
  position: fixed; top: 24px; right: 24px; z-index: 9999; padding: 14px 20px;
  border-radius: var(--radius-xs); font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  animation: slideIn .3s ease; max-width: 420px;
}
.toast.success { background: #ecfdf5; color: #065f46; border: 1px solid #bbf7d0; }
.toast.error { background: #fff1f2; color: #be123c; border: 1px solid #ffe4e6; }
.toast.info { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== App Shell ===== */
.app-shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.sidebar {
  width: var(--sidebar-w); background: linear-gradient(180deg, var(--nav) 0%, #11243a 100%);
  color: #c9d7e5; display: flex; flex-direction: column; position: fixed; top: 0; left: 0;
  bottom: 0; z-index: 100; border-right: 1px solid rgba(255,255,255,.06);
  transition: width .3s cubic-bezier(.22,.61,.36,1);
}
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 24px; min-width: 0; transition: margin-left .3s cubic-bezier(.22,.61,.36,1); }
.sidebar-header {
  padding: 20px 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo .sq {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: white;
}
.sidebar-logo .t { font-size: 15px; font-weight: 700; color: white; }
.sidebar-logo .t small { display: block; font-size: 10px; color: #7a8fa0; font-weight: 400; letter-spacing: .08em; }
.sidebar-nav { flex:1; padding: 12px 9px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 9px; padding: 10px 11px; border-radius: 10px;
  color: #8fa3b5; text-decoration: none; font-size: 14px; font-weight: 550; transition: .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #d0dce8; }
.sidebar-nav a.active { background: linear-gradient(90deg, var(--cyan), var(--teal)); color: white; box-shadow: 0 6px 18px rgba(31,182,216,.18); }
.sidebar-nav a .nav-icon { font-size: 17px; width: 22px; text-align: center; }
.sidebar-footer {
  padding: 14px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.sidebar-user { flex: 1; min-width: 0; }
.sidebar-user .name { font-size: 13px; font-weight: 600; color: #d0dce8; }
.sidebar-user .email { font-size: 11px; color: #7a8fa0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout { color: #7a8fa0; cursor: pointer; font-size: 16px; transition: .15s; background: none; border: none; }
.sidebar-logout:hover { color: #fb7185; }
.main-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
  flex-wrap: wrap; gap: 12px;
}
.main-header .page-title { font-size: 26px; font-weight: 800; color: var(--ink); }
.main-header .page-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }
.page { display: none; }
.page.active { display: block; }

/* ===== Cards ===== */
.card {
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px);
  border: 1px solid rgba(220,229,238,.95); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #f9fcfd, #eef7fa);
}
.card-title { font-size: 14px; font-weight: 800; color: var(--ink); }
.card-body { padding: 20px; }
.card-body.compact { padding: 14px; }

/* ===== Stats ===== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px;
  background: linear-gradient(135deg, #ffffff, #f6fafc); box-shadow: var(--shadow-sm);
}
.stat-card.cyan { border-left: 4px solid var(--cyan); }
.stat-card.teal { border-left: 4px solid var(--teal); }
.stat-card.violet { border-left: 4px solid var(--violet); }
.stat-card.amber { border-left: 4px solid var(--amber); }
.stat-card .stat-label { font-size: 12px; color: var(--muted); }
.stat-card .stat-value { margin-top: 6px; font-size: 28px; font-weight: 800; color: var(--ink); }
.stat-card .stat-desc { margin-top: 4px; font-size: 12px; color: var(--muted); }

/* ===== Grid ===== */
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-12 { grid-column: span 12; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.gap-16 { gap: 16px; }

/* ===== Components ===== */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: white; color: #334155;
}
.pill.sky { background: var(--cyan-soft); border-color: #b8e8f1; color: #08748a; }
.pill.green { background: #eaf8f3; border-color: #b9e7d8; color: #12745f; }
.pill.purple { background: #f2f1ff; border-color: #d8d6fb; color: #5650b6; }
.pill.amber { background: #fff7e8; border-color: #f3d39d; color: #9f650c; }
.pill.rose { background: #fff0f2; border-color: #fac8d0; color: #ad3448; }
.alert {
  border-radius: var(--radius-sm); padding: 14px; border: 1px solid var(--border);
  font-size: 13px; line-height: 1.6;
}
.alert.sky { background: #f0f9ff; border-color: #bae6fd; color: #0369a1; }
.alert.green { background: #ecfdf5; border-color: #bbf7d0; color: #047857; }
.alert.amber { background: #fffbeb; border-color: #fde68a; color: #a16207; }
.alert.rose { background: #fff1f2; border-color: #ffe4e6; color: #be123c; }
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .empty-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state .empty-desc { font-size: 13px; line-height: 1.6; }
.spinner {
  display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--cyan); border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.badge-status {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
}
.badge-status.processing { background: #f0f9ff; color: #0369a1; }
.badge-status.completed { background: #ecfdf5; color: #047857; }
.badge-status.failed { background: #fff1f2; color: #be123c; }
.badge-status.pending { background: #fffbeb; color: #a16207; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.processing .status-dot { background: #0ea5e9; animation: pulse-dot 1.4s infinite; }
.completed .status-dot { background: #10b981; }
.failed .status-dot { background: #ef4444; }
.pending .status-dot { background: #f59e0b; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ===== Topic List ===== */
.topic-list { display: flex; flex-direction: column; gap: 8px; }
.topic-item {
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: .18s; background: white;
}
.topic-item:hover { border-color: var(--cyan); box-shadow: var(--shadow-xs); }
.topic-item.selected { border-color: var(--cyan); background: var(--cyan-soft); box-shadow: 0 0 0 3px rgba(31,182,216,.09); }
.topic-item .topic-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.topic-item .topic-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }

/* ===== Script Editor ===== */
.script-editor { position: relative; }
.script-editor textarea {
  width: 100%; min-height: 280px; padding: 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; line-height: 1.8; color: var(--text);
  resize: vertical; font-family: inherit; background: white;
}
.script-editor textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(31,182,216,.08); }
.script-toolbar {
  display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap;
}
.diff-view {
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.diff-view .diff-header {
  padding: 10px 14px; background: #f8fafc; font-size: 12px; font-weight: 700; color: var(--muted);
  border-bottom: 1px solid var(--line); display: flex; justify-content: space-between;
}
.diff-view .diff-body { padding: 14px; font-size: 14px; line-height: 1.8; color: var(--text); max-height: 320px; overflow-y: auto; }
.diff-added { background: #e6f7ed; color: #047857; }
.diff-removed { background: #ffecec; color: #be123c; text-decoration: line-through; }

/* ===== Right Panel Config ===== */
.config-section { margin-bottom: 16px; }
.config-section .config-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 8px; }
.config-select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  font-size: 14px; color: var(--text); background: white; cursor: pointer; font-family: inherit;
}
.config-select:focus { outline: none; border-color: var(--cyan); }
.checkbox-list { display: flex; flex-direction: column; gap: 6px; }
.checkbox-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-xs); font-size: 13px;
  cursor: pointer; transition: .15s; background: white;
}
.checkbox-item:hover { border-color: var(--cyan); }
.checkbox-item.checked { background: var(--cyan-soft); border-color: #b8e8f1; }
.checkbox-item input[type="checkbox"] { accent-color: var(--cyan); }

/* ===== Video History Table ===== */
.video-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.video-table th, .video-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.video-table th { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.video-table td { color: var(--text); }
.video-table tr:hover td { background: #f8fafc; }
.video-thumb { width: 60px; height: 106px; border-radius: 6px; background: #f1f5f9; object-fit: cover; }

/* ===== Settings Tabs ===== */
.settings-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line); padding-bottom: 0; }
.settings-tab {
  padding: 10px 18px; border: none; background: none; cursor: pointer; font-size: 14px;
  font-weight: 600; color: var(--muted); border-radius: 8px 8px 0 0; transition: .15s;
  font-family: inherit;
}
.settings-tab:hover { color: var(--text); background: #f8fafc; }
.settings-tab.active { color: var(--cyan); border-bottom: 2px solid var(--cyan); background: transparent; }

/* ===== Page Transitions ===== */
.page { animation: pageIn .35s cubic-bezier(.22,.61,.36,1); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Skeleton Loading ===== */
.skeleton {
  background: linear-gradient(90deg, #e9eef3 25%, #f4f7fa 50%, #e9eef3 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-xs);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }
.skeleton-heading { height: 28px; width: 40%; margin-bottom: 12px; }
.skeleton-stat { height: 88px; border-radius: var(--radius-sm); }
.skeleton-row { height: 44px; margin-bottom: 6px; }
.skeleton-card { height: 200px; border-radius: var(--radius); }
.skeleton-avatar { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c3d2df; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #a0b5c8; }

/* ===== Micro-interactions ===== */
.btn:active:not(:disabled) { transform: scale(.97); }
.card { transition: box-shadow .3s, transform .25s; }
.card:hover { box-shadow: 0 24px 56px rgba(19,41,67,.14); }
.stat-card { transition: transform .25s, box-shadow .25s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(19,41,67,.11); }
.topic-item { transition: all .2s cubic-bezier(.22,.61,.36,1); }
.topic-item:active { transform: scale(.98); }
.checkbox-item { transition: all .18s; }
.sidebar-nav a { transition: all .2s cubic-bezier(.22,.61,.36,1); }
.settings-tab { transition: color .2s, border-color .2s, background .15s; position: relative; }

/* ===== Toast exit animation ===== */
.toast.removing { animation: slideOut .25s ease forwards; }
@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ===== Enhanced Stat Cards ===== */
.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
  content: ''; position: absolute; top: -24px; right: -24px;
  width: 64px; height: 64px; border-radius: 50%;
  opacity: .08; pointer-events: none;
}
.stat-card.cyan::after { background: var(--cyan); }
.stat-card.teal::after { background: var(--teal); }
.stat-card.violet::after { background: var(--violet); }
.stat-card.amber::after { background: var(--amber); }
.stat-card .stat-icon {
  font-size: 22px; margin-bottom: 6px; opacity: .7;
}

/* ===== Button loading state ===== */
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: white; border-radius: 50%;
  animation: spin .6s linear infinite;
}
.btn-secondary.loading::after,
.btn-outline.loading::after {
  border-color: rgba(0,0,0,.12);
  border-top-color: var(--muted);
}

/* ===== Enhanced focus ring ===== */
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.sidebar-nav a:focus-visible { outline-color: white; outline-offset: -2px; }

/* ===== Smooth number transition hint ===== */
.stat-value { transition: color .3s; }

/* ===== Settings panel transition ===== */
.settings-panel { animation: pageIn .3s cubic-bezier(.22,.61,.36,1); }

/* ===== Enhanced empty state ===== */
.empty-state { animation: pageIn .4s ease; }

/* ===== Topic card category icon ===== */
.topic-item .topic-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}

/* ===== Diff view enhancement ===== */
.diff-view { transition: box-shadow .25s; }
.diff-view:hover { box-shadow: var(--shadow-sm); }

/* ===== Video table enhancement ===== */
.video-table tbody tr { transition: background .15s; }

/* ===== Utility text ===== */
.text-muted-sm { font-size: 12px; color: var(--muted); }
.text-muted-xs { font-size: 11px; color: var(--muted); }

/* ===== Section label (script editor) ===== */
.section-label {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
}

/* ===== Code ===== */
code {
  background: rgba(15,28,46,.07); color: var(--nav);
  padding: 2px 7px; border-radius: 5px; font-size: .9em;
  font-family: "SF Mono", "Cascadia Code", "Fira Code", "Menlo", monospace;
}

/* ===== Readonly input ===== */
.input-readonly {
  background: var(--surface-2) !important;
  color: var(--muted) !important;
  cursor: default;
}

/* ===== Date input ===== */
input[type="date"] {
  color-scheme: light;
  font-family: inherit;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: .5; transition: opacity .15s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* ===== Settings tab panel transition ===== */
.settings-panel {
  animation: fadeTabIn .25s ease;
}
@keyframes fadeTabIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Brand-IP center panel emphasis ===== */
.col-6 > .card {
  box-shadow: 0 22px 52px rgba(19,41,67,.13), 0 0 0 1px rgba(31,182,216,.06);
}

/* ===== Form validation visual ===== */
.form-group input.input-error,
.form-group textarea.input-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(211,74,95,.1);
}
.form-group .field-hint { font-size: 11px; margin-top: 4px; }
.form-group .field-hint.error { color: var(--red); }

/* ===== Responsive ===== */
@media (max-width: 1280px) {
  .grid-12 { grid-template-columns: 1fr; }
  .col-3,.col-4,.col-5,.col-6,.col-8,.col-9 { grid-column: auto; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { width: 60px; }
  .sidebar-header { padding: 14px 10px; }
  .sidebar-logo .t { display: none; }
  .sidebar-logo .sq { margin: 0 auto; }
  .sidebar-nav a { justify-content: center; padding: 10px; }
  .sidebar-nav a span:not(.nav-icon) { display: none; }
  .sidebar-footer { padding: 10px; justify-content: center; }
  .sidebar-user { display: none; }
  .sidebar-logout { margin: 0 auto; }
  .main-content { margin-left: 60px; }
  .stats-row { grid-template-columns: 1fr; }
  .main-header .page-title { font-size: 20px; }
}
