/* ============ NUVEM DESK AI · DESIGN TOKENS ============ */
:root {
  /* Brand */
  --brand-green: #1B9E47;
  --brand-green-strong: #168A3D;
  --brand-green-soft: #E8F5EC;
  --brand-green-soft-2: #D6EEDE;
  --brand-red: #DC2626;
  --brand-red-soft: #FDECEC;
  --brand-amber: #D97706;
  --brand-amber-soft: #FEF3C7;
  --brand-blue: #2563EB;
  --brand-blue-soft: #E0E9FB;
  --brand-purple: #7C3AED;
  --brand-purple-soft: #EDE4FB;

  /* Channel colors */
  --ch-whatsapp: #25D366;
  --ch-glpi: #E48700;
  --ch-email: #64748B;
  --ch-crm: #2563EB;

  /* Light surfaces */
  --bg: #FBFBFA;
  --bg-2: #F4F4F3;
  --surface: #FFFFFF;
  --surface-2: #F7F7F6;
  --surface-hover: #F1F1EF;
  --surface-active: #ECECEA;
  --hairline: #E7E7E4;
  --hairline-strong: #DEDEDA;
  --text: #111315;
  --text-2: #4A4D52;
  --text-3: #7A7D83;
  --text-4: #A6A8AD;
  --ring: rgba(27,158,71,0.35);

  /* Type */
  --font-sans: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  /* Spacing (dense) */
  --row-h: 38px;
  --row-h-lg: 44px;
  --pad-x: 12px;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
}

[data-theme="dark"] {
  --bg: #0A0B0C;
  --bg-2: #0F1112;
  --surface: #131517;
  --surface-2: #16191B;
  --surface-hover: #1B1E21;
  --surface-active: #21252A;
  --hairline: #232629;
  --hairline-strong: #2C3034;
  --text: #ECEDEE;
  --text-2: #B6B9BD;
  --text-3: #888B8F;
  --text-4: #5C5F63;

  --brand-green-soft: #0F2418;
  --brand-green-soft-2: #143020;
  --brand-red-soft: #2A1414;
  --brand-amber-soft: #2A1F0D;
  --brand-blue-soft: #0E1A2E;
  --brand-purple-soft: #1B1230;
}

/* ============ DENSITY ============ */
[data-density="compact"] { --row-h: 32px; --row-h-lg: 38px; --pad-x: 10px; }
[data-density="cozy"] { --row-h: 38px; --row-h-lg: 44px; --pad-x: 12px; }
[data-density="comfortable"] { --row-h: 44px; --row-h-lg: 52px; --pad-x: 14px; }

/* ============ BASE ============ */
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.tnum { font-variant-numeric: tabular-nums; }

/* ============ APP SHELL ============ */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 44px 1fr;
  height: 100vh;
  background: var(--bg);
}
[data-sidebar="narrow"] .app { grid-template-columns: 56px 1fr; }

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  position: relative;
  z-index: 20;
  min-width: 0;
}
.tb-switcher { flex-shrink: 0; }
.logo { flex-shrink: 0; }

.sidebar {
  border-right: 1px solid var(--hairline);
  background: var(--bg-2);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ===== WORKSPACE SWITCHER (top of sidebar) ===== */
.ws-switcher {
  border-bottom: 1px solid var(--hairline);
  padding: 8px;
  position: relative;
}
.ws-current {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.ws-current:hover { background: var(--surface-hover); }
.ws-mark {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--ws-accent, var(--brand-green));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12.5px;
  flex-shrink: 0;
  position: relative;
}
.ws-mark::after {
  content: "";
  position: absolute;
  right: -2px; bottom: -2px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand-green);
  border: 1.5px solid var(--surface);
}
.ws-info { flex: 1; min-width: 0; line-height: 1.2; }
.ws-name {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-sub {
  font-size: 10.5px;
  color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 1px;
}

.ws-menu {
  position: absolute;
  left: 8px; right: 8px;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.04);
  z-index: 30;
  padding: 4px;
  animation: cpIn .14s ease-out;
}
.ws-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  border-radius: 5px;
  color: var(--text);
}
.ws-item:hover { background: var(--surface-hover); }
.ws-item.active { background: var(--surface-2); }
.ws-item .ws-mark { width: 24px; height: 24px; font-size: 11px; }
.ws-item .ws-mark::after { display: none; }
.ws-item-name {
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.2;
}
.ws-item-desc {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.3;
  white-space: normal;
}
.ws-foot {
  padding: 6px 8px;
  margin-top: 4px;
  border-top: 1px solid var(--hairline);
  display: flex;
  gap: 4px;
}
.ws-foot button {
  flex: 1;
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: 5px;
  color: var(--text-2);
  font-weight: 500;
}
.ws-foot button:hover { background: var(--surface-hover); color: var(--text); }

[data-sidebar="narrow"] .ws-info,
[data-sidebar="narrow"] .ws-current .chev,
[data-sidebar="narrow"] .ws-current { padding: 6px; border: 0; }
[data-sidebar="narrow"] .ws-info { display: none; }
[data-sidebar="narrow"] .ws-switcher { padding: 8px 6px; }

/* Active item indicator inherits workspace accent in a subtle way */
.sb-item.active .icon { color: var(--ws-accent, var(--brand-green)); }
.sb-item.active .count { background: var(--ws-accent-soft, var(--brand-green-soft)); color: var(--ws-accent, var(--brand-green-strong)); }
.inbox-tab.active::after { background: var(--ws-accent, var(--brand-green)); }
.inbox-tab.active .badge { background: var(--ws-accent-soft, var(--brand-green-soft)); color: var(--ws-accent, var(--brand-green-strong)); }
.conv-row.selected { background: var(--ws-accent-soft, var(--brand-green-soft)); }
.conv-row.selected::before { background: var(--ws-accent, var(--brand-green)); }
.conv-row.unread .conv-dot { background: var(--ws-accent, var(--brand-green)); }

.main {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 300px;
  overflow: hidden;
  background: var(--surface);
  min-width: 0;
}
[data-context="hidden"] .main { grid-template-columns: 340px minmax(0, 1fr); }
.main.cc { grid-template-columns: 1fr; }

/* ============ LOGO ============ */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 13px;
  padding: 0 6px;
  height: 28px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}
.logo-word { color: var(--text); white-space: nowrap; }
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green-strong) 100%);
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  position: relative;
  letter-spacing: -0.04em;
}
.logo-mark::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 7px;
  height: 7px;
  background: var(--brand-red);
  border-radius: 2px;
  border: 1.5px solid var(--surface);
}
.logo-word { color: var(--text); }
.logo-word .ai { color: var(--brand-red); font-weight: 700; }
.logo-org {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  padding-left: 8px;
  margin-left: 6px;
  border-left: 1px solid var(--hairline-strong);
}

/* ============ TOPBAR ============ */
.tb-search {
  flex: 1;
  max-width: 560px;
  height: 28px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  color: var(--text-3);
  font-size: 12.5px;
  margin: 0 12px;
  transition: border-color .15s;
}
.tb-search:hover { border-color: var(--hairline-strong); }
.tb-search:focus-within { border-color: var(--brand-green); box-shadow: 0 0 0 3px var(--ring); }
.tb-search input {
  border: 0; background: transparent; outline: 0;
  color: var(--text); flex: 1; font-size: 12.5px;
}
.tb-search input::placeholder { color: var(--text-3); }
.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border: 1px solid var(--hairline);
  border-bottom-width: 1.5px;
  border-radius: 3px;
  color: var(--text-3);
  background: var(--surface);
}

.tb-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.tb-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  position: relative;
  transition: background .12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tb-btn:hover { background: var(--surface-hover); color: var(--text); }
.tb-btn.primary {
  background: var(--brand-green);
  color: #fff;
  border-color: var(--brand-green-strong);
}
.tb-btn.primary:hover { background: var(--brand-green-strong); }
.tb-btn .dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-red);
  border: 1.5px solid var(--surface);
}
.tb-divider { width: 1px; height: 18px; background: var(--hairline); margin: 0 6px; }

.tb-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  padding: 2px;
  height: 28px;
  margin-right: 4px;
}
.tb-switcher button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  padding: 0 10px;
  height: 22px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.tb-switcher button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 0 var(--hairline-strong), 0 1px 2px rgba(0,0,0,0.04);
}
[data-theme="dark"] .tb-switcher button.active { box-shadow: 0 0 0 1px var(--hairline-strong); }

.tb-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1B9E47, #DC2626);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
}

/* ============ SIDEBAR ============ */
.sb-section {
  padding: 10px 8px 4px;
}
.sb-section-title {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 8px 4px;
  font-weight: 600;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--text-2);
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  font-weight: 450;
  white-space: nowrap;
}
.sb-item:hover { background: var(--surface-hover); color: var(--text); }
.sb-item.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  box-shadow: inset 0 0 0 1px var(--hairline);
}
[data-theme="dark"] .sb-item.active { background: var(--surface-active); }
.sb-item .icon { color: var(--text-3); flex-shrink: 0; }
.sb-item.active .icon { color: var(--brand-green); }
.sb-item .count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
  min-width: 18px;
  text-align: center;
}
.sb-item.active .count { background: var(--brand-green-soft); color: var(--brand-green-strong); }
.sb-item .count.alert { background: var(--brand-red-soft); color: var(--brand-red); }

[data-sidebar="narrow"] .sb-item-text,
[data-sidebar="narrow"] .sb-section-title,
[data-sidebar="narrow"] .sb-item .count,
[data-sidebar="narrow"] .sb-team-name { display: none; }
[data-sidebar="narrow"] .sb-item { justify-content: center; padding: 0; }

.sb-divider { height: 1px; background: var(--hairline); margin: 6px 8px; }

.sb-foot {
  margin-top: auto;
  border-top: 1px solid var(--hairline);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sb-team {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
}
.sb-team:hover { background: var(--surface-hover); }
.sb-team-avatar {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--brand-green);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.sb-team-name { font-size: 12px; font-weight: 550; }
.sb-team-role { font-size: 10.5px; color: var(--text-3); }

/* ============ INBOX LIST ============ */
.inbox {
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
}
.inbox-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
}
.inbox-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.inbox-count {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.inbox-tabs {
  display: flex;
  gap: 0;
  padding: 0 8px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  overflow-x: auto;
}
.inbox-tab {
  border: 0;
  background: transparent;
  padding: 8px 8px;
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 500;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.inbox-tab:hover { color: var(--text-2); }
.inbox-tab.active {
  color: var(--text);
  font-weight: 600;
}
.inbox-tab.active::after {
  content: "";
  position: absolute;
  left: 6px; right: 6px;
  bottom: -1px;
  height: 2px;
  background: var(--brand-green);
  border-radius: 2px 2px 0 0;
}
.inbox-tab .badge {
  font-size: 10px;
  background: var(--surface-2);
  color: var(--text-3);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-mono);
}
.inbox-tab.active .badge { background: var(--brand-green-soft); color: var(--brand-green-strong); }
.inbox-tab .badge.alert { background: var(--brand-red-soft); color: var(--brand-red); }

.inbox-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--hairline);
  font-size: 11px;
  color: var(--text-3);
  overflow-x: auto;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
}
.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip.active { background: var(--brand-green-soft); color: var(--brand-green-strong); border-color: var(--brand-green-soft-2); }
.chip .x { color: var(--text-3); margin-left: 2px; }

.inbox-list {
  flex: 1;
  overflow-y: auto;
}
.conv-row {
  display: grid;
  grid-template-columns: 18px 28px 1fr auto;
  align-items: start;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  position: relative;
  background: var(--surface);
}
.conv-row:hover { background: var(--surface-hover); }
.conv-row.selected { background: var(--brand-green-soft); }
.conv-row.selected::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--brand-green);
}
.conv-row.unread .conv-from { font-weight: 650; color: var(--text); }
.conv-row.unread .conv-snippet { color: var(--text); }
.conv-row.unread .conv-dot { background: var(--brand-green); }

.conv-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: transparent;
  margin-top: 8px;
  justify-self: center;
}
.conv-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: var(--text-2);
  position: relative;
  flex-shrink: 0;
  margin-top: 2px;
}
.conv-channel {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 8px;
  color: #fff;
}
.conv-channel.whatsapp { background: var(--ch-whatsapp); }
.conv-channel.glpi { background: var(--ch-glpi); }
.conv-channel.email { background: var(--ch-email); }
.conv-channel.crm { background: var(--ch-crm); }

.conv-row.selected .conv-channel { border-color: var(--brand-green-soft); }

.conv-body { min-width: 0; }
.conv-top {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 2px;
}
.conv-from {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1;
}
.conv-time {
  font-size: 10.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}
.conv-subject {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 1px;
}
.conv-snippet {
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-meta {
  display: flex; align-items: center; gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.conv-side {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
}

/* ============ TAG / PILL / SLA ============ */
.pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px;
  font-weight: 500;
  height: 16px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text-2);
  letter-spacing: 0.01em;
  border: 1px solid var(--hairline);
  white-space: nowrap;
}
.pill.green { background: var(--brand-green-soft); color: var(--brand-green-strong); border-color: transparent; }
.pill.red { background: var(--brand-red-soft); color: var(--brand-red); border-color: transparent; }
.pill.amber { background: var(--brand-amber-soft); color: var(--brand-amber); border-color: transparent; }
.pill.blue { background: var(--brand-blue-soft); color: var(--brand-blue); border-color: transparent; }
.pill.purple { background: var(--brand-purple-soft); color: var(--brand-purple); border-color: transparent; }
.pill .pdot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.sla {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}
.sla.ok { color: var(--brand-green-strong); }
.sla.warn { color: var(--brand-amber); }
.sla.breach { color: var(--brand-red); font-weight: 600; }
.sla-bar {
  width: 36px; height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.sla-bar > i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: currentColor;
}

/* ============ CONVERSATION PANE ============ */
.conv {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.conv-head {
  padding: 8px 14px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.conv-head-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  position: relative;
}
.conv-head-info { flex: 1; min-width: 0; }
.conv-head-name {
  font-size: 13.5px;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.conv-head-meta {
  font-size: 11px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
  margin-top: 1px;
}
.conv-head-meta .sep { color: var(--text-4); }
.conv-head-actions { display: flex; align-items: center; gap: 2px; }

.conv-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
}
.thread-day {
  align-self: center;
  font-size: 10.5px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--hairline);
  padding: 2px 8px;
  border-radius: 10px;
  margin: 8px 0;
  font-family: var(--font-mono);
}
.msg {
  display: flex;
  flex-direction: column;
  max-width: 70%;
  gap: 2px;
}
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg.note { align-self: stretch; max-width: 100%; }

.bubble {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.in .bubble {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-bottom-left-radius: 3px;
  color: var(--text);
}
.msg.out .bubble {
  background: var(--brand-green);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.msg.note .bubble {
  background: var(--brand-amber-soft);
  border: 1px dashed var(--brand-amber);
  color: var(--brand-amber);
  font-style: italic;
  font-size: 12px;
}
[data-theme="dark"] .msg.note .bubble { color: #FBBF24; }

.msg-foot {
  font-size: 10px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
}
.msg.out .msg-foot { color: var(--text-3); }

.msg-author {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-2);
}

/* Composer */
.composer {
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  padding: 8px 12px 10px;
}
.composer-tabs {
  display: flex; gap: 2px;
  margin-bottom: 6px;
}
.composer-tab {
  border: 0;
  background: transparent;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-3);
  border-radius: 4px;
  font-weight: 500;
}
.composer-tab.active { background: var(--surface-2); color: var(--text); }
.composer-tab.note.active { background: var(--brand-amber-soft); color: var(--brand-amber); }

.composer-box {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transition: border-color .15s;
}
.composer-box:focus-within {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px var(--ring);
}
.composer-box.note-mode { border-color: var(--brand-amber); background: var(--brand-amber-soft); }
.composer-textarea {
  border: 0; outline: 0;
  background: transparent;
  resize: none;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  padding: 9px 12px;
  min-height: 64px;
  max-height: 200px;
  line-height: 1.45;
}
.composer-textarea::placeholder { color: var(--text-3); }
.composer-bar {
  display: flex; align-items: center; gap: 2px;
  padding: 4px 6px 5px;
  border-top: 1px solid var(--hairline);
}
.composer-box.note-mode .composer-bar { border-top-color: rgba(217,119,6,0.2); }
.icon-btn {
  width: 26px; height: 26px;
  border: 0;
  background: transparent;
  border-radius: 5px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.composer-send {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px;
  padding: 0 10px;
  background: var(--brand-green);
  color: #fff;
  border: 0;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 550;
}
.composer-send:hover { background: var(--brand-green-strong); }
.composer-send.disabled { background: var(--surface-2); color: var(--text-3); pointer-events: none; }

.composer-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* ============ CONTEXT PANEL (right) ============ */
.context {
  border-left: 1px solid var(--hairline);
  background: var(--bg-2);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.ctx-section {
  border-bottom: 1px solid var(--hairline);
}
.ctx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 6px;
}
.ctx-head h4 {
  margin: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}
.ctx-head .ctx-actions { display: flex; gap: 2px; }
.ctx-body { padding: 0 12px 10px; }

.ctx-customer {
  padding: 12px 12px 10px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.ctx-avatar-lg {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-green);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.ctx-customer-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
}
.ctx-customer-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.ctx-customer-tags {
  display: flex; gap: 4px; margin-top: 4px;
  flex-wrap: wrap;
}

.kv {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 4px 8px;
  font-size: 11.5px;
  padding: 2px 0;
}
.kv .k { color: var(--text-3); }
.kv .v { color: var(--text); font-weight: 500; }
.kv .v.mono { font-family: var(--font-mono); font-size: 11px; }

.list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--hairline);
  font-size: 11.5px;
}
.list-row:first-child { border-top: 0; }
.list-row .lr-id {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  flex-shrink: 0;
  min-width: 56px;
}
.list-row .lr-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .lr-meta { color: var(--text-3); font-size: 10.5px; font-family: var(--font-mono); }
.list-row .lr-status { width: 6px; height: 6px; border-radius: 50%; }
.list-row .lr-status.green { background: var(--brand-green); }
.list-row .lr-status.red { background: var(--brand-red); }
.list-row .lr-status.amber { background: var(--brand-amber); }
.list-row .lr-status.gray { background: var(--text-4); }

.ai-hint {
  margin: 0 12px 10px;
  padding: 8px 10px 8px 26px;
  background: linear-gradient(180deg, var(--brand-green-soft) 0%, transparent 100%);
  border: 1px solid var(--brand-green-soft-2);
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text);
  position: relative;
  line-height: 1.45;
}
.ai-hint::before {
  content: "";
  position: absolute;
  left: 8px; top: 10px;
  width: 10px; height: 10px;
  background: radial-gradient(circle, var(--brand-green) 30%, transparent 32%),
              conic-gradient(from 0deg, var(--brand-green), var(--brand-red), var(--brand-green));
  -webkit-mask: radial-gradient(circle, transparent 30%, #000 32%);
          mask: radial-gradient(circle, transparent 30%, #000 32%);
  border-radius: 50%;
  animation: aiSpin 6s linear infinite;
}
@keyframes aiSpin { to { transform: rotate(360deg); } }
.ai-hint b { font-weight: 600; }
[data-theme="dark"] .ai-hint { background: linear-gradient(180deg, rgba(27,158,71,0.12) 0%, transparent 100%); }

/* ============ COMMAND CENTER ============ */
.cc-wrap {
  padding: 16px 20px 24px;
  overflow-y: auto;
}
.cc-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 16px;
}
.cc-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
.cc-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}
.cc-range {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 2px;
  font-size: 11.5px;
}
.cc-range button {
  border: 0; background: transparent;
  padding: 3px 10px; border-radius: 4px;
  color: var(--text-3); font-weight: 500;
}
.cc-range button.active {
  background: var(--surface); color: var(--text);
  box-shadow: 0 0 0 1px var(--hairline-strong);
}

.cc-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.cc-kpi {
  padding: 12px 14px;
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.cc-kpi:last-child { border-right: 0; }
.cc-kpi .label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 600;
}
.cc-kpi .value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.cc-kpi .delta {
  font-size: 11px;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.cc-kpi .delta.up { color: var(--brand-green-strong); }
.cc-kpi .delta.down { color: var(--brand-red); }
.cc-kpi .spark {
  position: absolute;
  right: 12px; top: 12px;
  width: 64px; height: 24px;
  color: var(--text-4);
}

.cc-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.cc-panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
}
.cc-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}
.cc-panel-title {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 6px;
}
.cc-panel-sub {
  font-size: 10.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.cc-panel-body { padding: 12px; }

/* Queue list */
.queue-row {
  display: grid;
  grid-template-columns: 14px 1fr 60px 70px 80px 60px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.queue-row:last-child { border-bottom: 0; }
.queue-row:hover { background: var(--surface-hover); }
.queue-row .ch {
  width: 12px; height: 12px;
  border-radius: 3px;
}
.queue-row .name { font-weight: 550; }
.queue-row .agents {
  display: flex; align-items: center;
}
.queue-row .agents .a {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand-green);
  color: #fff;
  font-size: 9px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: -4px;
  border: 1.5px solid var(--surface);
}
.queue-row .agents .a:first-child { margin-left: 0; }

/* Stacked bar for SLA */
.sla-stack {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-2);
}
.sla-stack > i { height: 100%; }
.sla-stack .ok { background: var(--brand-green); }
.sla-stack .warn { background: var(--brand-amber); }
.sla-stack .breach { background: var(--brand-red); }

/* Heatmap */
.heatmap {
  display: grid;
  grid-template-columns: 32px repeat(24, 1fr);
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-3);
}
.heatmap .h-cell {
  height: 16px;
  border-radius: 2px;
  background: var(--surface-2);
}
.heatmap .h-axis { display: flex; align-items: center; }

/* Agent rank */
.agent-row {
  display: grid;
  grid-template-columns: 22px 1fr 50px 50px 50px;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 11.5px;
}
.agent-row:last-child { border-bottom: 0; }
.agent-row .a-av {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brand-green);
  color: #fff;
  font-size: 9.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.agent-row .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 11.5px;
}

/* AI insights */
.ai-card {
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 10px 10px 10px 30px;
  font-size: 11.5px;
  line-height: 1.45;
  background: var(--surface);
  position: relative;
  margin-bottom: 6px;
}
.ai-card::before {
  content: "";
  position: absolute;
  left: 10px; top: 11px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--brand-green), var(--brand-red), var(--brand-green));
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 40%);
          mask: radial-gradient(circle, transparent 38%, #000 40%);
}
.ai-card-title {
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 1px;
  display: flex; align-items: center; gap: 6px;
}
.ai-card-body { color: var(--text-2); }
.ai-card-actions {
  display: flex; gap: 4px; margin-top: 6px;
}
.ai-card-actions button {
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10.5px;
  color: var(--text-2);
  font-weight: 500;
}
.ai-card-actions button.primary {
  background: var(--brand-green);
  color: #fff;
  border-color: var(--brand-green-strong);
}
.ai-card-actions button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ============ COPILOT (floating drawer) ============ */
.copilot-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  z-index: 50;
  color: var(--text-2);
}
.copilot-toggle::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--brand-green), var(--brand-red), var(--brand-green));
  z-index: -1;
  opacity: 0.6;
  animation: aiSpin 6s linear infinite;
}
.copilot-toggle.open { background: var(--brand-green); color: #fff; }

.copilot {
  position: fixed;
  right: 12px; top: 56px; bottom: 12px;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.04);
  display: flex; flex-direction: column;
  z-index: 49;
  overflow: hidden;
  animation: cpIn .18s ease-out;
}
@keyframes cpIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.cp-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}
.cp-head .title { font-size: 13px; font-weight: 600; }
.cp-head .sub { font-size: 10.5px; color: var(--text-3); }
.cp-orb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--brand-green), var(--brand-red), var(--brand-green));
  -webkit-mask: radial-gradient(circle, transparent 35%, #000 37%);
          mask: radial-gradient(circle, transparent 35%, #000 37%);
  animation: aiSpin 6s linear infinite;
}
.cp-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cp-bubble {
  font-size: 12.5px;
  line-height: 1.5;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  padding: 9px 11px;
  border-radius: 8px;
}
.cp-bubble.user {
  align-self: flex-end;
  background: var(--brand-green);
  color: #fff;
  border-color: transparent;
  max-width: 80%;
}
.cp-bubble strong { font-weight: 600; }
.cp-suggest {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.cp-chip {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: 4px;
  color: var(--text-2);
}
.cp-chip:hover { background: var(--surface-hover); }
.cp-foot {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--hairline);
}
.cp-input {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  outline: 0;
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
}
.cp-input:focus { border-color: var(--brand-green); background: var(--surface); }

/* ============ MISC ============ */
hr.line { border: 0; height: 1px; background: var(--hairline); margin: 8px 0; }

.empty {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 4px;
  color: var(--text-3);
  font-size: 12.5px;
  padding: 24px;
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 4px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* Persona views toggle small chrome differences */
[data-persona="manager"] .badge-persona { background: var(--brand-blue-soft); color: var(--brand-blue); }
[data-persona="director"] .badge-persona { background: var(--brand-purple-soft); color: var(--brand-purple); }


/* ============ RESPONSIVE OVERRIDES (must win over earlier .context rule) ============ */
/* Old rules — kept disabled; consolidated responsive layer at bottom of file */
@media (max-width: 1280px) {
  .main { grid-template-columns: 320px minmax(0, 1fr) 280px; }
}


/* ============ CONTEXT PANEL · Quick actions + collapsible sections ============ */
.ctx-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--hairline);
}
.qa-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: 5px;
  font-size: 11px;
  color: var(--text);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.qa-btn:hover {
  background: var(--surface-hover);
  border-color: var(--hairline-strong);
}
.qa-btn.primary {
  background: var(--ws-accent, var(--brand-green));
  color: #fff;
  border-color: transparent;
  grid-column: 1 / -1;
  justify-content: center;
}
.qa-btn.primary:hover {
  filter: brightness(.95);
}
.qa-btn svg { flex-shrink: 0; color: var(--ws-accent, var(--brand-green)); }
.qa-btn.primary svg { color: #fff; }

.ctx-section.closed .ctx-head {
  padding-bottom: 8px;
}
.ctx-section.closed .ctx-head:hover {
  background: var(--surface-hover);
}
.ctx-section.open .ctx-head:hover h4 {
  color: var(--text);
}


/* ============ LAYOUTS · email-client style ============ */

/* Toggle pinned in inbox header */
.layout-toggle {
  display: inline-flex;
  gap: 1px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 1px;
  margin-right: 4px;
}
.layout-toggle button {
  width: 22px; height: 20px;
  border: 0; background: transparent;
  border-radius: 3px;
  color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.layout-toggle button:hover { color: var(--text); }
.layout-toggle button.active {
  background: var(--surface);
  color: var(--ws-accent, var(--brand-green));
  box-shadow: 0 0 0 1px var(--hairline-strong);
}

/* === SIDE LAYOUT (default) — already styled via .main grid === */

/* === HORIZONTAL LAYOUT === */
.main[data-layout="horizontal"] {
  grid-template-columns: minmax(0, 1fr) 320px !important;
  grid-template-rows: minmax(220px, 38%) minmax(0, 1fr);
}
.main[data-layout="horizontal"] .inbox {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  border-right: 0;
  border-bottom: 1px solid var(--hairline);
}
.main[data-layout="horizontal"] .conv {
  grid-column: 1 / 2;
  grid-row: 2 / 3;
}
.main[data-layout="horizontal"] .context {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
}

/* Horizontal: inbox rows go wider, more compact */
.main[data-layout="horizontal"] .conv-row {
  grid-template-columns: 14px 24px 1.4fr 2fr auto 80px;
  align-items: center;
  padding: 6px 12px 6px 8px;
}
.main[data-layout="horizontal"] .conv-row .conv-avatar { width: 24px; height: 24px; font-size: 10px; margin-top: 0; }
.main[data-layout="horizontal"] .conv-body { display: contents; }
.main[data-layout="horizontal"] .conv-top {
  margin-bottom: 0;
  overflow: hidden;
}
.main[data-layout="horizontal"] .conv-top .conv-from { font-size: 12px; }
.main[data-layout="horizontal"] .conv-top .conv-time { display: none; }
.main[data-layout="horizontal"] .conv-subject {
  font-size: 12px; margin-bottom: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.main[data-layout="horizontal"] .conv-snippet {
  display: none;
}
.main[data-layout="horizontal"] .conv-meta {
  margin-top: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}
.main[data-layout="horizontal"] .conv-meta .pill,
.main[data-layout="horizontal"] .conv-meta .sla {
  flex-shrink: 0;
}
.main[data-layout="horizontal"] .conv-row .conv-side {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
.main[data-layout="horizontal"] .conv-row .conv-side::after {
  content: attr(data-time);
}

/* On horizontal, context hide breakpoint also */
@media (max-width: 1180px) {
  .main[data-layout="horizontal"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .main[data-layout="horizontal"] .context { display: none !important; }
  .main[data-layout="horizontal"] .conv { grid-column: 1 / 2; }
  .main[data-layout="horizontal"] .inbox { grid-column: 1 / 2; }
}

/* === FOCUS LAYOUT === */
.main[data-layout="focus"] {
  grid-template-columns: 0 minmax(0, 1fr) 0 !important;
}
.main[data-layout="focus"] .inbox,
.main[data-layout="focus"] .context {
  display: none !important;
}
.main[data-layout="focus"] .conv {
  border-left: 0;
}

/* Focus: floating "back to list" button — positioned in the top-left of main */
.focus-back {
  position: absolute;
  top: 8px;
  left: 12px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  color: var(--text-2);
  cursor: pointer;
}
.focus-back:hover { background: var(--surface-hover); color: var(--text); }

/* ============ CONV HEAD · robust wrapping ============ */
.conv-head {
  flex-wrap: wrap;
  row-gap: 4px;
}
.conv-head-info { min-width: 200px; }
.conv-head-name { flex-wrap: wrap; row-gap: 2px; }
.conv-head-meta { flex-wrap: wrap; row-gap: 2px; }
.conv-head-actions { flex-shrink: 0; margin-left: auto; }


/* ============ FIX · column overflow + responsive inbox tabs ============ */

/* Force every column to respect its allocated grid track. */
.inbox, .conv, .context { min-width: 0; }
.conv { overflow: hidden; }
.conv-head-info { min-width: 0; flex: 1 1 auto; }
.conv-head-info .conv-head-name,
.conv-head-info .conv-head-meta {
  flex-wrap: wrap;
  min-width: 0;
}
.conv-head-meta {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Inbox tabs/filters: hide native scrollbar, fade right edge to indicate more content. */
.inbox-tabs,
.inbox-filters {
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
}
.inbox-tabs::-webkit-scrollbar,
.inbox-filters::-webkit-scrollbar { display: none; }

.inbox-tabs {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
}
.inbox-filters {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
}

/* Inbox head wraps cleanly at narrow widths */
.inbox-head {
  flex-wrap: wrap;
  row-gap: 4px;
}
.inbox-head .inbox-title { flex-shrink: 0; }

/* Compact inbox at narrow viewports — keep content readable */
@media (max-width: 1100px) {
  .app .main[data-layout="side"], .app .main:not([data-layout]) { grid-template-columns: 280px minmax(0, 1fr) !important; }
  .inbox-tab { padding: 8px 6px; font-size: 11px; }
  .inbox-filters .chip { font-size: 10.5px; padding: 0 6px; }
  .conv-row { padding: 7px 10px 7px 6px; gap: 6px; }
}
@media (max-width: 900px) {
  .app .main[data-layout="side"], .app .main:not([data-layout]) { grid-template-columns: 260px minmax(0, 1fr) !important; }
}

/* Conv head actions wrap to the next visual line if needed, never push width */
.conv-head-actions {
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 2px;
}

/* The SLA badge in conv head: allow wrap and shrink */
.conv-head-actions .sla { white-space: nowrap; }


/* ============ CONV HEAD · single-line, aligned with inbox-head height ============ */

.conv-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  min-height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: nowrap !important;
  background: var(--surface);
}
.conv-head .conv-head-avatar {
  width: 26px; height: 26px; font-size: 11px;
  flex-shrink: 0;
}
.conv-head .conv-head-info {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.conv-head .conv-head-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.conv-head-channel {
  flex-shrink: 0;
}
.conv-head-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap !important;
}

/* Sub-header — single bar carrying meta info + quick actions.
   Height matches combined inbox-tabs (~38px) + inbox-filters (~34px) so the
   conversation thread starts at the same vertical position as the list. */
.conv-subhead {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 72px;
  min-height: 72px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  flex-wrap: wrap;
  row-gap: 4px;
}
.conv-subhead-id {
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10.5px;
}
.conv-subhead-sep {
  color: var(--text-4);
}
.conv-subhead .chip {
  height: 22px;
  font-size: 11px;
}

/* For horizontal layout, subhead is single thin row */
.main[data-layout="horizontal"] .conv-subhead {
  height: 32px;
  min-height: 32px;
  flex-wrap: nowrap;
  overflow: hidden;
}

/* Make inbox header bands consistent heights for alignment */
.inbox-head { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
.inbox-tabs { min-height: 38px; }
.inbox-filters { min-height: 34px; }


/* ============ INBOX HEAD · strict 44px alignment ============ */

.inbox-head {
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  flex-wrap: nowrap !important;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}
.inbox-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}
.inbox-count {
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}

/* Tabs row with layout toggle pinned right */
.inbox-tabs-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  overflow: hidden;
}
.inbox-tabs-row .inbox-tabs {
  flex: 1;
  min-width: 0;
  height: 100%;
  border-bottom: 0;
  display: flex;
  align-items: stretch;
}
.inbox-tabs-row .layout-toggle {
  flex-shrink: 0;
  margin: 0 8px 0 4px;
}

/* When very narrow, hide the count text in inbox-head */
@media (max-width: 900px) {
  .inbox-count { display: none; }
}

/* Conv-head: prevent inline child clipping by ensuring no overflow:hidden on the
   flex parent of inline children — clip only on the text container. */
.conv-head-info { overflow: visible; }
.conv-head-name {
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  padding: 4px 0;
}


/* ============ CONV HEAD · final fix · prevent inline children wrapping ============ */
.conv-head .conv-head-name {
  flex-wrap: nowrap !important;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  height: 100%;
  padding: 0;
  min-width: 0;
}
.conv-head .conv-head-name > * {
  flex-shrink: 0;
}
.conv-head .conv-head-name > :first-child {
  /* the name text itself can shrink and ellipsize */
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 60px;
}
/* Hide channel pill in narrow columns — channel still shown in subhead row */
@media (max-width: 1100px) {
  .conv-head-channel { display: none; }
}
/* Hide secondary badges below very narrow */
@media (max-width: 900px) {
  .conv-head .conv-head-name .pill:nth-of-type(n+2) { display: none; }
}


/* ============ INBOX FILTERS · visible without fade mask ============ */
.inbox-filters {
  -webkit-mask-image: none !important;
          mask-image: none !important;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  white-space: nowrap;
}
.inbox-filters::-webkit-scrollbar { display: none; }
.inbox-filters .chip {
  flex-shrink: 0;
  height: 22px;
  font-size: 10.5px;
  padding: 0 6px;
}
.inbox-filters > svg:first-child { flex-shrink: 0; color: var(--text-3); }

/* Keep tabs fade mask only (less critical, more items) */
.inbox-tabs {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent);
}


/* ============ HORIZONTAL LAYOUT · clear separator between list and conversation ============ */

.main[data-layout="horizontal"] .conv {
  border-top: 2px solid var(--ws-accent, var(--brand-green));
  position: relative;
}
.main[data-layout="horizontal"] .conv::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(180deg, rgba(0,0,0,0.04) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}
[data-theme="dark"] .main[data-layout="horizontal"] .conv::before {
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, transparent 100%);
}

/* In horizontal, merge head + subhead into a single compact bar (~52px) */
.main[data-layout="horizontal"] .conv-head {
  height: 52px;
  min-height: 52px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline);
  padding: 0 16px;
  position: relative;
  z-index: 2;
}
.main[data-layout="horizontal"] .conv-head-avatar {
  width: 30px; height: 30px;
  font-size: 12px;
}
.main[data-layout="horizontal"] .conv-subhead {
  height: 28px;
  min-height: 28px;
  padding: 0 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline-strong);
  font-size: 10.5px;
  position: relative;
  z-index: 2;
}
.main[data-layout="horizontal"] .conv-subhead .chip {
  height: 20px;
  font-size: 10px;
}

/* Show channel pill in horizontal head since we have more space */
.main[data-layout="horizontal"] .conv-head-channel {
  display: inline-flex !important;
}

/* Thread in horizontal: more padding from top for breathing room */
.main[data-layout="horizontal"] .conv-thread {
  padding-top: 18px;
}

/* Also: visual divider hint above the conv-head in horizontal mode for the inbox above */
.main[data-layout="horizontal"] .inbox {
  border-bottom: 0; /* the conv top border handles the separation */
  box-shadow: 0 4px 8px -4px rgba(0,0,0,0.06);
}
[data-theme="dark"] .main[data-layout="horizontal"] .inbox {
  box-shadow: 0 4px 8px -4px rgba(0,0,0,0.5);
}


/* ============ HORIZONTAL LAYOUT · ensure stack, not side-by-side ============ */
.app .main[data-layout="horizontal"] {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(220px, 38%) minmax(0, 1fr) !important;
}
.app .main[data-layout="horizontal"] .inbox {
  grid-column: 1 / 2 !important;
  grid-row: 1 / 2 !important;
}
.app .main[data-layout="horizontal"] .conv {
  grid-column: 1 / 2 !important;
  grid-row: 2 / 3 !important;
}
.app .main[data-layout="horizontal"] .context {
  display: none !important;
}

/* Focus layout: single conv pane */
.app .main[data-layout="focus"] {
  grid-template-columns: minmax(0, 1fr) !important;
}
.app .main[data-layout="focus"] .inbox,
.app .main[data-layout="focus"] .context {
  display: none !important;
}
.app .main[data-layout="focus"] .conv {
  grid-column: 1 / 2 !important;
}


/* ============ FIX · workspace switcher overflow + sidebar elevation ============ */

/* Stack name + sub vertically, not inline */
.ws-info {
  display: flex !important;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.ws-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ws-sub {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Sidebar visually sits ABOVE main content (elevated) */
.sidebar {
  z-index: 5;
  position: relative;
  box-shadow: 1px 0 0 var(--hairline), 4px 0 12px -8px rgba(0,0,0,0.08);
  background: var(--bg-2);
}
[data-theme="dark"] .sidebar {
  box-shadow: 1px 0 0 var(--hairline-strong), 4px 0 14px -8px rgba(0,0,0,0.5);
}

/* The inbox sits below sidebar visually (no left border needed) */
.inbox {
  border-left: 0;
}

/* Slight separation between workspace switcher and the nav sections */
.ws-switcher {
  background: var(--bg-2);
}

/* Active sidebar item: clearer affordance that this is "above" — use surface + accent */
.sb-item.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  box-shadow:
    inset 0 0 0 1px var(--hairline),
    0 1px 2px rgba(0,0,0,0.04);
}
[data-theme="dark"] .sb-item.active {
  box-shadow:
    inset 0 0 0 1px var(--hairline-strong),
    0 1px 2px rgba(0,0,0,0.3);
}


/* ============ TOPBAR BREADCRUMB · replaces view switcher ============ */
.tb-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 0 4px;
  height: 28px;
  font-size: 12.5px;
  flex-shrink: 0;
  border-radius: 6px;
}
.tb-crumb {
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
}
.tb-crumb.active {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.005em;
}
.tb-crumb-sep {
  color: var(--text-4);
  font-size: 12px;
  user-select: none;
}

@media (max-width: 900px) {
  .tb-breadcrumb .tb-crumb:not(.active) { display: none; }
  .tb-breadcrumb .tb-crumb-sep { display: none; }
}

/* Old tb-switcher styles can stay in CSS but are unused — keeping for compat */


/* ============ TOPBAR · align breadcrumb with main content start ============ */
.topbar {
  padding-left: 0;
  padding-right: 12px;
}
.logo {
  width: 220px;
  min-width: 220px;
  padding: 0 12px;
  height: 100%;
  border-right: 1px solid var(--hairline);
  box-sizing: border-box;
}
[data-sidebar="narrow"] .logo {
  width: 56px;
  min-width: 56px;
  padding: 0;
  justify-content: center;
}
[data-sidebar="narrow"] .logo .logo-word,
[data-sidebar="narrow"] .logo .logo-org { display: none; }
.tb-breadcrumb {
  padding-left: 14px;
}
@media (max-width: 900px) {
  .logo { width: 56px; min-width: 56px; padding: 0; justify-content: center; }
  .logo .logo-word, .logo .logo-org { display: none; }
}


/* ============ SETTINGS · UI ============ */
.settings {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

/* Sub-sidebar */
.settings-nav {
  border-right: 1px solid var(--hairline);
  background: var(--bg-2);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.settings-nav-head {
  display: flex;
  flex-direction: column;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--hairline);
}
.settings-nav-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin: 8px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--text-3);
}
.settings-nav-search input {
  border: 0; outline: 0; background: transparent;
  font-size: 12px; color: var(--text);
  flex: 1; min-width: 0;
}
.settings-nav-search input::placeholder { color: var(--text-3); }

.set-section { padding: 6px 8px 4px; }
.set-section-title {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 8px 4px;
  font-weight: 600;
}
.set-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  border-radius: 5px;
  text-align: left;
  color: var(--text-2);
  cursor: pointer;
}
.set-item:hover { background: var(--surface-hover); color: var(--text); }
.set-item.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.set-item-icon { color: var(--text-3); margin-top: 2px; flex-shrink: 0; }
.set-item.active .set-item-icon { color: var(--ws-accent, var(--brand-green)); }
.set-item-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.set-item-label { font-size: 12.5px; font-weight: 550; line-height: 1.2; }
.set-item-desc {
  font-size: 10.5px; color: var(--text-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Main settings body */
.settings-body { overflow-y: auto; background: var(--bg); }
.set-page { padding: 18px 24px 32px; max-width: 1100px; }
.set-page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.set-page-title { font-size: 19px; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.set-page-sub  { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.set-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  border-radius: 5px;
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap;
}
.set-btn:hover { background: var(--surface-hover); }
.set-btn.primary {
  background: var(--ws-accent, var(--brand-green));
  color: #fff; border-color: transparent;
}
.set-btn.primary:hover { filter: brightness(.95); }
.set-btn.danger { color: var(--brand-red); border-color: var(--hairline); }
.set-btn.danger:hover { background: var(--brand-red-soft); border-color: var(--brand-red); }

.set-filter-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.set-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: 5px;
  font-size: 11.5px; color: var(--text-2); font-weight: 500;
  cursor: pointer;
}
.set-chip:hover { background: var(--surface-hover); color: var(--text); }
.set-chip.active {
  background: var(--ws-accent-soft, var(--brand-green-soft));
  color: var(--ws-accent, var(--brand-green-strong));
  border-color: transparent;
}
.set-chip-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--surface-2);
  color: var(--text-3);
  padding: 0 5px;
  border-radius: 3px;
}
.set-chip.active .set-chip-count { background: rgba(255,255,255,.5); color: inherit; }
.set-chip-count.alert { background: var(--brand-red-soft); color: var(--brand-red); }

.set-group { margin-bottom: 18px; }
.set-group-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; color: var(--text-3); margin-bottom: 6px;
}
.set-list {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

/* Connector row */
.connector-row {
  display: grid;
  grid-template-columns: 36px 1.4fr 1.6fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}
.connector-row:last-child { border-bottom: 0; }
.connector-row:hover { background: var(--surface-hover); }
.connector-logo {
  width: 32px; height: 32px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.connector-logo.lg { width: 44px; height: 44px; border-radius: 9px; font-size: 18px; }
.connector-main { min-width: 0; }
.connector-name-row { display: flex; align-items: center; gap: 6px; }
.connector-name { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.connector-sub {
  font-size: 11px; color: var(--text-3); margin-top: 1px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.connector-sub .sep { color: var(--text-4); }
.connector-meta {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0; font-size: 11px;
}
.connector-accounts { display: flex; flex-direction: column; gap: 2px; }
.connector-account { display: flex; align-items: center; gap: 4px; }
.acc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-4); flex-shrink: 0;
}
.acc-dot.ok { background: var(--brand-green); }
.acc-dot.warn { background: var(--brand-amber); }
.acc-dot.error { background: var(--brand-red); }
.connector-stats { display: flex; gap: 16px; margin-top: 4px; }
.conn-stat { display: flex; flex-direction: column; }
.conn-stat-label {
  font-size: 9.5px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 600;
}
.conn-stat-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.conn-stat-value.mono { font-family: var(--font-mono); }

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

.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 500;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
.status-pill .pdot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.connected { background: var(--brand-green-soft); color: var(--brand-green-strong); }
.status-pill.ok        { background: var(--brand-green-soft); color: var(--brand-green-strong); }
.status-pill.warn      { background: var(--brand-amber-soft); color: var(--brand-amber); }
.status-pill.error     { background: var(--brand-red-soft);   color: var(--brand-red); }
.status-pill.available { background: var(--surface-2);        color: var(--text-3); }

/* Connector detail */
.set-back { margin-bottom: 8px; }
.set-back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: transparent;
  font-size: 11.5px; color: var(--text-3); font-weight: 500;
  padding: 4px 6px; border-radius: 4px;
  cursor: pointer;
}
.set-back-btn:hover { background: var(--surface-hover); color: var(--text); }

.connector-detail-head {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.conn-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 14px;
}
.conn-tab {
  border: 0; background: transparent;
  padding: 8px 12px;
  font-size: 12px; font-weight: 500; color: var(--text-3);
  position: relative; cursor: pointer;
}
.conn-tab:hover { color: var(--text); }
.conn-tab.active { color: var(--text); font-weight: 600; }
.conn-tab.active::after {
  content: ""; position: absolute;
  left: 8px; right: 8px; bottom: -1px;
  height: 2px; background: var(--ws-accent, var(--brand-green));
  border-radius: 2px 2px 0 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.detail-section {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 14px 16px;
}
.detail-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600; color: var(--text-3);
  margin: 0 0 10px;
}
.detail-callout {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 11px;
}
.detail-callout.ok { background: var(--brand-green-soft); color: var(--brand-green-strong); }

.kv-detail {
  display: grid; grid-template-columns: 132px 1fr;
  gap: 8px; padding: 5px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.kv-detail:last-of-type { border-bottom: 0; }
.kv-label { color: var(--text-3); font-size: 11.5px; }
.kv-value { color: var(--text); font-weight: 500; min-width: 0; word-break: break-word; }
.kv-value.mono { font-family: var(--font-mono); font-size: 11px; }

.kv-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 0; border-bottom: 1px solid var(--hairline);
  font-size: 11.5px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-row-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.perm-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.perm-row:last-child { border-bottom: 0; }

.toggle {
  display: inline-block;
  width: 28px; height: 16px;
  border-radius: 8px;
  background: var(--surface-2);
  position: relative;
  transition: background .15s;
  border: 1px solid var(--hairline-strong);
  flex-shrink: 0;
}
.toggle.on { background: var(--ws-accent, var(--brand-green)); border-color: transparent; }
.toggle-knob {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  top: 1px; left: 1px;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.toggle.on .toggle-knob { transform: translateX(12px); }

/* Event/api/wh tables */
.event-table { border-top: 1px solid var(--hairline); }
.event-row {
  display: grid;
  grid-template-columns: 36px 1.4fr auto auto;
  gap: 12px; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.event-row.head {
  font-size: 9.5px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600; padding: 6px 0;
}

.map-row {
  display: grid;
  grid-template-columns: 1.4fr 16px 1.4fr 80px;
  gap: 12px; align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--hairline);
}
.map-row.head {
  font-size: 9.5px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600; padding: 4px 0;
}

.logs-pane {
  background: #0F1419;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  max-height: 320px;
  overflow-y: auto;
  color: #B6B9BD;
}
[data-theme="dark"] .logs-pane { background: #050608; }
.log-line { display: flex; gap: 8px; }
.log-time { color: #6C7079; flex-shrink: 0; }
.log-level { width: 50px; flex-shrink: 0; font-weight: 600; }
.log-level.info  { color: #4FB6FF; }
.log-level.warn  { color: #FBBF24; }
.log-level.error { color: #F87171; }
.log-msg { color: #D4D7DB; }
.log-line.error .log-msg { color: #FCA5A5; }

/* api/wh/event rows */
.api-row {
  display: grid;
  grid-template-columns: 1.6fr 1.6fr 90px 1.4fr 90px 84px;
  gap: 12px; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.api-row.head, .wh-row.head, .ev-row.head {
  font-size: 9.5px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600;
  background: var(--bg-2);
}

.wh-row {
  display: grid;
  grid-template-columns: 2fr 1.4fr 84px 70px 130px 80px;
  gap: 12px; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}

.ev-row {
  display: grid;
  grid-template-columns: 1.2fr 2fr 1fr;
  gap: 12px; align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}

.set-empty {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  padding: 28px 16px;
  color: var(--text-3); font-size: 12.5px;
  text-align: center;
}
.set-empty.large { padding: 56px 16px; }
.set-empty-icon {
  width: 56px; height: 56px; border-radius: 12px;
  background: var(--surface-2);
  border: 1px dashed var(--hairline-strong);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}

@media (max-width: 1100px) {
  .settings { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .settings { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { display: none; }
}


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

.form-section {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}
.form-section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}
.form-section-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0;
}
.form-section-desc {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.45;
  max-width: 600px;
}
.form-section-body {
  padding: 8px 16px 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  align-items: flex-start;
}
.form-row:last-child { border-bottom: 0; }
.form-row-label label {
  font-size: 12px;
  font-weight: 550;
  color: var(--text);
  display: block;
  margin-top: 6px;
}
.form-optional {
  font-weight: 400;
  color: var(--text-3);
  font-size: 11px;
}
.form-row-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
  line-height: 1.45;
  max-width: 260px;
}
.form-row-error {
  font-size: 11px;
  color: var(--brand-red);
  margin-top: 3px;
}
.form-row-control {
  min-width: 0;
  align-self: center;
}

.form-grid {
  display: grid;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--hairline);
}
.form-grid:last-child { border-bottom: 0; }
.form-grid .form-row {
  border-bottom: 0;
  padding: 6px 0;
  grid-template-columns: 1fr;
  gap: 4px;
}
.form-grid .form-row-label label { margin-top: 0; }
.form-grid .form-row-control { align-self: stretch; }

/* Fields */
.field {
  display: flex; align-items: center;
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  overflow: hidden;
  max-width: 460px;
}
.field:hover { border-color: var(--text-4); }
.field:focus-within {
  border-color: var(--ws-accent, var(--brand-green));
  box-shadow: 0 0 0 3px var(--ws-accent-soft, var(--brand-green-soft));
}
.field input {
  border: 0; outline: 0; background: transparent;
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  flex: 1; min-width: 0;
  width: 100%;
}
.field input::placeholder { color: var(--text-3); }
.field.mono input { font-family: var(--font-mono); font-size: 11.5px; }
.field-prefix, .field-suffix {
  padding: 6px 10px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11.5px;
  font-family: var(--font-mono);
  border-right: 1px solid var(--hairline);
  flex-shrink: 0;
}
.field-suffix { border-right: 0; border-left: 1px solid var(--hairline); }

.field-textarea {
  width: 100%; max-width: 460px;
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  background: var(--surface);
  padding: 8px 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  min-height: 60px;
  outline: 0;
}
.field-textarea:focus {
  border-color: var(--ws-accent, var(--brand-green));
  box-shadow: 0 0 0 3px var(--ws-accent-soft, var(--brand-green-soft));
}

.field.select {
  padding-right: 8px;
  max-width: 460px;
}
.field.select select {
  border: 0; outline: 0; background: transparent;
  padding: 7px 8px 7px 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  flex: 1; min-width: 0;
  appearance: none;
  cursor: pointer;
}

/* Color picker */
.color-swatches {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.color-swatch {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 2px solid var(--surface);
  outline: 1px solid var(--hairline);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: transform .12s;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.active {
  outline: 2px solid var(--text);
  transform: scale(1.08);
}

/* Logo uploader */
.logo-uploader {
  display: flex; gap: 14px;
  align-items: center;
}
.logo-preview {
  width: 64px; height: 64px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.04em;
  flex-shrink: 0;
}

/* Day picker */
.day-picker { display: flex; gap: 4px; }
.day-chip {
  width: 36px; height: 28px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 550;
  color: var(--text-2);
  cursor: pointer;
}
.day-chip:hover { background: var(--surface-hover); color: var(--text); }
.day-chip.active {
  background: var(--ws-accent, var(--brand-green));
  color: #fff;
  border-color: transparent;
}

/* Toggle row */
.toggle-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}
.toggle-row:last-child { border-bottom: 0; }

/* Danger row */
.danger-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}
.danger-row:last-child { border-bottom: 0; }
.danger-row > div:first-child { flex: 1; min-width: 0; }

/* Save bar (sticky bottom) */
.save-bar {
  position: sticky;
  bottom: 0;
  left: 0; right: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--hairline-strong);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
  margin-top: 14px;
  z-index: 10;
  animation: slideUp .18s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Toast */
.settings-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--text);
  color: var(--surface);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 550;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 60;
  animation: toastIn .2s ease-out;
}
@keyframes toastIn {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Responsive form rows */
@media (max-width: 880px) {
  .form-row { grid-template-columns: 1fr; gap: 6px; }
  .form-row-hint { max-width: none; }
  .form-row-control { align-self: stretch; }
}


/* ============ FIX · full-width views (settings, cc, placeholder) ============ */
.app .main[data-layout="full"] {
  grid-template-columns: minmax(0, 1fr) !important;
}
.app .main[data-layout="full"] .inbox,
.app .main[data-layout="full"] .conv,
.app .main[data-layout="full"] .context { display: none !important; }


/* ============ SETTINGS · TEAM & PERMISSIONS ============ */

.conn-tab-count {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface-2);
  color: var(--text-3);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 5px;
}
.conn-tab.active .conn-tab-count {
  background: var(--ws-accent-soft);
  color: var(--ws-accent, var(--brand-green-strong));
}

/* === Members table === */
.member-table {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
}
.member-row {
  display: grid;
  grid-template-columns: 32px 1.4fr 2fr 130px 100px 60px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
}
.member-row:last-child { border-bottom: 0; }
.member-row:hover:not(.head) { background: var(--surface-hover); }
.member-row.head {
  font-size: 9.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  background: var(--bg-2);
  padding-top: 7px;
  padding-bottom: 7px;
}

.m-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand-green);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.m-avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }

.m-info { min-width: 0; }
.m-name {
  font-size: 12.5px;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-email {
  font-size: 10.5px;
  color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 1px;
}
.m-assignments {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.assignment-badge {
  display: inline-flex; align-items: center;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: var(--surface);
  overflow: hidden;
}
.ab-role {
  padding: 1px 6px;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.ab-unit {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px;
  font-size: 10px;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 4px;
}
.m-last { font-size: 11px; color: var(--text-3); }

/* === Units tree === */
.units-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  align-items: flex-start;
}
.units-tree {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
}
.units-tree-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}
.tree {
  padding: 4px 0;
}
.tree-row {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 12px 4px 6px;
  cursor: pointer;
  font-size: 12px;
  border-radius: 4px;
  margin: 0 6px;
}
.tree-row:hover { background: var(--surface-hover); }
.tree-row.selected {
  background: var(--ws-accent-soft, var(--brand-green-soft));
  color: var(--ws-accent, var(--brand-green-strong));
  font-weight: 600;
}
.tree-toggle {
  width: 14px; height: 14px;
  border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
}
.tree-icon { flex-shrink: 0; }
.tree-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tree-count {
  font-size: 10px;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 0 5px;
  border-radius: 3px;
}
.tree-row.selected .tree-count {
  background: rgba(255,255,255,.6);
  color: var(--ws-accent, var(--brand-green-strong));
}

.units-tree-legend {
  border-top: 1px solid var(--hairline);
  padding: 8px 12px;
  font-size: 10px;
  color: var(--text-3);
  display: flex; flex-direction: column; gap: 3px;
}
.units-tree-legend span:first-child {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 2px;
}
.units-tree-legend span {
  display: inline-flex; align-items: center; gap: 6px;
}

/* Unit detail */
.unit-detail {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 16px 18px;
}
.unit-detail-head {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 14px;
}
.unit-detail-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.unit-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.unit-stat {
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--bg-2);
}
.unit-stat-head {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
.unit-stat-value {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  margin-top: 4px;
}
.unit-stat-value.accent-green { color: var(--brand-green-strong); }
.unit-stat-value.accent-amber { color: var(--brand-amber); }
.unit-stat-value.accent-red   { color: var(--brand-red); }

/* === Roles tab === */
.roles-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  align-items: flex-start;
}
.roles-list {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
}
.role-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}
.role-row:last-child { border-bottom: 0; }
.role-row:hover { background: var(--surface-hover); }
.role-row.selected { background: var(--ws-accent-soft); }
.role-swatch {
  width: 8px;
  border-radius: 3px;
  align-self: stretch;
  min-height: 38px;
  flex-shrink: 0;
}
.role-swatch.lg {
  width: 8px;
  align-self: stretch;
  min-height: 48px;
}
.role-info { flex: 1; min-width: 0; }
.role-name {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -.005em;
}
.role-desc {
  display: block;
  font-size: 10.5px;
  color: var(--text-3);
  line-height: 1.4;
  margin-top: 2px;
}
.role-meta {
  display: flex; gap: 6px; align-items: center;
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 4px;
}
.role-meta .sep { color: var(--text-4); }

.role-detail {
  background: var(--bg);
}
.role-detail-head {
  display: flex; align-items: center; gap: 14px;
  padding: 4px 0;
}
.role-detail-head .role-swatch.lg {
  width: 6px;
  border-radius: 3px;
  min-height: 48px;
}

.perms-group { margin-bottom: 14px; }
.perms-group:last-child { margin-bottom: 0; }
.perms-group-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  color: var(--text-3);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
}
.toggle.disabled { opacity: .5; cursor: not-allowed; }

/* === Invites === */
.invite-table {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
}
.invite-row {
  display: grid;
  grid-template-columns: 1.6fr 1.8fr 1fr 70px 110px 86px;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.invite-row:last-child { border-bottom: 0; }
.invite-row.head {
  font-size: 9.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  background: var(--bg-2);
}

/* Responsive */
@media (max-width: 1100px) {
  .units-layout, .roles-layout { grid-template-columns: 1fr; }
  .member-row {
    grid-template-columns: 32px 1.5fr 130px 60px;
  }
  .member-row > *:nth-child(3), .member-row > *:nth-child(5) { display: none; }
  .invite-row {
    grid-template-columns: 1.6fr 90px 80px;
  }
  .invite-row > *:nth-child(3), .invite-row > *:nth-child(4), .invite-row > *:nth-child(6) { display: none; }
}


/* ============ SETTINGS · SECURITY (Identity providers + provisioning modes) ============ */

/* Mode explainer banner */
.mode-explainer {
  border: 1px solid var(--hairline);
  background: var(--bg-2);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.mode-explainer-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.mode-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--brand-green);
  border-radius: 6px;
  padding: 10px 12px;
}
.mode-card-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 4px;
}
.mode-card-desc {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.45;
}
.mode-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* IDP rows in providers list */
.idp-row {
  display: grid;
  grid-template-columns: 36px 1.4fr 1.6fr 120px 160px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}
.idp-row:last-child { border-bottom: 0; }
.idp-row:hover { background: var(--surface-hover); }
.idp-logo {
  width: 32px; height: 32px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px;
}
.idp-main { min-width: 0; }
.idp-name-row { display: flex; align-items: center; gap: 6px; }
.idp-name { font-size: 13px; font-weight: 600; }
.idp-sub {
  font-size: 11px; color: var(--text-3); margin-top: 1px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.idp-sub .sep { color: var(--text-4); }
.idp-mode-cell { display: flex; flex-direction: column; gap: 2px; }
.idp-mode-badge {
  display: inline-flex; flex-direction: column;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 11px;
  width: fit-content;
}
.idp-mode-detail { font-size: 10px; opacity: .85; font-weight: 400; }

.idp-sync-cell {
  display: flex; flex-direction: column; gap: 1px;
}

/* Mode radio grid (for provider detail) */
.mode-radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  padding: 4px 0;
}
.mode-radio {
  display: flex; flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.mode-radio:hover { border-color: var(--text-4); }
.mode-radio.active { border-width: 2px; padding: 11px 13px; }
.mode-radio-head { display: flex; align-items: center; gap: 8px; }
.mode-radio-check {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--hairline-strong);
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mode-radio-title {
  font-size: 12.5px;
  font-weight: 600;
}
.mode-radio-desc {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.45;
}

/* Group mapping table */
.grpmap-row {
  display: grid;
  grid-template-columns: 1.6fr 16px 1.4fr 1fr 60px 70px;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.grpmap-row.head {
  font-size: 9.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  background: var(--bg-2);
}

/* Sync log */
.synclog-row {
  display: grid;
  grid-template-columns: 80px 70px 200px 1fr;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--hairline);
  align-items: center;
  font-size: 11.5px;
}
.synclog-row:last-child { border-bottom: 0; }

/* Responsive */
@media (max-width: 1100px) {
  .idp-row {
    grid-template-columns: 36px 1.4fr 120px 100px;
  }
  .idp-row > .idp-sync-cell { display: none; }
  .grpmap-row {
    grid-template-columns: 1.4fr 16px 1fr 80px 60px;
  }
  .grpmap-row > *:nth-child(5):not(.head span) { display: none; }
  .synclog-row { grid-template-columns: 80px 70px 1fr; }
  .synclog-row > *:nth-child(3) { display: none; }
}


/* ============ CONNECTOR DETAIL VIEWS · WhatsApp / Evolution / GLPI ============ */

/* Phone numbers / templates table */
.phones-table { background: var(--surface); }
.phone-row {
  display: grid;
  grid-template-columns: 1.2fr 1.3fr 1.5fr 130px 60px;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.phone-row:last-child { border-bottom: 0; }
.phone-row.head {
  font-size: 9.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  padding: 6px 0;
}

/* QR Code area */
.qr-pair {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: flex-start;
  padding: 8px 0;
}
.qr-box {
  display: flex; flex-direction: column;
  align-items: center;
}
.qr-side {
  min-width: 0;
}

/* Entity table */
.entity-table { background: var(--surface); }
.entity-row {
  display: grid;
  grid-template-columns: 40px 1.6fr 70px 1.4fr 100px;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.entity-row:last-child { border-bottom: 0; }
.entity-row.head {
  font-size: 9.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  padding: 6px 0;
}
.entity-row.alert { background: var(--brand-amber-soft); }
[data-theme="dark"] .entity-row.alert { background: rgba(217,119,6,.1); }

.map-table { background: var(--surface); border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden; }
.map-table .map-row { padding: 8px 14px; border-bottom: 1px solid var(--hairline); }
.map-table .map-row:last-child { border-bottom: 0; }

/* Responsive */
@media (max-width: 1100px) {
  .qr-pair { grid-template-columns: 1fr; }
  .entity-row { grid-template-columns: 32px 1.6fr 60px 1.2fr; }
  .entity-row > *:nth-child(5) { display: none; }
  .phone-row { grid-template-columns: 1fr 1fr 100px 60px; }
  .phone-row > *:nth-child(3) { display: none; }
}


/* ============ MODALS ============ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 17, 20, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: backdropIn .15s ease-out;
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  max-width: 100%;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  animation: modalIn .18s ease-out;
}
@keyframes modalIn {
  from { transform: translateY(12px) scale(.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}
.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--hairline);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--bg-2);
  border-radius: 0 0 10px 10px;
}

/* Compact form rows inside modal */
.modal .form-row {
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 8px 0;
}
.modal .form-row-label label { margin-top: 0; }
.modal .field { max-width: 100%; }
.modal .field-textarea { max-width: 100%; }
.modal .field.select { max-width: 100%; }

/* Inline assignment editor (used in member modal) */
.assignment-editor {
  border: 1px solid var(--hairline);
  border-radius: 6px;
  overflow: hidden;
}
.assignment-edit-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 28px;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  align-items: center;
}
.assignment-edit-row:last-of-type { border-bottom: 0; }
.assignment-edit-row .field.select { padding-right: 8px; }
.add-assignment-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  border-top: 1px solid var(--hairline);
  cursor: pointer;
}
.add-assignment-btn:hover { background: var(--surface-hover); color: var(--text); }


/* ============ POP MENU ============ */
.pop-menu {
  position: absolute;
  right: 0; top: 100%;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 7px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.04);
  padding: 4px;
  min-width: 200px;
  z-index: 30;
  animation: cpIn .14s ease-out;
}
.pop-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: 0; background: transparent;
  border-radius: 4px;
  font-size: 11.5px; color: var(--text);
  text-align: left; cursor: pointer;
  white-space: nowrap;
}
.pop-item:hover { background: var(--surface-hover); }
.pop-item.danger { color: var(--brand-red); }
.pop-item.danger:hover { background: var(--brand-red-soft); }
.pop-item svg { color: var(--text-3); flex-shrink: 0; }
.pop-item.danger svg { color: var(--brand-red); }
.pop-divider {
  height: 1px;
  background: var(--hairline);
  margin: 4px 0;
}


.focus-back:hover { background: var(--surface-hover); color: var(--text); }

/* Push conv-head content right so the floating back button doesn't overlap it */
.app .main[data-layout="focus"] .conv-head { padding-left: 130px; }


/* ============ WHATSAPP · VALIDAÇÃO META (2026) ============ */

.meta-status-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  margin-bottom: 14px;
}
.meta-status-banner.ok    { background: var(--brand-green-soft); border-color: var(--brand-green-soft-2); }
.meta-status-banner.warn  { background: var(--brand-amber-soft); border-color: var(--brand-amber); }
.meta-status-banner.error { background: var(--brand-red-soft);   border-color: var(--brand-red); }

.meta-status-banner .ico {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: rgba(255,255,255,.6);
  color: var(--text);
}
.meta-status-banner.ok    .ico { background: var(--brand-green);  color: #fff; }
.meta-status-banner.warn  .ico { background: var(--brand-amber);  color: #fff; }
.meta-status-banner.error .ico { background: var(--brand-red);    color: #fff; }

.meta-status-banner .ttl { font-size: 12.5px; font-weight: 600; color: var(--text); }
.meta-status-banner .sub { font-size: 11px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.meta-status-banner .pct {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  text-align: right;
  white-space: nowrap;
}
.meta-status-banner .pct b { font-size: 14px; color: var(--text); font-weight: 700; }

.check-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.check-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline);
}
.check-row:last-child { border-bottom: 0; }
.check-row:hover { background: var(--surface-hover); }

.check-row .cr-ico {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.check-row.ok    .cr-ico { background: var(--brand-green-soft);  color: var(--brand-green-strong); }
.check-row.warn  .cr-ico { background: var(--brand-amber-soft);  color: var(--brand-amber); }
.check-row.error .cr-ico { background: var(--brand-red-soft);    color: var(--brand-red); }
.check-row.pending .cr-ico { background: var(--surface-2); color: var(--text-3); }
.check-row.info  .cr-ico { background: var(--brand-blue-soft); color: var(--brand-blue); }

.check-row .cr-body { min-width: 0; }
.check-row .cr-ttl {
  font-size: 12.5px; font-weight: 550; color: var(--text);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.check-row .cr-desc {
  font-size: 11px; color: var(--text-3);
  margin-top: 2px; line-height: 1.45;
}
.check-row .cr-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 3px;
}
.check-row .cr-meta b { color: var(--text-2); font-weight: 600; }

.check-row .cr-act {
  display: flex; gap: 4px;
  flex-shrink: 0;
}

.scope-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  margin-top: 4px;
}
.scope-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border-radius: 5px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-2);
}
.scope-pill.ok { color: var(--brand-green-strong); border-color: var(--brand-green-soft-2); background: var(--brand-green-soft); }
.scope-pill.missing { color: var(--brand-red); border-color: var(--brand-red-soft); background: var(--brand-red-soft); }

.tier-meter {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
}
.tier-bar {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--surface-2);
  position: relative; overflow: hidden;
}
.tier-bar > i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--brand-green);
  border-radius: 2px;
}
.tier-bar.warn > i { background: var(--brand-amber); }
.tier-bar.error > i { background: var(--brand-red); }
.tier-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.graph-step {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
  margin-bottom: 6px;
}
.graph-step .step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.graph-step.ok .step-num { background: var(--brand-green); color: #fff; }
.graph-step .step-body { flex: 1; min-width: 0; }
.graph-step .step-ttl { font-size: 12px; font-weight: 600; color: var(--text); }
.graph-step .step-endpoint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 2px;
  word-break: break-all;
}
.graph-step .step-meta {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 4px;
  font-family: var(--font-mono);
}
.graph-step .step-meta.ok { color: var(--brand-green-strong); }
.graph-step .step-meta.error { color: var(--brand-red); }
.graph-step .step-act { display: flex; gap: 4px; flex-shrink: 0; }

[data-theme="dark"] .meta-status-banner.ok    { background: rgba(27,158,71,.08); }
[data-theme="dark"] .meta-status-banner.warn  { background: rgba(217,119,6,.10); }
[data-theme="dark"] .meta-status-banner.error { background: rgba(220,38,38,.10); }


/* ============================================================ */
/* ====== RESPONSIVE SYSTEM · 2026-05 (consolidated) ============ */
/* ============================================================ */
/*
   Final breakpoint ladder (overrides earlier scattered queries):

   ≥1440  xl   — original 3-col layout (sidebar 220 · inbox 340 · conv · ctx 300)
   1280   lg   — context narrower (280) · inbox 320
   1024   md   — sidebar auto-narrow (56) · context becomes overlay drawer
                · inbox compact (300) · conv-head pills truncated
                · tables hide low-priority cols · KPIs 2-col
   768    sm   — sidebar becomes hamburger drawer · context drawer
                · settings-nav becomes dropdown · forms 1-col
                · check-rows stack · graph-steps stack · KPIs scroll-x
                · master-detail inbox (selecting a conv hides the list)
   <768   xs   — same as sm + topbar minimal · logo icon-only
*/

/* ---------- LG · 1280px ----------------------------------- */
@media (max-width: 1440px) {
  .app .main[data-layout="side"],
  .app .main:not([data-layout]) {
    grid-template-columns: 320px minmax(0, 1fr) 280px;
  }
}

/* ---------- MD · 1024-1280 -------------------------------- */
@media (max-width: 1280px) {
  /* Sidebar auto-narrow */
  .app:not([data-drawer-sidebar="open"]) {
    grid-template-columns: 56px 1fr;
  }
  .app:not([data-drawer-sidebar="open"]) .sb-item-text,
  .app:not([data-drawer-sidebar="open"]) .sb-section-title,
  .app:not([data-drawer-sidebar="open"]) .sb-item .count,
  .app:not([data-drawer-sidebar="open"]) .sb-team-name,
  .app:not([data-drawer-sidebar="open"]) .sb-team-role,
  .app:not([data-drawer-sidebar="open"]) .ws-info,
  .app:not([data-drawer-sidebar="open"]) .ws-current .chev {
    display: none;
  }
  .app:not([data-drawer-sidebar="open"]) .sb-item {
    justify-content: center;
    padding: 0;
  }
  .app:not([data-drawer-sidebar="open"]) .ws-current {
    justify-content: center;
    padding: 6px 4px;
  }
  .app:not([data-drawer-sidebar="open"]) .sb-team {
    justify-content: center;
    padding: 8px 4px;
  }

  /* Context becomes overlay drawer (toggle from conv-head) */
  .app .main[data-layout="side"],
  .app .main:not([data-layout]) {
    grid-template-columns: 300px minmax(0, 1fr);
  }
  .app .context {
    position: fixed;
    top: 44px;
    right: -340px;
    width: 320px;
    height: calc(100vh - 44px);
    background: var(--surface);
    border-left: 1px solid var(--hairline);
    z-index: 40;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.06);
    transition: right 0.22s ease;
  }
  .app[data-drawer-context="open"] .context {
    right: 0;
  }

  /* Show context toggle button in conv-head */
  .ctx-toggle-btn { display: inline-flex !important; }
}

/* ---------- SM · 768-1024 --------------------------------- */
@media (max-width: 1024px) {
  /* Sidebar becomes a hamburger drawer — hidden by default */
  .app {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .app .sidebar {
    position: fixed;
    top: 44px;
    left: -260px;
    width: 240px;
    height: calc(100vh - 44px);
    z-index: 40;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.06);
    transition: left 0.22s ease;
  }
  .app[data-drawer-sidebar="open"] .sidebar {
    left: 0;
  }
  /* Restore full sidebar contents inside drawer */
  .app[data-drawer-sidebar="open"] .sb-item-text,
  .app[data-drawer-sidebar="open"] .sb-section-title,
  .app[data-drawer-sidebar="open"] .sb-item .count,
  .app[data-drawer-sidebar="open"] .sb-team-name,
  .app[data-drawer-sidebar="open"] .sb-team-role,
  .app[data-drawer-sidebar="open"] .ws-info,
  .app[data-drawer-sidebar="open"] .ws-current .chev {
    display: inline;
  }
  .app[data-drawer-sidebar="open"] .sb-item {
    justify-content: flex-start;
    padding: 0 10px;
  }
  /* Show hamburger button */
  .tb-hamburger { display: inline-flex !important; }

  /* When sidebar drawer is open, hide main content overflow under it */
  .app[data-drawer-sidebar="open"] .main {
    pointer-events: none;
    user-select: none;
  }

  /* Inbox compact */
  .app .main[data-layout="side"],
  .app .main:not([data-layout]) {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  /* Tables: enable horizontal scroll with sticky first col */
  .api-row, .wh-row, .ev-row,
  .map-row, .event-row, .member-row, .role-row, .idp-row {
    min-width: 720px;
  }
  .detail-section.scrollable,
  .form-section-body.scrollable {
    overflow-x: auto;
  }

  /* conn-tabs: scroll-x when too many */
  .conn-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: thin;
  }
  .conn-tab {
    flex-shrink: 0;
  }

  /* KPIs in 2 cols max */
  .cc-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Command Center panels stack */
  .cc-grid {
    grid-template-columns: 1fr !important;
  }

  /* Workspace switcher in drawer should show name */
  .app[data-drawer-sidebar="open"] .ws-current {
    justify-content: flex-start;
    padding: 6px 8px;
  }
  .app[data-drawer-sidebar="open"] .sb-team {
    justify-content: flex-start;
    padding: 10px 8px;
  }
}

/* ---------- SM-narrow · 768 ------------------------------- */
@media (max-width: 768px) {
  /* Master-detail inbox: hide list when a conversation is selected */
  .app .main[data-layout="side"][data-conv-active="true"] .inbox,
  .app .main:not([data-layout])[data-conv-active="true"] .inbox {
    display: none;
  }
  .app .main[data-layout="side"][data-conv-active="true"],
  .app .main:not([data-layout])[data-conv-active="true"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  /* When no conv active, only show inbox (full width) */
  .app .main[data-layout="side"]:not([data-conv-active="true"]) .conv,
  .app .main:not([data-layout]):not([data-conv-active="true"]) .conv {
    display: none;
  }
  .app .main[data-layout="side"]:not([data-conv-active="true"]),
  .app .main:not([data-layout]):not([data-conv-active="true"]) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  /* Show "back to list" button in conv-head */
  .conv-back-btn { display: inline-flex !important; }

  /* Topbar minimal */
  .tb-search { display: none; }
  .tb-breadcrumb .tb-crumb:not(.active) { display: none; }
  .tb-breadcrumb .tb-crumb-sep { display: none; }
  /* Logo icon-only */
  .logo .logo-word, .logo .logo-org { display: none; }
  .logo { width: 40px; min-width: 40px; padding: 0; justify-content: center; }
  /* Hide secondary topbar buttons */
  .tb-actions .tb-btn[title="Disparos rápidos"],
  .tb-actions .tb-btn[title="Automações"],
  .tb-actions .tb-divider {
    display: none;
  }
  .tb-btn.primary { padding: 0 8px; }
  .tb-btn.primary span { display: none; }

  /* Settings: sub-sidebar becomes a top dropdown */
  .settings {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .settings-nav {
    display: none;
  }
  .settings-mobile-picker {
    display: flex !important;
  }

  /* Forms: 1-col rows */
  .form-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .form-row-label { padding-bottom: 2px; }
  .form-row-hint { max-width: none; }
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Check-row stacks (Validação Meta etc.) */
  .check-row {
    grid-template-columns: 28px 1fr;
    grid-template-areas:
      "icon body"
      ". actions";
    row-gap: 6px;
  }
  .check-row .cr-ico { grid-area: icon; }
  .check-row .cr-body { grid-area: body; }
  .check-row .cr-act {
    grid-area: actions;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  /* Meta status banner stacks */
  .meta-status-banner {
    flex-wrap: wrap;
    gap: 10px;
  }
  .meta-status-banner .pct {
    margin-left: 0;
    text-align: left;
    width: 100%;
    border-top: 1px solid var(--hairline);
    padding-top: 8px;
  }

  /* Graph steps stack */
  .graph-step {
    flex-wrap: wrap;
  }
  .graph-step .step-body { min-width: 0; flex: 1 1 200px; }

  /* Connector cards stack stats below info */
  .connector-row {
    flex-wrap: wrap;
  }

  /* KPIs single col with scroll-x option */
  .cc-kpis {
    grid-template-columns: 1fr;
  }

  /* Composer doesn't need 2-col compose at this width */
  .composer-meta {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Modal padding reduced */
  .modal {
    width: calc(100vw - 32px) !important;
    max-width: 520px;
  }

  /* Validation tab counter never wraps weirdly */
  .conn-tab-count { display: none; }
}

/* ---------- XS · <540 ------------------------------------- */
@media (max-width: 540px) {
  /* Even tighter topbar */
  .tb-actions .tb-btn[title="Notificações"] { display: none; }
  /* Avatar smaller */
  .tb-avatar { width: 26px; height: 26px; font-size: 10px; }
  /* Modal full-width */
  .modal {
    width: calc(100vw - 16px) !important;
  }
  /* Settings page padding */
  .set-page { padding: 16px 12px !important; }
  .cc-wrap { padding: 16px 12px !important; }
}

/* ---------- Utility: hidden by default, shown via media ---- */
.tb-hamburger { display: none; }
.ctx-toggle-btn { display: none; }
.conv-back-btn { display: none; }
.settings-mobile-picker { display: none; }

/* ---------- Drawer animations ------------------------------ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.drawer-backdrop {
  display: none;
}
@media (max-width: 1280px) {
  .app[data-drawer-context="open"] .drawer-backdrop,
  .app[data-drawer-sidebar="open"] .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 44px 0 0 0;
    background: rgba(0, 0, 0, 0.32);
    z-index: 38;
    animation: fadeIn 0.18s ease;
  }
}

/* ---------- Hamburger / drawer close buttons style --------- */
.tb-hamburger,
.ctx-toggle-btn,
.conv-back-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.tb-hamburger:hover,
.ctx-toggle-btn:hover,
.conv-back-btn:hover {
  background: var(--surface-hover);
}
.tb-hamburger.active,
.ctx-toggle-btn.active {
  background: var(--ws-accent-soft, var(--brand-green-soft));
  border-color: var(--ws-accent, var(--brand-green));
  color: var(--ws-accent, var(--brand-green));
}

/* ---------- Settings mobile picker ------------------------- */
.settings-mobile-picker {
  display: none;
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.settings-mobile-picker select {
  flex: 1;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text);
  padding: 0 8px;
  font-size: 12.5px;
  font-family: inherit;
}

/* ---------- Conv-head: ensure new buttons fit -------------- */
.conv-head {
  flex-wrap: wrap;
}
.conv-head-info {
  min-width: 0;
}
@media (max-width: 1024px) {
  .conv-head-name { font-size: 13px; }
  .conv-head-name .pill:nth-of-type(n+3) { display: none; }
}


/* ============ USER MENU (avatar dropdown) ============ */
.tb-avatar-btn {
  width: 26px; height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}
.tb-avatar-btn .tb-avatar {
  margin: 0;
  border: 1.5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--hairline-strong);
  transition: box-shadow 0.15s;
}
.tb-avatar-btn:hover .tb-avatar { box-shadow: 0 0 0 1px var(--ws-accent, var(--brand-green)); }
.tb-avatar-btn.active .tb-avatar { box-shadow: 0 0 0 2px var(--ws-accent, var(--brand-green)); }
.tb-avatar-btn .presence-dot {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--surface);
  background: var(--brand-green);
}
.tb-avatar-btn .presence-dot.away { background: var(--brand-amber); }
.tb-avatar-btn .presence-dot.busy { background: var(--brand-red); }
.tb-avatar-btn .presence-dot.offline { background: var(--text-4); }

/* Dropdown panel */
.um-menu {
  position: absolute;
  top: 40px; right: 8px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.04);
  z-index: 50;
  padding: 4px;
  animation: cpIn .14s ease-out;
}

/* User header */
.um-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
}
.um-header .um-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.um-header .um-info { flex: 1; min-width: 0; }
.um-header .um-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.um-header .um-email {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.um-header .um-role {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 2px;
}

/* Presence selector */
.um-presence {
  display: flex; align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
}
.um-presence:hover { background: var(--surface-hover); }
.um-presence .pdot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand-green);
  margin-right: 8px;
  flex-shrink: 0;
}
.um-presence.away .pdot { background: var(--brand-amber); }
.um-presence.busy .pdot { background: var(--brand-red); }
.um-presence.offline .pdot { background: var(--text-4); }
.um-presence .um-label {
  font-size: 12px;
  font-weight: 500;
  flex: 1;
}
.um-presence .um-value {
  font-size: 11px;
  color: var(--text-3);
  margin-right: 4px;
}

/* Menu items */
.um-section {
  padding: 2px 0;
  border-bottom: 1px solid var(--hairline);
}
.um-section:last-of-type { border-bottom: 0; }

.um-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.um-item:hover { background: var(--surface-hover); }
.um-item:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.um-item .um-ico {
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  flex-shrink: 0;
}
.um-item:hover .um-ico { color: var(--text-2); }
.um-item .um-label {
  font-size: 12.5px;
  font-weight: 500;
  flex: 1;
}
.um-item .um-value {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.um-item .um-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  padding: 1px 5px;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  background: var(--surface-2);
}
.um-item .um-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--brand-green-soft);
  color: var(--brand-green-strong);
}
.um-item .um-badge.warn { background: var(--brand-amber-soft); color: var(--brand-amber); }
.um-item .um-badge.off { background: var(--surface-2); color: var(--text-3); }

.um-item.danger { color: var(--brand-red); }
.um-item.danger:hover { background: var(--brand-red-soft); }
.um-item.danger .um-ico { color: var(--brand-red); }

/* Theme picker (3-segment radio inside menu) */
.um-theme {
  display: flex;
  margin: 4px 6px 6px;
  padding: 2px;
  background: var(--surface-2);
  border-radius: 6px;
}
.um-theme button {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 4px;
  border-radius: 4px;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.um-theme button:hover { color: var(--text); }
.um-theme button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--hairline-strong);
}

/* Status row at very top of theme/account toggles */
.um-status-pill {
  display: inline-flex;
  align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}
.um-status-pill.online { background: var(--brand-green-soft); color: var(--brand-green-strong); }

/* Modals shared with settings-forms (just wraps for password/mfa) */
.um-modal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.um-strength {
  display: flex; gap: 3px;
  margin-top: 4px;
}
.um-strength i {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-2);
}
.um-strength.weak   i:nth-child(-n+1) { background: var(--brand-red); }
.um-strength.medium i:nth-child(-n+2) { background: var(--brand-amber); }
.um-strength.strong i:nth-child(-n+3) { background: var(--brand-green); }
.um-strength.solid  i { background: var(--brand-green); }
.um-strength-label {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 3px;
  font-family: var(--font-mono);
}

/* MFA wizard steps */
.um-mfa-step {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}
.um-mfa-step:last-child { border-bottom: 0; }
.um-mfa-step .step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ws-accent-soft, var(--brand-green-soft));
  color: var(--ws-accent, var(--brand-green-strong));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.um-mfa-step.done .step-num {
  background: var(--brand-green);
  color: #fff;
}
.um-mfa-step .step-body { flex: 1; min-width: 0; }
.um-mfa-step .step-ttl { font-size: 12.5px; font-weight: 600; color: var(--text); }
.um-mfa-step .step-desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }

/* QR placeholder */
.um-qr {
  width: 160px; height: 160px;
  background: repeating-conic-gradient(var(--text) 0% 25%, var(--surface) 0% 50%) 50% / 14px 14px;
  border: 4px solid var(--surface);
  box-shadow: 0 0 0 1px var(--hairline-strong);
  border-radius: 4px;
  margin: 8px auto;
}

/* TOTP code input — 6 digits */
.um-totp {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 10px 0;
}
.um-totp input {
  width: 36px; height: 44px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
}
.um-totp input:focus {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
  border-color: var(--ws-accent, var(--brand-green));
  background: var(--surface);
}

/* Recovery codes block */
.um-recovery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  margin: 8px 0;
}
.um-recovery code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.04em;
}
/* ============================================================
   OPS — Telas de operação (Ativos, Clientes, Pedidos, Pipeline…)
   Estende o design system. Tudo via tokens → dark automático.
   ============================================================ */

.ops {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg);
  overflow: hidden;
}

/* ---- Header ---- */
.ops-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 24px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  flex-shrink: 0;
}
.ops-head-main { min-width: 0; flex: 1; }
.ops-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}
.ops-title .ops-title-ic {
  width: 26px; height: 26px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ws-accent-soft, var(--brand-green-soft));
  color: var(--ws-accent, var(--brand-green));
  flex-shrink: 0;
}
.ops-sub {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 3px;
}
.ops-sub .mono { font-size: 11.5px; }
.ops-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---- Buttons ---- */
.ops-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: 6px; border: 1px solid var(--hairline);
  background: var(--surface); color: var(--text-2);
  font-size: 12px; font-weight: 500; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.ops-btn:hover { background: var(--surface-hover); color: var(--text); }
.ops-btn.primary {
  background: var(--ws-accent, var(--brand-green));
  border-color: transparent; color: #fff;
}
.ops-btn.primary:hover { filter: brightness(.95); color: #fff; }
.ops-btn.ghost { border-color: transparent; background: transparent; }
.ops-btn.ghost:hover { background: var(--surface-hover); }

/* ---- KPI strip ---- */
.ops-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--hairline);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.ops-stat {
  background: var(--surface);
  padding: 11px 18px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.ops-stat-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-3);
}
.ops-stat-value {
  font-size: 22px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text); font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.ops-stat-value.sm { font-size: 17px; }
.ops-stat-meta { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.ops-stat-meta.up { color: var(--brand-green-strong); }
.ops-stat-meta.down { color: var(--brand-red); }
.ops-stat-accent { color: var(--ws-accent, var(--brand-green)); }

/* ---- Toolbar ---- */
.ops-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 24px; flex-shrink: 0;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  flex-wrap: wrap;
}
.ops-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--hairline);
  border-radius: 6px; padding: 0 10px; height: 30px;
  min-width: 200px; flex: 1; max-width: 360px;
}
.ops-search input {
  border: none; background: none; outline: none;
  font-size: 12.5px; color: var(--text); width: 100%;
  font-family: var(--font-sans);
}
.ops-search input::placeholder { color: var(--text-4); }

/* segmented control */
.ops-seg {
  display: inline-flex; border: 1px solid var(--hairline);
  border-radius: 6px; overflow: hidden; height: 30px;
}
.ops-seg button {
  padding: 0 12px; font-size: 12px; font-weight: 500;
  background: var(--surface); color: var(--text-3);
  border: none; border-right: 1px solid var(--hairline);
  cursor: pointer; white-space: nowrap; font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .15s, color .15s;
}
.ops-seg button:last-child { border-right: none; }
.ops-seg button:hover { background: var(--surface-hover); color: var(--text-2); }
.ops-seg button.active {
  background: var(--ws-accent-soft, var(--brand-green-soft));
  color: var(--ws-accent, var(--brand-green-strong));
  font-weight: 600;
}

.ops-toolbar-spacer { flex: 1; }
.ops-count { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.ops-count b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- Body ---- */
.ops-body { flex: 1; overflow-y: auto; min-height: 0; }
.ops-body.pad { padding: 20px 24px; }

/* ---- Table ---- */
.ops-table { width: 100%; }
.ops-tr {
  display: grid;
  grid-template-columns: var(--cols, 1fr);
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  min-height: 46px;
  border-bottom: 1px solid var(--hairline);
}
.ops-thead {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-2);
  min-height: 34px;
  border-bottom: 1px solid var(--hairline);
}
.ops-thead .ops-th {
  font-size: 10px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-3);
  white-space: nowrap; cursor: default;
  display: flex; align-items: center; gap: 4px;
}
.ops-th.sortable { cursor: pointer; }
.ops-th.sortable:hover { color: var(--text); }
.ops-th.num, .ops-td.num { justify-content: flex-end; text-align: right; }
.ops-tbody .ops-tr { background: var(--surface); cursor: pointer; transition: background .12s; }
.ops-tbody .ops-tr:hover { background: var(--surface-hover); }
.ops-tbody .ops-tr.selected { background: var(--ws-accent-soft, var(--brand-green-soft)); }
.ops-td { font-size: 12.5px; color: var(--text); min-width: 0; }
.ops-td .ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-td-strong { font-weight: 550; color: var(--text); }
.ops-td-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* primary cell with avatar/icon */
.ops-cell {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.ops-ava {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
}
.ops-ava.circ { border-radius: 50%; }
.ops-ava.sq { border-radius: 7px; }
.ops-cell-text { min-width: 0; }

/* row meta line */
.ops-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

/* ---- Drawer (detalhe master-detail) ---- */
.ops-drawer-back {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15,18,20,.34);
  animation: opsFade .18s ease;
}
[data-theme="dark"] .ops-drawer-back { background: rgba(0,0,0,.55); }
.ops-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 91;
  width: 560px; max-width: 94vw;
  background: var(--surface);
  border-left: 1px solid var(--hairline);
  box-shadow: -8px 0 28px rgba(15,18,20,.10);
  display: flex; flex-direction: column;
  animation: opsSlide .22s cubic-bezier(.22,.61,.36,1);
}
.ops-drawer.wide { width: 720px; }
@keyframes opsFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes opsSlide { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }

.ops-drawer-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.ops-drawer-head-text { min-width: 0; flex: 1; }
.ops-drawer-title { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.ops-drawer-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.ops-x {
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline); background: var(--surface);
  color: var(--text-3); cursor: pointer; transition: background .15s;
}
.ops-x:hover { background: var(--surface-hover); color: var(--text); }
.ops-drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.ops-drawer-foot {
  display: flex; gap: 8px; padding: 12px 20px;
  border-top: 1px solid var(--hairline); flex-shrink: 0;
  background: var(--surface);
}

/* detail sections inside drawer / page */
.ops-sec { margin-bottom: 20px; }
.ops-sec:last-child { margin-bottom: 0; }
.ops-sec-title {
  font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 9px;
  display: flex; align-items: center; gap: 6px;
}
.ops-kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.ops-kv dt { font-size: 12px; color: var(--text-3); }
.ops-kv dd { font-size: 12.5px; color: var(--text); margin: 0; font-weight: 500; word-break: break-word; }

.ops-card {
  border: 1px solid var(--hairline); border-radius: 8px;
  background: var(--surface); padding: 13px 15px;
}
.ops-card + .ops-card { margin-top: 8px; }

/* mini stat grid for drawer */
.ops-minigrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); gap: 8px; }
.ops-mini {
  border: 1px solid var(--hairline); border-radius: 7px;
  padding: 9px 11px; background: var(--bg);
}
.ops-mini-label { font-size: 10px; color: var(--text-3); margin-bottom: 3px; }
.ops-mini-value { font-size: 16px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* progress / meter bar */
.ops-meter { height: 6px; border-radius: 3px; background: var(--hairline); overflow: hidden; }
.ops-meter > i { display: block; height: 100%; border-radius: 3px; background: var(--ws-accent, var(--brand-green)); }
.ops-meter.thin { height: 4px; }

/* timeline (atividade / histórico) */
.ops-timeline { display: flex; flex-direction: column; }
.ops-tl-item { display: grid; grid-template-columns: 16px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.ops-tl-item:not(:last-child)::before {
  content: ""; position: absolute; left: 7px; top: 16px; bottom: 0;
  width: 1px; background: var(--hairline);
}
.ops-tl-dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--surface); margin-top: 1px; box-sizing: border-box; }
.ops-tl-body { min-width: 0; }
.ops-tl-title { font-size: 12.5px; font-weight: 550; color: var(--text); }
.ops-tl-meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ---- Empty ---- */
.ops-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 70px 24px; color: var(--text-3); text-align: center;
}
.ops-empty-ic { color: var(--hairline-strong); }
.ops-empty-title { font-size: 14px; font-weight: 550; color: var(--text-2); }
.ops-empty-sub { font-size: 12.5px; max-width: 340px; line-height: 1.5; }

/* ============ KANBAN (pipeline) ============ */
.kanban {
  display: flex; gap: 14px; padding: 18px 24px;
  height: 100%; align-items: stretch; min-width: min-content;
}
.kan-col {
  width: 290px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--hairline);
  border-radius: 10px; min-height: 0;
}
.kan-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 13px 10px; flex-shrink: 0;
  border-bottom: 1px solid var(--hairline);
}
.kan-col-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.kan-col-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.kan-col-count {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 20px; padding: 1px 8px; font-variant-numeric: tabular-nums;
}
.kan-col-sum { font-size: 11px; color: var(--text-3); margin-left: auto; font-variant-numeric: tabular-nums; }
.kan-col-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kan-card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 8px; padding: 11px 12px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.kan-card:hover { border-color: var(--hairline-strong); box-shadow: 0 2px 8px rgba(15,18,20,.06); }
.kan-card.drag { opacity: .4; }
.kan-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.kan-card-co { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kan-card-val { font-size: 13px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kan-card-title { font-size: 11.5px; color: var(--text-2); line-height: 1.4; margin-bottom: 8px; }
.kan-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kan-mini-ava { width: 20px; height: 20px; border-radius: 50%; font-size: 9px; font-weight: 600; color: #fff; display: inline-flex; align-items: center; justify-content: center; }

/* ============ TOPOLOGIA ============ */
.topo-wrap { position: relative; height: 100%; overflow: auto; background:
  radial-gradient(circle, var(--hairline) 1px, transparent 1px);
  background-size: 22px 22px; background-position: -1px -1px;
}
[data-theme="dark"] .topo-wrap { background:
  radial-gradient(circle, #23262990 1px, transparent 1px);
  background-size: 22px 22px; }
.topo-node {
  position: absolute; transform: translate(-50%, -50%);
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 9px; padding: 9px 12px; width: max-content; max-width: 210px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 1px 3px rgba(15,18,20,.05);
}
.topo-node:hover { border-color: var(--ws-accent, var(--brand-amber)); box-shadow: 0 4px 14px rgba(15,18,20,.10); }
.topo-node.selected { border-color: var(--ws-accent, var(--brand-amber)); box-shadow: 0 0 0 3px var(--ws-accent-soft, var(--brand-amber-soft)); }
.topo-node-top { display: flex; align-items: center; gap: 7px; }
.topo-node-ic { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.topo-node-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; line-height: 1.3; }
.topo-node-type { font-size: 9.5px; color: var(--text-3); white-space: nowrap; line-height: 1.2; }
.topo-node-sub { font-size: 10px; color: var(--text-3); margin-top: 4px; font-family: var(--font-mono); white-space: nowrap; }
.topo-status { position: absolute; top: -5px; right: -5px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--surface); }

/* responsive */
@media (max-width: 1100px) {
  .ops-head, .ops-toolbar, .ops-body.pad { padding-left: 16px; padding-right: 16px; }
  .ops-tr { padding: 0 16px; gap: 10px; }
}
