/* ═══════════════════════════════════════════════════════════════
   爽游国旅智能客服后台 — "Slate & Ember" Design System v2
   Dark premium admin · warm copper accents · refined layout
   ═══════════════════════════════════════════════════════════════ */

/* ─── 1. DESIGN TOKENS ─────────────────────────────────────── */
:root {
  --bg-base: #0b1018;
  --bg-surface: #111a26;
  --bg-elevated: #172232;
  --bg-hover: #1b2940;
  --bg-inset: #0d141e;

  --text-primary: #e4dfd6;
  --text-secondary: #8a96a8;
  --text-muted: #576478;
  --text-inverse: #0b1018;

  --accent: #c97b4b;
  --accent-hover: #da8f5f;
  --accent-bg: rgba(201, 123, 75, 0.10);
  --accent-border: rgba(201, 123, 75, 0.28);

  --success: #4caf82;
  --success-bg: rgba(76, 175, 130, 0.10);
  --success-border: rgba(76, 175, 130, 0.22);
  --danger: #d96060;
  --danger-bg: rgba(217, 96, 96, 0.10);
  --danger-border: rgba(217, 96, 96, 0.22);
  --info: #5b9bd5;
  --info-bg: rgba(91, 155, 213, 0.10);

  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.10);
  --border-focus: rgba(201, 123, 75, 0.45);

  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.40);

  --transition-fast: 120ms ease;
  --transition: 180ms ease;
  --transition-slow: 280ms ease;

  --sidebar-w: 256px;
}

/* ─── 2. RESET & BASE ──────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Outfit", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, sans-serif;
  color: var(--text-primary);
  background: var(--bg-base);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
}

textarea {
  resize: vertical;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

#app {
  min-height: 100vh;
}

/* ─── 3. SCROLLBAR & SELECTION ─────────────────────────────── */
::selection {
  background: rgba(201, 123, 75, 0.30);
  color: #fff;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ─── 4. ANIMATIONS ────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes subtlePulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* ─── 5. LOGIN PAGE ────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr minmax(320px, 420px);
  gap: 0;
  animation: fadeIn 400ms ease;
}

.login-hero {
  background: linear-gradient(155deg, #0f1824 0%, #152035 40%, #1a1a2e 100%);
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.login-hero::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 123, 75, 0.05) 0%, transparent 70%);
  animation: subtlePulse 8s ease-in-out infinite;
  pointer-events: none;
}

.login-hero h1 {
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.03em;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-hero p {
  margin: 0;
  max-width: 36rem;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.hero-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
  transition: border-color var(--transition);
  animation: fadeUp 400ms ease backwards;
}

.hero-card:nth-child(1) { animation-delay: 80ms; }
.hero-card:nth-child(2) { animation-delay: 160ms; }
.hero-card:nth-child(3) { animation-delay: 240ms; }

.hero-card:hover {
  border-color: var(--border-strong);
}

.hero-card strong {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-primary);
}

.hero-card span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.login-panel {
  background: var(--bg-surface);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  animation: slideInRight 350ms ease;
}

.panel-head h2 {
  margin: 4px 0 6px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-head p,
.login-tip,
.subcopy,
.muted-copy {
  color: var(--text-secondary);
  line-height: 1.65;
  font-size: 13px;
}

.login-tip {
  margin-top: 2px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  border: 1px solid rgba(91, 155, 213, 0.10);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ─── 6. EYEBROW ───────────────────────────────────────────── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

/* ─── 7. APP SHELL ─────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

/* ─── 8. SIDEBAR & NAVIGATION ──────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 16px 12px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-card {
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
}

.brand-card h1 {
  font-size: 14px;
  font-weight: 700;
  margin: 1px 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, #a85c2d 100%);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  box-shadow: 0 3px 10px rgba(201, 123, 75, 0.25);
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-caption {
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 6px 8px 4px;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  border: 1px solid transparent;
  background: transparent;
  transition: all var(--transition);
  font-size: 13px;
}

.nav-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  transition: all var(--transition);
}

.nav-icon svg {
  width: 15px;
  height: 15px;
}

.nav-text {
  min-width: 0;
  display: grid;
  gap: 0;
}

.nav-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.nav-link small {
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.nav-link:hover .nav-icon {
  background: rgba(255, 255, 255, 0.07);
}

.nav-link.active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.nav-link.active .nav-icon {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(201, 123, 75, 0.3);
}

.nav-link.active .nav-label {
  color: var(--text-primary);
}

.nav-link.active small {
  color: var(--text-secondary);
}

.sidebar-footer {
  margin-top: auto;
}

.mini-card {
  border-radius: var(--radius-sm);
  padding: 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
}

.mini-label,
.metric-label {
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.mini-value {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
}

.mini-meta {
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 11px;
}

/* ─── 9. MAIN SHELL & TOPBAR ──────────────────────────────── */
.main-shell {
  padding: 20px 24px;
  display: grid;
  gap: 16px;
  align-content: start;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.topbar h2 {
  margin: 2px 0 2px;
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.user-pill {
  display: grid;
  gap: 0;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.user-pill strong {
  font-size: 12px;
  font-weight: 600;
}

.user-pill span {
  color: var(--text-muted);
  font-size: 10.5px;
}

/* ─── 10. BUTTONS ──────────────────────────────────────────── */
.primary-button,
.ghost-button,
.danger-button,
.wide-button {
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, #a8602e 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(201, 123, 75, 0.18);
  border: 1px solid rgba(201, 123, 75, 0.3);
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
  box-shadow: 0 4px 14px rgba(201, 123, 75, 0.25);
  transform: translateY(-1px);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
}

.danger-button {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.danger-button:hover {
  background: rgba(217, 96, 96, 0.16);
}

.small-button {
  padding: 5px 10px;
  font-size: 12px;
}

.wide-button {
  width: 100%;
  padding: 11px 18px;
}

/* ─── 11. TAB BAR ──────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: fit-content;
}

.tab-btn {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

/* ─── 12. NOTIFICATIONS ────────────────────────────────────── */
.notice {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13px;
  animation: slideDown 250ms ease;
}

.notice-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.notice-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* ─── 13. LAYOUT GRIDS ────────────────────────────────────── */
.content-area {
  display: grid;
  gap: 16px;
}

.hero-metrics,
.dashboard-grid,
.detail-grid,
.workspace-grid,
.knowledge-grid,
.route-grid,
.triple-grid,
.form-grid,
.toolbar-grid {
  display: grid;
  gap: 12px;
}

.hero-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.workspace-grid {
  grid-template-columns: 280px minmax(0, 1fr);
}

.knowledge-grid {
  grid-template-columns: 260px minmax(0, 1fr);
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid.large-main {
  grid-template-columns: 1.3fr 1fr;
}

.detail-header {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.route-grid {
  grid-template-columns: 260px minmax(0, 1fr);
}

.triple-grid {
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
}

.form-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toolbar-grid {
  grid-template-columns: minmax(0, 1fr) 140px 140px 140px auto;
  align-items: end;
}

.toolbar-grid.compact {
  grid-template-columns: minmax(0, 1fr) auto;
}

.toolbar-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
}

.grow {
  grid-column: span 2;
}

/* ─── 14. CARDS & PANELS ──────────────────────────────────── */
.metric-card,
.feature-panel,
.detail-pane,
.workspace-sidebar,
.workspace-main,
.route-list-panel,
.route-editor-panel {
  border-radius: var(--radius-lg);
}

.metric-card,
.feature-panel,
.detail-pane,
.route-editor-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.metric-card {
  padding: 16px 18px;
  transition: border-color var(--transition);
}

.metric-card:hover {
  border-color: var(--border-strong);
}

.metric-value {
  margin-top: 8px;
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-hint {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.feature-panel,
.detail-pane,
.route-editor-panel {
  padding: 18px;
}

.spotlight {
  background: linear-gradient(145deg, var(--bg-surface) 0%, rgba(201, 123, 75, 0.03) 100%);
  border-color: var(--accent-border);
}

.feature-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.feature-points div {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
}

.feature-points strong {
  display: block;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.feature-points span {
  color: var(--text-secondary);
  font-size: 12px;
}

.panel-headline h3,
.section-heading h3,
.section-heading h4 {
  margin: 2px 0 0;
  font-weight: 650;
  font-size: 15px;
}

.section-heading h4 {
  font-size: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading > div p {
  margin: 4px 0 0;
}

.section-heading > span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.bullet-list {
  margin: 10px 0 0;
  padding-left: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 13px;
}

.bullet-list li::marker {
  color: var(--accent);
}

/* ─── 15. WORKSPACE & LIST PANELS ─────────────────────────── */
.workspace-sidebar,
.route-list-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.entity-list,
.stack-list {
  display: grid;
  gap: 4px;
}

.entity-list.tight,
.stack-list.compact {
  gap: 3px;
}

.entity-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.entity-card:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--border-strong);
}

.entity-card.active {
  border-color: var(--accent-border);
  background: var(--accent-bg);
}

.entity-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.entity-card-top strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-card-top span {
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
}

.entity-card-foot,
.muted-line,
.timeline-meta {
  color: var(--text-muted);
  font-size: 11.5px;
}

.entity-card-body,
.info-pairs,
.check-grid {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.muted-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-card-foot {
  margin-top: 3px;
}

/* ─── 16. TAGS ─────────────────────────────────────────────── */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  border: 1px solid rgba(201, 123, 75, 0.10);
}

/* ─── 17. FORMS & FIELDS ──────────────────────────────────── */
.field,
.stack-form {
  display: grid;
  gap: 6px;
}

.stack-form {
  gap: 14px;
}

.field > span {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(201, 123, 75, 0.07);
}

.field input[readonly] {
  opacity: 0.55;
  cursor: not-allowed;
}

.field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%238a96a8' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── 18. EDITORS ──────────────────────────────────────────── */
.editor-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
}

.editor-stack {
  display: grid;
  gap: 6px;
}

.editor-row,
.editor-card,
.timeline-card {
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  border: 1px solid var(--border);
}

.editor-row,
.editor-card {
  padding: 12px;
}

.editor-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.row-textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
}

.row-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(201, 123, 75, 0.07);
}

.editor-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.editor-card-top strong {
  font-size: 13px;
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── 19. CHAT ─────────────────────────────────────────────── */
.chat-timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0;
}

/* Each row = avatar + body, constrained to 72% max-width */
.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 72%;
}

/* Incoming (游客, tourist) → LEFT */
.chat-row.incoming {
  flex-direction: row;
  margin-right: auto;
}

/* Outgoing (客服, staff) → RIGHT */
.chat-row.outgoing {
  flex-direction: row-reverse;
  margin-left: auto;
}

/* System → CENTER */
.chat-row.system {
  flex-direction: row;
  max-width: 80%;
  margin: 0 auto;
  justify-content: center;
}

/* ── Avatar circle ── */
.chat-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}

.chat-avatar.incoming {
  background: linear-gradient(135deg, #3a7bd5, #2054a0);
  box-shadow: 0 2px 8px rgba(58, 123, 213, 0.35);
}

.chat-avatar.outgoing {
  background: linear-gradient(135deg, var(--accent), #8c4a1e);
  box-shadow: 0 2px 8px rgba(201, 123, 75, 0.35);
}

/* ── Body: sender + bubble + time ── */
.chat-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.chat-row.incoming .chat-body {
  align-items: flex-start;
}

.chat-row.outgoing .chat-body {
  align-items: flex-end;
}

/* Sender name */
.chat-sender {
  font-size: 11px;
  font-weight: 600;
  padding: 0 4px;
  white-space: nowrap;
}

.chat-row.incoming .chat-sender {
  color: #5b9bd5;
}

.chat-row.outgoing .chat-sender {
  color: var(--accent);
}

/* ── Bubble ── */
.chat-bubble {
  padding: 9px 13px;
  line-height: 1.75;
  font-size: 13.5px;
  word-break: break-word;
}

.chat-row.incoming .chat-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 2px 14px 14px 14px;
  color: var(--text-primary);
}

.chat-row.outgoing .chat-bubble {
  background: rgba(201, 123, 75, 0.13);
  border: 1px solid rgba(201, 123, 75, 0.25);
  border-radius: 14px 2px 14px 14px;
  color: var(--text-primary);
}

.chat-row.system .chat-bubble {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 5px 12px;
  text-align: center;
}

/* ── Timestamp ── */
.chat-time {
  font-size: 10.5px;
  color: var(--text-muted);
  padding: 0 4px;
  opacity: 0.65;
}

.chat-copy {
  word-break: break-word;
}

/* Hide old meta class if still referenced */
.chat-meta {
  display: none;
}

/* ─── 20. TIMELINE & STACK ─────────────────────────────────── */
.timeline-card {
  padding: 12px;
  display: grid;
  gap: 4px;
  transition: border-color var(--transition);
}

.timeline-card:hover {
  border-color: var(--border-strong);
}

.timeline-title {
  font-weight: 650;
  font-size: 13px;
  line-height: 1.45;
}

.timeline-copy {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 13px;
}

/* ─── 21. INFO PAIRS ───────────────────────────────────────── */
.info-pairs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-pairs div {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  display: grid;
  gap: 3px;
}

.info-pairs span {
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.info-pairs strong {
  font-size: 13px;
  word-break: break-all;
}

/* ─── 22. PERMISSIONS & CHECKS ─────────────────────────────── */
.check-item,
.permission-card {
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color var(--transition);
  font-size: 13px;
}

.check-item:hover,
.permission-card:hover {
  border-color: var(--border-strong);
}

.permission-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permission-card strong {
  display: block;
  font-size: 13px;
}

.permission-card span {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 11px;
}

/* ─── 22b. ACCESS PAGE REDESIGN ────────────────────────────── */

.ac-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.ac-stats-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ac-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.ac-stat-chip svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.ac-stat-chip strong {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 14px;
}

.ac-tab-group {
  display: flex;
  gap: 4px;
}

.ac-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.ac-tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.ac-tab-btn.active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.ac-tab-btn svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.ac-tab-btn.active svg {
  opacity: 1;
}

/* ── Workspace container ── */
.ac-workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 70vh;
  animation: fadeUp 300ms ease;
}

/* ── Left panel ── */
.ac-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.ac-panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.01);
}

.ac-panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.ac-count-pill {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 1px 7px;
}

.ac-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(201, 123, 75, 0.08);
  border: 1px solid rgba(201, 123, 75, 0.2);
  border-radius: 5px;
  padding: 3px 9px;
  cursor: pointer;
  transition: all var(--transition);
}

.ac-add-btn:hover {
  background: rgba(201, 123, 75, 0.14);
  border-color: rgba(201, 123, 75, 0.35);
}

.ac-add-btn svg {
  flex-shrink: 0;
}

/* ── List inside panel ── */
.ac-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ac-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  transition: all 0.14s;
  flex-shrink: 0;
}

.ac-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.ac-list-item.is-active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.ac-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(201, 123, 75, 0.15), rgba(201, 123, 75, 0.06));
  border: 1px solid rgba(201, 123, 75, 0.12);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.ac-list-item.is-active .ac-item-avatar {
  background: linear-gradient(135deg, var(--accent), #a85c2d);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(201, 123, 75, 0.3);
}

.ac-item-shield {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition);
}

.ac-list-item.is-active .ac-item-shield {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.ac-item-info {
  min-width: 0;
  flex: 1;
}

.ac-item-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.ac-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  line-height: 1.3;
}

.ac-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ac-status-dot.is-active {
  background: var(--success);
  box-shadow: 0 0 6px rgba(76, 175, 130, 0.4);
}

.ac-status-dot.is-disabled {
  background: var(--text-muted);
  opacity: 0.4;
}

.ac-perm-count {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 1px 7px;
  flex-shrink: 0;
}

.ac-list-item.is-active .ac-perm-count {
  background: rgba(201, 123, 75, 0.15);
  color: var(--accent);
}

/* ── Editor column ── */
.ac-editor-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.ac-editor-hd {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.01);
}

.ac-editor-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ac-editor-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #a85c2d);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(201, 123, 75, 0.25);
}

.ac-editor-shield {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  flex-shrink: 0;
}

.ac-editor-name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.ac-editor-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
  display: block;
}

.ac-editor-code {
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 11.5px;
  color: var(--accent);
  background: rgba(201, 123, 75, 0.1);
  border: 1px solid rgba(201, 123, 75, 0.18);
  border-radius: 4px;
  padding: 1px 7px;
  margin-top: 2px;
  display: inline-block;
}

/* ── Editor body ── */
.ac-editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}

.ac-form {
  display: grid;
  gap: 22px;
}

.ac-section {
  display: grid;
  gap: 12px;
}

.ac-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.ac-section-label::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.7;
}

.ac-section-count {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  margin-left: auto;
  text-transform: none;
  letter-spacing: normal;
}

/* ── Role cards ── */
.ac-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.ac-role-card {
  position: relative;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition);
}

.ac-role-card:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.035);
}

.ac-role-card.is-checked {
  border-color: var(--accent-border);
  background: var(--accent-bg);
}

.ac-role-card-body {
  min-width: 0;
}

.ac-role-card-body strong {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1.35;
}

.ac-role-card-body code {
  display: block;
  margin-top: 2px;
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 10.5px;
  color: var(--text-muted);
}

.ac-role-card.is-checked .ac-role-card-body code {
  color: var(--accent);
}

/* ── Permission cards ── */
.ac-perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.ac-perm-card {
  position: relative;
  border-radius: var(--radius-sm);
  padding: 12px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition);
}

.ac-perm-card:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.035);
  transform: translateY(-1px);
}

.ac-perm-card.is-checked {
  border-color: var(--accent-border);
  background: var(--accent-bg);
  box-shadow: 0 2px 10px rgba(201, 123, 75, 0.08);
}

.ac-perm-card-content {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.ac-perm-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
  grid-row: 1 / 3;
}

.ac-perm-card.is-checked .ac-perm-icon {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(201, 123, 75, 0.3);
}

.ac-perm-card-content strong {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1.3;
}

.ac-perm-card-content code {
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.2;
}

.ac-perm-card.is-checked .ac-perm-card-content code {
  color: var(--accent);
}

/* ── Form footer ── */
.ac-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ── Empty state ── */
.ac-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--text-muted);
  text-align: center;
}

.ac-empty-state svg {
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ac-empty-state h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--text-secondary);
}

.ac-empty-state p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-base);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  position: relative;
}

input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(201, 123, 75, 0.12);
}

/* ─── 23. TABLES ───────────────────────────────────────────── */
.table-wrap {
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

.data-table th,
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.data-table th {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 650;
  background: rgba(255, 255, 255, 0.02);
  position: sticky;
  top: 0;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ─── 24. EMPTY STATES & ERRORS ────────────────────────────── */
.empty-state,
.error-block {
  border-radius: var(--radius-md);
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
}

.empty-state h3,
.empty-state h4 {
  color: var(--text-primary);
  margin: 0 0 4px;
  font-size: 14px;
}

.empty-state p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state.slim {
  min-height: 160px;
  display: grid;
  place-items: center;
  place-content: center;
}

.error-block {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "JetBrains Mono", "SF Mono", monospace;
  font-size: 12px;
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

/* ─── 25. ROUTE STUDIO ─────────────────────────────────────── */
.route-studio {
  /* context marker */
}

/* ─── 26. SESSION PAGE ─────────────────────────────────────── */

/* Filter row */
.filter-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-search {
  flex: 1;
  min-width: 180px;
}

.filter-field {
  width: 120px;
  flex-shrink: 0;
}

.filter-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  padding-bottom: 1px;
}

/* Session master-detail layout */
.session-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  min-height: 70vh;
}

.session-list-panel {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.panel-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header-bar h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid rgba(201, 123, 75, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.session-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

/* Session cards in list */
.session-card {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  display: grid;
  gap: 3px;
  margin-bottom: 2px;
}

.session-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
}

.session-card.active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.session-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}

.session-card-head strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-lang-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.session-card-product {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-card-msg {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.session-card-time {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Session detail panel */
.session-detail-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Info strip - replaces 4 giant metric cards */
.session-info-strip {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.info-chip {
  padding: 10px 16px;
  border-right: 1px solid var(--border);
  display: grid;
  gap: 1px;
  min-width: 0;
}

.info-chip:last-child {
  border-right: none;
}

.info-chip span {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.info-chip strong {
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.info-chip.accent {
  background: var(--accent-bg);
}

.info-chip.accent strong {
  color: var(--accent);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

/* Tab bar inside session detail */
.session-detail-panel > .tab-bar {
  margin: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.015);
  border: none;
  border-bottom: 1px solid var(--border);
  width: 100%;
  padding: 4px 8px;
}

.tab-count {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  margin-left: 3px;
  opacity: 0.7;
}

.tab-btn.active .tab-count {
  color: var(--accent);
  opacity: 1;
}

/* Tab content area */
.session-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Context tab */
.context-section {
  margin-bottom: 20px;
}

.context-section h4 {
  font-size: 13px;
  font-weight: 650;
  margin: 0 0 10px;
  color: var(--text-primary);
}

.section-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-left: 6px;
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.context-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  display: grid;
  gap: 2px;
}

.context-item span {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.context-item strong {
  font-size: 13px;
  word-break: break-all;
}

/* Reply list (context tab) */
.reply-list {
  display: grid;
  gap: 6px;
}

.reply-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  border: 1px solid var(--border);
  display: grid;
  gap: 4px;
}

.reply-item-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.reply-item-route {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.reply-item-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
}

/* Reply log tab */
.reply-log-list {
  display: grid;
  gap: 8px;
}

.reply-log-entry {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-base);
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.reply-log-header {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.reply-log-time {
  font-size: 11px;
  color: var(--text-muted);
}

.reply-log-model,
.reply-log-source {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.reply-log-question {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.reply-log-answer {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.015);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ─── 27. SCROLLABLE PANELS ────────────────────────────────── */
.workspace-sidebar .entity-list,
.route-list-panel .entity-list {
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 2px;
}

.triple-grid > .entity-list {
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 2px;
}

.workspace-main {
  min-width: 0;
}

/* ─── 27. KNOWLEDGE BASE REDESIGN ─────────────────────────── */

/* Top header row: stats + tabs */
.kb-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.kb-stats-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kb-stat {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.kb-stat strong {
  color: var(--text-primary);
  font-weight: 700;
  margin-right: 3px;
}

.kb-stat-sep {
  color: var(--border-strong);
  font-size: 14px;
}

.kb-tab-group {
  display: flex;
  gap: 4px;
}

.kb-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.kb-tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.kb-tab-btn.active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.kb-tab-btn svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.kb-tab-count {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.kb-tab-btn.active .kb-tab-count {
  background: rgba(201, 123, 75, 0.15);
  color: var(--accent);
}

/* ── Workspace container ── */
.kb-workspace {
  display: grid;
  grid-template-columns: 180px 220px minmax(0, 1fr);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 72vh;
}

.kb-workspace--routes {
  grid-template-columns: 280px minmax(0, 1fr);
}

/* ── Panel column ── */
.kb-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.kb-panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.01);
}

.kb-panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.kb-count-pill {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 1px 7px;
}

/* ── Scrollable list inside panel ── */
.kb-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kb-list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  transition: all 0.13s;
  flex-shrink: 0;
}

.kb-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.kb-list-item.is-active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.kb-item-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  line-height: 1.3;
}

.kb-item-mono {
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 11.5px;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.kb-list-item.is-active .kb-item-mono {
  color: var(--accent);
}

.kb-item-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.kb-item-hint {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.3;
}

.kb-list-empty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 12px;
  margin: 0;
}

/* ── Chip badges ── */
.kb-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.kb-chip.accent {
  background: rgba(201, 123, 75, 0.16);
  color: var(--accent);
}

.kb-chip.dim {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  opacity: 0.9;
}

/* ── Editor column ── */
.kb-editor-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Editor header when direct child of col (route view) */
.kb-editor-col > .kb-editor-hd {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.01);
}

/* Settings bar at top of editor */
.kb-settings-bar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.01);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-settings-hd {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-settings-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.kb-code-tag {
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 11px;
  color: var(--accent);
  background: rgba(201, 123, 75, 0.1);
  border: 1px solid rgba(201, 123, 75, 0.2);
  border-radius: 4px;
  padding: 1px 6px;
}

.kb-settings-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.field.compact {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field.compact span {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.field.compact input {
  height: 30px;
  font-size: 12.5px;
  padding: 0 8px;
}

.kb-inline-save {
  height: 30px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), #a8602e);
  color: #fff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition);
}

.kb-inline-save:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  box-shadow: 0 2px 10px rgba(201, 123, 75, 0.3);
}

/* ── Editor body (scrollable) ── */
.kb-editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Entry editor header */
.kb-editor-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.kb-entry-code {
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.kb-route-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.kb-editor-badges {
  display: flex;
  gap: 5px;
}

/* Form inside editor */
.kb-form {
  display: grid;
  gap: 14px;
}

/* Field hint */
.field-hint {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

/* Empty state */
.kb-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--text-muted);
  text-align: center;
}

.kb-empty-state svg {
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kb-empty-state h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--text-secondary);
}

.kb-empty-state p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ── Route search ── */
.kb-route-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.kb-search-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  gap: 0;
  transition: border-color var(--transition);
}

.kb-search-wrap:focus-within {
  border-color: var(--accent-border);
}

.kb-search-ico {
  margin: 0 8px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.kb-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 12.5px;
  color: var(--text-primary);
  padding: 7px 0;
  min-width: 0;
  font-family: inherit;
}

.kb-search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.kb-search-btn {
  padding: 0 10px;
  height: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  align-self: stretch;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.kb-search-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* ── Route editor sections ── */
.kb-section {
  display: grid;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.kb-section:last-of-type {
  border-bottom: none;
}

.kb-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kb-section-hd > span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-section-hd > span::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.7;
}

.kb-add-btn {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(201, 123, 75, 0.08);
  border: 1px solid rgba(201, 123, 75, 0.2);
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.kb-add-btn:hover {
  background: rgba(201, 123, 75, 0.14);
  border-color: rgba(201, 123, 75, 0.35);
}

/* ─── 26b. OVERVIEW PAGE REDESIGN ──────────────────────────── */

/* ── Hero metric cards ── */
.ov-hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ov-hero-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: fadeUp 350ms ease backwards;
}

.ov-hero-card:nth-child(1) { animation-delay: 0ms; }
.ov-hero-card:nth-child(2) { animation-delay: 80ms; }
.ov-hero-card:nth-child(3) { animation-delay: 160ms; }
.ov-hero-card:nth-child(4) { animation-delay: 240ms; }

.ov-hero-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
}

.ov-hero--sessions::after { background: linear-gradient(90deg, #4285f4, #6ea8f7); }
.ov-hero--replies::after { background: linear-gradient(90deg, #db5338, #e8836e); }
.ov-hero--web::after { background: linear-gradient(90deg, #9b6dd7, #c4a0eb); }
.ov-hero--kb::after { background: linear-gradient(90deg, #4caf82, #7dd4a8); }

/* ── Ring chart ── */
.ov-ring-wrap {
  width: 68px;
  height: 68px;
  position: relative;
  flex-shrink: 0;
}

.ov-ring {
  width: 100%;
  height: 100%;
}

@keyframes ovRingDraw {
  from { stroke-dashoffset: 214; }
}

.ov-ring-arc {
  animation: ovRingDraw 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  filter: drop-shadow(0 0 4px currentColor);
}

.ov-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.ov-ring-label small {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 1px;
}

/* ── Hero body ── */
.ov-hero-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ov-hero-sup {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ov-hero-num {
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.15;
}

.ov-hero--sessions .ov-hero-num { color: #6ea8f7; }
.ov-hero--replies .ov-hero-num { color: #e8836e; }
.ov-hero--web .ov-hero-num { color: #c4a0eb; }
.ov-hero--kb .ov-hero-num { color: #7dd4a8; }

.ov-hero-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ov-hero-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--success);
  font-weight: 600;
  font-size: 11.5px;
}

/* ── Pulse animation ── */
@keyframes ovPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.6); }
}

.ov-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  animation: ovPulse 2s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(76, 175, 130, 0.5);
}

/* ── KB mini bar chart ── */
.ov-kb-visual {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 8px;
}

.ov-kb-bar-group {
  display: flex;
  gap: 8px;
  height: 100%;
  align-items: flex-end;
}

.ov-kb-bar {
  width: 18px;
  height: 100%;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

@keyframes ovBarGrow {
  from { height: 0; }
}

.ov-kb-bar-fill {
  border-radius: 4px;
  animation: ovBarGrow 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.ov-kb-bar--general {
  background: linear-gradient(180deg, #4caf82, #37855f);
}

.ov-kb-bar--route {
  background: linear-gradient(180deg, #7dd4a8, #4caf82);
  opacity: 0.7;
}

.ov-kb-legend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.ov-kb-dot {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  flex-shrink: 0;
}

.ov-kb-dot--general { background: #4caf82; }
.ov-kb-dot--route { background: #7dd4a8; }

/* ── Panels grid ── */
.ov-panels {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}

.ov-panel {
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeUp 400ms ease backwards;
  animation-delay: 300ms;
}

.ov-panel--tips {
  animation-delay: 380ms;
}

.ov-panel-hd {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ov-panel-hd > svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
  opacity: 0.7;
}

.ov-panel-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.ov-panel-hd h3 {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Engine bars ── */
.ov-engine-bars {
  display: grid;
  gap: 12px;
}

.ov-engine-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 50px;
  gap: 10px;
  align-items: center;
}

.ov-engine-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.ov-engine-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

@keyframes ovBarSlide {
  from { width: 0; }
}

.ov-engine-fill {
  height: 100%;
  border-radius: 4px;
  animation: ovBarSlide 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  box-shadow: 0 0 8px currentColor;
}

.ov-engine-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ov-engine-footer {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.ov-engine-stat {
  flex: 1;
  display: grid;
  gap: 2px;
  text-align: center;
}

.ov-engine-stat + .ov-engine-stat {
  border-left: 1px solid var(--border);
}

.ov-engine-stat span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ov-engine-stat strong {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ── Tips list ── */
.ov-tips-list {
  display: grid;
  gap: 10px;
}

.ov-tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  transition: border-color var(--transition), background var(--transition);
}

.ov-tip:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
}

.ov-tip-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ov-tip-icon--orange {
  background: rgba(201, 123, 75, 0.12);
  border: 1px solid rgba(201, 123, 75, 0.18);
  color: var(--accent);
}

.ov-tip-icon--blue {
  background: rgba(66, 133, 244, 0.12);
  border: 1px solid rgba(66, 133, 244, 0.18);
  color: #4285f4;
}

.ov-tip-icon--purple {
  background: rgba(155, 109, 215, 0.12);
  border: 1px solid rgba(155, 109, 215, 0.18);
  color: #9b6dd7;
}

.ov-tip-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─── 27a. SESSION PAGE REDESIGN ───────────────────────────── */

/* ── Workspace container ── */
.ss-workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 78vh;
  animation: fadeUp 280ms ease;
}

/* ── Sidebar: search + list ── */
.ss-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.10);
  overflow: hidden;
}

.ss-search-bar {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 6px;
  flex-shrink: 0;
}

.ss-search-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color var(--transition);
  overflow: hidden;
}

.ss-search-wrap:focus-within {
  border-color: var(--accent-border);
}

.ss-search-ico {
  margin: 0 9px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.ss-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 12.5px;
  color: var(--text-primary);
  padding: 8px 8px 8px 0;
  min-width: 0;
  font-family: inherit;
}

.ss-search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.ss-filter-row {
  display: flex;
  gap: 4px;
}

.ss-filter-select,
.ss-filter-input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--transition);
}

.ss-filter-select:focus,
.ss-filter-input:focus {
  outline: none;
  border-color: var(--accent-border);
}

.ss-filter-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 3.5L5 6L7.5 3.5' stroke='%23576478' stroke-width='1.2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  padding-right: 16px;
}

.ss-filter-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.ss-filter-btn:hover {
  background: var(--accent-hover);
}

.ss-filter-btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.ss-filter-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

/* ── List header ── */
.ss-list-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ss-list-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.ss-list-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid rgba(201, 123, 75, 0.12);
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

/* ── Session cards ── */
.ss-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.ss-card {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  transition: all 0.14s;
  margin-bottom: 1px;
}

.ss-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
}

.ss-card.is-active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.ss-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(91, 155, 213, 0.12);
  border: 1px solid rgba(91, 155, 213, 0.15);
  color: var(--info);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.ss-card.is-active .ss-card-avatar {
  background: linear-gradient(135deg, var(--accent), #a85c2d);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(201, 123, 75, 0.3);
}

.ss-card-body {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.ss-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}

.ss-card-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.ss-card-time {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.ss-card-product {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-card-preview {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* ── Detail panel ── */
.ss-detail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.ss-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
}

.ss-empty svg { color: var(--text-muted); margin-bottom: 4px; }
.ss-empty h4 { margin: 0; font-size: 15px; font-weight: 650; color: var(--text-secondary); }
.ss-empty p { margin: 0; font-size: 12.5px; color: var(--text-muted); }

/* ── Detail header ── */
.ss-detail-header {
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ss-detail-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
}

.ss-detail-avatar {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(91, 155, 213, 0.2), rgba(91, 155, 213, 0.08));
  border: 1px solid rgba(91, 155, 213, 0.2);
  color: var(--info);
  font-weight: 800;
  font-size: 17px;
  flex-shrink: 0;
}

.ss-detail-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.ss-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.ss-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.ss-chip--status {
  color: var(--success);
  background: var(--success-bg);
  border-color: var(--success-border);
}

.ss-status-light {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 5px rgba(76, 175, 130, 0.5);
}

.ss-chip--time {
  color: var(--text-muted);
}

.ss-chip--accent {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: rgba(201, 123, 75, 0.15);
}

/* ── Tabs ── */
.ss-detail-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 16px;
  background: rgba(255, 255, 255, 0.01);
}

.ss-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.ss-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.ss-tab.is-active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.ss-tab svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.ss-tab.is-active svg {
  opacity: 1;
}

.ss-tab-count {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 1px 6px;
  color: var(--text-muted);
}

.ss-tab.is-active .ss-tab-count {
  background: rgba(201, 123, 75, 0.15);
  color: var(--accent);
}

/* ── Detail body ── */
.ss-detail-body {
  flex: 1;
  overflow-y: auto;
}

/* ═══════════════════════════════════════
   CHAT MESSAGES — the core rework
   ═══════════════════════════════════════ */

.ss-chat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 28px;
  background:
    radial-gradient(ellipse at 85% 10%, rgba(66, 133, 244, 0.035) 0%, transparent 45%),
    radial-gradient(ellipse at 15% 90%, rgba(219, 83, 56, 0.03) 0%, transparent 45%),
    linear-gradient(180deg, var(--bg-inset) 0%, rgba(11, 16, 24, 0.98) 100%);
  min-height: 100%;
  position: relative;
}

/* ── Message row ── */
.ss-msg {
  display: flex;
  gap: 10px;
  max-width: 72%;
  padding: 2px 0;
}

/* Customer = RIGHT (blue theme) */
.ss-msg--customer {
  flex-direction: row-reverse;
  margin-left: auto;
}

/* Agent = LEFT (red/warm theme) */
.ss-msg--agent {
  flex-direction: row;
  margin-right: auto;
}

.ss-msg--system {
  max-width: 65%;
  margin: 10px auto;
  justify-content: center;
}

/* ── Avatar ── */
.ss-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  color: #fff;
  margin-top: 20px;
  position: relative;
  letter-spacing: 0.02em;
}

/* Customer avatar — BLUE */
.ss-msg-avatar--customer {
  background: linear-gradient(140deg, #4285f4 0%, #2b5ea7 100%);
  box-shadow:
    0 3px 10px rgba(66, 133, 244, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Agent avatar — RED/WARM */
.ss-msg-avatar--agent {
  background: linear-gradient(140deg, #db5338 0%, #a63525 100%);
  box-shadow:
    0 3px 10px rgba(219, 83, 56, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ── Content wrapper ── */
.ss-msg-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ss-msg--customer .ss-msg-content {
  align-items: flex-end;
}

.ss-msg--agent .ss-msg-content {
  align-items: flex-start;
}

/* ── Head: sender + time ── */
.ss-msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px;
}

.ss-msg--customer .ss-msg-head {
  flex-direction: row-reverse;
}

.ss-msg-sender {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Customer name — BLUE */
.ss-msg-sender--customer {
  color: #6ea8f7;
}

/* Agent name — RED */
.ss-msg-sender--agent {
  color: #e8836e;
}

.ss-msg-read {
  font-size: 10px;
  color: #4caf82;
  font-weight: 600;
}

.ss-msg-time {
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.ss-msg:hover .ss-msg-time {
  opacity: 1;
}

/* ── Bubble ── */
.ss-msg-bubble {
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.78;
  word-break: break-word;
  position: relative;
  max-width: 100%;
}

/* Customer bubble — BRIGHT BLUE, right side */
.ss-msg-bubble--customer {
  background: #1e5bc6;
  border: none;
  border-radius: 16px 4px 16px 16px;
  color: #fff;
  box-shadow: 0 2px 12px rgba(30, 91, 198, 0.35);
}

/* Agent bubble — WARM CORAL, left side */
.ss-msg-bubble--agent {
  background: #b8432d;
  border: none;
  border-radius: 4px 16px 16px 16px;
  color: #fff;
  box-shadow: 0 2px 12px rgba(184, 67, 45, 0.3);
}

/* ── System message ── */
.ss-msg-sys-pill {
  padding: 5px 16px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  backdrop-filter: blur(4px);
}

/* ── Context tab ── */
.ss-context-area {
  padding: 20px;
  display: grid;
  gap: 24px;
}

.ss-ctx-section {
  display: grid;
  gap: 12px;
}

.ss-ctx-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.ss-ctx-label::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.7;
}

.ss-ctx-count {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  margin-left: auto;
  text-transform: none;
  letter-spacing: normal;
}

.ss-ctx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.ss-ctx-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  display: grid;
  gap: 2px;
}

.ss-ctx-item span {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.ss-ctx-item strong {
  font-size: 13px;
  word-break: break-all;
}

.ss-ctx-replies {
  display: grid;
  gap: 6px;
}

.ss-ctx-reply {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  display: grid;
  gap: 4px;
}

.ss-ctx-reply-hd {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ss-ctx-reply-time {
  font-size: 11px;
  color: var(--text-muted);
}

.ss-ctx-reply-source {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.ss-ctx-reply-route {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ss-ctx-reply-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
}

/* ── Replies tab ── */
.ss-replies-area {
  display: grid;
  gap: 0;
}

.ss-reply-entry {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.ss-reply-entry:last-child {
  border-bottom: none;
}

.ss-reply-hd {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.ss-reply-time {
  font-size: 11px;
  color: var(--text-muted);
}

.ss-reply-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.ss-reply-badge--dim {
  opacity: 0.7;
}

.ss-reply-question {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.ss-reply-answer {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.015);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ─── 27b. REPORTS PAGE REDESIGN ───────────────────────────── */

/* Toolbar */
.rp-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 14px;
}

.rp-toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rp-period-group {
  display: flex;
  gap: 3px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px;
}

.rp-period-btn {
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.rp-period-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.rp-period-btn.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.rp-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rp-export-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.rp-export-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
}

.rp-export-link svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* ── Metrics row ── */
.rp-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.rp-metric-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), transform var(--transition);
  animation: fadeUp 300ms ease backwards;
}

.rp-metric-card:nth-child(1) { animation-delay: 0ms; }
.rp-metric-card:nth-child(2) { animation-delay: 60ms; }
.rp-metric-card:nth-child(3) { animation-delay: 120ms; }
.rp-metric-card:nth-child(4) { animation-delay: 180ms; }

.rp-metric-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.rp-metric-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.rp-metric--total .rp-metric-icon {
  background: rgba(201, 123, 75, 0.12);
  border: 1px solid rgba(201, 123, 75, 0.18);
  color: var(--accent);
}

.rp-metric--ai .rp-metric-icon {
  background: rgba(91, 155, 213, 0.12);
  border: 1px solid rgba(91, 155, 213, 0.18);
  color: var(--info);
}

.rp-metric--kb .rp-metric-icon {
  background: rgba(76, 175, 130, 0.12);
  border: 1px solid rgba(76, 175, 130, 0.18);
  color: var(--success);
}

.rp-metric--web .rp-metric-icon {
  background: rgba(168, 130, 214, 0.12);
  border: 1px solid rgba(168, 130, 214, 0.18);
  color: #a882d6;
}

.rp-metric-body {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.rp-metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.rp-metric-value {
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.2;
}

.rp-metric--total .rp-metric-value { color: var(--accent); }

.rp-metric-hint {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Workspace container ── */
.rp-workspace {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 50vh;
  animation: fadeUp 300ms ease;
}

.rp-workspace-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.rp-tab-group {
  display: flex;
  gap: 2px;
}

.rp-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.rp-tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.rp-tab-btn.active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.rp-tab-btn svg {
  flex-shrink: 0;
  opacity: 0.65;
}

.rp-tab-btn.active svg {
  opacity: 1;
}

.rp-tab-badge {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 1px 6px;
  color: var(--text-muted);
}

.rp-tab-btn.active .rp-tab-badge {
  background: rgba(201, 123, 75, 0.15);
  color: var(--accent);
}

/* ── Workspace body ── */
.rp-workspace-body {
  padding: 0;
}

/* ── Table styles ── */
.rp-table-area {
  overflow-x: auto;
}

.rp-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

.rp-table th,
.rp-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.rp-table th {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.015);
  position: sticky;
  top: 0;
  padding: 8px 16px;
}

.rp-table tbody tr {
  transition: background var(--transition-fast);
}

.rp-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.rp-table tbody tr:last-child td {
  border-bottom: none;
}

.rp-table td strong {
  font-weight: 600;
  color: var(--text-primary);
}

.rp-th-rank {
  width: 40px;
}

.rp-td-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  width: 40px;
}

.rp-td-rank:first-child {
  padding-left: 12px;
}

.rp-table tbody tr:nth-child(1) .rp-td-rank,
.rp-table tbody tr:nth-child(2) .rp-td-rank,
.rp-table tbody tr:nth-child(3) .rp-td-rank {
  color: var(--accent);
  font-size: 12px;
}

.rp-code {
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

.rp-th-num {
  text-align: right;
  width: 90px;
}

.rp-td-num {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.rp-th-bar {
  width: 140px;
}

.rp-td-bar {
  width: 140px;
}

/* ── Inline bar charts ── */
.rp-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
}

.rp-bar--stacked {
  gap: 1px;
}

.rp-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  min-width: 2px;
  transition: width 400ms ease;
}

.rp-bar-fill.rp-bar--info {
  background: var(--info);
}

/* ── Detail list ── */
.rp-detail-list {
  display: grid;
  gap: 0;
}

.rp-detail-card {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 5px;
  transition: background var(--transition-fast);
}

.rp-detail-card:last-child {
  border-bottom: none;
}

.rp-detail-card:hover {
  background: rgba(255, 255, 255, 0.015);
}

.rp-detail-hd {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rp-detail-time {
  font-size: 11px;
  color: var(--text-muted);
}

.rp-detail-source {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.rp-detail-title {
  font-weight: 650;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

.rp-detail-msg {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── 28. RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 1440px) {
  .hero-metrics,
  .feature-points,
  .permission-grid,
  .detail-header {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ac-perm-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .rp-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .detail-grid,
  .detail-grid.large-main {
    grid-template-columns: 1fr;
  }

  .toolbar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grow {
    grid-column: span 1;
  }

  .form-grid.three-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .ov-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ov-panels {
    grid-template-columns: 1fr;
  }

  .workspace-grid,
  .knowledge-grid,
  .route-grid,
  .triple-grid {
    grid-template-columns: 1fr;
  }

  .ac-workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .kb-workspace {
    grid-template-columns: 160px minmax(0, 1fr);
    min-height: 60vh;
  }

  .kb-workspace .kb-panel:first-child {
    display: none;
  }

  .kb-workspace--routes {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .session-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .ss-workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .form-grid.two-columns,
  .form-grid.three-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  :root {
    --sidebar-w: 1fr;
  }

  .app-shell,
  .login-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }

  .session-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .session-list-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 40vh;
  }

  .session-info-strip {
    flex-wrap: wrap;
  }

  .ss-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .ss-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 40vh;
  }

  .ss-detail-tabs {
    flex-wrap: wrap;
  }

  .ss-msg {
    max-width: 90%;
  }

  .ss-chat {
    padding: 16px 14px;
  }

  .hero-grid,
  .hero-metrics,
  .feature-points,
  .permission-grid,
  .detail-header,
  .toolbar-grid,
  .toolbar-grid.compact,
  .info-pairs {
    grid-template-columns: 1fr;
  }

  .ac-workspace {
    grid-template-columns: 1fr;
  }

  .ac-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 35vh;
  }

  .ac-stats-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .ac-perm-grid,
  .ac-role-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .rp-metrics {
    grid-template-columns: 1fr;
  }

  .rp-toolbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .rp-tab-group {
    flex-wrap: wrap;
  }

  .rp-th-bar,
  .rp-td-bar {
    display: none;
  }

  .topbar {
    flex-direction: column;
  }

  .nav-link small {
    display: none;
  }

  .nav-group {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
  }

  .nav-caption {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-hero {
    padding: 28px 20px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .login-panel {
    padding: 24px 20px;
  }

  .main-shell {
    padding: 14px;
  }

  .sidebar {
    padding: 10px;
  }

  .feature-panel,
  .detail-pane,
  .route-editor-panel,
  .metric-card {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  .chat-bubble {
    max-width: 94%;
  }

  .editor-row {
    grid-template-columns: 1fr;
  }

  .ov-hero {
    grid-template-columns: 1fr;
  }

  .ov-hero-card {
    padding: 16px;
  }

  .ov-hero-num {
    font-size: 22px;
  }

  .ov-engine-row {
    grid-template-columns: 65px minmax(0, 1fr) 40px;
  }

  .ss-msg {
    max-width: 90%;
  }

  .ss-chat {
    padding: 14px 12px;
  }
}
