/* Brance workspace — polished UI layer */

:root {
  --ws-bg: #f4f6f5;
  --ws-surface: #ffffff;
  --ws-border: #e4ebe7;
  --ws-border-soft: #eef2ef;
  --ws-text: #1a2b24;
  --ws-muted: #6b7a72;
  --ws-brand: #1d5c49;
  --ws-brand-soft: #e8f4e3;
  --ws-accent: #5c9a48;
  --ws-radius: 14px;
  --ws-radius-sm: 10px;
  --ws-shadow: 0 1px 2px rgba(20, 33, 29, 0.04), 0 8px 24px rgba(20, 33, 29, 0.04);
}

/* Layout polish */
.control-main { padding-bottom: 80px; }
.control-header h1 { font-size: 1.65rem; font-weight: 650; letter-spacing: -0.03em; }
.header-eyebrow { font-size: 0.68rem; letter-spacing: 0.08em; font-weight: 800; color: #7e8a83; margin: 0 0 4px; }
.workspace-body { margin-top: 24px; }

/* Waitlist notice, shown on every workspace page until the org is approved */
.waitlist-banner {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 14px 17px;
  margin-bottom: 20px;
  border-radius: 12px;
  background: #fff8e8;
  border: 1px solid #f0d9a0;
  color: #6b5320;
}

.waitlist-banner i { font-size: 1.05rem; line-height: 1.5; color: #b8860b; }
.waitlist-banner b { display: block; font-size: 0.93rem; margin-bottom: 2px; }
.waitlist-banner span { font-size: 0.86rem; line-height: 1.6; }
.waitlist-banner a { color: #8a6100; font-weight: 650; }

/* Body actions — top-right buttons in page content */
.body-actions {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 10px; margin-bottom: 16px;
}

/* Logo */
.control-logo img,
.offcanvas-header img,
.mobile-control-logo img {
  display: block;
  width: 198px;
  height: 50px;
  object-fit: contain;
  object-position: left center;
}
.control-logo img { filter: brightness(0) invert(1); margin: 0 8px 22px; }
.offcanvas-header img { width: 170px; height: 44px; }
.mobile-control-logo img { width: 130px; height: 36px; filter: none; }

/* Dropdowns */
.control-sidebar { display: flex; }
.workspace-select { cursor: pointer; border: 0; width: 100%; text-align: left; color: inherit; }
.workspace-select.dropdown-toggle::after { display: none; }
.sidebar-dropdown .dropdown-menu {
  background: #1b392e; border: 1px solid #365247; border-radius: var(--ws-radius-sm);
  padding: 6px; min-width: 240px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
.sidebar-dropdown .dropdown-item {
  color: #d6dfd9; border-radius: 8px; padding: 10px 12px; font-size: 12px; font-weight: 600;
}
.sidebar-dropdown .dropdown-item:hover { background: #385348; color: #fff; }
.sidebar-dropdown .dropdown-item small { display: block; color: #9eb2a7; font-size: 10px; margin-top: 2px; }
.sidebar-dropdown .dropdown-divider { border-color: #365247; margin: 6px 0; }
.account-person .dropdown-toggle {
  border: 0; background: transparent; color: inherit; padding: 0; width: 100%;
  display: flex; align-items: center; gap: 9px;
}
.account-person .dropdown-toggle::after { display: none; }
.header-tools .dropdown-menu {
  border-radius: var(--ws-radius-sm); border-color: var(--ws-border); padding: 8px;
  min-width: 220px; box-shadow: var(--ws-shadow);
}
.header-tools .dropdown-item { border-radius: 8px; font-size: 13px; font-weight: 600; padding: 10px 12px; }
.header-tools .dropdown-item small { display: block; color: var(--ws-muted); font-size: 10px; margin-top: 2px; }
.header-tools .profile-pill.dropdown-toggle { border: 0; }
.header-tools .profile-pill.dropdown-toggle::after { display: none; }

/* Section header (in-panel, not page title) */
.section-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 0;
}
.section-header-title {
  font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em; margin: 0; color: var(--ws-text);
}
.section-header-sub { font-size: 0.8125rem; color: var(--ws-muted); margin: 4px 0 0; line-height: 1.45; }

/* Legacy alias */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 0; }
.page-header-title { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em; margin: 0; color: var(--ws-text); }
.page-header-sub { font-size: 0.8125rem; color: var(--ws-muted); margin: 4px 0 0; max-width: 560px; line-height: 1.45; }

/* Surfaces */
.surface {
  background: var(--ws-surface); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius); box-shadow: var(--ws-shadow);
}
.surface-pad { padding: 22px 24px; }
.surface + .surface { margin-top: 16px; }

/* Setup hub cards */
.setup-grid { display: grid; gap: 10px; }
.setup-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--ws-surface); border: 1px solid var(--ws-border); border-radius: var(--ws-radius-sm);
  text-decoration: none; color: inherit; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.setup-card:hover {
  border-color: #c8dcc0; box-shadow: var(--ws-shadow); transform: translateY(-1px); color: inherit;
}
.setup-card-icon {
  width: 42px; height: 42px; border-radius: 11px; background: var(--ws-brand-soft);
  color: var(--ws-brand); display: grid; place-items: center; font-size: 18px; flex-shrink: 0;
}
.setup-card-body { flex: 1; min-width: 0; }
.setup-card-body b { display: block; font-size: 14px; font-weight: 650; }
.setup-card-body small { display: block; font-size: 12px; color: var(--ws-muted); margin-top: 3px; line-height: 1.4; }
.setup-card-body em { display: inline-block; font-style: normal; font-size: 10px; font-weight: 700;
  color: var(--ws-accent); margin-top: 6px; background: #edf6e8; padding: 3px 8px; border-radius: 999px; }
.setup-card-arrow { color: #a8b5ae; font-size: 14px; }

/* Stat cards — premium metrics with watermark icons */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px;
}
.stat-card {
  position: relative; overflow: hidden;
  background: var(--ws-surface); border: 1px solid var(--ws-border); border-radius: var(--ws-radius);
  padding: 22px 24px; box-shadow: var(--ws-shadow);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.stat-card:hover {
  border-color: #c8dcc0; box-shadow: 0 2px 4px rgba(20, 33, 29, 0.05), 0 12px 32px rgba(20, 33, 29, 0.06);
  transform: translateY(-1px);
}
.stat-card-icon {
  position: absolute; right: 16px; top: 14px;
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; opacity: 0.9;
}
.stat-card-icon.mint { background: #e7f2e3; color: #6a9a5e; }
.stat-card-icon.blue { background: #e8f1ff; color: #6b8fc4; }
.stat-card-icon.amber { background: #fff3dd; color: #c4923f; }
.stat-card-icon.coral { background: #ffebe5; color: #c97a62; }
.stat-card-icon.teal { background: #e0f3ee; color: #3d8a72; }
.stat-card-icon.violet { background: #ece7ff; color: #7a6bb8; }
.stat-card-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.07em; color: var(--ws-muted);
  margin: 0 0 10px; padding-right: 48px;
}
.stat-card-value {
  font-size: 2rem; font-weight: 700; letter-spacing: -0.04em; margin: 0; line-height: 1.1;
  color: var(--ws-text);
}
.stat-card-hint { display: block; font-size: 11px; color: var(--ws-muted); margin-top: 6px; }

/* Legacy metric row */
.metric-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px;
}
.metric-tile {
  background: var(--ws-surface); border: 1px solid var(--ws-border); border-radius: var(--ws-radius-sm);
  padding: 18px 20px;
}
.metric-tile span { display: block; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; color: var(--ws-muted); }
.metric-tile strong { display: block; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.04em; margin: 6px 0 2px; }
.metric-tile small { font-size: 11px; color: var(--ws-muted); }

/* Activity timeline — WhatsApp-inspired flow */
.timeline {
  list-style: none; margin: 0; padding: 8px 0;
}
.timeline-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 20px; text-decoration: none; color: inherit;
  transition: background 0.12s;
}
.timeline-item:hover { background: #fafcfb; color: inherit; }
.timeline-item.clickable { cursor: pointer; }
.timeline-rail {
  display: flex; flex-direction: column; align-items: center;
  width: 8px; flex-shrink: 0; padding-top: 14px;
}
.timeline-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.timeline-dot.mint { background: #82ae76; }
.timeline-dot.violet { background: #9b8fd4; }
.timeline-dot.coral { background: #d98c76; }
.timeline-dot.gold { background: #d7a55d; }
.timeline-dot.teal { background: #4da88a; }
.timeline-dot.blue { background: #739bd1; }
.timeline-dot.slate { background: #8a959e; }
.timeline-dot.rose { background: #c97a88; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-bubble {
  background: #f0f4f2; border-radius: 0 14px 14px 14px;
  padding: 12px 16px; max-width: 100%;
}
.timeline-bubble b { font-size: 13px; font-weight: 650; color: var(--ws-brand); }
.timeline-summary { display: block; font-size: 13px; font-weight: 500; color: var(--ws-text); margin-top: 2px; line-height: 1.45; }
.timeline-detail { display: block; font-size: 11px; color: var(--ws-muted); margin-top: 4px; }
.timeline-meta {
  display: flex; align-items: center; gap: 8px; margin-top: 6px; padding-left: 4px;
}
.timeline-meta time { font-size: 10px; color: #94a099; font-weight: 600; }

/* Approval cards — compact inbox */
.approval-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px;
  border-bottom: 1px solid var(--ws-border-soft); text-decoration: none; color: inherit;
  transition: background 0.12s;
}
.approval-card:last-child { border-bottom: 0; }
.approval-card:hover { background: #fff8ee; color: inherit; }
.approval-card-body { flex: 1; min-width: 0; }
.approval-card-body b { display: block; font-size: 14px; font-weight: 600; }
.approval-card-body small { display: block; font-size: 12px; color: var(--ws-muted); margin-top: 3px; }

/* Row list — rich list rows with avatars & accents */
.row-list { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px;
  border-bottom: 1px solid var(--ws-border-soft); text-decoration: none; color: inherit;
  transition: background 0.12s, padding-left 0.12s;
  position: relative;
}
.row-item::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: transparent; transition: background 0.15s;
}
.row-item:hover { background: #fafcfb; color: inherit; padding-left: 22px; }
.row-item:hover::before { background: var(--ws-accent); }
.row-item:last-child { border-bottom: 0; }
.row-item-info { flex: 1; min-width: 0; }
.row-item-info b { display: block; font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.row-item-info small { display: block; font-size: 12px; color: var(--ws-muted); margin-top: 3px; }
.row-item-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.row-item-count {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; color: var(--ws-muted);
  background: #f0f4f2; padding: 5px 9px; border-radius: 999px;
}
.row-item-count i { font-size: 11px; color: var(--ws-accent); }

/* Icon tiles — rounded squares for dept/tools */
.icon-tile {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  font-size: 17px; flex-shrink: 0;
}
.icon-tile.sm { width: 34px; height: 34px; font-size: 15px; border-radius: 9px; }
.icon-tile.mint { background: #e7f2e3; color: #4d7a42; }
.icon-tile.violet { background: #ece7ff; color: #6f5eb8; }
.icon-tile.coral { background: #ffe8e2; color: #b85f4d; }
.icon-tile.gold { background: #fff0d1; color: #9b6e16; }
.icon-tile.teal { background: #e0f3ee; color: #2f7560; }
.icon-tile.blue { background: #e8f1ff; color: #4f74a8; }
.icon-tile.slate { background: #eef1f3; color: #5a6670; }
.icon-tile.rose { background: #fdeef0; color: #a64d5c; }

/* Mini stat strip — compact page summary */
.mini-stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px;
}
.mini-stat {
  display: flex; align-items: center; gap: 12px;
  background: var(--ws-surface); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-sm); padding: 14px 16px; box-shadow: var(--ws-shadow);
}
.mini-stat-icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-size: 16px; flex-shrink: 0;
}
.mini-stat-icon.mint { background: #e7f2e3; color: #4d7a42; }
.mini-stat-icon.blue { background: #e8f1ff; color: #4f74a8; }
.mini-stat-icon.amber { background: #fff3dd; color: #c4923f; }
.mini-stat-icon.teal { background: #e0f3ee; color: #2f7560; }
.mini-stat-icon.violet { background: #ece7ff; color: #6f5eb8; }
.mini-stat b { display: block; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.mini-stat small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--ws-muted); margin-top: 2px; text-transform: uppercase; }

/* Department mini cards (dashboard grid strip) */
.dept-strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
  padding: 4px 20px 20px;
}
.dept-chip {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: #fafcfb; border: 1px solid var(--ws-border-soft); border-radius: var(--ws-radius-sm);
  text-decoration: none; color: inherit; transition: border-color 0.15s, background 0.15s;
}
.dept-chip:hover { border-color: #c8dcc0; background: #f4f8f5; color: inherit; }
.dept-chip-info { flex: 1; min-width: 0; }
.dept-chip-info b { display: block; font-size: 13px; font-weight: 650; }
.dept-chip-info small { display: block; font-size: 11px; color: var(--ws-muted); margin-top: 2px; }

/* Lists */
.clean-list { list-style: none; margin: 0; padding: 0; }
.clean-list-item {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px;
  border-bottom: 1px solid var(--ws-border-soft); text-decoration: none; color: inherit;
  transition: background 0.12s;
}
.clean-list-item:last-child { border-bottom: 0; }
.clean-list-item:hover { background: #fafcfb; color: inherit; }
.clean-list-item.clickable { cursor: pointer; }
.clean-list-body { flex: 1; min-width: 0; }
.clean-list-body b { display: block; font-size: 14px; font-weight: 600; }
.clean-list-body small { display: block; font-size: 12px; color: var(--ws-muted); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clean-list-meta { text-align: right; flex-shrink: 0; }
.clean-list-meta time { display: block; font-size: 11px; color: #94a099; }

/* Avatars & badges */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.avatar.sm { width: 34px; height: 34px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; font-size: 16px; }
.avatar.violet { background: #ece7ff; color: #6f5eb8; }
.avatar.coral { background: #ffe8e2; color: #b85f4d; }
.avatar.gold { background: #fff0d1; color: #9b6e16; }
.avatar.mint { background: #e7f2e3; color: #4d7a42; }
.avatar.teal { background: #e0f3ee; color: #2f7560; }
.avatar.blue { background: #e8f1ff; color: #4f74a8; }
.avatar.slate { background: #eef1f3; color: #5a6670; }
.avatar.rose { background: #fdeef0; color: #a64d5c; }

.status-badge {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap;
}
.status-badge.working { background: #e7f4d6; color: #568338; }
.status-badge.review { background: #fff0d2; color: #9a711a; }
.status-badge.complete { background: #ececff; color: #595e97; }
.status-badge.connected { background: #e9f5e6; color: #477b39; }
.status-badge.disconnected { background: #f3f4f3; color: #69776f; }
.status-badge.pending { background: #fff0d1; color: #9b6e16; }
.status-badge.clear { background: #e9f5e6; color: #477b39; }
.status-badge.alert { background: #ffebe5; color: #b85f4d; }

/* Grid cards — elevated entity cards */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.entity-card {
  background: var(--ws-surface); border: 1px solid var(--ws-border); border-radius: var(--ws-radius);
  padding: 22px; text-decoration: none; color: inherit; display: block;
  box-shadow: var(--ws-shadow);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.entity-card:hover {
  border-color: #c8dcc0;
  box-shadow: 0 2px 4px rgba(20, 33, 29, 0.05), 0 12px 32px rgba(20, 33, 29, 0.06);
  transform: translateY(-2px); color: inherit;
}
.entity-card h3 { font-size: 15px; font-weight: 650; margin: 14px 0 4px; letter-spacing: -0.02em; }
.entity-card p { font-size: 12px; color: var(--ws-muted); margin: 0; line-height: 1.45; }
.entity-card .card-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; align-items: center; }

/* Forms — minimal */
.form-panel { max-width: 520px; }
.form-panel label {
  display: grid; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--ws-muted); margin-bottom: 14px;
}
.form-panel input, .form-panel select, .form-panel textarea {
  border: 1px solid var(--ws-border); border-radius: 9px; padding: 10px 12px;
  font-size: 14px; color: var(--ws-text);
}
.form-panel textarea { min-height: 88px; resize: vertical; }

/* Filters — clean inline bar */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px;
  padding: 16px 20px; background: var(--ws-surface);
  border: 1px solid var(--ws-border); border-radius: var(--ws-radius);
  box-shadow: var(--ws-shadow);
}
.filter-bar select, .filter-bar input[type="search"], .filter-bar input[type="text"] {
  border: 1px solid var(--ws-border); border-radius: 999px; padding: 8px 16px;
  font-size: 12px; font-weight: 600; color: var(--ws-text); background: #fafcfb;
  min-width: 140px;
}
.filter-bar select:focus, .filter-bar input:focus {
  outline: none; border-color: var(--ws-accent); box-shadow: 0 0 0 3px rgba(92, 154, 72, 0.12);
}
.filter-bar .btn-clear {
  margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ws-muted);
  text-decoration: none; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--ws-border); background: var(--ws-surface);
  transition: background 0.12s;
}
.filter-bar .btn-clear:hover { background: #f0f4f2; color: var(--ws-text); }

/* Empty state */
.empty-state { padding: 56px 24px; text-align: center; }
.empty-state i { font-size: 32px; color: var(--ws-accent); margin-bottom: 14px; display: block; opacity: 0.85; }
.empty-state h3 { font-size: 16px; font-weight: 650; margin: 0 0 6px; }
.empty-state p { font-size: 13px; color: var(--ws-muted); margin: 0 0 16px; max-width: 360px; margin-inline: auto; }

/* Approval detail */
.approval-layout { max-width: 720px; }
.approval-artifact {
  margin-top: 16px; padding: 18px; background: #f8faf9; border: 1px solid var(--ws-border-soft);
  border-radius: var(--ws-radius-sm); font-family: ui-monospace, Consolas, monospace;
  font-size: 12px; white-space: pre-wrap; color: #34443b; line-height: 1.55;
}
.approval-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* Agent inbox — WhatsApp-style agent workspace */
.agent-inbox-shell {
  display: grid; grid-template-columns: 280px 1fr; min-height: 560px;
  background: var(--ws-surface); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius); overflow: hidden; box-shadow: var(--ws-shadow);
}
.agent-inbox-nav {
  border-right: 1px solid var(--ws-border-soft); background: #f0f2f1;
  overflow-y: auto; padding: 12px 10px;
}
.agent-inbox-profile {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 16px; margin-bottom: 4px;
}
.agent-inbox-profile b { display: block; font-size: 14px; font-weight: 650; }
.agent-inbox-profile small { display: block; font-size: 11px; color: var(--ws-muted); margin-top: 2px; }
.agent-inbox-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; color: var(--ws-muted);
  margin: 14px 10px 6px; padding-left: 2px;
}
.agent-inbox-hint {
  font-size: 10px; color: #8696a0; margin: 0 10px 8px; line-height: 1.4; padding-left: 2px;
}
.agent-inbox-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px; text-decoration: none; color: inherit;
  margin-bottom: 2px; transition: background 0.12s;
}
.agent-inbox-link span { flex: 1; min-width: 0; }
.agent-inbox-link b { display: block; font-size: 13px; font-weight: 650; }
.agent-inbox-link small { display: block; font-size: 10px; color: var(--ws-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-inbox-link.active { background: var(--ws-brand-soft); }
.agent-inbox-link.active b { color: var(--ws-brand); }
.agent-inbox-link:hover:not(.active):not(.muted) { background: #e8ece9; }
.agent-inbox-link.muted { opacity: 0.55; }
.agent-inbox-link.muted:hover { opacity: 0.75; background: #e8ece9; }
.agent-inbox-check { color: var(--ws-accent); font-size: 14px; flex-shrink: 0; }

.agent-inbox-main { display: flex; flex-direction: column; background: #e8ece9; min-width: 0; }
.agent-inbox-header {
  padding: 14px 20px; background: #f0f2f1; border-bottom: 1px solid var(--ws-border-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.agent-inbox-header b { display: block; font-size: 15px; font-weight: 650; }
.agent-inbox-header small { display: block; font-size: 11px; color: var(--ws-muted); margin-top: 2px; }
.agent-inbox-body { flex: 1; padding: 20px 24px; overflow-y: auto; }

.inbox-message-thread { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.inbox-system-note {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; background: #fff; border-radius: 10px;
  font-size: 12px; color: #54635a; line-height: 1.5;
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}
.inbox-system-note i { color: var(--ws-accent); font-size: 14px; margin-top: 1px; flex-shrink: 0; }
.inbox-system-note.success i { color: #477b39; }
.inbox-prompt-bubble { max-width: 100%; }
.inbox-prompt-display {
  margin: 8px 0 0; font-family: inherit; font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; color: var(--ws-text); background: transparent; border: 0; padding: 0;
}
.inbox-tool-detail {
  background: #fff; border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}
.inbox-tool-detail p { margin: 0; font-size: 13px; line-height: 1.55; color: #4a5a52; }
.inbox-tool-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.agent-manage-form { max-width: 640px; }
.inbox-panel {
  background: #fff; border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}
.inbox-field-label {
  display: block; font-size: 10px; font-weight: 800; letter-spacing: 0.07em;
  color: var(--ws-muted); margin-bottom: 10px;
}
.inbox-field-hint { font-size: 11px; color: var(--ws-muted); margin: 8px 0 0; line-height: 1.45; }
.inbox-prompt-input {
  width: 100%; border: 1px solid var(--ws-border); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; line-height: 1.55; resize: vertical; min-height: 180px;
  font-family: inherit; color: var(--ws-text);
}
.inbox-prompt-input:focus { outline: none; border-color: var(--ws-accent); box-shadow: 0 0 0 3px rgba(92,154,72,0.12); }
.tool-toggle-list { display: flex; flex-direction: column; gap: 8px; }
.tool-toggle-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--ws-border-soft); border-radius: 10px;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.tool-toggle-item:hover { background: #fafcfb; border-color: var(--ws-border); }
.tool-toggle-item input { margin-top: 12px; flex-shrink: 0; accent-color: var(--ws-brand); }
.tool-toggle-item span { flex: 1; min-width: 0; }
.tool-toggle-item b { display: block; font-size: 13px; font-weight: 650; }
.tool-toggle-item small { display: block; font-size: 11px; color: var(--ws-muted); margin-top: 3px; line-height: 1.4; }
.inbox-panel-actions { display: flex; gap: 10px; margin-top: 16px; }

/* Legacy agent detail */
.detail-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 24px;
  padding: 20px 24px; background: var(--ws-surface);
  border: 1px solid var(--ws-border); border-radius: var(--ws-radius); box-shadow: var(--ws-shadow);
}
.detail-header h2 { font-size: 1.4rem; font-weight: 650; margin: 0; letter-spacing: -0.03em; }
.detail-header .avatar.lg { width: 56px; height: 56px; font-size: 18px; box-shadow: 0 2px 8px rgba(20,33,29,0.08); }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.detail-stat {
  position: relative; overflow: hidden;
  padding: 18px 20px; background: var(--ws-surface);
  border: 1px solid var(--ws-border); border-radius: var(--ws-radius-sm); box-shadow: var(--ws-shadow);
}
.detail-stat span { font-size: 10px; font-weight: 800; letter-spacing: 0.06em; color: var(--ws-muted); }
.detail-stat b { display: block; font-size: 1.25rem; font-weight: 700; margin-top: 6px; letter-spacing: -0.03em; }
.tool-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  border-bottom: 1px solid var(--ws-border-soft);
}
.tool-row:last-child { border-bottom: 0; }

/* Channels — WhatsApp-style chat */
.channel-shell {
  display: grid; grid-template-columns: 260px 1fr; min-height: 520px;
  background: var(--ws-surface); border: 1px solid var(--ws-border); border-radius: var(--ws-radius);
  overflow: hidden; box-shadow: var(--ws-shadow);
}
.channel-nav {
  border-right: 1px solid var(--ws-border-soft); padding: 12px 10px;
  background: #f0f2f1; overflow-y: auto;
}
.channel-nav-header {
  padding: 8px 10px 14px; font-size: 15px; font-weight: 650; color: var(--ws-text);
  letter-spacing: -0.02em;
}
.channel-nav-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; color: var(--ws-muted);
  margin: 14px 10px 6px; padding-left: 2px;
}
.channel-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px; text-decoration: none;
  color: var(--ws-text); font-size: 14px; font-weight: 600; margin-bottom: 2px;
  transition: background 0.12s;
}
.channel-nav a::before {
  content: '#'; color: var(--ws-muted); font-weight: 500;
}
.channel-nav a.active { background: var(--ws-brand-soft); color: var(--ws-brand); }
.channel-nav a:hover:not(.active) { background: #e8ece9; }
.channel-main { display: flex; flex-direction: column; background: #e8ece9; }
.channel-header {
  padding: 14px 20px; background: #f0f2f1; border-bottom: 1px solid var(--ws-border-soft);
  display: flex; align-items: center; gap: 12px;
}
.channel-header-info b { display: block; font-size: 14px; font-weight: 650; }
.channel-header-info small { font-size: 11px; color: var(--ws-muted); }
.channel-messages {
  flex: 1; padding: 20px 24px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.chat-msg { display: flex; gap: 8px; max-width: 78%; margin-bottom: 6px; }
.chat-msg.incoming { align-self: flex-start; }
.chat-msg.outgoing { align-self: flex-end; flex-direction: row-reverse; }
.chat-bubble {
  padding: 10px 14px; border-radius: 0 12px 12px 12px;
  background: var(--ws-surface); box-shadow: 0 1px 1px rgba(0,0,0,0.06);
  font-size: 13px; line-height: 1.5; color: var(--ws-text);
}
.chat-msg.outgoing .chat-bubble {
  background: #d9fdd3; border-radius: 12px 0 12px 12px;
}
.chat-bubble b { font-size: 12px; font-weight: 650; color: var(--ws-brand); display: block; margin-bottom: 2px; }
.chat-bubble p { margin: 0; }
.chat-time { font-size: 10px; color: #8696a0; align-self: flex-end; margin-bottom: 4px; white-space: nowrap; }
.channel-compose {
  padding: 12px 16px; background: #f0f2f1; border-top: 1px solid var(--ws-border-soft);
}
.channel-compose .input-group {
  background: var(--ws-surface); border-radius: 24px; overflow: hidden;
  border: 1px solid var(--ws-border-soft); padding: 4px 4px 4px 16px;
}
.channel-compose .form-control {
  border: 0; background: transparent; font-size: 14px; box-shadow: none;
}
.channel-compose .form-control:focus { box-shadow: none; }
.channel-compose .btn-primary {
  border-radius: 50%; width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center;
}

/* Legacy msg styles */
.msg { display: flex; gap: 12px; padding: 12px 0; }
.msg + .msg { border-top: 1px solid var(--ws-border-soft); }
.msg-body b { font-size: 13px; }
.msg-body b span { font-weight: 500; color: var(--ws-muted); font-size: 11px; margin-left: 6px; }
.msg-body p { margin: 4px 0 0; font-size: 13px; color: #4a5a52; line-height: 1.5; }

/* Upload zone */
.upload-zone {
  border: 1.5px dashed #cfd8d2; border-radius: var(--ws-radius-sm); padding: 32px 24px;
  text-align: center; background: #fafcfb;
}
.upload-zone i { font-size: 26px; color: var(--ws-accent); }
.upload-zone p { margin: 10px 0 0; font-size: 13px; color: var(--ws-muted); }

/* Settings sections */
.settings-section + .settings-section { margin-top: 32px; }
.settings-section-title {
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: var(--ws-muted);
  margin: 0 0 12px;
}

/* Hide legacy clutter on dashboard */
.dashboard-grid { display: grid; grid-template-columns: 1.35fr 0.65fr; gap: 16px; }
.dashboard-grid .surface { display: flex; flex-direction: column; }
.dashboard-grid .surface .timeline,
.dashboard-grid .surface .clean-list { flex: 1; }
.alert-banner {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px; margin-bottom: 20px;
  background: linear-gradient(135deg, #fff8ee 0%, #fef3e0 100%);
  border: 1px solid #f0e4c8; border-radius: var(--ws-radius);
  box-shadow: var(--ws-shadow);
}
.alert-banner i { font-size: 22px; color: #b8860b; flex-shrink: 0; }
.alert-banner p { margin: 0; font-size: 13px; color: #5c5345; flex: 1; line-height: 1.45; }
.alert-banner .btn { flex-shrink: 0; border-radius: 999px; font-weight: 600; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-row { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 18px 16px; }
  .stat-card-value { font-size: 1.6rem; }
  .stat-card-icon { width: 44px; height: 44px; font-size: 18px; right: 12px; top: 12px; }
  .metric-row { grid-template-columns: 1fr 1fr; }
  .mini-stat-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .channel-shell { grid-template-columns: 1fr; min-height: 420px; }
  .agent-inbox-shell { grid-template-columns: 1fr; min-height: 480px; }
  .agent-inbox-nav { border-right: 0; border-bottom: 1px solid var(--ws-border-soft); max-height: 220px; }
  .channel-nav { border-right: 0; border-bottom: 1px solid var(--ws-border-soft); max-height: 160px; }
  .page-header, .section-header { flex-direction: column; }
  .dept-strip { grid-template-columns: 1fr; }
}
