:root {
  --blue: #2563eb;
  --indigo: #4338ca;
  --teal: #0f766e;
  --purple: #7c3aed;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --soft: #f8fafc;
  --line: #e5e7eb;
  --line-soft: #f1f5f9;
  --radius: 16px;
  --shadow: 0 8px 28px rgba(15, 23, 42, .06);
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px; letter-spacing: .2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.text-warn { color: var(--amber); }
.right { text-align: right; }
.block-muted { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 256px; z-index: 80;
  display: flex; flex-direction: column;
  background: radial-gradient(circle at 20% 0%, #1e3a8a 0, #0f172a 46%, #0b1220 100%);
  color: #e2e8f0; padding: 22px 16px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4f46e5, #2563eb 60%, #0891b2); color: #fff; font-size: 20px; font-weight: 800;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .38); flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 20px; letter-spacing: 1px; }
.brand-text small { font-size: 10px; color: #94a3b8; letter-spacing: 1.6px; margin-top: 4px; text-transform: uppercase; }
.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 11px;
  color: #cbd5e1; font-size: 14px; transition: .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-item.active { background: linear-gradient(90deg, rgba(37,99,235,.9), rgba(79,70,229,.8)); color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,.25); }
.nav-icon { width: 22px; text-align: center; font-size: 16px; opacity: .85; }
.sidebar-foot { margin-top: auto; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; gap: 10px; align-items: center; padding: 4px 6px 10px; }
.sidebar-user strong { display: block; font-size: 13px; color: #fff; }
.sidebar-user small { display: block; font-size: 11px; color: #94a3b8; }
.sidebar-version { font-size: 10px; color: #64748b; padding-left: 8px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; flex-shrink: 0; letter-spacing: .5px;
}
.avatar-sm { width: 34px; height: 34px; font-size: 13px; }
.avatar-xl { width: 76px; height: 76px; font-size: 28px; border-radius: 24px; }
.main { margin-left: 256px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px;
  padding: 14px 28px; background: rgba(255,255,255,.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-heading { flex: 1; min-width: 0; }
.topbar-kicker { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; }
.topbar-heading h1 { font-size: 19px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user-meta { display: flex; flex-direction: column; line-height: 1.3; }
.topbar-user-meta strong { font-size: 13px; }
.topbar-user-meta small { font-size: 11px; color: var(--muted); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 20px; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--line-soft); }
.menu-toggle { display: none; }
.content { padding: 24px 28px 56px; max-width: 1480px; width: 100%; margin: 0 auto; }
.flash {
  margin: 16px 28px 0; padding: 12px 18px; border-radius: 12px;
  background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; font-weight: 600;
}
.drawer-mask { display: none; }
.inline-form { display: inline; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 17px;
  font-size: 13px; font-weight: 600; line-height: 1.4; transition: .15s ease; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 14px rgba(37,99,235,.2); }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: #fff; color: #374151; border-color: var(--line); }
.btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-light { background: rgba(255,255,255,.95); color: var(--indigo); }
.btn-ai { background: linear-gradient(90deg, #4f46e5, #2563eb); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.25); }
.btn-success { background: var(--green); color: #fff; }
.btn-warn { background: #fff7ed; color: #b45309; border-color: #fed7aa; }
.btn-soft { background: #f1f5f9; color: #334155; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.form .btn-block, .auth-card .btn-block { min-height: 40px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Panels / layout ---------- */
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid rgba(226,232,240,.7); padding: 22px 24px; margin-bottom: 18px; }
.panel-soft { background: linear-gradient(180deg, #fff, #f8fafc); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h3 { font-size: 15px; font-weight: 700; }
.panel-head a { font-size: 12px; font-weight: 600; }
.panel-note { font-size: 12px; color: var(--muted); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.page-head h2 { font-size: 25px; font-weight: 800; letter-spacing: -.4px; }
.page-head p { color: var(--muted); margin-top: 5px; font-size: 13px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.split-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 0; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.quick-card {
  display: flex; align-items: center; gap: 13px; background: #fff; border-radius: 14px; padding: 17px 18px;
  border: 1px solid rgba(226,232,240,.8); box-shadow: var(--shadow-sm); color: var(--text);
}
.quick-card:hover { text-decoration: none; border-color: #bfdbfe; transform: translateY(-1px); }
.quick-card strong { display: block; font-size: 14px; }
.quick-card small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.quick-icon { width: 44px; height: 44px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.q-blue { background: #eff6ff; color: var(--blue); }
.q-teal { background: #ccfbf1; color: var(--teal); }
.q-purple { background: #f3e8ff; color: var(--purple); }
.q-green { background: #d1fae5; color: var(--green); }

/* ---------- Hero ---------- */
.hero-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  border-radius: 20px; padding: 28px 30px; color: #fff; margin-bottom: 20px; position: relative; overflow: hidden;
  box-shadow: 0 16px 34px rgba(37,99,235,.18);
}
.hero-panel::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -90px; top: -140px; background: rgba(255,255,255,.1); }
.hero-staff { background: linear-gradient(125deg, #0f766e, #0891b2 52%, #2563eb); }
.hero-customer { background: linear-gradient(125deg, #1d4ed8, #2563eb 58%, #7c3aed); }
.hero-admin { background: linear-gradient(125deg, #111827, #1e3a8a 55%, #4338ca); }
.hero-kicker { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; opacity: .78; }
.hero-panel h2 { font-size: 26px; font-weight: 800; margin-top: 8px; letter-spacing: -.4px; }
.hero-panel p { margin-top: 6px; color: rgba(255,255,255,.78); font-size: 13px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-actions .btn { padding: 10px 18px; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card {
  display: flex; flex-direction: column; gap: 3px; background: #fff; border-radius: 15px;
  padding: 18px 20px; border: 1px solid rgba(226,232,240,.8); box-shadow: var(--shadow-sm); color: var(--text);
}
a.stat-card:hover { text-decoration: none; border-color: #bfdbfe; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-card strong { font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1.25; }
.stat-card small { color: #94a3b8; font-size: 11px; }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 13px; }
.alert a { font-weight: 700; white-space: nowrap; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

/* ---------- Ticket cards ---------- */
.ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ticket-card {
  display: block; background: #fff; border: 1px solid var(--line-soft); border-radius: 13px;
  padding: 15px 17px; color: var(--text); transition: .15s ease;
}
.ticket-card:hover { text-decoration: none; border-color: #bfdbfe; box-shadow: 0 6px 18px rgba(37,99,235,.08); transform: translateY(-1px); }
.ticket-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ticket-title { font-size: 14px; font-weight: 700; line-height: 1.45; }
.ticket-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.ticket-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line-soft); font-size: 11px; color: #94a3b8; }
.meta-project { color: var(--teal); background: #f0fdfa; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 600; }
.meta-muted { color: #94a3b8; font-size: 11px; }
.ai-chip { display: inline-flex; align-items: center; gap: 3px; background: #ede9fe; color: #5b21b6; border-radius: 6px; padding: 1px 7px; font-size: 10px; font-weight: 700; white-space: nowrap; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; border-radius: 7px; padding: 2px 9px; font-size: 10px; font-weight: 700; white-space: nowrap; line-height: 1.55; }
.badge-pending { background: #fef3c7; color: #b45309; }
.badge-processing { background: #dbeafe; color: #1d4ed8; }
.badge-confirming { background: #ede9fe; color: #6d28d9; }
.badge-done { background: #d1fae5; color: #047857; }
.badge-closed { background: #f3f4f6; color: #4b5563; }
.badge-muted { background: #f3f4f6; color: #6b7280; }
.prio-P1 { background: #fee2e2; color: #b91c1c; }
.prio-P2 { background: #ffedd5; color: #c2410c; }
.prio-P3 { background: #e0f2fe; color: #0369a1; }
.prio-P4 { background: #f3f4f6; color: #4b5563; }
.type-bug { background: #fee2e2; color: #b91c1c; }
.type-requirement { background: #f3e8ff; color: #6d28d9; }
.type-consult { background: #cffafe; color: #0e7490; }
.type-other { background: #f3f4f6; color: #4b5563; }
.project-active { background: #dbeafe; color: #1d4ed8; }
.project-paused { background: #fef3c7; color: #b45309; }
.project-done { background: #d1fae5; color: #047857; }
.role-pill { display: inline-flex; align-items: center; border-radius: 20px; padding: 4px 11px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.role-pill-admin { background: #111827; color: #fff; }
.role-pill-staff { background: #e0f2fe; color: #0369a1; }
.role-pill-customer { background: #f3e8ff; color: #6d28d9; }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.project-grid-page { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.project-grid-compact { grid-template-columns: 1fr; }
.project-card {
  display: block; padding: 18px 19px; background: #fff; border: 1px solid var(--line-soft);
  border-radius: 14px; color: var(--text); box-shadow: var(--shadow-sm); transition: .15s ease;
}
.project-card:hover { text-decoration: none; border-color: #99f6e4; transform: translateY(-1px); }
.project-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.project-name { font-size: 15px; font-weight: 750; line-height: 1.4; }
.project-code { font-family: monospace; font-size: 10px; color: #94a3b8; margin-top: 3px; letter-spacing: .4px; }
.project-meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 11px; color: var(--muted); }
.project-progress { margin-top: 15px; }
.progress-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.progress-track { height: 7px; border-radius: 4px; background: #eef2f7; overflow: hidden; margin-top: 7px; }
.progress-track span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #0f766e, #14b8a6); }
.project-card-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 13px; font-size: 11px; color: #94a3b8; }
.enterprise-brief { display: flex; align-items: center; gap: 13px; padding: 12px; border-radius: 12px; background: #f8fafc; margin-bottom: 12px; }
.enterprise-logo { width: 46px; height: 46px; border-radius: 14px; background: #eff6ff; color: var(--blue); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; }
.enterprise-brief strong { display: block; font-size: 14px; }
.enterprise-brief small { display: block; font-size: 11px; color: var(--muted); }
.kv-list { display: flex; flex-direction: column; }
.kv-list > div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.kv-list > div:last-child { border-bottom: 0; }
.kv-list span { color: var(--muted); }
.kv-list strong { font-weight: 600; text-align: right; }

/* ---------- Empty / tables ---------- */
.empty { text-align: center; padding: 38px 18px; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%; background: #f1f5f9; color: #94a3b8; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.empty h3 { font-size: 15px; }
.empty p { font-size: 12px; color: var(--muted); margin-top: 5px; }
.empty .btn { margin-top: 14px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { text-align: left; color: #94a3b8; font-weight: 600; font-size: 11px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #fbfdff; }
.table-empty { text-align: center; color: var(--muted); padding: 30px 0 !important; }
.table-actions { display: flex; gap: 7px; justify-content: flex-end; align-items: center; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mini-stats > div { background: #f8fafc; border-radius: 11px; padding: 13px; display: flex; flex-direction: column; }
.mini-stats strong { font-size: 22px; font-weight: 800; }
.mini-stats span { font-size: 11px; color: var(--muted); }
.mini-stats-col { grid-template-columns: 1fr 1fr; }

/* ---------- Filters / list ---------- */
.filter-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; background: #fff; border-radius: 14px; padding: 14px 16px; border: 1px solid var(--line-soft); box-shadow: var(--shadow-sm); margin-bottom: 15px; }
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.filter-field > span { font-size: 10px; color: #94a3b8; font-weight: 700; letter-spacing: .5px; }
.filter-field select, .filter-field input { height: 38px; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 0 11px; font-size: 12px; color: var(--text); }
.filter-grow { flex: 1; min-width: 200px; }
.filter-actions { display: flex; gap: 8px; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 12px; font-size: 12px; color: var(--muted); }
.list-head strong { color: var(--text); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-narrow { max-width: 900px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.form-main, .form-side { min-width: 0; }
.form-submit-bar {
  grid-column: 1 / -1; position: sticky; bottom: 0; z-index: 20; display: flex; justify-content: flex-end; gap: 10px;
  background: rgba(244,247,251,.92); backdrop-filter: blur(8px); padding: 12px 0; border-top: 1px solid var(--line);
}
.form-submit-static { position: static; background: transparent; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 650; color: #374151; }
.field > span em { font-style: normal; color: #94a3b8; font-weight: 400; }
.field input, .field select, .field textarea, .form > textarea, .panel textarea, .panel input, .panel select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; padding: 10px 12px;
  font-size: 13px; color: var(--text); outline: none; transition: .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus, .panel textarea:focus, .panel input:focus, .panel select:focus {
  border-color: #93c5fd; background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.09);
}
.field textarea, .panel textarea { resize: vertical; line-height: 1.65; }
.field input:disabled, .field select:disabled, .field input[type="text"][disabled] { background: #f3f4f6; color: #6b7280; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint, .form-hint { font-size: 11px; color: #94a3b8; line-height: 1.6; }
.form-hint { margin-top: 8px; }
.form-actions-end { display: flex; justify-content: flex-end; margin-top: 10px; }
.inline-form-stack textarea { width: 100%; }
.type-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.type-option {
  display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 8px; font-size: 12px; cursor: pointer; background: #fbfdff; color: #374151;
}
.type-option input { width: auto; margin: 0; accent-color: var(--blue); }
.type-option.selected { border-color: var(--blue); background: #eff6ff; color: #1d4ed8; }
.check-list { display: flex; flex-direction: column; gap: 9px; font-size: 12px; color: var(--muted); }
.check-list li { position: relative; padding-left: 16px; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 800; }
.readonly-box { border: 1px dashed var(--line); border-radius: 10px; background: #f8fafc; color: #475569; padding: 10px 12px; font-size: 13px; font-weight: 600; min-height: 40px; }
.inline-control { display: flex; gap: 8px; }
.inline-control select { flex: 1; }

/* ---------- Ticket detail ---------- */
.ticket-hero { background: linear-gradient(130deg, #0f172a, #1e3a8a 55%, #0f766e); color: #fff; border-radius: 20px; padding: 26px 28px; margin-bottom: 20px; box-shadow: 0 16px 34px rgba(15,23,42,.18); }
.ticket-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.back-link { color: rgba(255,255,255,.72); font-size: 12px; }
.back-link:hover { color: #fff; text-decoration: none; }
.ticket-hero-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.ticket-hero h2 { font-size: 25px; font-weight: 800; margin-top: 14px; letter-spacing: -.3px; }
.ticket-hero-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; color: rgba(255,255,255,.7); font-size: 12px; }
.ticket-hero-meta .meta-project { color: #99f6e4; background: rgba(15,118,110,.35); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.detail-main, .detail-side { min-width: 0; }
.description-text { white-space: pre-wrap; word-break: break-word; color: #374151; font-size: 14px; line-height: 1.85; }
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.meta-grid > div { background: #f8fafc; border-radius: 10px; padding: 10px 12px; }
.meta-grid span { display: block; font-size: 10px; color: #94a3b8; }
.meta-grid strong { display: block; font-size: 13px; margin-top: 2px; }
.action-panel h3 { font-size: 14px; margin-bottom: 11px; }
.action-row { display: flex; flex-direction: column; gap: 8px; }
.rating-display { font-size: 30px; color: #d1d5db; letter-spacing: 3px; }
.rating-display .star-on { color: #f59e0b; }
.rating-input { display: flex; gap: 4px; font-size: 28px; color: #d1d5db; }
.rating-input label { cursor: pointer; }
.rating-input input { display: none; }
.rating-input label:hover span, .rating-input label:hover ~ label span { color: #fbbf24; }
.rating-input input:checked + span { color: #f59e0b; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 13px; position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; background: #cbd5e1; border: 2px solid #fff; box-shadow: 0 0 0 1px #e2e8f0; }
.event-status .timeline-dot { background: var(--blue); }
.event-reply .timeline-dot { background: var(--teal); }
.event-note .timeline-dot { background: var(--amber); }
.event-transfer .timeline-dot { background: var(--purple); }
.event-project .timeline-dot { background: var(--teal); }
.event-ai .timeline-dot { background: var(--indigo); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-head { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 12px; }
.timeline-head strong { font-weight: 650; }
.event-tag { font-size: 10px; font-weight: 700; background: #f1f5f9; color: #475569; border-radius: 6px; padding: 1px 7px; }
.event-note .event-tag { background: #fef3c7; color: #b45309; }
.event-ai .event-tag { background: #ede9fe; color: #6d28d9; }
.internal-tag { font-size: 9px; color: #b45309; border: 1px solid #fde68a; background: #fffbeb; border-radius: 5px; padding: 0 5px; }
.timeline-content { margin-top: 6px; font-size: 13px; color: #334155; background: #f8fafc; border-radius: 9px; padding: 9px 12px; white-space: pre-wrap; word-break: break-word; }
.timeline-item.internal .timeline-content { background: #fffbeb; border: 1px dashed #fde68a; color: #92400e; }
.timeline-note { margin-top: 8px; padding: 10px 12px; border: 1px solid #e6ebf2; border-radius: 9px; background: #fbfcfe; color: #526077; font-size: 12px; }
.timeline-note-label { display: block; margin-bottom: 4px; color: #7b8799; font-size: 10px; font-weight: 700; }
.timeline-note-text { line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.event-workflow .timeline-note { border-color: #dbe7ff; background: #f5f8ff; }
.event-workflow .timeline-note-label { color: #1f5eff; }
.event-approval .timeline-note { border-color: #fde8b2; background: #fffaeb; }
.event-approval .timeline-note-label { color: #b54708; }
.event-transfer .timeline-note { border-color: #e5dcfb; background: #faf7ff; }
.event-transfer .timeline-note-label { color: #7c3aed; }
.ai-panel { border-color: #ddd6fe; background: linear-gradient(180deg, #fff, #faf8ff); }
.details summary { cursor: pointer; font-size: 12px; font-weight: 650; color: var(--indigo); }
.ai-transcript { background: #f8fafc; border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px; font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; margin-top: 10px; }

/* ---------- Projects detail/form ---------- */
.project-hero { background: linear-gradient(130deg, #0f766e, #0891b2 55%, #2563eb); color: #fff; border-radius: 20px; padding: 26px 28px; margin-bottom: 20px; box-shadow: 0 16px 34px rgba(15,118,110,.18); }
.project-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.project-hero h2 { font-size: 26px; font-weight: 800; margin-top: 12px; }
.project-hero-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: rgba(255,255,255,.74); font-size: 12px; }
.project-hero .hero-actions { margin-top: 18px; }
.keyword-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.keyword { font-size: 11px; color: #6d28d9; background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 7px; padding: 2px 8px; }

/* ---------- AI ---------- */
.ai-hero {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 18px;
  border-radius: 20px; padding: 24px 28px; color: #fff; margin-bottom: 20px;
  background: radial-gradient(circle at 85% 0%, rgba(34,211,238,.28), transparent 42%), linear-gradient(125deg, #312e81, #4338ca 48%, #0e7490);
  box-shadow: 0 16px 34px rgba(67,56,202,.22);
}
.ai-orb { width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); font-weight: 800; font-size: 22px; }
.ai-hero h2 { font-size: 24px; font-weight: 800; margin-top: 5px; }
.ai-hero p { color: rgba(255,255,255,.75); font-size: 12px; margin-top: 5px; }
.ai-steps { display: flex; align-items: center; gap: 8px; font-size: 11px; color: rgba(255,255,255,.8); }
.ai-steps b { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,.2); align-items: center; justify-content: center; margin-right: 4px; font-size: 10px; }
.ai-steps i { width: 22px; height: 1px; background: rgba(255,255,255,.3); }
.ai-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.ai-main, .ai-side { min-width: 0; }
.sample-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; font-size: 12px; }
.chip-btn { border: 1px solid #ddd6fe; background: #f5f3ff; color: #6d28d9; border-radius: 20px; padding: 4px 11px; font-size: 11px; font-weight: 600; }
.chip-btn:hover { background: #ede9fe; }
.ai-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ai-actions .muted { font-size: 11px; }
.ai-result { border-color: #ddd6fe; background: linear-gradient(180deg, #fff, #fcfbff); }
.ai-summary { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.summary-chip { font-size: 11px; background: #f1f5f9; color: #334155; border-radius: 7px; padding: 4px 9px; }
.summary-chip.chip-project { background: #f0fdfa; color: #0f766e; font-weight: 600; }
.summary-chip.chip-ai { background: #ede9fe; color: #6d28d9; font-weight: 600; }
.ai-notes { display: flex; flex-direction: column; gap: 6px; }
.ai-note { display: flex; gap: 8px; font-size: 12px; color: #475569; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.ai-note:last-child { border-bottom: 0; }
.ai-note .note-icon { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; flex-shrink: 0; }
.note-ok .note-icon { background: #d1fae5; color: #047857; }
.note-warn .note-icon { background: #fef3c7; color: #b45309; }
.note-info .note-icon { background: #dbeafe; color: #1d4ed8; }
.ai-summary-box { margin-top: 12px; }
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-mask { position: absolute; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(3px); }
.modal-card { position: relative; z-index: 1; width: min(600px, 100%); max-height: 86vh; overflow: auto; background: #fff; border-radius: 18px; padding: 22px; box-shadow: 0 30px 80px rgba(15,23,42,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.modal-head h3 { font-size: 18px; margin-top: 6px; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.candidate-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.candidate {
  text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 11px 13px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%;
}
.candidate:hover { border-color: var(--teal); background: #f0fdfa; }
.candidate strong { display: block; font-size: 13px; }
.candidate small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.candidate .match { font-size: 10px; color: #6d28d9; background: #ede9fe; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }

/* ---------- Stats bars ---------- */
.bar-chart { display: flex; align-items: flex-end; justify-content: space-around; gap: 10px; height: 210px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-value { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.bar-column { width: min(42px, 70%); height: 150px; display: flex; align-items: flex-end; justify-content: center; }
.bar-column span { display: block; width: 100%; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #60a5fa, #2563eb); min-height: 6px; }
.bar-label { font-size: 10px; color: #94a3b8; margin-top: 7px; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.bar-name { width: 92px; flex-shrink: 0; font-size: 11px; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-name-wrap { width: 140px; white-space: normal; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bar-track { flex: 1; height: 9px; background: #eef2f7; border-radius: 5px; overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #2563eb, #60a5fa); min-width: 2px; }
.bar-count { width: 30px; text-align: right; font-size: 11px; color: var(--muted); }

/* ---------- Profile ---------- */
.profile-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.profile-card { text-align: center; }
.profile-card .avatar { margin: 0 auto 10px; }
.profile-card h3 { font-size: 18px; }
.profile-card p { color: var(--muted); font-size: 12px; margin: 3px 0 10px; }
.profile-card .kv-list { text-align: left; margin-top: 14px; }

/* ---------- Auth ---------- */
.auth-body { background: #eef2f7; min-height: 100vh; }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); min-height: 100vh; }
.auth-aside { background: radial-gradient(circle at 20% 10%, rgba(37,99,235,.35), transparent 40%), linear-gradient(145deg, #0f172a, #1e1b4b 58%, #0f766e); color: #fff; padding: 54px clamp(34px, 6vw, 86px); display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; width: 360px; height: 360px; border-radius: 50%; right: -120px; bottom: -160px; background: rgba(255,255,255,.06); }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.auth-aside h1 { font-size: clamp(34px, 4vw, 52px); line-height: 1.2; letter-spacing: -1px; margin-top: 52px; font-weight: 800; }
.auth-lead { color: rgba(255,255,255,.7); font-size: 14px; line-height: 1.8; max-width: 500px; margin-top: 18px; }
.auth-points { display: flex; flex-direction: column; gap: 13px; margin-top: 38px; font-size: 13px; color: rgba(255,255,255,.82); }
.auth-points span { display: inline-flex; width: 25px; height: 25px; border-radius: 8px; background: rgba(255,255,255,.12); align-items: center; justify-content: center; font-size: 10px; margin-right: 10px; color: #99f6e4; }
.auth-foot { margin-top: auto; padding-top: 48px; font-size: 11px; color: rgba(255,255,255,.4); letter-spacing: 1px; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 42px 24px; }
.auth-card { width: min(440px, 100%); background: #fff; border-radius: 22px; padding: 34px; box-shadow: 0 24px 60px rgba(15,23,42,.1); }
.auth-head { margin-bottom: 20px; }
.auth-kicker { font-size: 10px; font-weight: 800; letter-spacing: 2px; color: var(--blue); text-transform: uppercase; }
.auth-head h2 { font-size: 26px; font-weight: 800; margin-top: 5px; letter-spacing: -.5px; }
.auth-head p { color: var(--muted); font-size: 12px; margin-top: 6px; }
.auth-switch { text-align: center; font-size: 12px; color: var(--muted); margin-top: 15px; }
.demo-box { margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 15px; }
.demo-title { font-size: 10px; color: #94a3b8; font-weight: 800; letter-spacing: 1.5px; margin-bottom: 7px; }
.demo-row { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; padding: 5px 0; color: var(--muted); }
.demo-row code { font-size: 10px; color: #475569; background: #f8fafc; border-radius: 5px; padding: 1px 5px; }
.demo-hint { font-size: 10px; color: #94a3b8; margin-top: 7px; }
.auth-copyright { font-size: 10px; color: #94a3b8; margin-top: 18px; }
.error-page { text-align: center; padding: 8px 0; }
.error-code { font-size: 66px; font-weight: 900; letter-spacing: -3px; background: linear-gradient(90deg, #4f46e5, #0891b2); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.error-page h2 { font-size: 20px; margin-top: 12px; }
.error-page p { color: var(--muted); font-size: 12px; margin-top: 7px; }
.error-actions { display: flex; justify-content: center; gap: 9px; margin-top: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .project-grid-page { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 50px rgba(15,23,42,.35); }
  .app-shell.drawer-open .sidebar { transform: translateX(0); }
  .app-shell.drawer-open .drawer-mask { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(15,23,42,.45); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 20px 18px 50px; }
  .topbar { padding: 12px 18px; }
  .detail-layout, .ai-layout, .form-layout, .profile-layout { grid-template-columns: 1fr; }
  .form-submit-bar { grid-column: 1; }
  .split-2 { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { min-height: 100vh; }
}
@media (max-width: 760px) {
  .stat-grid, .stat-grid-5, .stat-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-grid, .project-grid-page { grid-template-columns: 1fr; }
  .hero-panel { flex-direction: column; align-items: flex-start; }
  .page-head { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field-row-2 { grid-template-columns: 1fr; }
  .type-options { grid-template-columns: repeat(2, 1fr); }
  .topbar-user-meta { display: none; }
  .role-pill { display: none; }
  .topbar-actions { gap: 8px; }
  .ai-hero { grid-template-columns: 48px minmax(0, 1fr); }
  .ai-orb { width: 48px; height: 48px; font-size: 17px; border-radius: 15px; }
  .ai-hero h2 { font-size: 20px; }
  .ai-steps { display: none; }
  .bar-name-wrap { width: 100px; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .flash { margin: 12px 18px 0; }
  .auth-card { padding: 26px 22px; }
  .demo-row { flex-direction: column; gap: 2px; }
}

.auth-flash { width: min(440px, 100%); margin-bottom: 14px; }

/* ---------- Notifications ---------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; border-radius: 10px; background: #f97316; color: #fff; font-size: 10px; font-weight: 800; line-height: 20px; text-align: center; padding: 0 6px; }
.notification-list { display: flex; flex-direction: column; gap: 10px; }
.notification-card { display: flex; gap: 12px; background: #fff; border: 1px solid var(--line-soft); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm); }
.notification-card.unread { border-color: #bfdbfe; background: linear-gradient(180deg, #fff, #f8fbff); }
.notification-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; margin-top: 7px; flex-shrink: 0; }
.notification-card.unread .notification-dot { background: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.1); }
.notification-body { flex: 1; min-width: 0; }
.notification-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.notification-head strong { font-weight: 650; }
.notification-kind { font-size: 10px; font-weight: 700; border-radius: 6px; padding: 2px 8px; background: #f1f5f9; color: #475569; }
.kind-ticket { background: #dbeafe; color: #1d4ed8; }
.kind-reply { background: #cffafe; color: #0e7490; }
.kind-transfer { background: #f3e8ff; color: #6d28d9; }
.kind-progress { background: #e0f2fe; color: #0369a1; }
.kind-urge { background: #fef3c7; color: #b45309; }
.kind-rating { background: #fef9c3; color: #a16207; }
.kind-project { background: #ccfbf1; color: #0f766e; }
.notification-text { margin-top: 7px; white-space: pre-wrap; color: #475569; font-size: 13px; line-height: 1.7; }
.notification-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 12px; }
.notification-foot a { color: var(--blue); font-weight: 600; }

/* ---------- Attachments ---------- */
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 9px; margin-top: 16px; }
.attachment-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-soft); border-radius: 10px; padding: 9px 10px; background: #fbfdff; color: var(--text); font-size: 12px; min-width: 0; }
.attachment-item:hover { border-color: #bfdbfe; background: #f8fbff; }
.attachment-thumb { display: flex; flex-shrink: 0; border-radius: 7px; overflow: hidden; }
.attachment-thumb:hover { text-decoration: none; }
.attachment-thumb img { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; display: block; }
.attachment-file-icon { width: 42px; height: 42px; border-radius: 7px; background: #e2e8f0; color: #64748b; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; letter-spacing: .5px; flex-shrink: 0; }
.att-icon-image { background: #e0f2fe; color: #0369a1; }
.att-icon-pdf { background: #fee2e2; color: #b91c1c; }
.att-icon-doc { background: #dbeafe; color: #1d4ed8; }
.att-icon-xls { background: #dcfce7; color: #15803d; }
.att-icon-ppt { background: #ffedd5; color: #c2410c; }
.att-icon-text { background: #f1f5f9; color: #475569; }
.att-icon-zip { background: #f3e8ff; color: #7e22ce; }
.att-icon-file { background: #e2e8f0; color: #64748b; }
.attachment-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.attachment-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }
.attachment-name:hover { color: var(--blue); }
.attachment-meta { color: #94a3b8; font-size: 10.5px; }
.attachment-actions { display: flex; align-items: center; gap: 10px; margin-top: 3px; }
.attachment-action { font-size: 11px; font-weight: 650; color: var(--blue); }
.attachment-action:hover { text-decoration: underline; }
.attachment-action-download { color: #667085; }
.event-attachments { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.event-attachment { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 11px; background: #f8fafc; border: 1px solid var(--line-soft); border-radius: 7px; padding: 4px 9px; color: #475569; }
.event-attachment:hover { border-color: #bfdbfe; }
.event-attachment-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-attachment-size { color: #94a3b8; font-size: 10px; flex-shrink: 0; }
.event-attachment-actions { display: inline-flex; align-items: center; gap: 6px; padding-left: 6px; border-left: 1px solid #e7ecf3; flex-shrink: 0; }
.event-attachment-actions a { font-size: 10.5px; font-weight: 650; }
.file-input { margin-top: 8px; font-size: 11px; width: 100%; }
input[type="file"] { border: 1px dashed #cbd5e1; border-radius: 9px; padding: 8px 10px; background: #fbfdff; color: #64748b; }

/* ---------- API tokens ---------- */
.token-new { border-color: #a7f3d0; background: linear-gradient(180deg, #fff, #f0fdf4); }
.token-value { width: 100%; font-family: monospace; font-size: 12px; background: #f8fafc; border: 1px solid #a7f3d0; border-radius: 9px; padding: 10px 12px; }
.inline-token-form { display: flex; gap: 9px; margin-bottom: 14px; }
.inline-token-form input { flex: 1; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; font-size: 13px; }
.token-table { margin-top: 6px; }

/* ---------- Help / Enterprise ---------- */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.faq { border-bottom: 1px solid var(--line-soft); padding: 10px 0; }
.faq:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-size: 13px; font-weight: 650; color: #1f2937; }
.faq p { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.faq code { background: #f1f5f9; border-radius: 4px; padding: 1px 5px; font-size: 11px; }
.enterprise-hero { display: flex; align-items: center; gap: 16px; background: linear-gradient(120deg, #eff6ff, #f0fdfa); border: 1px solid #bfdbfe; border-radius: 18px; padding: 22px 24px; margin-bottom: 18px; }
.enterprise-logo-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 26px; }
.enterprise-hero-body { flex: 1; }
.enterprise-hero-body h2 { font-size: 22px; font-weight: 800; }
.enterprise-hero-body p { font-size: 12px; color: var(--muted); margin-top: 4px; }
@media (max-width: 900px) { .help-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Light professional theme
   White surfaces, calm slate typography, blue accent, precise controls.
   ========================================================================== */
:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --soft: #f8fafc;
  --line: #dfe5ee;
  --line-soft: #edf1f6;
  --blue: #1f5eff;
  --indigo: #4f46e5;
  --teal: #0f766e;
  --green: #0f8a5f;
  --amber: #b45309;
  --red: #c2413a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
}

html { background: #f4f7fb; }
body {
  background: linear-gradient(180deg, #f7f9fc 0, #f4f7fb 320px, #f4f7fb 100%);
  color: var(--text);
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { letter-spacing: -.2px; }
::selection { background: #dbe7ff; color: #173b8f; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: #ffffff;
  color: #5d6b82;
  border-right: 1px solid #e6ebf2;
  box-shadow: 1px 0 0 rgba(16, 24, 40, .01);
  padding: 18px 14px;
}
.brand { color: #101828; padding: 2px 10px 20px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #2f6bff, #1f5eff 58%, #174bd6);
  box-shadow: 0 4px 10px rgba(31, 94, 255, .22);
  font-size: 18px;
}
.brand-text strong { color: #101828; font-size: 19px; font-weight: 750; }
.brand-text small { color: #98a2b3; font-size: 9px; letter-spacing: 1.5px; }
.side-nav { gap: 2px; margin-top: 4px; }
.nav-item {
  color: #5d6b82; padding: 9px 12px; border-radius: 8px; font-size: 13px;
  border: 1px solid transparent; font-weight: 500;
}
.nav-item:hover { background: #f6f9ff; color: #1849b8; text-decoration: none; }
.nav-item.active {
  background: #eef4ff; color: #1745a8; border-color: #dbe7ff;
  box-shadow: none; font-weight: 650;
}
.nav-icon { color: #8a96a8; opacity: 1; font-size: 15px; }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { color: #1f5eff; }
.nav-badge { background: #1f5eff; color: #fff; }
.sidebar-foot { border-top-color: #edf1f6; }
.sidebar-user strong { color: #1d2939; }
.sidebar-user small { color: #98a2b3; }
.sidebar-version { color: #98a2b3; }

/* ---------- Topbar / shell ---------- */
.topbar {
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid #e8edf4;
  padding: 12px 28px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .02);
}
.topbar-kicker { color: #98a2b3; font-size: 9px; letter-spacing: 1.4px; }
.topbar-heading h1 { font-size: 18px; font-weight: 700; color: #101828; }
.content { padding: 22px 28px 52px; }
.flash {
  background: #f0fdf4; color: #067647; border-color: #bbf7d0;
  border-radius: 10px; font-weight: 600; font-size: 12.5px;
}
.icon-btn { color: #667085; border-radius: 7px; }
.icon-btn:hover { background: #f4f7fb; color: #1849b8; }

/* ---------- Buttons ---------- */
.btn {
  border-radius: 8px; padding: 8px 14px; font-size: 12.5px; font-weight: 650;
  border: 1px solid transparent; box-shadow: none; letter-spacing: .1px;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: none; }
.btn:focus-visible, .chip-btn:focus-visible, .nav-item:focus-visible, .icon-btn:focus-visible {
  outline: 0; box-shadow: 0 0 0 3px rgba(31, 94, 255, .18);
}
.btn-primary {
  background: #1f5eff; border-color: #1f5eff; color: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.btn-primary:hover { background: #174bd6; border-color: #174bd6; }
.btn-ghost { background: #fff; border-color: #dce3ed; color: #344054; }
.btn-ghost:hover { background: #f8fafc; border-color: #c8d3e1; }
.btn-soft { background: #f4f7fb; border-color: #e4e9f1; color: #344054; }
.btn-soft:hover { background: #eef3f9; }
.btn-light { background: #fff; border-color: #d6e2fb; color: #1849b8; }
.btn-light:hover { background: #f7faff; border-color: #b9cdf8; }
.btn-ai { background: #eef4ff; border-color: #d8e4ff; color: #1d4ed8; box-shadow: none; }
.btn-ai:hover { background: #e3edff; border-color: #bfd3ff; }
.btn-success { background: #0f8a5f; border-color: #0f8a5f; color: #fff; }
.btn-success:hover { background: #0b7350; }
.btn-warn { background: #fffbeb; border-color: #fde7bb; color: #9a5b08; }
.btn-warn:hover { background: #fff7df; border-color: #f8d894; }
.btn-sm { padding: 5px 9px; font-size: 11.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.form .btn-block, .auth-card .btn-block { min-height: 40px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.chip-btn {
  background: #fff; border-color: #dce6f5; color: #355a9e; border-radius: 7px;
  padding: 5px 10px; font-size: 11px; font-weight: 600;
}
.chip-btn:hover { background: #f6f9ff; border-color: #bcd1f2; }

/* ---------- Panels, cards, tables ---------- */
.panel {
  background: #fff; border: 1px solid #e7ecf3; border-radius: 12px;
  box-shadow: var(--shadow-sm); padding: 20px 22px;
}
.panel-soft { background: #fbfcfe; }
.panel-head { margin-bottom: 14px; }
.panel-head h3 { font-size: 14.5px; font-weight: 700; color: #1d2939; }
.panel-head a { color: #1f5eff; font-size: 11.5px; }
.page-head h2 { font-size: 24px; font-weight: 750; color: #101828; }
.page-head p { font-size: 12.5px; color: var(--muted); }
.quick-card, .stat-card, .ticket-card, .project-card, .notification-card {
  border-color: #e7ecf3; box-shadow: var(--shadow-sm);
}
.quick-card { border-radius: 10px; padding: 15px 16px; }
.quick-card:hover { border-color: #bfd3f8; box-shadow: 0 4px 14px rgba(31, 94, 255, .06); transform: none; }
.stat-card { border-radius: 10px; padding: 16px 18px; }
.stat-card strong { font-size: 27px; font-weight: 750; color: #101828; letter-spacing: -.5px; }
.stat-label { font-size: 11.5px; color: #667085; }
.stat-card small { color: #98a2b3; }
.ticket-card { border-radius: 10px; padding: 14px 16px; }
.ticket-card:hover { transform: none; border-color: #bfd3f8; box-shadow: 0 4px 14px rgba(31, 94, 255, .06); }
.project-card { border-radius: 10px; padding: 16px 18px; }
.project-card:hover { transform: none; border-color: #bfd3f8; }
.project-name { font-size: 14.5px; font-weight: 700; }
.data-table th {
  background: #fafbfd; color: #7a8699; font-size: 10.5px; font-weight: 700;
  letter-spacing: .3px; border-bottom-color: #e7ecf3; padding: 9px 10px;
}
.data-table td { color: #344054; border-bottom-color: #eef2f6; padding: 11px 10px; }
.data-table tr:hover td { background: #f9fbff; }
.filter-bar { border-radius: 10px; border-color: #e7ecf3; box-shadow: var(--shadow-sm); padding: 12px 14px; }
.filter-field > span { color: #7a8699; font-size: 10px; }
.filter-field select, .filter-field input { height: 37px; border-color: #dbe2ec; border-radius: 7px; }
.mini-stats > div { background: #f8fafc; border: 1px solid #eef2f7; border-radius: 9px; }
.empty { padding: 34px 18px; }
.empty-icon { background: #f4f7fb; color: #98a2b3; }
.empty h3 { font-size: 14px; }
.role-pill { border-radius: 6px; font-size: 10px; padding: 3px 8px; }
.role-pill-admin { background: #f2f4f7; color: #344054; border: 1px solid #e4e7ec; }
.role-pill-staff { background: #eff8ff; color: #175cd3; border: 1px solid #d1e9ff; }
.role-pill-customer { background: #f4f3ff; color: #5925dc; border: 1px solid #e4e0ff; }
.badge { border-radius: 5px; font-size: 10px; padding: 2px 7px; }

/* ---------- Hero: light surfaces with blue / teal accents ---------- */
.hero-panel {
  color: #101828; border-radius: 14px; padding: 24px 26px;
  background: #fff; border: 1px solid #dbe6fb; box-shadow: var(--shadow-sm);
}
.hero-staff { background: linear-gradient(120deg, #f1faf8 0%, #f2f7ff 100%); border-color: #d5ebe8; }
.hero-customer { background: linear-gradient(120deg, #f2f6ff 0%, #f8f6ff 100%); border-color: #dae3fb; }
.hero-admin { background: linear-gradient(120deg, #f7f9fc 0%, #f1f4fb 100%); border-color: #e1e7f0; }
.hero-panel::after { background: rgba(31, 94, 255, .06); }
.hero-kicker { color: #1f5eff; opacity: 1; font-size: 10px; }
.hero-panel h2 { color: #101828; font-size: 23px; font-weight: 750; }
.hero-panel p { color: #5d6b82; }
.hero-actions .btn { box-shadow: none; }
.ticket-hero {
  background: linear-gradient(120deg, #ffffff, #f7faff);
  color: #101828; border: 1px solid #dbe6fb; border-radius: 14px;
  box-shadow: var(--shadow-sm); padding: 22px 24px;
}
.back-link { color: #667085; font-size: 11.5px; }
.back-link:hover { color: #1f5eff; }
.ticket-hero h2 { color: #101828; font-size: 23px; margin-top: 12px; }
.ticket-hero-meta { color: #667085; }
.ticket-hero-meta .meta-project { color: #0f766e; background: #f0fdfa; border: 1px solid #ccfbf1; }
.project-hero {
  background: linear-gradient(120deg, #ffffff, #f4fbfa);
  color: #101828; border: 1px solid #d7ebe8; border-radius: 14px;
  box-shadow: var(--shadow-sm); padding: 22px 24px;
}
.project-hero h2 { color: #101828; font-size: 24px; }
.project-hero-meta { color: #667085; }
.ai-hero {
  background: linear-gradient(120deg, #ffffff, #f5f8ff);
  color: #101828; border: 1px solid #dbe6fb; box-shadow: var(--shadow-sm);
  border-radius: 14px; padding: 22px 24px;
}
.ai-orb {
  background: #eef4ff; border: 1px solid #d8e4ff; color: #1f5eff;
  border-radius: 14px; width: 54px; height: 54px; font-size: 19px;
}
.ai-hero h2 { color: #101828; font-size: 21px; }
.ai-hero p { color: #5d6b82; }
.ai-steps { color: #667085; }
.ai-steps b { background: #eef4ff; color: #1f5eff; }
.ai-steps i { background: #dbe2ec; }

/* ---------- Forms / inputs ---------- */
.field { gap: 5px; }
.field > span { color: #344054; font-size: 11.5px; font-weight: 650; }
.field > span em { color: #98a2b3; font-size: 10.5px; }
.field input, .field select, .field textarea,
.form > textarea, .panel textarea, .panel input, .panel select,
.inline-token-form input {
  height: 40px; background: #fff; border: 1px solid #d8e0ea; border-radius: 8px;
  padding: 9px 12px; font-size: 13px; color: #1d2939;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, .02);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.field textarea, .form > textarea, .panel textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder, .panel textarea::placeholder, .panel input::placeholder { color: #a4aebe; }
.field input:hover, .field select:hover, .field textarea:hover, .panel textarea:hover, .panel input:hover, .panel select:hover { border-color: #c6d1df; }
.field input:focus, .field select:focus, .field textarea:focus,
.panel textarea:focus, .panel input:focus, .panel select:focus,
.inline-token-form input:focus {
  outline: none; border-color: #84a9f8; background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 94, 255, .12);
}
.field input:disabled, .field select:disabled, .field textarea:disabled,
.panel input:disabled, .panel select:disabled {
  background: #f7f9fc; color: #98a2b3; border-color: #e7ecf3; box-shadow: none;
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 12px;
  padding-right: 32px;
}
.field select { height: 40px; }
input[type="checkbox"], input[type="radio"] { accent-color: #1f5eff; }
.form-hint, .field-hint { color: #8a96a8; font-size: 10.5px; line-height: 1.65; }
.readonly-box { background: #f8fafc; border-color: #dfe5ee; color: #475467; border-radius: 8px; min-height: 40px; padding: 9px 12px; }
.form-submit-bar {
  position: static; background: transparent; border-top: 1px solid #e4e9f0;
  padding: 14px 0 0; margin-top: 16px; backdrop-filter: none;
}
.type-option {
  background: #fff; border-color: #dbe2ec; border-radius: 8px; padding: 9px 8px;
  font-size: 11.5px; color: #344054; transition: .15s ease;
}
.type-option:hover { border-color: #bfd3f8; background: #f8fbff; }
.type-option.selected { background: #eef4ff; border-color: #a8c2fb; color: #1745a8; }
.check-list li::before { color: #0f8a5f; }

/* ---------- File upload ---------- */
input[type="file"] {
  width: 100%; border: 1px dashed #cfd9e6; border-radius: 8px; background: #fbfcfe;
  color: #667085; padding: 10px 12px; font-size: 11.5px; cursor: pointer;
}
input[type="file"]::file-selector-button {
  appearance: none; margin-right: 10px; padding: 7px 12px;
  border: 1px solid #d6e2fb; border-radius: 7px; background: #eef4ff;
  color: #1849b8; font: inherit; font-weight: 650; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: #e3edff; }
.upload-control {
  position: relative; display: flex; flex-direction: column; gap: 9px;
  border: 1px dashed #cfd9e6; border-radius: 9px; background: #fbfcfe;
  padding: 13px 14px; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.upload-control:hover { border-color: #a8c2fb; background: #f8fbff; }
.upload-control:focus-within { border-color: #84a9f8; box-shadow: 0 0 0 3px rgba(31, 94, 255, .12); }
.upload-control.has-file { border-style: solid; border-color: #bcd1f2; background: #f8fbff; }
.upload-native {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; z-index: 2;
  border: 0; padding: 0; background: transparent;
}
.upload-face { display: flex; align-items: center; gap: 11px; pointer-events: none; }
.upload-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef4ff; color: #1f5eff; font-size: 16px; font-weight: 700;
}
.upload-title { display: block; color: #25324a; font-size: 12px; font-weight: 650; line-height: 1.4; }
.upload-sub { display: block; color: #8a96a8; font-size: 10.5px; margin-top: 2px; line-height: 1.5; }
.upload-meta {
  position: relative; z-index: 3; pointer-events: none; color: #7a8699; font-size: 10.5px;
  line-height: 1.6; padding-top: 8px; border-top: 1px solid #edf1f6;
}
.upload-meta strong { color: #1849b8; font-weight: 650; }
.upload-meta .upload-names { color: #475467; word-break: break-all; }
.upload-meta .upload-warn { color: #b45309; }
.file-input { margin-top: 8px; }
.file-input.upload-native { margin-top: 0; }

/* ---------- Auth: light split screen ---------- */
.auth-body { background: #f4f7fb; }
.auth-shell { grid-template-columns: minmax(0, 1fr) minmax(420px, .92fr); }
.auth-aside {
  background:
    radial-gradient(circle at 15% 12%, rgba(31, 94, 255, .10), transparent 38%),
    radial-gradient(circle at 90% 95%, rgba(15, 118, 110, .08), transparent 38%),
    linear-gradient(150deg, #fbfdff 0%, #f3f7ff 55%, #f4faf9 100%);
  color: #101828; border-right: 1px solid #e6ebf3;
}
.auth-aside::after { background: rgba(31, 94, 255, .045); }
.auth-brand { color: #101828; }
.auth-brand .brand-mark { box-shadow: 0 5px 14px rgba(31, 94, 255, .20); }
.auth-aside h1 { color: #101828; letter-spacing: -.8px; }
.auth-lead { color: #5d6b82; }
.auth-points { color: #475467; }
.auth-points span { background: #fff; border: 1px solid #dbe7ff; color: #1f5eff; }
.auth-foot { color: #98a2b3; }
.auth-main { background: rgba(255, 255, 255, .36); }
.auth-card {
  background: #fff; border: 1px solid #e5ebf3; border-radius: 16px;
  box-shadow: 0 16px 44px rgba(16, 24, 40, .07); padding: 32px;
}
.auth-head h2 { color: #101828; font-size: 24px; }
.auth-head p { color: #667085; }
.auth-kicker { color: #1f5eff; font-size: 9.5px; }
.auth-switch { color: #667085; }
.auth-copyright { color: #98a2b3; }
.demo-box { border-top-color: #e7ecf3; }
.demo-title { color: #98a2b3; }
.demo-row { color: #667085; }
.demo-row code { background: #f7f9fc; border: 1px solid #edf1f6; color: #475467; padding: 2px 6px; }
.demo-hint { color: #98a2b3; }
.auth-flash { border-radius: 9px; }
.error-page h2 { color: #101828; }
.error-page p { color: #667085; }

/* ---------- AI, timeline, modal ---------- */
.ai-panel { border-color: #dbe6fb; background: #fbfdff; }
.ai-transcript { background: #fbfcfe; border-color: #e7ecf3; }
.timeline-content { background: #f8fafc; color: #344054; border: 1px solid #eef2f6; }
.timeline-note { border-left-color: #dbe2ec; color: #667085; }
.modal-mask { background: rgba(16, 24, 40, .42); backdrop-filter: blur(2px); }
.modal-card { border: 1px solid #e5ebf3; border-radius: 13px; box-shadow: 0 24px 64px rgba(16, 24, 40, .18); }
.candidate { border-color: #e4e9f0; border-radius: 8px; }
.candidate:hover { border-color: #a8c2fb; background: #f8fbff; }
.candidate .match { background: #eef4ff; color: #1d4ed8; }
.bar-track, .progress-track { background: #eef2f7; }
.attachment-item { border-color: #e7ecf3; background: #fbfcfe; border-radius: 8px; }
.attachment-item:hover { border-color: #bfd3f8; background: #f8fbff; }
.notification-card { border-radius: 10px; }
.notification-card.unread { border-color: #bfd3f8; background: #f8fbff; }
.token-new { border-color: #bbf7d0; background: #f7fdf9; }
.token-value { border-color: #bbf7d0; background: #f8fafc; border-radius: 7px; }
.faq summary { color: #1d2939; }
.enterprise-hero { border-color: #dbe6fb; border-radius: 12px; background: linear-gradient(120deg, #f8fbff, #f4fbfa); }

/* ---------- Focus / motion ---------- */
a:focus-visible, .quick-card:focus-visible, .ticket-card:focus-visible, .project-card:focus-visible {
  outline: 0; box-shadow: 0 0 0 3px rgba(31, 94, 255, .16); border-radius: 8px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Responsive refinements ---------- */
@media (max-width: 1024px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { min-height: 100vh; }
  .sidebar { box-shadow: 14px 0 38px rgba(16, 24, 40, .08); }
  .app-shell.drawer-open .drawer-mask { background: rgba(16, 24, 40, .30); }
}
@media (max-width: 760px) {
  .hero-panel, .ticket-hero, .project-hero, .ai-hero { padding: 18px; border-radius: 12px; }
  .hero-panel h2, .ticket-hero h2, .project-hero h2, .ai-hero h2 { font-size: 20px; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 14px 46px; }
  .panel { padding: 17px 16px; }
  .auth-card { padding: 24px 20px; }
  .upload-control { padding: 12px; }
  .upload-sub { display: none; }
}

/* Compact uploads inside the right-hand ticket action column */
.detail-side .upload-control { padding: 10px 12px; gap: 6px; }
.detail-side .upload-sub { display: none; }
.detail-side .upload-icon { width: 30px; height: 30px; font-size: 13px; border-radius: 7px; }
.detail-side .upload-title { font-size: 11.5px; }
.detail-side .upload-meta { padding-top: 6px; font-size: 10px; }
.detail-side .upload-meta .upload-names { display: block; margin-top: 2px; }

.role-pill-pending { background: #fffaeb; color: #b54708; border: 1px solid #fef0c7; }

/* ---------- WeChat identity binding ---------- */
.wechat-bind-state {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 9px; background: #f8fafc;
  border: 1px solid #e7ecf3; color: #667085; font-size: 12px;
}
.wechat-bind-state.bound { background: #f0fdf4; border-color: #bbf7d0; color: #067647; }
.wechat-bind-state .btn { margin-left: auto; }
.wechat-dot { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; flex-shrink: 0; }
.wechat-bind-state.bound .wechat-dot { background: #12b76a; }
.wechat-link-head { display: flex; align-items: center; gap: 11px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid #edf1f6; }
.wechat-link-head .badge { margin-left: auto; }
.wechat-generate { max-width: 620px; }
.wechat-generate p { color: #5d6b82; font-size: 13px; line-height: 1.8; margin-bottom: 16px; }
.wechat-qr-wrap { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; align-items: start; }
.wechat-qr-card { border: 1px solid #e7ecf3; border-radius: 12px; padding: 18px; text-align: center; background: #fbfdff; }
.wechat-qr { width: 244px; height: 244px; display: block; margin: 0 auto 12px; border-radius: 6px; }
.wechat-qr-caption { font-size: 12px; font-weight: 700; color: #1d2939; }
.wechat-qr-expire { font-size: 10.5px; color: #98a2b3; margin-top: 4px; }
.wechat-steps { padding-top: 4px; }
.wechat-step-title { font-size: 13px; font-weight: 700; color: #1d2939; margin-bottom: 12px; }
.wechat-step { display: flex; gap: 9px; font-size: 12px; color: #5d6b82; line-height: 1.7; margin-bottom: 9px; }
.wechat-step span { width: 20px; height: 20px; border-radius: 50%; background: #eef4ff; color: #1f5eff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.wechat-token { margin-top: 16px; padding: 10px 12px; border-radius: 8px; background: #f8fafc; border: 1px solid #edf1f6; color: #667085; font-size: 10.5px; word-break: break-all; }
.wechat-token code { color: #475467; }
.wechat-bound-box { text-align: center; padding: 38px 20px; }
.wechat-bound-icon { width: 48px; height: 48px; border-radius: 50%; background: #ecfdf3; color: #12b76a; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; }
.wechat-bound-box h3 { margin-top: 12px; font-size: 16px; }
.wechat-bound-box p { margin-top: 6px; color: #667085; font-size: 12px; }
@media (max-width: 760px) {
  .wechat-qr-wrap { grid-template-columns: 1fr; }
  .wechat-qr-card { padding: 14px; }
  .wechat-qr { width: 210px; height: 210px; }
}

/* ---------- Attachment preview viewer ---------- */
.viewer-body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; background: #eef2f7; }
.viewer-bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-bottom: 1px solid #e6ebf2; box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.viewer-brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; color: #101828; }
.viewer-brand:hover { text-decoration: none; }
.brand-mark-sm { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
.viewer-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.viewer-brand-text strong { font-size: 13px; }
.viewer-brand-text small { font-size: 9px; color: #98a2b3; letter-spacing: .8px; }
.viewer-file { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.viewer-file-icon-sm, .viewer-file-icon-lg {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: .4px; flex-shrink: 0;
}
.viewer-file-icon-sm { width: 34px; height: 34px; border-radius: 8px; font-size: 9px; }
.viewer-file-meta { min-width: 0; display: flex; flex-direction: column; }
.viewer-file-meta strong { font-size: 13px; color: #101828; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-file-meta small { font-size: 10.5px; color: #667085; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.viewer-main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px 20px 20px; }
.viewer-stage {
  flex: 1; min-height: calc(100vh - 160px); display: flex; align-items: center; justify-content: center;
  padding: 24px; border-radius: 12px; overflow: auto;
  background: radial-gradient(circle at 50% 0%, #243247 0, #111827 58%, #0b1220 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.viewer-image {
  max-width: 100%; max-height: calc(100vh - 210px); object-fit: contain;
  border-radius: 6px; background: #fff; box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.viewer-frame {
  flex: 1; min-height: calc(100vh - 160px); border: 1px solid #e0e6ef; border-radius: 12px;
  background: #fff; overflow: hidden; box-shadow: 0 10px 30px rgba(16,24,40,.06);
}
.viewer-frame iframe { display: block; width: 100%; height: 100%; min-height: calc(100vh - 162px); border: 0; background: #fff; }
.viewer-hint { margin: 10px 0 0; text-align: center; color: #667085; font-size: 12px; }
.viewer-hint a { font-weight: 600; }
.viewer-fallback {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 48px 24px; border: 1px dashed #cfd8e6; border-radius: 12px; background: #fff;
}
.viewer-file-icon-lg { width: 84px; height: 84px; border-radius: 20px; font-size: 18px; }
.viewer-fallback h2 { margin-top: 18px; font-size: 20px; color: #101828; }
.viewer-fallback p { max-width: 560px; margin-top: 8px; color: #667085; font-size: 13px; line-height: 1.8; }
.viewer-fallback-actions { display: flex; gap: 10px; margin-top: 20px; }
.viewer-fallback-note { color: #98a2b3 !important; font-size: 11px !important; margin-top: 18px !important; }
@media (max-width: 760px) {
  .viewer-bar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .viewer-brand-text { display: none; }
  .viewer-actions { margin-left: auto; }
  .viewer-file { order: 3; flex-basis: 100%; }
  .viewer-main { padding: 12px; }
  .viewer-stage { min-height: calc(100vh - 190px); padding: 14px; }
  .viewer-image { max-height: calc(100vh - 220px); }
  .viewer-frame { min-height: calc(100vh - 190px); }
  .viewer-frame iframe { min-height: calc(100vh - 192px); }
}

/* ---------- Ticket conversation / rich composer ---------- */
#conversation,
#conversationComposer { scroll-margin-top: 84px; }
.conversation-head { align-items: flex-start; }
.conversation-head > div { min-width: 0; }
.conversation-head h3 { margin-bottom: 2px; }
.conversation-head .panel-note { flex-shrink: 0; white-space: nowrap; }
.panel-sub { color: #8a96a8; font-size: 11.5px; line-height: 1.6; }
.actor-role {
  display: inline-flex; align-items: center; height: 17px; padding: 0 6px;
  border-radius: 5px; background: #f2f5f9; color: #7a8699;
  font-size: 9.5px; font-weight: 650; line-height: 1;
}
.event-reply .event-tag { background: #cffafe; color: #0e7490; }
.event-progress .timeline-dot { background: #2563eb; }
.event-progress .event-tag { background: #e8f1ff; color: #1d4ed8; }

/* 富文本展示 */
.timeline-content.rich-text { white-space: normal; }
.timeline-content.rich-text p,
.timeline-content.rich-text div { margin: 0 0 6px; }
.timeline-content.rich-text p:last-child,
.timeline-content.rich-text div:last-child { margin-bottom: 0; }
.timeline-content.rich-text ul,
.timeline-content.rich-text ol { margin: 5px 0; padding-left: 20px; }
.timeline-content.rich-text ul { list-style: disc; }
.timeline-content.rich-text ol { list-style: decimal; }
.timeline-content.rich-text li { margin: 2px 0; }
.timeline-content.rich-text blockquote {
  margin: 6px 0; padding: 2px 0 2px 10px;
  border-left: 3px solid #cbd5e1; color: #475467;
}
.timeline-content.rich-text pre {
  margin: 6px 0; padding: 8px 10px; border-radius: 6px; background: #eef2f7;
  color: #334155; font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow: auto;
}
.timeline-content.rich-text code {
  padding: 0 4px; border: 1px solid #e4e9f0; border-radius: 4px; background: #eef2f7;
  color: #334155; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px;
}
.timeline-content.rich-text pre code { padding: 0; border: 0; background: transparent; }
.timeline-content.rich-text a { color: #1f5eff; text-decoration: underline; }
.timeline-item.internal .timeline-content.rich-text blockquote { border-left-color: #f0c36d; color: #92400e; }
.timeline-item.internal .timeline-content.rich-text code { background: #fef3c7; border-color: #fde68a; color: #92400e; }

/* 可见范围勾选 */
.composer { margin-top: 20px; padding-top: 18px; border-top: 1px solid #eef2f7; }
.composer-scope-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 7px; }
.composer-scope-label { color: #344054; font-size: 11px; font-weight: 700; }
.composer-scope-hint { color: #98a2b3; font-size: 10.5px; }
.composer-scope { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 8px; margin-bottom: 12px; }
.scope-option {
  position: relative; display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 11px; border: 1px solid #e4e9f0; border-radius: 9px;
  background: #fbfcfe; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.scope-option:hover { border-color: #bfd3f8; background: #f8fbff; }
.scope-option input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.scope-check {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid #c6d1df; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px;
  color: transparent; font-size: 11px; font-weight: 800; line-height: 1; transition: .15s ease;
}
.scope-check::before { content: "✓"; }
.scope-option input:checked + .scope-check { color: #fff; background: #1f5eff; border-color: #1f5eff; }
.scope-option input:focus-visible + .scope-check { box-shadow: 0 0 0 3px rgba(31, 94, 255, .18); }
.scope-option:has(input:checked),
.scope-option.selected { border-color: #a8c2fb; background: #f5f9ff; box-shadow: 0 0 0 2px rgba(31, 94, 255, .06); }
.scope-option.scope-note:has(input:checked),
.scope-option.scope-note.selected { border-color: #f2cf8d; background: #fffbf0; box-shadow: 0 0 0 2px rgba(217, 119, 6, .06); }
.scope-option.scope-note:has(input:checked) .scope-check,
.scope-option.scope-note.selected .scope-check { background: #d97706; border-color: #d97706; }
/* 不支持 :has 的浏览器使用 JS 添加的 .selected 兜底 */
.scope-option.selected { border-color: #a8c2fb; background: #f5f9ff; box-shadow: 0 0 0 2px rgba(31, 94, 255, .06); }
.scope-option.scope-note.selected { border-color: #f2cf8d; background: #fffbf0; box-shadow: 0 0 0 2px rgba(217, 119, 6, .06); }
.scope-option.scope-note.selected .scope-check { background: #d97706; border-color: #d97706; }
.scope-body { min-width: 0; }
.scope-body strong { display: block; color: #25324a; font-size: 12px; font-weight: 700; line-height: 1.45; }
.scope-body small { display: block; margin-top: 1px; color: #8a96a8; font-size: 10.5px; line-height: 1.45; }
.scope-option:has(input:checked) .scope-body strong,
.scope-option.selected .scope-body strong { color: #1745a8; }
.scope-option.scope-note:has(input:checked) .scope-body strong,
.scope-option.scope-note.selected .scope-body strong { color: #9a5b08; }
.scope-option.selected .scope-body strong { color: #1745a8; }
.scope-option.scope-note.selected .scope-body strong { color: #9a5b08; }

.composer-visibility {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content; margin-bottom: 10px;
  padding: 5px 9px; border: 1px solid #ccfbf1; border-radius: 7px;
  background: #f0fdfa; color: #0f766e; font-size: 11px; font-weight: 600;
}
.vis-dot { width: 6px; height: 6px; border-radius: 50%; background: #0f766e; flex-shrink: 0; }

/* 编辑器 */
.composer-box {
  border: 1px solid #d8e0ea; border-radius: 10px; background: #fff; overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer-box:focus-within { border-color: #84a9f8; box-shadow: 0 0 0 3px rgba(31, 94, 255, .10); }
.composer.mode-note .composer-box:focus-within { border-color: #e8b95c; box-shadow: 0 0 0 3px rgba(217, 119, 6, .10); }
.composer-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  padding: 6px 8px; border-bottom: 1px solid #eef2f7; background: #fbfcfe;
}
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 27px; padding: 0 6px; border: 0; border-radius: 6px;
  background: transparent; color: #5d6b82; font-size: 11.5px; font-weight: 700; line-height: 1;
}
.tool-btn:hover { background: #eef4ff; color: #1849b8; }
.tool-btn.active { background: #e3edff; color: #1849b8; }
.tool-btn.tool-link, .tool-btn.tool-clear { padding: 0 8px; font-size: 10.5px; font-weight: 600; }
.tool-sep { width: 1px; height: 17px; margin: 0 4px; background: #e4e9f0; }
.tool-u { text-decoration: underline; }
.tool-s { text-decoration: line-through; }
.composer-editor {
  min-height: 112px; max-height: 320px; overflow-y: auto; padding: 11px 13px;
  color: #1d2939; font-size: 13px; line-height: 1.75; outline: none; word-break: break-word;
}
.composer-editor.is-empty::before { content: attr(data-placeholder); color: #a4aebe; pointer-events: none; }
.composer-editor p, .composer-editor div { margin: 0 0 6px; }
.composer-editor p:last-child, .composer-editor div:last-child { margin-bottom: 0; }
.composer-editor ul, .composer-editor ol { margin: 5px 0; padding-left: 20px; }
.composer-editor ul { list-style: disc; }
.composer-editor ol { list-style: decimal; }
.composer-editor li { margin: 2px 0; }
.composer-editor blockquote {
  margin: 6px 0; padding: 2px 0 2px 10px;
  border-left: 3px solid #cbd5e1; color: #475467;
}
.composer-editor pre {
  margin: 6px 0; padding: 8px 10px; border-radius: 6px; background: #eef2f7;
  color: #334155; font-size: 12px; white-space: pre-wrap;
}
.composer-editor code {
  padding: 0 4px; border: 1px solid #e4e9f0; border-radius: 4px; background: #eef2f7;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px;
}
.composer .composer-fallback {
  display: block; width: 100%; min-height: 112px; height: auto; margin: 0;
  padding: 11px 13px; border: 0; border-radius: 0; background: #fff;
  color: #1d2939; font-size: 13px; line-height: 1.75; resize: vertical; box-shadow: none;
}
.composer .composer-fallback:focus { border: 0; outline: none; box-shadow: none; background: #fff; }
.composer.is-rich .composer-fallback { display: none; }

/* 附件 */
.composer-attach-row { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.attach-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px;
  border: 1px solid #dbe2ec; border-radius: 7px; background: #fff;
  color: #475467; font-size: 11.5px; font-weight: 600; cursor: pointer; transition: .15s ease;
}
.attach-btn:hover { border-color: #a8c2fb; background: #f8fbff; color: #1849b8; }
.composer-file-input {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  border: 0; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.attach-hint { color: #98a2b3; font-size: 10.5px; }
.composer-file-list { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.composer-file {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 3px 7px; border: 1px solid #e7ecf3; border-radius: 6px;
  background: #f8fafc; color: #475467; font-size: 10.5px;
}
.composer-file-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-file-size { color: #98a2b3; }
.composer-file-remove { padding: 0 1px; border: 0; background: transparent; color: #98a2b3; font-size: 14px; line-height: 1; }
.composer-file-remove:hover { color: #b42318; }

/* 底部状态 */
.composer-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.composer-scope-state {
  display: inline-flex; align-items: center; padding: 3px 8px;
  border: 1px solid #d8e4ff; border-radius: 6px; background: #eef4ff;
  color: #1d4ed8; font-size: 10.5px; font-weight: 650;
}
.composer.mode-note .composer-scope-state { border-color: #fde68a; background: #fffbeb; color: #b45309; }
.composer-count { color: #98a2b3; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.composer-count.over { color: #d92d20; font-weight: 700; }
.composer-submit { min-width: 96px; }
.composer-hint { margin-top: 8px; color: #98a2b3; font-size: 10.5px; }
.composer-alert {
  margin-top: 8px; padding: 6px 9px; border: 1px solid #fecdca; border-radius: 6px;
  background: #fef3f2; color: #b42318; font-size: 11px;
}
.conversation-locked {
  margin-top: 16px; padding: 12px 14px; border: 1px dashed #dbe2ec; border-radius: 8px;
  background: #f8fafc; color: #667085; font-size: 11.5px;
}

@media (max-width: 760px) {
  .composer-scope { grid-template-columns: 1fr; }
  .scope-option { padding: 9px 10px; }
  .composer-editor { min-height: 96px; max-height: 260px; }
  .composer-toolbar { gap: 1px; padding: 5px 6px; }
  .tool-btn { min-width: 26px; padding: 0 4px; }
  .tool-btn.tool-link, .tool-btn.tool-clear { padding: 0 5px; }
  .tool-sep { margin: 0 2px; }
  .composer-foot .spacer { display: none; }
  .composer-submit { width: 100%; order: 5; }
  .composer-hint { display: none; }
}

/* 对话滚动区：长工单只滚动消息，输入区始终可见 */
.conversation-scroll { max-height: 580px; overflow-y: auto; padding-right: 4px; scrollbar-gutter: stable; }
.conversation-scroll::-webkit-scrollbar { width: 6px; }
.conversation-scroll::-webkit-scrollbar-thumb { background: #d5dde8; border-radius: 3px; }
.conversation-scroll::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 760px) {
  .conversation-scroll { max-height: 52vh; }
}

/* ==========================================================================
   Workflow / approval
   ========================================================================== */
.badge-active { background: #ecfdf3; color: #067647; border: 1px solid #bbf7d0; }
.badge-draft { background: #f8fafc; color: #667085; border: 1px solid #e4e9f0; }
.badge-default { background: #eff4ff; color: #1849b8; border: 1px solid #d6e2fb; }
.badge-approval { background: #fffaeb; color: #b54708; border: 1px solid #fef0c7; }
.nav-badge-approval { background: #b54708; }

.workflow-stats .stat-card strong { font-size: 26px; }
.workflow-table td { vertical-align: top; }
.workflow-name { color: #1d2939; font-size: 13px; font-weight: 650; }
.workflow-name:hover { color: #1f5eff; }
.workflow-table .table-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 290px; }
.workflow-help-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.workflow-help-card { display: flex; gap: 12px; padding: 16px 18px; margin: 0; }
.workflow-help-icon {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: #eef4ff; color: #1f5eff; font-weight: 750; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.workflow-help-card strong { display: block; font-size: 13px; color: #1d2939; }
.workflow-help-card p { margin-top: 4px; color: #667085; font-size: 11.5px; line-height: 1.7; }

.field-span-2 { grid-column: 1 / -1; }
.check-card {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border: 1px solid #e4e9f0; border-radius: 9px; background: #fbfcfe; cursor: pointer;
}
.check-card:hover { border-color: #bfd3f8; background: #f8fbff; }
.check-card input { width: auto; margin: 3px 0 0; }
.check-card-body strong { display: block; font-size: 12.5px; color: #1d2939; }
.check-card-body small { display: block; margin-top: 2px; color: #667085; font-size: 11px; line-height: 1.6; }
.danger-panel { border-color: #fee4e2; background: #fffbfa; }
.danger-panel h3 { color: #b42318; }

/* Ticket flow panel */
.flow-panel { border-color: #dbe6fb; background: linear-gradient(180deg, #fff, #fbfdff); }
.flow-panel-head { align-items: flex-start; }
.flow-panel-head h3 { display: flex; align-items: center; gap: 8px; }
.flow-head-meta { display: flex; align-items: center; gap: 10px; }
.flow-percent { font-size: 12px; font-weight: 700; color: #1f5eff; }
.flow-status {
  display: inline-flex; align-items: center; border-radius: 6px; padding: 3px 8px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.flow-status-running { background: #eff8ff; color: #175cd3; border: 1px solid #d1e9ff; }
.flow-status-approval { background: #fffaeb; color: #b54708; border: 1px solid #fef0c7; }
.flow-status-rejected { background: #fef3f2; color: #b42318; border: 1px solid #fee4e2; }
.flow-status-completed { background: #ecfdf3; color: #067647; border: 1px solid #bbf7d0; }
.flow-status-cancelled { background: #f8fafc; color: #667085; border: 1px solid #e4e9f0; }
.flow-progress { height: 6px; border-radius: 4px; background: #eef2f7; overflow: hidden; margin: 0 0 16px; }
.flow-progress span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #1f5eff, #7aa2ff); transition: width .3s ease; }
.flow-notice {
  margin-bottom: 14px; padding: 10px 13px; border-radius: 8px; font-size: 12px;
  background: #f8fafc; color: #475467; border: 1px solid #e7ecf3;
}
.flow-notice-done { background: #f0fdf4; color: #067647; border-color: #bbf7d0; }
.flow-notice-cancelled { background: #f8fafc; color: #667085; }
.flow-timeline { display: flex; flex-direction: column; }
.flow-node { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.flow-node:last-child { padding-bottom: 0; }
.flow-node::before { content: ""; position: absolute; left: 12px; top: 25px; bottom: 0; width: 1px; background: #e4e9f0; }
.flow-node:last-child::before { display: none; }
.flow-node-marker {
  width: 25px; height: 25px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; background: #f2f4f7; color: #98a2b3;
  border: 1px solid #e4e7ec; position: relative; z-index: 1;
}
.flow-node-done .flow-node-marker { background: #ecfdf3; color: #067647; border-color: #a6f4c5; }
.flow-node-current .flow-node-marker { background: #eff4ff; color: #1f5eff; border-color: #b2ccff; box-shadow: 0 0 0 4px rgba(31, 94, 255, .1); }
.flow-node-approval .flow-node-marker { background: #fffaeb; color: #b54708; border-color: #fedf89; box-shadow: 0 0 0 4px rgba(181, 71, 8, .08); }
.flow-node-rejected .flow-node-marker { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.flow-node-body { flex: 1; min-width: 0; padding-bottom: 1px; }
.flow-node-head { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 12.5px; }
.flow-node-head strong { color: #1d2939; font-weight: 700; }
.flow-node-kind {
  font-size: 9.5px; font-weight: 700; color: #667085; background: #f2f4f7;
  border-radius: 4px; padding: 1px 6px;
}
.flow-state { font-size: 10px; font-weight: 700; border-radius: 5px; padding: 1px 6px; }
.flow-state-done { color: #067647; background: #ecfdf3; }
.flow-state-current { color: #175cd3; background: #eff8ff; }
.flow-state-approval { color: #b54708; background: #fffaeb; }
.flow-state-rejected { color: #b42318; background: #fef3f2; }
.flow-state-todo { color: #667085; background: #f8fafc; }
.flow-chip {
  display: inline-flex; align-items: center; border-radius: 5px; padding: 1px 7px;
  font-size: 9.5px; font-weight: 700; background: #f2f4f7; color: #475467;
}
.flow-chip-approval { background: #fffaeb; color: #b54708; border: 1px solid #fef0c7; }
.flow-attempts { font-size: 10px; color: #98a2b3; }
.flow-instruction { margin-top: 5px; font-size: 11.5px; color: #667085; line-height: 1.65; }
.flow-run { margin-top: 8px; padding: 10px 12px; border: 1px solid #eef2f6; border-radius: 8px; background: #fbfcfe; }
.flow-run-head { display: flex; flex-wrap: wrap; gap: 10px; font-size: 10.5px; color: #98a2b3; }
.flow-run-head strong { color: #475467; font-weight: 650; }
.flow-opinion, .flow-approval-opinion { margin-top: 6px; font-size: 12px; color: #344054; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.flow-opinion span, .flow-approval-opinion span {
  display: inline-block; margin-right: 6px; font-size: 9.5px; font-weight: 700;
  color: #667085; background: #f2f4f7; border-radius: 4px; padding: 1px 5px;
}
.flow-approval-opinion { color: #93370d; }
.flow-approval-opinion span { background: #fef0c7; color: #b54708; }
.flow-wait { margin-top: 6px; font-size: 11px; color: #b54708; }
.flow-rejected { margin-top: 6px; font-size: 11px; color: #b42318; }

.flow-action {
  margin-top: 16px; padding: 16px; border: 1px solid #e4e9f0; border-radius: 10px;
  background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.03);
}
.flow-action-approval { border-color: #fedf89; background: #fffdf5; }
.flow-action-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.flow-action-head h4 { font-size: 13px; color: #1d2939; }
.flow-form { display: flex; flex-direction: column; gap: 10px; }
.flow-form .field { gap: 5px; }
.flow-form textarea { min-height: 78px; }
.flow-approval-quote {
  margin-bottom: 10px; padding: 10px 12px; border-left: 3px solid #fdb022;
  background: #fffaeb; border-radius: 0 7px 7px 0;
}
.flow-approval-quote span { font-size: 10.5px; color: #b54708; font-weight: 650; }
.flow-approval-quote p { margin-top: 4px; font-size: 12px; color: #475467; line-height: 1.7; white-space: pre-wrap; }
.flow-action-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.flow-action-buttons .btn { flex: 1; min-width: 150px; }
.flow-approver-hint { font-size: 11px; color: #667085; padding: 8px 10px; background: #f8fafc; border: 1px dashed #dfe5ee; border-radius: 7px; }
.flow-approver-hint strong { color: #1d2939; }
.flow-empty-panel { border-style: dashed; background: #fbfcfe; }
.flow-binding { padding: 10px 12px; margin-bottom: 12px; border: 1px solid #eef2f6; border-radius: 8px; background: #f8fafc; }
.flow-binding-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.flow-binding-head strong { font-size: 12px; color: #1d2939; }
.flow-binding small { display: block; margin-top: 5px; font-size: 10.5px; color: #667085; line-height: 1.6; }
.flow-settings form { margin-top: 8px; }
.flow-design-link { display: inline-block; margin-top: 10px; font-size: 11px; font-weight: 650; }

/* Approval inbox */
.approval-summary {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; margin-bottom: 16px;
  border: 1px solid #fef0c7; border-radius: 10px; background: linear-gradient(120deg, #fffdf5, #fff);
}
.approval-summary-icon {
  width: 38px; height: 38px; border-radius: 10px; background: #fffaeb; color: #b54708;
  display: inline-flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800;
}
.approval-summary strong { display: block; font-size: 14px; color: #1d2939; }
.approval-summary small { display: block; margin-top: 2px; font-size: 11px; color: #667085; }
.approval-summary-rule { font-size: 11px; color: #b54708; background: #fffaeb; border-radius: 6px; padding: 4px 9px; }
.approval-list { display: flex; flex-direction: column; gap: 12px; }
.approval-card {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px;
  background: #fff; border: 1px solid #e7ecf3; border-radius: 12px; padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.approval-card-main { min-width: 0; }
.approval-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.approval-card-head strong { color: #1d2939; }
.flow-kind-chip {
  font-size: 9.5px; font-weight: 800; color: #b54708; background: #fffaeb;
  border: 1px solid #fef0c7; border-radius: 4px; padding: 1px 6px;
}
.approval-wf { margin-top: 4px; font-size: 11px; color: #667085; }
.approval-ticket {
  display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 9px 11px;
  border: 1px solid #eef2f6; border-radius: 7px; background: #fbfcfe; color: #344054; font-size: 12px;
}
.approval-ticket:hover { border-color: #bfd3f8; background: #f8fbff; text-decoration: none; }
.approval-ticket .mono { color: #98a2b3; flex-shrink: 0; }
.approval-arrow { margin-left: auto; color: #1f5eff; }
.approval-opinion { margin-top: 10px; padding: 10px 12px; border-left: 3px solid #d0d5dd; background: #f8fafc; border-radius: 0 7px 7px 0; }
.approval-opinion-label { font-size: 9.5px; font-weight: 700; color: #667085; letter-spacing: .3px; }
.approval-opinion p { margin-top: 3px; font-size: 12px; color: #344054; line-height: 1.7; white-space: pre-wrap; }
.approval-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 9px; font-size: 10.5px; color: #98a2b3; }
.approval-meta strong { color: #475467; }
.approval-form { display: flex; flex-direction: column; gap: 8px; border-left: 1px solid #eef2f6; padding-left: 20px; }
.approval-form textarea { min-height: 74px; }
.approval-actions { display: flex; flex-direction: column; gap: 7px; }
.approval-actions .btn { width: 100%; }

/* Notification / timeline colors */
.kind-approval { background: #fffaeb; color: #b54708; }
.kind-workflow { background: #eff4ff; color: #1849b8; }
.event-workflow .timeline-dot { background: #1f5eff; }
.event-approval .timeline-dot { background: #f79009; }
.event-workflow .event-tag { background: #eff4ff; color: #1849b8; }
.event-approval .event-tag { background: #fffaeb; color: #b54708; }
.timeline-item.event-workflow .timeline-content, .timeline-item.event-approval .timeline-content { background: #fbfcfe; }

@media (max-width: 1180px) {
  .approval-card { grid-template-columns: 1fr; }
  .approval-form { border-left: 0; border-top: 1px solid #eef2f6; padding-left: 0; padding-top: 14px; }
  .workflow-help-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .approval-summary { flex-wrap: wrap; }
  .approval-summary-rule { display: none; }
  .flow-action-buttons .btn { min-width: 100%; }
  .flow-run-head { gap: 6px; }
  .workflow-table .table-actions { max-width: none; }
}
.workflow-table td:nth-child(2) { white-space: nowrap; }
.workflow-table .table-actions { flex-wrap: nowrap; max-width: none; }
.workflow-table td:last-child { white-space: nowrap; }
.flow-node-skipped .flow-node-marker { background: #f8fafc; color: #98a2b3; border-style: dashed; }
.flow-state-skipped { color: #667085; background: #f8fafc; }
#workflow, #workflowSettings, #conversation, #progressForm { scroll-margin-top: 96px; }
.flow-node-cancelled .flow-node-marker { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.flow-state-cancelled { color: #b42318; background: #fef3f2; }
.instance-table td { vertical-align: top; }
.instance-ticket-title { display: block; margin-top: 2px; font-size: 11px; color: #475467; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.instance-table .flow-chip { margin-left: 6px; }
.flow-node-returned .flow-node-marker { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.flow-state-returned { color: #b42318; background: #fef3f2; }
.flow-return-reason { margin-top: 6px; font-size: 12px; color: #b42318; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.flow-return-reason span {
  display: inline-block; margin-right: 6px; font-size: 9.5px; font-weight: 700;
  color: #b42318; background: #fee4e2; border-radius: 4px; padding: 1px 5px;
}
.flow-returned { margin-top: 6px; font-size: 11px; color: #b42318; }
.flow-action-return { border-color: #fedf89; background: #fffdf5; }
.flow-chip-return { background: #fef3f2; color: #b42318; border: 1px solid #fee4e2; }
.flow-return-target {
  padding: 8px 10px; border: 1px dashed #fecdca; border-radius: 7px;
  background: #fffbfa; font-size: 11.5px; color: #93370d;
}
.flow-return-target strong { color: #b42318; }
.flow-side-panel { padding: 16px 18px; }
.flow-side-approval { border-color: #fedf89; background: #fffdf5; }
.flow-side-return { border-color: #fecdca; background: #fffbfa; }
.flow-side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.flow-side-head h3 { margin: 0; font-size: 14px; }
.flow-side-head small { display: block; margin-top: 2px; font-size: 10.5px; color: #667085; line-height: 1.5; }
.detail-side .flow-action-buttons { flex-direction: column; }
.detail-side .flow-action-buttons .btn { width: 100%; min-width: 0; }
.detail-side .flow-approval-quote { margin-bottom: 10px; }
.detail-side .flow-approval-quote p { max-height: 120px; overflow: auto; }
.detail-side .flow-form textarea { min-height: 70px; }
.flow-side-note { margin: 0; font-size: 10px; color: #98a2b3; line-height: 1.6; }

/* ---------- Web login: mini program QR ---------- */
.login-tabs {
  display: flex; gap: 4px; padding: 4px; margin: 4px 0 22px;
  background: #f2f6fb; border: 1px solid #e7edf5; border-radius: 10px;
}
.login-tab {
  flex: 1; border: 0; background: transparent; color: #667085;
  height: 34px; border-radius: 7px; font-size: 12px; font-weight: 650;
  cursor: pointer; transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.login-tab:hover { color: #1f5eff; }
.login-tab.active { background: #fff; color: #1849b8; box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.qr-login-panel { text-align: center; }
.qr-shell {
  width: 238px; height: 238px; margin: 4px auto 14px; border-radius: 14px;
  border: 1px solid #e4eaf2; background: #fbfdff;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.qr-image { width: 214px; height: 214px; display: block; }
.qr-placeholder { color: #98a2b3; font-size: 12px; }
.qr-status { font-size: 12px; color: #667085; font-weight: 650; min-height: 20px; }
.qr-status.qr-wait { color: #1f5eff; }
.qr-status.qr-ok { color: #067647; }
.qr-status.qr-error { color: #c2413a; }
.qr-help { margin-top: 6px; font-size: 11px; color: #8a96a8; line-height: 1.7; }
.qr-refresh { margin-top: 14px; }
.qr-tip { margin-top: 10px; font-size: 10.5px; color: #a4aebe; }
@media (max-width: 420px) {
  .qr-shell { width: 216px; height: 216px; }
  .qr-image { width: 194px; height: 194px; }
}

/* C 端个人用户没有项目：隐藏 AI 项目入口与提示，保留服务方/企业客户能力 */
.ai-layout.no-projects .project-field,
.ai-layout.no-projects .project-side-panel,
.ai-layout.no-projects .project-guide,
.ai-layout.no-projects #aiProjectWarn,
.ai-layout.no-projects #projectModal,
.ai-layout.no-projects .summary-chip.chip-project { display: none !important; }

/* 多次催办自动加急 */
.ticket-card.is-urgent { border-color: #fecaca; box-shadow: 0 0 0 1px rgba(220, 38, 38, .04), 0 5px 16px rgba(220, 38, 38, .06); }
.ticket-card-flags { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.urgent-chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 5px; background: #fef2f2; color: #c81e1e;
  border: 1px solid #fecaca; font-size: 10.5px; font-weight: 750; letter-spacing: .04em;
  white-space: nowrap;
}

/* ---------- Admin mail ingest ---------- */
.mail-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; align-items: start; }
.inline-form { margin: 0; }
.mail-toggle {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  border: 1px solid #e4eaf2; border-radius: 9px; background: #fbfdff;
  margin-bottom: 18px; cursor: pointer; font-size: 12px; color: #344054;
}
.mail-toggle input[type="checkbox"] {
  width: 16px; height: 16px; min-height: 0; margin: 0; flex: 0 0 16px;
  accent-color: #2563eb; cursor: pointer;
}
.mail-toggle > span { display: flex; flex-direction: column; gap: 2px; }
.mail-toggle small { color: #98a2b3; font-size: 11px; }
.mail-toggle.compact { margin: 2px 0 0; background: transparent; border: 0; padding: 0; }
.mail-status-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.mail-status-grid > div { padding: 12px 13px; border: 1px solid #e8eef6; border-radius: 9px; background: #fbfdff; }
.mail-status-grid span { display: block; font-size: 11px; color: #98a2b3; }
.mail-status-grid strong { display: block; margin-top: 4px; font-size: 13px; color: #1d2939; font-weight: 700; }
.text-ok { color: #067647 !important; }
.text-danger { color: #c81e1e !important; }
.text-muted { color: #98a2b3 !important; }
.mail-last-error { margin-top: 14px; font-size: 12px; }
.mail-meta { margin-top: 14px; display: flex; gap: 16px; color: #98a2b3; font-size: 10.5px; }
.mail-help { margin-top: 18px; padding-top: 16px; border-top: 1px solid #eef2f7; color: #667085; font-size: 12px; line-height: 1.7; }
.mail-help strong { color: #344054; }
.mail-help p { margin: 5px 0 0; }
.mail-security-note { margin: 14px 0 0; color: #98a2b3; font-size: 10.5px; }
.mail-table td { vertical-align: top; }
.mail-from { display: block; color: #98a2b3; font-size: 10px; margin-top: 2px; }
.mail-subject { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-badge { display: inline-flex; padding: 3px 7px; border-radius: 5px; font-size: 10px; font-weight: 650; background: #f2f5f9; color: #667085; white-space: nowrap; }
.badge-ticket { background: #ecfdf5; color: #067647; }
.badge-reply { background: #eff6ff; color: #1d4ed8; }
.badge-skip { background: #f8fafc; color: #98a2b3; }
.badge-error { background: #fef2f2; color: #c81e1e; }
.mail-error { display: block; color: #c2413a; font-size: 10px; margin-top: 3px; max-width: 220px; }
@media (max-width: 980px) { .mail-grid { grid-template-columns: 1fr; } }

.mail-src-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; font-size: 10px; font-weight: 650; }

/* ---------- Admin system settings ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
.settings-grid > .settings-submit { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; padding: 4px 0 8px; }
.settings-kv { margin-top: 20px; }
.settings-note { margin: 16px 0 0; color: #98a2b3; font-size: 11px; line-height: 1.7; }
.ai-config-state { display: flex; align-items: center; gap: 10px; margin-top: 18px; color: #98a2b3; font-size: 10.5px; }
.ai-config-state small { font-size: 10.5px; }
@media (max-width: 980px) { .settings-grid { grid-template-columns: 1fr; } .settings-grid > .settings-submit { grid-column: auto; } }

/* AI summary scope */
.settings-full { grid-column: 1 / -1; }
.summary-scope-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 18px; margin-top: 4px; }
.scope-title { font-size: 12px; font-weight: 650; color: #344054; margin-bottom: 9px; }
.scope-title small { margin-left: 8px; color: #98a2b3; font-weight: 400; }
.scope-options { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid #e4eaf2; border-radius: 7px; background: #fbfdff; color: #475467; font-size: 11px; cursor: pointer; }
.check-chip:has(input:checked) { border-color: #93b4f5; background: #eff6ff; color: #1849b8; }
.check-chip input { width: 14px; height: 14px; min-height: 0; margin: 0; accent-color: #2563eb; }
@media (max-width: 700px) { .summary-scope-grid { grid-template-columns: 1fr; } }

/* AI ticket summary */
.ai-summary-head { display: flex; align-items: center; gap: 10px; }
.ai-summary-text { white-space: pre-wrap; color: #344054; font-size: 13px; line-height: 1.8; background: #fbfdff; border: 1px solid #e8eef6; border-radius: 9px; padding: 14px 16px; }
.ai-summary-note { margin: 10px 0 0; color: #98a2b3; font-size: 10.5px; }

/* Ticket type management */
.type-desc-cell { max-width: 420px; color: #667085; font-size: 12px; line-height: 1.6; }
.type-actions { white-space: nowrap; }
.type-actions form { display: inline-block; margin-left: 4px; }
.type-used-hint { font-size: 10px; color: #98a2b3; }
.type-form-layout .form-main { min-width: 0; }

/* Auth brand refresh */
.auth-body {
  background: #f4f7fc;
  color: #172b4d;
}
.auth-shell {
  grid-template-columns: minmax(0, 1.06fr) minmax(440px, .94fr);
}
.auth-aside {
  justify-content: space-between;
  padding: clamp(42px, 6vh, 72px) clamp(38px, 6vw, 88px);
  border-right: 1px solid #e3eaf4;
  background:
    radial-gradient(circle at 12% 4%, rgba(69, 126, 245, .12), transparent 36%),
    linear-gradient(155deg, #f5f8ff 0%, #edf3fc 58%, #e9f3f3 100%);
}
.auth-aside::after { content: none; }
.auth-aside-content {
  position: relative;
  z-index: 1;
  width: min(580px, 100%);
  margin: auto;
}
.auth-ambient { position: absolute; border-radius: 50%; pointer-events: none; }
.auth-ambient-one {
  width: 430px; height: 430px; top: -230px; right: -180px;
  background: radial-gradient(circle, rgba(59, 130, 246, .12), rgba(59, 130, 246, 0) 70%);
}
.auth-ambient-two {
  width: 360px; height: 360px; left: -220px; bottom: -160px;
  background: radial-gradient(circle, rgba(5, 150, 105, .08), rgba(5, 150, 105, 0) 70%);
}
.auth-brand { gap: 14px; color: #14213d; }
.auth-logo {
  width: 54px; height: 54px; display: block; flex-shrink: 0;
  filter: drop-shadow(0 8px 12px rgba(37, 99, 235, .18));
}
.auth-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.auth-brand-text strong { font-size: 23px; font-weight: 800; letter-spacing: 2px; }
.auth-brand-text small { margin-top: 7px; color: #8a99af; font-size: 9px; font-weight: 650; letter-spacing: 2.2px; }
.auth-eyebrow { margin-top: clamp(44px, 8vh, 82px); color: #3472d5; font-size: 10px; font-weight: 750; letter-spacing: 2.6px; }
.auth-aside h1 {
  margin: 16px 0 0; color: #14213d; font-size: clamp(42px, 4.4vw, 62px);
  font-weight: 800; line-height: 1.22; letter-spacing: -1.5px;
}
.auth-lead { max-width: 510px; margin-top: 22px; color: #65758d; font-size: 15px; line-height: 1.9; }
.auth-points { gap: 22px; margin-top: 38px; }
.auth-points > div { display: flex; align-items: flex-start; }
.auth-points span {
  width: 29px; height: 29px; margin: 1px 14px 0 0; border: 1px solid #d8e5fa;
  border-radius: 9px; background: rgba(255,255,255,.8); color: #2563eb; font-size: 10px;
}
.auth-points strong { color: #334563; font-size: 14px; font-weight: 700; }
.auth-points p { margin: 5px 0 0; color: #8491a5; font-size: 12px; line-height: 1.6; }
.auth-foot {
  position: relative; z-index: 1; width: min(580px, 100%); margin: 40px auto 0;
  padding-top: 24px; color: #98a5b7; font-size: 11px; letter-spacing: 2px;
}
.auth-main {
  position: relative; padding: 46px 30px; overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(67, 124, 238, .08), transparent 34%),
    rgba(255,255,255,.52);
}
.auth-main::before {
  content: ''; position: absolute; width: 360px; height: 360px; left: -240px; bottom: -180px;
  border-radius: 50%; background: rgba(5, 150, 105, .035); pointer-events: none;
}
.auth-card {
  position: relative; z-index: 1; width: min(450px, 100%); padding: 36px;
  border: 1px solid #e0e7f1; border-radius: 24px;
  box-shadow: 0 24px 65px rgba(33, 57, 94, .09), 0 3px 10px rgba(33, 57, 94, .03);
}
.auth-copyright { position: relative; z-index: 1; letter-spacing: .4px; }
.auth-mobile-brand { display: none; }
@media (max-width: 1024px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-main { min-height: 100vh; padding: 34px 22px; }
  .auth-mobile-brand {
    position: relative; z-index: 1; display: flex; align-items: center; justify-content: center;
    gap: 12px; margin-bottom: 28px;
  }
  .auth-mobile-brand img { width: 48px; height: 48px; filter: drop-shadow(0 6px 10px rgba(37,99,235,.16)); }
  .auth-mobile-brand > div { display: flex; flex-direction: column; }
  .auth-mobile-brand strong { color: #14213d; font-size: 21px; letter-spacing: 2px; }
  .auth-mobile-brand small { margin-top: 5px; color: #8a99af; font-size: 8px; letter-spacing: 1.8px; }
}
@media (max-width: 520px) {
  .auth-main { justify-content: flex-start; padding: 30px 18px; }
  .auth-mobile-brand { margin-bottom: 24px; }
  .auth-card { padding: 26px 22px; border-radius: 20px; }
}

.summary-concurrency { max-width: 360px; margin-top: 16px; }

/* Multiple mail accounts */
.mail-accounts-table td { vertical-align: top; }
.mail-account-actions { white-space: nowrap; }
.mail-account-actions form { display: inline-block; margin-left: 4px; }
.mail-account-side { display: grid; gap: 18px; min-width: 0; }
.mail-account-form .form-submit-bar { margin-top: 16px; }
.mail-form-toggles { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 16px; }
.mail-summary-grid { margin-top: 16px; }

/* Spam / junk mail */
.spam-table td { vertical-align: top; }
.spam-subject { margin-top: 4px; font-size: 12px; color: #475467; }
.spam-reason { font-size: 11px; color: #b45309; background: #fffbeb; border-radius: 6px; padding: 3px 7px; }
.spam-actions { white-space: nowrap; }
.spam-actions form { display: inline-block; margin-left: 4px; }
.spam-preview { margin-top: 6px; }
.spam-preview summary { cursor: pointer; font-size: 10px; color: #667085; }
.spam-preview pre { white-space: pre-wrap; max-height: 180px; overflow: auto; background: #f8fafc; border: 1px solid #eef2f7; border-radius: 6px; padding: 8px; font-size: 11px; }

/* Mail receipts */
.receipt-list { display: flex; flex-direction: column; gap: 8px; }
.receipt-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border: 1px solid #e8eef6; border-radius: 9px; padding: 10px 12px; background: #fbfdff; }
.receipt-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.receipt-to { color: #475467; font-size: 12px; }
.receipt-subject { color: #98a2b3; overflow-wrap: anywhere; }
.receipt-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; white-space: nowrap; }

/* Flash messages: fixed top-right toast */
.flash {
  position: fixed;
  top: 76px;
  right: 26px;
  left: auto;
  z-index: 260;
  margin: 0;
  width: auto;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px 12px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 12px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-left: 4px solid #10b981;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .16), 0 3px 8px rgba(15, 23, 42, .07);
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.55;
  animation: flash-in .18s ease-out both;
  transition: opacity .15s ease, transform .15s ease;
}
.flash-hide { opacity: 0; transform: translateY(-6px); }
.flash-close {
  border: 0; background: transparent; color: #047857; cursor: pointer;
  font-size: 17px; line-height: 1; padding: 0 2px; margin-left: 2px;
}
.flash-close:hover { color: #065f46; }
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 720px) {
  .flash { top: 72px; left: 12px; right: 12px; max-width: none; }
}

/* Flow + conversation combined panel */
.activity-panel .conversation-head { margin-bottom: 0; }
.flow-accordion {
  margin: 14px 0 16px;
  border: 1px solid #e4ebf3;
  border-radius: 11px;
  background: #fbfdff;
  overflow: hidden;
}
.flow-accordion > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  user-select: none;
}
.flow-accordion > summary::-webkit-details-marker { display: none; }
.flow-accordion-icon {
  width: 27px; height: 27px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef2ff; color: #4f46e5; font-size: 14px; font-weight: 800;
}
.flow-accordion-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flow-accordion-title strong { font-size: 12.5px; color: #101828; }
.flow-accordion-title small { font-size: 10.5px; color: #98a2b3; }
.flow-accordion-summary .flow-percent { margin-left: 2px; }
.flow-accordion-chevron { color: #98a2b3; font-size: 16px; transition: transform .18s ease; }
.flow-accordion[open] .flow-accordion-chevron { transform: rotate(180deg); }
.flow-accordion-body { border-top: 1px solid #edf2f7; padding: 0 14px 14px; }
.flow-accordion-body .flow-progress { margin-top: 14px; }
.flow-unbound-note { margin: 14px 0 0; font-size: 12px; }
@media (max-width: 720px) {
  .flow-accordion-summary { flex-wrap: wrap; }
  .flow-accordion-summary .flow-percent { display: none; }
}

.event-email .timeline-dot { background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.12); }

/* Server-rendered document previews */
.viewer-document { width: 100%; max-width: 1200px; margin: 16px auto; padding: 28px; box-sizing: border-box; background: #fff; border-radius: 12px; overflow-wrap: anywhere; line-height: 1.8; }
.viewer-document p, .viewer-document pre, .viewer-document td { white-space: pre-wrap; }
.viewer-document table { border-collapse: collapse; min-width: 100%; }
.viewer-document td { border: 1px solid #e0e6ef; padding: 8px 12px; min-width: 100px; vertical-align: top; }
.viewer-document tr:first-child { background: #f0f5ff; }
.viewer-sheet { margin-bottom: 28px; }
.viewer-table-scroll { overflow-x: auto; }
@media (max-width: 760px) { .viewer-document { padding: 16px; overflow-x: auto; } }

/* One timeline and one composer for workflow actions and conversation. */
.timeline-current .timeline-dot { background: #1f5eff; box-shadow: 0 0 0 4px #e8efff; }
.timeline-current .timeline-body { border-left: 3px solid #1f5eff; background: #f5f8ff; padding: 14px; border-radius: 8px; }
.timeline-current-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.timeline-current .event-tag, .scope-workflow .scope-body strong { color: #1f5eff; }
.composer-flow-fields { margin: 10px 0; padding: 12px; border: 1px solid #dfe8ff; border-radius: 8px; background: #f8faff; }
.composer-flow-fields[hidden] { display: none; }

/* Bulk ticket management */
.bulk-form { margin-bottom: 14px; }
.bulk-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 10px 12px; border: 1px solid #e4ebf3; border-radius: 11px;
  background: #fbfdff; position: sticky; top: 8px; z-index: 8;
  box-shadow: 0 4px 14px rgba(15,23,42,.04);
}
.bulk-select-all { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #344054; white-space: nowrap; }
.bulk-count { font-size: 11px; color: #667085; white-space: nowrap; }
.bulk-divider { width: 1px; height: 20px; background: #e4ebf3; }
.bulk-field { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: #667085; }
.bulk-field select { min-width: 120px; }
.bulk-toolbar .btn { margin-left: auto; }
.ticket-bulk-row { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; align-items: start; }
.ticket-bulk-check { padding-top: 20px; display: flex; justify-content: center; }
.ticket-bulk-check input { width: 15px; height: 15px; accent-color: #2563eb; }
.ticket-bulk-row .ticket-card { min-width: 0; }
@media (max-width: 720px) {
  .bulk-toolbar { position: static; }
  .bulk-divider { display: none; }
  .bulk-toolbar .btn { margin-left: 0; }
}

/* Staff notification entry stays in the shared page header. */
.topbar-notifications { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 12px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #526580; font-size: 13px; font-weight: 500; }
.topbar-notifications svg { width: 19px; height: 19px; flex-shrink: 0; }
.topbar-notifications:hover, .topbar-notifications.active { color: var(--blue); background: #eff6ff; border-color: #bfdbfe; text-decoration: none; }
.topbar-notifications:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.topbar-unread { min-width: 19px; padding: 1px 5px; border-radius: 10px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 600; line-height: 17px; text-align: center; }
@media (max-width: 760px) {
  .topbar-notifications { min-width: 40px; padding: 8px; }
  .topbar-notifications-label { display: none; }
  .topbar-unread { position: absolute; top: -6px; right: -7px; }
}

/* Bulk user management */
.user-bulk-toolbar { margin-bottom: 12px; }
.bulk-check-col { width: 34px; text-align: center; }
.user-bulk-check { width: 15px; height: 15px; accent-color: #2563eb; }
.user-table td { vertical-align: middle; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Bulk controls are activated explicitly from the page header. */
.bulk-toolbar { display: none; }
body.bulk-mode .bulk-toolbar { display: flex; }
.ticket-bulk-row { grid-template-columns: minmax(0, 1fr); }
body.bulk-mode .ticket-bulk-row { grid-template-columns: 24px minmax(0, 1fr); }
.ticket-bulk-check { display: none; }
body.bulk-mode .ticket-bulk-check { display: flex; }
.user-table .bulk-check-col { display: none; }
body.bulk-mode .user-table .bulk-check-col { display: table-cell; }
.user-bulk-check { display: none; }
body.bulk-mode .user-bulk-check { display: inline-block; }

/* Ticket bulk console redesign */
.bulk-toolbar.bulk-console {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: #fff;
  top: 10px;
}
body.bulk-mode .bulk-toolbar.bulk-console { display: flex; }
.bulk-console-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #edf2f7;
}
.bulk-clear {
  border: 0; background: transparent; color: #667085; cursor: pointer;
  font-size: 11px; padding: 3px 6px; border-radius: 5px;
}
.bulk-clear:hover { background: #f1f5f9; color: #344054; }
.bulk-console-tip { font-size: 10.5px; color: #98a2b3; }
.bulk-console-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px;
}
.bulk-action-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #e4ebf3;
  border-radius: 9px;
  background: #fbfdff;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.bulk-action-card:hover { border-color: #b9d4f7; background: #f8fbff; }
.bulk-action-card input { position: absolute; opacity: 0; pointer-events: none; }
.bulk-action-card:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37,99,235,.1);
}
.bulk-action-icon {
  width: 22px; height: 22px; flex: none; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef2ff; color: #4f46e5; font-size: 12px; font-weight: 800;
}
.bulk-action-card:has(input:checked) .bulk-action-icon { background: #2563eb; color: #fff; }
.bulk-action-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bulk-action-text strong { font-size: 11.5px; color: #344054; }
.bulk-action-text small { font-size: 9.5px; color: #98a2b3; line-height: 1.35; }
.bulk-console-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid #edf2f7;
}
.bulk-console-context[hidden] { display: none; }
.bulk-context-field { display: flex; align-items: center; gap: 7px; }
.bulk-context-field[hidden] { display: none; }
.bulk-context-label { font-size: 10.5px; font-weight: 650; color: #667085; white-space: nowrap; }
.bulk-context-field select { min-width: 160px; }
.bulk-priority-chips { display: flex; gap: 5px; }
.bulk-priority-chips label {
  position: relative; display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid #e4ebf3; border-radius: 6px; background: #fff;
  padding: 4px 8px; font-size: 10.5px; color: #475467; cursor: pointer;
}
.bulk-priority-chips label:has(input:checked) {
  border-color: #2563eb; background: #eff6ff; color: #1d4ed8; font-weight: 650;
}
.bulk-priority-chips input { margin: 0; accent-color: #2563eb; }
.bulk-context-info { font-size: 10.5px; color: #667085; }
.bulk-context-hint { font-size: 10.5px; color: #b45309; }
.bulk-console-context .btn { margin-left: 0; }
@media (max-width: 900px) {
  .bulk-console-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .bulk-console-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bulk-console-tip { display: none; }
  .bulk-console-head { flex-wrap: wrap; }
  .bulk-context-field, .bulk-context-field select { width: 100%; }
}

.audience-choices { display: flex; flex-wrap: wrap; gap: 14px 24px; padding: 12px 0; }
.audience-choices label, .audience-enterprises label { display: flex; align-items: center; gap: 8px; }
.audience-choices input, .audience-enterprises input { width: 16px; height: 16px; flex: none; }
.audience-choices small { color: var(--muted); font-size: 12px; }
.audience-enterprises { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; max-height: 240px; overflow: auto; margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.type-audience-cell { min-width: 160px; max-width: 280px; }

/* Ticket trash */
.trash-actions { white-space: nowrap; }
.trash-actions form { display: inline-block; margin-left: 4px; }
.ticket-danger-zone { margin-top: 18px; border-color: #fee2e2; }
.ticket-danger-zone .panel-head h3 { color: #b42318; }
.ticket-danger-zone .btn-warn { margin-top: 6px; }

/* Merged trash tabs */
.trash-tabs { display: flex; gap: 4px; margin: 0 0 14px; padding: 4px; width: fit-content; max-width: 100%; background: #f1f5f9; border-radius: 10px; }
.trash-tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 7px; color: #667085; font-size: 12px; font-weight: 600; text-decoration: none; }
.trash-tab:hover { color: #344054; background: #eaf0f7; }
.trash-tab.active { color: #1d4ed8; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.trash-tab span { min-width: 18px; padding: 1px 6px; border-radius: 9px; background: #e2e8f0; color: #475467; font-size: 10px; text-align: center; }
.trash-tab.active span { background: #dbeafe; color: #1d4ed8; }

/* Grouped management navigation. */
.sidebar .brand, .sidebar-foot { flex-shrink: 0; }
.side-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; gap: 8px; margin: 4px -4px 12px; padding: 0 4px; scrollbar-width: thin; }
.nav-group { flex-shrink: 0; padding-top: 6px; }
.nav-group + .nav-group { border-top: 1px solid #edf1f6; }
.nav-group-heading { display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: 8px 12px; color: #8a96a8; font-size: 11px; font-weight: 600; letter-spacing: .5px; list-style: none; cursor: pointer; user-select: none; border-radius: 8px; }
.nav-group-heading::-webkit-details-marker { display: none; }
.nav-group-heading::marker { content: ''; }
.nav-group-heading:hover { color: #526580; background: #f8fafc; }
.nav-group-heading:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.nav-group-chevron { font-size: 19px; line-height: 14px; transform: rotate(0); transition: transform .15s ease; }
.nav-group[open] > .nav-group-heading .nav-group-chevron { transform: rotate(90deg); }
.nav-group-active > .nav-group-heading { color: #426593; }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px; }
.nav-group-items .nav-item { min-height: 40px; padding: 8px 12px; }
.sidebar-foot { padding-top: 14px; }
@media (prefers-reduced-motion: reduce) { .nav-group-chevron { transition: none; } }

.mail-template-layout { display:grid; grid-template-columns:minmax(0,1.3fr) minmax(320px,1fr); gap:22px; align-items:start; }
.mail-template-layout .panel { margin-bottom:18px; }
.mail-template-options,.mail-template-tools { display:flex; flex-wrap:wrap; gap:16px; margin-top:14px; }
.mail-template-options label { display:flex; align-items:center; gap:7px; font-size:13px; }
.mail-template-options input { width:16px; height:16px; }
.mail-template-variables { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:14px 0; color:var(--muted); font-size:12px; }
.mail-template-variables button { padding:4px 8px; border:1px solid var(--line); border-radius:6px; background:#f8fafc; color:#526580; font:11px monospace; }
.mail-template-source { font-family:ui-monospace,SFMono-Regular,monospace; font-size:12px; }
.mail-template-preview { position:sticky; top:90px; }
.mail-template-preview iframe { width:100%; height:480px; border:1px solid var(--line); border-radius:10px; margin-top:15px; background:#fff; }
.mail-template-preview pre { white-space:pre-wrap; font-size:12px; color:#64748b; }
@media(max-width:1050px) { .mail-template-layout {grid-template-columns:1fr;} .mail-template-preview {position:static;} }

/* Selected fourth logo: shared by web and mini program. */
.brand-mark.brand-logo { display: block; flex-shrink: 0; object-fit: contain; background: none; box-shadow: none; }
.auth-logo, .auth-mobile-brand img { border-radius: 12px; filter: none; object-fit: contain; }

.ticket-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ticket-title-row h2 { flex: 1; min-width: 0; }
