/* Retena Dashboard — Design System */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

:root {
  --whatsapp-green: #25D366;
  --bg-page: #06080d;
  --bg-sidebar: #0c1017;
  --bg-card: #111620;
  --bg-input: #151c28;
  --bg-tertiary: #151c28;
  --card-bg: #151c28;
  --border: #1e2736;
  --text-primary: #f0f2f5;
  --text-secondary: #a0a8b4;
  --text-muted: #7a8494;
  --accent: #E67E22;
  --accent-rgb: 230,126,34;
  --accent-hover: #d47420;
  --accent-glow: rgba(230,126,34,0.06);
  --accent-soft: rgba(var(--accent-rgb),0.10);
  --accent-border: rgba(var(--accent-rgb),0.28);
  --green: #27AE60;
  --red: #c0392b;
  --blue: #2A5C8F;
  --retena-navy: #1A2332;
  --retena-blue: #1E3A5F;
  --purple-bg: rgba(88,28,135,0.3);
  --purple-text: #c084fc;
  --purple-border: rgba(88,28,135,0.5);
  --sidebar-width: 220px;
  --sidebar-collapsed-width: 60px;
}

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

/* ── Retena form popups ──────────────────────────────────────────────────── */
.retena-ui-control {
  position: relative;
  min-width: 0;
  font: inherit;
}

.retena-ui-control.is-compact {
  min-width: 126px;
}

.retena-select-trigger,
.retena-date-trigger,
.retena-time-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.retena-select-trigger:hover,
.retena-select-trigger:focus-visible,
.retena-select-trigger[aria-expanded="true"],
.retena-date-trigger:hover,
.retena-date-trigger:focus-visible,
.retena-date-trigger[aria-expanded="true"],
.retena-time-trigger:hover,
.retena-time-trigger:focus-visible,
.retena-time-trigger[aria-expanded="true"] {
  border-color: rgba(230,126,34,.52);
  box-shadow: 0 0 0 1px rgba(230,126,34,.10);
  outline: none;
}

.retena-select-trigger-value,
.retena-date-trigger-value,
.retena-time-trigger-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.retena-select-chevron {
  position: relative;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.retena-select-chevron::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 4px;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .16s ease;
}

[aria-expanded="true"] > .retena-select-chevron::before {
  top: 6px;
  transform: rotate(225deg);
}

.retena-date-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.retena-date-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.retena-select-menu,
.retena-date-picker,
.retena-time-picker {
  position: absolute;
  z-index: 220;
  top: calc(100% + 6px);
  left: 0;
  width: max(100%, 220px);
  max-width: min(92vw, 360px);
  border: 1px solid rgba(230,126,34,.34);
  border-radius: 10px;
  background: linear-gradient(180deg, #151c28, #101620);
  box-shadow: 0 22px 54px rgba(0,0,0,.44);
}

.retena-select-menu[hidden],
.retena-date-picker[hidden],
.retena-time-picker[hidden] {
  display: none;
}

.retena-select-menu {
  display: grid;
  gap: 4px;
  max-height: min(320px, 62vh);
  overflow: auto;
  padding: 6px;
}

.retena-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.retena-select-option:hover,
.retena-select-option:focus-visible {
  border-color: rgba(230,126,34,.34);
  background: rgba(230,126,34,.10);
  color: var(--text-primary);
  outline: none;
}

.retena-select-option.is-selected {
  border-color: rgba(230,126,34,.82);
  background: var(--accent);
  color: #111620;
}

.retena-select-check {
  width: 14px;
  flex: 0 0 14px;
  color: currentColor;
  opacity: 0;
  font-weight: 900;
}

.retena-select-option.is-selected .retena-select-check {
  opacity: 1;
}

.retena-date-picker {
  width: min(340px, 92vw);
  padding: 18px;
}

.retena-date-picker-header,
.retena-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.retena-date-picker-month {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 850;
}

.retena-date-picker-nav {
  display: inline-flex;
  gap: 8px;
}

.retena-picker-icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: var(--accent);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.retena-picker-icon-button:hover,
.retena-picker-action:hover {
  border-color: rgba(230,126,34,.45);
  background: rgba(230,126,34,.11);
}

.retena-date-weekdays,
.retena-date-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.retena-date-weekdays {
  margin: 20px 0 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.retena-date-day {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.retena-date-day:hover,
.retena-date-day:focus-visible {
  border-color: rgba(230,126,34,.42);
  background: rgba(230,126,34,.10);
  color: var(--text-primary);
  outline: none;
}

.retena-date-day.is-muted {
  color: rgba(160,168,180,.44);
}

.retena-date-day.is-today {
  border-color: rgba(230,126,34,.55);
  color: var(--accent);
}

.retena-date-day.is-selected {
  border-color: rgba(230,126,34,.88);
  background: var(--accent);
  color: #111620;
}

.retena-picker-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(148,163,184,.16);
}

.retena-picker-action {
  min-height: 34px;
  border: 1px solid rgba(148,163,184,.20);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255,255,255,.035);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.retena-picker-action.primary {
  border-color: rgba(230,126,34,.75);
  background: var(--accent);
  color: #111620;
}

.retena-time-picker {
  width: min(300px, 92vw);
  padding: 14px;
}

.retena-time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.retena-time-row label {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.retena-time-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
  font-weight: 850;
  text-align: center;
}

.retena-time-separator {
  align-self: center;
  color: var(--text-muted);
  font-weight: 900;
  transform: translateY(9px);
}

.retena-time-period {
  min-height: 38px;
  border: 1px solid rgba(230,126,34,.42);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(230,126,34,.12);
  color: var(--accent);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

#ws-summary-lang-picker,
#ws-default-lang-picker {
  border-color: rgba(230,126,34,.34) !important;
  background: linear-gradient(180deg, #151c28, #101620) !important;
  box-shadow: 0 18px 42px rgba(0,0,0,.34);
  z-index: 220 !important;
}

.review-picker-list > div:hover,
.review-picker-list > button:hover {
  background: rgba(230,126,34,.10) !important;
  color: var(--text-primary) !important;
}

@media (max-width: 640px) {
  .retena-select-menu,
  .retena-date-picker,
  .retena-time-picker {
    left: 0;
    right: auto;
    width: min(100%, 92vw);
    max-width: calc(100vw - 32px);
  }

  .retena-date-picker {
    padding: 14px;
  }

  .retena-date-picker-month {
    font-size: 16px;
  }
}

html, body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.18s ease;
}

html.theme-sidebar-translucent .sidebar,
body.theme-sidebar-translucent .sidebar {
  background: rgba(12,16,23,0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  min-height: 100vh;
  overflow-y: auto;
  transition: margin-left 0.18s ease;
}

.page-content {
  padding: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.page-content.full-width {
  max-width: 100%;
}

.page-content.two-panel {
  max-width: 100%;
  padding: 0;
  display: flex;
  height: 100vh;
}

/* ── Sidebar Nav ── */
.sidebar-logo {
  padding: 20px 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
}

.sidebar-logo svg,
.sidebar-logo img {
  flex: 0 0 auto;
}

.sidebar-collapse-btn {
  width: 30px;
  height: 30px;
  margin: 0 12px 8px auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-collapse-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
  border-color: rgba(148,163,184,0.28);
}

.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-resize-handle {
  position: fixed;
  top: 0;
  bottom: 0;
  left: calc(var(--sidebar-width) - 12px);
  width: 12px;
  cursor: ew-resize;
  z-index: 80;
  touch-action: none;
  background: rgba(0,0,0,0.001);
  pointer-events: auto;
}

.sidebar-resize-handle::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 1px;
  background: transparent;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle:focus-visible::after,
body.sidebar-resizing .sidebar-resize-handle::after {
  background: rgba(230,126,34,0.72);
  box-shadow: 0 0 0 1px rgba(230,126,34,0.18);
}

.sidebar-resize-handle:focus-visible {
  outline: none;
}

body.sidebar-resizing {
  cursor: ew-resize;
  user-select: none;
}

body.sidebar-resizing .sidebar,
body.sidebar-resizing .main {
  transition: none;
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .main {
  margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-logo {
  justify-content: flex-start;
  padding: 20px 0 12px 16px;
}

body.sidebar-collapsed .sidebar-logo-text,
body.sidebar-collapsed .sidebar-status-dots,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-separator,
body.sidebar-collapsed .sidebar-bottom {
  display: none !important;
}

body.sidebar-collapsed .sidebar-collapse-btn {
  margin: 0 0 12px 15px;
}

body.sidebar-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-nav {
  padding: 0 6px 12px;
}

body.sidebar-collapsed .nav-item {
  width: 48px;
  min-height: 38px;
  margin: 0 auto;
  justify-content: center;
  gap: 0;
  padding: 9px 0;
  border-right-color: transparent;
}

body.sidebar-collapsed .nav-item.active {
  border-right-color: transparent;
}

body.devdash-enhancements-off .sidebar-collapse-btn {
  display: none;
}

body.sidebar-collapsed .sidebar-resize-handle,
body.devdash-enhancements-off .sidebar-resize-handle {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  border-right: 2px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(var(--accent-rgb),0.08);
  border-right-color: var(--accent);
  color: var(--text-primary);
}

.nav-item svg { flex-shrink: 0; }

.chat-search-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-action-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chat-action-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chat-action-filter:hover {
  color: var(--text-primary);
  border-color: rgba(148,163,184,0.34);
  background: rgba(255,255,255,0.04);
}

.chat-action-filter.active {
  color: var(--accent);
  border-color: rgba(230,126,34,0.42);
  background: rgba(230,126,34,0.10);
}

.chat-signal-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.chat-signal-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  border: 1px solid rgba(230,126,34,0.34);
  color: var(--accent);
  background: rgba(230,126,34,0.10);
}

.chat-signal-tag.p0,
.chat-signal-tag.p1 {
  border-color: rgba(239,68,68,0.38);
  color: #fca5a5;
  background: rgba(239,68,68,0.11);
}

.chat-signal-tag.p2 {
  border-color: rgba(245,158,11,0.38);
  color: #fcd34d;
  background: rgba(245,158,11,0.10);
}

.chat-signal-tag.p3 {
  border-color: rgba(230,126,34,0.34);
  color: var(--accent);
  background: rgba(230,126,34,0.10);
}

.chat-signal-tag.p4,
.chat-signal-tag.pending {
  border-color: rgba(148,163,184,0.26);
  color: var(--text-secondary);
  background: rgba(148,163,184,0.08);
}

body.devdash-enhancements-off .chat-action-filter-bar,
body.devdash-enhancements-off .chat-signal-tags {
  display: none !important;
}

.nav-section-label {
  padding: 12px 12px 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.nav-separator {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

.sidebar-bottom {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-meters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.meter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  min-height: 18px;
}

.meter-icon {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.44);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
}

.meter-icon svg {
  width: 12px;
  height: 12px;
  display: block;
}

.meter-row .meter-label { flex: 1; }
.meter-row .meter-value { font-weight: 600; color: var(--text-secondary); }

.meter-bar {
  width: 100%;
  height: 3px;
  background: var(--bg-input);
  border-radius: 3px;
  margin-top: 3px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.meter-fill.green { background: var(--green); }
.meter-fill.amber { background: #f59e0b; }
.meter-fill.red { background: var(--red); }

.sidebar-crosssell {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 0 0;
}

.sidebar-crosssell:hover { color: var(--accent); }

/* ── Mobile Tab Bar ── */
.mobile-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-tabs-inner {
  display: flex;
  height: 56px;
}

.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s;
}

.mobile-tab.active { color: var(--accent); }
.mobile-tab:hover { color: var(--text-primary); }
.mobile-tab svg { width: 20px; height: 20px; }

body.thread-search-focus-mode #chat-wa-bar {
  display: none !important;
}

body.thread-search-focus-mode .mobile-tabs {
  display: none !important;
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  cursor: pointer;
}

/* ── Section Title ── */
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Buttons ── */
button {
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
  color: var(--text-primary);
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

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

.btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-danger:hover { background: #a93226; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; }

/* ── Inputs ── */
.input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb),0.15);
}

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

/* ── Pills / Badges ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 9999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
}

.pill-group {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.pill-personal {
  background: var(--purple-bg);
  border: 1px solid var(--purple-border);
  color: var(--purple-text);
}

.pill-voice {
  background: rgba(var(--accent-rgb),0.12);
  border: 1px solid rgba(var(--accent-rgb),0.25);
  color: var(--accent);
}

.pill-text {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* ── Status Dot ── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.active { background: var(--green); }
.status-dot.paused { background: #64748b; }
.status-dot.disconnected { background: var(--red); }

/* ── Toggle Switch ── */
.toggle {
  position: relative;
  width: 40px;
  flex: 0 0 40px;
  height: 20px;
  border-radius: 9999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.toggle.on {
  background: var(--green);
  border-color: var(--green);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}

.toggle.on::after { transform: translateX(20px); }

.chat-header-toggle-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  min-width: 46px;
}

.chat-header-toggle-label {
  font-size: 10px;
  line-height: 1;
  color: var(--text-muted);
  white-space: nowrap;
}

.toggle.chat-header-toggle {
  width: 34px;
  flex: 0 0 auto;
  height: 18px;
}

.toggle.chat-header-toggle::after {
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
}

.toggle.chat-header-toggle.on::after {
  transform: translateX(16px);
}

/* ── Avatar ── */
.avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  min-height: 32px;
  max-height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
  line-height: 1;
  box-sizing: border-box;
}

.avatar-sm { width: 28px; height: 28px; min-width: 28px; max-width: 28px; min-height: 28px; max-height: 28px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; min-width: 40px; max-width: 40px; min-height: 40px; max-height: 40px; font-size: 14px; }

.avatar-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  min-height: 32px;
  max-height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-elevated);
  line-height: 1;
  vertical-align: middle;
  box-sizing: border-box;
  contain: layout paint;
  isolation: isolate;
}

.avatar-frame.has-avatar {
  background: var(--bg-elevated);
}

.avatar-frame.avatar-sm {
  width: 28px;
  height: 28px;
  min-width: 28px;
  max-width: 28px;
  min-height: 28px;
  max-height: 28px;
}

.avatar-frame.avatar-lg {
  width: 40px;
  height: 40px;
  min-width: 40px;
  max-width: 40px;
  min-height: 40px;
  max-height: 40px;
}

.avatar-frame .avatar {
  position: absolute;
  inset: 0;
  transition: opacity 0.12s ease;
}

.avatar-frame.avatar-ready .avatar {
  opacity: 0;
}

.avatar-frame.has-avatar:not(.avatar-ready) .avatar {
  opacity: 1;
}

.avatar-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 100%;
  max-width: 100%;
  min-height: 100%;
  max-height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.12s ease;
  box-sizing: border-box;
}

.avatar-frame.avatar-ready img {
  opacity: 1;
}

/* ── Two Panel Layout ── */
.panel-left {
  width: 360px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-sidebar);
  flex-shrink: 0;
}

.panel-right {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
}

.panel-left-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-left-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.panel-list { padding: 8px; }

.panel-list-item {
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.panel-list-item:hover { background: rgba(255,255,255,0.03); }
.panel-list-item.selected {
  background: var(--accent-glow);
  border-color: rgba(230,126,34,0.15);
}

.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.panel-empty svg { margin-bottom: 16px; opacity: 0.3; }
.panel-empty p { font-size: 14px; margin-bottom: 16px; }

/* ── Collapsible ── */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 0;
  user-select: none;
}

.collapsible-header svg {
  transition: transform 0.2s;
  color: var(--text-muted);
}

.collapsible-header.open svg { transform: rotate(180deg); }

.collapsible-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.collapsible-body.open { max-height: 2000px; }

/* ── Summary Card ── */
.summary-card {
  border-left: 3px solid var(--blue);
  padding-left: 14px;
  margin: 12px 0;
}

.summary-card.personal-summary {
  border-left-color: var(--purple-text);
}

/* ── ASR Quality Badges ── */
.voice-quality-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 10px;
  line-height: 1;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
  vertical-align: middle;
}
.voice-quality-badge.corrected,
.voice-quality-badge.verified {
  border-color: rgba(34,197,94,0.28);
  color: #86efac;
  background: rgba(34,197,94,0.08);
}
.voice-quality-badge.low_confidence,
.voice-quality-badge.provider_disagreement {
  border-color: rgba(245,158,11,0.35);
  color: #fcd34d;
  background: rgba(245,158,11,0.10);
}
.voice-quality-badge.auto {
  border-color: rgba(148,163,184,0.24);
  color: var(--text-muted);
  background: rgba(148,163,184,0.07);
}
.voice-provider-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px dashed rgba(148,163,184,0.25);
  color: var(--text-muted);
  background: rgba(148,163,184,0.04);
  font-size: 10px;
  line-height: 1;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-title-row .chat-header-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title-row .chat-visibility-badge {
  flex-shrink: 0;
}

.chat-visibility-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 10px;
  line-height: 1;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
}

.chat-visibility-badge--team {
  border-color: rgba(34,197,94,0.28);
  color: #86efac;
  background: rgba(34,197,94,0.08);
}

.chat-visibility-badge--personal,
.chat-visibility-badge--private {
  border-color: rgba(59,130,246,0.28);
  color: #93c5fd;
  background: rgba(59,130,246,0.08);
}

.chat-visibility-badge--pending {
  border-color: rgba(245,158,11,0.35);
  color: #fcd34d;
  background: rgba(245,158,11,0.10);
}

.chat-visibility-badge--off {
  border-color: rgba(148,163,184,0.18);
  color: var(--text-muted);
  background: rgba(148,163,184,0.04);
}

.chat-visibility-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-visibility-detail > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-visibility-detail-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 999px;
  background: var(--text-muted);
}

.chat-visibility-detail--team .chat-visibility-detail-dot { background: #22c55e; }
.chat-visibility-detail--personal .chat-visibility-detail-dot,
.chat-visibility-detail--private .chat-visibility-detail-dot { background: #60a5fa; }
.chat-visibility-detail--pending .chat-visibility-detail-dot { background: #f59e0b; }
.chat-visibility-detail--off .chat-visibility-detail-dot { background: #64748b; }

.chat-visibility-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  min-height: 0;
}

.chat-visibility-action-btn {
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(230,126,34,0.32);
  background: rgba(230,126,34,0.10);
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.chat-visibility-action-btn:hover:not(:disabled) {
  background: rgba(230,126,34,0.16);
}

.chat-visibility-action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  color: var(--text-muted);
  border-color: rgba(148,163,184,0.18);
  background: rgba(148,163,184,0.05);
}

.chat-contact-settings-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  flex: 0 0 34px;
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
}

.chat-contact-settings-btn:hover,
.chat-contact-settings-btn:focus-visible {
  color: var(--text-primary);
  border-color: rgba(230,126,34,.38);
  background: rgba(230,126,34,.10);
}

.chat-contact-settings-icon {
  display: block;
  stroke: currentColor;
}

.chat-contact-settings-drawer[hidden] {
  display: none !important;
}

.chat-contact-settings-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.contact-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(2,6,23,.62);
}

.contact-settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  padding: 20px;
  overflow: auto;
  border-left: 1px solid var(--border);
  background: var(--bg-card, #111620);
  box-shadow: -18px 0 48px rgba(0,0,0,.32);
  color: var(--text-primary);
  z-index: 1001;
}

body.contact-settings-open {
  overflow: hidden;
}

.contact-settings-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.contact-settings-identity {
  display: flex;
  gap: 12px;
  min-width: 0;
  align-items: center;
}

.contact-settings-avatar {
  flex: 0 0 auto;
}

.contact-settings-title-stack {
  min-width: 0;
}

.contact-settings-kicker,
.contact-settings-section-title {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.contact-settings-title-stack h2 {
  margin: 3px 0 0;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.contact-settings-title-stack p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
}

.contact-settings-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  flex: 0 0 34px;
}

.contact-settings-section {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.contact-settings-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.contact-settings-detail {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

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

.contact-settings-metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.03);
}

.contact-settings-metric span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.2;
}

.contact-settings-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.15;
}

.contact-settings-actions {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.contact-settings-action-row,
.contact-settings-action-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
}

.contact-settings-action-btn {
  cursor: pointer;
  font-weight: 700;
}

.contact-settings-action-btn:hover:not(:disabled) {
  border-color: rgba(230,126,34,.38);
  background: rgba(230,126,34,.09);
}

.contact-settings-action-btn:disabled {
  cursor: not-allowed;
  color: var(--text-muted);
  opacity: .6;
}

.contact-settings-action-btn.is-danger {
  color: #fca5a5;
}

.contact-settings-action-label {
  font-size: 13px;
  font-weight: 750;
}

.contact-settings-action-detail {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.contact-settings-switch {
  flex: 0 0 34px;
}

.chat-header.chat-header-compact {
  min-height: 56px;
  padding: 8px 16px;
  gap: 10px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
}

.chat-header-compact .chat-header-main {
  min-width: 0;
  flex: 1 1 auto !important;
  margin-right: auto !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.chat-header-compact .chat-title-row {
  min-height: 20px;
}

.chat-header-compact .chat-header-name {
  min-width: 0;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-compact .chat-header-meta {
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-compact .chat-visibility-detail {
  display: none;
}

.chat-header-compact .chat-thread-search-slot {
  flex: 0 0 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  margin-left: 0 !important;
  transition: flex-basis .22s cubic-bezier(.2,.8,.2,1), max-width .22s cubic-bezier(.2,.8,.2,1);
}

.chat-header-compact .chat-thread-search-slot.is-thread-search-active {
  flex: 0 1 420px !important;
  min-width: 220px !important;
  max-width: 440px !important;
}

.chat-header-compact #chat-thread-search + #chat-contact-settings-btn {
  margin-left: 0;
}

.chat-header-compact #chat-contact-settings-btn {
  margin-left: 0 !important;
  flex: 0 0 34px !important;
}

.chat-header-compact .chat-header-actions,
.chat-header-compact .chat-header-controls,
.chat-header-compact .chat-header-share-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

.chat-header-compact .chat-thread-search-slot.is-thread-search-collapsed,
.chat-header-compact .chat-thread-search-slot.is-thread-search-collapsed.is-thread-search-expanded {
  flex: 0 0 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
}

.chat-header-compact .chat-visibility-actions {
  margin-top: 0;
}

.chat-header-compact .chat-header-share-actions:empty,
.chat-header-compact .chat-header-actions #chat-actions:empty {
  display: none;
}

.chat-header-compact .chat-visibility-action-btn {
  min-height: 28px;
  height: 28px;
  max-width: 170px;
  padding: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-compact .chat-header-toggle-shell {
  flex-direction: row;
  min-width: auto;
  gap: 6px;
}

.chat-header-compact .chat-header-toggle-label {
  font-size: 11px;
}

.chat-header-compact #chat-avatar .avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  max-width: 34px;
  min-height: 34px;
  max-height: 34px;
}

@media (max-width: 768px) {
  .chat-header.chat-header-compact {
    min-height: 56px;
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: wrap;
    align-content: center;
  }

  .chat-header.chat-header-compact.is-thread-search-mode {
    min-height: 104px;
    max-height: 120px;
    align-content: flex-start;
  }

  .chat-header-compact #back-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    flex: 0 0 36px;
    justify-content: center;
  }

  .chat-header-compact .search-return-btn {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-header-compact #chat-avatar .avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    max-width: 34px;
    min-height: 34px;
    max-height: 34px;
  }

  .chat-header-compact .chat-header-main {
    flex: 1 1 0;
  }

  .chat-header-compact .chat-title-row {
    gap: 6px;
  }

  .chat-header-compact .chat-header-name {
    font-size: 14px;
  }

  .chat-header-compact .chat-header-meta[data-compact] {
    font-size: 0;
  }

  .chat-header-compact .chat-header-meta[data-compact]::after {
    content: attr(data-compact);
    font-size: 11px;
  }

  .chat-header-compact .business-profile-badge,
  .chat-header-compact .chat-visibility-badge,
  .chat-header-compact .shared-pill {
    height: 18px;
    padding-inline: 6px;
    font-size: 10px;
  }

  .chat-header-compact .chat-thread-search-slot {
    flex: 0 0 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    order: 30;
  }

  .chat-header-compact .chat-thread-search-slot.is-thread-search-open {
    flex: 1 0 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    order: 60;
  }

  .chat-header-compact .chat-thread-search-slot.is-thread-search-expanded:not(.is-thread-search-open) {
    flex: 0 0 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
  }

  .chat-header-compact.is-thread-search-mode .chat-thread-search-slot {
    flex: 1 0 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    order: 60;
  }

  .chat-header-compact.is-thread-search-mode .chat-header-share-actions,
  .chat-header-compact.is-thread-search-mode .chat-header-actions,
  .chat-header-compact.is-thread-search-mode .chat-header-controls {
    display: none !important;
  }

  .chat-header-compact .chat-header-controls {
    order: 40;
  }

  .chat-header-compact .chat-contact-settings-btn {
    order: 45;
  }

  .chat-header-compact .chat-header-toggle-label {
    display: none;
  }

  .chat-header-compact .chat-header-share-actions,
  .chat-header-compact .chat-header-actions #chat-actions:not(:empty) {
    flex: 0 1 78px;
    order: 35;
    margin-left: 0;
  }

  .chat-header-compact .chat-visibility-action-btn {
    min-height: 24px;
    height: 24px;
    max-width: 78px;
    font-size: 11px;
    padding: 0 9px;
  }

  .chat-header-compact .chat-header-actions #chat-actions .btn {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .contact-settings-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-header-compact .chat-thread-search-slot {
    transition: none !important;
  }
}

.toggle.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.45);
}
.asr-feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}
.asr-feedback-btn {
  border: 1px solid var(--border);
  background: rgba(148,163,184,0.08);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 3px 9px;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.asr-feedback-btn:hover {
  border-color: rgba(230,126,34,0.42);
  color: var(--text-primary);
  background: rgba(230,126,34,0.12);
}
.asr-feedback-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.asr-feedback-panel {
  display: none;
  flex-direction: column;
  gap: 6px;
  width: min(420px, 100%);
  margin-top: 6px;
}
.asr-feedback-textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  color: var(--text-primary);
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
}
.asr-feedback-panel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.asr-feedback-status {
  min-height: 14px;
  color: var(--text-muted);
  font-size: 10px;
}

/* ── Activity Item ── */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-content { flex: 1; min-width: 0; }

.activity-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

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

.activity-time {
  font-size: 12px;
  color: var(--text-muted);
}

.activity-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.voice-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  line-height: 1;
  width: fit-content;
}

.voice-waveform {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 16px;
  color: currentColor;
  flex: 0 0 auto;
}

.voice-waveform span {
  display: block;
  width: 2px;
  border-radius: 999px;
  background: currentColor;
}

.voice-waveform span:nth-child(1) { height: 6px; opacity: 0.55; }
.voice-waveform span:nth-child(2) { height: 11px; opacity: 0.8; }
.voice-waveform span:nth-child(3) { height: 15px; opacity: 1; }
.voice-waveform span:nth-child(4) { height: 9px; opacity: 0.72; }
.voice-waveform span:nth-child(5) { height: 13px; opacity: 0.88; }
.voice-waveform span:nth-child(6) { height: 7px; opacity: 0.58; }

.voice-duration {
  font-weight: 700;
}

.forwarded-tag {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 8px;
  color: #c5ccd5;
  font-size: 12px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  width: fit-content;
}

.forwarded-tag-icon {
  color: #aeb7c2;
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-0.5px);
}

.forwarded-tag--frequent {
  color: #d6dde5;
}

.reply-context {
  display: block;
  margin: 0 0 8px;
  padding: 7px 9px 7px 10px;
  border-left: 3px solid #a78bfa;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.11);
  max-width: 100%;
  overflow: hidden;
}

.msg-bubble.me .reply-context {
  background: rgba(20, 184, 166, 0.10);
}

.reply-context-sender {
  margin-bottom: 2px;
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.reply-context-body {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Loading / Empty / Error ── */
.skeleton {
  background: var(--bg-card);
  border-radius: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: var(--bg-input);
  animation: pulse 1.5s ease-in-out infinite;
  margin-bottom: 8px;
}

.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 20px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.error-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
}

.error-state h3 {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 16px;
}

.error-state p {
  margin: 0 auto;
  max-width: 380px;
  font-size: 13px;
  line-height: 1.5;
}

.recovery-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-primary);
  z-index: 100;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: min(95vw, 480px);
  max-height: 90vh;
  overflow-y: auto;
}

@media (max-width: 480px) {
  .modal {
    padding: 16px;
    border-radius: 12px;
    font-size: 13px;
  }
  .modal h3 {
    font-size: 16px;
  }
  .plan-picker-modal-inner #plan-picker-cards {
    flex-direction: column;
  }
  .btn, button {
    min-height: 44px;
  }
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill:hover { border-color: var(--text-muted); }

.filter-pill.active {
  background: rgba(var(--accent-rgb),0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Settings Tabs ── */
.settings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }

.settings-tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}

.settings-tab:hover { color: var(--text-secondary); }

.settings-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.settings-section { display: none; }
.settings-section.active { display: block; }

/* ── Animate In ── */
.animate-in {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeSlideIn 0.3s ease forwards;
}

.animate-in-d1 { animation-delay: 0.05s; }
.animate-in-d2 { animation-delay: 0.1s; }
.animate-in-d3 { animation-delay: 0.15s; }
.animate-in-d4 { animation-delay: 0.2s; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes fadeSlideIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Tip Card (dismissible) ── */
.tip-card {
  background: var(--accent-glow);
  border: 1px solid rgba(230,126,34,0.15);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.tip-card .tip-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  margin-left: auto;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  text-align: center;
}

/* ── Wide control-center pages ───────────────────────────────────────────── */
.control-center-page {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.control-center-page .page-header,
.control-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.control-page-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
}

.home-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.home-date-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
}

.home-date-step,
.home-date-today,
.home-date-input {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
}

.home-date-step,
.home-date-today {
  min-width: 32px;
  padding: 0 9px;
  cursor: pointer;
}

.home-date-step:hover,
.home-date-today:hover {
  background: rgba(255,255,255,.06);
  color: var(--text-primary);
}

.home-date-today:disabled {
  cursor: default;
  background: var(--accent);
  color: #fff;
}

.home-date-input {
  width: 132px;
  padding: 0 8px;
  background: rgba(15,23,42,.68);
}

.home-command-page .home-date-input {
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
  width: 132px;
  min-width: 0;
  background: rgba(15, 23, 42, .82);
  border: 1px solid rgba(148,163,184,.18);
  color: var(--text-primary);
  text-align: center;
}

.home-command-page .home-date-input::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(.72);
}

.home-command-page .home-date-step,
.home-command-page .home-date-today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.dashboard-subnav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -6px 0 18px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255,255,255,.025);
}

.dashboard-subnav-item {
  flex: 0 0 auto;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border-radius: 7px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.dashboard-subnav-item:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,.04);
}

.dashboard-subnav-item.active {
  background: rgba(230,126,34,.16);
  color: var(--accent);
}

.control-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.control-main,
.control-rail {
  min-width: 0;
}

.control-rail {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.control-panel + .control-panel {
  margin-top: 14px;
}

.control-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.control-panel-copy {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
}

.ai-credit-error-state {
  border: 1px solid rgba(230,126,34,.28);
  background:
    linear-gradient(135deg, rgba(230,126,34,.10), rgba(15,23,42,.24)),
    rgba(255,255,255,.02);
  border-radius: 10px;
  padding: 22px;
}

.ai-credit-error-state h3 {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 16px;
}

.ai-credit-error-state p {
  color: var(--text-secondary);
  line-height: 1.5;
}

.settings-inline-note {
  border: 1px solid rgba(230,126,34,.28);
  background: rgba(230,126,34,.10);
  color: #f8c35f;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
}

.control-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.control-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.control-stat {
  min-width: 0;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  padding: 12px;
}

.control-stat-value {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.control-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.35;
}

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

.rail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.rail-row:last-child {
  border-bottom: none;
}

.rail-label {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.rail-value {
  flex: 0 0 auto;
  max-width: min(180px, 56%);
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
}

.rail-value.good { color: #22c55e; }
.rail-value.warn { color: #f59e0b; }
.rail-value.bad { color: #f87171; }

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.18);
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  background: rgba(148,163,184,.08);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.status-chip.summary-cache-badge {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  text-align: left;
}

.status-chip.good {
  border-color: rgba(34,197,94,.28);
  background: rgba(34,197,94,.08);
  color: #86efac;
}

.status-chip.warn {
  border-color: rgba(245,158,11,.28);
  background: rgba(245,158,11,.08);
  color: #fcd34d;
}

.status-chip.bad {
  border-color: rgba(248,113,113,.28);
  background: rgba(248,113,113,.08);
  color: #fca5a5;
}

/* ── V2 command navigation pages ───────────────────────────────────────── */
.command-surface {
  max-width: 1340px;
}

.command-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.command-kpi {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
}

.command-kpi-value {
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1.05;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.command-kpi-label {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.operations-main,
.operations-rail {
  min-width: 0;
}

.operations-rail {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 12px;
}

.ops-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.ops-answer {
  border: 1px solid rgba(230,126,34,.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(230,126,34,.08), rgba(255,255,255,.02) 42%);
  padding: 16px;
}

.ops-answer-title {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 800;
}

.ops-answer-copy {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.ops-source-list,
.tower-list,
.task-list {
  display: grid;
  gap: 9px;
}

.ops-source-card,
.tower-card,
.task-card {
  min-width: 0;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  padding: 12px;
}

.ops-source-card-link,
.tower-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.ops-source-card-link:hover,
.tower-card:hover,
.memory-briefing-card:hover,
.home-activity-card:hover {
  border-color: rgba(230,126,34,.38);
  background: rgba(230,126,34,.045);
}

.ops-section-gap {
  margin-top: 12px;
}

.ops-source-head,
.tower-card-head,
.task-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.ops-source-head > div,
.tower-card-head > div,
.task-card-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.ops-source-head .status-chip,
.tower-card-head .status-chip,
.task-card-head .status-chip {
  flex: 0 0 auto;
}

.ops-source-title,
.tower-card-title,
.task-card-title {
  min-width: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-source-meta,
.tower-card-meta,
.task-card-meta {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
  margin-top: 3px;
}

.ops-source-copy,
.tower-card-copy {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.tower-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 18px;
  align-items: start;
}

.tower-column {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.tower-table {
  width: 100%;
  border-collapse: collapse;
}

.tower-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.tower-table th,
.tower-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: left;
  font-size: 12px;
}

.tower-table th {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tower-table td {
  color: var(--text-secondary);
}

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

.tower-table-link {
  color: var(--text-primary);
  font-weight: 800;
  text-decoration: none;
}

.tower-table-link:hover {
  color: var(--accent);
}

/* ── Home command center draft ──────────────────────────────────────────── */
.home-command-page {
  max-width: 1340px;
}

.home-command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.home-command-main,
.home-command-rail {
  min-width: 0;
}

.home-command-rail {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-status-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  margin: 0 0 18px;
  padding: 15px 16px;
  border: 1px solid rgba(230,126,34,.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(230,126,34,.08), transparent 42%),
    rgba(255,255,255,.025);
}

.home-status-main,
.home-status-copy,
.home-status-chips {
  min-width: 0;
}

.home-status-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.home-status-copy {
  margin: 4px 0 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.home-status-chips {
  flex: 0 1 420px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.home-command-page .home-status-main {
  width: 100%;
}

.home-command-page .home-status-chips {
  display: flex;
  margin-top: 10px;
  justify-content: flex-start;
  flex: 1 1 100%;
}

.home-status-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 999px;
  background: rgba(15,23,42,.66);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.home-status-chip.good {
  border-color: rgba(34,197,94,.26);
  background: rgba(34,197,94,.09);
  color: #bbf7d0;
}

.home-status-chip.warn {
  border-color: rgba(245,158,11,.30);
  background: rgba(245,158,11,.10);
  color: #fde68a;
}

.home-status-chip.bad {
  border-color: rgba(239,68,68,.30);
  background: rgba(239,68,68,.10);
  color: #fecaca;
}

.home-briefing-panel {
  min-width: 0;
  min-height: 320px;
  border-color: rgba(230,126,34,.22);
  background:
    linear-gradient(135deg, rgba(230,126,34,.08), transparent 40%),
    var(--bg-card);
}

.home-briefings {
  display: grid;
  gap: 12px;
}

.home-briefing-section {
  display: grid;
  gap: 14px;
}

.home-briefing-section + .home-briefing-section {
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.home-briefing-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 0;
}

.home-briefing-section-head > div {
  min-width: 0;
}

.home-briefing-section-head .section-count {
  flex: 0 0 auto;
  margin-top: 2px;
  margin-left: auto;
  white-space: nowrap;
}

.home-briefing-section-head h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
}

.home-briefing-section-head p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.home-briefing-section-list {
  display: grid;
  gap: 10px;
}

.home-priority-panel {
  border-color: rgba(230,126,34,.24);
}

.home-priority-grid {
  display: grid;
  gap: 10px;
}

.home-action-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.home-action-row:hover {
  border-color: rgba(230,126,34,.36);
  background: rgba(230,126,34,.07);
  transform: translateY(-1px);
}

.home-action-row > div {
  min-width: 0;
}

.home-action-row strong {
  display: block;
  min-width: 0;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.home-action-row p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.home-action-row .status-chip {
  flex: 0 0 auto;
}

.home-attention-panel,
.home-today-panel,
.home-conversation-panel {
  min-width: 0;
  border-color: rgba(230,126,34,.22);
  background:
    linear-gradient(135deg, rgba(230,126,34,.07), transparent 44%),
    var(--bg-card);
}

.home-today-panel {
  border-color: rgba(34,197,94,.18);
  background:
    linear-gradient(135deg, rgba(34,197,94,.055), transparent 38%),
    var(--bg-card);
}

.home-command-queue-evidence {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.34fr);
  gap: 12px;
  align-items: stretch;
  min-width: 0;
}

.home-pulse-strip {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(148,163,184,.12);
  border-radius: 8px;
  background: rgba(148,163,184,.035);
}

.home-pulse-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.home-pulse-head p {
  margin: -3px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.home-pulse-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  min-width: 0;
}

.home-pulse-item {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(148,163,184,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.022);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease;
}

.home-pulse-item:hover {
  border-color: rgba(148,163,184,.26);
  background: rgba(148,163,184,.07);
}

.home-pulse-item span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.home-pulse-item strong,
.home-pulse-empty {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.home-confirmation-strip {
  display: grid;
  gap: 9px;
  grid-column: 1 / -1;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(245,158,11,.18);
  border-radius: 8px;
  background: rgba(245,158,11,.045);
}

.home-confirmation-strip[hidden] {
  display: none;
}

.home-confirmation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.home-confirmation-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.home-confirmation-list {
  display: grid;
  gap: 4px;
}

.home-confirmation-list .home-work-row {
  padding: 8px 0;
}

.home-attention-panel-is-empty {
  border-color: rgba(148,163,184,.16);
  background:
    linear-gradient(135deg, rgba(148,163,184,.05), transparent 44%),
    var(--bg-card);
}

.home-review-empty-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(148,163,184,.14);
  border-radius: 8px;
  background: rgba(148,163,184,.045);
}

.home-review-empty-compact > div {
  min-width: 0;
}

.home-review-empty-compact strong {
  display: block;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.home-review-empty-compact p {
  margin: 5px 0 0;
  max-width: 560px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.home-review-empty-compact .btn {
  flex: 0 0 auto;
}

.home-operator-queue,
.home-evidence-pane {
  min-width: 0;
}

.home-brief-subhead {
  margin: 0 0 9px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.home-evidence-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.024);
}

.home-evidence-empty {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.home-evidence-selected {
  display: grid;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.home-evidence-kind {
  width: fit-content;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(230,126,34,.12);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.home-evidence-selected strong {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.home-evidence-selected p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.home-source-message-block {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(148,163,184,.13);
  border-radius: 8px;
  background: rgba(15,23,42,.28);
}

.home-source-message-block > span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
}

.home-source-message-block > p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.home-source-message {
  margin: 0;
  padding: 0 0 0 10px;
  border-left: 2px solid rgba(230,126,34,.36);
}

.home-source-message p,
.home-source-message-text {
  margin: 0;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.home-source-message-text {
  display: block;
  text-decoration: none;
}

a.home-source-message-text:hover {
  color: var(--accent);
}

.home-source-message-actions {
  display: flex;
  margin-top: 5px;
}

.home-source-message-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  padding: 0;
}

.home-source-message-toggle:hover {
  color: var(--accent-hover);
}

.home-source-message footer {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
}

.home-evidence-rows {
  display: grid;
  gap: 8px;
}

.home-evidence-row {
  display: grid;
  gap: 3px;
}

.home-evidence-row span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
}

.home-evidence-row strong {
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.home-evidence-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.home-evidence-token {
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  background: rgba(255,255,255,.035);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.home-evidence-token.is-flag {
  border-color: rgba(245,158,11,.18);
  background: rgba(245,158,11,.08);
  color: #fcd34d;
}

.home-evidence-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.home-work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-work-grid .empty-state {
  grid-column: 1 / -1;
}

.home-work-grid .error-state {
  grid-column: 1 / -1;
}

.home-work-card {
  min-width: 0;
  min-height: 176px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
}

.home-work-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.home-work-card-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.home-work-card-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.home-work-list {
  display: grid;
  gap: 7px;
}

.home-work-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  grid-template-areas:
    "dot text text"
    ". meta chip";
  gap: 8px;
  align-items: start;
  padding: 8px 0;
  color: inherit;
  text-decoration: none;
  border-top: 1px solid rgba(255,255,255,.07);
  border-radius: 6px;
}

.home-work-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.home-work-row:hover .home-work-text {
  color: var(--accent);
}

.home-work-row.is-selected {
  padding-left: 8px;
  padding-right: 8px;
  border-color: rgba(230,126,34,.24);
  background: rgba(230,126,34,.07);
}

.home-work-dot {
  grid-area: dot;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-top: 5px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(230,126,34,.12);
}

.home-work-text,
.home-work-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.home-work-text {
  grid-area: text;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.home-work-meta {
  grid-area: meta;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.25;
}

.trust-chip {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid rgba(34,197,94,.22);
  border-radius: 999px;
  background: rgba(34,197,94,.08);
  color: #86efac;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.trust-chip.warn {
  border-color: rgba(245,158,11,.3);
  background: rgba(245,158,11,.09);
  color: #fcd34d;
}

.trust-chip.muted {
  border-color: rgba(148,163,184,.22);
  background: rgba(148,163,184,.08);
  color: #cbd5e1;
}

.home-work-row .trust-chip {
  grid-area: chip;
  justify-self: end;
}

.home-attention-list,
.home-conversation-list {
  display: grid;
  gap: 10px;
}

.home-attention-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.home-attention-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(82px, .28fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.home-attention-row:hover,
.home-conversation-card:hover {
  border-color: rgba(230,126,34,.36);
  background: rgba(230,126,34,.07);
  transform: translateY(-1px);
}

.home-attention-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid rgba(230,126,34,.22);
  border-radius: 999px;
  background: rgba(230,126,34,.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.home-attention-body {
  min-width: 0;
}

.home-attention-body strong,
.home-conversation-title strong {
  display: block;
  min-width: 0;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.home-attention-body p,
.home-conversation-summary,
.home-conversation-evidence {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.home-attention-source {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.attention-list-panel {
  min-height: 260px;
}

.attention-list,
.attention-source-coverage,
.attention-pulse-list {
  display: grid;
  gap: 10px;
}

.attention-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(92px, .25fr) minmax(0, 1fr) minmax(96px, .22fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.attention-row:hover,
.attention-coverage-row:hover,
.attention-pulse-row:hover {
  border-color: rgba(230,126,34,.36);
  background: rgba(230,126,34,.07);
  transform: translateY(-1px);
}

.attention-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid rgba(230,126,34,.22);
  border-radius: 999px;
  background: rgba(230,126,34,.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.attention-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.attention-main strong {
  min-width: 0;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.attention-main span,
.attention-source,
.attention-coverage-empty {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.attention-source {
  color: var(--text-muted);
  font-weight: 700;
  text-align: right;
}

.attention-pulse-panel,
.attention-coverage-panel {
  margin-top: 14px;
}

.attention-source-coverage,
.attention-pulse-list {
  margin-top: 12px;
}

.attention-coverage-row,
.attention-pulse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.attention-pulse-row {
  border-color: rgba(148,163,184,.12);
  background: rgba(148,163,184,.035);
}

.attention-coverage-row span,
.attention-pulse-row span {
  min-width: 0;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.attention-coverage-row strong,
.attention-pulse-row strong {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.attention-coverage-row[data-source-coverage="active"] strong {
  color: var(--accent);
}

.home-conversation-card {
  display: block;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.home-conversation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.home-conversation-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.home-conversation-meta {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.home-conversation-evidence strong {
  color: var(--text-primary);
}

.memory-briefing-card {
  display: block;
  color: inherit;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  padding: 13px 14px 12px;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.memory-briefing-card:focus-visible,
.home-attention-row:focus-visible,
.home-work-row:focus-visible,
.home-conversation-card:focus-visible,
.home-activity-card:focus-visible,
.home-alert-card:focus-visible,
.ops-source-card-link:focus-visible,
.tower-card:focus-visible {
  outline: 2px solid rgba(230,126,34,.75);
  outline-offset: 2px;
}

.memory-briefing-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.memory-briefing-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.memory-briefing-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-briefing-meta {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  margin-top: -2px;
}

.memory-briefing-chip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.memory-briefing-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 999px;
  background: rgba(15,23,42,.68);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.memory-briefing-summary {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.memory-briefing-summary.is-muted {
  color: var(--text-muted);
}

.memory-briefing-block {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.memory-briefing-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.home-search-panel {
  border-color: rgba(230,126,34,.2);
}

.home-search-preview {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.home-search-preview .btn {
  width: 100%;
}

.home-search-preview p {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.home-search-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.home-search-suggestions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 999px;
  background: rgba(15,23,42,.66);
  color: var(--text-secondary);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.home-search-suggestions button:hover,
.home-search-suggestions button:focus-visible {
  border-color: rgba(230,126,34,.34);
  color: var(--accent);
}

.home-rail-action {
  margin-top: 12px;
}

.search-preview-input {
  min-height: 42px;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-muted);
  padding: 0 12px;
  font-size: 13px;
}

input.search-preview-input {
  width: 100%;
  font-family: inherit;
  outline: none;
  appearance: none;
}

input.search-preview-input::placeholder {
  color: var(--text-muted);
}

input.search-preview-input:focus {
  color: var(--text-primary);
  border-color: rgba(230,126,34,.6);
  box-shadow: 0 0 0 3px rgba(230,126,34,.14);
}

.home-alert-card {
  display: block;
  cursor: pointer;
  border-color: rgba(230,126,34,.34);
  background: rgba(230,126,34,.08);
  color: inherit;
  text-decoration: none;
}

.home-alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-alert-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
}

.home-alert-copy {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
}

.home-alert-action {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.home-rail-head {
  display: grid;
  gap: 10px;
}

.home-segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-input);
}

.home-segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.home-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.home-metric-card {
  min-width: 0;
  padding: 12px;
  text-align: left;
  border-radius: 8px;
  background: rgba(255,255,255,.025);
}

.home-metric-card .metric-value {
  font-size: 21px;
  overflow-wrap: anywhere;
}

.home-metric-card .metric-label {
  line-height: 1.25;
}

.home-proof-strip {
  border-color: rgba(59,130,246,.16);
}

.home-proof-cues {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.home-proof-cues a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  background: rgba(255,255,255,.02);
  color: inherit;
  text-decoration: none;
}

.home-proof-cues span {
  color: var(--text-muted);
  font-size: 12px;
}

.home-proof-cues strong {
  min-width: 0;
  color: var(--accent);
  font-size: 12px;
  text-align: right;
  overflow-wrap: anywhere;
}

.home-command-page .home-proof-cues {
  grid-template-columns: 1fr;
}

.home-command-page .home-proof-cues a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.home-command-page .home-proof-cues a:visited,
.home-command-page .home-proof-cues a:hover,
.home-command-page .home-proof-cues a:focus {
  color: var(--text-primary);
  text-decoration: none;
}

.home-activity-list .activity-item {
  padding: 13px 0;
}

.home-activity-list .activity-text {
  color: var(--text-secondary);
}

.home-activity-card {
  color: inherit;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px;
  margin: 0 -4px;
  transition: border-color .15s ease, background .15s ease;
}

.settings-page-content {
  width: 100%;
  max-width: 1460px;
  min-width: 0;
}

.settings-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.settings-rail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.settings-section .card {
  border-radius: 8px;
}

.settings-rail .rail-row {
  flex-wrap: wrap;
}

.settings-rail .rail-value {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.settings-toggle-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.settings-toggle-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.settings-toggle-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.settings-team-header,
.settings-team-member-row,
.settings-team-member-actions {
  display: flex;
  align-items: center;
}

.settings-team-header {
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.settings-team-member-row {
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.settings-team-member-main {
  flex: 1 1 220px;
  min-width: 0;
}

.settings-team-member-name,
.settings-team-member-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-team-member-name {
  font-size: 13px;
  font-weight: 600;
}

.settings-team-member-meta {
  font-size: 11px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.settings-team-member-capture {
  margin-top: 2px;
}

.settings-team-member-actions {
  flex: 0 1 auto;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-team-note {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-input);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.settings-premium-card {
  border-color: rgba(230,126,34,.16);
  box-shadow: 0 18px 42px rgba(0,0,0,.18);
}

.settings-chat-summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.settings-chat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  transition: border .2s;
}

.settings-chat-row--new {
  border-color: rgba(230,126,34,.25);
}

.settings-chat-emoji {
  flex-shrink: 0;
  font-size: 20px;
}

.settings-chat-main {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-chat-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-chat-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  min-width: 0;
  flex-wrap: wrap;
}

.settings-chat-count,
.settings-chat-status {
  font-size: 11px;
  line-height: 1.3;
}

.settings-chat-count,
.settings-chat-status--off {
  color: var(--text-muted);
}

.settings-chat-status--on {
  color: #22c55e;
}

.settings-chat-new-badge {
  display: inline-flex;
  align-items: center;
  min-height: 16px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  vertical-align: 1px;
}

.settings-chat-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.settings-chat-toggle-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.settings-chat-paused-since {
  margin-top: 2px;
  color: #ef4444;
  font-size: 9px;
  text-align: center;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 180px; }
  .control-layout {
    grid-template-columns: 1fr;
  }
  .home-command-grid {
    grid-template-columns: 1fr;
  }
  .operations-grid,
  .tower-layout {
    grid-template-columns: 1fr;
  }
  .operations-rail {
    position: static;
  }
  .command-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .control-rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-command-rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-command-queue-evidence {
    grid-template-columns: 1fr;
  }
  .home-work-grid {
    grid-template-columns: 1fr;
  }
  .home-work-row {
    grid-template-columns: 8px minmax(0, 1fr);
    grid-template-areas:
      "dot text"
      ". meta"
      ". chip";
  }
  .home-work-row .home-work-text,
  .home-work-row .home-work-meta,
  .home-work-row .trust-chip {
    justify-self: start;
  }
  .control-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .main { margin-left: 0 !important; }
  .mobile-tabs { display: block; }
  .page-content { padding: 16px; padding-bottom: 80px; }
  .control-center-page {
    max-width: none;
  }
  .control-page-header {
    flex-direction: column;
    align-items: stretch;
  }
  .control-page-header > .btn,
  .home-header-actions {
    width: fit-content;
    max-width: 100%;
    align-self: flex-start;
  }
  .home-date-controls {
    width: 100%;
  }
  .home-date-input {
    flex: 1;
    min-width: 0;
  }
  .home-command-page .home-date-controls {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 6px;
    width: 100%;
  }
  .home-command-page .home-date-input {
    width: 100%;
  }
  .home-command-page .home-date-today {
    grid-column: 1 / -1;
    width: 100%;
  }
  .control-panel-header {
    flex-direction: column;
    align-items: stretch;
  }
  .control-toolbar {
    align-items: stretch;
  }
  .tower-table-wrap {
    overflow: visible;
  }
  .tower-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 8px;
  }
  .tower-table,
  .tower-table tbody,
  .tower-table tr,
  .tower-table td {
    display: block;
    width: 100%;
  }
  .tower-table thead {
    display: none;
  }
  .tower-table tr {
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 8px;
    background: rgba(255,255,255,.025);
    padding: 10px;
  }
  .tower-table td {
    border-bottom: 0;
    padding: 4px 0;
  }
  .tower-table td[data-label] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .tower-table td[data-label]::before {
    content: attr(data-label);
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .tower-table td[data-label] > * {
    flex: 0 0 auto;
  }
  .tower-table .status-chip {
    max-width: min(180px, 58%);
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .rail-row {
    gap: 10px;
  }
  .rail-value {
    max-width: 50%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  .memory-briefing-head,
  .home-alert-row,
  .home-action-row,
  .home-conversation-head,
  .activity-meta {
    flex-wrap: wrap;
  }
  .home-action-row {
    align-items: flex-start;
  }
  .home-attention-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .home-attention-actions {
    justify-content: flex-start;
  }
  .home-review-empty-compact {
    align-items: flex-start;
    flex-direction: column;
  }
  .home-attention-type {
    justify-self: flex-start;
  }
  .home-attention-source {
    text-align: left;
  }
  .attention-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .attention-type {
    justify-self: flex-start;
  }
  .attention-source {
    text-align: left;
  }
  .attention-coverage-row,
  .attention-pulse-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .home-work-card {
    min-height: auto;
  }
  .home-status-band {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .home-status-copy {
    font-size: 17px;
  }
  .home-status-chips {
    flex-basis: auto;
    justify-content: flex-start;
  }
  .home-command-page .home-proof-cues {
    grid-template-columns: 1fr;
  }
  .home-command-page .home-proof-cues a {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .memory-briefing-head {
    align-items: flex-start;
  }
  .home-command-page .btn {
    width: fit-content;
    max-width: 100%;
  }
  .home-command-grid,
  .home-command-main,
  .home-command-rail,
  .home-command-page .control-page-subtitle {
    min-width: 0;
    max-width: 100%;
  }
  .home-command-page {
    max-width: 100vw;
    overflow-x: hidden;
  }
  .home-command-grid {
    width: 100%;
    max-width: calc(100vw - 32px);
  }
  .memory-briefing-head {
    flex-direction: column;
  }
  .memory-briefing-head .status-chip {
    max-width: 100%;
  }
  .home-action-row .status-chip {
    max-width: 100%;
  }
  .home-briefing-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .home-briefing-section-head .section-count {
    max-width: 100%;
    margin-left: 0;
  }
  .activity-item {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
  }
  .activity-text,
  .memory-briefing-summary,
  .memory-briefing-block,
  .home-attention-body p,
  .home-conversation-summary,
  .home-conversation-evidence,
  .home-command-page .control-page-subtitle {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .home-command-page .control-panel,
  .home-command-page .memory-briefing-card,
  .home-command-page .home-attention-row,
  .home-command-page .home-conversation-card,
  .home-command-page .activity-item {
    min-width: 0;
    max-width: calc(100vw - 32px);
    overflow: hidden;
  }
  .control-rail {
    grid-template-columns: 1fr;
  }
  .home-command-rail {
    grid-template-columns: 1fr;
  }
  .control-stat-grid {
    grid-template-columns: 1fr;
  }
  .home-metrics-grid {
    grid-template-columns: 1fr;
  }
  .command-kpi-grid {
    grid-template-columns: 1fr;
  }
  .ops-search-row {
    grid-template-columns: 1fr;
  }
  .dashboard-subnav {
    width: 100%;
    flex-wrap: wrap;
    overflow: visible;
  }
  .dashboard-subnav-item {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 0;
    min-height: 36px;
    padding: 7px 8px;
    white-space: normal;
    line-height: 1.2;
    text-align: center;
  }
  .settings-tabs {
    flex-wrap: wrap;
    gap: 6px;
    overflow: visible;
    border-bottom: 0;
    margin-bottom: 16px;
  }
  .settings-tab {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255,255,255,.025);
    white-space: normal;
    line-height: 1.2;
    text-align: center;
  }
  .settings-tab.active {
    border-color: rgba(230,126,34,.42);
    background: rgba(230,126,34,.12);
  }

  .page-content.two-panel {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    padding-bottom: 72px;
  }

  .panel-left {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .panel-left.hidden-mobile { display: none !important; }
  .panel-right.hidden-mobile { display: none !important; }

  .panel-right {
    width: 100%;
    position: fixed;
    inset: 0 0 calc(64px + env(safe-area-inset-bottom)) 0;
    z-index: 45;
    padding-bottom: 16px;
  }

  .settings-chat-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .settings-chat-main {
    flex: 1 1 calc(100% - 36px);
  }

  .settings-chat-control {
    flex: 1 1 100%;
    justify-content: flex-end;
    padding-left: 32px;
  }

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

  .filter-bar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 380px) {
  .card-grid { grid-template-columns: 1fr; }
  .settings-chat-control {
    justify-content: flex-start;
    padding-left: 32px;
  }
}

/* ── New Group Notification ── */
.new-group-card {
  border: 1px solid var(--accent);
  background: var(--accent-glow);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}

/* ── Disconnect Button Zone ── */
.danger-zone {
  border: 1px solid rgba(192,57,43,0.3);
  border-radius: 12px;
  padding: 16px;
  background: rgba(192,57,43,0.05);
  margin-top: 16px;
}

/* ── Usage Meter (large, for settings) ── */
.usage-meter-lg {
  margin-bottom: 16px;
}

.usage-meter-lg .meter-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.usage-meter-lg .meter-bar-lg {
  height: 8px;
  background: var(--bg-input);
  border-radius: 8px;
  overflow: hidden;
}

.usage-meter-lg .meter-fill-lg {
  height: 100%;
  border-radius: 8px;
  transition: width 0.4s;
}

/* ── Search ── */
.search-input-wrapper {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input-wrapper .input {
  padding-left: 44px;
  font-size: 15px;
  border-radius: 12px;
}

/* ── AI Answer ── */
.ai-answer {
  border-left: 3px solid var(--accent);
  padding: 16px 16px 16px 20px;
  background: var(--bg-card);
  border-radius: 0 12px 12px 0;
  margin: 20px 0;
}

.ai-answer p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

/* ── Export List ── */
.export-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.export-badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.export-badge.pdf { background: rgba(39,174,96,0.15); color: var(--green); }
.export-badge.csv { background: rgba(42,92,143,0.2); color: #5b9bd5; }

/* ── Mobile Drawer ── */
.mobile-drawer { display: none; }
.mobile-drawer.open { display: block; }

.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998;
  animation: fadeIn 0.2s ease;
}

.mobile-drawer-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  z-index: 999;
  max-height: 75vh;
  overflow-y: auto;
  padding: 0 0 20px;
  animation: slideUp 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.mobile-drawer-handle {
  display: flex;
  justify-content: center;
  padding: 12px 0 8px;
  cursor: pointer;
}

.handle-bar {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.mobile-drawer-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px 16px 16px;
}

.mobile-drawer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}

.mobile-drawer-item:hover,
.mobile-drawer-item:active {
  background: rgba(230,126,34,0.08);
  color: var(--text-primary);
}

.mobile-drawer-item.active {
  background: rgba(230,126,34,0.12);
  color: var(--accent);
}

.mobile-drawer-item svg {
  width: 22px;
  height: 22px;
}

.mobile-drawer-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* Hide sidebar on mobile, show drawer */
@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .mobile-drawer-panel .sidebar-meters { margin: 0; }
}

/* Chat config toggles */
.sw-track {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 9999px;
  background: var(--bg-input, rgba(255,255,255,.08));
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.sw-track.sw-on {
  background: var(--accent, #e67e22);
  border-color: var(--accent, #e67e22);
}
.sw-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}
.sw-track.sw-on::after { transform: translateX(16px); }

/* ── Whisper language picker (review banner + settings) ──────────────────── */
.review-banner { margin: 6px 0 4px; padding: 8px 10px; background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.35); border-radius: 8px; font-size: 12px; color: #fbbf24; }
.review-banner strong { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; }
.review-picker-wrap { display: flex; flex-direction: column; gap: 6px; }
.review-picker-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.review-lang-btn { padding: 4px 10px; border-radius: 20px; border: 1px solid rgba(251,191,36,0.4); background: rgba(251,191,36,0.1); color: #fbbf24; font-size: 11px; cursor: pointer; font-weight: 600; transition: background 0.15s; }
.review-lang-btn:hover { background: rgba(251,191,36,0.25); }
.review-lang-btn.loading { opacity: 0.5; pointer-events: none; }
.review-lang-btn--more { border-color: rgba(148,163,184,0.3); background: rgba(148,163,184,0.08); color: var(--text-muted, #7a8494); }
.review-lang-btn--more:hover { background: rgba(148,163,184,0.15); color: var(--text-secondary); }
.review-picker-full { display: flex; flex-direction: column; gap: 4px; }
.review-picker-search { background: var(--bg-main, #0d1926); color: var(--text-primary, #f1f5f9); border: 1px solid var(--border, #2a3a4a); border-radius: 6px; padding: 7px 10px; font-size: 12px; outline: none; font-family: inherit; width: 100%; box-sizing: border-box; }
.review-picker-search:focus { border-color: rgba(230,126,34,0.5); }
.review-picker-list { max-height: 180px; overflow-y: auto; border: 1px solid var(--border, #2a3a4a); border-radius: 6px; background: var(--bg-sidebar, #1a2332); }
.review-picker-item { padding: 7px 10px; font-size: 12px; cursor: pointer; color: var(--text-secondary, #94a3b8); display: flex; align-items: center; gap: 6px; }
.review-picker-item:hover { background: rgba(230,126,34,0.12); color: var(--text-primary, #f1f5f9); }
.review-status { font-size: 11px; margin-top: 4px; color: var(--text-muted, #7a8494); min-height: 14px; }

/* ── Settings language picker search (dark, matches theme) ──────────────── */
.ws-lang-search {
  background: #0d1926 !important;
  color: #f1f5f9 !important;
  border: none !important;
  border-bottom: 1px solid #2a3a4a !important;
  border-radius: 0 !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  outline: none !important;
  font-family: inherit !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.ws-lang-search::placeholder { color: #7a8494 !important; }
.ws-lang-search:focus { border-bottom-color: rgba(230,126,34,0.5) !important; }

/* ── Settings — desktop workspace layout ───────────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  align-items: flex-start;
  min-height: 60vh;
  min-width: 0;
}

/* Vertical sidenav — desktop only */
.settings-sidenav {
  display: none; /* hidden on mobile */
  flex-direction: column;
  width: clamp(160px, 16vw, 196px);
  flex-shrink: 0;
  padding: 2px 10px 2px 0;
  border-right: 1px solid rgba(255,255,255,.06);
  margin-right: 0;
  gap: 14px;
  min-width: 0;
}

.settings-sidenav-group {
  min-width: 0;
}

.settings-sidenav-group + .settings-sidenav-group {
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top: 14px;
}

.settings-sidenav-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 8px 8px;
}

.settings-navitem {
  position: relative;
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.25;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
  margin: 0 0 3px;
  white-space: nowrap;
  min-width: 0;
}

.settings-navitem::after {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  right: -11px;
  width: 2px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .16s ease;
}

.settings-navicon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(255,255,255,.035);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.settings-navlabel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-navitem:hover {
  background: rgba(255,255,255,0.045);
  border-color: rgba(255,255,255,.05);
  color: var(--text-secondary);
}

.settings-navitem:hover .settings-navicon {
  background: rgba(255,255,255,.055);
  color: var(--text-primary);
}

.settings-navitem:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb),.48);
  outline-offset: 2px;
}

.settings-navitem.active {
  background: linear-gradient(90deg, rgba(var(--accent-rgb),0.16), rgba(var(--accent-rgb),0.06));
  border-color: rgba(var(--accent-rgb),.18);
  color: var(--accent);
  font-weight: 700;
}

.settings-navitem.active::after {
  opacity: 1;
}

.settings-navitem.active .settings-navicon {
  background: rgba(var(--accent-rgb),.16);
  color: var(--accent);
}

.theme-settings-stack {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--border);
}

.theme-settings-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(220px, 310px);
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
}

.theme-settings-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-secondary);
}

.theme-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 7px;
}

.theme-preset-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0)),
    var(--bg-input);
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.theme-preset-button:hover {
  color: var(--text-primary);
  border-color: rgba(var(--accent-rgb),0.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.055), 0 8px 20px rgba(0,0,0,0.14);
  transform: translateY(-1px);
}

.theme-preset-button:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb),0.46);
  outline-offset: 2px;
}

.theme-preset-button.active {
  color: var(--text-primary);
  border-color: rgba(var(--accent-rgb),0.72);
  background:
    radial-gradient(circle at 50% 0, rgba(var(--accent-rgb),0.22), transparent 58%),
    rgba(var(--accent-rgb),0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 1px rgba(var(--accent-rgb),0.12);
}

.theme-preset-swatch {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--preset-accent, var(--accent));
  box-shadow: 0 0 0 3px rgba(255,255,255,0.035);
  flex: 0 0 auto;
}

.theme-preset-name {
  min-width: 0;
  line-height: 1.15;
  white-space: normal;
}

.theme-inline-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-switch-control {
  justify-content: flex-end;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 50px;
  height: 30px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.theme-switch-track {
  position: relative;
  display: block;
  width: 50px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0)),
    var(--bg-input);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.22), 0 1px 0 rgba(255,255,255,0.035);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.theme-switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #d7dde7);
  box-shadow: 0 4px 10px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.78);
  transition: transform 0.2s cubic-bezier(.2,.8,.2,1), background 0.18s ease, box-shadow 0.18s ease;
}

.theme-switch:hover .theme-switch-track {
  border-color: rgba(var(--accent-rgb),0.36);
}

.theme-switch input:focus-visible + .theme-switch-track {
  outline: 2px solid rgba(var(--accent-rgb),0.46);
  outline-offset: 3px;
}

.theme-switch input:checked + .theme-switch-track {
  border-color: rgba(var(--accent-rgb),0.72);
  background:
    radial-gradient(circle at 72% 50%, rgba(255,255,255,0.22), transparent 28%),
    linear-gradient(180deg, rgba(var(--accent-rgb),0.94), rgba(var(--accent-rgb),0.72));
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.12), 0 8px 22px rgba(var(--accent-rgb),0.20);
}

.theme-switch input:checked + .theme-switch-track .theme-switch-thumb {
  transform: translateX(20px);
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
  box-shadow: 0 5px 12px rgba(0,0,0,0.26), inset 0 1px 0 rgba(255,255,255,0.85);
}

.theme-color-chip {
  width: 36px;
  height: 28px;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  background: var(--accent);
  flex: 0 0 auto;
}

.theme-color-input {
  width: 48px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.theme-hex-input {
  max-width: 120px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-transform: uppercase;
}

.theme-range {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.theme-range:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb),0.46);
  outline-offset: 4px;
  border-radius: 999px;
}

.theme-action-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

.theme-action-button {
  min-height: 36px;
  padding-inline: 17px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.045);
}

.theme-action-button:hover {
  transform: translateY(-1px);
}

.theme-action-primary {
  box-shadow: 0 10px 22px rgba(var(--accent-rgb),0.20), inset 0 1px 0 rgba(255,255,255,0.16);
}

.theme-preview {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--bg-sidebar), var(--bg-card));
}

.theme-preview-shell {
  display: grid;
  grid-template-columns: 92px 1fr;
  min-height: 118px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-page);
}

.theme-preview-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 10px;
}

.theme-preview-logo {
  width: 32px;
  height: 22px;
  border-radius: 8px;
  background: rgba(var(--accent-rgb),0.18);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.theme-preview-nav {
  height: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  margin-bottom: 8px;
}

.theme-preview-nav.active {
  background: rgba(var(--accent-rgb),0.18);
}

.theme-preview-main {
  padding: 12px;
}

.theme-preview-title {
  height: 10px;
  width: 54%;
  border-radius: 8px;
  background: rgba(255,255,255,0.16);
  margin-bottom: 12px;
}

.theme-preview-card {
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 10px;
}

.theme-preview-line {
  height: 7px;
  border-radius: 8px;
  background: rgba(255,255,255,0.10);
  margin-bottom: 9px;
}

.theme-preview-line.accent {
  width: 64%;
  background: rgba(var(--accent-rgb),0.28);
}

@media (max-width: 680px) {
  .theme-settings-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }

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

  .theme-preview-shell {
    grid-template-columns: 72px 1fr;
  }
}

/* Content area */
.settings-body {
  min-width: 0;
}

body.demo-settings-locked [data-demo-settings-locked="true"] {
  cursor: not-allowed !important;
  opacity: 0.62;
}

body.demo-settings-locked #app-language-options,
body.demo-settings-locked #app-language-options * {
  cursor: pointer;
  opacity: 1;
}

/* Mobile: horizontal scroll tabs visible, sidenav hidden */
.settings-tabs-mobile { display: flex; }

/* Desktop: hide mobile tabs, show sidenav */
@media (min-width: 768px) {
  .settings-page-content {
    padding-left: clamp(16px, 2vw, 28px);
    padding-right: clamp(16px, 2vw, 28px);
  }
  .settings-tabs-mobile { display: none !important; }
  .settings-sidenav { display: flex; }
  .settings-layout {
    grid-template-columns: clamp(160px, 16vw, 196px) minmax(0, 1fr);
  }
  .settings-rail {
    grid-column: 2;
  }
}

@media (min-width: 1360px) {
  .settings-layout {
    grid-template-columns: clamp(160px, 14vw, 196px) minmax(0, 1fr) minmax(260px, 300px);
    gap: 20px;
  }
  .settings-rail {
    grid-column: auto;
    position: sticky;
    top: 24px;
  }
}

@media (max-width: 640px) {
  .settings-team-header {
    align-items: stretch;
  }

  .settings-team-header .btn {
    width: 100%;
    justify-content: center;
  }

  .settings-team-member-actions {
    width: 100%;
    justify-content: flex-start;
    padding-left: 42px;
  }
}
