/* ===================================================================
   FORGESTAR OS — Design system (Apple-aesthetic, dark mode)
   =================================================================== */

:root {
  /* Surfaces — light glassy grey */
  --bg: #E8E9EE;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-elev: rgba(255, 255, 255, 0.86);
  --surface-translucent: rgba(255, 255, 255, 0.58);
  --glass: rgba(0, 0, 0, 0.22);
  --glass-strong: rgba(255, 255, 255, 0.78);

  /* Text */
  --text: #14141B;
  --text-secondary: #4A4A55;
  --text-tertiary: #8C8C96;

  /* Borders */
  --border: rgba(20, 20, 27, 0.07);
  --border-strong: rgba(20, 20, 27, 0.13);
  --border-glow: rgba(255, 255, 255, 0.6);

  /* Accent (single accent — Forgestar ember) */
  --accent: #E8632B;
  --accent-soft: rgba(232, 99, 43, 0.10);
  --accent-strong: #C8531F;

  /* Tile accents — neutral palette. Color reserved for semantic signals only. */
  --hue-ember:    60, 60, 66;
  --hue-iris:     42, 42, 48;
  --hue-jade:     72, 72, 78;
  --hue-azure:    55, 55, 62;
  --hue-sky:      88, 88, 94;
  --hue-magenta:  48, 48, 55;
  --hue-gold:     78, 78, 84;
  --hue-mint:     65, 65, 72;

  /* Tier → color mapping (monochrome palette + ember accent).
     Tiers graduate from light → dark, premium tiers get ember. */
  --tier-ship:           100, 100, 106;
  --tier-build:          68, 68, 74;
  --tier-os:             36, 36, 42;
  --tier-starter_3:      110, 110, 116;
  --tier-starter_5:      82, 82, 88;
  --tier-custom_force:   52, 52, 58;
  --tier-persona:        30, 30, 36;
  --tier-workforce_os_seat: 44, 44, 50;
  --tier-care_plan:      90, 90, 96;

  /* Semantic */
  --success: #1A9D4F;
  --warning: #D58400;
  --danger: #D8362F;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(255, 255, 255, 0.06);
  --shadow-md: 0 6px 20px rgba(255, 255, 255, 0.08);
  --shadow-lg: 0 24px 60px rgba(255, 255, 255, 0.14);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 24px 48px -12px rgba(255, 255, 255, 0.12);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-rail: 52px;
  --inspector-w: 320px;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Menlo', 'Monaco', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  position: relative;
}

@keyframes pearlShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(80px, -60px) scale(1.1); }
  66%  { transform: translate(-40px, 40px) scale(0.95); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-70px, 50px) scale(1.05); }
  66%  { transform: translate(60px, -30px) scale(1.1); }
}
@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(50px, 70px) scale(1.08); }
  66%  { transform: translate(-60px, -50px) scale(0.97); }
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 25%,
    rgba(255,255,255,0.06) 40%,
    rgba(232, 99, 43, 0.08) 48%,
    rgba(124, 99, 230, 0.06) 55%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: pearlShimmer 8s ease-in-out infinite;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
}

/* Animated floating orbs behind everything */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.bg-orbs::before,
.bg-orbs::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
}
.bg-orbs::before {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(232, 99, 43, 0.55), transparent 70%);
  top: -10%; right: 5%;
  animation: orbFloat1 20s ease-in-out infinite;
}
.bg-orbs::after {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(46, 175, 139, 0.45), transparent 70%);
  bottom: -5%; left: 5%;
  animation: orbFloat2 24s ease-in-out infinite;
}
.bg-orb-3 {
  position: absolute;
  width: 380px; height: 380px;
  border-radius: 50%;
  filter: blur(90px);
  background: radial-gradient(circle, rgba(124, 99, 230, 0.40), transparent 70%);
  top: 30%; left: 45%;
  animation: orbFloat3 28s ease-in-out infinite;
  pointer-events: none;
}

/* Desktop grid — subtle "graph paper" pattern that gives the app a
   floating-cards-on-a-desktop feel like the inspo. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
  mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.85), rgba(0,0,0,0.35) 80%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.85), rgba(0,0,0,0.35) 80%);
}

a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ===================================================================
   APP SHELL
   =================================================================== */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-rail) 1fr;
  height: 100vh;
  width: 100vw;
  transition: grid-template-columns 250ms cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 2;
}
.app.sb-expanded {
  grid-template-columns: var(--sidebar-w) 1fr;
}
.sb-collapse-btn { display: none; }

/* ===================================================================
   SIDEBAR
   =================================================================== */

.sidebar {
  background: transparent;
  border-right: none;
  display: flex;
  flex-direction: column;
  padding: 12px 4px;
  overflow-y: auto;
  overflow-x: hidden;
  width: var(--sidebar-rail);
  min-width: var(--sidebar-rail);
  max-width: var(--sidebar-rail);
  transition: width 250ms cubic-bezier(0.16, 1, 0.3, 1),
              min-width 250ms cubic-bezier(0.16, 1, 0.3, 1),
              max-width 250ms cubic-bezier(0.16, 1, 0.3, 1),
              padding 250ms cubic-bezier(0.16, 1, 0.3, 1),
              background 250ms ease,
              backdrop-filter 250ms ease;
  gap: 2px;
  align-items: center;
}
.app.sb-expanded .sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  padding: 16px 12px;
  background: var(--glass, rgba(255, 255, 255, 0.10));
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border-right: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  align-items: stretch;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Rail mode: hide ALL text — only icons visible */
.sidebar .sb-name,
.sidebar .sb-label,
.sidebar .sb-search-label,
.sidebar .sb-search-kbd,
.sidebar .sb-newthread span:not(.sb-newthread-icon),
.sidebar .sb-newtask span:not(.sb-newtask-icon),
.sidebar .sb-newproto span:not(.sb-newproto-icon),
.sidebar .sb-section-head .sb-label,
.sidebar .sb-section-btn,
.sidebar .sb-thread-list,
.sidebar .sb-agent-list,
.sidebar .sb-project-list,
.sidebar .sb-foot .sb-vacation-label,
.sidebar .sb-foot .sb-reception-label,
.sidebar .sb-foot .sb-blockers-label,
.sidebar .sb-foot .sb-bridge-label,
.sidebar .sb-foot .sb-poweredby,
.sidebar .sb-pill {
  display: none;
}
/* Also hide the text node next to sb-icon inside sb-item */
.sidebar .sb-item {
  font-size: 0;
  color: transparent;
}
.sidebar .sb-item .sb-icon {
  font-size: 15px;
}
.sidebar .sb-section-head {
  display: none;
}
/* Rail mode: hide all nav items, only show top action buttons */
.sidebar .sb-nav,
.sidebar .sb-foot,
.sidebar .sb-search {
  display: none;
}
.app.sb-expanded .sidebar .sb-nav,
.app.sb-expanded .sidebar .sb-foot,
.app.sb-expanded .sidebar .sb-search {
  display: flex;
}
.app.sb-expanded .sidebar .sb-name,
.app.sb-expanded .sidebar .sb-label,
.app.sb-expanded .sidebar .sb-search-label,
.app.sb-expanded .sidebar .sb-search-kbd,
.app.sb-expanded .sidebar .sb-newthread span:not(.sb-newthread-icon),
.app.sb-expanded .sidebar .sb-newtask span:not(.sb-newtask-icon),
.app.sb-expanded .sidebar .sb-newproto span:not(.sb-newproto-icon),
.app.sb-expanded .sidebar .sb-section-head .sb-label,
.app.sb-expanded .sidebar .sb-section-btn,
.app.sb-expanded .sidebar .sb-thread-list,
.app.sb-expanded .sidebar .sb-agent-list,
.app.sb-expanded .sidebar .sb-project-list,
.app.sb-expanded .sidebar .sb-foot .sb-vacation-label,
.app.sb-expanded .sidebar .sb-foot .sb-reception-label,
.app.sb-expanded .sidebar .sb-foot .sb-blockers-label,
.app.sb-expanded .sidebar .sb-foot .sb-bridge-label,
.app.sb-expanded .sidebar .sb-foot .sb-poweredby,
.app.sb-expanded .sidebar .sb-pill {
  display: inline;
}
.app.sb-expanded .sidebar .sb-item {
  font-size: 13px;
  color: var(--text-secondary);
}
.app.sb-expanded .sidebar .sb-section-head {
  display: flex;
}

/* Rail mode: center icons */
.sidebar .sb-item {
  justify-content: center;
  padding: 7px 0;
}
.app.sb-expanded .sidebar .sb-item {
  justify-content: flex-start;
  padding: 7px 12px;
}
.sidebar .sb-newthread,
.sidebar .sb-newtask,
.sidebar .sb-newproto,
.sidebar .sb-search {
  justify-content: center;
  padding: 0;
  width: 34px;
  height: 34px;
  margin: 3px auto;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.20);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 200ms ease;
}
.sidebar .sb-newthread:hover,
.sidebar .sb-newtask:hover,
.sidebar .sb-newproto:hover,
.sidebar .sb-search:hover {
  background: rgba(0, 0, 0, 0.30);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  transform: scale(1.08);
}
.app.sb-expanded .sidebar .sb-newthread,
.app.sb-expanded .sidebar .sb-newtask,
.app.sb-expanded .sidebar .sb-newproto {
  padding: 9px 12px;
  justify-content: flex-start;
  width: calc(100% - 8px);
  height: auto;
  margin: 2px 4px;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-bottom: 1px solid transparent;
  box-shadow: none;
}
.app.sb-expanded .sidebar .sb-newthread:hover,
.app.sb-expanded .sidebar .sb-newtask:hover,
.app.sb-expanded .sidebar .sb-newproto:hover {
  background: transparent;
  border-bottom-color: rgba(0, 0, 0, 0.15);
  transform: none;
}
.app.sb-expanded .sidebar .sb-search {
  padding: 7px 12px;
  justify-content: flex-start;
  width: 100%;
  height: auto;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-bottom: 1px solid transparent;
  box-shadow: none;
}
.app.sb-expanded .sidebar .sb-search:hover {
  background: transparent;
  border-bottom-color: rgba(0, 0, 0, 0.15);
  transform: none;
}

/* Rail mode: brand mark — no bubble, just the icon */
.sidebar .sb-brand {
  justify-content: center;
  padding: 6px 0 16px;
  width: 38px;
  height: auto;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  margin-bottom: 8px;
}
.app.sb-expanded .sidebar .sb-brand {
  justify-content: flex-start;
  padding: 6px 10px 24px;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  margin-bottom: 0;
}

/* Rail mode: footer items center */
.sidebar .sb-foot .sb-item {
  justify-content: center;
}
.app.sb-expanded .sidebar .sb-foot .sb-item {
  justify-content: flex-start;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 24px;
}
.sb-mark {
  width: 22px;
  height: 22px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M50 8 L62 38 L94 42 L70 64 L78 96 L50 78 L22 96 L30 64 L6 42 L38 38 Z' fill='none' stroke='%23FF8A3D' stroke-width='6' stroke-linejoin='round' stroke-linecap='round'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter:
    drop-shadow(0 0 6px rgba(255, 138, 60, 0.55))
    drop-shadow(0 0 2px rgba(255, 138, 60, 0.7));
  flex-shrink: 0;
}
.sb-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}

.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sb-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sb-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  padding: 4px 12px 6px;
  text-transform: uppercase;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 120ms ease-out;
  position: relative;
  background: transparent;
  border-bottom: 1px solid transparent;
}
.sb-item:hover {
  background: transparent;
  color: var(--text);
  border-bottom-color: rgba(0, 0, 0, 0.15);
}
.sb-item.active {
  background: transparent;
  color: var(--text);
  border-bottom-color: var(--accent);
}
.sb-item.active::before {
  display: none;
}

.sb-icon {
  width: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-tertiary);
  opacity: 0.85;
  transition: all 200ms ease;
}

/* Rail mode: floating glass bubble icons */
.sidebar .sb-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.20);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-size: 15px;
  color: var(--text);
  opacity: 1;
  flex-shrink: 0;
}
.sidebar .sb-item:hover .sb-icon {
  background: rgba(0, 0, 0, 0.30);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  transform: scale(1.08);
}
.sidebar .sb-item.active .sb-icon {
  background: rgba(10, 10, 10, 0.85);
  color: #fff;
  border-color: rgba(10, 10, 10, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

/* Expanded mode: revert to inline icons */
.app.sb-expanded .sidebar .sb-icon {
  width: 16px;
  height: auto;
  border-radius: 0;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: none;
  font-size: 14px;
  color: var(--text-tertiary);
  opacity: 0.85;
}
.app.sb-expanded .sidebar .sb-item:hover .sb-icon {
  background: transparent;
  box-shadow: none;
  transform: none;
}
.app.sb-expanded .sidebar .sb-item.active .sb-icon {
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.sb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin: 0 4px;
}
.sb-dot.status-live { background: var(--success); box-shadow: 0 0 6px rgba(48, 209, 88, 0.6); }
.sb-dot.status-idle { background: var(--text-tertiary); }
.sb-dot.status-warn { background: var(--warning); }

.sb-pill {
  margin-left: auto;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
}
.sb-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sb-foot {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sb-newthread {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 8px);
  padding: 9px 16px;
  margin: 2px 4px;
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease-out, transform 120ms ease-out, border-color 120ms ease-out;
}
.sb-newthread:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.sb-newthread-icon {
  font-size: 13px;
  color: var(--text-secondary);
}

.sb-newtask {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 8px);
  padding: 8px 12px;
  margin: 0 4px 12px 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease-out, transform 120ms ease-out, border-color 120ms ease-out;
}
.sb-newtask:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.sb-newtask-icon {
  font-size: 13px;
  color: var(--text-secondary);
}

.sb-newproto {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 8px);
  padding: 8px 12px;
  margin: 0 4px 12px 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease-out, transform 120ms ease-out, border-color 120ms ease-out;
}
.sb-newproto:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.sb-newproto-icon {
  font-size: 14px;
  color: var(--text-secondary);
}

.task-routing-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid rgb(var(--card-hue, var(--hue-ember)));
  border-radius: 8px;
  margin: 12px 0 6px;
}
.task-routing-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  font-size: 16px;
  background: rgba(var(--card-hue, var(--hue-ember)), 0.15);
  color: rgb(var(--card-hue, var(--hue-ember)));
  border-radius: 6px;
}
.task-routing-info { flex: 1; min-width: 0; }
.task-routing-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.task-routing-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-top: 1px;
}
.task-routing-why {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.task-routing-override {
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}

.sb-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 8px);
  margin: 0 4px 12px 4px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease-out;
}
.sb-search:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }
.sb-search-icon { font-size: 13px; }
.sb-search-label { flex: 1; text-align: left; }
.sb-search-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  color: var(--text-tertiary);
}

.sb-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 4px 10px;
  cursor: pointer;
}
.sb-section.collapsed .sb-agent-list,
.sb-section.collapsed .sb-thread-list,
.sb-section.collapsed .sb-project-list,
.app.sb-expanded .sidebar .sb-section.collapsed .sb-agent-list,
.app.sb-expanded .sidebar .sb-section.collapsed .sb-thread-list,
.app.sb-expanded .sidebar .sb-section.collapsed .sb-project-list {
  display: none !important;
}
.sb-label::before {
  content: '▾';
  display: inline-block;
  margin-right: 6px;
  font-size: 9px;
  transition: transform 120ms ease;
  color: var(--text-tertiary);
}
.sb-section.collapsed .sb-label::before {
  transform: rotate(-90deg);
}
.sb-section-btn {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 0;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.sb-section-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
}

.sb-agent-list,
.sb-thread-list,
.sb-project-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sb-agent-item,
.sb-thread-item,
.sb-project-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  width: 100%;
  position: relative;
  transition: background 120ms ease-out, color 120ms ease-out;
}
.sb-agent-item:hover,
.sb-thread-item:hover,
.sb-project-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.sb-agent-item.active,
.sb-thread-item.active,
.sb-project-item.active {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.sb-agent-chip {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='6' width='16' height='12' rx='3'/%3E%3Ccircle cx='9' cy='12' r='1.5'/%3E%3Ccircle cx='15' cy='12' r='1.5'/%3E%3Cpath d='M12 2v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 13px;
  position: relative;
}
.sb-error-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e53e3e;
  border: 1.5px solid var(--bg, #0e0e11);
}
.sb-error-text {
  color: #e53e3e;
}
.sb-error-actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}
.sb-error-dismiss, .sb-error-diag {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 120ms, background 120ms;
}
.sb-error-dismiss:hover, .sb-error-diag:hover {
  opacity: 1;
  background: rgba(229,62,62,0.15);
}
.sb-error-dismiss { color: var(--text-muted); }
.sb-error-diag { color: #e53e3e; }

.sb-thread-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-tertiary);
}
.sb-thread-status.active {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(26, 157, 79, 0.18);
  animation: thread-pulse 1.6s ease-in-out infinite;
}
.sb-thread-status.complete { background: var(--text-tertiary); }
@keyframes thread-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.sb-thread-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sb-thread-title {
  font-size: 12.5px;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-thread-sub {
  font-size: 10.5px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-loading,
.sb-empty {
  font-size: 11.5px;
  color: var(--text-tertiary);
  padding: 6px 12px;
}

.sb-cmdk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  transition: background 120ms ease-out;
}
.sb-cmdk:hover { background: rgba(255, 255, 255, 0.07); }

.sb-poweredby {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px 4px;
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: opacity 150ms ease-out;
}
.sb-poweredby:hover { opacity: 0.85; }
.sb-poweredby svg { display: block; flex-shrink: 0; }
.sb-poweredby .tk-name {
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: -0.005em;
}

kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ===================================================================
   MAIN CONTENT
   =================================================================== */

.main {
  overflow-y: auto;
  padding: 0;
  height: 100vh;
}

.view {
  max-width: 1100px;
  padding: 24px 28px 60px;
  margin: 16px auto;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-height: calc(100vh - 32px);
}

/* Thread shell uses its own layered floating cards — no outer wrapper. */
.view.thread-view-shell,
main > .thread-shell {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  max-width: none;
  border-radius: 0;
}

.view-header {
  margin-bottom: 32px;
}
.view-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 4px;
}
.view-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.section-heading {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
  margin: 32px 0 12px;
}

/* ===================================================================
   CARDS
   =================================================================== */

.card {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: background 150ms ease-out, transform 150ms ease-out, border-color 150ms ease-out, box-shadow 150ms ease-out;
  box-shadow: var(--shadow-sm);
}
.card.interactive {
  cursor: pointer;
}
.card.interactive:hover {
  background: var(--glass-strong);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.card-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.card-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* ===================================================================
   BUTTONS
   =================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition: all 150ms ease-out;
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}
.btn-secondary {
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--surface-elev);
  border-color: rgba(255, 255, 255, 0.16);
}
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

/* ===================================================================
   INPUTS
   =================================================================== */

.input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 120ms ease-out, background 120ms ease-out;
  outline: none;
}
.input:focus {
  border-color: var(--accent);
}
.input::placeholder { color: var(--text-tertiary); }

textarea.input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
  font-family: inherit;
}

/* ===================================================================
   STATUS / METADATA
   =================================================================== */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.status-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  letter-spacing: 0.005em;
}
.status-pill.live { background: rgba(48, 209, 88, 0.15); color: var(--success); }
.status-pill.warn { background: rgba(255, 159, 10, 0.15); color: var(--warning); }
.status-pill.accent { background: var(--accent-soft); color: var(--accent); }

/* ===================================================================
   AGENT CHAT (used by Methodology agent + others)
   =================================================================== */

.chat {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 100px;
}
.chat-msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 720px;
}
.chat-msg .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-elev);
  color: var(--text);
}
.chat-msg.user .avatar { background: var(--accent); color: #fff; }
.chat-msg.bot .avatar { background: linear-gradient(135deg, var(--accent), #FFB87A); color: #fff; }
.chat-msg .body {
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  padding-top: 4px;
}
.chat-msg .body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface);
  padding: 2px 5px;
  border-radius: 3px;
}

.chat-input-wrap {
  position: sticky;
  bottom: 0;
  background: transparent;
  padding: 16px 0 4px;
  margin-top: 16px;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input-row .input {
  flex: 1;
}

/* ===================================================================
   LIST (used by inbox, audits, etc.)
   =================================================================== */

.list {
  display: flex;
  flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.list-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  transition: background 120ms ease-out;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-elev); }
.list-row .row-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}
.list-row .row-main {
  flex: 1;
  min-width: 0;
}
.list-row .row-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-row .row-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}
.list-row .row-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ===================================================================
   COMMAND PALETTE
   =================================================================== */

.cmdk-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
  animation: fadein 150ms ease-out;
}
.cmdk-backdrop[hidden] { display: none; }

.cmdk-panel {
  width: 100%;
  max-width: 560px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cmdkenter 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cmdk-input {
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 16px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input::placeholder { color: var(--text-tertiary); }

.cmdk-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.cmdk-item:hover, .cmdk-item.selected {
  background: var(--accent-soft);
  color: var(--text);
}
.cmdk-item .cmdk-cat {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-tertiary);
}
.cmdk-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.cmdk-foot {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  gap: 12px;
}

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes cmdkenter {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===================================================================
   DAILY BRIEF
   =================================================================== */

.brief-eyebrow {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px;
  padding: 6px 0;
}
.view-header .view-title {
  display: inline-block;
  padding: 0;
}

/* ── Stat strip: floating pills ── */
.brief-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  background: none;
  border-radius: 0;
  overflow: visible;
}
.brief-stat {
  flex: 1;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 120ms, transform 120ms, box-shadow 120ms;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.brief-stat:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}
.brief-stat:first-child { border-radius: 14px; }
.brief-stat:last-child  { border-radius: 14px; }
.brief-stat.interactive { cursor: pointer; }
.brief-stat.interactive:hover { background: var(--surface-elev); }
.brief-stat-value {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 3px;
}
.brief-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}
.brief-stat-hint {
  font-size: 10px;
  color: var(--text-tertiary);
}
.brief-stat.warn .brief-stat-value { color: var(--danger); }
.brief-stat-skel {
  flex: 1;
  background: var(--surface);
  height: 72px;
}
.brief-stat-skel:first-child { border-radius: 12px 0 0 12px; }
.brief-stat-skel:last-child  { border-radius: 0 12px 12px 0; }
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.85; }
}
@media (max-width: 720px) {
  .brief-stats { flex-wrap: wrap; background: none; gap: 8px; border-radius: 0; }
  .brief-stat { border-radius: 10px !important; border: 1px solid var(--border); flex: 1 1 45%; }
  .brief-stat-skel { border-radius: 10px !important; border: 1px solid var(--border); flex: 1 1 45%; height: 64px; }
}

/* ── Main grid: 2-col with full-width banners ── */
.brief-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.brief-section-wide { grid-column: 1 / -1; }
@media (max-width: 700px) {
  .brief-grid { grid-template-columns: 1fr; }
  .brief-section-wide { grid-column: 1; }
}
.brief-section {
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.brief-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.brief-section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.brief-section-body {
  flex: 1;
}
.brief-loading,
.brief-empty,
.brief-error {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 6px 0;
}
.brief-empty a {
  color: var(--accent);
  text-decoration: none;
}
.brief-error { color: #FF6B6B; }

/* ── Needs attention (full-width banner) ── */
.brief-clear {
  font-size: 13px; color: var(--text-tertiary); padding: 4px 0;
}
.brief-attention-list {
  display: flex; flex-direction: column; gap: 1px;
}
.brief-attention-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; margin: 0 -10px; width: calc(100% + 20px);
  background: transparent; border: 0; border-radius: 8px;
  cursor: pointer; font-family: inherit; text-align: left;
  transition: background 100ms;
}
.brief-attention-item:hover { background: var(--surface-elev); }
.brief-attention-icon {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--surface-elev); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.brief-attention-error .brief-attention-icon { background: rgba(255,107,107,0.12); color: #FF6B6B; }
.brief-attention-lead .brief-attention-icon  { background: rgba(74,222,128,0.12); color: #16a34a; }
.brief-attention-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px;
}
.brief-attention-title {
  font-size: 13px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brief-attention-sub {
  font-size: 11px; color: var(--text-tertiary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brief-attention-time {
  font-size: 10px; color: var(--text-tertiary); flex-shrink: 0;
}

/* ── Inbox / pipeline rows ── */
.brief-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brief-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  margin: 0 -8px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  width: calc(100% + 16px);
  transition: background 100ms;
}
.brief-row:hover { background: var(--surface-elev); }
.brief-row-static { cursor: default; }
.brief-row-static:hover { background: transparent; }
.brief-row-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-tertiary);
}
.brief-row-dot.dot-ok    { background: #4ADE80; }
.brief-row-dot.dot-warn  { background: #FFC857; }
.brief-row-dot.dot-fail  { background: #FF6B6B; }
.brief-row-dot.dot-mute  { background: var(--text-tertiary); }
.brief-row-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.brief-row-title {
  font-size: 12.5px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brief-row-sub {
  font-size: 10.5px; color: var(--text-tertiary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brief-row-meta {
  font-size: 10px; color: var(--text-tertiary); flex-shrink: 0;
}

/* ── Spend rows ── */
.brief-spend-rows {
  display: flex; flex-direction: column; gap: 0;
}
.brief-spend-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--border);
}
.brief-spend-row:last-child { border-bottom: 0; }
.brief-spend-label { font-size: 12px; color: var(--text-secondary); }
.brief-spend-value { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* ── Alert pills (below stats strip) ── */
.brief-alerts {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
}
.brief-alert {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 20px; border: 0;
  font-family: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: opacity 120ms;
}
.brief-alert:hover { opacity: 0.8; }
.brief-alert-error { background: rgba(255,70,70,0.30); color: #000; }
.brief-alert-warn  { background: rgba(255,200,87,0.30); color: #000; }
.brief-alert-ok    { background: rgba(74,222,128,0.25); color: #000; }

/* ── Quick action row (horizontal, above grid) ── */
.brief-quick-row {
  display: flex; gap: 8px; margin-bottom: 14px;
}
.brief-quick-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.15); backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10); border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  cursor: pointer; font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary); transition: all 120ms;
}
.brief-quick-btn:hover { border-color: rgba(0, 0, 0, 0.08); color: var(--text); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07); }
.brief-quick-btn span { font-size: 14px; }
@media (max-width: 600px) { .brief-quick-row { flex-wrap: wrap; } .brief-quick-btn { flex: 1 1 45%; } }

/* ── Agent status (horizontal 3-col when full-width) ── */
.brief-agent-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
@media (max-width: 700px) { .brief-agent-cards { grid-template-columns: 1fr; } }
.brief-agent-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; min-width: 0;
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-family: inherit; text-align: left;
  transition: background 100ms, border-color 120ms;
  overflow: hidden;
}
.brief-agent-card:hover { background: var(--surface-elev); border-color: var(--border-strong); }
.brief-agent-card-name {
  font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; flex-shrink: 0;
}
.brief-agent-card-task {
  flex: 1; min-width: 0;
  font-size: 11px; color: var(--text-tertiary); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brief-agent-card-status {
  font-size: 10px; color: var(--text-tertiary); flex-shrink: 0; white-space: nowrap;
}

/* ── Pulse: curated daily signal ── */
.brief-pulse { }
.brief-pulse-updated {
  font-size: 10px; color: var(--text-tertiary); font-weight: 400;
}
.brief-pulse-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 600px) { .brief-pulse-grid { grid-template-columns: 1fr; } }
.brief-pulse-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  text-decoration: none; color: inherit;
  transition: border-color 120ms, background 100ms;
}
.brief-pulse-card:hover { border-color: var(--border-strong); background: var(--surface-elev); }
.brief-pulse-type {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
}
.brief-pulse-text {
  font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.45;
}
.brief-pulse-author {
  font-size: 11px; color: var(--text-tertiary);
}

/* ── Settings inputs (pulse, etc.) ── */
.settings-input {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--text); font-size: 12.5px; font-family: inherit;
  width: 100%; box-sizing: border-box;
}
.settings-input:focus { outline: none; border-color: var(--border-strong); }

/* ===================================================================
   AUDIT DETAIL
   =================================================================== */

.audit-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.audit-head-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.stage-flow {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 18px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  overflow-x: auto;
}
.stage-flow-step {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-tertiary);
  transition: all 120ms ease-out;
  white-space: nowrap;
}
.stage-flow-step:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}
.stage-flow-step.done {
  color: var(--text-secondary);
}
.stage-flow-step.done .stage-flow-dot {
  background: var(--accent);
}
.stage-flow-step.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.stage-flow-step.active .stage-flow-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 99, 43, 0.18);
  animation: stageflow-pulse 1.6s ease-in-out infinite;
}
.stage-flow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}
.stage-flow-step.pending .stage-flow-dot {
  background: rgba(255, 255, 255, 0.18);
}
.stage-flow-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes stageflow-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(232, 99, 43, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(232, 99, 43, 0.10); }
}

.audit-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 720px) {
  .audit-meta-grid { grid-template-columns: repeat(2, 1fr); }
}
.audit-meta-card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.audit-meta-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.audit-meta-value {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.audit-meta-card .compose-select {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12.5px;
  width: 100%;
}

.audit-section {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 26px;
  margin-bottom: 16px;
}
.audit-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}
.audit-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.audit-section-actions {
  display: flex;
  gap: 6px;
}

.audit-transcript {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 280px;
  overflow-y: auto;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* ===================================================================
   CUSTOMERS
   =================================================================== */

.customers-search {
  width: 240px;
}
.customers-search input {
  width: 100%;
}

.customers-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 720px) {
  .customers-stats { grid-template-columns: repeat(2, 1fr); }
}

.customers-list {
  display: flex;
  flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.customer-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease-out;
}
.customer-row:last-child { border-bottom: 0; }
.customer-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.customer-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M5.5 21c0-4 2.9-7 6.5-7s6.5 3 6.5 7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px;
  font-size: 0;
}

.customer-main {
  flex: 1;
  min-width: 0;
}
.customer-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.customer-star { color: var(--accent); font-size: 11px; }
.customer-stage {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
}
.customer-stage.stage-inquiry              { background: rgba(var(--hue-iris),  0.15); color: rgb(var(--hue-iris));  }
.customer-stage.stage-call_booked          { background: rgba(var(--hue-azure), 0.15); color: rgb(var(--hue-azure)); }
.customer-stage.stage-call_complete        { background: rgba(var(--hue-jade),  0.18); color: rgb(var(--hue-jade));  }
.customer-stage.stage-drafting             { background: var(--accent-soft);            color: var(--accent);          }
.customer-stage.stage-delivered            { background: rgba(46, 175, 139, 0.18);     color: var(--success);         }
.customer-stage.stage-walkthrough_complete { background: rgba(124, 99, 230, 0.18);     color: rgb(var(--hue-iris));  }
.customer-stage.stage-closed               { background: rgba(232, 180, 82, 0.22);     color: var(--text-secondary);                }

.drafter-rating {
  margin-top: 24px;
  padding: 16px 22px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.drafter-rating-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.rating-stars {
  display: flex;
  gap: 2px;
}
.rating-star {
  background: transparent;
  border: 0;
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 4px;
  font-family: inherit;
  transition: color 100ms ease-out;
}
.rating-star:hover,
.rating-star.hover,
.rating-star.selected {
  color: var(--accent);
}
.rating-thanks {
  font-size: 11.5px;
  color: var(--success);
  font-weight: 500;
}
.rating-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.rating-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 120ms ease-out;
}
.rating-btn:hover { border-color: var(--border-strong); }
.rating-btn.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.rating-btn:disabled { opacity: 0.4; cursor: default; }
.customer-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.customer-counts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.customer-count {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}
.customer-count.audit {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.customer-count.revenue {
  background: rgba(46, 175, 139, 0.14);
  color: var(--success);
  font-weight: 600;
}

.customer-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  width: 70px;
  text-align: right;
  flex-shrink: 0;
}

.customer-notes {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 12px 14px;
  margin-bottom: 18px;
}
.customer-notes-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
}
.customer-notes-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}

.customer-tl {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tl-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.tl-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.tl-audit .tl-icon { background: var(--accent-soft); color: var(--accent); }
.tl-sent .tl-icon  { background: rgba(46, 175, 139, 0.14); color: var(--success); }
.tl-inbox .tl-icon { background: rgba(72, 142, 230, 0.14); color: #2A5FA0; }
.tl-main {
  flex: 1;
  min-width: 0;
}
.tl-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-sub {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.tl-time {
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ===================================================================
   PIPELINE — FANTASY MAP
   =================================================================== */

.pipeline-view {
  max-width: none;
  padding: 32px 40px 56px;
  margin: 0;
  width: 100%;
  position: relative;
}
@media (max-width: 720px) {
  .pipeline-view { padding: 24px 20px 40px; }
}

.pipeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding: 0 8px;
}
.pipeline-title {
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 4px 0;
}
.pipeline-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.quest-region {
  width: 100%;
}

.quest-canvas {
  position: relative;
  width: 100%;
  border-radius: 24px;
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  padding: 60px 40px 60px;
}
.quest-canvas::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 8% 10%, rgba(var(--hue-iris), 0.12), transparent 60%),
    radial-gradient(800px 500px at 95% 90%, rgba(var(--hue-ember), 0.10), transparent 60%),
    radial-gradient(700px 400px at 50% 50%, rgba(var(--hue-azure), 0.06), transparent 70%);
}
.quest-canvas > * { position: relative; }

.quest-empty {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quest-empty-content {
  text-align: center;
  max-width: 460px;
}
.quest-empty-icon {
  font-size: 36px;
  color: var(--accent);
  margin-bottom: 14px;
}
.quest-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.quest-empty-sub {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.quest-track-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* The track line — thin string drooping between stations */
.quest-track-line {
  fill: none;
  stroke: url(#track-grad);
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.85;
}
.quest-track-shadow {
  fill: none;
  stroke: url(#track-shadow-grad);
  stroke-width: 4;
  stroke-linecap: round;
  filter: blur(3px);
  opacity: 0.6;
}

/* Stations */
.quest-station { cursor: pointer; }

.quest-station .station-glow {
  fill: rgba(var(--station-hue, var(--hue-ember)), 0.18);
  opacity: 0;
  transition: opacity 200ms ease-out;
}
.quest-station:hover .station-glow { opacity: 1; }
.quest-station.occupied .station-glow {
  opacity: 1;
  animation: station-pulse 2.4s ease-in-out infinite;
}
@keyframes station-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.12); }
}

.quest-station .station-outer {
  fill: rgba(255, 255, 255, 0.9);
  stroke: rgba(var(--station-hue, var(--hue-ember)), 0.5);
  stroke-width: 2;
  filter: drop-shadow(0 6px 12px rgba(255, 255, 255, 0.07));
}
.quest-station.occupied .station-outer {
  stroke: rgb(var(--station-hue, var(--hue-ember)));
  stroke-width: 2.5;
}
.quest-station .station-inner {
  fill: rgba(var(--station-hue, var(--hue-ember)), 0.15);
}
.quest-station.occupied .station-inner {
  fill: rgb(var(--station-hue, var(--hue-ember)));
}
.quest-station .station-num {
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  fill: rgb(var(--station-hue, var(--hue-ember)));
}
.quest-station.occupied .station-num {
  fill: rgba(255, 255, 255, 0.9);
}

.quest-station .station-name {
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  fill: var(--text);
  letter-spacing: -0.005em;
}
.quest-station .station-tag {
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 11px;
  fill: var(--text-tertiary);
  font-weight: 500;
}

.quest-station .station-avatar-bg {
  fill: rgb(var(--station-hue, var(--hue-ember)));
  stroke: white;
  stroke-width: 2;
  filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.18));
}
.quest-station .station-avatar-bg.more {
  fill: var(--text);
}
.quest-station .station-avatar-text {
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  fill: rgba(255, 255, 255, 0.9);
}

.quest-station .station-hit {
  fill: transparent;
  pointer-events: all;
}

.quest-trophy {
  background: linear-gradient(135deg, rgba(232, 180, 82, 0.22), rgba(200, 130, 40, 0.22));
  border: 1px solid rgba(160, 122, 48, 0.45);
  color: var(--text);
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
}

/* ===== Upsell map (per-customer drawer) ===== */
.upsell-section {
  margin-bottom: 24px;
}
.upsell-section-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}
.upsell-minitrack {
  width: 100%;
  height: 80px;
  display: block;
}
.upsell-track-line {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 2;
  stroke-linecap: round;
}
.upsell-station-bg {
  fill: rgba(255, 255, 255, 0.9);
  stroke: var(--border-strong);
  stroke-width: 2;
}
.upsell-station.done .upsell-station-bg {
  fill: var(--accent);
  stroke: var(--accent-strong);
}
.upsell-station.current .upsell-station-bg {
  fill: rgba(255, 255, 255, 0.9);
  stroke: var(--accent);
  stroke-width: 3;
}
.upsell-station-pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0.4;
  animation: upsell-pulse 1.6s ease-out infinite;
}
@keyframes upsell-pulse {
  0%   { r: 9;  stroke-opacity: 0.6; }
  100% { r: 18; stroke-opacity: 0;   }
}
.upsell-station-mark {
  font-size: 10px;
  font-weight: 700;
  fill: rgba(255, 255, 255, 0.9);
}
.upsell-station-label {
  font-size: 9.5px;
  font-weight: 500;
  fill: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.upsell-station.current .upsell-station-label,
.upsell-station.done .upsell-station-label {
  fill: var(--text);
}

.upsell-branches {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upsell-branch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 150ms ease-out;
}
.upsell-branch:hover {
  border-color: var(--border-strong);
  background: rgba(0, 0, 0, 0.45);
  transform: translateX(2px);
}
.upsell-branch-primary {
  border-color: rgba(232, 99, 43, 0.30);
  background: linear-gradient(135deg, rgba(232, 99, 43, 0.07), rgba(232, 99, 43, 0.02));
}
.upsell-branch-primary:hover {
  border-color: var(--accent);
}
.upsell-branch-gold {
  border-color: rgba(160, 122, 48, 0.30);
  background: linear-gradient(135deg, rgba(232, 180, 82, 0.10), rgba(232, 180, 82, 0.02));
}
.upsell-branch-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.upsell-branch-primary .upsell-branch-icon {
  background: var(--accent-soft);
  color: var(--accent);
}
.upsell-branch-gold .upsell-branch-icon {
  background: rgba(232, 180, 82, 0.18);
  color: var(--text-secondary);
}
.upsell-branch-main {
  flex: 1;
  min-width: 0;
}
.upsell-branch-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.upsell-branch-sub {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.upsell-branch-arrow {
  font-size: 14px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.upsell-branch:hover .upsell-branch-arrow { color: var(--accent); }

.pipeline-totals {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pipeline-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  font-family: inherit;
}
.pipeline-pill strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 4px;
}
.pipeline-pill.champion {
  background: linear-gradient(135deg, rgba(232, 180, 82, 0.20), rgba(200, 130, 40, 0.20));
  border-color: rgba(160, 122, 48, 0.45);
  color: var(--text-secondary);
}
.pipeline-pill.champion strong { color: var(--text); }

.forgequest-eyebrow {
  font-family: 'Iowan Old Style', 'Palatino', Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #C8531F;
  font-weight: 700;
  margin-bottom: 6px;
}
.forgequest-title {
  font-family: 'Iowan Old Style', 'Palatino', Georgia, serif !important;
  letter-spacing: -0.005em;
}

.map-row.has-won {
  background: linear-gradient(135deg, rgba(255, 235, 180, 0.65), rgba(232, 180, 82, 0.30));
  border-color: rgba(160, 122, 48, 0.40);
  box-shadow: 0 0 0 1px rgba(232, 180, 82, 0.30) inset, var(--shadow-sm);
}
.map-row-crown {
  font-size: 12px;
  margin-left: 4px;
  filter: drop-shadow(0 1px 2px rgba(120, 80, 30, 0.4));
}
.map-row-victory {
  margin-top: 4px;
  font-family: 'Iowan Old Style', 'Palatino', Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.map-region { margin-top: 8px; }

.map-parchment {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  box-shadow: var(--shadow-md);
  padding: 32px 24px 28px 24px;
}
.map-parchment::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(800px 500px at 12% 12%, rgba(var(--hue-iris), 0.10), transparent 60%),
    radial-gradient(800px 500px at 88% 88%, rgba(var(--hue-jade), 0.10), transparent 60%),
    radial-gradient(700px 400px at 50% 50%, rgba(var(--hue-azure), 0.06), transparent 70%);
}

.map-decor {
  position: absolute;
  pointer-events: none;
  opacity: 0.18;
}
.map-decor-mountain {
  top: 12px;
  right: 24px;
  width: 110px;
  height: 60px;
  background:
    linear-gradient(160deg, transparent 50%, #5C4527 50.5%, #5C4527 60%, transparent 60.5%) 0 0 / 60px 60px no-repeat,
    linear-gradient(160deg, transparent 50%, #6E5331 50.5%, #6E5331 62%, transparent 62.5%) 38px 0 / 70px 60px no-repeat;
}
.map-decor-trees {
  bottom: 10px;
  left: 16px;
  width: 140px;
  height: 32px;
  background:
    radial-gradient(circle at 12px 16px, #527245 8px, transparent 9px),
    radial-gradient(circle at 32px 12px, #4F6E42 10px, transparent 11px),
    radial-gradient(circle at 56px 18px, #527245 7px, transparent 8px),
    radial-gradient(circle at 80px 14px, #4F6E42 9px, transparent 10px),
    radial-gradient(circle at 110px 16px, #527245 8px, transparent 9px);
}
.map-decor-compass {
  top: 18px;
  left: 22px;
  width: 64px;
  height: 64px;
  opacity: 0.34;
}
.map-compass-rose {
  position: relative;
  width: 100%;
  height: 100%;
  border: 2px solid #6E5331;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 60%, rgba(110, 83, 49, 0.18) 100%);
}
.map-compass-rose > div {
  position: absolute;
  font-size: 9px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Iowan Old Style', 'Palatino', Georgia, serif;
}
.map-compass-n { top: 2px; left: 50%; transform: translateX(-50%); }
.map-compass-s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.map-compass-e { right: 4px; top: 50%; transform: translateY(-50%); }
.map-compass-w { left: 4px; top: 50%; transform: translateY(-50%); }
.map-compass-needle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 36px;
  margin-top: -18px;
  margin-left: -1px;
  background: linear-gradient(to bottom, #B33A20 0%, #B33A20 50%, #5C4527 50%, #5C4527 100%);
  border-radius: 2px;
  transform-origin: 50% 50%;
  animation: compass-spin 12s linear infinite;
}
@keyframes compass-spin {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(8deg); }
}

.adventure-map {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

/* Coastline (the realm outline) */
.coast-line {
  fill: rgba(0, 0, 0, 0.22);
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 2 4;
}
.coast-line-shadow {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 6;
  filter: blur(3px);
}

/* The dashed quest route between landmarks */
.quest-route {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-dasharray: 4 6;
  stroke-linecap: round;
  opacity: 0.55;
}

/* Modern outline-style fills for every landmark drawing */
.ink {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ink-fill {
  fill: rgba(0, 0, 0, 0.65);
  stroke: var(--text);
  stroke-width: 1.4;
  stroke-linejoin: round;
}
.ink-fill-bg {
  fill: var(--text);
}
.ink-fill-window {
  fill: var(--accent);
  stroke: var(--text);
  stroke-width: 1.1;
}
.ink-fill-flag {
  fill: var(--accent);
  stroke: var(--text);
  stroke-width: 1;
}
.ink-fill-yellow {
  fill: var(--accent);
  stroke: var(--text);
  stroke-width: 1;
}
.ink-fill-flame {
  fill: var(--accent);
  stroke: var(--text);
  stroke-width: 1;
}
.ink-fill-sail {
  fill: rgba(0, 0, 0, 0.65);
  stroke: var(--text);
  stroke-width: 1.3;
}
.ink-fill-snow {
  fill: rgba(0, 0, 0, 0.65);
  stroke: var(--text);
  stroke-width: 1.1;
}
.ink-fill-gold {
  fill: var(--accent);
  stroke: var(--text);
  stroke-width: 1.5;
}
.ink-fill-gem {
  fill: rgba(255, 255, 255, 0.9);
  stroke: var(--text);
  stroke-width: 0.8;
}
.ink-smoke {
  fill: none;
  stroke: var(--text-tertiary);
  stroke-width: 1.1;
  stroke-linecap: round;
  opacity: 0.6;
}

/* Landmark groups */
.landmark {
  cursor: pointer;
  transition: transform 220ms ease-out;
}
.landmark:hover {
  transform: translate(var(--lx, 0), var(--ly, 0)) scale(1.06);
}
.landmark-hit {
  fill: transparent;
  pointer-events: all;
}
.landmark.empty .ink-fill,
.landmark.empty .ink-fill-bg,
.landmark.empty .ink-fill-window,
.landmark.empty .ink-fill-flag,
.landmark.empty .ink-fill-yellow,
.landmark.empty .ink-fill-flame,
.landmark.empty .ink-fill-sail,
.landmark.empty .ink-fill-snow,
.landmark.empty .ink-fill-gold,
.landmark.empty .ink-fill-gem {
  opacity: 0.55;
}
.landmark.empty .ink {
  opacity: 0.55;
}

.landmark-name {
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  fill: var(--text);
  letter-spacing: -0.005em;
}
.landmark-sub {
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 10px;
  fill: var(--text-tertiary);
  font-weight: 500;
}

.landmark-flagcluster .flagcluster-bg {
  fill: var(--accent);
  stroke: white;
  stroke-width: 2;
  filter: drop-shadow(0 2px 6px rgba(232, 99, 43, 0.32));
}
.landmark-flagcluster .flagcluster-count {
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  fill: rgba(255, 255, 255, 0.9);
}

/* Active landmark glow ring */
.landmark.occupied .ink-fill,
.landmark.occupied .ink-fill-bg,
.landmark.occupied .ink-fill-sail,
.landmark.occupied .ink-fill-snow {
  filter: drop-shadow(0 0 8px rgba(232, 99, 43, 0.18));
}

/* Compass on the map */
.map-compass-svg .compass-ring {
  fill: rgba(0, 0, 0, 0.30);
  stroke: var(--text);
  stroke-width: 1.2;
}
.map-compass-svg .compass-star {
  fill: var(--text);
  stroke: var(--text);
  stroke-width: 0.5;
  animation: compass-spin-svg 18s linear infinite;
  transform-origin: 0 0;
}
.map-compass-svg .compass-letter {
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  fill: var(--text);
}
@keyframes compass-spin-svg {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Title banner */
.map-banner .banner-bg {
  fill: rgba(0, 0, 0, 0.65);
  stroke: var(--text);
  stroke-width: 1.2;
  filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.12));
}
.map-banner .banner-fold {
  fill: var(--accent);
  stroke: var(--text);
  stroke-width: 1;
}
.map-banner .banner-text {
  font-family: -apple-system, 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  fill: var(--text);
  letter-spacing: 0.22em;
}

/* Sea decorations — subtle dots & marks */
.sea-wave {
  fill: none;
  stroke: var(--text-tertiary);
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.35;
}
.sea-fish {
  fill: var(--text-tertiary);
  stroke: var(--text-tertiary);
  stroke-width: 0.8;
  opacity: 0.4;
}
.sea-monster {
  fill: none;
  stroke: var(--text-tertiary);
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.4;
}

/* Cohort drawer list */
.cohort-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cohort-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.cohort-row:hover {
  background: rgba(255, 255, 255, 0.10);
}

.map-empty {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.map-empty-content {
  position: relative;
  z-index: 1;
}
.map-empty-icon {
  font-size: 40px;
  color: var(--accent);
  margin-bottom: 12px;
}
.map-empty-title {
  font-family: 'Iowan Old Style', 'Palatino', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.map-empty-sub {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 360px;
  line-height: 1.55;
}

.map-customers {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(120, 90, 50, 0.16);
  border-radius: 14px;
  padding: 10px 14px;
  backdrop-filter: blur(2px);
}
.map-row-left {
  width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: 'Iowan Old Style', 'Palatino', Georgia, serif;
}
.map-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.map-row-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-row-pay {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  font-family: var(--font-sans);
  align-self: flex-start;
}
.map-row-pay.paid {
  background: rgba(46, 125, 50, 0.18);
  color: #2E5C2A;
}
.map-row-pay.unpaid {
  background: rgba(180, 90, 40, 0.18);
  color: #8B4A1F;
}
.map-row-canvas {
  flex: 1;
  min-width: 0;
}
.map-svg {
  width: 100%;
  height: 140px;
  display: block;
}

.map-path {
  fill: none;
  stroke: #8B6F47;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.7;
}
.map-path-shadow {
  fill: none;
  stroke: rgba(80, 50, 20, 0.20);
  stroke-width: 4;
  stroke-linecap: round;
  filter: blur(1.5px);
  transform: translate(0, 1.5px);
}

.map-milestone {
  cursor: pointer;
  transition: transform 200ms ease-out;
}
.map-milestone:hover {
  transform: translate(var(--mx, 0), var(--my, 0)) scale(1.08);
}
.map-milestone .map-milestone-bg {
  fill: #F4E5C0;
  stroke: #8B6F47;
  stroke-width: 2;
}
.map-milestone .map-milestone-ring {
  fill: none;
  stroke: transparent;
  stroke-width: 2;
}
.map-milestone .map-milestone-glyph {
  font-size: 18px;
  fill: #6E5331;
  font-family: 'Iowan Old Style', 'Palatino', Georgia, serif;
  pointer-events: none;
}
.map-milestone .map-milestone-label {
  font-size: 9px;
  fill: #7A5E38;
  font-family: var(--font-sans);
  font-weight: 500;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.map-milestone.done .map-milestone-bg {
  fill: url(#mile-gradient-done);
  fill: #E8B452;
  stroke: #A07A30;
}
.map-milestone.done .map-milestone-glyph {
  fill: #3C2E18;
  font-weight: 700;
}
.map-milestone.done .map-milestone-label {
  fill: #5C4527;
}

.map-milestone.current .map-milestone-bg {
  fill: #FFE5C7;
  stroke: #E8632B;
  stroke-width: 2.5;
}
.map-milestone.current .map-milestone-ring {
  stroke: rgba(232, 99, 43, 0.45);
  stroke-width: 3;
  animation: milestone-pulse 1.6s ease-out infinite;
}
.map-milestone.current .map-milestone-glyph {
  fill: #E8632B;
  font-weight: 700;
}
.map-milestone.current .map-milestone-label {
  fill: #C8531F;
  font-weight: 700;
}
@keyframes milestone-pulse {
  0%   { stroke-opacity: 0.65; r: 20; }
  100% { stroke-opacity: 0; r: 30; }
}

.map-milestone.pending .map-milestone-bg {
  fill: rgba(230, 215, 180, 0.55);
  stroke: rgba(120, 90, 50, 0.40);
  stroke-dasharray: 3 3;
}
.map-milestone.pending .map-milestone-glyph,
.map-milestone.pending .map-milestone-label {
  opacity: 0.5;
}

.map-flag {
  pointer-events: none;
}
.map-flag-pole {
  stroke: #5C4527;
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}
.map-flag-cloth {
  fill: #E8632B;
  stroke: #A0421C;
  stroke-width: 1;
}
.map-flag-name {
  font-family: 'Iowan Old Style', 'Palatino', Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  fill: rgba(255, 255, 255, 0.9);
}

.md-step-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
}
.md-step-glyph {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

/* ===================================================================
   LEARNING
   =================================================================== */

.learning-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(var(--hue-iris), 0.08), rgba(var(--hue-azure), 0.06));
  border: 1px solid rgba(var(--hue-iris), 0.18);
  border-radius: 12px;
  margin-bottom: 18px;
}
.learning-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(var(--hue-iris), 0.18);
  color: rgb(var(--hue-iris));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.learning-banner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.learning-banner-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.learning-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.learning-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.learning-card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
}
.learning-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.learning-kind {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 9px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
}
.learning-kind.kind-methodology   { background: var(--accent-soft); color: var(--accent); }
.learning-kind.kind-tool          { background: rgba(var(--hue-jade),0.18); color: rgb(var(--hue-jade)); }
.learning-kind.kind-audit_pattern { background: rgba(var(--hue-iris),0.18); color: rgb(var(--hue-iris)); }
.learning-kind.kind-industry_note { background: rgba(var(--hue-azure),0.18); color: rgb(var(--hue-azure)); }
.learning-kind.kind-preference    { background: rgba(232, 180, 82, 0.20); color: var(--text-secondary); }
.learning-kind.kind-rule          { background: rgba(216, 54, 47, 0.16); color: var(--danger); }
.learning-confidence {
  font-size: 10px;
  letter-spacing: 1px;
}
.learning-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: auto;
}
.learning-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.learning-card-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 8px;
}
.learning-card-when {
  font-size: 11.5px;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 10px;
  border-radius: 6px;
}
.learning-card-when strong {
  color: var(--text-secondary);
  font-weight: 600;
}
.learning-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  justify-content: flex-end;
}

/* ===================================================================
   COMMAND CENTER
   =================================================================== */

.cmd-view { max-width: 1280px; padding: 32px 40px 60px; }

.cmd-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
@media (max-width: 980px) { .cmd-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .cmd-stats { grid-template-columns: repeat(2, 1fr); } }

.cmd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 980px) { .cmd-grid { grid-template-columns: 1fr; } }

.cmd-main, .cmd-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cmd-card {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.cmd-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.cmd-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cmd-card-badge {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(46, 175, 139, 0.15);
  color: var(--success);
  font-weight: 500;
}
.cmd-card-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.cmd-toggles {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  padding: 2px;
}
.cmd-toggle {
  font-family: inherit;
  font-size: 11.5px;
  background: transparent;
  border: 0;
  padding: 4px 10px;
  border-radius: 5px;
  color: var(--text-tertiary);
  cursor: pointer;
  font-weight: 500;
}
.cmd-toggle.active {
  background: rgba(0, 0, 0, 0.30);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(255, 255, 255, 0.07);
}

/* Roster table */
.cmd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.cmd-table thead th {
  text-align: left;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.cmd-table th.num { text-align: right; }
.cmd-table td.num { text-align: right; }
.cmd-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.cmd-row { cursor: pointer; }
.cmd-row:hover td { background: rgba(255, 255, 255, 0.05); }
.cmd-row:last-child td { border-bottom: 0; }

.cmd-agent {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cmd-agent-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
}
.cmd-agent-dot.live { background: var(--success); }
.cmd-agent-dot.error { background: #e53e3e; box-shadow: 0 0 4px rgba(229,62,62,0.5); }
.cmd-agent-chip {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  background: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='6' width='16' height='12' rx='3'/%3E%3Ccircle cx='9' cy='12' r='1.5'/%3E%3Ccircle cx='15' cy='12' r='1.5'/%3E%3Cpath d='M12 2v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
  flex-shrink: 0;
}
.cmd-agent-name {
  font-weight: 500;
  color: var(--text);
}
.cmd-grade {
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
}
.cmd-grade.grade-a  { background: rgba(46,175,139,0.18);  color: #1A8C5C; }
.cmd-grade.grade-b  { background: rgba(72,142,230,0.18);  color: #2A5FA0; }
.cmd-grade.grade-c  { background: rgba(213,132,0,0.18);   color: var(--text-secondary); }
.cmd-grade.grade-d  { background: rgba(216,54,47,0.18);   color: var(--danger); }
.cmd-grade.grade-na { background: rgba(255, 255, 255, 0.07);    color: var(--text-tertiary); }
.cmd-trend.trend-up   { color: var(--success); }
.cmd-trend.trend-down { color: var(--danger); }
.cmd-trend.trend-flat { color: var(--text-tertiary); }
.cmd-cost { font-family: var(--font-mono); }
.cmd-last { color: var(--text-tertiary); }

/* Cost breakdown */
.cmd-cost-total {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}
.cmd-cost-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cmd-cost-row {
  display: grid;
  grid-template-columns: 110px 1fr 60px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.cmd-cost-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmd-cost-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.cmd-cost-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 200ms ease-out;
  background: rgba(255, 255, 255, 0.7) !important;
}
.cmd-cost-value {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  text-align: right;
}

/* Empty states + recent runs */
.cmd-empty {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 14px 8px;
}

.cmd-runs-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.cmd-run-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  flex-shrink: 0;
  border-left: 2px solid rgb(var(--card-hue, var(--hue-ember)));
}
.cmd-run-pill .cmd-run-cost { font-family: var(--font-mono); color: var(--text); }
.cmd-run-pill .cmd-run-time { color: var(--text-tertiary); }
.cmd-run-pill .cmd-run-rating { color: var(--accent); font-size: 10px; }
.cmd-run-pill .cmd-run-err   { color: var(--danger); font-weight: 600; }

/* Agent card report card details */
.agent-card-grade {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
}
.agent-card-grade.grade-a { background: rgba(46,175,139,0.18); color: #1A8C5C; }
.agent-card-grade.grade-b { background: rgba(72,142,230,0.18); color: #2A5FA0; }
.agent-card-grade.grade-c { background: rgba(213,132,0,0.18);  color: var(--text-secondary); }
.agent-card-grade.grade-d { background: rgba(216,54,47,0.18);  color: var(--danger); }
.agent-card-report {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 11px;
}
.agent-card-report-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 8px;
  align-items: center;
  color: var(--text-secondary);
}
.agent-card-report-label {
  font-size: 10.5px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.agent-card-stars {
  font-size: 10px;
  letter-spacing: 1px;
}
.star-on   { color: var(--accent); }
.star-half { color: var(--accent); opacity: 0.5; }
.star-off  { color: rgba(255, 255, 255, 0.15); }
.agent-card-trend {
  font-size: 10.5px;
  font-weight: 500;
}
.agent-card-trend.trend-up   { color: var(--success); }
.agent-card-trend.trend-down { color: var(--danger); }
.agent-card-trend.trend-flat { color: var(--text-tertiary); }
.agent-card-report-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-tertiary);
}
.agent-card-noratings {
  font-size: 10.5px;
  color: var(--text-tertiary);
  padding: 8px 0;
  font-style: italic;
}

/* Profile view */
.profile-view { max-width: 1100px; padding: 32px 40px 60px; }
.profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  margin-bottom: 18px;
}
.profile-head-left {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex: 1;
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  background: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='6' width='16' height='12' rx='3'/%3E%3Ccircle cx='9' cy='12' r='1.5'/%3E%3Ccircle cx='15' cy='12' r='1.5'/%3E%3Cpath d='M12 2v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 36px;
  flex-shrink: 0;
}
.profile-name {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0 0 6px 0;
}
.profile-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 10px;
}
.profile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-tertiary);
}
.profile-meta-item { color: var(--text-tertiary); }
.profile-config {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 180px;
}
.profile-config-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-secondary);
  padding: 4px 0;
}
.profile-config-row span:first-child { color: var(--text-tertiary); }
.profile-cta-row {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}
.profile-soon {
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
}

.profile-report {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 22px;
}
.profile-report-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}
.profile-report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.profile-report-tile {
  text-align: center;
}
.profile-report-grade {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
}
.profile-report-grade.grade-a { color: var(--success); }
.profile-report-grade.grade-b { color: #2A5FA0; }
.profile-report-grade.grade-c { color: var(--text-secondary); }
.profile-report-grade.grade-d { color: var(--danger); }
.profile-report-stars {
  font-size: 22px;
  letter-spacing: 2px;
}
.profile-report-trend {
  font-size: 22px;
  font-weight: 600;
}
.profile-report-trend.trend-up   { color: var(--success); }
.profile-report-trend.trend-down { color: var(--danger); }
.profile-report-trend.trend-flat { color: var(--text-tertiary); }
.profile-report-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.profile-section {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 14px;
}
.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.profile-section-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.profile-prompt {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 14px 16px;
}
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 720px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-thread-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.profile-thread-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.profile-thread-row:hover { background: rgba(255, 255, 255, 0.05); }
.profile-thread-main { flex: 1; min-width: 0; }
.profile-thread-title { font-size: 12.5px; color: var(--text); font-weight: 500; }
.profile-thread-sub   { font-size: 11px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-thread-meta  { font-size: 11px; color: var(--text-tertiary); flex-shrink: 0; }
.profile-usage {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-usage-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  border-bottom: 1px dashed var(--border);
}
.profile-usage-row:last-child { border-bottom: 0; }
.profile-usage-row strong { color: var(--text); font-weight: 600; }

/* ===================================================================
   AGENTS GRID
   =================================================================== */

.agents-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 720px) {
  .agents-stats { grid-template-columns: repeat(2, 1fr); }
}

.agents-filterbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.agents-chips {
  display: flex;
  gap: 6px;
}
.agents-chip {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
  transition: all 120ms ease-out;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.agents-chip:hover { border-color: var(--border-strong); color: var(--text); }
.agents-chip.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.agent-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  padding: 0;
  overflow: hidden;
  min-height: 180px;
  box-shadow: var(--shadow-sm);
  transition: transform 200ms ease-out, box-shadow 200ms ease-out;
}
.agent-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.agent-card-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 80% at 0% 0%, rgba(var(--card-hue, var(--hue-ember)), 0.30), transparent 60%),
    radial-gradient(80% 80% at 100% 100%, rgba(var(--card-hue, var(--hue-ember)), 0.18), transparent 60%);
  pointer-events: none;
}
.agent-card-content {
  position: relative;
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 180px;
}
.agent-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.agent-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: linear-gradient(135deg, rgba(var(--card-hue, var(--hue-ember)), 0.95), rgba(var(--card-hue, var(--hue-ember)), 0.65));
  color: white;
  flex-shrink: 0;
}
.agent-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
}
.agent-card-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.agent-card-tag.beta {
  background: var(--accent-soft);
  color: var(--accent);
}
.agent-card-tag.soon {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-tertiary);
}
.agent-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
}
.agent-card-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
}
.agent-card-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
}
.agent-card-dot.live {
  background: var(--success);
}
.agent-card-cost {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 7px;
  border-radius: 4px;
}

/* ===================================================================
   THREAD VIEW (new — full-width with Context side rail)
   =================================================================== */

.thread-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  padding: 16px;
  gap: 16px;
}

.thread-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}
.thread-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.thread-agent-chip {
  width: 26px;
  height: 26px;
  font-size: 12px;
  flex-shrink: 0;
}
.thread-topbar .thread-title-input {
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 6px;
}
.thread-topbar .thread-title-input:focus {
  background: rgba(255, 255, 255, 0.06);
}

.thread-token-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: rgba(46, 175, 139, 0.12);
  border: 1px solid rgba(46, 175, 139, 0.25);
  border-radius: 999px;
  font-size: 11px;
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.thread-token-num  { color: var(--success); font-weight: 600; }
.thread-token-cost { color: var(--text-secondary); }

.thread-topbar-tabs {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 2px;
}
.thread-tab {
  font-family: inherit;
  font-size: 11.5px;
  background: transparent;
  border: 0;
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--text-tertiary);
  cursor: pointer;
  font-weight: 500;
}
.thread-tab.active {
  background: rgba(0, 0, 0, 0.30);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(255, 255, 255, 0.07);
}

.thread-topbar-right {
  display: flex;
  gap: 6px;
}

.thread-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  flex: 1;
  min-height: 0;
}
@media (max-width: 980px) {
  .thread-body { grid-template-columns: 1fr; }
  .thread-context { display: none; }
}

.thread-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px 28px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.thread-main .chat {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
}
.thread-main .chat-input-wrap {
  flex-shrink: 0;
  padding-top: 12px;
}

.thread-pane {
  padding: 8px 0;
}
.thread-pane-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.thread-pane-empty {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
}
.thread-usage-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.thread-usage-tile {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 14px 16px;
}
.thread-usage-num {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.thread-usage-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Context side rail — no wrapper, floating glass cards */
.thread-context {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.thread-context-card {
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.thread-context-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.thread-context-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
.thread-context-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.thread-context-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin-bottom: 8px;
}
.thread-context-textarea {
  width: 100%;
  min-height: 140px;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  resize: vertical;
  outline: 0;
}
.thread-context-textarea:focus { border-color: var(--accent); }
.thread-context-status {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  min-height: 14px;
}
.thread-context-status.ok  { color: var(--success); }
.thread-context-status.err { color: var(--danger); }

.thread-plan-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.thread-plan-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.thread-plan-row.done {
  color: var(--text-tertiary);
}
.thread-plan-row.done .thread-plan-text {
  text-decoration: line-through;
}
.thread-plan-dot {
  font-size: 11px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}

.thread-mini-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.thread-mini-stats > div {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  padding: 4px 0;
  color: var(--text-secondary);
}
.thread-mini-stats > div span { color: var(--text-tertiary); }
.thread-mini-stats > div strong { color: var(--text); font-weight: 600; }

/* ===================================================================
   THREAD VIEW (legacy classes — kept for compat)
   =================================================================== */

.thread-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: calc(100vh - 32px);
}
.thread-head {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.thread-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.thread-head-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.thread-head-right {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.thread-head-loading {
  font-size: 12px;
  color: var(--text-tertiary);
}
.thread-title-input-wrap {
  margin-bottom: 2px;
}
.thread-title-input {
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  padding: 0;
  width: 100%;
}
.thread-title-input:focus {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
}
.thread-meta {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

/* ===================================================================
   DRAFTER AGENT
   =================================================================== */

.drafter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 980px) {
  .drafter-grid { grid-template-columns: 1fr; }
}

.drafter-form,
.drafter-preview {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-sm);
}
.drafter-preview {
  min-height: 600px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding: 0;
}
.drafter-section-title {
  margin: 0 0 12px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.drafter-section-title em {
  text-transform: none;
  letter-spacing: 0;
  font-style: normal;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-left: 6px;
  font-size: 10.5px;
}
.drafter-req {
  color: var(--accent);
}

.drafter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.drafter-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.drafter-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}
.drafter-label em {
  font-style: normal;
  color: var(--accent);
  margin-left: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.drafter-transcript {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  font-family: var(--font-sans);
  line-height: 1.55;
}
.drafter-notes {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  font-family: var(--font-sans);
  line-height: 1.55;
}
.drafter-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.drafter-status {
  font-size: 12px;
  color: var(--text-tertiary);
}
.drafter-status.ok  { color: var(--success); }
.drafter-status.err { color: var(--danger); }

.drafter-empty {
  height: 100%;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  color: var(--text-tertiary);
}
.drafter-empty-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.drafter-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.drafter-empty-sub {
  font-size: 12.5px;
  max-width: 320px;
  line-height: 1.55;
}
.drafter-empty-sub code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.07);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.drafter-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 600px;
  gap: 14px;
}
.drafter-loading-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
.drafter-loading-text {
  font-size: 13px;
  color: var(--text-secondary);
}
.drafter-error {
  padding: 24px;
  color: var(--danger);
  font-size: 13px;
}

.drafter-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  z-index: 1;
}
.drafter-preview-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.drafter-preview-meta code {
  font-family: var(--font-mono);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--text-secondary);
}
.drafter-preview-actions {
  display: flex;
  gap: 6px;
}
.drafter-preview-body {
  padding: 24px 26px 40px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

/* Markdown styling inside drafter-preview-body */
.drafter-preview-body .md-h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.drafter-preview-body .md-h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 10px 0;
  letter-spacing: -0.01em;
}
.drafter-preview-body .md-h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 8px 0;
}
.drafter-preview-body .md-h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}
.drafter-preview-body .md-p {
  margin: 0 0 12px 0;
}
.drafter-preview-body .md-list {
  margin: 0 0 14px 0;
  padding-left: 22px;
}
.drafter-preview-body .md-list li {
  margin-bottom: 4px;
}
.drafter-preview-body .md-quote {
  margin: 14px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-secondary);
}
.drafter-preview-body .md-hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
.drafter-preview-body .md-code {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  margin: 12px 0;
  color: var(--text);
}
.drafter-preview-body .md-icode {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.07);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
.drafter-preview-body .md-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 12.5px;
}
.drafter-preview-body .md-table th,
.drafter-preview-body .md-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.drafter-preview-body .md-table th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.drafter-preview-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===================================================================
   INBOX DRAWER
   =================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(640px, 100vw);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.drawer-backdrop.open .drawer-panel {
  transform: translateX(0);
}
.drawer-loading {
  padding: 32px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}
.drawer-head {
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: 0;
  color: var(--text-tertiary);
  font-size: 14px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.drawer-close:hover {
  background: var(--surface);
  color: var(--text);
}
.drawer-meta {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}
.drawer-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 14px 0;
  padding-right: 36px;
  line-height: 1.3;
}
.drawer-from {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.drawer-label {
  display: inline-block;
  width: 76px;
  color: var(--text-tertiary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 32px;
}
.drawer-body-text {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  word-wrap: break-word;
  margin: 0;
  letter-spacing: -0.005em;
}
.drawer-body-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.drawer-body-text a:hover {
  text-decoration: none;
}
.email-block {
  white-space: pre-wrap;
}
.email-block + .email-block {
  margin-top: 4px;
}
.email-quote {
  white-space: pre-wrap;
  color: var(--text-tertiary);
  border-left: 2px solid var(--border-strong);
  padding-left: 12px;
  margin: 12px 0;
  font-size: 13px;
}
.email-quote + .email-block,
.email-block + .email-quote {
  margin-top: 12px;
}
.drawer-body-iframe {
  width: 100%;
  min-height: 60vh;
  border: 0;
  background: rgba(0, 0, 0, 0.30);
  border-radius: 8px;
}
.row-title.unread {
  font-weight: 600;
  color: var(--text);
}
.row-title.unread::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: middle;
}

.view-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.drawer-actions {
  margin-top: 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.drawer-danger:hover {
  color: #FF6B6B !important;
}

.inbox-tabs {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  border-bottom: 1px solid var(--border);
}
.inbox-tab {
  background: transparent;
  border: 0;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}
.inbox-tab:hover {
  color: var(--text-secondary);
}
.inbox-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.inbox-tab-action {
  margin-left: auto;
  margin-bottom: 4px;
}

.compose-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tpl-menu {
  position: absolute;
  top: 52px;
  right: 16px;
  width: 320px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--surface-elev);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  padding: 6px;
}
.tpl-menu[hidden] { display: none; }
.tpl-loading {
  padding: 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
}
.tpl-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  gap: 2px;
}
.tpl-item:hover {
  background: var(--accent-soft);
}
.tpl-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.tpl-subject {
  font-size: 11px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.compose-head { position: relative; }

/* ===================================================================
   COMPOSE MODAL
   =================================================================== */

.compose-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 30, 0.36);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
  padding-bottom: 8vh;
}
.compose-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.compose-panel {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 16vh);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.97) translateY(8px);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.compose-backdrop.open .compose-panel {
  transform: scale(1) translateY(0);
}
.compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.compose-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.compose-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
}
.compose-field {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.compose-label {
  width: 56px;
  flex-shrink: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}
.compose-field input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 4px 0;
}
.compose-field input::placeholder { color: var(--text-tertiary); }
.compose-textarea {
  width: 100%;
  min-height: 220px;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.55;
  resize: vertical;
  padding: 8px 0;
}
.compose-textarea::placeholder { color: var(--text-tertiary); }

.placeholders {
  background: var(--accent-soft);
  border: 1px solid rgba(255, 138, 61, 0.25);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 4px;
}
.placeholders[hidden] { display: none; }
.placeholders-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 600;
}
.placeholders-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-left: 6px;
}
.placeholders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.placeholder-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.placeholder-name {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.placeholder-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  outline: 0;
}
.placeholder-input:focus {
  border-color: var(--accent);
}
.placeholder-input::placeholder { color: var(--text-tertiary); }
.compose-status {
  font-size: 12px;
  color: var(--text-tertiary);
  min-height: 16px;
}
.compose-status.ok { color: var(--accent); }
.compose-status.err { color: #FF6B6B; }
.compose-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.compose-foot-spacer { flex: 1; }
.compose-select {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 4px 0;
  cursor: pointer;
}
.compose-select option {
  background: var(--surface-elev);
  color: var(--text);
}
.compose-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.compose-attachments:empty { display: none; }
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
  color: var(--text);
  max-width: 240px;
}
.att-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-size {
  color: var(--text-tertiary);
  font-size: 11px;
  flex-shrink: 0;
}
.att-remove {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 0;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.att-remove:hover {
  background: var(--surface-elev);
  color: var(--text);
}

/* ===================================================================
   TOASTS
   =================================================================== */

.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--surface-elev);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toast-in 200ms ease-out;
  max-width: 320px;
}
.toast.error { border-left: 3px solid var(--danger); }
.toast.success { border-left: 3px solid var(--success); }
.toast.warn { border-left: 3px solid #d6b13c; background: rgba(214, 177, 60, 0.06); }
.toast.warn strong { color: #d6b13c; font-weight: 600; }
.toast.warn a { color: #d6b13c; text-decoration: underline; }
.toast.error a { color: #d97070; text-decoration: underline; }
.toast { max-width: 380px; line-height: 1.45; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===================================================================
   EMPTY STATES
   =================================================================== */

.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
}
.empty-icon {
  font-size: 32px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  opacity: 0.6;
}
.empty-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.empty-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  max-width: 320px;
  margin: 0 auto 20px;
  line-height: 1.5;
}

/* ===================================================================
   SETTINGS / FORMS
   =================================================================== */

.settings-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}
.settings-row {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.settings-row:last-child { border-bottom: 0; }
.settings-row .label {
  flex: 0 0 200px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.settings-row .value {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}

/* ===================================================================
   SAGE — Rubrics, evaluations, performance
   =================================================================== */

.learning-header-actions {
  display: flex;
  gap: 8px;
}

.rubrics-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rubric-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.rubric-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.rubric-card-icon {
  font-size: 22px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  flex-shrink: 0;
}
.rubric-card-body { flex: 1; min-width: 0; }
.rubric-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.rubric-card-title { font-weight: 600; font-size: 15px; color: var(--text); }
.rubric-card-meta { font-size: 12px; color: var(--text-muted); }
.rubric-card-score { text-align: right; min-width: 90px; }
.rubric-score-num { font-size: 18px; font-weight: 600; }
.rubric-score-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rubric-score-empty { color: var(--text-muted); font-size: 18px; }

.rubric-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-weight: 500;
}
.rubric-tag.tag-general { background: var(--accent-soft); color: var(--accent); }
.rubric-tag.tag-creative { background: rgba(var(--hue-iris),0.18); color: rgb(var(--hue-iris)); }
.rubric-tag.tag-strategic { background: rgba(var(--hue-ember),0.18); color: rgb(var(--hue-ember)); }
.rubric-tag.tag-technical { background: rgba(var(--hue-jade),0.18); color: rgb(var(--hue-jade)); }
.rubric-tag.tag-research { background: rgba(var(--hue-azure),0.18); color: rgb(var(--hue-azure)); }
.rubric-tag.tag-support { background: rgba(255,255,255,0.07); color: var(--text-muted); }
.rubric-tag.tag-source { background: rgba(232,180,82,0.20); color: var(--text-secondary); }
.rubric-tag.tag-agent { background: rgba(var(--hue-azure),0.16); color: rgb(var(--hue-azure)); }
.rubric-tag.tag-judge { background: rgba(255,255,255,0.06); color: var(--text-muted); font-family: ui-monospace, monospace; font-size: 10px; }
.rubric-tag.tag-model { background: rgba(255,255,255,0.06); color: var(--text-muted); font-family: ui-monospace, monospace; font-size: 10px; }
.rubric-tag.tag-completed { background: rgba(46,160,67,0.18); color: rgb(46,160,67); }
.rubric-tag.tag-running { background: rgba(232,180,82,0.20); color: var(--text-secondary); }

.score-high { color: rgb(46,160,67); }
.score-mid { color: #B8860B; }
.score-low { color: var(--danger); }

.rubric-preview-criteria {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
}
.rubric-preview-row { display: flex; justify-content: space-between; font-size: 13px; }
.rubric-preview-name { color: var(--text); }
.rubric-preview-weight { color: var(--text-muted); font-weight: 500; }

.rubric-back { margin-bottom: 16px; }
.back-link { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--text); }

.rubric-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.rubric-detail-tags {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.rubric-detail-actions { display: flex; gap: 8px; flex-shrink: 0; }

.rubric-summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.rubric-summary-tile {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
}
.rubric-summary-num { font-size: 22px; font-weight: 600; color: var(--text); }
.rubric-summary-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.rubric-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 12px;
}

.rubric-criteria-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.rubric-criterion-row {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.rubric-criterion-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.rubric-criterion-name { font-weight: 600; font-size: 14px; }
.rubric-criterion-weight { font-weight: 600; font-size: 13px; color: var(--text-muted); }
.rubric-criterion-desc { font-size: 13px; color: var(--text-muted); }

.rubric-eval-history { display: flex; flex-direction: column; gap: 6px; }
.rubric-eval-row {
  display: grid;
  grid-template-columns: 70px 1fr 220px 90px;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  align-items: center;
  transition: border-color 0.15s ease;
}
.rubric-eval-row.v2 {
  grid-template-columns: 70px 1fr 160px 110px 90px;
}
.rubric-eval-row:hover { border-color: var(--accent); }
.rubric-eval-score { font-weight: 600; font-size: 15px; }
.rubric-eval-judge { color: var(--text-muted); font-size: 12px; font-family: ui-monospace, monospace; }
.rubric-eval-rating { font-size: 13px; letter-spacing: 1px; }
.rubric-eval-unrated { color: var(--text-muted); font-style: italic; font-size: 11px; }
.rubric-eval-time { color: var(--text-muted); font-size: 12px; text-align: right; }
.judge-stat-star { color: rgba(255,255,255,0.20); font-size: 14px; }
.judge-stat-star.filled { color: #DAA520; }
.judge-stat-stars-row { display: flex; gap: 1px; justify-content: center; }
.judge-stat-stars-row .judge-stat-star { font-size: 18px; }
.rubric-summary-row {
  grid-template-columns: repeat(5, 1fr);
}

/* ===================================================================
   RUBRIC EDITOR
   =================================================================== */
.rubric-editor-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 0 64px;
}
.rubric-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 32px;
}
.rubric-editor-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.rubric-editor-section { margin-bottom: 18px; }
.rubric-editor-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.rubric-editor-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.rubric-editor-optional { font-weight: 400; color: var(--text-muted); }
.rubric-editor-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.rubric-editor-input:focus { outline: none; border-color: var(--accent); }
textarea.rubric-editor-input { resize: vertical; }

.rubric-editor-criteria-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.rubric-editor-weight-total {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.rubric-editor-weight-total.ok { background: rgba(46,160,67,0.18); color: rgb(46,160,67); }
.rubric-editor-weight-total.bad { background: rgba(216,54,47,0.16); color: var(--danger); }

.rubric-editor-criteria { display: flex; flex-direction: column; gap: 10px; }
.rubric-editor-criterion {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.rubric-editor-criterion-row {
  display: grid;
  grid-template-columns: 1fr 80px 32px;
  gap: 8px;
  margin-bottom: 8px;
}
.rubric-editor-remove {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
}
.rubric-editor-remove:hover { color: var(--danger); border-color: var(--danger); }

.rubric-editor-add {
  margin-top: 10px;
  padding: 8px 14px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  width: 100%;
  font-family: inherit;
}
.rubric-editor-add:hover { color: var(--text); border-color: var(--text-muted); }

.rubric-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.rubric-editor-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(216,54,47,0.08);
  border: 1px solid rgba(216,54,47,0.20);
  border-radius: 8px;
  color: var(--danger);
  font-size: 13px;
}

.rubrics-page-title-block { flex: 1; }

/* Codey: form bubble + preview side-by-side */
.codey-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: flex-start;
}
.codey-form-bubble { margin-top: 0; }
.codey-preview {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  min-height: 480px;
}
.codey-form-bubble .msg-form-chips-radio { gap: 6px; }
.codey-form-bubble .msg-form-chip { width: 100%; justify-content: flex-start; }

.eval-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.eval-overall { margin: 24px 0 32px; }
.eval-overall-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.eval-overall-bar {
  height: 14px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.eval-overall-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.eval-overall-fill.score-high { background: rgb(46,160,67); }
.eval-overall-fill.score-mid { background: #DAA520; }
.eval-overall-fill.score-low { background: var(--danger); }
.eval-overall-num { text-align: right; font-size: 28px; font-weight: 700; margin-top: 4px; }

.eval-section-head { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 12px; }
.eval-validated {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.eval-criteria-list { display: flex; flex-direction: column; gap: 10px; }
.eval-criterion {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.eval-criterion-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.eval-criterion-name { font-weight: 600; font-size: 14px; color: var(--text); }
.eval-criterion-weight { font-weight: 500; color: var(--text-muted); font-size: 13px; }
.eval-criterion-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.eval-criterion-bar {
  width: 80px;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.eval-criterion-bar-fill { height: 100%; }
.eval-criterion-bar-fill.score-high { background: rgb(46,160,67); }
.eval-criterion-bar-fill.score-mid { background: #DAA520; }
.eval-criterion-bar-fill.score-low { background: var(--danger); }
.eval-criterion-score { font-weight: 600; font-size: 14px; min-width: 38px; text-align: right; }
.eval-criterion-verdict { font-size: 12px; color: var(--text-muted); min-width: 60px; }
.eval-validate-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}
.eval-validate-btn:hover { background: var(--accent-soft); }
.eval-validate-btn.active { background: var(--accent-soft); border-color: var(--accent); }

.eval-criterion-reasoning {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  margin-top: 8px;
}
.eval-criterion-revision {
  font-size: 12px;
  color: var(--accent);
  margin-top: 6px;
  font-style: italic;
}

.eval-narrative,
.eval-improvements {
  margin-top: 24px;
  padding: 18px 20px;
  background: rgba(255,255,255,0.04);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}
.eval-narrative-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.eval-narrative-body { font-size: 14px; line-height: 1.6; color: var(--text); }
.eval-improvements { border-left-color: rgb(46,160,67); }

.eval-meta { margin-top: 20px; font-size: 12px; color: var(--text-muted); }
.eval-meta a { color: var(--accent); text-decoration: none; }

.perf-info { border-radius: 10px; }
.perf-table { display: flex; flex-direction: column; gap: 16px; }
.perf-agent-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.perf-agent-head {
  padding: 12px 18px;
  background: rgba(255,255,255,0.04);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  text-transform: capitalize;
}
.perf-rows { display: flex; flex-direction: column; }
.perf-row {
  display: grid;
  grid-template-columns: 1fr 80px 100px 160px 140px;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
}
.perf-row:first-child { border-top: none; }
.perf-cell.perf-model { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text-muted); }
.perf-cell.perf-score { font-weight: 600; font-size: 15px; }
.perf-cell.perf-runs, .perf-cell.perf-cost { color: var(--text-muted); font-size: 12px; }
.perf-flag-tag { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 500; }
.perf-flag-tag.flag-downgrade { background: rgba(46,160,67,0.18); color: rgb(46,160,67); }
.perf-flag-tag.flag-upgrade { background: rgba(216,54,47,0.16); color: var(--danger); }

.recent-evals { display: flex; flex-direction: column; gap: 4px; }
.recent-eval-row {
  display: grid;
  grid-template-columns: 1fr 1fr 80px 100px;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  align-items: center;
}
.recent-eval-row:hover { border-color: var(--accent); }
.recent-eval-rubric { font-weight: 500; }
.recent-eval-agent { color: var(--text-muted); font-size: 12px; }
.recent-eval-score { font-weight: 600; text-align: right; }
.recent-eval-time { color: var(--text-muted); font-size: 12px; text-align: right; }

.btn.btn-danger:hover { color: var(--danger); border-color: var(--danger); }

.learning-kind.kind-rubric { background: var(--accent-soft); color: var(--accent); }

/* ===================================================================
   THREAD VIEW V2 — header bar, model pill, composer
   =================================================================== */

.thread-topbar.v2 {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.07), 0 1px 3px rgba(255, 255, 255, 0.05);
}
.thread-topbar.v2 .thread-topbar-left {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; flex: 1;
}
.thread-topbar.v2 .thread-title-input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  flex: 1;
  padding: 4px 6px;
  border-radius: 6px;
}
.thread-topbar.v2 .thread-title-input:focus {
  background: rgba(255,255,255,0.05);
}
.thread-fav-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 6px;
}
.thread-fav-btn:hover { color: var(--accent); }
.thread-fav-btn.active { color: #DAA520; }

.thread-topbar-mid {
  display: flex; align-items: center; gap: 8px;
}
.thread-model-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
}
.thread-model-name { color: var(--text); font-weight: 500; }
.thread-model-sep { color: var(--text-muted); opacity: 0.5; }
.thread-token-num, .thread-token-cost { color: var(--text-muted); }

.thread-icon-btn {
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: 6px;
}
.thread-icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }

.thread-topbar.v2 .thread-topbar-right {
  display: flex; align-items: center; gap: 8px;
}
.thread-topbar.v2 .thread-topbar-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  padding: 3px;
  border-radius: 8px;
}
.thread-topbar.v2 .thread-tab {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
}
.thread-topbar.v2 .thread-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Composer V2 — floating element at the bottom of the chat card */
.chat-input-wrap.v2 {
  padding: 16px 0 0;
  border-top: none;
  margin-top: 16px;
}
.chat-composer {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 10px 12px 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chat-composer:focus-within {
  border-color: rgba(10, 10, 10, 0.2);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08), 0 0 0 3px rgba(0, 0, 0, 0.04);
}
.chat-composer:focus-within { border-color: rgba(10, 10, 10, 0.3); }
.chat-composer-input {
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  min-height: 40px;
  max-height: 200px;
}

.chat-composer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 0;
}
.chat-composer-btn {
  background: transparent;
  border: 1px solid var(--border);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
}
.chat-composer-btn:hover { background: rgba(255,255,255,0.06); }
.chat-composer-bar-spacer { flex: 1; }
.chat-composer-execute {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.chat-composer-execute:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.chat-composer-execute-caret { font-size: 9px; }
.chat-composer-send {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-composer-send:hover { opacity: 0.85; }
.chat-composer-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===================================================================
   AGENT MESSAGE PROTOCOL — reasoning, forms, skills
   =================================================================== */

.msg-reasoning {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.025);
  border-radius: 8px;
  font-size: 13px;
}
.msg-reasoning summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
  user-select: none;
  padding: 2px 0;
}
.msg-reasoning summary:hover { color: var(--text); }
.msg-reasoning[open] summary { margin-bottom: 8px; }
.msg-reasoning-body {
  white-space: pre-wrap;
  color: var(--text-muted);
  line-height: 1.55;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.msg-prose { white-space: pre-wrap; }

/* When a bot message contains only a form (or skill), hide the avatar
   and let the form take full width with the gradient ring. */
.chat-msg.bot:has(.msg-form):not(:has(.msg-prose)) .avatar { display: none; }
.chat-msg.bot:has(.msg-form):not(:has(.msg-prose)) .body { max-width: 760px; width: 100%; }
.chat-msg.bot .body { max-width: 720px; }

.msg-form {
  margin-top: 14px;
  padding: 0;
  border-radius: 16px;
  position: relative;
  /* Glassy light-grey ring */
  border: 1.5px solid transparent;
  background:
    linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.40)) padding-box,
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.10)) border-box;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 8px 28px rgba(0, 0, 0, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.10);
}
.msg-form-inner {
  padding: 22px 26px 18px;
}
.msg-form-title {
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 18px;
  color: var(--text);
}
.msg-form-field {
  margin-bottom: 22px;
  padding-bottom: 6px;
}
.msg-form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.msg-form-row-2 .msg-form-field { margin-bottom: 22px; }
.msg-form-field:last-of-type { margin-bottom: 12px; }
.msg-form-label {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
  font-weight: 600;
}
.msg-form-sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 10px;
}
.msg-form-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.msg-form-chips-radio { flex-direction: column; align-items: flex-start; }
.msg-form-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: all 0.12s ease;
}
.msg-form-chip:hover { border-color: var(--text-muted); background: rgba(255,255,255,0.04); }
.msg-form-chip input[type="checkbox"],
.msg-form-chip input[type="radio"] {
  margin: 0;
  accent-color: var(--text);
  width: 14px; height: 14px;
}
.msg-form-chip:has(input:checked) {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.msg-form-chip:has(input:checked) input { accent-color: var(--bg); }
.msg-form-text {
  width: 100%;
  padding: 10px 14px;
  margin-top: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.msg-form-select {
  width: 100%;
  padding: 10px 36px 10px 14px;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.msg-form-select:focus { outline: none; border-color: var(--accent); }
textarea.msg-form-text { border-radius: 12px; }
.msg-form-text:focus { outline: none; border-color: var(--accent); }
.msg-form-text::placeholder { color: var(--text-muted); font-style: italic; }
.msg-form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
}
.msg-form-actions .btn-primary {
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  padding: 8px 16px;
}
.msg-form-actions .btn-primary:hover { opacity: 0.9; }
.msg-form-clear {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 0;
}
.msg-form-clear:hover { color: var(--text); }
.msg-form-submitted { opacity: 0.6; }
.msg-form-scroll-link {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
}
.msg-form-scroll-link:hover { color: var(--text); }

.msg-skill {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(var(--hue-iris), 0.25);
  border-radius: 12px;
  position: relative;
}
.msg-skill-tag {
  position: absolute;
  top: -8px;
  left: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.msg-skill-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  margin-top: 4px;
}
.msg-skill-icon { font-size: 14px; }
.msg-skill-name { font-weight: 600; font-size: 14px; color: var(--text); }
.msg-skill-why {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}
.msg-skill-actions { display: flex; gap: 6px; }

/* Skills view */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.skill-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skill-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.skill-card-icon { font-size: 16px; }
.skill-card-name { font-weight: 600; font-size: 14px; flex: 1; }
.skill-card-pin { color: #DAA520; }
.skill-card-kind {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  align-self: flex-start;
  text-transform: capitalize;
}
.skill-card-why {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.skill-card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}
.skill-card-source { flex: 1; }
.skill-card-action {
  background: transparent;
  border: 1px solid var(--border);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-muted);
}
.skill-card-action:hover { color: var(--text); border-color: var(--text-muted); }

/* ===================================================================
   COMMAND CENTER V2
   =================================================================== */

.cmd-view.v2 {
  padding: 32px 36px 80px;
  max-width: 1400px;
  margin: 0 auto;
}

.cmd-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.cmd-header-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.cmd-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cmd-search {
  padding: 7px 12px 7px 32px;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") no-repeat 10px center;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  width: 220px;
  color: var(--text);
}
.cmd-search:focus { outline: none; border-color: var(--accent); }

.cmd-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
}
.cmd-strip-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cmd-strip-tile.interactive { cursor: pointer; }
.cmd-strip-tile.interactive:hover .cmd-strip-num { color: var(--accent); }
.cmd-strip-icon {
  font-size: 13px;
  color: var(--text-muted);
}
.cmd-strip-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-top: -2px;
}
.cmd-strip-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}
.cmd-strip-num.warn { color: #DAA520; }

.cmd-grid.v2 {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-bottom: 20px;
}

.cmd-recent-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.cmd-recent-bar .cmd-card-head { padding: 0; margin-bottom: 12px; }

.cmd-attn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(232,180,82,0.10);
  border: 1px solid rgba(232,180,82,0.25);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.cmd-attn-head:hover { background: rgba(232,180,82,0.18); }
.cmd-attn-count {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}
.cmd-attn-arrow { color: var(--text-secondary); }

.cmd-attn-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cmd-attn-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  font-size: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
}
.cmd-attn-icon { font-size: 13px; }
.cmd-attn-title {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmd-attn-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.cmd-score {
  font-weight: 600;
}

/* ===================================================================
   AGENT PROFILE V2 (Petra-style)
   =================================================================== */

.profile-view.v2 {
  padding: 28px 36px 80px;
  max-width: 1100px;
  margin: 0 auto;
}
.profile-back { margin-bottom: 24px; }
.profile-back .back-link {
  background: transparent; border: none; cursor: pointer;
  font-size: 13px; color: var(--text-muted); padding: 4px 0;
}
.profile-back .back-link:hover { color: var(--text); }

.profile-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.profile-head.v2 { padding: 0; background: transparent; border: none; }
.profile-head-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: flex-start;
}
.profile-avatar.v2 {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  font-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='6' width='16' height='12' rx='3'/%3E%3Ccircle cx='9' cy='12' r='1.5'/%3E%3Ccircle cx='15' cy='12' r='1.5'/%3E%3Cpath d='M12 2v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 40px;
  border: 1px solid var(--border);
}
.profile-head-mid { min-width: 0; }
.profile-name.v2 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
}
.profile-desc.v2 {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 8px;
  max-width: 640px;
}
.profile-meta-line {
  font-size: 12px;
  color: var(--text-muted);
}

.profile-config-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 200px;
}
.profile-config-card .profile-config-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.profile-config-card .profile-config-row span { color: var(--text-muted); }
.profile-config-card .profile-config-row strong { font-weight: 500; color: var(--text); }

.profile-section.v2 { margin-top: 4px; }
.profile-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.profile-prompt-box {
  position: relative;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 200px;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.profile-prompt-box.expanded { max-height: 2000px; }
.profile-prompt-box.expanded .profile-prompt-fade { display: none; }
.profile-prompt-content {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
}
.profile-prompt-edit {
  position: absolute;
  top: 12px; right: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 26px; height: 26px;
  cursor: pointer;
  color: var(--text-muted);
}
.profile-prompt-edit:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.profile-prompt-fade {
  position: absolute;
  bottom: 36px; left: 0; right: 0; height: 60px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--surface));
  pointer-events: none;
}
.profile-prompt-toggle {
  position: absolute;
  bottom: 8px; left: 50%; transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.profile-prompt-toggle:hover { color: var(--text); }

.profile-invocations-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.profile-invocations-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.profile-invocations-icon { color: #DAA520; }
.profile-invocations-title { font-weight: 600; font-size: 14px; }
.profile-invocations-sub {
  font-size: 12px; color: var(--text-muted); margin: 0 0 14px;
}
.profile-invocations-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.profile-invocation-tile {
  position: relative;
  padding: 14px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px dashed var(--border);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.profile-invocation-tile:hover { border-color: var(--text-muted); background: rgba(255,255,255,0.06); }
.profile-invocation-tile.soon {
  opacity: 0.5;
  cursor: not-allowed;
}
.profile-invocation-tag {
  position: absolute;
  top: -8px; right: 8px;
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.profile-invocation-icon { font-size: 22px; margin-bottom: 6px; }
.profile-invocation-label { font-size: 12px; color: var(--text); }

.profile-grid.v2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.profile-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.profile-card.mini { padding: 12px 16px; cursor: pointer; }
.profile-card.mini:hover { border-color: var(--text-muted); }
.profile-card-stack { display: flex; flex-direction: column; gap: 12px; }
.profile-card-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.profile-card-icon { font-size: 14px; }
.profile-card-title { font-weight: 600; font-size: 13px; flex: 1; }
.profile-card-count {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
}
.profile-card-link { font-size: 11px; color: var(--accent); text-decoration: none; }
.profile-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px;
  line-height: 1.5;
}
.profile-card-foot-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: underline;
}

.profile-integrations-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.profile-integration-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.7;
}
.profile-integration-tile.active {
  opacity: 1;
  background: var(--surface);
  border-color: var(--text-muted);
}
.profile-integration-icon { font-size: 14px; }
.profile-integration-label { flex: 1; }
.profile-integration-check { color: rgb(46,160,67); }

.profile-new-thread-btn {
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 8px;
}
.profile-new-thread-btn:hover { color: var(--text); border-color: var(--text-muted); }

.profile-thread-list { display: flex; flex-direction: column; gap: 4px; }
.profile-thread-row.v2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.profile-thread-row.v2:hover { background: rgba(255,255,255,0.05); border-color: var(--border); }
.profile-thread-main { min-width: 0; flex: 1; }
.profile-thread-title { font-weight: 500; font-size: 13px; color: var(--text); }
.profile-thread-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-thread-meta { font-size: 11px; color: var(--text-muted); flex-shrink: 0; margin-left: 8px; }

.profile-usage.v2 {
  display: flex; flex-direction: column; gap: 8px;
}
.profile-usage.v2 .profile-usage-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.profile-usage.v2 .profile-usage-row:last-child { border-bottom: none; }
.profile-usage.v2 .profile-usage-row span { color: var(--text-muted); }
.profile-usage.v2 .profile-usage-row strong { color: var(--text); font-weight: 500; }

/* ===================================================================
   RUBRICS PAGE V2
   =================================================================== */

.rubrics-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 0 64px;
}
.rubrics-page-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 28px;
}
.rubrics-back-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.rubrics-back-btn:hover { background: rgba(255,255,255,0.06); }
.rubrics-page-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.rubrics-page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 2px 0 4px;
}
.rubrics-page-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.rubrics-info {
  background: rgba(124, 91, 207, 0.06);
  border: 1px solid rgba(124, 91, 207, 0.16);
  border-radius: 12px;
  margin-bottom: 24px;
  padding: 0;
}
.rubrics-info > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.rubrics-info > summary::-webkit-details-marker { display: none; }
.rubrics-info-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(124,91,207,0.15);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rubrics-info-text { flex: 1; }
.rubrics-info-text strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
}
.rubrics-info-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.rubrics-info-toggle {
  font-size: 12px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}
.rubrics-info-caret { font-size: 9px; }
.rubrics-info[open] > summary .rubrics-info-toggle::before { content: 'Collapse'; }
.rubrics-info[open] > summary .rubrics-info-toggle { font-size: 0; }
.rubrics-info[open] > summary .rubrics-info-toggle::before { font-size: 12px; }
.rubrics-info-body {
  padding: 0 18px 16px 60px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.rubrics-recent { margin-bottom: 24px; }
.rubrics-recent-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.rubrics-recent-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.rubrics-recent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  min-width: 200px;
  transition: border-color 0.15s ease;
}
.rubrics-recent-card:hover { border-color: var(--text-muted); }
.rubrics-recent-card-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.rubrics-recent-card-thread {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.rubrics-recent-card-foot {
  margin-top: 4px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.rubrics-recent-card-score { font-weight: 600; font-size: 13px; }
.rubrics-recent-card-time { font-size: 11px; color: var(--text-muted); }

.rubrics-suggest-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 24px;
  padding: 0;
}
.rubrics-suggest-banner > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.rubrics-suggest-banner > summary::-webkit-details-marker { display: none; }
.rubrics-suggest-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rubrics-suggest-text {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
}
.rubrics-suggest-count {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(232,180,82,0.20);
  color: var(--text-secondary);
}
.rubrics-suggest-body {
  padding: 0 18px 16px 60px;
}

.rubrics-list-heading {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 14px;
}

.rubrics-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.rubrics-search-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.rubrics-search-input:focus { outline: none; border-color: var(--accent); }
.rubrics-filter-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text-muted);
}
.rubrics-type-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.rubrics-archived-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.rubrics-archived-toggle input { accent-color: var(--text); }

.rubrics-rows { display: flex; flex-direction: column; gap: 8px; }
.rubric-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.rubric-row:hover { border-color: var(--text-muted); }
.rubric-row-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rubric-row-body { min-width: 0; }
.rubric-row-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rubric-row-title { font-weight: 600; font-size: 14px; color: var(--text); }
.rubric-row-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.rubric-row-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.rubric-row-runs { font-size: 12px; color: var(--text-muted); }
.rubric-row-pct { font-weight: 600; font-size: 14px; }
.rubric-row-empty { color: var(--text-muted); }

/* ===================================================================
   EVAL DETAIL V2
   =================================================================== */

.view.eval-detail.v2 {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 0 64px;
}

.eval-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 32px;
}

.eval-detail-head.v2 {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.eval-detail-head-left { min-width: 0; }
.eval-detail-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
}
.eval-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.eval-detail-existing {
  font-weight: 500;
  color: var(--text-muted);
}
.eval-detail-meta-sep { opacity: 0.4; }
.eval-detail-judge-name {
  font-family: ui-monospace, monospace;
  font-size: 11px;
}
.eval-detail-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.eval-status-pill {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 500;
}
.pill-completed { background: rgba(46,160,67,0.18); color: rgb(46,160,67); }
.pill-running { background: rgba(232,180,82,0.20); color: var(--text-secondary); }

.eval-overall.v2 .eval-overall-bar {
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
}

.judge-rate-block {
  margin: 24px 0;
  padding: 18px 20px;
  background: rgba(232,180,82,0.06);
  border: 1px solid rgba(232,180,82,0.20);
  border-radius: 12px;
}
.judge-rate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.judge-rate-label strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
}
.judge-rate-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.judge-rate-stars {
  display: flex;
  gap: 4px;
}
.judge-star {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: rgba(0,0,0,0.15);
  padding: 0;
  transition: color 0.1s ease, transform 0.1s ease;
}
.judge-star:hover, .judge-star.hover { color: #DAA520; transform: scale(1.1); }
.judge-star.filled { color: #DAA520; }
.judge-rate-note {
  width: 100%;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  min-height: 40px;
}
.judge-rate-note:focus { outline: none; border-color: var(--accent); }

/* ===================================================================
   LEARNING PAGE V2
   =================================================================== */

/* When .learning-page is the .view itself, scope the inner-content
   width to its direct children so the floating card's padding stays. */
.view.learning-page > * {
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}

/* ===================================================================
   PIPELINE ANALYTICS BOARD
   =================================================================== */

.view.pipeline-page {
  max-width: 1200px;
}

/* ---- Pipeline — page header ---- */
.pipe-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
.pipe-page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
}
.pipe-page-actions { display: flex; gap: 6px; align-items: center; }

/* ---- Pipeline — stat cards ---- */
.pipe-stat-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.pipe-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.pipe-stat:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.pipe-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.pipe-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.pipe-stat.warn .pipe-stat-value { color: var(--danger); }
.pipe-stat-delta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
}

/* ---- Pipeline — split bar ---- */
.pipe-split-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.pipe-split-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  white-space: nowrap;
  min-width: 60px;
}
.pipe-split-bar {
  flex: 1;
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border);
}
.pipe-split-seg {
  height: 100%;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
.pipe-split-seg.stack    { background: var(--text); border-radius: 999px 0 0 999px; }
.pipe-split-seg.workforce{ background: var(--text-tertiary); border-radius: 0 999px 999px 0; }
.pipe-split-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.pipe-split-meta-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.pipe-split-meta-dot.stack    { background: var(--text); }
.pipe-split-meta-dot.workforce{ background: var(--text-tertiary); }

/* ---- Pipeline — segmented control (track tabs) ---- */
.pipe-seg-control {
  display: inline-flex;
  background: var(--border);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 20px;
}
.pipe-seg-btn {
  padding: 8px 20px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.pipe-seg-btn:hover { color: var(--text); }
.pipe-seg-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.pipe-seg-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 400;
  margin-left: 6px;
}
.pipe-seg-btn.active .pipe-seg-meta { color: var(--text-secondary); }

/* ---- Pipeline — tier legend (inline) ---- */
.pipe-tier-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 0 2px;
}
.pipe-tier-row-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-right: 4px;
}

/* ---- Pipeline — size dots ---- */
.pipe-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
}
.pipe-dot.sz-solo       { background: rgb(46, 160, 67); }
.pipe-dot.sz-smb        { background: rgb(72, 142, 230); }
.pipe-dot.sz-mid        { background: rgb(124, 99, 230); }
.pipe-dot.sz-enterprise { background: rgb(232, 99, 43); }
.pipe-dot.sz-unknown    { background: rgba(0,0,0,0.18); }

/* ---- Pipeline — funnel stages ---- */
.pipe-funnel {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 28px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
}
.pipe-funnel::-webkit-scrollbar { height: 4px; }
.pipe-funnel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.pipe-stage-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.pipe-stage-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 140px;
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.pipe-stage-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.pipe-stage-card.selected {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}
.pipe-stage-card.empty { opacity: 0.45; }
.pipe-stage-card.pulsing {
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(46, 160, 67, 0.25);
}
.pipe-stage-name {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.pipe-stage-count {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
}
.pipe-stage-value {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 500;
  min-height: 16px;
}
.pipe-stage-buckets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.pipe-bucket-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}
.pipe-bucket-empty {
  font-size: 11px;
  color: var(--text-tertiary);
}
.pipe-stage-tier-mix {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

/* ---- Pipeline — conversion connector ---- */
.pipe-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  min-width: 44px;
}
.pipe-connector-line {
  width: 20px;
  height: 1px;
  background: var(--border-strong);
  margin-bottom: 4px;
}
.pipe-connector-rate {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  font-family: var(--font-mono, ui-monospace, monospace);
  white-space: nowrap;
}
.pipe-connector.good .pipe-connector-rate { color: var(--success); }
.pipe-connector.mid  .pipe-connector-rate { color: var(--warning); }
.pipe-connector.bad  .pipe-connector-rate { color: var(--danger); }

/* ---- Pipeline — drill-in panel ---- */
.pipe-drill-hint {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 400;
}
.pipe-drill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.pipe-drill-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.pipe-drill-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 400;
}
.pipe-drill-stage { font-weight: 600; font-size: 14px; }
.pipe-drill-count {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  color: var(--text-secondary);
}
.pipe-drill-close {
  margin-left: auto;
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.pipe-drill-close:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.pipe-drill-list { display: flex; flex-direction: column; }
.pipe-drill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.12s;
}
.pipe-drill-row:first-child { border-top: none; }
.pipe-drill-row:hover { background: rgba(0,0,0,0.015); }
.pipe-drill-row.stuck { background: rgba(216, 54, 47, 0.03); }
.pipe-drill-name { font-weight: 600; }
.pipe-drill-company { color: var(--text-secondary); }
.pipe-drill-meta {
  color: var(--text-tertiary);
  font-size: 12px;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.pipe-drill-stuck-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(216, 54, 47, 0.10);
  color: var(--danger);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pipe-drill-tier {
  margin-left: auto;
  font-weight: 600;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--success);
}

/* ---- Pipeline — Closer brief ---- */
.pipe-closer-brief {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
}
.pipe-closer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.pipe-closer-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.pipe-closer-title { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.pipe-closer-close {
  margin-left: auto;
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.pipe-closer-close:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.pipe-closer-summary {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  margin: 0 0 20px;
}
.pipe-closer-section { margin-top: 20px; }
.pipe-closer-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 10px;
}
.pipe-leak {
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
}
.pipe-leak-rate {
  margin-left: 8px;
  font-weight: 700;
  color: var(--danger);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
}
.pipe-leak-why { margin-top: 8px; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.pipe-leak-fix { margin-top: 8px; color: var(--text); font-size: 13px; font-weight: 500; }

.pipe-priorities { display: flex; flex-direction: column; gap: 8px; }
.pipe-priority {
  padding: 14px 16px;
  background: rgba(0,0,0,0.015);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-left: 3px solid var(--text-tertiary);
  transition: box-shadow 0.15s;
}
.pipe-priority:hover { box-shadow: var(--shadow-sm); }
.pipe-priority.urgency-now { border-left-color: var(--danger); }
.pipe-priority.urgency-this_week { border-left-color: var(--warning); }
.pipe-priority.urgency-eventually { border-left-color: var(--text-tertiary); }
.pipe-priority-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.pipe-priority-action {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  font-size: 11px;
  color: var(--text);
}
.pipe-priority-customer { font-weight: 600; color: var(--text); }
.pipe-priority-tier {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}
.pipe-priority-urgency {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.pipe-priority-script {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.pipe-priority-reason {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ===================================================================
   REVENUE TAB
   =================================================================== */

.view.revenue-page { max-width: 1200px; }

.rev-page-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.rev-page-title { font-size: 22px; font-weight: 700; margin: 0; }

.rev-stat-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
}
.rev-stat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 4px 8px;
  border-right: 1px solid var(--border);
}
.rev-stat:last-child { border-right: none; }
.rev-stat-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.rev-stat-value { font-size: 18px; font-weight: 700; color: var(--text); }
.rev-stat.warn .rev-stat-value { color: var(--danger); }

.rev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.rev-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.rev-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
}
.rev-card-title { font-weight: 600; font-size: 14px; }
.rev-card-sub { font-size: 11px; color: var(--text-muted); }
.rev-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

.rev-trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding-top: 8px;
}
.rev-trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.rev-trend-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  min-height: 2px;
  transition: opacity 0.15s ease;
}
.rev-trend-col:hover .rev-trend-bar { opacity: 0.85; }
.rev-trend-seg { display: block; }
.rev-trend-label {
  font-size: 10px;
  color: var(--text-muted);
}
.rev-trend-val {
  font-size: 9px;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}

.rev-tier-list { display: flex; flex-direction: column; gap: 8px; }
.rev-tier-row {
  display: grid;
  grid-template-columns: 12px 70px 32px 1fr 70px 36px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.rev-tier-dot { width: 10px; height: 10px; border-radius: 50%; }
.rev-tier-name { font-weight: 500; }
.rev-tier-count { color: var(--text-muted); font-size: 12px; }
.rev-tier-bar {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.rev-tier-bar-fill { height: 100%; }
.rev-tier-total { font-weight: 600; text-align: right; font-family: ui-monospace, monospace; font-size: 12px; }
.rev-tier-pct { font-size: 11px; color: var(--text-muted); text-align: right; }

.rev-customers, .rev-payments { display: flex; flex-direction: column; gap: 6px; }
.rev-customer-row {
  display: grid;
  grid-template-columns: 24px 1fr 200px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
}
.rev-customer-row:hover { background: rgba(255,255,255,0.04); border-color: var(--border); }
.rev-customer-rank {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
}
.rev-customer-name { font-weight: 500; }
.rev-customer-meta { color: var(--text-muted); font-size: 11px; }
.rev-customer-total { font-weight: 600; font-family: ui-monospace, monospace; }

.rev-pay-row {
  display: grid;
  grid-template-columns: 12px 80px 1fr 100px 80px 24px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
}
.rev-pay-row:hover { background: rgba(255,255,255,0.04); }
.rev-pay-tier-dot { width: 10px; height: 10px; border-radius: 50%; }
.rev-pay-tier { font-weight: 500; font-size: 12px; }
.rev-pay-customer { color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rev-pay-amount { font-weight: 600; font-family: ui-monospace, monospace; text-align: right; }
.rev-pay-time { color: var(--text-muted); font-size: 11px; text-align: right; }
.rev-pay-del {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px; opacity: 0;
}
.rev-pay-row:hover .rev-pay-del { opacity: 1; }
.rev-pay-del:hover { color: var(--danger); }

/* Modal (shared) */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px 28px;
  max-width: 580px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(0,0,0,0.18);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close {
  background: transparent; border: none; font-size: 20px;
  cursor: pointer; color: var(--text-muted);
}
.modal-close:hover { color: var(--text); }
.rev-recurring-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.rev-recurring-toggle input { accent-color: var(--text); }
.rev-log-error {
  margin-top: 10px; padding: 8px 12px;
  background: rgba(216,54,47,0.08); border: 1px solid rgba(216,54,47,0.20);
  border-radius: 6px; color: var(--danger); font-size: 12px;
}

/* ===================================================================
   CUSTOMER PROFILE
   =================================================================== */

.customers-filter-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.customer-profile { max-width: 1100px; }

.cust-profile-head {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}
.cust-profile-avatar {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0;
  background: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M5.5 21c0-4 2.9-7 6.5-7s6.5 3 6.5 7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 36px;
}
.cust-profile-avatar.sz-solo,
.cust-profile-avatar.sz-smb,
.cust-profile-avatar.sz-mid,
.cust-profile-avatar.sz-enterprise,
.cust-profile-avatar.sz-unknown    { background-color: rgba(255, 255, 255, 0.08); }

.cust-profile-name { font-size: 24px; margin: 0 0 6px; font-weight: 700; }
.cust-profile-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cust-profile-meta a { color: var(--text); }
.cust-meta-sep { opacity: 0.4; }
.cust-profile-tags { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.cust-tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.cust-tag-meta { font-size: 11px; color: var(--text-muted); }
.cust-profile-actions { display: flex; gap: 6px; }

.cust-stat-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
}
.cust-stat-tile {
  display: flex; flex-direction: column; gap: 4px;
  padding: 4px 8px;
  border-right: 1px solid var(--border);
}
.cust-stat-tile:last-child { border-right: none; }
.cust-stat-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.cust-stat-value { font-size: 16px; font-weight: 700; }

.cust-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.cust-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.cust-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
.cust-card-title { font-weight: 600; font-size: 14px; }
.cust-card-sub { font-size: 11px; color: var(--text-muted); }

.cust-notes {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  resize: vertical;
}
.cust-notes:focus { outline: none; border-color: var(--accent); }
.cust-notes-status { font-size: 11px; color: var(--text-muted); margin-top: 4px; min-height: 14px; }

.cust-timeline { display: flex; flex-direction: column; gap: 4px; }
.cust-timeline-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
}
.cust-timeline-row:hover { background: rgba(255,255,255,0.04); }
.cust-timeline-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.07);
  border-radius: 8px;
  font-size: 13px;
}
.cust-timeline-row.tl-payment .cust-timeline-icon { background: rgba(46,160,67,0.18); color: rgb(46,160,67); }
.cust-timeline-row.tl-audit .cust-timeline-icon { background: rgba(124,99,230,0.18); color: rgb(124,99,230); }
.cust-timeline-row.tl-call .cust-timeline-icon { background: rgba(72,142,230,0.18); color: rgb(72,142,230); }
.cust-timeline-row.tl-walkthrough .cust-timeline-icon { background: rgba(232,99,43,0.18); color: rgb(232,99,43); }
.cust-timeline-label { font-weight: 500; font-size: 13px; }
.cust-timeline-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cust-timeline-meta { font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace; text-align: right; }

/* Customer row status dot */
.customer-pay-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 6px;
  flex-shrink: 0;
}
.customer-pay-dot.paid { background: rgb(46, 160, 67); box-shadow: 0 0 0 3px rgba(46, 160, 67, 0.18); }
.customer-pay-dot.outstanding { background: var(--danger); box-shadow: 0 0 0 3px rgba(216, 54, 47, 0.18); animation: pulse-red 2s ease-in-out infinite; }
.customer-pay-dot.na { background: rgba(0,0,0,0.15); }
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 3px rgba(216, 54, 47, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(216, 54, 47, 0.04); }
}

/* Revenue v2 — timeframe + expenses overlay */
.rev-page-actions { display: flex; gap: 6px; }
.rev-stat.expense .rev-stat-value { color: var(--danger); }
.rev-stat.good .rev-stat-value { color: rgb(46,160,67); }

.rev-timeframe-row { display: flex; gap: 4px; }
.rev-timeframe-row .chip { padding: 3px 10px; font-size: 11px; }

.rev-trend-with-expenses .rev-trend-col { position: relative; }
.rev-trend-stack {
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  position: relative;
  min-height: 2px;
}
.rev-trend-with-expenses .rev-trend-bar {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  min-height: 2px;
}
.rev-trend-exp {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 6px;
  background: repeating-linear-gradient(45deg, rgba(216,54,47,0.65), rgba(216,54,47,0.65) 2px, rgba(216,54,47,0.35) 2px, rgba(216,54,47,0.35) 4px);
  border-radius: 3px;
}
.rev-trend-exp-val { color: var(--danger); }

.rev-trend-legend {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  justify-content: center;
}
.rev-legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.rev-legend-rev { background: linear-gradient(135deg, rgb(124,99,230), rgb(72,142,230)); }
.rev-legend-exp { background: repeating-linear-gradient(45deg, rgba(216,54,47,0.65), rgba(216,54,47,0.65) 2px, rgba(216,54,47,0.35) 2px, rgba(216,54,47,0.35) 4px); }

.rev-cat-dot { background: rgba(216, 54, 47, 0.7) !important; }
.rev-cat-fill { background: rgba(216, 54, 47, 0.7) !important; }
.rev-pay-amount.expense { color: var(--danger); }

/* Payment search + month filter row */
.rev-pay-filter-row {
  display: grid;
  grid-template-columns: 1fr 200px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.rev-pay-search {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}
.rev-pay-search:focus { outline: none; border-color: var(--accent); }
.rev-pay-month {
  padding: 7px 30px 7px 12px !important;
  font-size: 13px !important;
}
.rev-pay-filtered-total {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}
.rev-pay-filtered-total strong {
  color: var(--text);
  font-family: ui-monospace, monospace;
}

/* ===================================================================
   STATE OF BUSINESS (Chief)
   =================================================================== */

.view.sob-page { max-width: 1200px; }

.sob-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.sob-page-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.sob-page-sub { font-size: 13px; color: var(--text-muted); }
.sob-page-actions { display: flex; gap: 8px; }

.sob-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
}
.sob-stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 8px;
  border-right: 1px solid var(--border);
}
.sob-stat:last-child { border-right: none; }
.sob-stat-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.sob-stat-value { font-size: 18px; font-weight: 700; color: var(--text); }
.sob-stat-sub { font-size: 10px; color: var(--text-muted); }
.sob-stat-sub.pos { color: rgb(46,160,67); }
.sob-stat-sub.neg { color: var(--danger); }

/* Workforce cost breakdown card (Boardroom) */
.sob-cost-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.sob-cost-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 14px;
}
.sob-cost-title { font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: 0.01em; }
.sob-cost-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.sob-cost-total { text-align: right; }
.sob-cost-total-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.sob-cost-total-num { font-size: 22px; font-weight: 700; color: var(--text); }
.sob-cost-rows { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: 8px; overflow: hidden; }
.sob-cost-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; background: var(--surface-elev);
}
.sob-cost-row-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text-secondary);
  background: var(--bg);
  flex-shrink: 0;
}
.sob-cost-row-body { flex: 1; min-width: 0; }
.sob-cost-row-label { font-size: 13px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 8px; }
.sob-cost-row-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.sob-cost-row-num { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.sob-cost-tag {
  font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--surface-translucent); color: var(--text-muted);
  padding: 2px 6px; border-radius: 4px;
}
.sob-cost-tag-warn { background: rgba(213,132,0,0.14); color: var(--warning); }
.sob-cost-foot {
  display: flex; gap: 24px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
}
.sob-cost-foot-row { display: flex; gap: 6px; align-items: baseline; }
.sob-cost-foot-label { color: var(--text-muted); }
.sob-cost-foot-val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.sob-cost-foot-hint { font-size: 10px; font-weight: 400; opacity: 0.7; margin-left: 2px; }
.sob-cost-health-ok { color: rgb(46,160,67); }
.sob-cost-health-mid { color: var(--warning); }
.sob-cost-health-warn { color: var(--danger); }

.sob-brief-card {
  background: linear-gradient(180deg, rgba(124,99,230,0.04), rgba(124,99,230,0.01));
  border: 1px solid rgba(124,99,230,0.20);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 18px;
}
.sob-brief-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.sob-trajectory {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid var(--border);
}
.sob-trajectory.traj-up    { border-color: rgba(46,160,67,0.4); }
.sob-trajectory.traj-up    .sob-traj-arrow { color: rgb(46,160,67); }
.sob-trajectory.traj-down  { border-color: rgba(216,54,47,0.4); }
.sob-trajectory.traj-down  .sob-traj-arrow { color: var(--danger); }
.sob-trajectory.traj-mid   { border-color: rgba(232,180,82,0.4); }
.sob-trajectory.traj-mid   .sob-traj-arrow { color: #B8860B; }
.sob-trajectory.traj-flat  .sob-traj-arrow { color: var(--text-muted); }
.sob-traj-arrow { font-size: 26px; font-weight: 700; line-height: 1; }
.sob-traj-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase;
}
.sob-traj-score { font-size: 13px; color: var(--text-muted); font-family: ui-monospace, monospace; }

.sob-brief-meta {
  display: flex; align-items: center; gap: 8px;
}
.sob-brief-time { font-size: 12px; color: var(--text-muted); }
.sob-brief-select {
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.sob-headline {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.4;
}
.sob-brief-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.sob-brief-body p { margin: 0 0 10px; }

.sob-focus {
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(232,99,43,0.06);
  border: 1px solid rgba(232,99,43,0.20);
  border-radius: 10px;
}
.sob-focus-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 8px;
}
.sob-focus-list { display: flex; flex-direction: column; gap: 10px; }
.sob-focus-item {
  padding-left: 12px;
  border-left: 2px solid var(--accent);
}
.sob-focus-priority { font-weight: 700; font-size: 14px; }
.sob-focus-why { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.sob-focus-step { font-size: 13px; color: var(--text); margin-top: 4px; }

.sob-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 1100px) {
  .sob-grid { grid-template-columns: repeat(3, 1fr); }
}
.sob-list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.sob-list-card.sob-list-risks  { border-left: 3px solid var(--danger); }
.sob-list-card.sob-list-opps   { border-left: 3px solid rgb(46,160,67); }
.sob-list-card.sob-list-adds   { border-left: 3px solid rgb(72,142,230); }
.sob-list-card.sob-list-cuts   { border-left: 3px solid #B8860B; }
.sob-list-card.sob-list-pivots { border-left: 3px solid rgb(124,99,230); }
.sob-list-card.sob-list-keep   { border-left: 3px solid rgb(46,160,67); }
.sob-list-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}
.sob-list-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
.sob-list-item {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.sob-list-item:first-of-type { border-top: none; padding-top: 0; }
.sob-list-label { font-weight: 600; font-size: 13px; }
.sob-list-why { font-size: 12px; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }
.sob-list-action { font-size: 12px; color: var(--accent); margin-top: 4px; }

.sob-empty {
  text-align: center;
  padding: 64px 32px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 14px;
}
.sob-empty-icon {
  font-size: 32px;
  color: var(--accent);
  margin-bottom: 12px;
}
.sob-empty-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.sob-empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

.learn-page-head { margin-bottom: 22px; }
.learn-page-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.learn-page-icon { font-size: 22px; }
.learn-page-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0;
}
.learn-page-count-pill {
  font-size: 12px;
  padding: 3px 10px;
  background: rgba(232,180,82,0.18);
  color: var(--text-secondary);
  border-radius: 999px;
  font-weight: 500;
}

.learn-hero {
  background: rgba(46,160,67,0.06);
  border: 1px solid rgba(46,160,67,0.18);
  border-radius: 14px;
  margin-bottom: 24px;
}
.learn-hero > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.learn-hero > summary::-webkit-details-marker { display: none; }
.learn-hero-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(46,160,67,0.16);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.learn-hero-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.learn-hero-text strong {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}
.learn-hero-text span { font-size: 13px; color: var(--text-muted); }
.learn-hero-toggle { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.learn-hero-caret { font-size: 9px; }
.learn-hero-body {
  padding: 0 18px 16px 68px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.learn-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.learn-preview-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.learn-preview-card:hover { border-color: var(--text-muted); }
.learn-preview-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.learn-preview-icon { font-size: 16px; }
.learn-preview-title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}
.learn-preview-count {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.learn-preview-pinned {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
}
.learn-preview-arrow { color: var(--text-muted); font-size: 16px; }
.learn-preview-empty { font-size: 12px; color: var(--text-muted); padding: 8px 0; }
.learn-preview-sub { font-size: 12px; color: var(--text-muted); }
.learn-preview-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.learn-preview-list li {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.learn-preview-more {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.learn-preview-rubric-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.learn-preview-rubric-list li {
  display: grid;
  grid-template-columns: 1fr 60px 32px;
  gap: 6px;
  font-size: 12px;
  align-items: center;
}
.learn-preview-rubric-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.learn-preview-rubric-bar {
  height: 5px;
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
  overflow: hidden;
}
.learn-preview-rubric-bar-fill {
  height: 100%;
  background: rgb(46,160,67);
}
.learn-preview-rubric-pct {
  font-weight: 600;
  font-size: 11px;
}
.learn-preview-rubric-empty { color: var(--text-muted); }

.learn-page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 18px;
}

.learn-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.learn-filter-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.learn-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.chip:hover { border-color: var(--text-muted); }
.chip.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.chip.muted { opacity: 0.6; cursor: default; }
.chip-icon { font-size: 13px; }
.chip-num {
  font-size: 11px;
  opacity: 0.75;
  font-weight: 500;
}

.learn-filter-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0 18px;
}

.learn-thread-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.learn-thread-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.learn-thread-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 16px auto 1fr auto auto auto;
  gap: 8px;
  align-items: center;
}
.learn-thread-group > summary::-webkit-details-marker { display: none; }
.learn-thread-caret {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.learn-thread-group[open] > summary .learn-thread-caret { transform: rotate(0deg); }
.learn-thread-group:not([open]) > summary .learn-thread-caret { transform: rotate(-90deg); }
.learn-thread-prefix {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 13px;
}
.learn-thread-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.learn-thread-title:hover { text-decoration: underline; }
.learn-thread-meta { font-size: 11px; color: var(--text-muted); }
.learn-thread-badge {
  font-size: 11px;
  padding: 3px 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
}
.learn-thread-icons { display: flex; gap: 4px; }
.learn-thread-kind-icon {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
}

.learn-thread-body {
  padding: 0 18px 16px 18px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
}
.learn-suggestions-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #B8860B;
  font-weight: 600;
  margin: 14px 0 10px;
}

.learn-suggest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}
.learn-suggest-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 10px;
  align-items: center;
}
.learn-suggest-card > summary::-webkit-details-marker { display: none; }
.learn-suggest-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
}
.learn-suggest-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.learn-suggest-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  font-weight: 500;
}
.learn-suggest-tag.tag-memory { background: rgba(124,91,207,0.10); color: var(--accent); }
.learn-suggest-conf {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}
.learn-suggest-conf.conf-high { background: rgba(46,160,67,0.18); color: rgb(46,160,67); }
.learn-suggest-conf.conf-mid { background: rgba(232,180,82,0.20); color: var(--text-secondary); }
.learn-suggest-conf.conf-low { background: rgba(216,54,47,0.16); color: var(--danger); }
.learn-suggest-caret { font-size: 12px; color: var(--text-muted); }
.learn-suggest-body {
  padding: 0 14px 14px 14px;
  border-top: 1px solid var(--border);
}
.learn-suggest-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 12px;
}
.learn-suggest-meta-label { color: var(--text-muted); }
.learn-suggest-meta-cat {
  padding: 2px 8px;
  background: rgba(255,255,255,0.07);
  border-radius: 6px;
  color: var(--text);
}
.learn-suggest-stars { color: #DAA520; letter-spacing: 1px; }
.learn-suggest-stars-empty { color: rgba(0,0,0,0.15); }
.learn-card-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 8px;
}
.learn-suggest-when {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.learn-suggest-when strong { color: var(--text); }
.learn-suggest-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.learn-suggest-actions .btn-primary {
  background: var(--text);
  color: var(--bg);
}

/* ===================================================================
   TIER DOTS / CHIPS
   =================================================================== */

.tier-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(var(--this-tier-hue, var(--hue-ember)));
  margin-right: 4px;
  flex-shrink: 0;
}
.tier-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  background: rgba(var(--this-tier-hue, var(--hue-ember)), 0.12);
  color: rgb(var(--this-tier-hue, var(--hue-ember)));
  text-transform: lowercase;
}
.tier-chip .tier-dot {
  width: 6px;
  height: 6px;
  margin-right: 0;
}
.tier-ship              { --this-tier-hue: var(--tier-ship); }
.tier-build             { --this-tier-hue: var(--tier-build); }
.tier-os                { --this-tier-hue: var(--tier-os); }
.tier-starter_3         { --this-tier-hue: var(--tier-starter_3); }
.tier-starter_5         { --this-tier-hue: var(--tier-starter_5); }
.tier-custom_force      { --this-tier-hue: var(--tier-custom_force); }
.tier-persona           { --this-tier-hue: var(--tier-persona); }
.tier-workforce_os_seat { --this-tier-hue: var(--tier-workforce_os_seat); }
.tier-care_plan         { --this-tier-hue: var(--tier-care_plan); }

/* (pipe-tier-legend, pipe-stage-tier-mix — moved to main pipeline CSS block) */

/* Customer-profile engagement pill border by tier */
.custpipe-eng[data-tier="ship"]              { border-left: 3px solid rgb(var(--tier-ship)); }
.custpipe-eng[data-tier="build"]             { border-left: 3px solid rgb(var(--tier-build)); }
.custpipe-eng[data-tier="os"]                { border-left: 3px solid rgb(var(--tier-os)); }
.custpipe-eng[data-tier="starter_3"]         { border-left: 3px solid rgb(var(--tier-starter_3)); }
.custpipe-eng[data-tier="starter_5"]         { border-left: 3px solid rgb(var(--tier-starter_5)); }
.custpipe-eng[data-tier="custom_force"]      { border-left: 3px solid rgb(var(--tier-custom_force)); }
.custpipe-eng[data-tier="persona"]           { border-left: 3px solid rgb(var(--tier-persona)); }
.custpipe-eng[data-tier="workforce_os_seat"] { border-left: 3px solid rgb(var(--tier-workforce_os_seat)); }
.custpipe-eng[data-tier="care_plan"]         { border-left: 3px solid rgb(var(--tier-care_plan)); }

/* ===================================================================
   WORKFORCE MAP
   =================================================================== */

.wf-page { padding-bottom: 60px; }

.wf-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.wf-page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}
.wf-page-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.wf-page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.wf-dataset-select {
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  min-width: 200px;
}

.wf-mode-toggle {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}
.wf-mode-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
  font-family: inherit;
}
.wf-mode-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.wf-canvas {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.wf-canvas.present {
  background: var(--surface);
  border-color: var(--border);
  padding: 56px 40px;
}

.wf-tier {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.wf-tier-top { margin-bottom: 4px; }

.wf-connector-line {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.wf-teams-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}
.wf-team-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  flex: 1 1 200px;
  max-width: 240px;
  min-width: 180px;
}
.wf-team-head {
  text-align: center;
  margin-bottom: 6px;
  position: relative;
}
.wf-team-head::before {
  content: '';
  position: absolute;
  top: -28px;
  left: 50%;
  width: 1px;
  height: 18px;
  background: var(--border);
}
.wf-team-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.wf-team-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.wf-card {
  background: var(--surface-elev);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.wf-card:hover {
  border-color: rgba(var(--card-hue, var(--hue-ember)), 0.55);
  transform: translateY(-1px);
}
.wf-card.lead {
  border-color: rgba(var(--card-hue, var(--hue-ember)), 0.4);
  box-shadow: inset 0 0 0 1px rgba(var(--card-hue, var(--hue-ember)), 0.15);
}
.wf-card.paused { opacity: 0.55; }

.wf-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wf-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  font-size: 14px;
  background: linear-gradient(135deg, rgba(var(--card-hue, var(--hue-ember)), 0.20), rgba(var(--card-hue, var(--hue-ember)), 0.08));
  color: rgb(var(--card-hue, var(--hue-ember)));
  border-radius: 6px;
  flex-shrink: 0;
}
.wf-card-titles { flex: 1; min-width: 0; }
.wf-card-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  line-height: 1.25;
}
.wf-card-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.wf-card-tag.paused {
  background: rgba(214,138,60,0.14);
  color: #b87432;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
}
.wf-card-lead-mark {
  color: rgb(var(--card-hue, var(--hue-ember)));
  font-size: 13px;
  margin-left: auto;
}
.wf-card-desc {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.wf-card-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
}
.wf-card-meta > span {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}
.wf-card-tasks {
  background: rgba(var(--card-hue, var(--hue-ember)), 0.10) !important;
  color: rgb(var(--card-hue, var(--hue-ember))) !important;
  border-color: rgba(var(--card-hue, var(--hue-ember)), 0.25) !important;
}

.wf-card-owners {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  gap: 4px;
}
.wf-owners-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 4px;
}
.wf-owner-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  font-size: 11px;
  background: linear-gradient(135deg, rgba(var(--card-hue, var(--hue-ember)), 0.20), rgba(var(--card-hue, var(--hue-ember)), 0.08));
  color: rgb(var(--card-hue, var(--hue-ember)));
  border-radius: 50%;
  border: 1px solid rgba(var(--card-hue, var(--hue-ember)), 0.30);
}

.wf-client-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 14px 16px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 8px;
}
.wf-gen-help {
  font-size: 12px;
  color: var(--text-muted);
}

.wf-empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.wf-empty-hint {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.8;
}

.wf-foot-meta {
  margin-top: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* Print: clean for PDF export */
@media print {
  .sidebar, .wf-page-actions, .wf-foot-meta { display: none !important; }
  .wf-page { padding: 0; }
  .wf-canvas { border: none; box-shadow: none; }
  .main { padding: 0 !important; }
}

/* (pipe-track-split, pipe-track-tabs — replaced by pipe-seg-control + pipe-split-row in main pipeline CSS block) */

/* ===================================================================
   CUSTOMER — RECURRING PLANS (subscriptions / MRR)
   =================================================================== */

.cust-subs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}
.cust-sub-row {
  display: flex;
  align-items: stretch;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid rgb(var(--this-tier-hue, var(--hue-mint)));
  border-radius: 8px;
}
.cust-sub-row[data-tier="care_plan"]         { --this-tier-hue: var(--tier-care_plan); }
.cust-sub-row[data-tier="workforce_os_seat"] { --this-tier-hue: var(--tier-workforce_os_seat); }

.cust-sub-main { flex: 1; }
.cust-sub-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.cust-sub-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.cust-sub-mrr {
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.cust-sub-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.cust-sub-health {
  font-weight: 600;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cust-sub-health.health-current     { background: rgba(76,175,80,0.14); color: #4ba055; }
.cust-sub-health.health-lapsed      { background: rgba(255,90,90,0.14); color: #d97070; }
.cust-sub-health.health-no-billing  { background: rgba(120,120,120,0.10); color: #888; }
.cust-sub-detail { color: var(--text-muted); }

/* ===================================================================
   PER-CUSTOMER CUSTOM PIPELINE
   =================================================================== */

#cust-pipeline-card { margin-bottom: 18px; }

.custpipe-track {
  padding: 14px 0;
  border-bottom: 1px dashed var(--border);
}
.custpipe-track:last-child { border-bottom: none; }
.custpipe-track-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 10px;
}
.custpipe-track-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
.custpipe-track-stages {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  padding: 6px 0;
}
.custpipe-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 84px;
  position: relative;
}
.custpipe-stage-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--surface);
  margin-bottom: 6px;
  transition: background 0.2s;
}
.custpipe-stage.current .custpipe-stage-dot {
  width: 18px; height: 18px;
  margin-bottom: 4px;
  box-shadow: 0 0 0 4px rgba(214, 138, 60, 0.18);
  animation: custpipe-pulse 2s infinite;
}
@keyframes custpipe-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(214, 138, 60, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(214, 138, 60, 0.28); }
}
.custpipe-stage-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.02em;
}
.custpipe-stage.done .custpipe-stage-label,
.custpipe-stage.current .custpipe-stage-label {
  color: var(--text);
  font-weight: 600;
}
.custpipe-stage-link {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 12px;
  margin: 0 -2px 22px;
  align-self: center;
  border-radius: 2px;
}

.custpipe-next {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
}
.custpipe-next-label {
  color: var(--text-muted);
  margin-right: 4px;
}
.custpipe-next-reason {
  color: var(--text-muted);
  margin-left: 8px;
}

.custpipe-engs {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.custpipe-eng {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.custpipe-eng-tier { font-weight: 600; }
.custpipe-eng-stage {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.custpipe-eng-stage.stage-proposal    { background: rgba(120,120,120,0.12); color: #777; }
.custpipe-eng-stage.stage-negotiation { background: rgba(64,169,222,0.12); color: #4ba9de; }
.custpipe-eng-stage.stage-engaged     { background: rgba(75,169,222,0.18); color: #2c89be; }
.custpipe-eng-stage.stage-closed_won,
.custpipe-eng-stage.stage-closed-won  { background: rgba(76,175,80,0.18); color: #4ba055; }
.custpipe-eng-stage.stage-closed_lost,
.custpipe-eng-stage.stage-closed-lost { background: rgba(255,90,90,0.14); color: #d97070; }
.custpipe-eng-value { font-family: var(--font-mono, monospace); color: var(--text-muted); }

.custpipe-candidates {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(75,169,222,0.06);
  border-left: 3px solid rgba(75,169,222,0.45);
  border-radius: 6px;
}
.custpipe-candidates-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  color: #2c89be;
  text-transform: uppercase;
}
.custpipe-candidates-list {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  color: var(--text);
}

.custpipe-closer {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(214, 138, 60, 0.6);
  border-radius: 8px;
}
.custpipe-closer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.custpipe-closer-summary {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 14px;
}
.custpipe-closer-section { margin-bottom: 12px; }
.custpipe-closer-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}
.custpipe-closer-urg {
  margin-left: 8px;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 4px;
  text-transform: lowercase;
}
.custpipe-closer-urg.now        { background: rgba(255,90,90,0.14); color: #d97070; }
.custpipe-closer-urg.this_week  { background: rgba(214,138,60,0.14); color: #b87432; }
.custpipe-closer-urg.eventually { background: rgba(120,120,120,0.10); color: #888; }
.custpipe-closer-action { font-size: 14px; margin-bottom: 4px; }
.custpipe-closer-reason { font-size: 12px; color: var(--text-muted); }
.custpipe-closer-script {
  background: var(--surface);
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  border-left: 2px solid var(--text);
}
.custpipe-closer-risks,
.custpipe-closer-alts {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  line-height: 1.5;
}

/* ===================================================================
   FILE ATTACHMENTS (drop zone + file list)
   =================================================================== */

.cust-upload-form {
  padding: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.attach-zone {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
  font-size: 12px;
  color: var(--text-muted);
}
.attach-zone:hover { border-color: var(--text-muted); background: var(--surface); }
.attach-zone.drag-over {
  border-color: rgb(var(--hue-ember));
  background: rgba(232, 99, 43, 0.06);
  color: var(--text);
}
.attach-zone-prompt { pointer-events: none; }

.attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 0;
}
.attach-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
}
.attach-pill-icon { font-size: 12px; }
.attach-pill-name { font-weight: 500; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-pill-size { color: var(--text-muted); font-size: 10px; }
.attach-pill-x {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  line-height: 1;
}
.attach-pill-x:hover { color: #d97070; }

.attach-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.attach-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.attach-file-icon { font-size: 18px; }
.attach-file-main { flex: 1; min-width: 0; }
.attach-file-name { font-weight: 600; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.attach-file-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.attach-file-del { color: var(--text-muted); }
.attach-file-del:hover { color: #d97070; }
.attach-list-empty {
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg);
  border-radius: 8px;
}
.attach-add-row { margin-top: 10px; text-align: right; }

/* ===================================================================
   WORKFORCE — MANUAL EDIT CARDS (client mode)
   =================================================================== */

.wf-card-edit-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  justify-content: flex-end;
}
.wf-card-edit-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.wf-card-edit-btn:hover { color: var(--text); border-color: var(--text-muted); }
.wf-card-edit-btn.danger:hover { color: #d97070; border-color: rgba(255,90,90,0.4); }

/* ===================================================================
   AGENT INSTRUCTIONS / MEMORY FILES (per-agent profile)
   =================================================================== */

.profile-instructions-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.profile-instructions-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 0;
  max-width: 60ch;
  line-height: 1.5;
}
.profile-instructions-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.profile-mem-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-mem-row {
  display: flex;
  align-items: stretch;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  gap: 12px;
}
.profile-mem-row:hover { border-color: var(--text-muted); }
.profile-mem-main { flex: 1; min-width: 0; }
.profile-mem-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.profile-mem-icon { font-size: 14px; }
.profile-mem-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-mono, monospace);
}
.profile-mem-kind {
  font-size: 10px;
  background: rgba(120, 120, 120, 0.10);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.profile-mem-size {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}
.profile-mem-preview {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  white-space: pre-wrap;
}
.profile-mem-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.mem-modal-card { max-width: 720px; width: 95vw; max-height: 90vh; overflow-y: auto; }
.mem-content-textarea {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  line-height: 1.5;
  min-height: 360px;
  resize: vertical;
}

.profile-heartbeat-card {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(var(--card-hue, var(--hue-ember)), 0.05);
  border: 1px solid rgba(var(--card-hue, var(--hue-ember)), 0.25);
  border-left: 3px solid rgb(var(--card-hue, var(--hue-ember)));
  border-radius: 8px;
}
.profile-heartbeat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.profile-heartbeat-icon { font-size: 14px; color: rgb(var(--card-hue, var(--hue-ember))); }
.profile-heartbeat-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.profile-heartbeat-cost {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
}
.profile-heartbeat-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  padding: 8px 0;
}
.profile-heartbeat-foot {
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 6px;
  border-top: 1px dashed rgba(var(--card-hue, var(--hue-ember)), 0.25);
}
.profile-heartbeat-foot a { color: rgb(var(--card-hue, var(--hue-ember))); }

/* ===================================================================
   COWORK (rooms + flows)
   =================================================================== */

.cowork-page { padding-bottom: 60px; }
.cowork-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.cowork-agent-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  font-size: 0;
  background: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='6' width='16' height='12' rx='3'/%3E%3Ccircle cx='9' cy='12' r='1.5'/%3E%3Ccircle cx='15' cy='12' r='1.5'/%3E%3Cpath d='M12 2v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
  border-radius: 50%;
  border: 1px solid var(--border);
  margin-left: 4px;
}

/* Cowork room (chat) */
.cwroom-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  padding-bottom: 0;
}
.cwroom-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.cwroom-head-actions { display: flex; gap: 6px; }

.cwroom-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cwroom-msg { display: flex; flex-direction: column; gap: 4px; max-width: 80%; }
.cwroom-msg.user { align-self: flex-end; align-items: flex-end; }
.cwroom-msg.agent { align-self: flex-start; align-items: flex-start; }
.cwroom-msg.system {
  align-self: center;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  padding: 6px 12px;
  background: rgba(120, 120, 120, 0.06);
  border-radius: 999px;
}
.cwroom-msg-author {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.cwroom-msg.agent .cwroom-msg-author { color: rgb(var(--card-hue, var(--hue-ember))); }
.cwroom-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: var(--bg);
  border: 1px solid var(--border);
}
.cwroom-msg.user .cwroom-msg-bubble {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.cwroom-msg.agent .cwroom-msg-bubble {
  background: rgba(var(--card-hue, var(--hue-ember)), 0.06);
  border-color: rgba(var(--card-hue, var(--hue-ember)), 0.25);
}
.cwroom-msg-meta {
  font-size: 10px;
  color: var(--text-muted);
}
.cwroom-transport-tag {
  margin-left: 4px;
  font-size: 9px;
  background: rgba(46, 175, 139, 0.14);
  color: #2c8b6b;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cwroom-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0 4px;
}
.cwroom-composer textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}
.cwroom-composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cwroom-mention-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cwroom-mention-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  color: var(--text-muted);
  cursor: pointer;
}
.cwroom-mention-btn:hover { color: var(--text); border-color: var(--text-muted); }

/* Member picker */
.cw-member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}
.cw-member-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.cw-member-pill:hover { border-color: var(--text-muted); }
.cw-member-pill input[type="checkbox"] { accent-color: var(--text); }
.cw-member-pill input[type="checkbox"]:checked + .cw-member-icon {
  box-shadow: 0 0 0 2px var(--text);
}
.cw-member-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  font-size: 11px;
  background: rgba(var(--card-hue, var(--hue-ember)), 0.14);
  color: rgb(var(--card-hue, var(--hue-ember)));
  border-radius: 50%;
}

/* Flow steps */
.flow-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flow-step {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid rgb(var(--card-hue, var(--hue-ember)));
  border-radius: 8px;
}
.flow-step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(var(--card-hue, var(--hue-ember)), 0.14);
  color: rgb(var(--card-hue, var(--hue-ember)));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.flow-step-main { flex: 1; min-width: 0; }
.flow-step-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.flow-step-prompt {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  white-space: pre-wrap;
}
.flow-add-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===================================================================
   PROJECT DETAIL PAGE
   =================================================================== */

.proj-page { padding-bottom: 60px; }
.proj-back { margin-bottom: 16px; }

.proj-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.proj-head-main { flex: 1; min-width: 280px; }
.proj-name {
  width: 100%;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 4px 6px;
  margin: -4px -6px 6px;
  border-radius: 6px;
  font-family: inherit;
}
.proj-name:focus, .proj-name:hover {
  background: var(--bg);
  border-color: var(--border);
  outline: none;
}
.proj-head-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.proj-meta-sep { opacity: 0.5; }
.proj-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: rgba(72, 142, 230, 0.10);
  color: rgb(var(--hue-azure));
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.proj-chip-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
.proj-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.proj-status.status-active     { background: rgba(76,175,80,0.14); color: #4ba055; }
.proj-status.status-on_hold    { background: rgba(214,138,60,0.14); color: #b87432; }
.proj-status.status-completed  { background: rgba(72,142,230,0.14); color: #4285d2; }
.proj-status.status-archived   { background: rgba(120,120,120,0.10); color: #888; }
.proj-meta-time { font-size: 12px; }
.proj-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.proj-stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.proj-stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
}
.proj-stat-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.proj-stat-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-top: 2px;
}
.proj-stat-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.proj-body-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.proj-section-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.proj-description {
  width: 100%;
  background: transparent;
  border: none;
  resize: vertical;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  outline: none;
  min-height: 60px;
}
.proj-link-customer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.proj-save-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  margin-top: 6px;
}
.proj-save-status {
  font-size: 12px;
  color: var(--text-muted);
}

.proj-recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.proj-recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.proj-recent-row:hover { border-color: var(--text-muted); }
.proj-recent-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  font-size: 13px;
  flex-shrink: 0;
}
.proj-recent-kind.kind-thread   { background: rgba(72,142,230,0.14); color: rgb(var(--hue-azure)); }
.proj-recent-kind.kind-task     { background: rgba(232,99,43,0.14);  color: rgb(var(--hue-ember)); }
.proj-recent-kind.kind-protocol { background: rgba(124,99,230,0.14); color: rgb(var(--hue-iris)); }
.proj-recent-main { flex: 1; min-width: 0; }
.proj-recent-title { font-weight: 600; font-size: 13px; color: var(--text); }
.proj-recent-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.proj-recent-meta { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

/* ===================================================================
   PROTOCOL DETAIL PAGE
   =================================================================== */

.proto-page { padding-bottom: 60px; }

.proto-back { margin-bottom: 16px; }

.proto-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.proto-head-main { flex: 1; min-width: 280px; }
.proto-name {
  width: 100%;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 4px 6px;
  margin: -4px -6px 6px;
  border-radius: 6px;
  font-family: inherit;
}
.proto-name:focus, .proto-name:hover {
  background: var(--bg);
  border-color: var(--border);
  outline: none;
}
.proto-head-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.proto-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(var(--card-hue, var(--hue-ember)), 0.12);
  color: rgb(var(--card-hue, var(--hue-ember)));
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.proto-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.proto-run-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-elev, var(--surface));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.proto-run-btn:hover {
  background: var(--text);
  color: var(--bg);
}
.proto-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.proto-active-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.proto-active-label.on  { color: #4ba055; }
.proto-active-label.off { color: #b87432; }

.proto-body-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 24px;
}
.proto-instructions {
  width: 100%;
  background: transparent;
  border: none;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  outline: none;
  min-height: 200px;
}
.proto-save-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  margin-top: 10px;
}
.proto-save-status {
  font-size: 12px;
  color: var(--text-muted);
}

.proto-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.proto-tab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
}
.proto-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.proto-tab-count {
  background: var(--bg);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
}

.proto-tab-body { padding: 8px 0 24px; }

.proto-trigger-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.proto-trigger-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.proto-trigger-row:last-child { margin-bottom: 0; }
.proto-trigger-label {
  min-width: 60px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.proto-trigger-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.proto-runs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.proto-run-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.proto-run-row:hover { border-color: var(--text-muted); }
.proto-run-main { flex: 1; min-width: 0; }
.proto-run-title { font-weight: 600; font-size: 13px; color: var(--text); }
.proto-run-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.proto-run-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.proto-run-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.proto-run-status.status-active   { background: rgba(75,169,222,0.14); color: #4ba9de; }
.proto-run-status.status-archived { background: rgba(120,120,120,0.10); color: #888; }

.proto-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 8px;
}

.proto-activity {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 16px;
}
.proto-activity-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.proto-activity-row:last-child { border-bottom: none; }
.proto-activity-row span { color: var(--text-muted); }

/* ===================================================================
   AGENT TASKS & PROTOCOLS (per-agent profile)
   =================================================================== */

.profile-disabled-banner {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(255, 90, 90, 0.08);
  border: 1px solid rgba(255, 90, 90, 0.25);
  border-radius: 8px;
  color: #d97070;
  font-size: 13px;
}
.profile-disabled-banner.deactivated {
  background: rgba(214, 138, 60, 0.08);
  border-color: rgba(214, 138, 60, 0.28);
  color: #b87432;
}

.profile-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-left: 8px;
}
.profile-active-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.profile-active-label.on  { color: #4ba055; }
.profile-active-label.off { color: #b87432; }

.profile-more-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(120, 120, 120, 0.3);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 2px; top: 2px;
  background: rgba(0, 0, 0, 0.30);
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: rgba(76, 175, 80, 0.65); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

.agent-card-tag.deactivated {
  background: rgba(214, 138, 60, 0.14);
  color: #b87432;
}
.cmd-row.deactivated {
  opacity: 0.6;
}
.cmd-row.deactivated:hover { opacity: 0.95; }

.cmd-archive-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}
.cmd-archive-toggle:hover { color: var(--text); }
.cmd-arch-divider-row td {
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
}

.profile-head-menu { margin-left: 8px; }
.profile-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  min-width: 180px;
  z-index: 100;
  padding: 4px;
}
.profile-more-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
}
.profile-more-item:hover { background: var(--bg); }
.profile-more-item.danger { color: #d97070; }
.profile-more-item.danger:hover { background: rgba(255, 90, 90, 0.08); }

.profile-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg);
  border-radius: 8px;
}

.profile-task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.profile-task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(var(--card-hue, var(--hue-ember)), 0.5);
  border-radius: 8px;
  transition: border-color 0.15s, transform 0.15s;
}
.profile-task-row:hover {
  border-color: rgba(var(--card-hue, var(--hue-ember)), 0.4);
}
.profile-task-row.disabled { opacity: 0.55; }

.profile-task-main { flex: 1; min-width: 0; }
.profile-task-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.profile-task-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.profile-task-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 4px;
}
.profile-task-meta {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.75;
}
.profile-task-meta a { color: var(--accent); }

.profile-task-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.task-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.task-status-pill.todo      { background: rgba(120,120,120,0.12); color: #9a9a9a; }
.task-status-pill.running   { background: rgba(64, 169, 222, 0.12); color: #4ba9de; }
.task-status-pill.done      { background: rgba(76, 175, 80, 0.12); color: #6abf6f; }
.task-status-pill.failed    { background: rgba(255, 90, 90, 0.12); color: #d97070; }
.task-status-pill.cancelled { background: rgba(120,120,120,0.08); color: #777; }

.task-priority-pill {
  display: inline-flex;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.task-priority-pill.low    { background: rgba(120,120,120,0.10); color: #888; }
.task-priority-pill.high   { background: rgba(255, 165, 64, 0.14); color: #d68a3c; }
.task-priority-pill.urgent { background: rgba(255, 90, 90, 0.14); color: #d97070; }

.task-handoff {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  opacity: 0.8;
}

.cmd-fired-divider {
  padding: 12px 8px 6px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.cmd-row.fired { opacity: 0.65; }
.cmd-row.fired:hover { opacity: 1; }

/* ===================================================================
   CONTEXT WARNING + HANDOFF MODAL (Memo)
   =================================================================== */

.ctx-warning {
  margin: 0 24px;
  padding: 10px 14px;
  background: rgba(214, 177, 60, 0.12);
  border: 1px solid rgba(214, 177, 60, 0.35);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  color: #d6b13c;
}
.ctx-warning.ctx-critical {
  background: rgba(217, 112, 112, 0.12);
  border-color: rgba(217, 112, 112, 0.4);
  color: #d97070;
}
.ctx-warning-text { flex: 1; line-height: 1.5; }
.ctx-warning-text strong { font-weight: 600; }

.thread-handoff-btn { color: #6c7eef; }

.handoff-modal { max-width: 720px; }
.handoff-meta {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.handoff-meta-item {
  font-family: var(--font-mono, monospace);
}
.handoff-brief {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  background: rgba(0,0,0,0.18);
  padding: 14px 16px;
  border-radius: 6px;
  margin: 0 0 12px;
  max-height: 50vh;
  overflow-y: auto;
}
.handoff-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ===================================================================
   JUDGE'S CORNER (Learning page)
   =================================================================== */

.judges-corner {
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.judges-corner-head { margin-bottom: 14px; }
.judges-corner-icon { font-size: 18px; vertical-align: middle; }
.judges-corner-title {
  font-weight: 600;
  font-size: 15px;
  margin-left: 6px;
}
.judges-corner-sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.55;
}
.judges-corner-subhead {
  margin: 18px 0 10px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.judges-grade-table {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.judges-grade-row {
  display: grid;
  grid-template-columns: 2fr 60px 60px 90px 60px 90px;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-elev);
  font-size: 12px;
  text-align: left;
  border: none;
  cursor: default;
  color: var(--text);
}
.judges-grade-head {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-top: 8px;
  padding-bottom: 8px;
}
.judges-grade-data { cursor: pointer; }
.judges-grade-data:hover { background: rgba(255,255,255,0.04); }
.judges-grade-icon { margin-right: 8px; font-size: 14px; }
.judges-grade-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-mono, monospace);
}
.judges-grade-letter.g-a { background: rgba(95,168,105,0.18); color: #5fa869; }
.judges-grade-letter.g-b { background: rgba(110,130,240,0.18); color: #6c7eef; }
.judges-grade-letter.g-c { background: rgba(214,177,60,0.18); color: #d6b13c; }
.judges-grade-letter.g-d { background: rgba(214,138,60,0.18); color: #d68a3c; }
.judges-grade-letter.g-f { background: rgba(217,112,112,0.18); color: #d97070; }
.judges-grade-letter.na  { color: var(--text-muted); font-size: 16px; }
.judges-grade-trend.trend-improving { color: #5fa869; }
.judges-grade-trend.trend-declining { color: #d97070; }
.judges-grade-trend.trend-flat,
.judges-grade-trend.trend-stable { color: var(--text-muted); }
.judges-grade-rating { font-family: var(--font-mono, monospace); color: #d6b13c; }

.judges-recent-evals {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.judges-eval-row {
  background: var(--bg, transparent);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(var(--card-hue, 110, 130, 240), 0.6);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.judges-eval-row:hover { background: rgba(255,255,255,0.04); }
.judges-eval-row-head {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  flex-wrap: wrap;
}
.judges-eval-icon { font-size: 14px; }
.judges-eval-agent { font-weight: 600; }
.judges-eval-grade {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.judges-eval-grade.g-a { background: rgba(95,168,105,0.18); color: #5fa869; }
.judges-eval-grade.g-b { background: rgba(110,130,240,0.18); color: #6c7eef; }
.judges-eval-grade.g-c { background: rgba(214,177,60,0.18); color: #d6b13c; }
.judges-eval-grade.g-d { background: rgba(214,138,60,0.18); color: #d68a3c; }
.judges-eval-grade.g-f { background: rgba(217,112,112,0.18); color: #d97070; }
.judges-eval-rubric { color: var(--text-muted); font-family: var(--font-mono, monospace); font-size: 11px; }
.judges-eval-when { color: var(--text-muted); font-size: 11px; margin-left: auto; }
.judges-eval-judith { color: #d6b13c; font-size: 11px; }
.judges-eval-judith.pending { color: var(--text-muted); font-style: italic; }

/* Eval review modal */
.eval-review-modal { max-width: 760px; }
.eval-review-head { padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.eval-review-headline { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.eval-review-score { font-family: var(--font-mono, monospace); color: var(--text-muted); margin-left: 8px; }
.eval-review-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono, monospace); }
.eval-narrative-box {
  background: rgba(110,130,240,0.08);
  border-left: 3px solid #6c7eef;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 16px;
}
.eval-math-note {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0,0,0,0.18);
}
.eval-math-note summary {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: 0.02em;
  list-style: none;
}
.eval-math-note summary::-webkit-details-marker { display: none; }
.eval-math-note summary::before {
  content: '▸ ';
  color: var(--text-muted);
}
.eval-math-note[open] summary::before { content: '▾ '; }
.eval-math-note summary:hover { color: var(--text); }
.eval-math-body {
  padding: 4px 14px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}
.eval-math-body strong { color: var(--text); font-weight: 600; }

.eval-review-criteria { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.eval-criterion-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}
.eval-criterion-head { display: flex; gap: 10px; align-items: center; font-size: 12px; flex-wrap: wrap; }
.eval-criterion-name { font-weight: 600; flex: 1; }
.eval-criterion-verdict {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.eval-criterion-verdict.v-excellent { background: rgba(95,168,105,0.18); color: #5fa869; }
.eval-criterion-verdict.v-strong    { background: rgba(110,130,240,0.18); color: #6c7eef; }
.eval-criterion-verdict.v-fair      { background: rgba(214,177,60,0.18); color: #d6b13c; }
.eval-criterion-verdict.v-weak      { background: rgba(214,138,60,0.18); color: #d68a3c; }
.eval-criterion-verdict.v-poor      { background: rgba(217,112,112,0.18); color: #d97070; }
.eval-criterion-score { font-family: var(--font-mono, monospace); color: var(--text-muted); font-size: 11px; }
.eval-criterion-weight { color: var(--text-muted); font-size: 10px; }
.eval-criterion-bar {
  height: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  margin: 6px 0 8px;
  overflow: hidden;
}
.eval-criterion-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6c7eef, #5fa869);
  transition: width 0.3s;
}
.eval-criterion-reasoning {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}

.eval-judge-judge {
  background: rgba(214,177,60,0.04);
  border: 1px solid rgba(214,177,60,0.30);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 14px;
}
.eval-judge-judge-head { margin-bottom: 10px; }
.eval-judge-judge-head strong { font-size: 13px; color: #d6b13c; }
.eval-judge-judge-sub { display: block; font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.eval-stars { display: flex; gap: 4px; margin-bottom: 10px; }
.eval-star {
  background: none; border: none;
  color: rgba(214,177,60,0.30);
  font-size: 24px; line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.12s;
}
.eval-star.on { color: #d6b13c; }
.eval-star:hover { color: #d6b13c; }
.eval-judge-note {
  width: 100%;
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
}
.eval-judge-actions { display: flex; align-items: center; gap: 12px; }
.eval-save-status { font-size: 11px; color: var(--text-muted); }

/* ===================================================================
   PROTOCOL ROW INLINE INSTRUCTIONS
   =================================================================== */

.protocol-row .protocol-instructions {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(0,0,0,0.18);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 7.5em;
  overflow-y: auto;
  font-family: inherit;
}
.protocol-row.disabled .protocol-instructions { opacity: 0.65; }

/* ===================================================================
   VACATION MODE
   =================================================================== */

/* Sidebar pill — only visible when vacation is ON */
.sb-vacation-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin: 4px 8px 4px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.12s;
}
.sb-vacation-row:hover {
  background: rgba(255, 255, 255, 0.09);
}
.sb-vacation-icon { font-size: 12px; line-height: 1; }

/* Settings page card */
.vacation-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  padding: 16px;
  align-items: start;
}
.vacation-icon {
  font-size: 26px;
  line-height: 1;
}
.vacation-body { min-width: 0; }
.vacation-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.vacation-title {
  font-size: 14px;
  font-weight: 600;
}
.vacation-state {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono, monospace);
}
.vacation-state.on { background: rgba(214,177,60,0.18); color: #d6b13c; }
.vacation-state.off { background: rgba(95,168,105,0.12); color: #5fa869; }
.vacation-desc {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}
.vacation-msg-input {
  width: 100%;
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

/* Per-agent exclusion list */
.vacation-exclusions {
  margin-top: 4px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border);
}
.vacation-exclusions-head {
  margin-bottom: 10px;
}
.vacation-exclusions-head > span:first-child {
  font-size: 13px; font-weight: 600;
}
.vacation-exclusions-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.5;
}
.vacation-exclusions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
}
.vacation-excl-row {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.12s;
}
.vacation-excl-row:hover { background: rgba(255,255,255,0.04); }
.vacation-excl-row:has(.vacation-excl-checkbox:checked) {
  background: rgba(95,168,105,0.06);
  border-color: rgba(95,168,105,0.30);
}
.vacation-excl-checkbox {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: #5fa869;
}
.vacation-excl-icon { font-size: 14px; }
.vacation-excl-name { font-weight: 600; }
.vacation-excl-desc { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vacation-excl-state {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Toggle switch (slider) */
.vacation-toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  margin-top: 4px;
}
.vacation-toggle-switch input { opacity: 0; width: 0; height: 0; }
.vacation-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.10);
  border: 1px solid var(--border);
  border-radius: 26px;
  transition: background 0.18s;
}
.vacation-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; top: 3px;
  background: #888;
  border-radius: 50%;
  transition: transform 0.18s, background 0.18s;
}
.vacation-toggle-switch input:checked + .vacation-toggle-slider {
  background: rgba(214, 177, 60, 0.30);
  border-color: rgba(214, 177, 60, 0.60);
}
.vacation-toggle-switch input:checked + .vacation-toggle-slider::before {
  transform: translateX(22px);
  background: #d6b13c;
}

/* ===================================================================
   CONTACTS VIEW
   =================================================================== */

.contacts-view { padding-bottom: 80px; }
.contacts-toolbar {
  display: flex; gap: 12px;
  margin: 14px 0 12px;
}
.contacts-search {
  flex: 1; max-width: 480px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.contacts-search:focus { outline: none; border-color: var(--text-muted); }

.contacts-filter-strip {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 16px;
}
.contacts-filter-chip {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
}
.contacts-filter-chip:hover { color: var(--text); border-color: var(--text-muted); }
.contacts-filter-chip.active {
  background: rgba(255,138,61,0.12);
  border-color: rgba(255,138,61,0.40);
  color: #ff8a3d;
}
.contacts-filter-count {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  opacity: 0.7;
  padding: 1px 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
}
.contacts-filter-chip.active .contacts-filter-count {
  background: rgba(255,138,61,0.18);
}

.contacts-list { display: flex; flex-direction: column; gap: 4px; }
.contact-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  align-items: center;
}
.contact-row:hover { background: rgba(255,255,255,0.04); }
.contact-label { font-size: 18px; text-align: center; }
.contact-main { min-width: 0; }
.contact-line1 {
  display: flex; gap: 10px; align-items: center;
  font-size: 13px; font-weight: 600;
  margin-bottom: 2px;
}
.contact-name { color: var(--text); }
.contact-star { color: #d6b13c; font-size: 12px; }
.contact-label-text {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
}
.contact-line2 {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
}
.contact-id { color: var(--text); }
.contact-meta { color: var(--text-muted); }
.contact-flag { color: #d97070; }
.contact-meta-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.contact-when {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
}

/* ===================================================================
   RECEPTION FLAGS (Greta → Judith)
   =================================================================== */

.sb-reception-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin: 4px 8px 4px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.12s;
}
.sb-reception-row:hover { background: rgba(255, 255, 255, 0.09); }
.sb-reception-icon { font-size: 12px; line-height: 1; }

.reception-modal { max-width: 700px; }
.reception-list { display: flex; flex-direction: column; gap: 8px; }
.reception-row {
  text-align: left;
  background: var(--bg, transparent);
  border: 1px solid var(--border);
  border-left: 3px solid #6c7eef;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.12s;
}
.reception-row:hover { background: rgba(255,255,255,0.04); }
.reception-row.unread { background: rgba(110,130,240,0.06); border-left-color: #d6b13c; }
.reception-row-head { display: flex; gap: 10px; align-items: center; font-size: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.reception-cat {
  font-weight: 600;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(110,130,240,0.18);
  color: #6c7eef;
}
.reception-channel {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.recep-existing { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: rgba(95,168,105,0.14); color: #5fa869; }
.recep-prospect { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: rgba(120,120,120,0.10); color: var(--text-muted); }
.reception-when { color: var(--text-muted); font-size: 11px; margin-left: auto; }
.reception-reason { font-size: 13px; line-height: 1.45; margin-bottom: 4px; }
.reception-meta { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono, monospace); }

.reception-detail-modal { max-width: 720px; }
.recep-flag-box {
  background: rgba(214,177,60,0.10);
  border-left: 3px solid #d6b13c;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 12px;
  margin-bottom: 12px;
}
.recep-flag-box strong { color: #d6b13c; text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; margin-right: 8px; }
.recep-detail-meta {
  font-size: 11px; color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.recep-transcript { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; margin-bottom: 14px; }
.recep-turn {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.55;
}
.recep-turn.turn-user { background: rgba(255,255,255,0.04); }
.recep-turn.turn-assistant { background: rgba(110,130,240,0.06); }
.recep-turn-role {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 60px;
}
.recep-turn-content { flex: 1; white-space: pre-wrap; }
.recep-detail-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ===================================================================
   BLOCKER ALERT PILL
   =================================================================== */

.sb-blockers-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin: 4px 8px 4px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #d97070;
  background: rgba(217, 112, 112, 0.10);
  border: 1px solid rgba(217, 112, 112, 0.30);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.sb-blockers-row:hover {
  background: rgba(217, 112, 112, 0.18);
  border-color: rgba(217, 112, 112, 0.55);
}
.sb-blockers-icon { font-size: 9px; line-height: 1; animation: blocker-pulse 1.4s ease-in-out infinite; }
.sb-blockers-label { letter-spacing: 0.02em; }

@keyframes blocker-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.blockers-modal { max-width: 640px; }
.blockers-list { display: flex; flex-direction: column; gap: 10px; }
.blocker-row {
  border: 1px solid var(--border);
  border-left: 3px solid #d97070;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(217, 112, 112, 0.04);
}
.blocker-row-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.blocker-agent {
  font-family: var(--font-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #d97070;
}
.blocker-title { font-weight: 600; font-size: 13px; line-height: 1.4; margin-bottom: 6px; }
.blocker-preview {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-muted);
  white-space: pre-wrap;
  line-height: 1.5;
  background: rgba(0,0,0,0.18);
  padding: 8px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
  max-height: 100px;
  overflow-y: auto;
}
.blocker-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ===================================================================
   BRIDGE STATUS PILL + POPOVER
   =================================================================== */

.sb-bridge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin: 4px 8px 8px;
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.sb-bridge-row:hover { background: rgba(255,255,255,0.04); border-color: var(--border); }
.sb-bridge-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #888;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.18);
}
.sb-bridge-row[data-status="green"]  .sb-bridge-dot { background: #5fa869; box-shadow: 0 0 8px rgba(95,168,105,0.5); }
.sb-bridge-row[data-status="yellow"] .sb-bridge-dot { background: #d6b13c; box-shadow: 0 0 8px rgba(214,177,60,0.5); }
.sb-bridge-row[data-status="orange"] .sb-bridge-dot { background: #d68a3c; box-shadow: 0 0 8px rgba(214,138,60,0.6); animation: bridge-pulse 1.4s ease-in-out infinite; }
.sb-bridge-row[data-status="red"]    .sb-bridge-dot { background: #d97070; box-shadow: 0 0 10px rgba(217,112,112,0.7); animation: bridge-pulse 1s ease-in-out infinite; }
.sb-bridge-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@keyframes bridge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.bridge-popover-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1100;
  padding: 24px;
}
.bridge-popover {
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  overflow: hidden;
}
.bridge-popover-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.bridge-popover-title { font-weight: 600; font-size: 13px; }
.bridge-popover-close {
  background: none; border: none; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--text-muted);
}
.bridge-popover-body {
  padding: 14px 16px;
  font-size: 12px;
}
.bp-line {
  display: flex; gap: 12px;
  padding: 4px 0;
  align-items: center;
}
.bp-key { color: var(--text-muted); width: 110px; flex-shrink: 0; }
.bp-val { flex: 1; word-break: break-word; }
.bp-divider { border-top: 1px solid var(--border); margin: 8px 0; }
.bp-ok   { color: #5fa869; font-family: var(--font-mono, monospace); font-size: 11px; }
.bp-fail { color: #d97070; font-family: var(--font-mono, monospace); font-size: 11px; }
.bridge-popover-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
}

/* ===================================================================
   TRANSCRIPT LIBRARY
   =================================================================== */

.transcript-list { display: flex; flex-direction: column; gap: 8px; }
.transcript-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--bg-card, transparent);
}
.transcript-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}
.transcript-spacer { flex: 1; }
.transcript-when, .transcript-dur { color: var(--text-muted); font-size: 11px; }
.transcript-summary {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.transcript-err {
  margin-top: 8px;
  font-size: 11px;
  color: #d97070;
  font-family: var(--font-mono, monospace);
}
.transcript-status {
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}
.transcript-kind {
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
  font-family: var(--font-mono, monospace);
}
.transcript-kind.kind-strategy { background: rgba(110,130,240,0.14); color: #6c7eef; }
.transcript-kind.kind-persona  { background: rgba(214,138,60,0.14); color: #d68a3c; }

.transcript-status.tx-pending    { background: rgba(120,120,120,0.10); color: #888; }
.transcript-status.tx-released   { background: rgba(120, 200, 120, 0.14); color: #5fa869; }
.transcript-status.tx-processing { background: rgba(255, 165, 64, 0.14); color: #d68a3c; }
.transcript-status.tx-processed  { background: rgba(110, 130, 240, 0.18); color: #6c7eef; }
.transcript-status.tx-failed     { background: rgba(255, 90, 90, 0.14); color: #d97070; }
.transcript-status.tx-archived   { background: rgba(120,120,120,0.06); color: #aaa; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.modal-card {
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%; max-width: 800px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
}
.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-weight: 600; font-size: 14px; }
.modal-close {
  background: none; border: none;
  font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--text-muted);
}
.modal-body { padding: 16px 20px; overflow-y: auto; }

.tx-summary-box, .tx-pain-box {
  background: rgba(110, 130, 240, 0.06);
  border-left: 3px solid #6c7eef;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-size: 13px;
}
.tx-summary-box p { margin: 6px 0 0; line-height: 1.55; }
.tx-pain-box ul { margin: 6px 0 0; padding-left: 20px; }
.tx-pain-box li { line-height: 1.55; margin: 4px 0; }
.tx-pain-cat {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 6px;
}
.tx-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.tx-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
}
.tx-tab.active { color: var(--text); border-bottom-color: var(--text); }
.tx-body {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  background: rgba(0, 0, 0, 0.18);
  padding: 14px;
  border-radius: 6px;
  margin: 0;
  max-height: 50vh;
  overflow-y: auto;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */

@media (max-width: 720px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none; /* TODO: mobile slide-out menu */
  }
  .view {
    padding: 24px 20px 80px;
  }
  .view-title { font-size: 22px; }
}

/* ----- Cost breakdown styles (Command Center + Agent Profile) ----- */
.cmd-cost-summary {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--border); border-radius: 8px; overflow: hidden;
  margin-bottom: 14px;
}
.cmd-cost-summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; background: var(--surface-elev);
  font-size: 12px;
}
.cmd-cost-summary-row.cmd-cost-summary-total {
  background: var(--surface);
  font-weight: 600;
}
.cmd-cost-summary-label { color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.cmd-cost-summary-val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.cmd-cost-summary-hint { color: var(--text-muted); font-size: 10px; font-weight: 400; }
.cmd-cost-pill {
  font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--surface-translucent); color: var(--text-muted);
  padding: 1px 5px; border-radius: 3px;
}
.cmd-cost-pill.warn { background: rgba(213,132,0,0.14); color: var(--warning); }
.cmd-cost-bars-label {
  font-size: 10px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.06em; margin: 8px 0 6px;
}

/* Agent profile cost split */
.profile-usage-divider {
  margin: 14px 0 8px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
  border-top: 1px dashed var(--border); padding-top: 10px;
}
.profile-usage-tag {
  font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--surface-translucent); color: var(--text-muted);
  padding: 1px 5px; border-radius: 3px; margin-left: 4px;
}
.profile-usage-tag.warn { background: rgba(213,132,0,0.14); color: var(--warning); }
.profile-usage-hint { color: var(--text-muted); font-size: 11px; font-weight: 400; }
.profile-usage-row.profile-usage-total {
  border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px;
  font-weight: 600;
}

/* ── Agent error log panel ── */
.profile-errors-card {
  border-color: rgba(220,38,38,0.2);
  transition: opacity 300ms;
}
.profile-errors-list {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--border); border-radius: 8px; overflow: hidden;
  margin-top: 8px;
}
.profile-error-row {
  background: var(--surface); padding: 10px 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.profile-error-time {
  font-size: 10px; color: var(--text-tertiary); font-weight: 500;
}
.profile-error-msg {
  font-size: 12.5px; color: var(--danger, #dc2626); line-height: 1.4;
  font-family: var(--font-mono, monospace); word-break: break-word;
}
.profile-error-meta {
  font-size: 10px; color: var(--text-tertiary);
}

/* =================================================================
   VIEW: GOALS
   ================================================================= */
.goals-category { margin-bottom: 20px; }
.goals-cat-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin: 0 0 8px; padding: 0 2px;
}
.goals-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px;
}
.goals-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-family: inherit; text-align: left;
  transition: border-color 120ms;
}
.goals-card:hover { border-color: var(--border-strong); }
.goals-card.goals-hit { border-color: rgba(34,197,94,0.3); }
.goals-card-top {
  display: flex; justify-content: space-between; align-items: center;
}
.goals-card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.goals-card-pct { font-size: 13px; font-weight: 700; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.goals-card-pct.hit { color: #16a34a; }
.goals-bar {
  height: 4px; border-radius: 2px; background: var(--surface-elev); overflow: hidden;
}
.goals-bar-fill {
  height: 100%; border-radius: 2px; background: var(--text-tertiary);
  transition: width 400ms ease;
}
.goals-bar-fill.hit { background: #4ADE80; }
.goals-card-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-tertiary); font-variant-numeric: tabular-nums;
}
.goals-card-notes {
  font-size: 11px; color: var(--text-muted); line-height: 1.4;
  margin-top: 2px;
}

/* =================================================================
   VIEW: LABS
   ================================================================= */
.labs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; margin-top: 4px;
}
.labs-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 22px 22px 18px; display: flex; flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.labs-card:hover {
  border-color: var(--border-strong); box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.labs-card-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.labs-card-icon {
  font-size: 22px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-elev); border-radius: 10px; color: var(--text);
}
.labs-card-status {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 6px;
  background: rgba(255,255,255,0.07); color: var(--text-muted);
}
.labs-status-live { background: rgba(34,197,94,0.12); color: #16a34a; }
.labs-status-beta { background: rgba(234,179,8,0.12); color: #b45309; }
.labs-status-planned { background: var(--surface-elev); color: var(--text-muted); }
.labs-card-name {
  font-size: 16px; font-weight: 650; margin: 0 0 2px; color: var(--text); letter-spacing: -0.01em;
}
.labs-card-tagline {
  font-size: 12px; color: var(--text-muted); margin: 0 0 10px; font-weight: 500;
}
.labs-card-desc {
  font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin: 0;
  flex: 1;
}
.labs-card-foot {
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border);
}
.labs-card-cta {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  transition: color 0.15s;
}
.labs-card:hover .labs-card-cta { color: var(--text); }
