:root {
  --bg: #0a0f1e; --surface: #131b2e; --surface2: #1a2540; --border: #1e2a45;
  --text: #e2e8f0; --text2: #c8d0dc; --muted: #7a8ba8; --muted2: #5a6a88;
  --accent: #6366f1; --accent2: #8b5cf6; --accent-glow: rgba(99,102,241,0.12);
  --gold: #f59e0b; --green: #10b981; --red: #ef4444;
  --radius: 8px; --radius-sm: 6px; --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --hover-bg: rgba(255,255,255,0.025); --hover-bg2: rgba(255,255,255,0.02);
  --row-border: rgba(255,255,255,0.035); --input-bg: rgba(0,0,0,0.3);
  --en-color: #93c5fd; --overlay-bg: rgba(0,0,0,0.65);
}

[data-theme="light"] {
  --bg: #f8fafc; --surface: #ffffff; --surface2: #f1f5f9; --border: #e2e8f0;
  --text: #1e293b; --text2: #334155; --muted: #64748b; --muted2: #94a3b8;
  --accent: #6366f1; --accent2: #8b5cf6; --accent-glow: rgba(99,102,241,0.08);
  --gold: #d97706; --green: #059669; --red: #dc2626;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.1);
  --hover-bg: rgba(0,0,0,0.03); --hover-bg2: rgba(0,0,0,0.02);
  --row-border: rgba(0,0,0,0.05); --input-bg: rgba(0,0,0,0.04);
  --en-color: #3b82f6; --overlay-bg: rgba(0,0,0,0.4);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8fafc; --surface: #ffffff; --surface2: #f1f5f9; --border: #e2e8f0;
    --text: #1e293b; --text2: #334155; --muted: #64748b; --muted2: #94a3b8;
    --accent: #6366f1; --accent2: #8b5cf6; --accent-glow: rgba(99,102,241,0.08);
    --gold: #d97706; --green: #059669; --red: #dc2626;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.1);
    --hover-bg: rgba(0,0,0,0.03); --hover-bg2: rgba(0,0,0,0.02);
    --row-border: rgba(0,0,0,0.05); --input-bg: rgba(0,0,0,0.04);
    --en-color: #3b82f6; --overlay-bg: rgba(0,0,0,0.4);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

svg { vertical-align: middle; flex-shrink: 0; }
i.ic { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg); color: var(--text); height: 100vh; overflow: hidden;
  font-size: 13px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}

#app { display: flex; height: 100vh; }

/* ===== Sidebar ===== */
#sidebar {
  width: 260px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  box-shadow: 1px 0 0 rgba(0,0,0,0.05);
  transition: margin-left 0.3s ease;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 18px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(99,102,241,0.03) 0%, transparent 100%);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
}
.logo-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.25);
}
.logo-text h1 {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 2px; letter-spacing: -0.2px;
}
.server-status {
  font-size: 11px; display: flex; align-items: center; gap: 4px;
  font-weight: 500; color: var(--green);
}
.server-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px rgba(16,185,129,0.4);
}

/* ===== Sidebar Toggle Button ===== */
body.sidebar-collapsed #sidebar {
  margin-left: -260px;
}

.sidebar-toggle-btn {
  position: fixed; top: 50%; left: 248px; z-index: 100;
  width: 24px; height: 24px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); box-shadow: var(--shadow-md);
  transition: left 0.3s ease, transform 0.3s ease;
  transform: translateY(-50%);
}
.sidebar-toggle-btn:hover {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
}
body.sidebar-collapsed .sidebar-toggle-btn {
  left: 8px;
  transform: translateY(-50%) rotate(180deg);
}

/* ===== Sidebar User Info ===== */
.sidebar-user-info {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.user-details {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px;
}
.user-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-role-badge {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 4px; text-transform: uppercase; letter-spacing: 0.5px;
  width: fit-content;
}
.role-l1 { background: rgba(245,158,11,0.15); color: var(--gold); }
.role-l2 { background: rgba(99,102,241,0.15); color: var(--accent); }
.role-l3 { background: rgba(16,185,129,0.15); color: var(--green); }

/* ===== Expiry Banner ===== */
.expiry-banner {
  background: linear-gradient(90deg, rgba(245,158,11,0.1), rgba(245,158,11,0.05));
  border-bottom: 1px solid rgba(245,158,11,0.2);
  padding: 10px 16px; font-size: 12px; color: var(--gold);
  text-align: center; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.expiry-banner::before {
  content: '⚠'; font-size: 14px;
}

/* ===== Sidebar Actions ===== */
.sidebar-actions {
  padding: 12px 14px; display: flex; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-actions .btn-outline {
  flex: 1; justify-content: center; font-size: 12px; padding: 7px 10px;
}

/* ===== Sidebar Nav ===== */
.sidebar-nav {
  padding: 10px 8px; display: flex; flex-direction: column; gap: 2px;
  flex: 1; overflow-y: auto;
}
.nav-section-label {
  font-size: 10px; font-weight: 700; color: var(--muted2);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 12px 12px 6px; margin-top: 4px;
}
.nav-section-label:first-child { margin-top: 0; padding-top: 4px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 14px; border: none; background: none; color: var(--muted);
  font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
  border-radius: var(--radius); transition: all 0.2s ease;
  position: relative; text-align: left;
}
.nav-btn:hover { color: var(--text2); background: var(--hover-bg); }
.nav-btn.active {
  color: var(--accent); font-weight: 600;
  background: var(--accent-glow);
}
.nav-btn.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 0 2px 2px 0;
}
.nav-btn .nav-icon { font-size: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-btn.active .nav-icon { opacity: 1; }
.nav-btn .tab-badge {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  min-width: 18px; height: 18px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 5px;
  line-height: 18px; text-align: center; box-shadow: 0 2px 6px rgba(239,68,68,0.3);
  animation: badgePulse 2s infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: translateY(-50%) scale(1); }
  50% { transform: translateY(-50%) scale(1.05); }
}

/* ===== Sidebar Footer ===== */
.sidebar-footer {
  padding: 10px 8px; border-top: 1px solid var(--border);
  background: var(--surface2);
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-footer-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 14px; border: none; background: none; color: var(--muted);
  font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
  border-radius: var(--radius); transition: all 0.2s ease; text-align: left;
}
.sidebar-footer-btn:hover { color: var(--text2); background: var(--hover-bg); }
.sidebar-footer-btn .footer-icon {
  font-size: 16px; opacity: 0.8; display: flex; align-items: center;
}
.sidebar-footer-btn.logout:hover { color: var(--red); background: rgba(239,68,68,0.08); }

/* ===== Section Title ===== */
.sidebar-section-title {
  padding: 14px 16px 6px; font-size: 13px; font-weight: 700; color: var(--muted2);
  text-transform: uppercase; letter-spacing: 1.2px;
}

/* ===== Stage List ===== */
.stage-list { flex: 1; overflow-y: auto; padding: 6px 8px 8px; }
.stage-item {
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition); border: 1px solid transparent;
  margin-bottom: 2px; display: flex; justify-content: space-between; align-items: center;
  position: relative;
}
.stage-item:hover {
  background: var(--hover-bg); border-color: var(--border);
}
.stage-item.active {
  background: var(--accent-glow); border-color: rgba(99,102,241,0.2);
}
.stage-item .title {
  font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.4;
}
.stage-item.stage-ref { opacity: 0.55; }
.stage-item.stage-ref:hover { opacity: 0.85; }
.stage-item .count {
  font-size: 13px; color: var(--muted2); background: var(--input-bg);
  padding: 1px 7px; border-radius: 8px; font-weight: 600;
}
.stage-item .del-stage {
  opacity: 0; font-size: 13px; cursor: pointer; padding: 2px 5px;
  border-radius: 4px; color: var(--muted2); transition: all var(--transition);
}
.stage-item:hover .del-stage { opacity: 0.4; }
.stage-item .del-stage:hover { opacity: 1; color: var(--red); background: rgba(239,68,68,0.12); }

/* ===== Main ===== */
#main { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.tab-content { flex: 1; overflow-y: auto; }

/* ===== Empty State ===== */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 40px; color: var(--muted);
  text-align: center;
}
.empty-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--surface2);
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted2); font-size: 28px;
}
.empty-state h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; color: var(--text2); }
.empty-state p { font-size: 13px; color: var(--muted); }

/* ===== Stage Detail ===== */
/* ===== Stage Detail Container ===== */
.stage-detail {
  padding: 24px 28px;
  max-width: 960px;
  margin: 20px auto 0;
  border-top: 1px solid var(--border);
}
#industryStageDetail .stage-detail,
#entStageDetail .stage-detail,
#stageDetail .stage-detail {
  margin-top: 0;
  border-top: none;
  padding: 24px 20px;
}
.stage-detail > h2 {
  font-size: 18px; font-weight: 700; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.stage-detail > h2 .stage-id-badge {
  font-size: 11px; color: var(--accent);
  background: var(--accent-glow); padding: 3px 10px;
  border-radius: 6px; font-weight: 600;
  border: 1px solid rgba(99,102,241,0.2);
  letter-spacing: 0.3px;
}

/* ===== Intro Editor ===== */
.intro-section {
  margin-bottom: 24px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.intro-section label {
  font-size: 11px; font-weight: 600; color: var(--muted2);
  text-transform: uppercase; letter-spacing: 0.6px;
  display: block; margin-bottom: 6px;
}
.intro-section textarea, .intro-section input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px; color: var(--text);
  font-family: inherit; font-size: 13px; outline: none; resize: vertical;
  margin-bottom: 10px; transition: all 0.2s ease;
}
.intro-section textarea:last-child, .intro-section input:last-child {
  margin-bottom: 0;
}
.intro-section textarea:focus, .intro-section input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg);
}
.intro-section .field-row { display: flex; gap: 14px; }
.intro-section .field-row > div { flex: 1; }
.intro-section .field-row label { font-size: 11px; margin-bottom: 6px; }
.intro-section .field-row input { font-size: 13px; }

/* ===== QA Section ===== */
.qa-section { margin-top: 24px; }
.qa-section .section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.qa-section .section-header h3 {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}

/* ===== QA Card ===== */
.qa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  overflow: hidden;
  transition: all 0.2s ease;
  position: relative;
}
.qa-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.qa-card:hover {
  border-color: rgba(99,102,241,0.25);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.qa-card:hover::before { opacity: 1; }

.qa-row {
  padding: 14px 18px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--row-border);
}
.qa-row:last-child { border-bottom: none; }

.qa-tag {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 6px;
  white-space: nowrap; flex-shrink: 0; height: fit-content; line-height: 1.4;
  letter-spacing: 0.3px;
}
.tag-q {
  background: linear-gradient(135deg, rgba(239,68,68,0.12), rgba(239,68,68,0.08));
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.2);
}
.tag-a {
  background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(16,185,129,0.08));
  color: #10b981;
  border: 1px solid rgba(16,185,129,0.2);
}

.qa-text {
  flex: 1; font-size: 13px; line-height: 1.65; word-break: break-word; min-width: 0;
  color: var(--text2);
}
.qa-text .en { color: var(--en-color); }
.qa-text .cn { color: var(--text); }
.qa-text .divider {
  display: block; height: 1px;
  background: linear-gradient(90deg, transparent, var(--row-border), transparent);
  margin: 4px 0;
}

/* ===== QA Action Buttons ===== */
.qa-actions {
  display: flex; gap: 4px; align-items: flex-start; flex-shrink: 0;
  opacity: 0; transition: opacity 0.2s ease;
  padding-top: 2px;
}
.qa-card:hover .qa-actions { opacity: 1; }
.qa-actions button, .btn-edit, .btn-del {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.btn-edit:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.btn-del:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(239,68,68,0.08);
}

/* ===== Edit Mode ===== */
.edit-area {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface2);
}
.edit-area textarea, .edit-area input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  resize: vertical;
  transition: all 0.2s ease;
}
.edit-area textarea:focus, .edit-area input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
}

/* ===== Add QA Form ===== */
.add-qa {
  margin-top: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
}
.add-qa:focus-within {
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.add-qa h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.add-qa h4::before {
  content: '';
  width: 4px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}
.add-qa textarea, .add-qa input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  resize: vertical;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}
.add-qa textarea:last-of-type, .add-qa input:last-of-type {
  margin-bottom: 0;
}
.add-qa textarea:focus, .add-qa input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg);
}
.add-qa .tags-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 40px;
  align-items: center;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}
.add-qa .tags-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.add-qa .tags-input input {
  flex: 1;
  min-width: 120px;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  outline: none;
  font-size: 13px;
}
.add-qa .tags-input input:focus {
  box-shadow: none;
}

/* ===== QA Card Extras ===== */
.qa-type-wrap {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.qa-tags-row {
  padding-top: 6px !important;
  padding-bottom: 10px !important;
}
.qa-tags {
  display: flex; gap: 6px; flex-wrap: wrap; width: 100%;
}
.qa-tag-pill {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
}
.qa-tag-pill:hover {
  color: var(--accent);
  border-color: rgba(99,102,241,0.3);
  background: var(--accent-glow);
}

/* ===== Buttons ===== */
.btn {
  padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-family: inherit; font-weight: 600;
  transition: all var(--transition); border: none;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
}
.btn-primary:hover { box-shadow: 0 2px 12px rgba(99,102,241,0.3); }
.btn-primary:active { transform: scale(0.97); }
.btn-outline {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); background: var(--accent-glow); color: var(--accent); }
.btn-danger {
  background: rgba(239,68,68,0.1); color: var(--red);
  border: 1px solid rgba(239,68,68,0.15);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { box-shadow: 0 2px 10px rgba(16,185,129,0.3); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay-bg);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); max-width: 560px; width: 90%;
  max-height: 80vh; overflow-y: auto; padding: 24px;
  box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 17px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.modal p { font-size: 13px; color: var(--muted); margin-bottom: 12px; line-height: 1.6; }
.modal textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; color: var(--text);
  font-family: monospace; font-size: 13px; outline: none; resize: vertical;
}
.modal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

.import-file-area {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  padding: 12px; background: var(--surface2); border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.import-file-area input[type="file"] { display: none; }
.import-file-label {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; background: var(--accent); color: #fff;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: opacity 0.2s;
}
.import-file-label:hover { opacity: 0.85; }
.import-file-name { font-size: 12px; color: var(--muted); }
.import-tip { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(8px);
  z-index: 200; background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border); padding: 8px 20px;
  border-radius: var(--radius); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); opacity: 0; transition: all 0.25s ease;
  pointer-events: none; white-space: nowrap; max-width: 80vw;
  overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Tags ===== */
.tags-input {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 5px 8px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.tags-input input {
  flex: 1; min-width: 70px; background: none; border: none; outline: none;
  color: var(--text); font-family: inherit; font-size: 13px; padding: 3px 0;
}
.tag-chip {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--accent-glow); color: var(--accent);
  padding: 1px 7px; border-radius: 4px; font-size: 13px;
}
.tag-chip .tag-del { cursor: pointer; font-size: 13px; opacity: 0.5; transition: opacity var(--transition); }
.tag-chip .tag-del:hover { opacity: 1; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a6a; }

/* ===== Feedback Layout ===== */
.fb-stats {
  display: flex; gap: 12px; padding: 16px 24px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.fb-stat-card {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 14px; text-align: center;
  transition: all 0.25s ease; position: relative; overflow: hidden;
}
.fb-stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--border); border-radius: 3px 3px 0 0; transition: background 0.25s ease;
}
.fb-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.fb-stat-card.total::before { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.fb-stat-card.pending::before { background: linear-gradient(90deg, var(--gold), #fbbf24); }
.fb-stat-card.in-progress::before { background: linear-gradient(90deg, var(--accent), #818cf8); }
.fb-stat-card.resolved::before { background: linear-gradient(90deg, var(--green), #34d399); }
.fb-stat-card.pending { border-color: rgba(245,158,11,0.15); background: linear-gradient(180deg, rgba(245,158,11,0.04) 0%, var(--surface) 100%); }
.fb-stat-card.in-progress { border-color: rgba(99,102,241,0.15); background: linear-gradient(180deg, rgba(99,102,241,0.04) 0%, var(--surface) 100%); }
.fb-stat-card.resolved { border-color: rgba(16,185,129,0.15); background: linear-gradient(180deg, rgba(16,185,129,0.04) 0%, var(--surface) 100%); }
.fb-stat-icon { font-size: 18px; margin-bottom: 4px; opacity: 0.6; display: block; }
.fb-stat-num { display: block; font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -1px; line-height: 1.2; }
.fb-stat-card.pending .fb-stat-num { color: var(--gold); }
.fb-stat-card.in-progress .fb-stat-num { color: var(--accent); }
.fb-stat-card.resolved .fb-stat-num { color: var(--green); }
.fb-stat-label { font-size: 12px; color: var(--muted2); margin-top: 4px; display: block; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

.fb-layout { display: flex; flex: 1; overflow: hidden; }
.fb-list-panel {
  width: 320px; min-width: 320px; overflow-y: auto;
  border-right: 1px solid var(--border); padding: 10px;
  background: rgba(0,0,0,0.02);
}
[data-theme="dark"] .fb-list-panel { background: rgba(0,0,0,0.1); }
.fb-detail-panel { flex: 1; overflow-y: auto; padding: 32px 40px; }

/* ===== Feedback List Items ===== */
.fb-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 6px; cursor: pointer;
  transition: all 0.2s ease; padding: 12px 14px;
  border-left: 3px solid transparent; position: relative;
}
.fb-item:hover { border-color: rgba(99,102,241,0.2); border-left-color: rgba(99,102,241,0.3); transform: translateX(2px); }
.fb-item.active { border-color: var(--accent); border-left-color: var(--accent); background: var(--accent-glow); box-shadow: 0 2px 8px rgba(99,102,241,0.1); }
.fb-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.fb-item-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px; letter-spacing: 0.3px;
}
.fb-item-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.fb-item-badge.pending { background: rgba(245,158,11,0.12); color: var(--gold); }
.fb-item-badge.pending::before { background: var(--gold); box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.fb-item-badge.in-progress { background: rgba(99,102,241,0.12); color: var(--accent); }
.fb-item-badge.in-progress::before { background: var(--accent); box-shadow: 0 0 6px rgba(99,102,241,0.4); animation: fbPulse 2s infinite; }
.fb-item-badge.resolved { background: rgba(16,185,129,0.12); color: var(--green); }
.fb-item-badge.resolved::before { background: var(--green); }
.fb-item-badge.closed { background: rgba(148,163,184,0.12); color: var(--muted); }
.fb-item-badge.closed::before { background: var(--muted); }
@keyframes fbPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.fb-item-time { font-size: 11px; color: var(--muted2); }
.fb-item-text {
  font-size: 13px; color: var(--text2); line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 400;
}
.fb-item-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.fb-item-del {
  font-size: 12px; color: var(--muted2); cursor: pointer; opacity: 0;
  transition: all 0.2s ease; background: none; border: none; font-family: inherit;
  padding: 2px 6px; border-radius: var(--radius-sm);
}
.fb-item:hover .fb-item-del { opacity: 0.5; }
.fb-item-del:hover { opacity: 1 !important; color: var(--red); background: rgba(239,68,68,0.1); }

/* ===== Feedback Detail ===== */
.fb-detail { max-width: 720px; animation: fbDetailIn 0.3s ease-out; }
@keyframes fbDetailIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fb-detail-header {
  display: flex; gap: 16px; font-size: 12px; color: var(--muted2);
  margin-bottom: 20px; flex-wrap: wrap; align-items: center;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.fb-detail-header > div {
  display: flex; align-items: center; gap: 5px;
}
.fb-detail-id {
  font-weight: 600; color: var(--text); background: var(--surface2);
  padding: 3px 10px; border-radius: var(--radius-sm); font-size: 12px;
}
.fb-status-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.fb-status-btn {
  padding: 7px 16px; border-radius: 20px;
  border: 1px solid var(--border); font-size: 12px; font-weight: 600;
  cursor: pointer; background: var(--surface); color: var(--muted);
  font-family: inherit; transition: all 0.2s ease;
  display: inline-flex; align-items: center; gap: 5px;
}
.fb-status-btn:hover { border-color: var(--accent); color: var(--text2); transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.fb-status-btn.active { border-color: transparent; cursor: default; transform: none; }
.fb-status-btn.active.s-pending { background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(245,158,11,0.08)); color: var(--gold); border-color: rgba(245,158,11,0.25); box-shadow: 0 2px 8px rgba(245,158,11,0.1); }
.fb-status-btn.active.s-in-progress { background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(99,102,241,0.08)); color: var(--accent); border-color: rgba(99,102,241,0.25); box-shadow: 0 2px 8px rgba(99,102,241,0.1); }
.fb-status-btn.active.s-resolved { background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(16,185,129,0.08)); color: var(--green); border-color: rgba(16,185,129,0.25); box-shadow: 0 2px 8px rgba(16,185,129,0.1); }
.fb-status-btn.active.s-closed { background: linear-gradient(135deg, rgba(148,163,184,0.15), rgba(148,163,184,0.08)); color: var(--muted); border-color: rgba(148,163,184,0.25); }
.fb-detail-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px;
  transition: box-shadow 0.2s ease;
}
.fb-detail-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.fb-detail-label {
  font-size: 11px; font-weight: 700; color: var(--muted2);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.fb-detail-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.fb-detail-body {
  font-size: 14px; color: var(--text); line-height: 1.8;
  white-space: pre-wrap; word-break: break-word;
}
.fb-detail-url {
  margin-top: 10px; font-size: 12px; color: var(--accent); word-break: break-all;
  display: flex; align-items: center; gap: 5px; padding: 8px 12px;
  background: rgba(99,102,241,0.05); border-radius: var(--radius-sm);
  border: 1px solid rgba(99,102,241,0.1);
}
.fb-note {
  padding: 12px 14px; border-left: 3px solid var(--accent); margin-bottom: 8px;
  background: rgba(99,102,241,0.03); border-radius: 0 var(--radius) var(--radius) 0;
  transition: all 0.2s ease; position: relative;
}
.fb-note:hover { background: rgba(99,102,241,0.06); }
.fb-note-text { font-size: 13px; color: var(--text); line-height: 1.6; }
.fb-note-time { font-size: 11px; color: var(--muted2); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.fb-note-input { display: flex; gap: 8px; margin-top: 12px; }
.fb-note-input textarea {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; color: var(--text);
  font-size: 13px; font-family: inherit; resize: vertical;
  min-height: 40px; outline: none; transition: all 0.2s ease;
}
.fb-note-input textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.fb-note-input button {
  padding: 8px 18px; border-radius: var(--radius); border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; white-space: nowrap; align-self: flex-end;
  transition: all 0.2s ease; box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}
.fb-note-input button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.fb-note-input button:active { transform: translateY(0); }

/* ===== Pending QA ===== */
.pending-page { padding: 28px 36px; }
.pending-stats { display: flex; gap: 8px; margin-bottom: 22px; }
.pending-list { display: flex; flex-direction: column; gap: 6px; max-width: 780px; }
.pending-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border var(--transition);
}
.pending-item:hover { border-color: rgba(99,102,241,0.2); }
.pending-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--row-border);
}
.pending-body { padding: 10px 14px; }
.pending-field {
  font-size: 13px; color: var(--text); line-height: 1.6;
  padding: 2px 0; display: flex; gap: 8px;
}
.pending-label {
  font-size: 13px; font-weight: 700; padding: 1px 6px; border-radius: 3px;
  background: rgba(239,68,68,0.1); color: #f87171;
  flex-shrink: 0; height: fit-content;
}
.pending-field + .pending-field .pending-label { background: rgba(16,185,129,0.1); color: #34d399; }
.pending-actions {
  display: flex; gap: 5px; padding: 8px 14px;
  border-top: 1px solid var(--row-border); align-items: center;
}
.pending-notes {
  padding: 6px 14px 10px; border-top: 1px solid var(--row-border);
}
.pending-notes div { font-size: 13px; color: var(--muted); }
.loading { text-align: center; padding: 40px; color: var(--muted2); font-size: 13px; }

/* ===== Icon Preview ===== */
.icon-preview {
  width: 60px; height: 60px; border-radius: var(--radius);
  border: 2px dashed var(--border); display: flex; align-items: center;
  justify-content: center; overflow: hidden; background: var(--surface);
}
.icon-preview img { max-width: 100%; max-height: 100%; }

/* ===== Settings ===== */
.settings-page { padding: 32px 36px; max-width: 640px; }
.settings-page h2 { font-size: 18px; font-weight: 700; margin-bottom: 3px; }
.settings-desc { font-size: 13px; color: var(--muted2); margin-bottom: 28px; }
.settings-form { display: flex; flex-direction: column; gap: 22px; }
.setting-field label {
  display: block; font-size: 13px; font-weight: 600; color: var(--muted2);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.8px;
}
.setting-field input, .setting-field textarea, .setting-field select {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px; color: var(--text);
  font-family: inherit; font-size: 13px; outline: none;
  transition: border var(--transition);
}
.setting-field input:focus, .setting-field textarea:focus, .setting-field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.setting-hint { display: block; font-size: 13px; color: var(--muted2); margin-top: 3px; }
.settings-icon-row { display: flex; align-items: center; gap: 16px; }
.settings-status { margin-top: 22px; font-size: 13px; }

/* ===== Login Page ===== */
/* ===== Login Page ===== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; background: var(--bg);
  background-image: radial-gradient(circle at 50% 30%, rgba(99,102,241,0.08) 0%, transparent 60%);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px; width: 380px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(99,102,241,0.06);
  animation: loginCardIn 0.4s ease-out;
}
@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-logo {
  width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px;
  box-shadow: 0 8px 24px rgba(99,102,241,0.3);
}
.login-title {
  font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-subtitle { font-size: 13px; color: var(--muted2); text-align: center; margin-bottom: 28px; }
.login-field { margin-bottom: 18px; }
.login-field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.login-field input, .login-field select {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px; color: var(--text);
  font-family: inherit; font-size: 14px; outline: none;
  transition: all 0.2s ease;
}
.login-field input:focus, .login-field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.login-error {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 18px;
  font-size: 12px; color: var(--red); animation: loginShake 0.4s ease-out;
}
@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.login-btn { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }

/* ===== Manage Tables ===== */
.manage-page { padding: 28px 36px; }
.manage-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.manage-header h2 { font-size: 18px; font-weight: 700; }
.manage-table {
  width: 100%; border-collapse: collapse; table-layout: fixed;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.manage-table thead { background: var(--surface2); }
.manage-table th {
  padding: 10px 14px; text-align: left; font-size: 12px;
  font-weight: 600; color: var(--muted2); text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
}
.manage-table td {
  padding: 10px 14px; font-size: 13px; color: var(--text);
  border-bottom: 1px solid var(--row-border);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.manage-table td .um-user-cell { white-space: normal; }
.manage-table td .um-actions { white-space: nowrap; }
.manage-table tbody tr:hover { background: var(--hover-bg2); }
.manage-table tbody tr:last-child td { border-bottom: none; }

/* ===== Sub Tab Bar ===== */
.sub-tab-bar {
  display: flex; gap: 0; padding: 0 28px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
  position: relative;
}
.sub-tab-btn {
  padding: 12px 20px; border: none; background: none; color: var(--muted);
  font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent; transition: all 0.2s ease;
  position: relative;
}
.sub-tab-btn:hover { color: var(--text2); background: var(--hover-bg2); }
.sub-tab-btn.active {
  color: var(--accent); font-weight: 600;
  border-bottom-color: var(--accent);
}
.review-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 600;
  border-radius: 9px; margin-left: 6px;
}

/* ===== Script Type Tags ===== */
.script-type-tag {
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 3px;
  white-space: nowrap; letter-spacing: 0.3px;
}
.type-industry {
  background: rgba(99,102,241,0.12); color: var(--accent);
  border: 1px solid rgba(99,102,241,0.2);
}
.type-enterprise {
  background: rgba(245,158,11,0.12); color: var(--gold);
  border: 1px solid rgba(245,158,11,0.2);
}
.type-personal {
  background: rgba(16,185,129,0.12); color: var(--green);
  border: 1px solid rgba(16,185,129,0.2);
}

/* ===== Personal Script Panel ===== */
#personalScriptPanel .manage-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
#personalScriptPanel .manage-header h2 {
  display: flex; align-items: center; gap: 8px;
}
#personalEntFilter {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px; color: var(--text);
  font-family: inherit; font-size: 13px; outline: none;
  transition: all 0.2s ease;
  min-width: 160px;
}
#personalEntFilter:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ===== User Groups ===== */
.user-group {
  margin-bottom: 20px;
}
.user-group-header {
  font-size: 14px; font-weight: 600; color: var(--text2);
  padding: 10px 14px; margin-bottom: 8px;
  background: var(--surface2); border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.enterprise-group-details {
  margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.enterprise-group-summary {
  padding: 10px 14px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--surface2);
  list-style: none; display: flex; align-items: center; gap: 6px;
  transition: background var(--transition);
}
.enterprise-group-summary:hover { background: rgba(99,102,241,0.08); }
.enterprise-group-summary::before {
  content: '▶'; font-size: 10px; color: var(--muted);
  transition: transform var(--transition);
}
.enterprise-group-details[open] > .enterprise-group-summary::before {
  transform: rotate(90deg);
}
.enterprise-group-details > .manage-table {
  margin: 0; border-radius: 0;
}

/* ===== Employee Script Cards ===== */
.employee-script-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px; padding: 20px;
}
.employee-script-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative; overflow: hidden;
}
.employee-script-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.employee-script-card:hover {
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 4px 16px rgba(99,102,241,0.08);
  transform: translateY(-2px);
}
.employee-script-card:hover::before { opacity: 1; }
.employee-script-card.card-high-overlap {
  border-color: rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.04);
}
.employee-script-card.card-high-overlap::before {
  background: linear-gradient(180deg, var(--gold), #f97316);
}
.card-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.card-user {
  font-weight: 600; font-size: 13px; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.card-user::before {
  content: '';
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: inline-block;
}
.card-time {
  font-size: 11px; color: var(--muted); margin-left: auto;
}
.card-stage {
  font-size: 11px; color: var(--accent); margin-bottom: 10px;
  padding: 3px 10px; background: var(--accent-glow);
  border-radius: 12px; display: inline-block;
  font-weight: 500;
}
.card-q, .card-a {
  font-size: 13px; color: var(--text2); line-height: 1.7;
  margin-bottom: 8px; padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
}
.card-q { border-left-color: var(--red); }
.card-a { border-left-color: var(--green); }
.card-actions {
  display: flex; gap: 8px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
  justify-content: flex-end;
}
.overlap-badge {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  font-weight: 600;
}
.overlap-high {
  background: rgba(245,158,11,0.15); color: var(--gold);
  border: 1px solid rgba(245,158,11,0.3);
}
.employee-script-card.card-deleted {
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.04);
  opacity: 0.85;
}
.employee-script-card.card-deleted::before {
  background: linear-gradient(180deg, var(--red), #dc2626);
}
.employee-script-card.card-deleted:hover {
  border-color: var(--red);
  box-shadow: 0 4px 16px rgba(239,68,68,0.1);
}
.deleted-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  font-weight: 600; background: rgba(239,68,68,0.12);
  color: var(--red); border: 1px solid rgba(239,68,68,0.25);
}
.pending-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  font-weight: 600; background: rgba(245,158,11,0.12);
  color: var(--gold); border: 1px solid rgba(245,158,11,0.25);
}
.employee-script-card.card-pending {
  border-left: 3px solid var(--gold);
}
.review-section-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; font-size: 14px; font-weight: 600;
  color: var(--text); background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

/* ===== L2 Stage List ===== */
.l2-stage-list-container {
  padding: 20px;
}
.l2-stage-list-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.l2-stage-list-header h3 {
  font-size: 16px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.l2-stage-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.l2-stage-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative; overflow: hidden;
}
.l2-stage-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.l2-stage-card:hover {
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 4px 16px rgba(99,102,241,0.1);
  transform: translateY(-2px);
}
.l2-stage-card:hover::before { opacity: 1; }
.l2-stage-card.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.l2-stage-card.active::before { opacity: 1; }
.l2-stage-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.l2-stage-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.l2-stage-count {
  font-size: 11px; color: var(--muted);
  background: var(--surface2); padding: 2px 8px; border-radius: 10px;
  font-weight: 500;
}
.l2-stage-card-body {
  margin-bottom: 12px;
}
.l2-stage-intro {
  font-size: 12px; color: var(--muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.l2-stage-card-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ===== Industry Stage List ===== */
/* ===== Industry Detail Header ===== */
.ind-detail-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(99,102,241,0.03) 0%, transparent 100%);
}
.ind-detail-back-btn {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease; flex-shrink: 0;
}
.ind-detail-back-btn:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-glow);
}
.ind-detail-title-wrap { flex: 1; }
.ind-detail-title-wrap h2 {
  font-size: 18px; font-weight: 700; color: var(--text);
  margin: 0; display: flex; align-items: center; gap: 8px;
}
.ind-detail-title-wrap .ind-detail-subtitle {
  font-size: 12px; color: var(--muted); margin-top: 2px;
}
.ind-detail-actions {
  display: flex; gap: 8px; align-items: center;
}

/* ===== Industry Stage List ===== */
.industry-stage-list-container {
  padding: 20px;
}
.industry-stage-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.industry-stage-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative; overflow: hidden;
}
.industry-stage-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.industry-stage-card:hover {
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 4px 16px rgba(99,102,241,0.1);
  transform: translateY(-2px);
}
.industry-stage-card:hover::before { opacity: 1; }
.industry-stage-card.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.industry-stage-card.active::before { opacity: 1; }
.industry-stage-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.industry-stage-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.industry-stage-count {
  font-size: 11px; color: var(--muted);
  background: var(--surface2); padding: 2px 8px; border-radius: 10px;
  font-weight: 500;
}
.industry-stage-card-body {
  margin-bottom: 12px;
}
.industry-stage-intro {
  font-size: 12px; color: var(--muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.industry-stage-card-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ===== Enterprise Stage List ===== */
.ent-stage-list-container {
  padding: 20px;
}
.ent-stage-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.ent-stage-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative; overflow: hidden;
}
.ent-stage-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.ent-stage-card:hover {
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 4px 16px rgba(99,102,241,0.1);
  transform: translateY(-2px);
}
.ent-stage-card:hover::before { opacity: 1; }
.ent-stage-card.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.ent-stage-card.active::before { opacity: 1; }
.ent-stage-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.ent-stage-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.ent-stage-count {
  font-size: 11px; color: var(--muted);
  background: var(--surface2); padding: 2px 8px; border-radius: 10px;
  font-weight: 500;
}
.ent-stage-card-body {
  margin-bottom: 12px;
}
.ent-stage-intro {
  font-size: 12px; color: var(--muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.ent-stage-card-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ===== Category Scripts ===== */
.category-scripts-layout {
  display: flex; gap: 0; height: calc(100vh - 180px);
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
}
.category-sidebar {
  width: 220px; min-width: 220px;
  background: var(--card-bg); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 12px;
}
.category-content {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  background: var(--bg);
}
.category-list {
  display: flex; flex-direction: column; gap: 6px;
}
.category-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s ease;
  border: 1px solid transparent;
}
.category-item:hover {
  background: var(--hover-bg); border-color: var(--border);
}
.category-item.active {
  background: var(--hover-bg); border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.category-item-icon {
  width: 36px; height: 36px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.category-item-info { flex: 1; min-width: 0; }
.category-item-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 2px;
}
.category-item-count {
  font-size: 11px; color: var(--muted);
}
.category-detail-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.category-detail-icon {
  width: 52px; height: 52px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.category-detail-info h3 {
  font-size: 18px; font-weight: 700; color: var(--text);
  margin: 0 0 4px 0;
}
.category-detail-info p {
  font-size: 13px; color: var(--muted); margin: 0;
}
.category-empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.category-empty p { font-size: 13px; margin: 0; }
.category-script-list {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 24px;
}
.category-script-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  transition: border-color 0.15s;
}
.category-script-card:hover { border-color: var(--accent); }
.category-script-card.readonly { opacity: 0.85; }
.category-script-card.editing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.category-script-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.category-script-index {
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--hover-bg); padding: 2px 8px; border-radius: 4px;
}
.category-script-actions {
  display: flex; gap: 6px;
}
.category-script-q, .category-script-a {
  font-size: 13px; line-height: 1.6; color: var(--text);
  margin-bottom: 6px;
}
.category-script-q:last-child, .category-script-a:last-child { margin-bottom: 0; }
.category-edit-form {
  display: flex; flex-direction: column; gap: 10px;
}
.category-edit-form .form-group { margin: 0; }
.category-edit-form label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  margin-bottom: 4px; display: block;
}
.category-edit-form textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; font-family: inherit;
  background: var(--input-bg); color: var(--text); resize: vertical;
}
.category-edit-form textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}
.category-edit-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  padding-top: 4px;
}
.category-add-section {
  border-top: 1px solid var(--border); padding-top: 20px;
}
.category-add-section h4 {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin: 0 0 14px 0; display: flex; align-items: center; gap: 6px;
}
.category-add-form {
  display: flex; flex-direction: column; gap: 12px;
}
.category-add-form .form-group { margin: 0; }
.category-add-form label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  margin-bottom: 4px; display: block;
}
.category-add-form textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; font-family: inherit;
  background: var(--input-bg); color: var(--text); resize: vertical;
}
.category-add-form textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}

/* ===== Quick Scripts Grid ===== */
.quick-scripts-container {
  padding: 24px;
}
.quick-scripts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.quick-script-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.quick-script-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.quick-script-card:hover {
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 4px 16px rgba(99,102,241,0.1);
  transform: translateY(-2px);
}
.quick-script-card:hover::before { opacity: 1; }
.quick-script-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.quick-script-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.quick-script-title h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.quick-script-title span {
  font-size: 11px;
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 4px;
}
.quick-script-title span::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
}
.quick-script-body {
  padding: 16px 20px;
}
.quick-script-body textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface2);
  color: var(--text);
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
  transition: all 0.2s ease;
}
.quick-script-body textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface);
}
.quick-script-body textarea[readonly] {
  background: var(--surface);
  cursor: not-allowed;
  opacity: 0.75;
}
.quick-script-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

/* ===== User Management Page ===== */
.manage-header-actions {
  display: flex; align-items: center; gap: 12px;
}
.user-search-box {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 12px;
  transition: all 0.2s ease;
}
.user-search-box:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.user-search-box input {
  background: none; border: none; outline: none; color: var(--text);
  font-size: 13px; font-family: inherit; width: 180px;
}
.user-search-box input::placeholder { color: var(--muted2); }

.user-ent-filter {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 12px;
  color: var(--text); font-size: 13px; font-family: inherit;
  outline: none; cursor: pointer; transition: all 0.2s ease;
  min-width: 140px;
}
.user-ent-filter:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}

.um-group-add-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ===== User Modal ===== */
.user-modal {
  max-width: 480px; padding: 0; overflow: hidden;
  animation: aiFadeScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.user-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(99,102,241,0.04) 0%, transparent 100%);
}
.user-modal-header h3 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 0; display: flex; align-items: center; gap: 8px;
}
.user-modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.user-modal-close:hover { background: var(--surface2); color: var(--text); }
.user-modal-body { padding: 20px 24px; max-height: 60vh; overflow-y: auto; }
.user-modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px; border-top: 1px solid var(--border);
  background: var(--surface2);
}

.um-field { margin-bottom: 18px; }
.um-field:last-child { margin-bottom: 0; }
.um-field > label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--muted2);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;
}
.um-hint {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--muted); font-size: 11px;
}
.um-field input, .um-field select {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px; color: var(--text);
  font-family: inherit; font-size: 14px; outline: none;
  transition: all 0.2s ease;
}
.um-field input:focus, .um-field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.um-field input:disabled {
  opacity: 0.5; cursor: not-allowed;
}

.um-pwd-wrap {
  position: relative; display: flex; align-items: center;
}
.um-pwd-wrap input { padding-right: 42px; }
.um-pwd-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.um-pwd-toggle:hover { background: var(--hover-bg2); color: var(--text); }

/* ===== Role Cards ===== */
.um-role-cards {
  display: flex; flex-direction: column; gap: 10px;
}
.um-role-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--surface2);
  cursor: pointer; transition: all 0.2s ease;
  position: relative;
}
.um-role-card:hover {
  border-color: rgba(99,102,241,0.3);
  background: rgba(99,102,241,0.04);
}
.um-role-card.selected {
  border-color: var(--accent);
  background: rgba(99,102,241,0.06);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.um-role-card.selected .um-role-check {
  opacity: 1; transform: scale(1);
}
.um-role-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.role-icon-l2 {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15));
  color: var(--accent);
}
.role-icon-l3 {
  background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(52,211,153,0.15));
  color: var(--green);
}
.um-role-info {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.um-role-name {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.um-role-desc {
  font-size: 11px; color: var(--muted);
}
.um-role-check {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(0.5);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== User Table Improvements ===== */
.um-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.5px;
}
.um-avatar-l1 { background: linear-gradient(135deg, #f59e0b, #f97316); }
.um-avatar-l2 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.um-avatar-l3 { background: linear-gradient(135deg, #10b981, #34d399); }

.um-user-cell {
  display: flex; align-items: center; gap: 10px;
}
.um-user-info {
  display: flex; flex-direction: column; gap: 1px;
}
.um-user-name {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.um-user-nickname {
  font-size: 11px; color: var(--muted);
}

.um-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.um-status-active {
  background: rgba(16,185,129,0.1); color: var(--green);
}
.um-status-disabled {
  background: rgba(239,68,68,0.1); color: var(--red);
}
.um-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
}
.um-status-active::before { background: var(--green); }
.um-status-disabled::before { background: var(--red); }

.um-expiry {
  font-size: 12px; color: var(--text2);
}
.um-expiry-forever {
  color: var(--green); font-weight: 500;
}
.um-expiry-soon {
  color: var(--gold); font-weight: 500;
}

.um-actions {
  display: flex; gap: 6px; align-items: center;
}
.um-action-toggle {
  background: rgba(245,158,11,0.08) !important;
  color: var(--gold) !important;
  border-color: rgba(245,158,11,0.2) !important;
}
.um-action-toggle:hover {
  background: rgba(245,158,11,0.15) !important;
}
.um-action-enable {
  background: rgba(16,185,129,0.08) !important;
  color: var(--green) !important;
  border-color: rgba(16,185,129,0.2) !important;
}
.um-action-enable:hover {
  background: rgba(16,185,129,0.15) !important;
}

.um-table-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; margin-bottom: 10px;
  background: var(--surface2); border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.um-table-header .um-group-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.um-table-header .um-group-icon.icon-admin {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(249,115,22,0.15));
  color: var(--gold);
}
.um-table-header .um-group-icon.icon-team {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15));
  color: var(--accent);
}
.um-table-header .um-group-title {
  font-size: 14px; font-weight: 600; color: var(--text);
}
.um-table-header .um-group-count {
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--hover-bg2); padding: 2px 8px; border-radius: 10px;
  margin-left: auto;
}

.enterprise-group-summary {
  padding: 12px 16px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--surface2);
  list-style: none; display: flex; align-items: center; gap: 8px;
  transition: all 0.2s ease;
}
.enterprise-group-summary:hover { background: rgba(99,102,241,0.06); }
.enterprise-group-summary::before {
  content: ''; width: 0; height: 0;
  border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform 0.2s ease;
}
.enterprise-group-details[open] > .enterprise-group-summary::before {
  transform: rotate(90deg);
}
.enterprise-group-summary .ent-count {
  font-size: 11px; font-weight: 500; color: var(--muted);
  margin-left: auto;
}

.um-empty-state {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.um-empty-state .um-empty-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--surface2); margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted2);
}
.um-empty-state p { font-size: 13px; margin: 0; }

/* ===== Unified Card Grid (Industry + Enterprise) ===== */
.ind-card-grid,
.ent-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.ind-card,
.ent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.ind-card:hover,
.ent-card:hover {
  border-color: rgba(99,102,241,0.25);
  box-shadow: 0 6px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(99,102,241,0.06);
  transform: translateY(-2px);
}

.card-top-bar {
  height: 3px;
  flex-shrink: 0;
}
.ind-card .card-top-bar { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.ent-card .card-top-bar { background: linear-gradient(90deg, var(--gold), #f97316); }

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 0;
}
.card-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; font-weight: 700;
  flex-shrink: 0;
}
.ind-card .card-avatar { background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 2px 8px rgba(99,102,241,0.2); }
.ent-card .card-avatar { background: linear-gradient(135deg, var(--gold), #f97316); box-shadow: 0 2px 8px rgba(245,158,11,0.2); }

.card-head-info { flex: 1; min-width: 0; }
.card-head-info h4 {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.card-head-meta {
  font-size: 11px; color: var(--muted);
  margin-top: 3px;
  display: flex; align-items: center; gap: 6px;
}

.card-head-actions {
  display: flex; gap: 4px; flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.ind-card:hover .card-head-actions,
.ent-card:hover .card-head-actions { opacity: 1; }
.card-action-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.card-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.card-action-btn.card-action-danger:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(239,68,68,0.08);
}

.card-body {
  padding: 12px 18px 0;
  flex: 1;
}
.card-body-text {
  font-size: 12px; color: var(--muted);
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}

.card-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 18px 0;
}
.card-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 500;
  border: 1px solid;
}
.card-tag-accent {
  background: rgba(99,102,241,0.06); color: var(--accent);
  border-color: rgba(99,102,241,0.12);
}
.card-tag-gold {
  background: rgba(245,158,11,0.06); color: var(--gold);
  border-color: rgba(245,158,11,0.12);
}
.card-tag-green {
  background: rgba(16,185,129,0.06); color: var(--green);
  border-color: rgba(16,185,129,0.12);
}
.card-tag-red {
  background: rgba(239,68,68,0.06); color: var(--red);
  border-color: rgba(239,68,68,0.12);
}

.card-stats {
  display: flex;
  margin: 14px 18px 0;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.card-stat {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  position: relative;
}
.card-stat:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0; top: 15%; bottom: 15%;
  width: 1px;
  background: var(--border);
}
.card-stat-num {
  font-size: 17px; font-weight: 700; color: var(--text);
}
.ind-card .card-stat-num { color: var(--accent); }
.ent-card .card-stat-num { color: var(--gold); }
.card-stat-label {
  font-size: 10px; color: var(--muted);
  letter-spacing: 0.3px;
}

.card-footer {
  display: flex; align-items: center;
  padding: 10px 18px;
  margin-top: auto;
}
.card-footer-date {
  font-size: 11px; color: var(--muted2);
  display: flex; align-items: center; gap: 4px;
}
.card-footer-enter {
  margin-left: auto;
  font-size: 11px; font-weight: 500;
  display: flex; align-items: center; gap: 3px;
  opacity: 0; transform: translateX(-6px);
  transition: all 0.25s ease;
}
.ind-card .card-footer-enter { color: var(--accent); }
.ent-card .card-footer-enter { color: var(--gold); }
.ind-card:hover .card-footer-enter,
.ent-card:hover .card-footer-enter {
  opacity: 1; transform: translateX(0);
}

.card-ai-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 18px 0;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius);
  gap: 8px;
}
.card-ai-row span {
  font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 4px;
}
.card-ai-row .toggle-switch { width: 34px; height: 18px; }
.card-ai-row .toggle-slider::before { height: 12px; width: 12px; }
.card-ai-row .toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

.ent-empty-state,
.ind-empty-state {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.ent-empty-icon,
.ind-empty-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--surface2); margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted2);
}
.ent-empty-state p,
.ind-empty-state p {
  font-size: 15px; font-weight: 600; color: var(--text2);
  margin: 0 0 4px 0;
}
.ent-empty-state span,
.ind-empty-state span { font-size: 13px; }

/* ===== Enterprise Modal ===== */
.enterprise-modal {
  max-width: 420px; padding: 0; overflow: hidden;
  animation: aiFadeScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.enterprise-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(245,158,11,0.04) 0%, transparent 100%);
}
.enterprise-modal-header h3 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 0; display: flex; align-items: center; gap: 8px;
}
.enterprise-modal-body { padding: 20px 24px; }

/* ===== Enterprise Detail Page ===== */
.ent-detail-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(245,158,11,0.03) 0%, transparent 100%);
}
.ent-detail-back-btn {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease; flex-shrink: 0;
}
.ent-detail-back-btn:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-glow);
}
.ent-detail-title-wrap { flex: 1; }
.ent-detail-title-wrap h2 {
  font-size: 18px; font-weight: 700; color: var(--text);
  margin: 0; display: flex; align-items: center; gap: 8px;
}
.ent-detail-title-wrap .ent-detail-subtitle {
  font-size: 12px; color: var(--muted); margin-top: 2px;
}
.ent-detail-actions {
  display: flex; gap: 8px; align-items: center;
}

/* ===== Stage Modal ===== */
.stage-modal {
  max-width: 420px; padding: 0; overflow: hidden;
  animation: aiFadeScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.stage-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(245,158,11,0.04) 0%, transparent 100%);
}
.stage-modal-header h3 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 0; display: flex; align-items: center; gap: 8px;
}
.stage-modal-body { padding: 20px 24px; }

/* ===== Industry Modal ===== */
.industry-modal {
  max-width: 420px; padding: 0; overflow: hidden;
  animation: aiFadeScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.industry-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(245,158,11,0.04) 0%, transparent 100%);
}
.industry-modal-header h3 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 0; display: flex; align-items: center; gap: 8px;
}
.industry-modal-body { padding: 20px 24px; }

@keyframes aiFadeScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes aiFadeScaleOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  #sidebar { width: 220px; }
  .logo-text h1 { font-size: 13px; }
  .sidebar-footer-btn .footer-label { display: none; }
  .stage-detail { padding: 16px; }
  .fb-list-panel { width: 240px; min-width: 240px; }
  .l2-stage-list, .industry-stage-list, .ent-stage-list {
    grid-template-columns: 1fr;
  }
  .ind-card-grid,
  .ent-card-grid {
    grid-template-columns: 1fr;
  }
  .card-head-actions {
    opacity: 1;
  }
  .card-footer-enter {
    opacity: 1;
    transform: translateX(0);
  }
  .ent-detail-header {
    padding: 16px 20px;
  }
  .ind-detail-header {
    padding: 16px 20px;
  }
  .manage-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .manage-header-actions { justify-content: space-between; }
  .user-search-box input { width: 120px; }
}

/* ====== AI Models Page ====== */

.nav-ai-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--accent) !important;
  font-size: 10px !important;
}
.nav-ai-btn {
  padding-left: 20px !important;
  font-size: 13px !important;
}
.nav-ai-btn .nav-icon {
  opacity: 0.7;
}
.nav-ai-btn.active .nav-icon {
  opacity: 1;
}

.ai-page { padding: 28px 36px; max-width: 1400px; }
.ai-page-header { margin-bottom: 28px; }
.ai-page-header h2 {
  font-size: 22px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 10px;
  margin: 0;
}
.ai-page-header h2 .ic {
  color: var(--accent);
}
.ai-page-desc { font-size: 13px; color: var(--muted); margin-top: 6px; }

.ai-active-section { margin-bottom: 32px; }
.ai-active-section h3 {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
}
.ai-active-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ai-active-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  position: relative; overflow: hidden;
}
.ai-active-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.ai-active-label {
  font-size: 11px; color: var(--muted2); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 6px;
}
.ai-active-value { font-size: 16px; font-weight: 600; color: var(--text); }
.ai-active-status { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ai-active-action { margin-top: 10px; }

.ai-providers-section { margin-bottom: 28px; }
.ai-providers-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.ai-providers-header h3 {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.ai-providers-list { display: flex; flex-direction: column; gap: 10px; }
.ai-provider-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  transition: all 0.2s ease;
}
.ai-provider-card:hover {
  border-color: rgba(99,102,241,0.25);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.ai-provider-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.ai-provider-info { flex: 1; min-width: 0; }
.ai-provider-name {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.ai-provider-badge {
  font-size: 10px; padding: 2px 6px; border-radius: var(--radius-sm); font-weight: 500;
}
.ai-provider-badge.active-llm {
  background: rgba(16,185,129,0.12); color: var(--green);
  border: 1px solid rgba(16,185,129,0.2);
}
.ai-provider-badge.active-embed {
  background: var(--accent-glow); color: var(--accent);
  border: 1px solid rgba(99,102,241,0.2);
}
.ai-provider-models { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ai-provider-status {
  font-size: 11px; margin-top: 4px;
  display: flex; align-items: center; gap: 4px;
}
.ai-provider-status.status-ok { color: var(--green); }
.ai-provider-status.status-error { color: var(--red); }
.ai-provider-status.status-unknown { color: var(--muted); }
.ai-provider-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ai-provider-actions .btn { padding: 6px 10px; font-size: 12px; }

.ai-presets-section { margin-bottom: 28px; }
.ai-presets-section h3 {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
}
.ai-presets-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.ai-preset-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; text-align: center;
  cursor: pointer; transition: all 0.2s ease;
}
.ai-preset-card:hover {
  border-color: rgba(99,102,241,0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.ai-preset-icon {
  width: 36px; height: 36px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff; margin: 0 auto 8px;
}
.ai-preset-name { font-size: 13px; font-weight: 500; color: var(--text); }

.ai-usage-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 24px;
}
.ai-stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; align-items: center; gap: 12px;
}
.ai-stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.ai-stat-value { font-size: 20px; font-weight: 700; color: var(--text); }
.ai-stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.ai-usage-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}
.ai-usage-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 16px;
}
.ai-usage-card-full { grid-column: 1 / -1; }
.ai-usage-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.ai-usage-card-header h3 {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin: 0; display: flex; align-items: center; gap: 6px;
}
.ai-usage-filters {
  display: flex; gap: 8px;
}
.ai-usage-filters select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 12px; color: var(--text); background: var(--surface);
  font-family: inherit; outline: none; cursor: pointer;
}
.ai-usage-filters select:focus { border-color: var(--accent); }

.ai-usage-table table { width: 100%; border-collapse: collapse; }
.ai-usage-table th {
  text-align: left; padding: 10px 16px; font-size: 11px; font-weight: 600;
  color: var(--muted2); text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--surface2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.ai-usage-table td {
  padding: 10px 16px; font-size: 13px; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.ai-usage-table tr:last-child td { border-bottom: none; }
.ai-usage-table tr:hover td { background: var(--hover-bg); }
.ai-usage-table th:nth-child(n+2),
.ai-usage-table td:nth-child(n+2) { text-align: right; }
.ai-usage-table th:first-child,
.ai-usage-table td:first-child { text-align: left; }
.ai-usage-table .col-center { text-align: center !important; }
.ai-usage-empty {
  padding: 32px; text-align: center; color: var(--muted); font-size: 13px;
}

.ai-settings-form { max-width: 560px; }
.ai-setting-field { margin-bottom: 20px; }
.ai-setting-field label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--muted2);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;
}
.ai-setting-field input,
.ai-setting-field select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px;
  color: var(--text); background: var(--surface2);
  font-family: inherit; outline: none; transition: all 0.2s ease;
}
.ai-setting-field input:focus,
.ai-setting-field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.ai-setting-hint {
  font-size: 11px; color: var(--muted); margin-top: 4px; display: block;
  text-transform: none; letter-spacing: 0; font-weight: 400;
}

.ai-setting-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.ai-setting-label-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.ai-setting-tooltip {
  position: relative;
  display: inline-flex;
  cursor: help;
  color: var(--muted);
  transition: color 0.15s;
}

.ai-setting-tooltip:hover {
  color: var(--accent);
}

.ai-setting-tooltip .tooltip-content {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 280px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  font-weight: 400;
  color: var(--text2);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.6;
  z-index: 1000;
  transition: opacity 0.15s, visibility 0.15s;
  pointer-events: none;
  white-space: pre-line;
}

.ai-setting-tooltip:hover .tooltip-content {
  visibility: visible;
  opacity: 1;
}

.ai-setting-tooltip .tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
}

.ai-setting-impact {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(99, 102, 241, 0.04);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent);
}

.ai-setting-impact.impact-high {
  background: rgba(239, 68, 68, 0.06);
  border-left-color: var(--red);
  color: var(--red);
}

.ai-setting-impact.impact-medium {
  background: rgba(245, 158, 11, 0.06);
  border-left-color: var(--gold);
  color: var(--gold);
}

.ai-setting-impact.impact-low {
  background: rgba(16, 185, 129, 0.06);
  border-left-color: var(--green);
  color: var(--green);
}

.ai-settings-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

.provider-modal {
  max-width: 520px; padding: 0; overflow: hidden;
  animation: aiFadeScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.provider-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(99,102,241,0.04) 0%, transparent 100%);
}
.provider-modal-header h3 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 0; display: flex; align-items: center; gap: 8px;
}
.provider-modal-body { padding: 20px 24px; max-height: 60vh; overflow-y: auto; }
.ai-model-row { display: flex; gap: 8px; }
.ai-model-row input { flex: 1; }
.provider-modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px; border-top: 1px solid var(--border);
  background: var(--surface2);
}

.ai-type-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-type-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: all 0.2s ease; font-size: 13px; color: var(--text);
}
.ai-type-card:hover { border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.04); }
.ai-type-card.selected {
  border-color: var(--accent); background: rgba(99,102,241,0.1);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.ai-type-icon {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.ai-key-row { display: flex; gap: 6px; }
.ai-key-row input { flex: 1; }

.toggle-switch {
  position: relative; display: inline-block;
  width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--surface3); border-radius: 24px;
  transition: 0.25s ease;
}
.toggle-slider::before {
  content: ''; position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--green);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}
.ai-toggle-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--surface2);
  border-radius: var(--radius); margin-top: 4px;
}
.ai-toggle-label {
  font-size: 13px; color: var(--text2);
}
.ent-ai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; text-transform: uppercase;
}
.ent-ai-badge.ai-on {
  background: rgba(34,197,94,0.12); color: var(--green);
}
.ent-ai-badge.ai-off {
  background: rgba(239,68,68,0.1); color: var(--red);
}

.usage-deleted-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(156,163,175,0.15);
  color: var(--muted);
  vertical-align: middle;
  opacity: 0.8;
}

.usage-del-btn {
  padding: 3px 10px;
  font-size: 11px;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  background: rgba(239,68,68,0.08);
  color: var(--red);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.usage-del-btn:hover {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.5);
}


.ai-usage-filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}
.ai-usage-filter-bar h3 { margin: 0; }
.ai-usage-filters {
  display: flex; gap: 8px; align-items: center;
}
.ai-usage-filters select {
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  background: var(--surface); color: var(--text);
  min-width: 140px;
}

@media (max-width: 768px) {
  .ai-active-cards { grid-template-columns: 1fr; }
  .ai-usage-stats { grid-template-columns: repeat(2, 1fr); }
  .ai-presets-grid { grid-template-columns: repeat(2, 1fr); }
}

.usage-detail-btn {
  padding: 3px 10px;
  font-size: 11px;
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-sm);
  background: rgba(99,102,241,0.08);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.usage-detail-btn:hover {
  background: rgba(99,102,241,0.18);
  border-color: rgba(99,102,241,0.5);
}

.log-detail-modal {
  max-width: 680px;
  width: 95%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.log-detail-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.log-detail-modal-head h3 {
  margin: 0;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.log-detail-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.log-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.log-detail-field {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.log-detail-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}
.log-detail-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.log-detail-intent {
  color: var(--accent) !important;
  font-weight: 600;
}

.log-detail-section {
  margin-bottom: 16px;
}
.log-detail-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.log-detail-message {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  border-left: 3px solid var(--accent);
}
.log-detail-history {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  max-height: 160px;
  overflow-y: auto;
}
.log-detail-hist-item {
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
}
.log-detail-hist-item:last-child { border-bottom: none; }
.hist-in { color: var(--text); }
.hist-out { color: var(--muted); font-style: italic; }
.hist-in::before { content: '客户: '; font-weight: 600; color: var(--accent); }
.hist-out::before { content: '销售: '; font-weight: 600; color: var(--muted); }

.log-detail-result-item {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 8px;
}
.log-detail-result-item:last-child { margin-bottom: 0; }
.log-detail-result-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.log-detail-result-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.log-detail-result-type {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(99,102,241,0.1);
  color: var(--accent);
}
.log-detail-result-score {
  font-size: 13px;
  font-weight: 700;
}
.log-detail-result-stage {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}
.log-detail-result-q {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.5;
}
.log-detail-result-a {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  line-height: 1.5;
}
.log-detail-result-reason {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.log-detail-collapse {
  margin-bottom: 12px;
}
.log-detail-collapse summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
}
.log-detail-collapse summary:hover { color: var(--accent); }
.log-detail-pre {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 4px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.log-detail-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 0;
  text-align: center;
}

.log-source-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}

.log-detail-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.log-detail-source-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
}

.log-detail-vector-score {
  font-size: 12px;
  color: var(--muted);
}

.log-detail-vector-score strong {
  color: var(--text);
  font-weight: 600;
}

.log-token-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-light);
  border-radius: 8px;
}

.log-token-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.log-token-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.log-token-label {
  color: var(--muted);
  min-width: 90px;
}

.log-token-value {
  font-weight: 500;
  color: var(--text);
}

.log-token-zero {
  color: var(--green);
  font-weight: 600;
}
