:root {
  --xi-accent: #E85C00;
  --xi-accent-rgb: 232, 92, 0;
  --xi-orange-light: #FFF0E5;
  --xi-orange-dark: #B34300;

  --xi-body-bg: #f8f9fb;
  --xi-surface: #ffffff;
  --xi-border: #e5e7eb;
  --xi-text: #111827;
  --xi-muted: #6b7280;

  --xi-sidebar-bg: #FFFFFF;
  --xi-sidebar-border: #e5e7eb;
  --xi-sidebar-text: #374151;
  --xi-sidebar-muted: #9ca3af;
  --xi-sidebar-hover: #FFF0E5;
  --xi-sidebar-active: #E85C00;

  --bs-primary: var(--xi-accent);
  --bs-primary-rgb: var(--xi-accent-rgb);
  --bs-link-color: var(--xi-accent);
  --bs-link-hover-color: var(--xi-orange-dark);
}

html, body { height: 100%; }
body { font-size: 14px; background: var(--xi-body-bg); color: var(--xi-text); }
a { text-decoration: none; }

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--xi-sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1030;
  border-right: 1px solid var(--xi-sidebar-border);
  transition: width .22s ease;
  display: flex;
  flex-direction: column;
}
.sidebar .brand, .xi-sidebar .brand { padding: 1rem 1.25rem; border-bottom: 1px solid var(--xi-sidebar-border); }
.sidebar .brand .brand-title, .xi-sidebar .brand-title { font-size: 14px; font-weight: 700; color: #111827; letter-spacing: .02em; }
.sidebar .brand .brand-sub, .xi-sidebar .brand-sub { display: block; font-size: 11px; color: var(--xi-sidebar-muted); }
.sidebar .brand { overflow: hidden; }
.sidebar .brand .xi-brand-lockup { min-width: 0; }
.sidebar .brand .xi-brand-text { min-width: 0; }
.sidebar .nav-link, .xi-sidebar .nav-link {
  color: var(--xi-sidebar-text);
  padding: .5rem 1rem;
  border-radius: 8px;
  margin: 1px .65rem;
  font-size: 13px;
  position: relative;
  transition: background .15s ease, color .15s ease;
}
.sidebar .nav-link:hover, .xi-sidebar .nav-link:hover { color: var(--xi-orange-dark); background: var(--xi-sidebar-hover); }
.sidebar .nav-link.active, .xi-sidebar .nav-link.active {
  color: var(--xi-orange-dark);
  background: var(--xi-orange-light);
  font-weight: 600;
  box-shadow: none;
}
.sidebar .nav-link.active::before, .xi-sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 2px;
  background: var(--xi-accent);
}
.sidebar .nav-link i, .xi-sidebar .nav-link i { width: 20px; margin-right: 8px; font-size: 14px; }
.sidebar .nav-section, .xi-sidebar .nav-section {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--xi-sidebar-muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin: 1.1rem .75rem .3rem;
  padding: 0 0 .25rem;
  border-bottom: 1px solid var(--xi-sidebar-border);
}
.sidebar nav, .xi-sidebar nav {
  overflow-y: auto;
  flex-basis: 0;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--xi-sidebar-border) transparent;
}
.sidebar nav::-webkit-scrollbar, .xi-sidebar nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar nav::-webkit-scrollbar-track, .xi-sidebar nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar nav::-webkit-scrollbar-thumb, .xi-sidebar nav::-webkit-scrollbar-thumb {
  background: var(--xi-sidebar-border);
  border-radius: 4px;
}
.sidebar .xi-sidebar-footer, .xi-sidebar .xi-sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--xi-sidebar-border);
}
.user-area {
  display: flex;
  align-items: center;
  padding: .65rem .75rem .65rem 1rem;
  gap: 6px;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background .15s ease;
  text-decoration: none;
  color: inherit;
}
.user-card--trigger {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
}
.user-card:hover,
.show > .user-card--trigger {
  background: var(--xi-sidebar-hover);
}
.user-card__chevron {
  margin-left: auto;
  color: var(--xi-sidebar-muted);
  font-size: 13px;
  flex-shrink: 0;
  transition: transform .18s ease;
}
.show > .user-card--trigger .user-card__chevron,
.user-area .show + .user-card__chevron {
  transform: rotate(180deg);
}
.user-avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.user-avatar-text {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--xi-orange-dark);
  background: var(--xi-orange-light);
  border: 1px solid rgba(var(--xi-accent-rgb), .18);
  flex-shrink: 0;
}
.user-info {
  min-width: 0;
  overflow: hidden;
}
.user-info .user-name {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .user-role {
  font-size: 10px;
  color: var(--xi-sidebar-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-dropdown-menu {
  width: min(260px, calc(100vw - 32px));
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .10);
  overflow: hidden;
  margin-bottom: 6px !important;
}
.account-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--xi-border);
  color: inherit;
  cursor: pointer;
  transition: background .15s ease;
}
.account-dropdown-header:hover {
  background: rgba(var(--xi-accent-rgb), .04);
}
.account-dropdown-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--xi-orange-dark);
  background: var(--xi-orange-light);
  border: 1px solid rgba(var(--xi-accent-rgb), .18);
  flex-shrink: 0;
  overflow: hidden;
}
.account-dropdown-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.account-dropdown-header-body {
  min-width: 0;
  flex: 1;
}
.account-dropdown-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--xi-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-dropdown-subtitle {
  font-size: 11px;
  color: var(--xi-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-dropdown-links {
  padding: 6px;
}
.account-dropdown-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--xi-text);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s ease;
}
.account-dropdown-link i {
  color: var(--xi-orange-dark);
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.account-dropdown-link:hover {
  background: rgba(var(--xi-accent-rgb), .07);
}
.account-dropdown-section-title {
  padding: 8px 14px 6px;
  border-top: 1px solid var(--xi-border);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--xi-muted);
}
.account-dropdown-theme {
  padding: 0 10px 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.account-theme-btn {
  border: 1px solid var(--xi-border);
  background: var(--xi-surface);
  border-radius: 8px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--xi-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 0 6px;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.account-theme-btn i {
  font-size: 14px;
}
.account-theme-btn.is-active {
  border-color: rgba(var(--xi-accent-rgb), .30);
  background: rgba(var(--xi-accent-rgb), .08);
  color: var(--xi-orange-dark);
}
.account-theme-btn:hover {
  border-color: rgba(var(--xi-accent-rgb), .20);
  background: rgba(var(--xi-accent-rgb), .04);
}
.account-dropdown-footer {
  border-top: 1px solid var(--xi-border);
}
.account-dropdown-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: #dc2626;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s ease;
}
.account-dropdown-logout i {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.account-dropdown-logout:hover {
  background: rgba(220, 38, 38, .06);
}
.xi-collapse-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: .55rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--xi-sidebar-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  border-top: 1px solid var(--xi-sidebar-border);
}
.xi-collapse-toggle:hover {
  background: var(--xi-sidebar-hover);
  color: var(--xi-sidebar-text);
}
.xi-collapse-toggle i {
  font-size: 13px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: transform .22s ease;
}
.xi-collapse-label {
  white-space: nowrap;
  overflow: hidden;
}

.main { margin-left: 240px; min-height: 100vh; transition: margin-left .22s ease; }
.topbar { background: var(--xi-surface); border-bottom: 1px solid var(--xi-border); padding: .75rem 1.25rem; }
.content { padding: 1.25rem; }
.stat-card { background: var(--xi-surface); border: 1px solid var(--xi-border); border-radius: 12px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.04); transition: box-shadow .2s ease, transform .2s ease; }
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--xi-text); }

.stat-card .label { font-size: 12px; color: var(--xi-muted); }

.stat-card p { font-size: .8125rem; color: #334155; line-height: 1.5; margin: 0; }
.xi-card-title { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: rgba(17, 24, 39, .70); margin-bottom: .75rem; }
[data-bs-theme="dark"] .xi-card-title { color: rgba(255, 255, 255, .70); }
.xi-subtitle { font-size: 12px; font-weight: 700; color: rgba(17, 24, 39, .75); margin-bottom: .35rem; }
[data-bs-theme="dark"] .xi-subtitle { color: rgba(255, 255, 255, .75); }

.xi-filterbar { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.xi-filterbar .form-control { border-radius: 10px; }
.xi-filterbar .btn { border-radius: 10px; }

.xi-multi { border-radius: 12px; background: rgba(17, 24, 39, .02); }
[data-bs-theme="dark"] .xi-multi { background: rgba(255, 255, 255, .04); }
.xi-multi option { padding: 6px 10px; }

.xi-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  color: var(--xi-orange-dark);
  background: var(--xi-orange-light);
  border: 1px solid rgba(var(--xi-accent-rgb), .18);
  flex: 0 0 auto;
}

.xi-table-soft thead th { font-size: 12px; color: rgba(17, 24, 39, .70); }
[data-bs-theme="dark"] .xi-table-soft thead th { color: rgba(255, 255, 255, .70); }
.xi-table-soft tbody td { vertical-align: middle; }

.badge-won { background: #dcfce7; color: #15803d; }
.badge-lost { background: #fee2e2; color: #b91c1c; }
.badge-active { background: var(--xi-orange-light); color: var(--xi-orange-dark); }
/* Parked on a manager's desk: amber, to read as "waiting on someone else"
   rather than the orange of .badge-active ("we are working on it"). */
.badge-waiting { background: #fef3c7; color: #b45309; }
[data-bs-theme="dark"] .badge-waiting { background: rgba(245, 158, 11, .20); color: #fbbf24; }
.margin-ok { color: #15803d; font-weight: 600; }
.margin-warn { color: #b91c1c; font-weight: 600; }

.progress { background: rgba(17, 24, 39, .08); }
.progress-bar { background-color: var(--xi-accent); }

.notif-dd-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px;
  margin: 2px 0;
  text-decoration: none;
  color: inherit;
  transition: background .14s ease;
}
.notif-dd-item:hover {
  background: rgba(var(--xi-accent-rgb), .04);
}
.notif-dd-item--unread {
  background: rgba(var(--xi-accent-rgb), .04);
  border-radius: 8px;
}
.notif-dd-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 14px;
}
.notif-dd-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.notif-dd-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--xi-text);
  line-height: 1.3;
}
.notif-dd-item--unread .notif-dd-title {
  font-weight: 700;
}
.notif-dd-text {
  font-size: 11px;
  color: var(--xi-muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-dd-time {
  font-size: 10px;
  color: var(--xi-muted);
  margin-top: 3px;
}
.toast-container { z-index: 2000; }
.text-bg-xi-warning { background-color: var(--xi-accent) !important; color: #fff !important; }

.xi-brand-mark { width: 28px; height: 28px; display: inline-block; }
.xi-brand-lockup { display: flex; align-items: center; gap: .6rem; }
@keyframes xi-spin { to { transform: rotate(360deg); } }
.xi-spin { animation: xi-spin .6s linear; }

@media (max-width: 767.98px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
}

body.xi-sidebar-collapsed .sidebar { width: 72px; }
body.xi-sidebar-collapsed .main { margin-left: 72px; }
body.xi-sidebar-collapsed .sidebar .xi-brand-text { display: none; }
body.xi-sidebar-collapsed .sidebar .nav-section { display: none; }
body.xi-sidebar-collapsed .sidebar .nav-link {
  font-size: 0;
  padding: .5rem 0;
  margin: 1px .55rem;
  justify-content: center;
  border-radius: 8px;
}
body.xi-sidebar-collapsed .sidebar .nav-link i { margin-right: 0; width: auto; font-size: 16px; }
body.xi-sidebar-collapsed .sidebar .xi-sidebar-footer { border-top-color: transparent; }
body.xi-sidebar-collapsed .sidebar .user-area { padding: .65rem 0; justify-content: center; }
body.xi-sidebar-collapsed .sidebar .user-card { padding: 0; justify-content: center; }
body.xi-sidebar-collapsed .sidebar .user-info,
body.xi-sidebar-collapsed .sidebar .user-card__chevron { display: none; }
body.xi-sidebar-collapsed .sidebar .account-dropdown-menu { margin-left: 12px; }
body.xi-sidebar-collapsed .sidebar .user-info { display: none; }
body.xi-sidebar-collapsed .sidebar .user-actions { display: none; }
body.xi-sidebar-collapsed .sidebar .user-avatar-img { width: 32px; height: 32px; border-radius: 8px; }
body.xi-sidebar-collapsed .sidebar .user-avatar-text { width: 32px; height: 32px; border-radius: 8px; font-size: 13px; }
body.xi-sidebar-collapsed .sidebar .xi-collapse-toggle { justify-content: center; padding: .55rem 0; }
body.xi-sidebar-collapsed .sidebar .xi-collapse-toggle i { transform: rotate(180deg); }
body.xi-sidebar-collapsed .sidebar .xi-collapse-label { display: none; }
body.xi-sidebar-collapsed .sidebar .xi-brand-mark { width: 32px; height: 32px; }
body.xi-sidebar-collapsed .sidebar nav { overflow: visible !important; }

body.xi-sidebar-collapsed .sidebar .nav-link { position: relative; z-index: 1; }
body.xi-sidebar-collapsed .sidebar .nav-link::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--xi-orange-dark, #c44900);
  color: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 4px 14px rgba(232, 92, 0, .35);
  transition: opacity .15s ease;
}
body.xi-sidebar-collapsed .sidebar .nav-link:hover::after { opacity: 1; }

[data-bs-theme="dark"] {
  --xi-body-bg: #0b0f1a;
  --xi-surface: #111827;
  --xi-border: rgba(255, 255, 255, .10);
  --xi-text: rgba(255, 255, 255, .92);
  --xi-muted: rgba(255, 255, 255, .62);
}

[data-bs-theme="dark"] .progress { background: rgba(255, 255, 255, .12); }

.contacts-shell .toolbar-card { border: 1px solid var(--xi-border); border-radius: 12px; background: var(--xi-surface); }
.contacts-shell .view-pill { font-size: 12px; border-radius: 999px; padding: .35rem .7rem; border: 1px solid var(--xi-border); color: #4b5563; background: #fff; text-decoration: none; display: inline-block; }
.contacts-shell .view-pill.active { color: #fff; background: var(--xi-accent); border-color: var(--xi-accent); }
.contacts-shell .kpi-chip { border: 1px solid var(--xi-border); border-radius: 10px; padding: .5rem .7rem; background: #fff; min-width: 130px; }
.contacts-shell .kpi-chip .k { font-size: 11px; color: var(--xi-muted); display: block; }
.contacts-shell .kpi-chip .v { font-size: 16px; font-weight: 700; color: #111827; }
.contacts-shell .kpi-link { text-decoration: none; display: inline-block; }
.contacts-shell .kpi-link:hover .kpi-chip { border-color: var(--xi-accent); }
.contacts-shell .contacts-filter-form { border: 1px solid #e5e7eb; border-radius: 16px; background: linear-gradient(180deg, #ffffff, #fafbfc); padding: 14px; box-shadow: 0 10px 24px rgba(15, 23, 42, .04); }
.contacts-shell .contacts-filter-form__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #edf0f3; }
.contacts-shell .contacts-filter-form__eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--xi-orange-dark); }
.contacts-shell .contacts-filter-form__title { margin-top: 4px; font-size: 15px; font-weight: 700; color: #111827; }
.contacts-shell .contacts-filter-form__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.contacts-shell .contacts-filter-grid { display: grid; grid-template-columns: minmax(220px, 1.7fr) repeat(4, minmax(140px, 1fr)); gap: 12px; align-items: end; }
.contacts-shell .contacts-filter-field .form-label { font-size: 12px; font-weight: 600; color: #374151; }
.contacts-shell .contacts-filter-field .form-control,
.contacts-shell .contacts-filter-field .form-select { border-color: #d1d5db; background: #fff; min-height: 38px; border-radius: 10px; box-shadow: inset 0 1px 0 rgba(255,255,255,.5); }
.contacts-shell .contacts-filter-field--search { grid-column: span 1; }
.contacts-shell .contacts-filter-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.contacts-shell .contacts-filter-actions__hint { font-size: 12px; color: #6b7280; }
.contacts-shell .contacts-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; white-space: nowrap; }
.contacts-shell .contacts-table td { vertical-align: middle; font-size: 13px; }
.contacts-shell .table-responsive { border-top: 1px solid #edf0f3; }
.contacts-shell .contacts-table thead th { background: #f8fafc; }
.contacts-shell .contacts-table tbody tr { transition: background-color .16s ease, box-shadow .16s ease; }
.contacts-shell .contacts-table tbody tr:hover { background: #fcfcfd; }
.contacts-shell .source-badge { background: #fff7ed; color: #b45309; border: 1px solid #fed7aa; font-size: 11px; }
.contacts-shell .overdue { color: #b91c1c; font-weight: 600; }
.contacts-shell .due-today { color: #b45309; font-weight: 600; }
.contacts-shell .table-actions a { color: #6b7280; }
.contacts-shell .table-actions a:hover { color: var(--xi-accent); }
.contacts-shell .status-select { width: 170px; }
.contacts-shell .msg-input { width: 260px; }
.contacts-shell .msg-surface { display: flex; flex-direction: column; gap: 4px; width: 260px; min-height: 42px; padding: .5rem .65rem; border: 1px solid rgba(var(--xi-accent-rgb), .14); border-radius: 10px; background: linear-gradient(135deg, rgba(255,240,229,.82), rgba(255,255,255,.98)); text-align: left; color: var(--xi-text); box-shadow: inset 0 1px 0 rgba(255,255,255,.65); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.contacts-shell .msg-surface:hover { border-color: rgba(var(--xi-accent-rgb), .36); background: linear-gradient(135deg, rgba(255,232,214,.98), rgba(255,255,255,1)); box-shadow: 0 10px 24px rgba(232, 92, 0, .08); transform: translateY(-1px); }
.contacts-shell .msg-surface:focus { outline: none; border-color: rgba(var(--xi-accent-rgb), .46); box-shadow: 0 0 0 .2rem rgba(232, 92, 0, .12), 0 12px 30px rgba(232, 92, 0, .10); }
.contacts-shell .msg-surface__text { line-height: 1.4; font-weight: 600; color: #7a2f00; }
.contacts-shell .msg-surface__meta, .contacts-shell .msg-readonly-meta { font-size: 11px; color: #a14a14; }
.contacts-shell .followup-input { width: 150px; }
.contacts-shell .followup-wrap { display: flex; align-items: center; gap: 8px; }
.contacts-shell .contacts-transfer-banner { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid rgba(var(--xi-accent-rgb), .18); border-radius: 14px; background: linear-gradient(135deg, rgba(255,240,229,.95), rgba(255,255,255,.98)); }
.contacts-shell .contacts-transfer-banner__title { font-size: 13px; font-weight: 800; color: var(--xi-text); }
.contacts-shell .contacts-transfer-banner__meta { font-size: 12px; color: var(--xi-muted); margin-top: 3px; }
.contacts-shell .contacts-bulk-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-bottom: 1px solid #e5e7eb; background: linear-gradient(180deg, #fbfcfd, #f5f7fa); }
.contacts-shell .contacts-bulk-toolbar__meta { display: grid; gap: 3px; font-size: 12px; color: #6b7280; }
.contacts-shell .contacts-bulk-toolbar__label { font-size: 13px; font-weight: 700; color: #111827; }
.contacts-shell .contacts-bulk-toolbar__subtext { font-size: 12px; color: #6b7280; }
.contacts-shell .contacts-bulk-toolbar__count { display: inline-flex; align-items: center; width: fit-content; margin-top: 2px; padding: 3px 9px; border-radius: 999px; background: rgba(15, 23, 42, .05); color: #374151; font-weight: 700; }
.contacts-shell .contacts-bulk-toolbar__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.contacts-shell .contacts-bulk-toolbar__group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; }
.contacts-shell .contacts-bulk-toolbar__group--danger { border-color: rgba(220, 38, 38, .16); background: rgba(254, 242, 242, .7); }
.contacts-shell .contacts-bulk-toolbar__actions .form-select { min-width: 190px; background: #fff; border-radius: 10px; }

.contacts-shell--advanced .contacts-advanced-layout { display: block; }
.contacts-shell--advanced .contacts-results-panel { background: transparent; }
.contacts-shell--advanced .contacts-live-panel { border-radius: 16px; }
.contacts-shell--advanced .contacts-live-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--xi-orange-dark); }
.contacts-shell--advanced .contacts-live-count { font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: var(--xi-text); }
.contacts-shell--advanced .contacts-live-meta { font-size: 13px; color: var(--xi-muted); margin-top: 4px; }
.contacts-shell--advanced .contacts-preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.contacts-shell--advanced .contacts-preview-card { border: 1px solid var(--xi-border); border-radius: 14px; padding: 12px; background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,240,229,.45)); }
.contacts-shell--advanced .contacts-preview-card--empty { grid-column: 1 / -1; text-align: center; color: var(--xi-muted); }
.contacts-shell--advanced .contacts-preview-name { font-size: 14px; font-weight: 700; color: var(--xi-text); }
.contacts-shell--advanced .contacts-preview-sub { font-size: 12px; color: var(--xi-muted); margin-top: 2px; }
.contacts-shell--advanced .contacts-preview-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--xi-orange-dark); }
.contacts-shell--advanced .contacts-filter-panel { border: 1px solid var(--xi-border); border-radius: 16px; background: var(--xi-surface); padding: 14px; box-shadow: 0 14px 40px rgba(15, 23, 42, .04); }
.contacts-shell--advanced .contacts-selection-meta { font-size: 12px; color: var(--xi-orange-dark); font-weight: 700; margin-top: 4px; }
.contacts-shell--advanced .contacts-filter-section + .contacts-filter-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--xi-border); }
.contacts-shell--advanced .contacts-filter-section__title { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--xi-muted); margin-bottom: 10px; }
.contacts-shell--advanced .contacts-filter-presets { display: grid; gap: 10px; }
.contacts-shell--advanced .contacts-filter-presets__actions,
.contacts-shell--advanced .contacts-filter-presets__save { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contacts-shell--advanced .contacts-filter-presets__save { grid-template-columns: minmax(0, 1fr) auto; }
.contacts-shell--advanced .contacts-filter-logic { padding: 10px; border: 1px solid var(--xi-border); border-radius: 12px; background: rgba(255,240,229,.35); }
.contacts-shell--advanced .contacts-filter-groups { display: grid; gap: 10px; }
.contacts-shell--advanced .contacts-rule-group { border: 1px solid var(--xi-border); border-radius: 14px; padding: 12px; background: #fff; transition: border-color .18s ease, box-shadow .18s ease; }
.contacts-shell--advanced .contacts-rule-group.is-active { border-color: rgba(var(--xi-accent-rgb), .45); box-shadow: 0 0 0 3px rgba(var(--xi-accent-rgb), .09); }
.contacts-shell--advanced .contacts-rule-group__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.contacts-shell--advanced .contacts-rule-group__title { border: none; background: none; padding: 0; font-size: 13px; font-weight: 700; color: var(--xi-text); }
.contacts-shell--advanced .contacts-rule-list { display: grid; gap: 10px; }
.contacts-shell--advanced .contacts-rule-row { border: 1px solid var(--xi-border); border-radius: 12px; padding: 10px; background: rgba(248,249,251,.9); }
.contacts-shell--advanced .contacts-rule-row__top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .85fr) auto; gap: 8px; align-items: center; }
.contacts-shell--advanced .contacts-rule-row__value { margin-top: 8px; }
.contacts-shell--advanced .contacts-rule-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contacts-shell--advanced .contacts-rule-empty { font-size: 12px; color: var(--xi-muted); padding: 10px; border: 1px dashed var(--xi-border); border-radius: 12px; text-align: center; }
.contacts-shell--advanced .contacts-filter-category + .contacts-filter-category { margin-top: 10px; }
.contacts-shell--advanced .contacts-filter-category__toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--xi-border); border-radius: 12px; background: #fff; padding: 10px 12px; font-size: 13px; font-weight: 700; color: var(--xi-text); }
.contacts-shell--advanced .contacts-filter-category__toggle.is-open i { transform: rotate(180deg); }
.contacts-shell--advanced .contacts-filter-category__body { display: none; padding: 10px 2px 0; }
.contacts-shell--advanced .contacts-filter-category__body.is-open { display: block; }
.contacts-shell--advanced .contacts-filter-category__copy { font-size: 12px; color: var(--xi-muted); margin-bottom: 10px; }
.contacts-shell--advanced .contacts-filter-chipset { display: flex; flex-wrap: wrap; gap: 8px; }
.contacts-shell--advanced .contacts-filter-chip { border: 1px solid rgba(var(--xi-accent-rgb), .18); border-radius: 999px; padding: 6px 10px; background: rgba(255,240,229,.7); color: var(--xi-orange-dark); font-size: 12px; font-weight: 600; }
.contacts-shell--advanced .contacts-hint { font-size: 11px; color: var(--xi-muted); margin-top: 5px; }
.contacts-shell--advanced .contacts-empty-state { padding: 26px 18px; text-align: center; font-size: 13px; color: var(--xi-muted); border-top: 1px solid var(--xi-border); }
.contacts-shell--advanced .contacts-pagination { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 14px 16px; border-top: 1px solid var(--xi-border); }
.contacts-shell--advanced .contacts-advanced-table th { white-space: nowrap; }
.contacts-shell--advanced .contacts-score-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; padding: 4px 10px; border-radius: 999px; background: rgba(232,92,0,.1); color: var(--xi-orange-dark); font-size: 12px; font-weight: 700; }

@media (max-width: 1199.98px) {
  .contacts-shell--advanced .contacts-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 991.98px) {
  .contacts-shell--advanced .contacts-advanced-layout { grid-template-columns: 1fr; }
  .contacts-shell--advanced .contacts-rule-row__top { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
  .contacts-shell .contacts-transfer-banner { align-items: flex-start; flex-direction: column; }
  .contacts-shell .contacts-filter-grid { grid-template-columns: 1fr; }
  .contacts-shell .contacts-filter-form__head { align-items: flex-start; }
  .contacts-shell .contacts-filter-form__actions { width: 100%; }
  .contacts-shell .contacts-filter-form__actions .btn { width: 100%; }
  .contacts-shell .contacts-filter-actions { width: 100%; }
  .contacts-shell .contacts-filter-actions .btn { width: 100%; }
  .contacts-shell .contacts-bulk-toolbar { align-items: flex-start; }
  .contacts-shell .contacts-bulk-toolbar__actions { width: 100%; }
  .contacts-shell .contacts-bulk-toolbar__group { width: 100%; }
  .contacts-shell .contacts-bulk-toolbar__actions .form-select,
  .contacts-shell .contacts-bulk-toolbar__actions .btn { width: 100%; }
  .contacts-shell--advanced .contacts-preview-grid { grid-template-columns: 1fr; }
  .contacts-shell--advanced .contacts-live-count { font-size: 22px; }
  .contacts-shell--advanced .contacts-filter-presets__actions,
  .contacts-shell--advanced .contacts-filter-presets__save,
  .contacts-shell--advanced .contacts-rule-range { grid-template-columns: 1fr; }
}

.xi-msg-meta { margin-top: 12px; border: 1px solid rgba(var(--xi-accent-rgb), .14); border-radius: 12px; padding: 10px 12px; background: linear-gradient(135deg, rgba(255,240,229,.72), rgba(255,255,255,.98)); }

/* Attachment chips (message detail) */
.xi-att-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  border: 1px solid var(--xi-border); border-radius: 9px;
  background: var(--xi-body-bg); padding: .3rem .6rem;
  font-size: .74rem; color: var(--xi-text); max-width: 240px;
  transition: border-color .15s ease, background .15s ease;
}
.xi-att-chip:hover { border-color: var(--xi-accent); background: var(--xi-orange-light); text-decoration: none; }
.xi-att-chip i.bi { color: var(--xi-accent); }
.xi-att-chip__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xi-att-chip__size { color: var(--xi-muted); font-size: .66rem; white-space: nowrap; }
[data-bs-theme="dark"] .xi-msg-meta { background: rgba(255,255,255,.03); }
.xi-msg-meta__label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--xi-muted); margin-bottom: 4px; }
.xi-msg-meta__value { font-size: 13px; color: #7a2f00; font-weight: 600; }

.companies-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; white-space: nowrap; }
.companies-table td { vertical-align: middle; font-size: 13px; }
.companies-table .table-actions a { color: #6b7280; }
.companies-table .table-actions a:hover { color: var(--xi-accent); }

.co-shell .co-meta { font-size: 13px; }
.co-shell .co-meta dt { color: var(--xi-muted); font-weight: 600; }
.co-shell .co-meta dd { margin-bottom: .5rem; }
.co-shell .co-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.co-shell .activity-item { border: 1px solid var(--xi-border); border-radius: 12px; padding: 12px; background: #fff; }
.co-shell .activity-item .meta { font-size: 12px; color: #6b7280; }
.co-shell .activity-item .subject { font-weight: 700; font-size: 13px; }
.co-shell .activity-item .notes { font-size: 13px; color: #111827; white-space: pre-wrap; }
.co-shell .list-mini td { font-size: 13px; vertical-align: middle; }
.co-shell .list-mini th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; white-space: nowrap; }

.hs-shell { --hs-line: rgba(17, 24, 39, .10); --hs-muted: rgba(17, 24, 39, .60); }
[data-bs-theme="dark"] .hs-shell { --hs-line: rgba(255, 255, 255, .10); --hs-muted: rgba(255, 255, 255, .65); }
.hs-card { border: 1px solid var(--hs-line); border-radius: 12px; background: var(--xi-surface); }
.hs-head { display:flex; justify-content:space-between; align-items:center; gap:12px; padding: 14px 16px; border-bottom: 1px solid var(--hs-line); }
.hs-sub { font-size: 12px; color: var(--hs-muted); }
.hs-stream { padding: 12px 16px 16px; }
.hs-event { border: 1px solid rgba(var(--xi-accent-rgb), .12); border-left: 4px solid rgba(var(--xi-accent-rgb), .75); border-radius: 14px; padding: 12px 12px; background: linear-gradient(135deg, rgba(255,244,236,.95), rgba(255,255,255,.98)); box-shadow: 0 10px 24px rgba(15, 23, 42, .04); }
[data-bs-theme="dark"] .hs-event { background: rgba(255,255,255,.03); }
.hs-event + .hs-event { margin-top: 10px; }
.hs-meta { display:flex; justify-content:space-between; gap:10px; font-size: 12px; color: #9a5b2b; }
.hs-meta .who { color: #7a2f00; font-weight: 700; }
.hs-body { margin-top: 8px; font-size: 13px; color: #4a2a17; white-space: pre-wrap; line-height: 1.5; }
.hs-side { padding: 14px 16px 16px; }
.hs-side h6 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--hs-muted); margin-bottom: 10px; }
.hs-item { border: 1px dashed var(--hs-line); border-radius: 12px; padding: 10px 10px; }
.hs-item + .hs-item { margin-top: 10px; }
.hs-item a { text-decoration: none; }
.hs-shell--detail .hs-title { display:flex; align-items:center; gap:10px; }
.hs-shell--detail .hs-avatar { width:34px; height:34px; border-radius:999px; background: radial-gradient(120% 120% at 20% 20%, rgba(232, 92, 0, .18), rgba(232, 92, 0, .04)); border: 1px solid rgba(232, 92, 0, .22); display:flex; align-items:center; justify-content:center; color: var(--xi-accent); }
.hs-shell--detail .hs-pill { font-size: 11px; border: 1px solid var(--hs-line); border-radius: 999px; padding: 5px 10px; background: rgba(232, 92, 0, .07); color: var(--xi-text); }
.hs-shell--detail .hs-actions { display:flex; flex-wrap:wrap; gap:8px; }
.hs-shell--detail .hs-tabs { padding: 10px 16px 0; display:flex; gap:8px; flex-wrap:wrap; }
.hs-shell--detail .hs-tab { font-size: 12px; border-radius: 999px; padding: .35rem .7rem; border: 1px solid var(--hs-line); color: var(--hs-muted); background: transparent; }
.hs-shell--detail .hs-tab.active { color:#fff; background: var(--xi-accent); border-color: var(--xi-accent); }
.hs-shell--detail .hs-kv { padding: 14px 16px; }
.hs-shell--detail .hs-kv .k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--hs-muted); margin-top: 12px; }
.hs-shell--detail .hs-kv .v { font-size: 13px; color: var(--xi-text); margin-top: 4px; }
.hs-shell--detail .hs-task { border: 1px solid var(--hs-line); border-radius: 12px; background: rgba(0,0,0,.01); }
[data-bs-theme="dark"] .hs-shell--detail .hs-task { background: rgba(255,255,255,.03); }
.hs-shell--detail .hs-task-head { display:flex; justify-content:space-between; gap:10px; padding: 10px 12px; cursor: pointer; }
.hs-shell--detail .hs-task-title { font-size: 13px; font-weight: 700; color: var(--xi-text); }
.hs-shell--detail .hs-task-sub { font-size: 12px; color: var(--hs-muted); margin-top: 2px; }
.hs-shell--detail .hs-task-body { padding: 0 12px 12px; }
.hs-shell--detail .hs-task-grid { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; font-size: 12px; color: var(--xi-text); }
@media (max-width: 991.98px) { .hs-shell--detail .hs-task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hs-shell--detail .hs-task-grid .k { color: var(--hs-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.hs-shell--detail .hs-note { display:flex; gap:10px; }
.hs-shell--detail .hs-note textarea { resize: vertical; min-height: 90px; }
.hs-shell--detail .hs-grid { display:grid; grid-template-columns: 320px 1fr 320px; gap: 14px; }
@media (max-width: 1199.98px) { .hs-shell--detail .hs-grid { grid-template-columns: 1fr; } }
.hs-shell--edit .hs-grid { display:grid; grid-template-columns: 420px 1fr 320px; gap: 14px; }
@media (max-width: 1199.98px) { .hs-shell--edit .hs-grid { grid-template-columns: 1fr; } }

.leadboard-shell { --lb-line: rgba(17, 24, 39, .10); --lb-muted: rgba(17, 24, 39, .62); }
[data-bs-theme="dark"] .leadboard-shell { --lb-line: rgba(255, 255, 255, .12); --lb-muted: rgba(255, 255, 255, .62); }
.leadboard-shell .toolbar { border: 1px solid var(--lb-line); background: var(--xi-surface); border-radius: 12px; padding: 12px; }
.leadboard-shell .cols { display:flex; gap: 12px; overflow:auto; padding-bottom: 10px; }
.leadboard-shell .col { width: 300px; flex: 0 0 300px; border: 1px solid var(--lb-line); border-radius: 14px; background: rgba(0,0,0,.015); position: relative; overflow: hidden; --lb-stage: var(--xi-accent); }
.leadboard-shell .col::before { content:""; position:absolute; top:0; left:0; width:100%; height:4px; background: linear-gradient(90deg, var(--lb-stage), rgba(0,0,0,0)); }
[data-bs-theme="dark"] .leadboard-shell .col { background: rgba(255,255,255,.03); }
.leadboard-shell .col-head { display:flex; justify-content:space-between; align-items:center; gap:10px; padding: 12px 12px; border-bottom: 1px solid var(--lb-line); }
.leadboard-shell .col-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--lb-muted); font-weight: 700; display:flex; align-items:center; gap:8px; }
.leadboard-shell .col-title::before { content:""; width: 8px; height: 8px; border-radius: 999px; background: var(--lb-stage); box-shadow: 0 0 0 4px rgba(17, 24, 39, .04); }
[data-bs-theme="dark"] .leadboard-shell .col-title::before { box-shadow: 0 0 0 4px rgba(255, 255, 255, .06); }
.leadboard-shell .col-count { font-size: 11px; border: 1px solid var(--lb-line); border-radius: 999px; padding: 4px 8px; background: var(--xi-surface); color: var(--xi-text); }
.leadboard-shell .dropzone { padding: 10px 10px 14px; min-height: 120px; }
.leadboard-shell .dropzone.is-over { outline: 2px dashed var(--lb-stage); outline-offset: -6px; border-radius: 12px; }
.leadboard-shell .card { border: 1px solid var(--lb-line); border-radius: 14px; background: var(--xi-surface); padding: 10px 10px; text-decoration: none; color: inherit; display:block; }
.leadboard-shell .card + .card { margin-top: 10px; }
.leadboard-shell .card.is-dragging { opacity: .55; }
.leadboard-shell .name { font-size: 13px; font-weight: 800; color: var(--xi-text); line-height: 1.2; }
.leadboard-shell .sub { font-size: 12px; color: var(--lb-muted); margin-top: 4px; }
.leadboard-shell .meta { display:flex; gap:8px; flex-wrap:wrap; margin-top: 8px; }
.leadboard-shell .chip { font-size: 11px; border: 1px solid var(--lb-line); border-radius: 999px; padding: 4px 8px; background: rgba(232,92,0,.07); color: var(--xi-text); }
.leadboard-shell .chip.muted { background: transparent; color: var(--lb-muted); }
.leadboard-shell .hint { font-size: 12px; color: var(--lb-muted); margin-left: 2px; }
.leadboard-shell .col[data-stage="new_lead"] { --lb-stage: #64748b; }
.leadboard-shell .col[data-stage="first_contact_done"] { --lb-stage: #0ea5e9; }
.leadboard-shell .col[data-stage="follow_up_required"] { --lb-stage: #f59e0b; }
.leadboard-shell .col[data-stage="warm"] { --lb-stage: #f97316; }
.leadboard-shell .col[data-stage="negotiation"] { --lb-stage: #8b5cf6; }
.leadboard-shell .col[data-stage="deal_closing"] { --lb-stage: #14b8a6; }
.leadboard-shell .col[data-stage="closed_won"] { --lb-stage: #22c55e; }
.leadboard-shell .col[data-stage="closed_lost"] { --lb-stage: #ef4444; }
.lb-empty { font-size:12px; text-align:center; padding:18px 0; }

.tasks-shell .toolbar { border: 1px solid var(--xi-border); border-radius: 12px; background: var(--xi-surface); padding: 12px; }
.tasks-shell .metric { border: 1px solid var(--xi-border); border-radius: 12px; padding: 10px 12px; background: #fff; min-width: 140px; }
.tasks-shell .metric .k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--xi-muted); }
.tasks-shell .metric .v { font-size: 18px; font-weight: 800; color: var(--xi-text); margin-top: 2px; }
.tasks-shell .metric .v.danger { color: #b91c1c; }
.tasks-shell .metric .v.warn { color: #b45309; }
.tasks-shell .tasks-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; white-space: nowrap; }
.tasks-shell .tasks-table td { vertical-align: middle; font-size: 13px; }
.tasks-shell .badge-priority { font-size: 11px; border: 1px solid var(--xi-border); background: #fff; color: #374151; }
.tasks-shell .badge-status { font-size: 11px; }
.tasks-shell .due.overdue { color: #b91c1c; font-weight: 700; }
.tasks-shell .due.today { color: #b45309; font-weight: 700; }

.task-shell .head { border: 1px solid var(--xi-border); border-radius: 14px; background: var(--xi-surface); padding: 14px 14px; }
.task-shell .title { font-size: 16px; font-weight: 800; color: var(--xi-text); }
.task-shell .sub { font-size: 12px; color: var(--xi-muted); margin-top: 2px; }
.task-shell .pill { font-size: 11px; border: 1px solid var(--xi-border); border-radius: 999px; padding: 5px 10px; background: #fff; color: #374151; }
.task-shell .pill.danger { border-color: rgba(185, 28, 28, .35); background: rgba(185, 28, 28, .06); color: #b91c1c; }
.task-shell .pill.warn { border-color: rgba(180, 83, 9, .35); background: rgba(180, 83, 9, .07); color: #b45309; }
.task-shell .pill.done { border-color: rgba(22, 163, 74, .35); background: rgba(22, 163, 74, .07); color: #15803d; }
.task-shell dt { color: var(--xi-muted); font-weight: 700; font-size: 12px; }
.task-shell dd { font-size: 13px; margin-bottom: .6rem; }

.pipeline-col { min-width: 220px; background: #f1f5f9; border-radius: 8px; padding: 10px; }
.pipeline-col h6 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #64748b; margin-bottom: 10px; }
.deal-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; font-size: 13px; }
.deal-card:hover { border-color: var(--xi-accent); }
.deal-card .deal-value { font-weight: 600; color: #111; }
.deal-card .deal-company { color: #6b7280; font-size: 12px; }

.db .kpi-card { background: var(--xi-surface); border: 1px solid var(--xi-border); border-radius: 12px; padding: 14px 16px; position: relative; overflow: hidden; }
.db .kpi-card .kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--xi-muted); }
.db .kpi-card .kpi-val { font-size: 22px; font-weight: 700; color: var(--xi-text); line-height: 1.1; margin-top: 4px; }
.db .kpi-card .kpi-sub { font-size: 12px; color: var(--xi-muted); margin-top: 3px; }
.db .kpi-card .kpi-accent-bar { position: absolute; bottom: 0; left: 0; height: 3px; width: 100%; background: var(--xi-border); }
.db .kpi-card .kpi-accent-bar span { display: block; height: 100%; border-radius: 0 2px 2px 0; }
.db .kpi-bar-red-high { width: 80%; background: #ef4444; }
.db .kpi-bar-red-low { width: 5%; background: #ef4444; }
.db .kpi-bar-amber-high { width: 65%; background: #f59e0b; }
.db .kpi-bar-amber-low { width: 5%; background: #f59e0b; }
.db .kpi-card .kpi-val.text-danger { color: #b91c1c !important; }
.db .kpi-card .kpi-val.text-warning { color: #b45309 !important; }
.db .section-card { background: var(--xi-surface); border: 1px solid var(--xi-border); border-radius: 12px; padding: 14px 16px; }
.db .card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.db .card-head strong { font-size: 13px; font-weight: 600; color: var(--xi-text); }
.db .sec-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--xi-muted); margin: 10px 0 4px; }
.db .sec-label:first-child { margin-top: 0; }
.db .item-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-top: 1px solid var(--xi-border); font-size: 13px; }
.db .item-row:first-of-type { border-top: none; }
.db .item-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.db .dot-red { background: #ef4444; }
.db .dot-amber { background: #f59e0b; }
.db .dot-green { background: #22c55e; }
.db .dot-blue { background: var(--xi-accent); }
.db .item-name { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db .item-name a { color: var(--xi-text); }
.db .item-name a:hover { color: var(--xi-accent); text-decoration: none; }
.db .item-meta { font-size: 11px; color: var(--xi-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db .item-meta a { color: var(--xi-muted); }
.db .item-meta a:hover { color: var(--xi-accent); }
.db .item-val { font-size: 12px; font-weight: 600; text-align: right; white-space: nowrap; }
.db .item-val.overdue { color: #b91c1c; }
.db .item-val.warn { color: #b45309; }
.db .pip-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--xi-border); font-size: 12px; }
.db .pip-row:first-child { border-top: none; }
.db .pip-stage { width: 90px; flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--xi-muted); }
.db .pip-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--xi-border); overflow: hidden; }
.db .pip-bar-fill { height: 100%; border-radius: 999px; background: var(--xi-accent); }
.db .pip-info { font-size: 11px; color: var(--xi-muted); min-width: 90px; text-align: right; }
.db .pip-pct { font-size: 12px; font-weight: 700; min-width: 34px; text-align: right; color: var(--xi-text); }
.db .health-box { background: var(--xi-body-bg); border: 1px solid var(--xi-border); border-radius: 8px; padding: 10px 12px; }
.db .health-box .h-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--xi-muted); }
.db .health-box .h-val { font-size: 17px; font-weight: 700; color: var(--xi-text); margin-top: 2px; }
.db .health-box .h-sub { font-size: 11px; color: var(--xi-muted); margin-top: 1px; }
.db .renew-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--xi-border); font-size: 12px; }
.db .renew-row:first-child { border-top: none; }
.db .renew-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex-shrink: 0; }
.db .pill-hot { background: #fee2e2; color: #b91c1c; }
.db .pill-warn { background: #fef3c7; color: #92400e; }
.db .pill-ok { background: #dcfce7; color: #15803d; }
.db .src-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.db .src-table th { text-align: left; padding: 5px 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--xi-muted); border-bottom: 1px solid var(--xi-border); }
.db .src-table td { padding: 7px 6px; border-bottom: 1px solid var(--xi-border); vertical-align: middle; }
.db .src-table tr:last-child td { border-bottom: none; }
.db .src-table tr:hover td { background: var(--xi-body-bg); }
.db .src-table .td-r { text-align: right; font-weight: 600; }
.db .xi-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.db .xi-badge.ok { background: #dcfce7; color: #15803d; }
.db .xi-badge.danger { background: #fee2e2; color: #b91c1c; }
.db .xi-badge.warn { background: #fef3c7; color: #92400e; }
.db .xi-badge.info { background: var(--xi-orange-light); color: var(--xi-orange-dark); }
.db .xi-badge.muted { background: var(--xi-body-bg); color: var(--xi-muted); border: 1px solid var(--xi-border); }
.db .divider { height: 1px; background: var(--xi-border); margin: 10px 0; }
.db .empty-state { font-size: 12px; color: var(--xi-muted); padding: 6px 0; }
[data-bs-theme="dark"] .db .pill-hot { background: rgba(185,28,28,.25); color: #fca5a5; }
[data-bs-theme="dark"] .db .pill-warn { background: rgba(180,83,9,.25); color: #fcd34d; }
[data-bs-theme="dark"] .db .pill-ok { background: rgba(21,128,61,.25); color: #86efac; }
[data-bs-theme="dark"] .db .xi-badge.ok { background: rgba(21,128,61,.2); color: #86efac; }
[data-bs-theme="dark"] .db .xi-badge.warn { background: rgba(180,83,9,.2); color: #fcd34d; }
[data-bs-theme="dark"] .db .xi-badge.info { background: rgba(232,92,0,.18); color: #fdba74; }

.xi-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.xi-page-header__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--xi-text);
  margin: 0 0 .2rem;
  letter-spacing: -.02em;
}
.xi-page-header__sub {
  font-size: .82rem;
  color: var(--xi-muted);
  margin: 0;
}

.xi-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}
.xi-kpi-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.xi-kpi-card__icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: #fff4ed;
  color: var(--xi-accent);
  flex-shrink: 0;
}
.xi-kpi-card__icon--purple { background: #f3f0ff; color: #7c3aed; }
.xi-kpi-card__icon--orange { background: #fff4ed; color: var(--xi-accent); }
.xi-kpi-card__icon--red { background: #fff1f1; color: #dc2626; }
.xi-kpi-card__icon--green { background: #ecfdf5; color: #15803d; }
.xi-kpi-card__icon--amber { background: #fff7ed; color: #c2410c; }
.xi-kpi-card__value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--xi-text);
  line-height: 1.1;
}
.xi-kpi-card__label {
  font-size: .75rem;
  color: var(--xi-muted);
  margin-top: .1rem;
}
.xi-kpi-card--link {
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.xi-kpi-card--link:hover {
  border-color: var(--xi-accent);
  box-shadow: 0 2px 8px rgba(var(--xi-accent-rgb, 59,130,246), .12);
}

/* Email · confirm & compact action panels (send / delete / add-recipient) */
.xi-confirm {
  max-width: 560px;
  margin: 0 auto;
}
.xi-confirm__card {
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  border-radius: 16px;
  padding: 1.9rem 1.75rem 1.6rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  text-align: center;
}
.xi-confirm__icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  margin-bottom: 1rem;
  background: rgba(var(--xi-accent-rgb), .10);
  color: var(--xi-accent);
}
.xi-confirm__icon--danger { background: #fff1f1; color: #dc2626; }
[data-bs-theme="dark"] .xi-confirm__icon--danger { background: rgba(220,38,38,.16); color: #f87171; }
.xi-confirm__title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--xi-text);
  letter-spacing: -.01em;
  margin: 0 0 .4rem;
}
.xi-confirm__text {
  font-size: .9rem;
  color: var(--xi-muted);
  margin: 0 auto 1.25rem;
  max-width: 44ch;
  line-height: 1.55;
}
.xi-confirm__summary {
  text-align: left;
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  padding: .35rem .9rem;
  margin-bottom: 1.25rem;
  background: rgba(var(--xi-accent-rgb), .045);
}
.xi-confirm__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem 0;
  font-size: .86rem;
}
.xi-confirm__row + .xi-confirm__row { border-top: 1px dashed var(--xi-border); }
.xi-confirm__k { color: var(--xi-muted); flex: 0 0 auto; }
.xi-confirm__v { color: var(--xi-text); font-weight: 700; text-align: right; min-width: 0; word-break: break-word; }
.xi-confirm__field { text-align: left; margin-bottom: 1.25rem; }
.xi-confirm__note {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  text-align: left;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--xi-muted);
  background: rgba(var(--xi-accent-rgb), .06);
  border: 1px solid rgba(var(--xi-accent-rgb), .16);
  border-radius: 10px;
  padding: .7rem .85rem;
  margin-bottom: 1.25rem;
}
.xi-confirm__note i { color: var(--xi-accent); margin-top: .1rem; flex: 0 0 auto; }
.xi-confirm__note--danger {
  color: #b91c1c;
  background: #fff1f1;
  border-color: rgba(220,38,38,.2);
}
.xi-confirm__note--danger i { color: #dc2626; }
[data-bs-theme="dark"] .xi-confirm__note--danger { color: #fca5a5; background: rgba(220,38,38,.1); }
.xi-confirm__actions {
  display: flex;
  gap: .5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.xi-confirm__actions .btn { min-width: 130px; }

/* Email · grouped form sections (campaign / audience builders) */
.xi-form { max-width: 820px; }
.xi-form-section { border: 1px solid var(--xi-border); border-radius: 16px; background: var(--xi-surface); box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-bottom: 1rem; overflow: hidden; }
.xi-form-section__head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--xi-border); }
.xi-form-section__ico { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; background: rgba(var(--xi-accent-rgb), .10); color: var(--xi-accent); flex: 0 0 auto; }
.xi-form-section__title { font-size: .95rem; font-weight: 800; color: var(--xi-text); margin: 0; letter-spacing: -.01em; }
.xi-form-section__sub { font-size: .78rem; color: var(--xi-muted); margin: .1rem 0 0; }
.xi-form-section__body { padding: 1.15rem; }
.xi-form__label { font-size: .8rem; font-weight: 600; color: var(--xi-text); margin-bottom: .35rem; }
.xi-form__hint { font-size: .78rem; color: var(--xi-muted); margin-top: .3rem; }
.xi-form .form-control, .xi-form .form-select { border-radius: 10px; }
.xi-form__actions { display: flex; justify-content: flex-end; gap: .5rem; padding-top: .25rem; }
.xi-form__actions .btn { min-width: 120px; }

.tender-shell .tender-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6b7280;
  white-space: nowrap;
}
.tender-shell .tender-table td {
  vertical-align: middle;
  font-size: 13px;
}
.tender-record-shell {
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  background: var(--xi-surface);
  overflow: hidden;
  margin-bottom: 16px;
}
.tender-record-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--xi-border);
  background: linear-gradient(180deg, #ffffff, #fafbfc);
}
.tender-record-topbar__left,
.tender-record-topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tender-record-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(var(--xi-accent-rgb), .10);
  color: var(--xi-orange-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.tender-stage-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 10px 12px;
  background: #f8fafc;
  border-top: 1px solid rgba(255,255,255,.7);
}
.tender-stage-tab {
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--xi-border);
  background: #fff;
  color: var(--xi-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tender-stage-tab.is-active {
  background: rgba(var(--xi-accent-rgb), .12);
  border-color: rgba(var(--xi-accent-rgb), .32);
  color: var(--xi-orange-dark);
}
.tender-stage-tab:disabled {
  cursor: default;
  opacity: .72;
}
.tender-record-layout {
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--xi-surface);
}
.tender-record-main {
  padding: 16px;
  border-right: 1px solid var(--xi-border);
  min-height: 100%;
}
.tender-record-side {
  padding: 16px;
  background: #fbfcfe;
  min-height: 100%;
}
.tender-detail-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.tender-detail-hero__eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--xi-orange-dark);
  margin-bottom: .5rem;
}
.tender-detail-hero__title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--xi-text);
  margin: 0;
}
.tender-detail-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  margin-top: .65rem;
  color: var(--xi-muted);
  font-size: 12px;
}
.tender-detail-hero__meta span {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.tender-workflow__track {
  display: grid;
  grid-template-columns: repeat(11, minmax(70px, 1fr));
  gap: .5rem;
  overflow-x: auto;
}
.tender-workflow__step {
  position: relative;
  min-width: 70px;
  text-align: center;
}
.tender-workflow__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 10px;
  left: calc(50% + 15px);
  width: calc(100% - 30px);
  height: 2px;
  background: var(--xi-border);
}
.tender-workflow__dot {
  width: 20px;
  height: 20px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #d1d5db;
  position: relative;
  z-index: 1;
}
.tender-workflow__label {
  font-size: 11px;
  line-height: 1.35;
  color: var(--xi-muted);
  font-weight: 600;
}
.tender-workflow__step.is-current .tender-workflow__dot,
.tender-workflow__step.is-complete .tender-workflow__dot {
  border-color: var(--xi-accent);
}
.tender-workflow__step.is-current .tender-workflow__dot {
  background: var(--xi-accent);
  box-shadow: 0 0 0 6px rgba(var(--xi-accent-rgb), .12);
}
.tender-workflow__step.is-complete .tender-workflow__dot {
  background: rgba(var(--xi-accent-rgb), .18);
}
.tender-workflow__step.is-complete:not(:last-child)::after {
  background: var(--xi-accent);
}
.tender-workflow__step.is-current .tender-workflow__label,
.tender-workflow__step.is-complete .tender-workflow__label {
  color: var(--xi-text);
}
.tender-record-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.tender-record-metric {
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
}
.tender-record-panel {
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.tender-record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tender-record-field {
  padding: 12px 14px;
  border-bottom: 1px solid #edf0f3;
}
.tender-record-field:nth-child(odd) {
  border-right: 1px solid #edf0f3;
}
.tender-record-field .k {
  font-size: 11px;
  font-weight: 700;
  color: var(--xi-muted);
  margin-bottom: 4px;
}
.tender-record-field .v {
  font-size: 13px;
  color: var(--xi-text);
  min-height: 20px;
}
.tender-record-tabs {
  display: flex;
  gap: 6px;
  margin-top: 16px;
}
.tender-record-tab {
  padding: 7px 12px;
  border: 1px solid var(--xi-border);
  border-radius: 10px 10px 0 0;
  background: #f8fafc;
  color: var(--xi-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tender-record-tab.is-active {
  background: #fff;
  color: var(--xi-text);
}
.tender-record-notes {
  border: 1px solid var(--xi-border);
  border-top: none;
  border-radius: 0 12px 12px 12px;
  min-height: 110px;
  padding: 14px;
  background: #fff;
  color: var(--xi-muted);
  font-size: 13px;
}
.tender-tab-panel {
  display: none;
}
.tender-tab-panel.is-active {
  display: block;
}
.tender-panel-stack {
  display: grid;
  gap: 10px;
}
.tender-note-item,
.tender-contact-item {
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}
.tender-note-item.is-own {
  border-color: rgba(var(--xi-accent-rgb), .22);
  background: linear-gradient(180deg, rgba(255,240,229,.58), rgba(255,255,255,.98));
}
.tender-note-item__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--xi-muted);
  margin-bottom: 6px;
}
.tender-note-item__body {
  white-space: pre-wrap;
  color: var(--xi-text);
}
.tender-contact-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}
.tender-contact-item__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--xi-text);
}
.tender-contact-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  color: var(--xi-muted);
  font-size: 12px;
}
.tender-contact-item__aside {
  text-align: right;
  font-size: 12px;
  color: var(--xi-muted);
}
.tender-inline-form {
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.tender-empty-state {
  border: 1px dashed var(--xi-border);
  border-radius: 12px;
  padding: 20px 16px;
  color: var(--xi-muted);
  background: #fbfcfe;
  font-size: 12px;
  text-align: center;
}

.tender-table__row--overdue {
  border-left: 3px solid #b91c1c !important;
  background: linear-gradient(90deg, rgba(185,28,28,.04), transparent);
}
.tender-table__row--urgent {
  border-left: 3px solid #b91c1c !important;
}
.tender-table__row--high {
  border-left: 3px solid #d97706 !important;
}
.tender-table__row--atrisk {
  border-left: 3px solid #f59e0b !important;
}
.tender-table__row td {
  vertical-align: middle;
}

.tender-table__prob {
  height: 6px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
  flex: 0 0 auto;
}
.tender-table__prob-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--xi-accent), #f59e0b);
  transition: width .3s ease;
}

.tender-bulk-bar {
  background: linear-gradient(135deg, rgba(var(--xi-accent-rgb), .10), rgba(255, 162, 93, .06));
  border: 1px solid rgba(var(--xi-accent-rgb), .16);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 12px;
}
.tender-bulk-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--xi-text);
  flex-wrap: wrap;
}
.tender-bulk-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tender-pricing {
  display: grid;
  gap: 2px;
}
.tender-pricing__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #edf0f3;
  font-size: 13px;
}
.tender-pricing__row:last-child { border-bottom: none; }
.tender-pricing__row span { color: var(--xi-muted); }
.tender-pricing__row strong { font-weight: 700; color: var(--xi-text); }
.tender-pricing__row--saving { background: rgba(21,128,61,.04); margin: 0 -8px; padding: 8px; border-radius: 8px; border-bottom: none; }

.tender-timeline {
  display: grid;
  gap: 0;
  padding-left: 4px;
}
.tender-timeline__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}
.tender-timeline__item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 22px;
  bottom: -2px;
  width: 2px;
  background: #e5e7eb;
}
.tender-timeline__dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #e5e7eb;
  border: 2px solid #fff;
  flex: 0 0 auto;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}
.tender-timeline__item--done .tender-timeline__dot { background: #15803d; }
.tender-timeline__item--active .tender-timeline__dot { background: var(--xi-accent); box-shadow: 0 0 0 4px rgba(var(--xi-accent-rgb), .14); }
.tender-timeline__item--overdue .tender-timeline__dot { background: #b91c1c; }
.tender-timeline__item--done:not(:last-child)::before { background: #15803d; }
.tender-timeline__label { font-size: 12px; font-weight: 700; color: var(--xi-text); }
.tender-timeline__date { font-size: 12px; color: var(--xi-muted); margin-top: 1px; }

.tender-activity-item__avatar i {
  font-size: 14px !important;
}
.tender-mini-stat__value {
  font-size: 20px !important;
}
.tender-detail-grid dt {
  color: var(--xi-muted);
  font-weight: 700;
  font-size: 12px;
}
.tender-detail-grid dd {
  font-size: 13px;
  margin-bottom: .7rem;
  color: var(--xi-text);
}
.tender-panel {
  height: 100%;
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  padding: 12px 13px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,240,229,.35));
}
.tender-panel__title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--xi-orange-dark);
  margin-bottom: 8px;
}
.tender-panel p,
.tender-placeholder__meta,
.tender-alert .small,
.tender-readiness__row span {
  font-size: 13px;
  color: var(--xi-text);
  margin-bottom: 0;
}
.tender-placeholder {
  height: 100%;
  border: 1px dashed rgba(var(--xi-accent-rgb), .28);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,240,229,.35);
}
.tender-placeholder__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(var(--xi-accent-rgb), .14);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--xi-accent);
  margin-bottom: 10px;
}
.tender-placeholder__title,
.tender-alert__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--xi-text);
  margin-bottom: 6px;
}
.tender-alert {
  border-width: 1px;
  border-style: solid;
}
.tender-alert--ok {
  border-color: rgba(21,128,61,.18);
  background: linear-gradient(180deg, rgba(240,253,244,.95), rgba(255,255,255,.98));
}
.tender-alert--warning {
  border-color: rgba(217,119,6,.2);
  background: linear-gradient(180deg, rgba(255,251,235,.95), rgba(255,255,255,.98));
}
.tender-alert--danger {
  border-color: rgba(185,28,28,.18);
  background: linear-gradient(180deg, rgba(254,242,242,.95), rgba(255,255,255,.98));
}
.tender-alert--muted {
  border-color: var(--xi-border);
  background: var(--xi-surface);
}
.tender-readiness {
  display: grid;
  gap: 10px;
}
.tender-readiness__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--xi-border);
}
.tender-readiness__row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}
.tender-readiness__row strong {
  font-size: 12px;
  color: var(--xi-orange-dark);
}
.tender-team-list {
  display: grid;
  gap: 10px;
}
.tender-team-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.tender-team-item__avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(var(--xi-accent-rgb), .12);
  color: var(--xi-orange-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}
.tender-team-item__name {
  font-size: 13px;
  font-weight: 700;
  color: var(--xi-text);
}
.tender-team-item__role {
  font-size: 11px;
  color: var(--xi-muted);
  margin-top: 2px;
}
.tender-side-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--xi-border);
  border-radius: 10px;
  background: #fff;
  padding: 9px 12px;
  color: var(--xi-muted);
  font-size: 12px;
  margin-bottom: 12px;
}
.tender-activity-card {
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.tender-chat-card {
  border-bottom: 1px solid var(--xi-border);
}
.tender-activity-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--xi-border);
}
.tender-activity-stream {
  padding: 8px 14px 14px;
}
.tender-activity-actions {
  padding: 0 14px 14px;
}
.tender-activity-toggle {
  border: 1px solid var(--xi-border);
  background: #fff;
  color: var(--xi-orange-dark);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  transition: background .18s ease, border-color .18s ease;
}
.tender-activity-toggle:hover {
  background: rgba(var(--xi-accent-rgb), .08);
  border-color: rgba(var(--xi-accent-rgb), .26);
}
.tender-chat-stream {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
  padding: 10px 14px 0;
}
.tender-chat-message {
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.tender-chat-message.is-own {
  background: linear-gradient(135deg, rgba(255,240,229,.86), rgba(255,255,255,.98));
  border-color: rgba(var(--xi-accent-rgb), .22);
}
.tender-chat-message__author {
  font-size: 12px;
  font-weight: 700;
  color: var(--xi-text);
}
.tender-chat-message__body {
  font-size: 13px;
  color: #374151;
  margin-top: 4px;
  white-space: pre-wrap;
}
.tender-chat-message__meta,
.tender-chat-empty {
  font-size: 11px;
  color: var(--xi-muted);
  margin-top: 6px;
}
.tender-chat-empty {
  padding: 6px 0 10px;
}
.tender-chat-form {
  padding: 12px 14px 14px;
}
.tender-chat-form textarea {
  resize: vertical;
  min-height: 88px;
}
.tender-activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
}
.tender-activity-item + .tender-activity-item {
  border-top: 1px solid #edf0f3;
}
.tender-activity-item__avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(var(--xi-accent-rgb), .12);
  color: var(--xi-orange-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}
.tender-activity-item__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--xi-text);
}
.tender-activity-item__meta {
  font-size: 11px;
  color: var(--xi-muted);
  margin-top: 2px;
}
.tender-activity-item__detail {
  font-size: 12px;
  color: #4b5563;
  margin-top: 4px;
}
.stat-card--brand { border-left: 4px solid var(--xi-accent); }
.stat-card--success { border-left: 4px solid #15803d; }
.stat-card--info { border-left: 4px solid #2563eb; }
.stat-card--warning { border-left: 4px solid #d97706; }
.stat-card--danger { border-left: 4px solid #b91c1c; }

.stat-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex: 0 0 auto;
  margin-bottom: 10px;
}
.stat-card--brand .stat-card__icon { background: rgba(var(--xi-accent-rgb), .12); color: var(--xi-orange-dark); }
.stat-card--success .stat-card__icon { background: #dcfce7; color: #15803d; }
.stat-card--info .stat-card__icon { background: #dbeafe; color: #2563eb; }
.stat-card--warning .stat-card__icon { background: #fef3c7; color: #d97706; }
.stat-card--danger .stat-card__icon { background: #fee2e2; color: #b91c1c; }

.stat-card__label { font-size: 11px; color: var(--xi-muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 2px; }
.stat-card__value { font-size: 26px; font-weight: 800; color: var(--xi-text); line-height: 1.2; transition: opacity .3s ease; }
.stat-card__value[data-updating="true"] { opacity: .5; }
.stat-card__trend { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.stat-card__trend-label { font-size: 11px; color: var(--xi-muted); }
.stat-card__trend-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  background: rgba(var(--xi-accent-rgb), .10);
  color: var(--xi-orange-dark);
}
.stat-card__trend-badge:not(span) {
  transition: opacity .15s;
}
.stat-card__trend-badge:not(span):hover {
  opacity: .75;
}

.stat-card__trend-badge--success { background: #dcfce7; color: #15803d; }
.stat-card__trend-badge--info { background: #dbeafe; color: #2563eb; }
.stat-card__trend-badge--warning { background: #fef3c7; color: #d97706; }
.stat-card__trend-badge--danger { background: #fee2e2; color: #b91c1c; }

.tender-dashboard-health {
  display: grid;
  gap: 8px;
}
.tender-dashboard-health__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--xi-border);
  background: #fff;
  font-size: 13px;
}
.tender-dashboard-health__item i { font-size: 16px; flex: 0 0 auto; }
.tender-dashboard-health__item span { flex: 1; color: var(--xi-text); }
.tender-dashboard-health__item strong { font-size: 14px; font-weight: 800; min-width: 24px; text-align: right; }
.tender-dashboard-health__item--ok i { color: #15803d; }
.tender-dashboard-health__item--warn i { color: #d97706; }
.tender-dashboard-health__item--danger i { color: #b91c1c; }

.tender-dashboard-priority {
  display: grid;
  gap: 10px;
}
.tender-dashboard-priority__row {
  display: grid;
  grid-template-columns: 10px 1fr 2fr 28px;
  gap: 10px;
  align-items: center;
}
.tender-dashboard-priority__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}
.tender-dashboard-priority__dot--urgent { background: #b91c1c; }
.tender-dashboard-priority__dot--high { background: #d97706; }
.tender-dashboard-priority__dot--medium { background: #2563eb; }
.tender-dashboard-priority__dot--low { background: #9ca3af; }
.tender-dashboard-priority__label { font-size: 13px; color: var(--xi-text); }
.tender-dashboard-priority__track {
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}
.tender-dashboard-priority__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(var(--xi-accent-rgb), .92), rgba(255, 162, 93, .82));
  transition: width .4s ease;
}
.tender-dashboard-priority__count { font-size: 13px; font-weight: 800; color: var(--xi-text); text-align: right; }

.tender-dashboard-team {
  display: grid;
  gap: 10px;
}
.tender-dashboard-team__item {
  display: grid;
  grid-template-columns: 28px 1fr 2fr 24px;
  gap: 10px;
  align-items: center;
}
.tender-dashboard-team__avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(var(--xi-accent-rgb), .12);
  color: var(--xi-orange-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex: 0 0 auto;
}
.tender-dashboard-team__name { font-size: 12px; color: var(--xi-text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tender-dashboard-team__bar { height: 6px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.tender-dashboard-team__fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #15803d, #22c55e); }
.tender-dashboard-team__count { font-size: 12px; font-weight: 800; color: var(--xi-text); text-align: right; }

.tender-dashboard-list__bar {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(var(--xi-accent-rgb), .82), rgba(255, 162, 93, .72));
  min-width: 4px;
  max-width: 120px;
  flex: 1 1 auto;
}
.tender-dashboard-list__bar--award {
  background: linear-gradient(90deg, #15803d, #22c55e);
}
.tender-dashboard-list__bar--competitor {
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.tender-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 140px;
  padding: 4px 0;
  overflow-x: auto;
}
.tender-chart__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 36px;
}
.tender-chart__label {
  font-size: 9px;
  color: var(--xi-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.tender-chart__bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 100px;
  flex: 1;
  width: 100%;
  justify-content: center;
}
.tender-chart__bar {
  width: 10px;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height .4s ease;
}
.tender-chart__bar--submission { background: linear-gradient(180deg, rgba(var(--xi-accent-rgb), .92), rgba(255, 162, 93, .78)); }
.tender-chart__bar--award { background: linear-gradient(180deg, #15803d, #4ade80); }
.tender-chart__value {
  font-size: 10px;
  font-weight: 700;
  color: var(--xi-text);
}
.tender-chart__legend {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 4px;
}
.tender-chart__legend--submission { background: rgba(var(--xi-accent-rgb), .82); }
.tender-chart__legend--award { background: #15803d; }

.tender-forecast {
  display: grid;
  gap: 16px;
}
.tender-forecast__primary {
  text-align: center;
  padding: 20px 16px;
  background: linear-gradient(135deg, rgba(var(--xi-accent-rgb), .10), rgba(255, 162, 93, .08));
  border-radius: 12px;
  border: 1px solid rgba(var(--xi-accent-rgb), .14);
}
.tender-forecast__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--xi-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}
.tender-forecast__value {
  font-size: 28px;
  font-weight: 800;
  color: var(--xi-text);
}
.tender-forecast__secondary {
  display: grid;
  gap: 8px;
}
.tender-forecast__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #edf0f3;
  font-size: 13px;
}
.tender-forecast__item:last-child { border-bottom: none; }
.tender-forecast__item span { color: var(--xi-muted); }
.tender-forecast__item strong { color: var(--xi-text); font-weight: 700; }

.xi-nav-btn--icon {
  width: 38px;
  padding: 0;
  justify-content: center;
  font-size: 16px;
}

[data-xi-widget-hidden="true"] {
  display: none !important;
}

@media print {
  .sidebar, .topbar, .xi-nav-btn, .xi-nav-btn--icon, .xi-scope-pill { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  .stat-card { break-inside: avoid; border: 1px solid #ddd !important; box-shadow: none !important; }
  [data-xi-widget-hidden="true"] { display: block !important; }
}

.tender-dashboard {
  /* Layout is handled by Bootstrap row/col — no grid here to avoid conflicts */
}
.xi-page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--xi-text);
}
.xi-page-sub {
  color: var(--xi-muted);
  font-size: 13px;
}
.xi-scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(var(--xi-accent-rgb), .08);
  color: var(--xi-orange-dark);
  font-size: 11px;
  font-weight: 700;
}
.xi-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(var(--xi-accent-rgb), .18);
  border-radius: 10px;
  background: #fff;
  color: var(--xi-orange-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.xi-nav-btn:hover {
  background: rgba(var(--xi-accent-rgb), .08);
  border-color: rgba(var(--xi-accent-rgb), .28);
}
.tender-dashboard-pipeline {
  display: grid;
  gap: 12px;
}
.tender-dashboard-pipeline__row {
  display: grid;
  grid-template-columns: 120px 1fr 36px;
  gap: 12px;
  align-items: center;
}
.tender-dashboard-pipeline__label,
.tender-dashboard-list__row span {
  font-size: 13px;
  color: var(--xi-text);
}
.tender-dashboard-pipeline__track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}
.tender-dashboard-pipeline__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(var(--xi-accent-rgb), .92), rgba(255, 162, 93, .88));
}
.tender-dashboard-pipeline__count {
  font-size: 12px;
  font-weight: 700;
  color: var(--xi-orange-dark);
}
.tender-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.tender-dashboard-mini {
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,240,229,.32));
  padding: 14px;
}
.tender-dashboard-mini .label {
  font-size: 12px;
  color: var(--xi-muted);
}
.tender-dashboard-mini .value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 800;
  color: var(--xi-text);
}
.tender-dashboard-list,
.tender-dashboard-actions,
.tender-dashboard-alerts {
  display: grid;
  gap: 10px;
}
.tender-dashboard-list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f3;
}
.tender-dashboard-list__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.tender-dashboard-list__row strong {
  font-size: 12px;
  font-weight: 800;
  color: var(--xi-orange-dark);
  text-align: right;
  min-width: 20px;
}
.tender-dashboard-action,
.tender-dashboard-alert {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.tender-dashboard-action:hover,
.tender-dashboard-alert:hover {
  background: rgba(var(--xi-accent-rgb), .04);
  border-color: rgba(var(--xi-accent-rgb), .22);
  transform: translateY(-1px);
}
.tender-dashboard-action strong,
.tender-dashboard-alert strong {
  font-size: 13px;
  color: var(--xi-text);
}
.tender-dashboard-action span,
.tender-dashboard-alert span,
.tender-dashboard-alert small {
  font-size: 12px;
  color: var(--xi-muted);
}

@media (max-width: 991.98px) {
  .xi-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tender-record-main {
    border-right: none;
  }
  .tender-detail-hero {
    flex-direction: column;
  }
  .tender-record-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tender-record-grid {
    grid-template-columns: 1fr;
  }
  .tender-record-field:nth-child(odd) {
    border-right: none;
  }
  .tender-workflow__track {
    grid-template-columns: repeat(11, minmax(88px, 1fr));
  }
  .tender-dashboard-pipeline__row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (max-width: 767.98px) {
  .xi-page-header,
  .tender-detail-hero {
    flex-direction: column;
  }
  .xi-kpi-strip {
    grid-template-columns: 1fr;
  }
  .tender-record-topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .tender-record-summary {
    grid-template-columns: 1fr;
  }
  .tender-stage-tabs {
    padding-bottom: 8px;
  }
  .tender-contact-item {
    flex-direction: column;
  }
  .tender-contact-item__aside {
    text-align: left;
  }
  .tender-dashboard-grid {
    grid-template-columns: 1fr;
  }
  .xi-nav-btn {
    width: 100%;
  }
}
[data-bs-theme="dark"] .db .xi-badge.danger { background: rgba(185,28,28,.2); color: #fca5a5; }
[data-bs-theme="dark"] .db .xi-badge.warn { background: rgba(180,83,9,.2); color: #fcd34d; }

.notif-shell {
  max-width: 720px;
  margin: 0 auto;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.notif-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--xi-text);
  margin: 0;
}
.notif-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--xi-body-bg);
  color: var(--xi-muted);
  border: 1px solid var(--xi-border);
}
.notif-count-badge--unread {
  background: rgba(var(--xi-accent-rgb), .10);
  color: var(--xi-orange-dark);
  border-color: rgba(var(--xi-accent-rgb), .18);
}
.notif-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--xi-border);
  border-radius: 10px;
  background: var(--xi-surface);
  color: var(--xi-text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.notif-btn:hover {
  background: rgba(var(--xi-accent-rgb), .06);
  border-color: rgba(var(--xi-accent-rgb), .20);
}
.notif-btn--mark-read {
  color: var(--xi-orange-dark);
  border-color: rgba(var(--xi-accent-rgb), .18);
}
.notif-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  padding: 4px;
}
.notif-tab {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--xi-muted);
  text-decoration: none;
  transition: background .16s ease, color .16s ease;
}
.notif-tab:hover {
  color: var(--xi-text);
  background: var(--xi-body-bg);
}
.notif-tab.is-active {
  background: var(--xi-accent);
  color: #fff;
}
.notif-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.25);
  font-size: 10px;
  font-weight: 800;
  margin-left: 5px;
  vertical-align: middle;
}
.notif-groups {
  display: grid;
  gap: 20px;
}
.notif-group-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--xi-muted);
  margin-bottom: 8px;
  padding-left: 2px;
}
.notif-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--xi-border);
  background: var(--xi-surface);
  transition: background .16s ease, border-color .16s ease;
  cursor: pointer;
}
.notif-card + .notif-card {
  margin-top: 6px;
}
.notif-card:hover {
  border-color: rgba(var(--xi-accent-rgb), .22);
  background: rgba(var(--xi-accent-rgb), .02);
}
.notif-card:active {
  transform: scale(.995);
}
.notif-card--unread {
  background: rgba(var(--xi-accent-rgb), .03);
  border-color: rgba(var(--xi-accent-rgb), .10);
}
.notif-card--unread:hover {
  border-color: rgba(var(--xi-accent-rgb), .28);
  background: rgba(var(--xi-accent-rgb), .05);
}
.notif-card--read {
  opacity: .82;
}
.notif-card--info { border-left: 3px solid #2563eb; }
.notif-card--success { border-left: 3px solid #15803d; }
.notif-card--warning { border-left: 3px solid #d97706; }
.notif-card--danger { border-left: 3px solid #b91c1c; }
.notif-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 15px;
}
.notif-card--info .notif-card-icon { background: #dbeafe; color: #2563eb; }
.notif-card--success .notif-card-icon { background: #dcfce7; color: #15803d; }
.notif-card--warning .notif-card-icon { background: #fef3c7; color: #d97706; }
.notif-card--danger .notif-card-icon { background: #fee2e2; color: #b91c1c; }
.notif-card-body {
  flex: 1;
  min-width: 0;
}
.notif-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.notif-card-link {
  font-size: 13px;
  color: var(--xi-text);
  text-decoration: none;
}
.notif-card-link:hover {
  color: var(--xi-accent);
}
.notif-card-link--read {
  color: var(--xi-muted);
}
.notif-card-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--xi-accent);
  flex: 0 0 auto;
}
.notif-card-text {
  font-size: 12px;
  color: var(--xi-muted);
  line-height: 1.4;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-card-time {
  font-size: 11px;
  color: var(--xi-muted);
  margin-top: 4px;
}
.notif-card-arrow {
  color: var(--xi-border);
  font-size: 13px;
  margin-top: 4px;
  flex: 0 0 auto;
  opacity: 0;
  transition: opacity .16s ease;
}
.notif-card:hover .notif-card-arrow {
  opacity: 1;
  color: var(--xi-muted);
}
.notif-empty {
  text-align: center;
  padding: 48px 20px;
  border: 1px dashed var(--xi-border);
  border-radius: 16px;
  background: var(--xi-surface);
}
.notif-empty-icon {
  font-size: 36px;
  color: var(--xi-border);
  margin-bottom: 12px;
}
.notif-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--xi-text);
  margin-bottom: 4px;
}
.notif-empty-sub {
  font-size: 13px;
  color: var(--xi-muted);
}
@media (max-width: 767.98px) {
  .notif-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.tender-form-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
}
.tender-form-alert--error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid rgba(185,28,28,.2);
}
.tender-form-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}
.tender-form-main {
  display: grid;
  gap: 16px;
}
.tender-form-section {
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  border-radius: 14px;
  padding: 18px 20px;
}
.tender-form-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--xi-orange-dark);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--xi-border);
}
.tender-form-section-head i {
  font-size: 16px;
}
.tender-form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.tender-form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px 16px;
}
.tender-form-field {
  margin-bottom: 4px;
}
.tender-form-field .form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--xi-muted);
  margin-bottom: 4px;
}
.tender-form-field .form-control,
.tender-form-field .form-select {
  border-radius: 10px;
  border-color: #d1d5db;
  font-size: 13px;
  padding: 8px 12px;
  min-height: 38px;
}
.tender-form-field .form-control:focus,
.tender-form-field .form-select:focus {
  border-color: rgba(var(--xi-accent-rgb), .55);
  box-shadow: 0 0 0 .25rem rgba(var(--xi-accent-rgb), .12);
}
.tender-form-field select[multiple] {
  min-height: 100px;
}
.tender-form-field .errorlist {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  font-size: 12px;
  color: #b91c1c;
  font-weight: 600;
}
.tender-form-field .invalid-feedback {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #b91c1c;
  font-weight: 600;
}
.tender-form-field .invalid-feedback,
.tender-form-field .is-invalid {
  border-color: #b91c1c !important;
}
.tender-form-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 8px;
}
.tender-form-field--inline .form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin: 0;
  min-height: 0;
}
.tender-form-field--inline .form-check-input {
  margin: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border-color: #d1d5db;
}
.tender-form-field--inline .form-check-input:checked {
  background-color: var(--xi-accent);
  border-color: var(--xi-accent);
}
.tender-form-field--inline .form-check-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--xi-text);
}
.tender-form-side {
  position: sticky;
  top: 88px;
}
.tender-form-side-inner {
  display: grid;
  gap: 14px;
}
.tender-form-card {
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  border-radius: 14px;
  padding: 16px;
}
.tender-form-card-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--xi-muted);
  margin-bottom: 12px;
}
.tender-form-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
  margin-bottom: 8px;
}
.tender-form-btn:last-child {
  margin-bottom: 0;
}
.tender-form-btn--primary {
  background: var(--xi-accent);
  color: #fff;
  border-color: var(--xi-accent);
}
.tender-form-btn--primary:hover {
  background: var(--xi-orange-dark);
  color: #fff;
}
.tender-form-btn--outline {
  background: var(--xi-surface);
  color: var(--xi-text);
  border-color: var(--xi-border);
}
.tender-form-btn--outline:hover {
  border-color: rgba(var(--xi-accent-rgb), .28);
  color: var(--xi-orange-dark);
}
.tender-form-btn--ghost {
  background: transparent;
  color: var(--xi-muted);
  border-color: transparent;
}
.tender-form-btn--ghost:hover {
  color: #b91c1c;
  background: rgba(185,28,28,.06);
}
.tender-form-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #edf0f3;
  font-size: 12px;
}
.tender-form-meta:last-child {
  border-bottom: none;
}
.tender-form-meta-key {
  color: var(--xi-muted);
  font-weight: 600;
}
.tender-form-meta-value {
  color: var(--xi-text);
  font-weight: 700;
  text-align: right;
}
@media (max-width: 991.98px) {
  .tender-form-layout {
    grid-template-columns: 1fr;
  }
  .tender-form-side {
    position: static;
  }
  .tender-form-side-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
.tender-doc-list {
  display: grid;
  gap: 6px;
}
.tender-doc-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--xi-border);
  border-radius: 10px;
  background: #fff;
  transition: border-color .16s ease;
}
.tender-doc-item:hover {
  border-color: rgba(var(--xi-accent-rgb), .22);
}
.tender-doc-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(var(--xi-accent-rgb), .08);
  color: var(--xi-orange-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex: 0 0 auto;
}
.tender-doc-body {
  flex: 1;
  min-width: 0;
}
.tender-doc-name {
  font-size: 13px;
  font-weight: 700;
}
.tender-doc-name a {
  color: var(--xi-text);
  text-decoration: none;
}
.tender-doc-name a:hover {
  color: var(--xi-accent);
  text-decoration: underline;
}
.tender-doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
  font-size: 11px;
  color: var(--xi-muted);
  align-items: center;
}
.tender-doc-category {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tender-doc-category--tender_doc { background: #dbeafe; color: #2563eb; }
.tender-doc-category--supplier_quote { background: #dcfce7; color: #15803d; }
.tender-doc-category--compliance { background: #fef3c7; color: #d97706; }
.tender-doc-category--other { background: var(--xi-body-bg); color: var(--xi-muted); }
.tender-doc-delete {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--xi-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.tender-doc-delete:hover {
  background: rgba(185,28,28,.1);
  color: #b91c1c;
}
.tender-doc-upload {
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  background: var(--xi-surface);
}
.tender-doc-upload-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--xi-orange-dark);
  cursor: pointer;
  list-style: none;
}
.tender-doc-upload-summary::-webkit-details-marker {
  display: none;
}
.tender-doc-upload-summary:hover {
  background: rgba(var(--xi-accent-rgb), .04);
}

@media (max-width: 767.98px) {
  .tender-form-grid-2,
  .tender-form-grid-3 {
    grid-template-columns: 1fr;
  }
  .tender-form-side-inner {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════════════════
   Authentication screens (sign in, sign out, password reset/change)

   Scoped to body.xi-auth so these styles never bleed into the app shell.
   Replaces the previous body.xi-login block.
   ══════════════════════════════════════════════════════════════════ */
body.xi-auth {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(1100px 560px at 8% 4%, rgba(var(--xi-accent-rgb), .10), transparent 58%),
    radial-gradient(900px 520px at 96% 10%, rgba(15, 23, 42, .05), transparent 60%),
    linear-gradient(180deg, #ffffff, #fafafb);
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
}

/* Keyboard-only users can jump straight to the form. */
body.xi-auth .xi-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  padding: .6rem 1rem;
  background: #0f172a;
  color: #fff;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}
body.xi-auth .xi-skip-link:focus { left: 0; }

body.xi-auth .xi-auth-shell { min-height: 100vh; display: flex; align-items: stretch; }
body.xi-auth .xi-auth-row { min-height: 100vh; flex-wrap: nowrap; }
body.xi-auth .xi-auth-panel-wrap { min-height: 100vh; }
body.xi-auth .xi-auth-form-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

/* ── Brand / marketing panel ─────────────────────────────────────── */
body.xi-auth .xi-auth-panel {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  color: #f8fafc;
  background:
    radial-gradient(900px 620px at 12% 8%, rgba(var(--xi-accent-rgb), .30), transparent 60%),
    radial-gradient(760px 560px at 88% 30%, rgba(37, 99, 235, .16), transparent 62%),
    linear-gradient(155deg, #0b1220 0%, #131c2e 55%, #0d1524 100%);
}
body.xi-auth .xi-auth-panel-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 30% 25%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 30% 25%, #000 0%, transparent 78%);
  opacity: .5;
  pointer-events: none;
}
body.xi-auth .xi-auth-panel-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  right: -190px;
  bottom: -190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--xi-accent-rgb), .34), transparent 66%);
  filter: blur(12px);
  pointer-events: none;
}
body.xi-auth .xi-auth-panel-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  padding: 44px 40px;
}
body.xi-auth .xi-auth-brand { display: flex; align-items: center; gap: 13px; }
body.xi-auth .xi-mark { width: 42px; height: 42px; flex: 0 0 auto; }
body.xi-auth .xi-auth-brand-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: #fff;
}
body.xi-auth .xi-auth-brand-title--dark { color: #0f172a; }
body.xi-auth .xi-auth-brand-sub {
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, .76);
  margin-top: 3px;
}
body.xi-auth .xi-auth-brand-sub--dark { color: #64748b; }

body.xi-auth .xi-auth-pitch { margin-top: auto; padding-top: 44px; }
body.xi-auth .xi-auth-pitch-title {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.028em;
  color: #fff;
  margin: 0 0 12px;
  max-width: 15ch;
}
body.xi-auth .xi-auth-pitch-sub {
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(226, 232, 240, .84);
  margin: 0;
  max-width: 42ch;
}

body.xi-auth .xi-auth-features {
  list-style: none;
  margin: 30px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
body.xi-auth .xi-auth-features li {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(226, 232, 240, .86);
}
body.xi-auth .xi-auth-features strong {
  display: block;
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 2px;
}
body.xi-auth .xi-auth-feature-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  font-size: 14px;
  color: #FFB27A;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .10);
}

body.xi-auth .xi-auth-panel-foot { margin-top: auto; padding-top: 40px; }
body.xi-auth .xi-auth-trust {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: rgba(226, 232, 240, .72);
}
body.xi-auth .xi-auth-trust-item { display: inline-flex; align-items: center; gap: 5px; }
body.xi-auth .xi-auth-trust-dot { opacity: .5; }
body.xi-auth .xi-auth-copy {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(226, 232, 240, .62);
}

/* ── Form column ─────────────────────────────────────────────────── */
body.xi-auth .xi-auth-form { width: 100%; max-width: 408px; }

body.xi-auth .xi-auth-mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}
body.xi-auth .xi-auth-head { margin-bottom: 24px; }
body.xi-auth .xi-auth-title {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.028em;
  color: #0f172a;
  margin: 0 0 7px;
  line-height: 1.2;
}
body.xi-auth .xi-auth-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0;
  line-height: 1.55;
}
body.xi-auth .xi-auth-strong { color: #0f172a; font-weight: 700; }

/* ── Alerts ──────────────────────────────────────────────────────── */
body.xi-auth .xi-auth-alerts { display: flex; flex-direction: column; gap: 12px; }
body.xi-auth .xi-auth-alerts:not(:empty) { margin-bottom: 22px; }
body.xi-auth .xi-auth-alert {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid;
}
body.xi-auth .xi-auth-alert strong { display: block; font-weight: 700; }
body.xi-auth .xi-auth-alert a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
body.xi-auth .xi-auth-alert-icon { font-size: 16px; flex: 0 0 auto; margin-top: 1px; line-height: 1; }

body.xi-auth .xi-auth-alert--error {
  color: #991b1b;
  background: rgba(185, 28, 28, .05);
  border-color: rgba(185, 28, 28, .20);
}
body.xi-auth .xi-auth-alert--warning {
  color: #854d0e;
  background: rgba(217, 119, 6, .07);
  border-color: rgba(217, 119, 6, .24);
}
body.xi-auth .xi-auth-alert--info {
  color: #1e40af;
  background: rgba(37, 99, 235, .06);
  border-color: rgba(37, 99, 235, .20);
}
body.xi-auth .xi-auth-alert--ok {
  color: #065f46;
  background: rgba(5, 150, 105, .07);
  border-color: rgba(5, 150, 105, .22);
}
body.xi-auth .xi-auth-countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

/* ── Fields ──────────────────────────────────────────────────────── */
body.xi-auth .xi-auth-form-el { display: flex; flex-direction: column; gap: 18px; }
body.xi-auth .xi-field { display: flex; flex-direction: column; }
body.xi-auth .xi-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 7px;
  letter-spacing: .005em;
}
body.xi-auth .xi-field-link {
  font-size: 12.5px;
  font-weight: 600;
  /* #E85C00 is only 3.5:1 on white; this shade clears WCAG AA (4.68:1). */
  color: #C25000;
  white-space: nowrap;
  /* Sits in the options row opposite the checkbox, so it needs to read as a
     peer of it: centre-aligned, and with a target past the 24px WCAG 2.5.8
     minimum rather than the ~17px a bare text link would give. */
  align-self: center;
  padding: 6px 4px;
  margin: -6px -4px;
}
body.xi-auth .xi-field-link:hover { color: var(--xi-orange-dark); text-decoration: underline; text-underline-offset: 2px; }

body.xi-auth .xi-field-control { position: relative; display: block; }
body.xi-auth .xi-input {
  width: 100%;
  height: 46px;
  border-radius: 10px;
  border: 1px solid #dfe3e8;
  background: #fff;
  padding: 0 13px;
  font-size: 14px;
  color: #0f172a;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
body.xi-auth .xi-input::placeholder { color: #6b7686; }
body.xi-auth .xi-input:hover:not(:focus) { border-color: #cbd2d9; }
body.xi-auth .xi-input:focus {
  border-color: rgba(var(--xi-accent-rgb), .65);
  box-shadow: 0 0 0 3.5px rgba(var(--xi-accent-rgb), .13);
  outline: none;
  background: #fff;
}
body.xi-auth .xi-input--icon { padding-left: 40px; }
body.xi-auth .xi-input--icon-end { padding-right: 44px; }
body.xi-auth .xi-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: #94a3b8;
  pointer-events: none;
  transition: color .15s ease;
}
body.xi-auth .xi-input:focus ~ .xi-field-icon,
body.xi-auth .xi-field-control:focus-within .xi-field-icon { color: var(--xi-accent); }
body.xi-auth .xi-field-btn {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 15px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
body.xi-auth .xi-field-btn:hover { background: #f1f3f6; color: #334155; }
body.xi-auth .xi-field-btn:focus-visible { outline: 2px solid var(--xi-accent); outline-offset: 1px; }

body.xi-auth .xi-field.is-invalid .xi-input {
  border-color: #dc2626;
  background: rgba(220, 38, 38, .02);
}
body.xi-auth .xi-field.is-invalid .xi-input:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3.5px rgba(220, 38, 38, .13);
}
body.xi-auth .xi-field.is-invalid .xi-field-icon { color: #dc2626; }
body.xi-auth .xi-field-error {
  font-size: 12px;
  color: #b91c1c;
  margin-top: 6px;
  font-weight: 500;
}

body.xi-auth .xi-caps-warning {
  font-size: 12px;
  color: #854d0e;
  background: rgba(217, 119, 6, .08);
  border: 1px solid rgba(217, 119, 6, .22);
  border-radius: 8px;
  padding: 6px 9px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
body.xi-auth .xi-caps-warning[hidden] { display: none; }

/* ── Options row ─────────────────────────────────────────────────── */
body.xi-auth .xi-auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: -2px;
  margin-bottom: 2px;
}
/* The raw checkbox is only 16px, so the label carries the real hit area:
   padding plus the row's own padding lift the effective target past the
   24px WCAG 2.5.8 minimum without changing the visual weight. */
body.xi-auth .xi-check { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 0; }
body.xi-auth .xi-check .form-check-input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
  border-color: #cbd2d9;
  cursor: pointer;
}
body.xi-auth .xi-check .form-check-input:checked {
  background-color: var(--xi-accent);
  border-color: var(--xi-accent);
}
body.xi-auth .xi-check .form-check-input:focus {
  box-shadow: 0 0 0 3.5px rgba(var(--xi-accent-rgb), .15);
  border-color: var(--xi-accent);
}
body.xi-auth .xi-check .form-check-label {
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  user-select: none;
  padding: 6px 4px;
  margin: -6px -4px;
}
body.xi-auth .xi-auth-attempts {
  font-size: 12px;
  color: #b45309;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  /* Own line under the options row, so it no longer competes for the right
     side with "Forgot password?" when the flex row wraps on narrow screens. */
  margin-top: 6px;
}
body.xi-auth .xi-auth-attempts[hidden] { display: none; }

/* ── Buttons ─────────────────────────────────────────────────────── */
body.xi-auth .xi-btn {
  height: 46px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .005em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  transition: filter .15s ease, box-shadow .15s ease, background-color .15s ease;
}
body.xi-auth .xi-btn--block { width: 100%; }
body.xi-auth .xi-btn:active { transform: translateY(1px); }
body.xi-auth .xi-btn:focus-visible { outline: none; box-shadow: 0 0 0 3.5px rgba(var(--xi-accent-rgb), .28); }
body.xi-auth .xi-btn:disabled { opacity: .72; cursor: not-allowed; }

/* Loading state: swap the label for a spinner to prevent double-submits. */
body.xi-auth .xi-btn-spinner { display: none; }
body.xi-auth .xi-btn.is-loading .xi-btn-label { display: none; }
body.xi-auth .xi-btn.is-loading .xi-btn-spinner { display: inline-block; }

body.xi-auth .xi-auth-btn-row { display: flex; flex-direction: column; gap: 10px; }
body.xi-auth .xi-auth-noscript { font-size: 12.5px; color: #64748b; text-align: center; margin: 0; }

/* ── Card layout (sign out, password pages) ──────────────────────── */
body.xi-auth .xi-auth-card { text-align: left; }
body.xi-auth .xi-auth-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 20px;
  color: var(--xi-accent);
  background: rgba(var(--xi-accent-rgb), .10);
  border: 1px solid rgba(var(--xi-accent-rgb), .20);
}
body.xi-auth .xi-auth-card-icon--warn {
  color: #b45309;
  background: rgba(217, 119, 6, .10);
  border-color: rgba(217, 119, 6, .22);
}
body.xi-auth .xi-auth-card-icon--ok {
  color: #047857;
  background: rgba(5, 150, 105, .10);
  border-color: rgba(5, 150, 105, .22);
}
body.xi-auth .xi-auth-card .xi-auth-head { margin-bottom: 22px; }
body.xi-auth .xi-auth-card .xi-auth-form-el { margin-top: 20px; }

body.xi-auth .xi-auth-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #64748b;
  margin: 20px 0 0;
  padding: 11px 13px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #eef1f4;
}
body.xi-auth .xi-auth-note i { margin-top: 1px; color: #94a3b8; }
body.xi-auth .xi-auth-alt {
  margin-top: 22px;
  font-size: 13px;
  color: #64748b;
  text-align: center;
}
body.xi-auth .xi-auth-alt a { color: #C25000; font-weight: 600; }
body.xi-auth .xi-auth-alt a:hover { color: var(--xi-orange-dark); text-decoration: underline; text-underline-offset: 2px; }

body.xi-auth .xi-auth-steps {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
body.xi-auth .xi-auth-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #475569;
}
body.xi-auth .xi-auth-step-num {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--xi-accent);
  background: rgba(var(--xi-accent-rgb), .10);
}

body.xi-auth .xi-auth-foot { margin-top: 32px; }
body.xi-auth .xi-auth-foot .xi-auth-copy { color: #64748b; }
body.xi-auth .xi-auth-foot .xi-auth-trust { color: #64748b; }

/* ── Sign-out button must not inherit browser button chrome ──────── */
/* Zero-specificity via :where() so the existing .account-dropdown-logout /
   .account-logout rules keep winning on padding, colour and border-top. */
:where(.xi-logout-form) :where(button) {
  width: 100%;
  margin: 0;
  border: 0;
  background: none;
  font: inherit;
  line-height: inherit;
  color: inherit;
  text-align: inherit;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.xi-logout-form { margin: 0; padding: 0; }
.xi-logout-form button:focus-visible {
  outline: 2px solid var(--xi-accent);
  outline-offset: -2px;
  border-radius: 6px;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  body.xi-auth .xi-auth-form-wrap { min-height: 100vh; align-items: flex-start; padding-top: 40px; }
  body.xi-auth .xi-auth-form { max-width: 460px; margin: 0 auto; }
}
@media (min-width: 1200px) {
  body.xi-auth .xi-auth-panel-inner { padding: 52px 46px; }
  body.xi-auth .xi-auth-pitch-title { font-size: 30px; }
}
@media (max-width: 420px) {
  body.xi-auth .xi-auth-form-wrap { padding: 28px 16px; }
  body.xi-auth .xi-auth-title { font-size: 22px; }
}

/* Respect users who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  body.xi-auth *, body.xi-auth *::before, body.xi-auth *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* ── Tender Kanban Board ──────────────────────────────────────────── */
.tender-board { padding: 0 0 24px; }
.tender-board-toolbar { margin-bottom: 20px; }
.tender-board-hint { font-size: .8125rem; color: #64748b; }
.tender-board-cols {
  display: flex; gap: 16px; overflow-x: auto;
  align-items: flex-start; min-height: 70vh; padding-bottom: 16px;
}
.tender-board-col {
  flex: 0 0 260px; min-width: 260px; max-width: 260px;
  display: flex; flex-direction: column;
  background: #f1f5f9; border-radius: 12px;
}
.tender-board-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 14px 10px; font-size: .875rem; font-weight: 600;
  color: #1e293b; border-bottom: 1px solid #e2e8f0;
}
.tender-board-col-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tender-board-col-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tender-board-col-count {
  background: #e2e8f0; color: #475569; font-size: .75rem; font-weight: 700;
  padding: 1px 8px; border-radius: 10px; flex-shrink: 0;
}
.tender-board-dropzone {
  flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 8px;
  min-height: 100px; transition: background .15s; border-radius: 0 0 12px 12px;
}
.tender-board-dropzone.is-over { background: #dbeafe; }
.tender-board-card {
  display: block; text-decoration: none;
  background: #fff; border-radius: 8px; padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); cursor: grab;
  transition: box-shadow .15s, transform .15s, opacity .15s;
  border: 1px solid #e2e8f0;
}
.tender-board-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); transform: translateY(-1px); }
.tender-board-card.is-dragging { opacity: .4; }
.tender-board-card.is-overdue { border-left: 3px solid #ef4444; }
.tender-board-card-ref { font-size: .75rem; font-weight: 700; color: var(--board-color, #64748b); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.tender-board-card-title { font-size: .8125rem; font-weight: 600; color: #1e293b; line-height: 1.3; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tender-board-card-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: .75rem; color: #64748b; margin-bottom: 6px; }
.tender-board-card-meta span { display: inline-flex; align-items: center; gap: 3px; }
.tender-board-card-footer { display: flex; align-items: center; justify-content: space-between; }
.tender-board-card-priority { font-size: .6875rem; font-weight: 600; padding: 1px 7px; border-radius: 4px; }
.tender-board-card-priority--high { background: #fef2f2; color: #dc2626; }
.tender-board-card-priority--medium { background: #fffbeb; color: #d97706; }
.tender-board-card-priority--low { background: #f0fdf4; color: #16a34a; }
.tender-board-card-prob { font-size: .75rem; font-weight: 700; color: #475569; }
.tender-board-empty { text-align: center; color: #94a3b8; font-size: .8125rem; padding: 20px 0; }

@media (max-width: 991.98px) {
  .tender-board-cols { gap: 12px; }
  .tender-board-col { flex: 0 0 240px; min-width: 240px; max-width: 240px; }
  .tender-board-toolbar .row > .col-lg-3:last-of-type { margin-top: 0; }
}

/* ── Contacts List ────────────────────────────────────────── */
.xi-transfer-banner {
  display: flex;
  align-items: center;
  gap: .85rem;
  background: #fff8f3;
  border: 1px solid #f4c89f;
  border-radius: 10px;
  padding: .85rem 1.1rem;
}
.xi-transfer-banner__icon { font-size: 1.1rem; color: var(--xi-primary, #E85C00); flex-shrink: 0; }
.xi-transfer-banner__body { display: flex; flex-direction: column; gap: .15rem; font-size: .85rem; }
.xi-transfer-banner__body strong { color: var(--xi-text, #1a1a2e); }

.xi-tab {
  display: inline-flex;
  align-items: center;
  padding: .35rem .85rem;
  font-size: .82rem;
  font-weight: 500;
  color: var(--xi-muted, #6b7280);
  border-radius: 6px;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.xi-tab:hover { background: var(--xi-bg, #f9fafb); color: var(--xi-text, #1a1a2e); }
.xi-tab--active { background: var(--xi-primary, #E85C00); color: #fff; }

.xi-filter-panel {
  background: var(--xi-surface, #fff);
  border: 1px solid var(--xi-border, #e5e7eb);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}
.xi-filter-panel__nav { display: flex; gap: .3rem; flex-wrap: wrap; }
.xi-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem .75rem;
  align-items: flex-end;
}
.xi-filter-field { display: flex; flex-direction: column; min-width: 140px; }
.xi-filter-field--search { min-width: 220px; flex: 1; }
.xi-filter-field--actions { flex-direction: row; gap: .5rem; align-items: flex-end; }
.xi-filter-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--xi-muted, #6b7280);
  margin-bottom: .3rem;
}
.xi-search-wrap { position: relative; }
.xi-search-wrap__icon {
  position: absolute;
  left: .55rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .8rem;
  color: var(--xi-muted, #9ca3af);
  pointer-events: none;
}
.xi-search-wrap__input { padding-left: 1.75rem; }

.xi-table-card {
  background: var(--xi-surface, #fff);
  border: 1px solid var(--xi-border, #e5e7eb);
  border-radius: 12px;
  overflow: hidden;
}

.xi-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: .75rem 1.1rem;
  background: var(--xi-bg, #f9fafb);
  border-bottom: 1px solid var(--xi-border, #e5e7eb);
}
.xi-bulk-bar__left  { display: flex; align-items: center; gap: .75rem; }
.xi-bulk-bar__right { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.xi-bulk-bar__count {
  font-size: .8rem;
  font-weight: 600;
  color: var(--xi-muted, #6b7280);
  padding: .2rem .6rem;
  background: var(--xi-surface, #fff);
  border: 1px solid var(--xi-border, #e5e7eb);
  border-radius: 20px;
}
.xi-bulk-bar__divider {
  width: 1px;
  height: 1.5rem;
  background: var(--xi-border, #e5e7eb);
}

.xi-contacts-table { font-size: .835rem; }
.xi-contacts-table thead tr {
  background: var(--xi-bg, #f9fafb);
}
.xi-contacts-table thead th {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--xi-muted, #6b7280);
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--xi-border, #e5e7eb);
  white-space: nowrap;
}
.xi-contacts-table tbody td {
  padding: .65rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--xi-border, #e5e7eb);
  color: var(--xi-text, #1a1a2e);
}
.xi-contacts-table tbody tr:last-child td { border-bottom: none; }
.xi-contacts-table tbody tr:hover td { background: var(--xi-bg, #f9fafb); }

.xi-col-check { width: 36px; padding-left: 1rem !important; padding-right: .5rem !important; }
.xi-col-check .form-check-input {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-top: 0;
  vertical-align: middle;
  border: 1px solid #cbd5e1;
  border-radius: .25rem;
  background-color: #fff;
  cursor: pointer;
}
.xi-col-check .form-check-input:checked {
  background-color: var(--xi-primary, #E85C00);
  border-color: var(--xi-primary, #E85C00);
}
.xi-col-check .form-check-input:indeterminate {
  background-color: var(--xi-primary, #E85C00);
  border-color: var(--xi-primary, #E85C00);
}
.xi-col-actions { width: 72px; text-align: center; }

.xi-contact-cell {
  min-width: 0;
  white-space: nowrap;
}
.xi-contact-meta {
  display: block;
  color: var(--xi-muted, #6b7280);
  font-size: .76rem;
  margin-top: 1px;
}
.xi-contact-name:hover { color: var(--xi-primary, #E85C00); text-decoration: underline; }
.xi-contact-title {
  display: block;
  font-size: .7rem;
  color: #fff;
  background: var(--xi-primary, #E85C00);
  padding: 1px 7px;
  border-radius: 10px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: fit-content;
}

.xi-company-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.xi-company-link {
  color: var(--xi-muted, #4b5563);
  text-decoration: none;
  font-size: .82rem;
}
.xi-company-link:hover { color: var(--xi-primary, #E85C00); }
.xi-company-sub {
  font-size: .72rem;
  color: var(--xi-muted, #9ca3af);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xi-company-sub a { color: inherit; }
.xi-company-sub a:hover { color: var(--xi-primary, #E85C00); }

.xi-status-badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 500;
  padding: .2rem .6rem;
  border-radius: 20px;
  background: var(--xi-bg, #f3f4f6);
  color: var(--xi-text, #374151);
  white-space: nowrap;
}

.xi-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  font-size: .78rem;
  font-weight: 700;
}
.xi-score--high { background: #d1fae5; color: #065f46; }
.xi-score--mid  { background: #fef3c7; color: #92400e; }
.xi-score--low  { background: #fee2e2; color: #991b1b; }

.xi-status-select {
  min-width: 138px;
  font-size: .8rem;
  border-radius: 8px;
  border-color: var(--xi-border, #e5e7eb);
  background-color: #fff;
}

.xi-msg-cell {
  display: block;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  max-width: 200px;
  white-space: nowrap;
}
.xi-msg-cell__text { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; color: var(--xi-text, #1a1a2e); line-height: 1.3; }
.xi-msg-cell__placeholder { font-size: .8rem; color: #c0c9d6; font-style: italic; }
.xi-msg-cell:hover .xi-msg-cell__text { color: var(--xi-primary, #E85C00); }

.xi-phone { color: var(--xi-muted, #4b5563); font-size: .82rem; }

.xi-followup-input {
  min-width: 130px;
  font-size: .8rem;
  border-radius: 6px;
  border-color: var(--xi-border, #e5e7eb);
}

.xi-email-link {
  font-size: .8rem;
  color: var(--xi-muted, #4b5563);
  text-decoration: none;
}
.xi-email-link:hover { color: var(--xi-primary, #E85C00); }

.xi-email-cell { line-height: 1.5; }
.xi-email-action {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  margin-top: .15rem;
  font-size: .72rem;
  color: var(--xi-primary, #E85C00);
  text-decoration: none;
}
.xi-email-action:hover { text-decoration: underline; }

.xi-owner { font-size: .82rem; color: var(--xi-text, #1a1a2e); }
.xi-owner__name {
  display: inline-block;
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--xi-text, #1a1a2e);
  font-weight: 600;
}

.xi-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 6px;
  color: var(--xi-muted, #6b7280);
  text-decoration: none;
  transition: background .15s, color .15s;
  font-size: .9rem;
}
.xi-action-btn:hover { background: var(--xi-bg, #f3f4f6); color: var(--xi-text, #1a1a2e); }
.xi-action-btn--danger:hover { background: #fee2e2; color: #dc2626; }
.xi-action-btn--disabled { opacity: .35; pointer-events: none; }

.xi-empty { color: #c9d0da; }
.xi-empty-state {
  padding: 3.5rem 1rem !important;
  text-align: center;
  color: var(--xi-muted, #6b7280);
  font-size: .9rem;
}
.xi-empty-state__icon { font-size: 2rem; color: #d1d5db; display: block; margin-bottom: .75rem; }
.xi-empty-state__sub { font-size: .8rem; color: #9ca3af; margin-top: .25rem; }

.xi-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .9rem 1.1rem;
  border-top: 1px solid var(--xi-border, #e5e7eb);
}
.xi-pagination__info { font-size: .82rem; color: var(--xi-muted, #6b7280); padding: 0 .5rem; }

.xi-modal { border-radius: 14px; border: none; }
.xi-modal__header {
  border-bottom: 1px solid var(--xi-border, #e5e7eb);
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.xi-modal__title { font-size: 1rem; font-weight: 700; color: var(--xi-text, #1a1a2e); margin: 0; }
.xi-modal__sub { font-size: .78rem; color: var(--xi-muted, #6b7280); margin-top: .1rem; }
.xi-modal__body { padding: 1.2rem 1.4rem; }
.xi-modal__textarea { border-radius: 8px; font-size: .875rem; resize: vertical; }
.xi-modal__meta-grid { margin-top: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.xi-modal__meta-row { display: flex; gap: .5rem; font-size: .78rem; }
.xi-modal__meta-label { font-weight: 600; color: var(--xi-muted, #6b7280); min-width: 90px; }
.xi-modal__meta-value { color: var(--xi-text, #374151); }

@media (max-width: 768px) {
  .xi-kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .xi-page-header { flex-direction: column; }
  .xi-bulk-bar { flex-direction: column; align-items: flex-start; }
}

/* ── Document Repository ───────────────────────────────────── */
.doc-shell .form-label { margin-bottom: .25rem; }
.doc-shell .form-control,
.doc-shell .form-select { font-size: .82rem; border-radius: 10px; }

/* ── Reports ────────────────────────────────────────────────── */
.reports-shell .stat-card { transition: border-color .16s ease, transform .16s ease; }
.reports-shell a .stat-card:hover { border-color: rgba(var(--xi-accent-rgb), .28); transform: translateY(-1px); }
.reports-shell .table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; white-space: nowrap; }
.reports-shell .table td { vertical-align: middle; font-size: 13px; }

/* ── KPI Dashboard ──────────────────────────────────────────── */
.kpi-shell .form-label { margin-bottom: .25rem; }

/* ── Google Drive Link ──────────────────────────────────────── */
.drive-link-group .drive-link-group__icon {
  background: #4285F4;
  border-color: #4285F4;
  color: #fff;
  border-radius: 10px 0 0 10px;
}
.drive-link-group .form-control { border-radius: 0 10px 10px 0; }

.tender-record-field .tender-drive-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: #4285F4;
  font-weight: 600;
  text-decoration: none;
}
.tender-record-field .tender-drive-link:hover { text-decoration: underline; }

.tender-drive-banner {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .9rem 1.1rem;
  margin-bottom: 1rem;
  background: linear-gradient(90deg, rgba(66,133,244,.08), rgba(66,133,244,.02));
  border: 1px solid rgba(66,133,244,.35);
  border-radius: 12px;
  text-decoration: none;
  color: var(--xi-text, #1a1a2e);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tender-drive-banner:hover {
  border-color: #4285F4;
  box-shadow: 0 2px 10px rgba(66,133,244,.15);
  color: var(--xi-text, #1a1a2e);
}
.tender-drive-banner__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: #4285F4;
  color: #fff;
  font-size: 1.15rem;
  flex: 0 0 auto;
}
.tender-drive-banner__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tender-drive-banner__body strong { font-size: .9rem; }
.tender-drive-banner__body span { font-size: .78rem; color: var(--xi-muted, #6b7280); }
.tender-drive-banner__action {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: .8rem;
  font-weight: 600;
  color: #4285F4;
  white-space: nowrap;
}

/* ── Potential Clients ─────────────────────────────────────── */
.xi-pc-section-title {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .95rem 1.15rem;
  font-size: .9rem;
  font-weight: 700;
  color: var(--xi-text, #1a1a2e);
  border-bottom: 1px solid var(--xi-border, #e5e7eb);
}
.xi-pc-section-title i { color: var(--xi-primary, #E85C00); }

.xi-pc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .75rem;
}
.xi-pc-branch-card {
  background: var(--xi-surface, #fff);
  border: 1px solid var(--xi-border, #e5e7eb);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.xi-pc-branch-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .7rem;
}
.xi-pc-branch-card__name {
  font-size: .88rem;
  font-weight: 700;
  color: var(--xi-text, #1a1a2e);
}
.xi-pc-branch-card__count {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--xi-primary, #E85C00);
  text-decoration: none;
}
.xi-pc-branch-card__count:hover { text-decoration: underline; }
.xi-pc-branch-card__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: .7rem;
}
.xi-pc-branch-card__stats > div {
  display: flex;
  flex-direction: column;
  font-size: .68rem;
  color: var(--xi-muted, #6b7280);
}
.xi-pc-branch-card__stats strong { font-size: .95rem; color: var(--xi-text, #1a1a2e); }

.xi-progress {
  height: 6px;
  border-radius: 20px;
  background: var(--xi-bg, #f3f4f6);
  overflow: hidden;
}
.xi-progress__bar { height: 100%; border-radius: 20px; }
.xi-progress__bar--orange { background: linear-gradient(90deg, #f97316, var(--xi-primary, #E85C00)); }

.xi-pipeline-bar {
  display: flex;
  align-items: stretch;
  height: 34px;
  margin: .9rem 1.15rem .5rem;
  border-radius: 8px;
  overflow: hidden;
  background: var(--xi-bg, #f3f4f6);
}
.xi-pipeline-bar__seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  color: #fff;
  text-decoration: none;
  transition: filter .15s ease;
  overflow: hidden;
  white-space: nowrap;
}
.xi-pipeline-bar__seg:hover { filter: brightness(1.08); }
.xi-pipeline-bar__seg-label { font-size: .68rem; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.2); padding: 0 .3rem; }
.xi-pipeline-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .8rem;
  padding: 0 1.15rem .95rem;
}
.xi-pipeline-legend__label { font-size: .72rem; color: var(--xi-muted, #6b7280); }

.xi-stage-dot, .xi-stage-mini {
  display: inline-block;
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  flex: 0 0 auto;
}
.xi-stage-mini { width: .62rem; height: .62rem; }

.xi-stage-new { background: #94a3b8; }
.xi-stage-first { background: #38bdf8; }
.xi-stage-followup { background: #f59e0b; }
.xi-stage-warm { background: #6366f1; }
.xi-stage-negotiation { background: #a855f7; }
.xi-stage-closing { background: #ef4444; }
.xi-stage-won { background: #22c55e; }
.xi-stage-lost { background: #1f2937; }

.xi-status-connected { background: #6366f1; color: #fff; }
.xi-status-open-deal { background: #22c55e; color: #fff; }

[data-bs-theme="dark"] .xi-stage-new { background: #64748b; }
[data-bs-theme="dark"] .xi-stage-lost { background: #111827; }

.xi-pipeline-bar__seg--new_lead { background: #94a3b8; }
.xi-pipeline-bar__seg--first_contact_done { background: #38bdf8; }
.xi-pipeline-bar__seg--follow_up_required { background: #f59e0b; }
.xi-pipeline-bar__seg--warm { background: #6366f1; }
.xi-pipeline-bar__seg--negotiation { background: #a855f7; }
.xi-pipeline-bar__seg--deal_closing { background: #ef4444; }
.xi-pipeline-bar__seg--closed_won { background: #22c55e; }
.xi-pipeline-bar__seg--closed_lost { background: #1f2937; }

.xi-row-stale { background: rgba(245, 158, 11, .045); }
[data-bs-theme="dark"] .xi-row-stale { background: rgba(245, 158, 11, .06); }

.xi-row-needs { background: rgba(239, 68, 68, .05); }
[data-bs-theme="dark"] .xi-row-needs { background: rgba(239, 68, 68, .08); }

.xi-pc-table .xi-followup-input { min-width: 128px; }
.xi-pc-table .xi-col-actions { width: 120px; }

.xi-note-cell {
  max-width: 220px;
  min-width: 160px;
}
.xi-note-cell__text {
  display: block;
  color: var(--xi-text, #374151);
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .xi-pc-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   ERP Sidebar Navigation (apps/core/nav.py -> includes/sidebar_nav.html)
   ========================================================================== */
.xi-nav {
  display: flex;
  flex-direction: column;
  padding: 0 .25rem 1rem;
  position: relative;
}
.xi-nav.is-searching .xi-menu { display: none; }

/* --- Search ------------------------------------------------------------ */
.xi-nav-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 .4rem .25rem;
}
.xi-nav-search__icon {
  position: absolute;
  left: .65rem;
  color: var(--xi-sidebar-muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  pointer-events: none;
}
.xi-nav-search__input {
  width: 100%;
  min-height: 34px;
  padding: .35rem .65rem .35rem 2rem;
  border: 1px solid var(--xi-sidebar-border);
  border-radius: 9px;
  background: var(--xi-sidebar-bg);
  color: var(--xi-sidebar-text);
  font-size: 12.5px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.xi-nav-search__input::placeholder { color: var(--xi-sidebar-muted); opacity: 1; }
.xi-nav-search__input:focus {
  outline: none;
  border-color: rgba(var(--xi-accent-rgb), .55);
  box-shadow: 0 0 0 3px rgba(var(--xi-accent-rgb), .12);
}
.xi-nav-search__kbd {
  position: absolute;
  right: .55rem;
  font-size: 10px;
  line-height: 1;
  padding: 3px 6px;
  border: 1px solid var(--xi-sidebar-border);
  border-radius: 5px;
  color: var(--xi-sidebar-muted);
  background: transparent;
}

/* Search results dropdown */
.xi-nav-results {
  position: absolute;
  z-index: 2001;
  top: 42px;
  left: .5rem;
  right: .5rem;
  max-height: min(380px, 60vh);
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--xi-surface, #fff);
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
}
[data-bs-theme="dark"] .xi-nav-results {
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.xi-nav-results__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--xi-text);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.xi-nav-results__item:hover { background: var(--xi-sidebar-hover); }
.xi-nav-results__item.is-active { background: var(--xi-sidebar-hover); }
.xi-nav-results__item:focus-visible { outline: 2px solid var(--xi-accent); outline-offset: -2px; }
.xi-nav-results__icon { color: var(--xi-orange-dark); font-size: 14px; width: 16px; flex: 0 0 auto; }
.xi-nav-results__meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.xi-nav-results__label { font-weight: 600; }
.xi-nav-results__label mark { background: transparent; color: var(--xi-accent); font-weight: 800; }
.xi-nav-results__group { font-size: 11px; color: var(--xi-muted); }
.xi-nav-results__disabled {
  opacity: .55;
  cursor: default;
}
.xi-nav-results__empty { padding: 10px 12px; color: var(--xi-muted); font-size: 12.5px; }
.xi-nav-results__hint { padding: 6px 10px 2px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--xi-muted); }

/* --- Groups ------------------------------------------------------------ */
.xi-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}
.xi-menu-group { position: relative; }
.xi-menu-group__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  padding: .5rem .7rem;
  margin: 1px .4rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--xi-sidebar-text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.xi-menu-group__toggle:hover { color: var(--xi-orange-dark); background: var(--xi-sidebar-hover); }
.xi-menu-group__toggle:focus-visible { outline: 2px solid var(--xi-accent); outline-offset: -2px; }
.xi-menu-group.is-active-group > .xi-menu-group__toggle { color: var(--xi-orange-dark); }
.xi-menu-group__icon { width: 20px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.xi-menu-group__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xi-menu-group__caret { font-size: 12px; color: var(--xi-sidebar-muted); transition: transform .18s ease; flex: 0 0 auto; }
.xi-menu-group.is-open > .xi-menu-group__toggle .xi-menu-group__caret { transform: rotate(180deg); }

/* Smooth expand / collapse via grid-template-rows */
.xi-menu-group__panel {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows .22s ease, visibility 0s .22s;
}
.xi-menu-group__panel > .xi-menu-group__items {
  min-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0 0 .15rem;
  list-style: none;
}
.xi-menu-group.is-open > .xi-menu-group__panel {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows .22s ease, visibility 0s;
}
.xi-menu-group:not(.is-open) > .xi-menu-group__panel { visibility: hidden; }

.xi-menu-item .nav-link {
  padding-left: 2.05rem;
  font-size: 12.75px;
}
.xi-menu-item .nav-link .xi-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-link--planned {
  display: flex;
  align-items: center;
  opacity: .62;
  cursor: default;
  color: var(--xi-sidebar-muted) !important;
  background: transparent !important;
}
.xi-nav-planned {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--xi-orange-dark);
  background: var(--xi-orange-light);
  border: 1px solid rgba(var(--xi-accent-rgb), .22);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}
[data-bs-theme="dark"] .xi-nav-planned { color: #ffb37e; background: rgba(var(--xi-accent-rgb), .14); }

.xi-nav-empty {
  margin: 1rem .75rem;
  font-size: 12px;
  color: var(--xi-sidebar-muted);
  list-style: none;
}

.xi-menu-group__items ::marker { display: none; }

/* Auto-scroll active item into view */
.xi-menu-group.is-open .nav-link.active { scroll-margin-top: 8px; }

/* Initial alignment pass only: suppress open/close animation while nav.js
   scrolls the active item into view on page load, preventing a flash of the
   sidebar's top section (brand/search) when moving between sub-menus. */
.xi-nav.xi-nav-init .xi-menu-group__panel,
.xi-nav.xi-nav-init .xi-menu-group__caret { transition: none; }

/* --- Collapsed (icon-only) mode -------------------------------------- */
/* Scoped to .sidebar so the body-level collapsed flyout (.xi-nav-flyout,
   JS-cloned from the submenu) keeps its full labels + links visible. */
body.xi-sidebar-collapsed .sidebar .xi-nav { padding-top: .35rem; }
body.xi-sidebar-collapsed .sidebar .xi-nav-search { display: none; }
body.xi-sidebar-collapsed .sidebar .xi-menu-group__label,
body.xi-sidebar-collapsed .sidebar .xi-menu-group__caret,
body.xi-sidebar-collapsed .sidebar .xi-menu-item .xi-nav-label,
body.xi-sidebar-collapsed .sidebar .xi-nav-planned { display: none; }
body.xi-sidebar-collapsed .sidebar .xi-menu-group__toggle {
  font-size: 0;
  padding: .5rem 0;
  margin: 1px .55rem;
  justify-content: center;
  border-radius: 8px;
  gap: 0;
}
body.xi-sidebar-collapsed .sidebar .xi-menu-group__icon { margin: 0; width: auto; font-size: 16px; }
body.xi-sidebar-collapsed .sidebar .xi-menu-group__panel { display: none; }
body.xi-sidebar-collapsed .sidebar .xi-menu-item .nav-link { padding-left: 0; background: transparent; }
body.xi-sidebar-collapsed .sidebar .xi-menu-item .nav-link.active { background: transparent; box-shadow: none; }
body.xi-sidebar-collapsed .sidebar .xi-menu-item .nav-link.active::before { display: none; }
body.xi-sidebar-collapsed .sidebar .xi-menu-group__toggle::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--xi-orange-dark, #c44900);
  color: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 4px 14px rgba(232, 92, 0, .35);
  transition: opacity .15s ease;
}
body.xi-sidebar-collapsed .sidebar .xi-menu-group:hover .xi-menu-group__toggle::after,
body.xi-sidebar-collapsed .sidebar .xi-menu-group__toggle:focus-visible::after { opacity: 1; }

/* Collapsed flyout submenu (JS-inserted) */
.xi-nav-flyout {
  position: fixed;
  z-index: 2002;
  min-width: 220px;
  max-width: 300px;
  padding: 6px;
  background: var(--xi-surface, #fff);
  border: 1px solid var(--xi-border);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .20);
}
.xi-nav-flyout[hidden] { display: none; }
.xi-nav-flyout__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--xi-sidebar-muted);
  border-bottom: 1px solid var(--xi-sidebar-border);
  margin-bottom: 4px;
}
.xi-nav-flyout__head i { color: var(--xi-orange-dark); font-size: 12px; }

/* Items: clean flex layout, consistent icon box, strong hover feedback */
.xi-nav-flyout .xi-menu-group__items { padding: 2px 0 4px; }
.xi-nav-flyout .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--xi-sidebar-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.xi-nav-flyout .nav-link i {
  width: 18px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--xi-orange-dark);
  opacity: .75;
}
.xi-nav-flyout .nav-link:hover { color: var(--xi-orange-dark); background: var(--xi-sidebar-hover); }
.xi-nav-flyout .nav-link:hover i { opacity: 1; }
.xi-nav-flyout .nav-link:focus-visible { outline: 2px solid var(--xi-accent); outline-offset: -2px; }
.xi-nav-flyout .nav-link.active {
  color: var(--xi-orange-dark);
  background: var(--xi-orange-light);
  font-weight: 600;
  box-shadow: none;
}
.xi-nav-flyout .nav-link.active i { opacity: 1; }
.xi-nav-flyout .nav-link--planned { background: transparent !important; opacity: .55; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .xi-menu-group__panel { transition: none; }
  .xi-menu-group__caret { transition: none; }
  .sidebar, .main { transition: none; }
}


/* ═══════════════════════════════════════════════════════════════
   Page sections — extracted from inline <style> blocks in templates
   ═══════════════════════════════════════════════════════════════ */

/* ── from templates/accounts/profile.html ── */
.account-shell {
    max-width: 960px;
  }
  .account-grid {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 18px;
  }
  .account-menu,
  .account-summary {
    background: var(--xi-surface);
    border: 1px solid var(--xi-border);
    border-radius: 16px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .06);
    overflow: hidden;
  }
  .account-section-title {
    padding: 14px 18px;
    border-bottom: 1px solid var(--xi-border);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--xi-muted);
    background: linear-gradient(180deg, rgba(15, 23, 42, .02), rgba(15, 23, 42, 0));
  }
  .account-link-list {
    padding: 10px;
    display: grid;
    gap: 4px;
  }
  .account-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--xi-text);
    transition: background .18s ease, transform .18s ease, color .18s ease;
  }
  .account-link:hover {
    background: rgba(var(--xi-accent-rgb), .07);
    color: var(--xi-orange-dark);
    transform: translateX(2px);
  }
  .account-link__main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }
  .account-link__icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--xi-accent-rgb), .08);
    color: var(--xi-orange-dark);
    font-size: 17px;
    flex: 0 0 auto;
  }
  .account-link__text strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: inherit;
  }
  .account-link__text span {
    display: block;
    font-size: 12px;
    color: var(--xi-muted);
    margin-top: 2px;
  }
  .account-link__chevron {
    color: var(--xi-muted);
    font-size: 13px;
  }
  .account-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
  }
  .account-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-top: 1px solid var(--xi-border);
    text-decoration: none;
    color: #dc2626;
    font-size: 15px;
    font-weight: 700;
  }
  .account-logout:hover {
    background: rgba(220, 38, 38, .05);
    color: #b91c1c;
  }
  .account-summary {
    padding: 24px;
  }
  .account-identity {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
  }
  .account-avatar {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(var(--xi-accent-rgb), .14), rgba(15, 23, 42, .04));
    color: var(--xi-orange-dark);
    font-size: 26px;
    font-weight: 800;
    flex: 0 0 auto;
  }
  .account-identity h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--xi-text);
  }
  .account-identity p {
    margin: 5px 0 0;
    color: var(--xi-muted);
    font-size: 14px;
  }
  .account-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
  }
  .account-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(var(--xi-accent-rgb), .08);
    color: var(--xi-orange-dark);
    font-size: 12px;
    font-weight: 700;
  }
  .account-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .account-data-card {
    border: 1px solid var(--xi-border);
    border-radius: 14px;
    padding: 14px 15px;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,240,229,.24));
  }
  .account-data-card .k {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--xi-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .account-data-card .k i {
    font-size: 13px;
  }
  .account-data-card .v {
    font-size: 15px;
    font-weight: 700;
    color: var(--xi-text);
    word-break: break-word;
  }
  @media (max-width: 991.98px) {
    .account-grid {
      grid-template-columns: 1fr;
    }
  }
  @media (max-width: 767.98px) {
    .account-card-grid {
      grid-template-columns: 1fr;
    }
    .account-summary {
      padding: 18px;
    }
    .account-identity {
      align-items: flex-start;
    }
  }

/* ── from templates/contacts/list.html ── */
.xi-filter-field--dates { min-width: 260px; }
  .xi-date-presets {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-bottom: .35rem;
  }
  .xi-date-preset {
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 999px;
    padding: .2rem .6rem;
    font-size: .75rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
  }
  .xi-date-preset:hover { background: #f3f4f6; color: #111827; }
  .xi-date-preset.is-active {
    background: #fff7ed;
    border-color: #fdba74;
    color: #b45309;
  }
  .xi-date-range {
    display: flex;
    align-items: center;
    gap: .3rem;
  }
  .xi-date-range input[type="date"] { min-width: 0; }
  .xi-date-range__sep { color: #9ca3af; font-size: .8rem; }
  .xi-date-clear {
    display: inline-block;
    margin-top: .3rem;
    font-size: .72rem;
    color: #6b7280;
    text-decoration: none;
  }
  .xi-date-clear:hover { color: #b45309; text-decoration: underline; }

/* ── from templates/dashboard/home.html ── */
/* ═══════════════════════════════════════════════
   XI CRM — PROFESSIONAL DASHBOARD STYLES
   ═══════════════════════════════════════════════ */

:root {
  --xi-accent:        #E85C00;
  --xi-accent-light:  #fff3ed;
  --xi-accent-mid:    #ffd4b8;
  --xi-bg:            #f4f5f7;
  --xi-surface:       #ffffff;
  --xi-border:        #e8e8ec;
  --xi-text:          #111827;
  --xi-text-2:        #374151;
  --xi-muted:         #6b7280;
  --xi-muted-2:       #9ca3af;
  --xi-blue:          #2563eb;
  --xi-blue-light:    #eff6ff;
  --xi-green:         #059669;
  --xi-green-light:   #ecfdf5;
  --xi-amber:         #d97706;
  --xi-amber-light:   #fffbeb;
  --xi-red:           #dc2626;
  --xi-red-light:     #fef2f2;
  --xi-purple:        #7c3aed;
  --xi-purple-light:  #f5f3ff;
  --xi-teal:          #0891b2;
  --xi-teal-light:    #ecfeff;
  --xi-radius:        14px;
  --xi-radius-sm:     8px;
  --xi-shadow:        0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --xi-shadow-hover:  0 4px 12px rgba(0,0,0,.10), 0 8px 32px rgba(0,0,0,.06);
}

/* ── Layout ── */
.xi-dashboard { padding: 0 0 40px; }

.db-main-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
  align-items: start;
}
.db-col-left,
.db-col-right { display: flex; flex-direction: column; gap: 20px; }

/* ── Top bar ── */
.db-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.db-greeting__eyebrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.db-greeting__title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--xi-text);
  margin: 0 0 4px;
  line-height: 1.2;
}
.db-greeting__name { color: var(--xi-accent); }
.db-wave { font-style: normal; }
.db-greeting__sub { font-size: 13px; color: var(--xi-muted); margin: 0; }

.db-scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  color: var(--xi-text-2);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: .2px;
}
.db-scope-chip--accent { background: var(--xi-accent); border-color: var(--xi-accent); color: #fff; }
.db-scope-chip--branch { background: var(--xi-blue-light); border-color: #bfdbfe; color: var(--xi-blue); }

.db-topbar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.db-branch-form { display: flex; align-items: center; gap: 8px; }
.db-select-wrap { position: relative; display: flex; align-items: center; }
.db-select-icon { position: absolute; left: 10px; color: var(--xi-muted); font-size: 13px; pointer-events: none; z-index: 1; }
.db-select {
  appearance: none;
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  border-radius: var(--xi-radius-sm);
  padding: 6px 14px 6px 30px;
  font-size: 12.5px;
  color: var(--xi-text);
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.db-select:focus { border-color: var(--xi-accent); }

.db-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--xi-radius-sm);
  border: none;
  cursor: pointer;
  transition: all .15s;
}
.db-btn--ghost {
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  color: var(--xi-text-2);
}
.db-btn--ghost:hover { border-color: var(--xi-accent); color: var(--xi-accent); background: var(--xi-accent-light); }

.db-quick-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.db-quick-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--xi-text-2);
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  border-radius: var(--xi-radius-sm);
  padding: 6px 13px;
  text-decoration: none;
  transition: all .15s;
}
.db-quick-link:hover { border-color: var(--xi-accent); color: var(--xi-accent); background: var(--xi-accent-light); }
.db-quick-link--primary { background: var(--xi-accent); border-color: var(--xi-accent); color: #fff; }
.db-quick-link--primary:hover { background: #c94f00; border-color: #c94f00; color: #fff; }

/* ── KPI Cards ── */
.db-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.db-kpi {
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  border-radius: var(--xi-radius);
  padding: 20px 20px 16px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.db-kpi:hover { box-shadow: var(--xi-shadow-hover); transform: translateY(-2px); }

.db-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--xi-radius) var(--xi-radius) 0 0;
}
.db-kpi--brand::before  { background: var(--xi-accent); }
.db-kpi--info::before   { background: var(--xi-blue); }
.db-kpi--success::before{ background: var(--xi-green); }
.db-kpi--warning::before{ background: var(--xi-amber); }
.db-kpi--danger::before  { background: var(--xi-red); }

.db-kpi__top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.db-kpi__icon-wrap {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.db-kpi__icon-wrap--brand   { background: var(--xi-accent-light); color: var(--xi-accent); }
.db-kpi__icon-wrap--info    { background: var(--xi-blue-light); color: var(--xi-blue); }
.db-kpi__icon-wrap--success { background: var(--xi-green-light); color: var(--xi-green); }
.db-kpi__icon-wrap--warning { background: var(--xi-amber-light); color: var(--xi-amber); }
.db-kpi__icon-wrap--danger  { background: var(--xi-red-light); color: var(--xi-red); }

.db-kpi__trend-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.db-kpi__trend-dot--up   { background: var(--xi-green-light); color: var(--xi-green); }
.db-kpi__trend-dot--down { background: var(--xi-red-light); color: var(--xi-red); }
.db-kpi__trend-dot--warn { background: var(--xi-amber-light); color: var(--xi-amber); }

.db-kpi__value {
  font-size: 28px;
  font-weight: 800;
  color: var(--xi-text);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}
.db-kpi__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--xi-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.db-kpi__footer { margin-bottom: 12px; min-height: 22px; }

.db-kpi__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #f3f4f6;
  color: var(--xi-muted);
  padding: 3px 8px;
  border-radius: 20px;
}
.db-kpi__chip--success { background: var(--xi-green-light); color: var(--xi-green); }
.db-kpi__chip--warning { background: var(--xi-amber-light); color: var(--xi-amber); }
.db-kpi__chip--danger  { background: var(--xi-red-light); color: var(--xi-red); }

.db-kpi__bar-track {
  height: 4px;
  background: #f3f4f6;
  border-radius: 99px;
  overflow: hidden;
}
.db-kpi__bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--xi-accent);
  transition: width 1s cubic-bezier(.4,0,.2,1);
}
.db-kpi__bar-fill--info    { background: var(--xi-blue); }
.db-kpi__bar-fill--success { background: var(--xi-green); }
.db-kpi__bar-fill--warning { background: var(--xi-amber); }
.db-kpi__bar-fill--danger  { background: var(--xi-red); }

/* ── Section Cards ── */
.db-card {
  background: var(--xi-surface);
  border: 1px solid var(--xi-border);
  border-radius: var(--xi-radius);
  overflow: hidden;
  box-shadow: var(--xi-shadow);
  transition: box-shadow .2s;
}
.db-card:hover { box-shadow: var(--xi-shadow-hover); }

.db-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--xi-border);
  gap: 12px;
  flex-wrap: wrap;
}
.db-card__head-left { display: flex; align-items: center; gap: 12px; }
.db-card__head-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.db-card__head-icon--accent  { background: var(--xi-accent-light); color: var(--xi-accent); }
.db-card__head-icon--blue    { background: var(--xi-blue-light); color: var(--xi-blue); }
.db-card__head-icon--green   { background: var(--xi-green-light); color: var(--xi-green); }
.db-card__head-icon--orange  { background: var(--xi-accent-light); color: var(--xi-accent); }
.db-card__head-icon--purple  { background: var(--xi-purple-light); color: var(--xi-purple); }
.db-card__head-icon--teal    { background: var(--xi-teal-light); color: var(--xi-teal); }

.db-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--xi-text);
  line-height: 1.2;
}
.db-card__subtitle { font-size: 11.5px; color: var(--xi-muted); margin-top: 1px; }
.db-card__action {
  font-size: 12px;
  font-weight: 600;
  color: var(--xi-accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: var(--xi-radius-sm);
  transition: background .15s;
}
.db-card__action:hover { background: var(--xi-accent-light); text-decoration: none; }

/* ── Pipeline ── */
.db-pipeline { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.db-pip-row { display: flex; align-items: center; gap: 12px; }
.db-pip-stage {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 130px;
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--xi-text-2);
}
.db-pip-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--xi-accent);
  flex-shrink: 0;
}
.db-pip-track {
  flex: 1;
  height: 8px;
  background: #f3f4f6;
  border-radius: 99px;
  overflow: hidden;
}
.db-pip-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--xi-accent), #ff8c4b);
  border-radius: 99px;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
  min-width: 4px;
}
.db-pip-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 110px;
  flex-shrink: 0;
}
.db-pip-deals { font-size: 11px; color: var(--xi-muted); font-weight: 500; }
.db-pip-val { font-size: 12px; font-weight: 700; color: var(--xi-text); }
.db-pip-pct {
  width: 38px;
  flex-shrink: 0;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--xi-accent);
}

/* ── List Items ── */
.db-list { display: flex; flex-direction: column; }
.db-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid #f3f4f6;
  transition: background .12s;
}
.db-list-item:last-child { border-bottom: none; }
.db-list-item:hover { background: #fafafa; }

.db-list-item__avatar {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--xi-accent), #ff8c4b);
  flex-shrink: 0;
}
.db-list-item__avatar--deal { background: linear-gradient(135deg, var(--xi-blue), #60a5fa); }

.db-list-item__body { flex: 1; min-width: 0; }
.db-list-item__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--xi-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-list-item__meta {
  font-size: 11.5px;
  color: var(--xi-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-list-item__right { text-align: right; flex-shrink: 0; }
.db-list-item__value { font-size: 14px; font-weight: 700; color: var(--xi-text); }
.db-list-item__value-unit { font-size: 11px; font-weight: 500; color: var(--xi-muted); }

/* ── Stage badge ── */
.db-stage-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 3px;
  background: #f3f4f6;
  color: var(--xi-muted);
  text-transform: capitalize;
}

/* ── Source table ── */
.db-src-table-wrap { padding: 0 20px 16px; overflow-x: auto; }
.db-src-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.db-src-table thead th {
  padding: 10px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--xi-muted);
  border-bottom: 1px solid var(--xi-border);
  white-space: nowrap;
}
.db-src-table tbody tr { border-bottom: 1px solid #f3f4f6; transition: background .12s; }
.db-src-table tbody tr:last-child { border-bottom: none; }
.db-src-table tbody tr:hover { background: #fafafa; }
.db-src-table tbody td { padding: 10px 10px; vertical-align: middle; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.db-src-name { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--xi-text); }
.db-src-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--xi-accent); flex-shrink: 0; }
.db-src-num { font-weight: 700; color: var(--xi-text); }
.db-src-num--won { color: var(--xi-green); }
.db-src-val { font-weight: 700; color: var(--xi-text); }

.db-win-rate { display: flex; align-items: center; gap: 8px; justify-content: center; }
.db-win-rate__bar { flex: 1; height: 6px; background: #f3f4f6; border-radius: 99px; overflow: hidden; max-width: 60px; }
.db-win-rate__fill { height: 100%; border-radius: 99px; }
.db-win-rate__fill--good { background: var(--xi-green); }
.db-win-rate__fill--mid  { background: var(--xi-amber); }
.db-win-rate__fill--low  { background: var(--xi-red); }
.db-win-rate__label { font-size: 11.5px; font-weight: 700; color: var(--xi-text); min-width: 30px; text-align: right; }

/* ── Action Centre ── */
.db-card--action-centre { border-top: 3px solid var(--xi-accent); }

.db-action-section { padding: 12px 20px 4px; }
.db-action-section__label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 5px 0 8px;
  margin-bottom: 2px;
}
.db-action-section__label--danger  { color: var(--xi-red); }
.db-action-section__label--success { color: var(--xi-green); }
.db-action-section__label--warning { color: var(--xi-amber); }
.db-action-section__label--info    { color: var(--xi-blue); }

.db-action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--xi-radius-sm);
  margin-bottom: 5px;
  text-decoration: none;
  transition: background .12s, transform .1s;
  border: 1px solid transparent;
}
.db-action-item:hover { transform: translateX(2px); text-decoration: none; }

.db-action-item--danger  { background: #fff8f8; border-color: #fecaca; }
.db-action-item--danger:hover { background: var(--xi-red-light); }
.db-action-item--success { background: #f8fff9; border-color: #bbf7d0; }
.db-action-item--success:hover { background: var(--xi-green-light); }
.db-action-item--warning { background: #fffdf5; border-color: #fde68a; }
.db-action-item--warning:hover { background: var(--xi-amber-light); }
.db-action-item--info    { background: #f8fbff; border-color: #bfdbfe; }
.db-action-item--info:hover { background: var(--xi-blue-light); }

.db-action-item__status {
  font-size: 9px;
  color: var(--xi-red);
  flex-shrink: 0;
}
.db-action-item__status--success { color: var(--xi-green); }

.db-action-item__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--xi-amber), #fbbf24);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.db-action-item__avatar--info { background: linear-gradient(135deg, var(--xi-blue), #60a5fa); }

.db-action-item__body { flex: 1; min-width: 0; }
.db-action-item__title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--xi-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-action-item__meta { font-size: 11px; color: var(--xi-muted); margin-top: 1px; }

.db-action-item__time {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--xi-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.db-action-item__time--danger  { color: var(--xi-red); }
.db-action-item__time--warning { color: var(--xi-amber); }
.db-action-item__time--info    { color: var(--xi-blue); }

.db-clear-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 20px;
  text-align: center;
}
.db-clear-state__icon { font-size: 32px; color: var(--xi-green); }
.db-clear-state__text { font-size: 13.5px; font-weight: 700; color: var(--xi-text); }
.db-clear-state__sub { font-size: 12px; color: var(--xi-muted); }

.db-followup-clear {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--xi-muted);
  padding: 12px 20px 16px;
  font-weight: 500;
}

/* ── Badges ── */
.db-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}
.db-badge--danger { background: var(--xi-red-light); color: var(--xi-red); }
.db-badge--muted  { background: #f3f4f6; color: var(--xi-muted); }

/* ── Contract status ── */
.db-contract-status-bar {
  width: 4px;
  align-self: stretch;
  border-radius: 4px;
  flex-shrink: 0;
  margin: -13px 0;
}
.db-contract-status-bar--active  { background: var(--xi-green); }
.db-contract-status-bar--pending { background: var(--xi-amber); }
.db-contract-status-bar--other   { background: var(--xi-muted-2); }

.db-contract-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 3px;
}
.db-contract-chip--active  { background: var(--xi-green-light); color: var(--xi-green); }
.db-contract-chip--pending { background: var(--xi-amber-light); color: var(--xi-amber); }
.db-contract-chip--other   { background: #f3f4f6; color: var(--xi-muted); }

/* ── Activity Feed ── */
.db-feed { display: flex; flex-direction: column; padding: 16px 20px; gap: 0; }
.db-feed-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}
.db-feed-item:last-child { padding-bottom: 0; }

.db-feed-item__line {
  position: absolute;
  left: 15px;
  top: 28px;
  bottom: 0;
  width: 1px;
  background: var(--xi-border);
}
.db-feed-item:last-child .db-feed-item__line { display: none; }

.db-feed-item__dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--xi-blue-light);
  color: var(--xi-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  border: 2px solid var(--xi-surface);
}

.db-feed-item__body { flex: 1; min-width: 0; padding-top: 4px; }
.db-feed-item__title { font-size: 12.5px; font-weight: 600; color: var(--xi-text); }
.db-feed-item__title a { color: var(--xi-text); text-decoration: none; }
.db-feed-item__title a:hover { color: var(--xi-accent); }
.db-feed-item__meta { font-size: 11.5px; color: var(--xi-muted); margin-top: 2px; }
.db-feed-item__meta a { color: var(--xi-muted); text-decoration: none; }
.db-feed-item__meta a:hover { color: var(--xi-accent); }
.db-feed-type {
  display: inline-block;
  background: #f3f4f6;
  color: var(--xi-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 1px 6px;
  border-radius: 4px;
}

.db-feed-item__time {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--xi-muted-2);
  white-space: nowrap;
  padding-top: 6px;
  flex-shrink: 0;
}

/* ── Empty States ── */
.db-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 20px;
  color: var(--xi-muted-2);
  text-align: center;
}
.db-empty i { font-size: 28px; opacity: .5; }
.db-empty p { font-size: 13px; margin: 0; font-weight: 500; }
.db-empty-cta {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--xi-accent);
  text-decoration: none;
  border: 1px solid var(--xi-accent-mid);
  border-radius: var(--xi-radius-sm);
  padding: 5px 14px;
  margin-top: 4px;
  transition: background .15s;
}
.db-empty-cta:hover { background: var(--xi-accent-light); }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .db-main-grid { grid-template-columns: 1fr; }
  .db-kpi-grid  { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .db-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .db-kpi__value { font-size: 22px; }
  .db-greeting__title { font-size: 20px; }
  .db-topbar { flex-direction: column; }
  .db-pip-stage { width: 90px; font-size: 11px; }
  .db-pip-meta { width: 80px; }
}
@media (max-width: 480px) {
  .db-kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── from templates/email_integration/audience_list.html ── */
.al-name { display: flex; align-items: center; gap: .6rem; }
  .al-avatar {
    width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .82rem; font-weight: 800; text-transform: uppercase;
    background: rgba(var(--xi-accent-rgb), .12); color: var(--xi-accent);
  }
  .al-count {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .18rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
    background: rgba(var(--xi-accent-rgb), .10); color: var(--xi-accent);
  }
  .al-count--zero { background: var(--xi-hover); color: var(--xi-muted); }

/* ── from templates/email_integration/brand_settings_form.html ── */
.bs-body{ --bs-radius:14px; }
.bs-head{
  display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; flex-wrap:wrap;
  margin-bottom:1.25rem;
}
.bs-head__back{ display:inline-flex; align-items:center; gap:.4rem; font-size:.8rem; font-weight:600; color:var(--xi-muted); margin-bottom:.4rem; }
.bs-head__back:hover{ color:var(--xi-accent); }
.bs-head__title{ font-size:1.4rem; font-weight:700; letter-spacing:-.02em; margin:0; color:var(--xi-text); }
.bs-head__sub{ font-size:.85rem; color:var(--xi-muted); margin:.25rem 0 0; }
.bs-sticky{
  position:sticky; top:0; z-index:20; display:flex; align-items:center; gap:.5rem;
  padding:.6rem .85rem; background:var(--xi-surface); border:1px solid var(--xi-border);
  border-radius:12px; box-shadow:0 1px 2px rgba(16,24,40,.04); margin-bottom:1rem;
}
.bs-sticky__title{ flex:1 1 auto; font-weight:700; font-size:.95rem; color:var(--xi-text); }
.bs-card{ background:var(--xi-surface); border:1px solid var(--xi-border); border-radius:var(--bs-radius); overflow:hidden; margin-bottom:1rem; }
.bs-card__head{ display:flex; align-items:center; gap:.6rem; padding:.8rem 1rem; border-bottom:1px solid var(--xi-border); }
.bs-card__head .num{ width:26px; height:26px; flex:0 0 auto; border-radius:8px; display:inline-flex; align-items:center; justify-content:center; background:var(--xi-orange-light); color:var(--xi-orange-dark); font-size:13px; font-weight:800; }
.bs-card__title{ font-size:14px; font-weight:700; color:var(--xi-text); margin:0; }
.bs-card__title small{ display:block; font-weight:500; font-size:11.5px; color:var(--xi-muted); margin-top:2px; }
.bs-card__body{ padding:1rem; }
.bs-label{ font-size:12px; font-weight:700; color:var(--xi-text); margin-bottom:.35rem; display:block; }
.bs-help{ font-size:11.5px; color:var(--xi-muted); margin-top:.3rem; }
.bs-input, .bs-select{
  width:100%; padding:.55rem .7rem; font-size:13.5px;
  border:1px solid var(--xi-border); border-radius:10px;
  background:var(--xi-surface); color:var(--xi-text); min-height:38px;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.bs-input:focus, .bs-select:focus{ outline:none; border-color:var(--xi-accent); box-shadow:0 0 0 3px rgba(var(--xi-accent-rgb),.12); }
.bs-input--color{ width:56px; padding:.3rem; cursor:pointer; }
.bs-color-row{ display:flex; align-items:center; gap:.6rem; }
.bs-color-row .bs-input--color{ flex:0 0 auto; }
.bs-chip{ display:inline-flex; align-items:center; gap:.45rem; padding:.5rem .7rem; border-radius:10px; background:var(--xi-orange-light); border:1px solid rgba(var(--xi-accent-rgb),.2); }
.bs-chip i{ font-size:15px; color:var(--xi-orange-dark); }
.bs-chip small{ color:var(--xi-orange-dark); font-size:11.5px; font-weight:600; display:block; opacity:.75; }
.bs-switch{ display:flex; align-items:center; gap:.6rem; font-size:13px; color:var(--xi-text); }

/* ── from templates/email_integration/campaign_detail.html ── */
/* ---- campaign detail (scoped cd-*) — app chrome on --xi-accent (#E85C00) ---- */
  .cd-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
  .cd-toolbar__actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

  .cd-hero {
    background: var(--xi-surface); border: 1px solid var(--xi-border); border-radius: 16px;
    padding: 1.25rem 1.35rem; box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-bottom: 1rem;
    display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  }
  .cd-hero__icon {
    width: 54px; height: 54px; border-radius: 14px; flex: 0 0 auto; display: inline-flex;
    align-items: center; justify-content: center; font-size: 1.5rem;
    background: rgba(var(--xi-accent-rgb), .10); color: var(--xi-accent);
  }
  .cd-hero__body { flex: 1 1 260px; min-width: 0; }
  .cd-hero__title { font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; color: var(--xi-text); margin: 0 0 .25rem; word-break: break-word; }
  .cd-hero__desc { color: var(--xi-muted); font-size: .9rem; margin: 0 0 .5rem; }
  .cd-hero__meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--xi-muted); }
  .cd-hero__meta span { display: inline-flex; align-items: center; gap: .35rem; }
  .cd-hero__meta i { color: var(--xi-accent); }

  .cd-status {
    display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 700;
    padding: .35rem .7rem; border-radius: 999px; line-height: 1; flex: 0 0 auto; white-space: nowrap;
  }
  .cd-status--success { background: #ecfdf5; color: #15803d; border: 1px solid rgba(21,128,61,.2); }
  .cd-status--warning { background: #fff7ed; color: #c2410c; border: 1px solid rgba(194,65,12,.2); }
  .cd-status--danger  { background: #fff1f1; color: #dc2626; border: 1px solid rgba(220,38,38,.2); }
  .cd-status--muted   { background: var(--xi-hover, #f1f3f5); color: var(--xi-muted); border: 1px solid var(--xi-border); }
  [data-bs-theme="dark"] .cd-status--success { background: rgba(21,128,61,.14); }
  [data-bs-theme="dark"] .cd-status--warning { background: rgba(194,65,12,.16); }
  [data-bs-theme="dark"] .cd-status--danger  { background: rgba(220,38,38,.14); }

  .cd-card { background: var(--xi-surface); border: 1px solid var(--xi-border); border-radius: 14px; overflow: hidden; height: 100%; }
  .cd-card__head { padding: .7rem 1rem; border-bottom: 1px solid var(--xi-border); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--xi-text); display: flex; align-items: center; gap: .4rem; }
  .cd-card__head i { color: var(--xi-accent); }
  .cd-card__body { padding: 1.1rem 1.15rem; }

  .cd-progress__top { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
  .cd-progress__count { font-size: 1.5rem; font-weight: 800; color: var(--xi-text); }
  .cd-progress__count small { font-size: .85rem; font-weight: 500; color: var(--xi-muted); }
  .cd-progress__pct { font-size: .82rem; font-weight: 700; color: var(--xi-accent); }
  .cd-track { height: 10px; border-radius: 999px; background: rgba(var(--xi-accent-rgb), .12); overflow: hidden; }
  .cd-track__fill { height: 100%; background: linear-gradient(90deg, var(--xi-accent), var(--xi-orange-dark)); border-radius: 999px; transition: width .4s ease; }

  .cd-rate { display: flex; align-items: center; justify-content: space-between; font-size: .82rem; margin: .9rem 0 .3rem; }
  .cd-rate__k { color: var(--xi-muted); }
  .cd-rate__v { font-weight: 700; color: var(--xi-text); }
  .cd-rate-track { height: 6px; border-radius: 999px; background: var(--xi-hover, #f1f3f5); overflow: hidden; }
  .cd-rate-track__fill { height: 100%; border-radius: 999px; }
  .cd-rate-track__fill--open  { background: #7c3aed; }
  .cd-rate-track__fill--click { background: #15803d; }

  .cd-detail { display: flex; justify-content: space-between; gap: .75rem; padding: .5rem 0; font-size: .84rem; }
  .cd-detail + .cd-detail { border-top: 1px dashed var(--xi-border); }
  .cd-detail__k { color: var(--xi-muted); flex: 0 0 auto; }
  .cd-detail__v { color: var(--xi-text); font-weight: 600; text-align: right; min-width: 0; word-break: break-word; }

/* ── from templates/email_integration/compose.html ── */
/* ---------- XiCRM Compose (xc-*) ---------- */
  .xc-actionbar{
    position:sticky; top:0; z-index:1020;
    display:flex; align-items:center; justify-content:space-between; gap:.75rem;
    padding:.65rem .9rem; margin-bottom:.75rem;
    background:var(--xi-surface);
    border:1px solid var(--xi-border); border-radius:12px;
    box-shadow:0 6px 18px rgba(15,23,42,.06);
  }
  .xc-actionbar__title{ font-size:1rem; font-weight:700; color:var(--xi-text); margin:0; letter-spacing:-.01em; }
  .xc-savestate{ display:inline-flex; align-items:center; gap:.35rem; font-size:.72rem; color:var(--xi-muted); }
  .xc-savestate .dot{ width:7px; height:7px; border-radius:50%; background:#cbd5e1; transition:background .2s ease; }
  .xc-savestate.is-dirty .dot{ background:#f59e0b; }
  .xc-savestate.is-saved .dot{ background:#16a34a; }

  .xc-checks{ display:flex; flex-wrap:wrap; gap:.4rem .5rem; align-items:center; margin-bottom:.75rem; }
  .xc-check{
    display:inline-flex; align-items:center; gap:.4rem;
    font-size:.74rem; font-weight:600; color:var(--xi-muted);
    border:1px solid var(--xi-border); border-radius:999px;
    padding:.28rem .7rem; background:var(--xi-surface);
    transition:all .18s ease;
  }
  .xc-check i{ font-size:.8rem; color:#cbd5e1; transition:color .18s ease; }
  .xc-check.is-ok{ color:#15803d; border-color:rgba(22,163,74,.35); background:rgba(22,163,74,.06); }
  .xc-check.is-ok i{ color:#16a34a; }

  .xc-card{ background:var(--xi-surface); border:1px solid var(--xi-border); border-radius:12px; overflow:hidden; }
  .xc-card + .xc-card{ margin-top:.75rem; }
  .xc-card__head{
    display:flex; align-items:center; justify-content:space-between; gap:.5rem;
    padding:.55rem .9rem; border-bottom:1px solid var(--xi-border); background:rgba(248,249,251,.6);
  }
  .xc-card__title{ font-size:.72rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--xi-muted); margin:0; }
  .xc-card__body{ padding:.9rem; }

  .xc-row{ display:flex; align-items:flex-start; gap:.6rem; padding:.45rem 0; }
  .xc-row__label{
    flex:0 0 58px; padding-top:.42rem;
    font-size:.78rem; font-weight:600; color:var(--xi-text);
  }
  .xc-row__label .text-muted{ font-weight:400; }
  .xc-row__field{ flex:1 1 auto; min-width:0; position:relative; }
  .xc-minilink{
    border:0; background:none; padding:.15rem .3rem; margin-left:.15rem;
    font-size:.72rem; font-weight:600; color:var(--xi-accent); cursor:pointer;
  }
  .xc-minilink:hover{ text-decoration:underline; }

  /* Chip recipient input */
  .xc-chipbox{
    display:flex; flex-wrap:wrap; align-items:center; gap:.3rem;
    border:1px solid var(--xi-border); border-radius:10px;
    padding:.28rem .5rem; min-height:40px; cursor:text;
    background:var(--xi-surface);
    transition:border-color .15s ease, box-shadow .15s ease;
  }
  .xc-chipbox:focus-within{ border-color:var(--xi-accent); box-shadow:0 0 0 .2rem rgba(var(--xi-accent-rgb),.10); }
  .xc-chipbox input{
    flex:1 1 140px; min-width:140px; border:0; outline:none; background:transparent;
    font-size:.85rem; padding:.3rem .15rem; color:var(--xi-text);
  }
  .xc-chip{
    display:inline-flex; align-items:center; gap:.35rem;
    max-width:100%;
    background:var(--xi-orange-light); color:var(--xi-orange-dark);
    border:1px solid rgba(var(--xi-accent-rgb),.25);
    border-radius:999px; padding:.18rem .3rem .18rem .55rem;
    font-size:.76rem; font-weight:600; line-height:1.2;
  }
  .xc-chip.is-invalid-email{ background:#fef2f2; color:#b91c1c; border-color:rgba(220,38,38,.4); }
  .xc-chip__avatar{
    width:17px; height:17px; border-radius:50%; flex:0 0 17px;
    background:var(--xi-accent); color:#fff; font-size:.58rem; font-weight:700;
    display:inline-flex; align-items:center; justify-content:center; text-transform:uppercase;
  }
  .xc-chip__meta{ font-weight:400; opacity:.75; font-size:.68rem; }
  .xc-chip__x{
    border:0; background:none; cursor:pointer; color:inherit; opacity:.55;
    display:inline-flex; align-items:center; padding:.05rem .25rem; border-radius:50%;
    font-size:.8rem; line-height:1;
  }
  .xc-chip__x:hover{ opacity:1; background:rgba(0,0,0,.07); }

  .xc-autocomplete{
    position:absolute; z-index:1055; left:0; right:0; top:calc(100% + 4px);
    background:var(--xi-surface); border:1px solid var(--xi-border); border-radius:10px;
    box-shadow:0 14px 34px rgba(15,23,42,.14);
    max-height:264px; overflow-y:auto; display:none;
  }
  .xc-autocomplete.is-open{ display:block; }
  .xc-ac-item{
    display:flex; align-items:center; gap:.55rem; width:100%;
    padding:.45rem .65rem; border:0; background:none; text-align:left; cursor:pointer;
  }
  .xc-ac-item:hover, .xc-ac-item.is-active{ background:var(--xi-orange-light); }
  .xc-ac-item__avatar{
    width:30px; height:30px; border-radius:50%; flex:0 0 30px;
    background:linear-gradient(135deg,#ffb27d,var(--xi-accent)); color:#fff;
    display:inline-flex; align-items:center; justify-content:center;
    font-size:.72rem; font-weight:700; text-transform:uppercase;
  }
  .xc-ac-item__name{ font-size:.8rem; font-weight:600; color:var(--xi-text); line-height:1.2; }
  .xc-ac-item__sub{ font-size:.7rem; color:var(--xi-muted); line-height:1.3; }
  .xc-ac-empty{ padding:.6rem .7rem; font-size:.76rem; color:var(--xi-muted); }

  /* Subject */
  .xc-subject-input{
    width:100%; border:1px solid transparent; border-radius:10px;
    font-size:1.12rem; font-weight:600; color:var(--xi-text);
    padding:.5rem .65rem; background:transparent; outline:none;
    transition:border-color .15s ease, background .15s ease;
  }
  .xc-subject-input::placeholder{ color:#9ca3af; font-weight:500; }
  .xc-subject-input:focus{ border-color:var(--xi-accent); background:var(--xi-surface); box-shadow:0 0 0 .2rem rgba(var(--xi-accent-rgb),.10); }
  .xc-counter{ font-size:.68rem; color:var(--xi-muted); white-space:nowrap; }
  .xc-counter.is-warn{ color:#d97706; font-weight:700; }

  /* Priority segmented control */
  .xc-segmented{ display:inline-flex; border:1px solid var(--xi-border); border-radius:9px; overflow:hidden; }
  .xc-segmented input{ position:absolute; opacity:0; pointer-events:none; }
  .xc-segmented label{
    font-size:.74rem; font-weight:600; color:var(--xi-muted);
    padding:.32rem .8rem; cursor:pointer; background:var(--xi-surface);
    border-right:1px solid var(--xi-border); margin:0;
    transition:all .15s ease;
  }
  .xc-segmented label:last-of-type{ border-right:0; }
  .xc-segmented input:checked + label{ background:var(--xi-accent); color:#fff; }
  .xc-segmented input:focus-visible + label{ outline:2px solid rgba(var(--xi-accent-rgb),.4); outline-offset:-2px; }

  /* Schedule pill */
  .xc-schedule-pill{
    display:none; align-items:center; gap:.45rem;
    font-size:.74rem; font-weight:600; color:#92400e;
    background:#fffbeb; border:1px solid #fde68a; border-radius:999px;
    padding:.3rem .4rem .3rem .75rem;
  }
  .xc-schedule-pill.is-set{ display:inline-flex; }

  /* Attachments */
  .xc-dropzone{
    display:flex; align-items:center; justify-content:center; gap:.5rem;
    border:1.5px dashed #d1d5db; border-radius:10px;
    padding:.7rem .9rem; cursor:pointer; color:var(--xi-muted);
    font-size:.78rem; font-weight:500; text-align:center;
    transition:all .15s ease; background:transparent;
  }
  .xc-dropzone:hover, .xc-dropzone.is-dragover{ border-color:var(--xi-accent); color:var(--xi-accent); background:var(--xi-orange-light); }
  .xc-att-list{ display:flex; flex-wrap:wrap; gap:.4rem; margin-top:.5rem; }
  .xc-att-list:empty{ display:none; }
  .xc-att-chip{
    display:inline-flex; align-items:center; gap:.4rem;
    border:1px solid var(--xi-border); border-radius:9px;
    background:var(--xi-body-bg); padding:.3rem .35rem .3rem .6rem;
    font-size:.74rem; color:var(--xi-text); max-width:230px;
  }
  .xc-att-chip i.bi{ color:var(--xi-accent); }
  .xc-att-chip__name{ font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .xc-att-chip__size{ color:var(--xi-muted); font-size:.66rem; white-space:nowrap; }

  /* ===== Email preview modal — lightweight (shared across compose, template builder, template list & detail) ===== */
  .xpv-modal .modal-dialog{ max-width:min(840px, calc(100vw - 1.5rem)); margin-top:1.5rem; }
  .xpv-modal .modal-dialog-scrollable{ max-height:calc(100vh - 3rem); }
  .xpv-modal .modal-content{ border:0; border-radius:12px; overflow:hidden; box-shadow:0 18px 50px rgba(15,23,42,.22); }
  .xpv-modal .modal-header{
    display:flex; align-items:center; gap:.75rem;
    padding:.72rem 1rem; border-bottom:1px solid #eef0f5; flex-wrap:nowrap;
  }
  [data-bs-theme="dark"] .xpv-modal .modal-header{ border-bottom-color:#2a3347; }
  .xpv-modal .modal-title{
    display:inline-flex; align-items:center; gap:.55rem; min-width:0; margin:0;
    font-size:.9rem; font-weight:700;
  }
  .xpv-modal .modal-title > i{ color:var(--xi-accent); flex:0 0 auto; }
  .xpv-xsubj{ font-weight:600; color:#3a4663; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  [data-bs-theme="dark"] .xpv-xsubj{ color:#cdd6e8; }
  .xpv-badge{
    flex:0 0 auto; display:inline-flex; align-items:center; gap:.3rem;
    color:#e66100; font-weight:600; font-size:.7rem;
    background:rgba(230,97,0,.08); border:1px dashed rgba(230,97,0,.4);
    border-radius:5px; padding:.08rem .42rem; white-space:nowrap;
  }
  .xpv-badge i{ font-size:.72rem; }
  .xpv-header-actions{ margin-left:auto; display:flex; align-items:center; gap:.55rem; flex:0 0 auto; }
  .xpv-modal .modal-body{ padding:.85rem; background:#f3f4f8; }
  [data-bs-theme="dark"] .xpv-modal .modal-body{ background:#0f1420; }
  .xpv-stage{ text-align:center; }
  .xpv-iframe{
    width:100%; max-width:680px; display:block; margin:0 auto; min-height:420px;
    background:#fff; border:1px solid #e6e9f0; border-radius:8px;
    box-shadow:0 8px 24px rgba(15,23,42,.10);
  }

  /* legacy aliases for templates still loading xc-preview-modal */
  .xc-preview-modal .modal-dialog{ max-width:min(840px, calc(100vw - 1.5rem)); margin-top:1.5rem; }
  .xc-preview-modal .modal-content{ border:0; border-radius:12px; overflow:hidden; box-shadow:0 18px 50px rgba(15,23,42,.22); }
  .xc-preview-modal .modal-body{ padding:.85rem; background:#f3f4f8; }

  @media (max-width: 575.98px){
    .xpv-modal .modal-dialog{ margin-top:.75rem; max-width:calc(100vw - .75rem); }
    .xpv-xsubj{ max-width:38vw; }
  }

  @media (max-width: 991.98px){
    .xc-actionbar{ flex-wrap:wrap; }
  }
  .xc-btn-busy {
    pointer-events: none;
    opacity: .65;
  }

  /* ---- compose: email signature preview ---- */
  .xc-signature{
    display:flex; align-items:flex-start; gap:.8rem;
    max-width:560px; padding: .8rem 1rem;
    background:var(--xi-bg, #f8f9fb); border:1px solid var(--xi-border);
    border-radius:10px;
  }
  .xc-signature__avatar{
    flex:0 0 auto; width:38px; height:38px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    background:var(--xi-accent, #e66100); color:#fff;
    font-weight:700; font-size:.95rem; text-transform:uppercase;
  }
  .xc-signature__body{ min-width:0; }
  .xc-signature__name{ font-weight:600; color:var(--xi-text); font-size:.88rem; }
  .xc-signature__meta{ color:#6b7280; font-size:.8rem; }
  .xc-signature__contact{ color:#6b7280; font-size:.8rem; }
  [data-bs-theme="dark"] .xc-signature{ background:#161d2c; border-color:#263047; }
  [data-bs-theme="dark"] .xc-signature__meta,
  [data-bs-theme="dark"] .xc-signature__contact{ color:#9aa3b8; }

  /* ---- compose: signature editor ---- */
  .xc-signature-editor{
    font-family:var(--bs-body-font-family, inherit);
    font-size:.85rem; line-height:1.55;
    min-height:110px; resize:vertical;
  }

  /* ---- compose: body editor fallback (TinyMCE unavailable) ---- */
  .xc-fallback-editor{
    display:block; width:100%; min-height:420px;
    font-family:var(--bs-body-font-family, inherit);
    font-size:.95rem; line-height:1.6;
    padding:.9rem 1rem; resize:vertical;
  }
  .xc-fallback-editor:focus{ outline:2px solid var(--xi-accent, #e66100); outline-offset:-1px; }

/* ── from templates/email_integration/detail.html ── */
/* ---- message detail (scoped em-*) — app chrome uses --xi-accent (#E85C00);
         the email body is rendered inside an isolated iframe with its own brand (#e66100). ---- */
  .em-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    flex-wrap: wrap; margin-bottom: 1rem;
  }
  .em-toolbar__meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

  .em-card {
    background: var(--xi-surface); border: 1px solid var(--xi-border);
    border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.04); overflow: hidden;
  }
  .em-card__bar {
    padding: .6rem 1rem; border-bottom: 1px solid var(--xi-border);
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  }
  .em-card__bar-title { font-size: .78rem; font-weight: 700; letter-spacing: .02em; color: var(--xi-text); text-transform: uppercase; }
  .em-card__bar-note { font-size: .72rem; color: var(--xi-muted); }

  .em-head { padding: 1.15rem 1.25rem 1rem; }
  .em-subject {
    font-size: 1.3rem; font-weight: 800; line-height: 1.3; color: var(--xi-text);
    margin: 0 0 .65rem; letter-spacing: -.01em; word-break: break-word;
  }
  .em-badges { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

  .em-pill {
    display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 700;
    padding: .2rem .55rem; border-radius: 999px; line-height: 1;
  }
  .em-pill i { font-size: .72rem; }
  .em-pill--dir { background: rgba(var(--xi-accent-rgb), .10); color: var(--xi-orange-dark); border: 1px solid rgba(var(--xi-accent-rgb), .18); }
  .em-pill--high { background: #fff1f1; color: #dc2626; border: 1px solid rgba(220,38,38,.2); }
  [data-bs-theme="dark"] .em-pill--dir { background: rgba(var(--xi-accent-rgb), .16); color: #ffb27a; }

  .em-meta { padding: 0 1.25rem 1.1rem; }
  .em-meta__row { display: flex; align-items: flex-start; gap: .65rem; padding: .5rem 0; }
  .em-meta__row + .em-meta__row { border-top: 1px dashed var(--xi-border); }
  .em-meta__key {
    flex: 0 0 74px; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--xi-muted); font-weight: 700; padding-top: .5rem;
  }
  .em-meta__val { flex: 1 1 auto; min-width: 0; font-size: .9rem; color: var(--xi-text); }
  .em-meta__val .name { font-weight: 700; }
  .em-meta__val .addr { color: var(--xi-muted); font-size: .82rem; }
  .em-identity { display: flex; align-items: center; gap: .6rem; }
  .em-identity .em-avatar { width: 38px; height: 38px; border-radius: 12px; font-size: 14px; }

  .em-attach { padding: .75rem 1.25rem; border-top: 1px solid var(--xi-border); background: rgba(var(--xi-accent-rgb), .03); }

  /* email render stage — mirrors the compose/template preview surfaces */
  .em-stage { background: #eef0f4; padding: 20px 14px; }
  [data-bs-theme="dark"] .em-stage { background: #0d1117; }
  .em-frame {
    width: 100%; max-width: 680px; margin: 0 auto; display: block; background: #fff;
    border: 1px solid #e5e7eb; border-radius: 12px; min-height: 320px;
    box-shadow: 0 10px 30px rgba(15,23,42,.10);
  }
  .em-plain {
    max-width: 680px; margin: 0 auto; background: #fff; border: 1px solid #e5e7eb;
    border-radius: 12px; padding: 22px 24px; white-space: pre-wrap;
    font-family: inherit; color: #111827; box-shadow: 0 10px 30px rgba(15,23,42,.10);
  }
  .em-empty { padding: 2.5rem 1rem; text-align: center; color: var(--xi-muted); }

  .em-side-card { background: var(--xi-surface); border: 1px solid var(--xi-border); border-radius: 14px; overflow: hidden; }
  .em-side-card + .em-side-card { margin-top: 1rem; }
  .em-side-card__head { padding: .6rem 1rem; border-bottom: 1px solid var(--xi-border); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--xi-text); }
  .em-side-card__body { padding: 1rem; }

  .em-rate { display: flex; align-items: center; justify-content: space-between; font-size: .82rem; margin-bottom: .35rem; }
  .em-rate__track { height: 6px; border-radius: 999px; background: rgba(var(--xi-accent-rgb), .12); overflow: hidden; margin-bottom: .75rem; }
  .em-rate__fill { height: 100%; background: var(--xi-accent); border-radius: 999px; }

  .em-detail-row { display: flex; justify-content: space-between; gap: .75rem; padding: .4rem 0; font-size: .84rem; }
  .em-detail-row + .em-detail-row { border-top: 1px dashed var(--xi-border); }
  .em-detail-row__k { color: var(--xi-muted); flex: 0 0 auto; }
  .em-detail-row__v { color: var(--xi-text); font-weight: 600; text-align: right; min-width: 0; word-break: break-word; }

  /* ---- recipient chips + copy ---- */
  .em-chip-list { display: flex; flex-wrap: wrap; gap: .4rem; }
  .em-chip {
    display: inline-flex; align-items: center; gap: .45rem; max-width: 100%;
    background: var(--xi-body-bg); border: 1px solid var(--xi-border);
    border-radius: 999px; padding: .28rem .7rem .28rem .3rem; font-size: .82rem;
  }
  .em-chip__avatar {
    width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .62rem; font-weight: 800; color: var(--xi-orange-dark);
    background: var(--xi-orange-light); border: 1px solid rgba(var(--xi-accent-rgb), .2);
  }
  .em-chip__email { color: var(--xi-text); font-weight: 600; word-break: break-all; }
  .em-copy {
    margin-left: .35rem; border: 1px solid var(--xi-border); background: var(--xi-body-bg);
    color: var(--xi-muted); width: 26px; height: 26px; border-radius: 8px; font-size: .8rem;
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    transition: background .15s, color .15s, border-color .15s, transform .1s;
  }
  .em-copy:hover { transform: translateY(-1px); border-color: var(--xi-accent); color: var(--xi-accent); background: var(--xi-orange-light); }
  .em-copy--ok { color: #15803d !important; border-color: #86efac !important; background: #dcfce7 !important; }

  /* ---- recipient-view mail window ---- */
  .em-window { max-width: 680px; margin: 0 auto; }
  .em-window .em-frame {
    border-radius: 0 0 12px 12px; box-shadow: none; border-top: 0; min-height: 320px;
  }
  .em-mail-head {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .7rem 1rem; background: #fff; border: 1px solid #e5e7eb; border-bottom: 0;
    border-radius: 12px 12px 0 0;
  }
  .em-mail-head__id { display: flex; align-items: center; gap: .7rem; min-width: 0; }
  .em-mail-head__from { font-size: .88rem; font-weight: 700; color: #111827; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .em-mail-head__addr { font-size: .75rem; color: #6b7280; }
  .em-mail-head__meta { display: flex; align-items: center; gap: .55rem; flex: 0 0 auto; }
  .em-mail-head__dir { display: inline-flex; align-items: center; gap: .28rem; font-size: .68rem; font-weight: 700; padding: .18rem .5rem; border-radius: 999px; background: rgba(var(--xi-accent-rgb), .1); color: var(--xi-orange-dark); }
  .em-mail-head__date { font-size: .74rem; color: #6b7280; white-space: nowrap; }
  [data-bs-theme="dark"] .em-mail-head { background: #0d1117; border-color: #1f2937; }
  [data-bs-theme="dark"] .em-mail-head__from { color: #f3f4f6; }
  [data-bs-theme="dark"] .em-mail-head__addr, [data-bs-theme="dark"] .em-mail-head__date { color: #9ca3af; }
  [data-bs-theme="dark"] .em-mail-head__dir { background: rgba(var(--xi-accent-rgb), .16); color: #ffb27a; }

/* ── from templates/email_integration/detail.html ── */
html,body{margin:0;padding:0;background:#ffffff;}'
    + 'body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;color:#111827;}'
    + 'img{max-width:100%;height:auto;}

/* ── from templates/email_integration/index.html ── */
/* ---- mail list (scoped ml-*) — app chrome on --xi-accent (#E85C00) ---- */
  .ml-head-icon {
    width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center;
    justify-content: center; font-size: 1.15rem; background: rgba(var(--xi-accent-rgb), .10);
    color: var(--xi-accent); flex: 0 0 auto;
  }

  .ml-table { margin-bottom: 0; }
  .ml-table tbody tr { cursor: pointer; transition: background .12s ease; }
  .ml-table tbody tr:hover { background: rgba(var(--xi-accent-rgb), .045); }
  .ml-table td { vertical-align: middle; padding-top: .7rem; padding-bottom: .7rem; }

  /* leading indicator */
  .ml-flag { position: relative; width: 34px; text-align: center; }
  .ml-flag__icon {
    width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center;
    justify-content: center; font-size: .9rem;
  }
  .ml-flag__icon--in  { background: rgba(var(--xi-accent-rgb), .12); color: var(--xi-orange-dark); }
  .ml-flag__icon--out { background: var(--xi-hover, #f1f3f5); color: var(--xi-muted); }
  [data-bs-theme="dark"] .ml-flag__icon--out { background: rgba(255,255,255,.06); }
  .ml-unread-dot {
    position: absolute; top: -1px; left: -1px; width: 9px; height: 9px; border-radius: 50%;
    background: var(--xi-accent); border: 2px solid var(--xi-surface);
  }

  .ml-party { display: flex; align-items: center; gap: .55rem; min-width: 0; }
  .ml-party__name { font-weight: 600; color: var(--xi-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
  .ml-row--unread .ml-party__name { font-weight: 800; }
  .ml-party__pre { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--xi-muted); font-weight: 700; margin-right: .15rem; }

  .ml-subject { min-width: 0; }
  .ml-subject__line { display: flex; align-items: center; gap: .45rem; }
  .ml-subject__text {
    color: var(--xi-text); text-decoration: none; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  }
  .ml-row--unread .ml-subject__text { font-weight: 800; }
  .ml-subject__text:hover { color: var(--xi-accent); }
  .ml-subject__preview {
    color: var(--xi-muted); font-size: .82rem; margin-top: .1rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .ml-prio { color: #dc2626; font-size: .78rem; flex: 0 0 auto; }

  .ml-date { white-space: nowrap; font-size: .8rem; color: var(--xi-muted); text-align: right; }

  .ml-badge { font-size: .68rem; font-weight: 700; padding: .18rem .45rem; flex: 0 0 auto; }

  @media (max-width: 991.98px) {
    .ml-col-preview { display: none; }
    .ml-party__name { max-width: 130px; }
  }

/* ── from templates/email_integration/suppression_list.html ── */
/* ===== Suppression list — premium, theme-aware ===== */
.sl-kpi{ display:grid; grid-template-columns:repeat(4,1fr); gap:.75rem; margin-bottom:1.25rem; }
.sl-kpi .xi-kpi-card{ margin:0; }
@media (max-width: 991px){ .sl-kpi{ grid-template-columns:repeat(2,1fr); } }
@media (max-width: 479px){ .sl-kpi{ grid-template-columns:1fr; } }

.sl-badge{
  display:inline-flex; align-items:center; gap:.3rem; white-space:nowrap;
  font-size:12px; font-weight:600; padding:.25rem .62rem; border-radius:999px;
  border:1px solid transparent;
}
.sl-badge--manual      { background:rgba(var(--xi-accent-rgb),.10); color:var(--xi-orange-dark); border-color:rgba(var(--xi-accent-rgb),.20); }
.sl-badge--unsubscribed{ background:#fff8e1; color:#b45309; border-color:#fde68a; }
.sl-badge--bounced     { background:#fef2f2; color:#b91c1c; border-color:#fecaca; }
.sl-badge--complaint   { background:#f5f3ff; color:#6d28d9; border-color:#ddd6fe; }
.sl-badge--invalid     { background:#f3f4f6; color:#4b5563; border-color:#e5e7eb; }
[data-bs-theme="dark"] .sl-badge--manual      { color:#ffb27a; }
[data-bs-theme="dark"] .sl-badge--unsubscribed{ background:rgba(180,83,9,.18); color:#fcd34d; border-color:rgba(180,83,9,.35); }
[data-bs-theme="dark"] .sl-badge--bounced     { background:rgba(220,38,38,.16); color:#fca5a5; border-color:rgba(220,38,38,.3); }
[data-bs-theme="dark"] .sl-badge--complaint   { background:rgba(109,40,217,.18); color:#c4b5fd; border-color:rgba(109,40,217,.35); }
[data-bs-theme="dark"] .sl-badge--invalid     { background:rgba(128,128,128,.14); color:#d1d5db; border-color:rgba(128,128,128,.25); }

.sl-avatar{
  width:38px; height:38px; flex:0 0 auto; border-radius:11px;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:15px; color:var(--xi-muted);
  background:var(--xi-body-bg); border:1px solid var(--xi-border);
}
.sl-avatar--manual      { color:var(--xi-orange-dark); background:var(--xi-orange-light); border-color:rgba(var(--xi-accent-rgb),.2); }
.sl-avatar--unsubscribed{ color:#b45309; background:#fff8e1; border-color:#fde68a; }
.sl-avatar--bounced     { color:#b91c1c; background:#fef2f2; border-color:#fecaca; }
.sl-avatar--complaint   { color:#6d28d9; background:#f5f3ff; border-color:#ddd6fe; }
.sl-avatar--invalid     { color:#4b5563; background:#f3f4f6; border-color:#e5e7eb; }

.sl-email{ font-weight:600; color:var(--xi-text); word-break:break-all; }
.sl-notes{
  display:inline-flex; align-items:flex-start; gap:.35rem; max-width:360px;
  font-size:12px; color:var(--xi-muted); margin-top:.2rem;
}
.sl-source{
  display:inline-flex; align-items:center; gap:.3rem;
  font-size:12px; font-weight:600; padding:.22rem .55rem; border-radius:7px;
  background:var(--xi-body-bg); border:1px solid var(--xi-border); color:var(--xi-muted);
  white-space:nowrap; max-width:220px; overflow:hidden; text-overflow:ellipsis;
}
.sl-row .sl-actions{ opacity:.35; transition:opacity .15s ease; }
.sl-row:hover .sl-actions{ opacity:1; }
.sl-action{
  display:inline-flex; align-items:center; justify-content:center;
  width:1.9rem; height:1.9rem; border-radius:8px; border:none; background:transparent;
  font-size:.98rem; text-decoration:none; transition:background .15s, transform .1s;
}
.sl-action:hover{ transform:translateY(-1px); }
.sl-action--notes{ color:#7c3aed; }
.sl-action--notes:hover{ background:#f3f0ff; }
.sl-action--delete{ color:#dc2626; }
.sl-action--delete:hover{ background:#fee2e2; }
[data-bs-theme="dark"] .sl-action--notes{ color:#a78bfa; }
[data-bs-theme="dark"] .sl-action--delete{ color:#f87171; }

/* ===== Suppress modal — premium ===== */
#suppressForm [name="reason"]{ display:none; }
.sl-modal-hero{
  display:flex; align-items:center; gap:.75rem;
  padding:1.15rem 1.25rem;
  background:linear-gradient(135deg, rgba(var(--xi-accent-rgb),.12), rgba(var(--xi-accent-rgb),.03));
  border-bottom:1px solid rgba(var(--xi-accent-rgb),.16);
}
.sl-modal-hero__icon{
  width:44px; height:44px; flex:0 0 auto; border-radius:12px;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:1.25rem; color:#fff;
  background:linear-gradient(135deg, var(--xi-accent), var(--xi-orange-dark));
  box-shadow:0 6px 16px rgba(var(--xi-accent-rgb),.32);
}
.sl-modal-hero__title{ font-size:1.02rem; font-weight:700; color:var(--xi-text); letter-spacing:-.01em; }
.sl-modal-hero__sub{ font-size:.78rem; color:var(--xi-muted); margin-top:.1rem; }
.sl-modal-body{ padding:1.25rem 1.5rem .15rem; }
.sl-field { margin-bottom:1rem; }
.sl-field__label{
  display:inline-flex; align-items:center; gap:.35rem;
  font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em;
  color:var(--xi-muted); margin-bottom:.38rem;
}
.sl-field__label i{ font-size:.8rem; }
.sl-email-wrap{ position:relative; }
.sl-email-wrap .form-control{
  border-radius:11px; padding:.62rem .9rem; font-weight:600; font-size:.95rem;
  border:1.5px solid var(--xi-border); background:var(--xi-surface); color:var(--xi-text);
  transition:border-color .15s, box-shadow .15s;
}
.sl-email-wrap .form-control:focus{ border-color:var(--xi-accent); box-shadow:0 0 0 3px rgba(var(--xi-accent-rgb),.14); }
.sl-email-wrap__icon{
  position:absolute; left:.85rem; top:50%; transform:translateY(-50%);
  font-size:.95rem; color:var(--xi-accent); pointer-events:none;
}
.sl-field .form-select,
.sl-field .form-control{ border-radius:10px; }
.sl-reason-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:.45rem; }
@media (max-width: 420px){ .sl-reason-grid{ grid-template-columns:repeat(2,1fr); } }
.sl-reason-chip{
  display:inline-flex; align-items:center; justify-content:center; gap:.35rem;
  padding:.55rem .5rem; border-radius:10px; border:1.5px solid var(--xi-border);
  background:var(--xi-surface); color:var(--xi-muted);
  font-size:.8rem; font-weight:600; cursor:pointer; text-align:center;
  transition:border-color .15s, background .15s, color .15s, box-shadow .15s, transform .1s;
  margin:0;
}
.sl-reason-chip:hover{ transform:translateY(-1px); border-color:rgba(var(--xi-accent-rgb),.35); }
.sl-reason-chip.is-active[data-value="manual"]      { background:rgba(var(--xi-accent-rgb),.12); color:var(--xi-orange-dark); border-color:var(--xi-accent); box-shadow:0 2px 8px rgba(var(--xi-accent-rgb),.2); }
.sl-reason-chip.is-active[data-value="unsubscribed"]{ background:#fff8e1; color:#b45309; border-color:#f59e0b; box-shadow:0 2px 8px rgba(245,158,11,.22); }
.sl-reason-chip.is-active[data-value="bounced"]     { background:#fef2f2; color:#b91c1c; border-color:#ef4444; box-shadow:0 2px 8px rgba(239,68,68,.2); }
.sl-reason-chip.is-active[data-value="complaint"]   { background:#f5f3ff; color:#6d28d9; border-color:#8b5cf6; box-shadow:0 2px 8px rgba(139,92,246,.2); }
.sl-reason-chip.is-active[data-value="invalid"]     { background:#f3f4f6; color:#4b5563; border-color:#9ca3af; }
[data-bs-theme="dark"] .sl-reason-chip.is-active[data-value="manual"]      { color:#ffb27a; }
[data-bs-theme="dark"] .sl-reason-chip.is-active[data-value="unsubscribed"]{ background:rgba(180,83,9,.18); color:#fcd34d; border-color:#f59e0b; }
[data-bs-theme="dark"] .sl-reason-chip.is-active[data-value="bounced"]     { background:rgba(220,38,38,.16); color:#fca5a5; border-color:#ef4444; }
[data-bs-theme="dark"] .sl-reason-chip.is-active[data-value="complaint"]   { background:rgba(109,40,217,.18); color:#c4b5fd; border-color:#8b5cf6; }
[data-bs-theme="dark"] .sl-reason-chip.is-active[data-value="invalid"]     { background:rgba(128,128,128,.16); color:#d1d5db; border-color:#9ca3af; }

/* ── from templates/email_integration/template_detail.html ── */
/* ===== Template detail (td-) — premium, theme-aware chrome ===== */
  .td-head { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; flex-wrap:wrap; margin-bottom:1.25rem; }
  .td-head__back { display:inline-flex; align-items:center; gap:.4rem; font-size:.8rem; font-weight:600; color:var(--xi-muted); margin-bottom:.4rem; }
  .td-head__back:hover { color:var(--xi-accent); }
  .td-head__title { font-size:1.5rem; font-weight:700; letter-spacing:-.02em; margin:0; color:var(--xi-text); line-height:1.2; }
  .td-head__sub { font-size:.85rem; color:var(--xi-muted); margin:.25rem 0 0; }
  .td-actions { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }

  .td-meta { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:.85rem; margin-bottom:1.25rem; }
  .td-meta__cell { background:var(--xi-surface); border:1px solid var(--xi-border); border-radius:12px; padding:.85rem 1rem; box-shadow:0 1px 3px rgba(0,0,0,.04); }
  .td-meta__label { font-size:.68rem; text-transform:uppercase; letter-spacing:.06em; font-weight:700; color:var(--xi-muted); margin-bottom:.3rem; }
  .td-meta__value { font-size:.95rem; font-weight:600; color:var(--xi-text); word-break:break-word; }
  .td-meta__value--muted { color:var(--xi-muted); font-weight:500; }

  .td-chip { display:inline-flex; align-items:center; gap:.35rem; font-size:.78rem; font-weight:600; padding:.2rem .6rem; border-radius:999px; }
  .td-chip--cat { background:rgba(var(--xi-accent-rgb),.10); color:var(--xi-orange-dark); border:1px solid rgba(var(--xi-accent-rgb),.20); }
  .td-chip--global { background:rgba(var(--xi-accent-rgb),.12); color:var(--xi-orange-dark); border:1px solid rgba(var(--xi-accent-rgb),.22); }
  .td-chip--private { background:var(--xi-body-bg); color:var(--xi-muted); border:1px solid var(--xi-border); }
  [data-bs-theme="dark"] .td-chip--cat,
  [data-bs-theme="dark"] .td-chip--global { color:#ffb27a; }

  .td-preview { background:var(--xi-surface); border:1px solid var(--xi-border); border-radius:16px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,.04); }
  .td-preview__bar { display:flex; align-items:center; justify-content:space-between; gap:.75rem; flex-wrap:wrap; padding:.7rem 1rem; border-bottom:1px solid var(--xi-border); background:var(--xi-body-bg); }
  .td-preview__bar-title { display:flex; align-items:center; gap:.5rem; font-weight:700; font-size:.9rem; color:var(--xi-text); }
  .td-preview__bar-title i { color:#e66100; }
  .td-preview__bar-meta { font-size:.75rem; color:var(--xi-muted); }

  /* device segmented toggle — mirrors the builder */
  .td-seg { display:inline-flex; background:var(--xi-surface); border:1px solid var(--xi-border); border-radius:9px; padding:2px; }
  .td-seg__btn { border:0; background:transparent; color:var(--xi-muted); font-size:.78rem; font-weight:600; padding:.28rem .65rem; border-radius:7px; display:inline-flex; align-items:center; gap:.35rem; cursor:pointer; transition:all .15s ease; }
  .td-seg__btn.active { background:var(--xi-accent); color:#fff; box-shadow:0 1px 2px rgba(var(--xi-accent-rgb),.4); }

  .td-envelope { background:var(--xi-surface); border:1px solid var(--xi-border); border-radius:10px; padding:.75rem 1rem; margin:1rem 1rem 0; font-size:.82rem; line-height:1.7; }
  .td-envelope__row { display:flex; gap:.6rem; }
  .td-envelope__key { flex:0 0 52px; color:var(--xi-muted); font-weight:600; }
  .td-envelope__val { color:var(--xi-text); }
  .td-envelope__val .muted { color:var(--xi-muted); }

  /* preview stage stays LIGHT regardless of theme — this is the recipient's view */
  .td-stage { padding:20px 14px; background:#eef0f5; }
  .td-frame-wrap { margin:0 auto; max-width:680px; transition:max-width .2s ease; }
  .td-frame-wrap.is-mobile { max-width:380px; }
  #emailPreviewFrame { width:100%; display:block; background:#fff; border:1px solid #e5e7eb; border-radius:12px; min-height:460px; box-shadow:0 6px 24px rgba(17,24,39,.12); }

  .td-empty { padding:3rem 1rem; text-align:center; color:var(--xi-muted); }
  .td-empty i { font-size:2.2rem; display:block; margin-bottom:.6rem; opacity:.6; }

  .td-note { display:flex; align-items:center; gap:.4rem; font-size:.75rem; color:var(--xi-muted); padding:.6rem 1rem; border-top:1px solid var(--xi-border); background:var(--xi-body-bg); }
  .td-note i { color:#e66100; }

/* ── from templates/email_integration/template_form.html ── */
/* ============================================================
   Template Builder — premium, theme-aware (xi- design tokens)
   Chrome uses the app accent (--xi-accent #E85C00).
   The email PREVIEW keeps the email brand (#e66100) so that
   "what you see is what recipients get".
   ============================================================ */
.tb-wrap{ --tb-radius:14px; }

/* ---- Sticky action bar ---- */
.tb-bar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; gap:.75rem;
  padding:.6rem .85rem;
  background:var(--xi-surface);
  border:1px solid var(--xi-border);
  border-radius:12px;
  box-shadow:0 1px 2px rgba(16,24,40,.04);
  margin-bottom:1rem;
}
.tb-bar__back{
  display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; flex:0 0 auto;
  border-radius:9px; border:1px solid var(--xi-border);
  color:var(--xi-muted); background:var(--xi-surface);
  transition:all .15s ease;
}
.tb-bar__back:hover{ color:var(--xi-accent); border-color:var(--xi-accent); background:var(--xi-orange-light); }
.tb-bar__name{ flex:1 1 auto; min-width:0; }
.tb-name-input{
  width:100%; border:1px solid transparent; background:transparent;
  font-size:1.02rem; font-weight:700; color:var(--xi-text);
  padding:.35rem .55rem; border-radius:9px; line-height:1.2;
  transition:all .15s ease;
}
.tb-name-input::placeholder{ color:var(--xi-muted); font-weight:600; }
.tb-name-input:hover{ background:var(--xi-body-bg); }
.tb-name-input:focus{ outline:none; background:var(--xi-surface); border-color:var(--xi-accent); box-shadow:0 0 0 3px rgba(var(--xi-accent-rgb),.12); }
.tb-bar__status{ font-size:11.5px; color:var(--xi-muted); padding-left:.55rem; display:flex; align-items:center; gap:.35rem; white-space:nowrap; }
.tb-bar__status .dot{ width:7px; height:7px; border-radius:50%; background:#22c55e; }
.tb-bar__status.is-dirty .dot{ background:#f59e0b; }
.tb-bar__actions{ display:flex; align-items:center; gap:.5rem; flex:0 0 auto; }

/* ---- Cards ---- */
.tb-card{
  background:var(--xi-surface);
  border:1px solid var(--xi-border);
  border-radius:var(--tb-radius);
  overflow:hidden;
  margin-bottom:1rem;
}
.tb-card__head{
  display:flex; align-items:center; gap:.6rem;
  padding:.8rem 1rem; border-bottom:1px solid var(--xi-border);
}
.tb-card__head .num{
  width:24px; height:24px; flex:0 0 auto; border-radius:7px;
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--xi-orange-light); color:var(--xi-orange-dark);
  font-size:12px; font-weight:800;
}
.tb-card__title{ font-size:13.5px; font-weight:700; color:var(--xi-text); margin:0; line-height:1.2; }
.tb-card__title small{ display:block; font-weight:500; font-size:11.5px; color:var(--xi-muted); margin-top:2px; }
.tb-card__body{ padding:1rem; }
.tb-card__head .ms-auto{ margin-left:auto; }

/* ---- Fields ---- */
.tb-label{ font-size:12px; font-weight:700; color:var(--xi-text); margin-bottom:.35rem; display:block; }
.tb-help{ font-size:11.5px; color:var(--xi-muted); }
.tb-input, .tb-select{
  width:100%; padding:.55rem .7rem; font-size:13.5px;
  border:1px solid var(--xi-border); border-radius:10px;
  background:var(--xi-surface); color:var(--xi-text);
  transition:border-color .15s ease, box-shadow .15s ease;
}
.tb-input:focus, .tb-select:focus{ outline:none; border-color:var(--xi-accent); box-shadow:0 0 0 3px rgba(var(--xi-accent-rgb),.12); }
.tb-subject-row{ display:flex; gap:.5rem; align-items:stretch; }
.tb-subject-row .tb-input{ flex:1 1 auto; }
.tb-charcount{ font-size:11px; color:var(--xi-muted); margin-top:.35rem; }
.tb-charcount b{ color:var(--xi-text); font-weight:700; }

/* ---- Scope toggle / segmented ---- */
.tb-scope{ display:flex; gap:.5rem; flex-wrap:wrap; }
.tb-scope label{
  flex:1 1 0; min-width:150px; cursor:pointer; margin:0;
  border:1px solid var(--xi-border); border-radius:11px; padding:.65rem .8rem;
  display:flex; gap:.6rem; align-items:flex-start; transition:all .15s ease; background:var(--xi-surface);
}
.tb-scope label:hover{ border-color:var(--xi-accent); }
.tb-scope input{ margin-top:2px; accent-color:var(--xi-accent); }
.tb-scope .t{ font-size:12.5px; font-weight:700; color:var(--xi-text); }
.tb-scope .d{ font-size:11px; color:var(--xi-muted); }
.tb-scope input:checked ~ .tb-scope-txt .t{ color:var(--xi-orange-dark); }

/* ---- Toolbar (Add block / Insert field) ---- */
.tb-toolbar{
  display:flex; align-items:center; gap:.5rem; flex-wrap:wrap;
  padding:.6rem .8rem; border:1px solid var(--xi-border); border-bottom:none;
  border-radius:10px 10px 0 0; background:var(--xi-body-bg);
}
.tb-tool-btn{
  display:inline-flex; align-items:center; gap:.4rem;
  font-size:12.5px; font-weight:600; color:var(--xi-text);
  padding:.4rem .7rem; border-radius:8px; border:1px solid var(--xi-border);
  background:var(--xi-surface); transition:all .15s ease;
}
.tb-tool-btn:hover{ border-color:var(--xi-accent); color:var(--xi-orange-dark); background:var(--xi-orange-light); }
.tb-tool-btn i{ font-size:14px; }
.tb-toolbar__hint{ margin-left:auto; font-size:11px; color:var(--xi-muted); display:flex; align-items:center; gap:.35rem; }

/* editor mount sits flush under the toolbar */
.tb-editor-shell{ border:1px solid var(--xi-border); border-radius:0 0 10px 10px; overflow:hidden; }
.tb-editor-shell .tox-tinymce{ border:none !important; border-radius:0 !important; }
#bodyEditor{ /* textarea fallback when TinyMCE is unavailable */
  width:100%; min-height:340px; border:none; padding:1rem; font-size:14px;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace; resize:vertical;
  color:var(--xi-text); background:var(--xi-surface);
}

/* ---- Dropdown menus (blocks + fields) ---- */
.tb-menu{ border:1px solid var(--xi-border); border-radius:12px; box-shadow:0 12px 30px rgba(16,24,40,.14); padding:.4rem; }
.tb-menu--wide{ width:min(440px,88vw); }
.tb-menu__group{ font-size:10px; letter-spacing:.08em; text-transform:uppercase; font-weight:800; color:var(--xi-muted); padding:.5rem .55rem .25rem; }
.tb-block-grid{ display:grid; grid-template-columns:1fr 1fr; gap:.35rem; }
.tb-block-item{
  display:flex; gap:.55rem; align-items:flex-start; text-align:left; width:100%;
  padding:.55rem .6rem; border-radius:9px; border:1px solid transparent; background:transparent;
  transition:all .12s ease;
}
.tb-block-item:hover{ background:var(--xi-orange-light); border-color:var(--xi-accent); }
.tb-block-item i{ font-size:16px; color:var(--xi-orange-dark); margin-top:1px; flex:0 0 auto; }
.tb-block-item .bt{ font-size:12.5px; font-weight:700; color:var(--xi-text); line-height:1.15; }
.tb-block-item .bd{ font-size:10.5px; color:var(--xi-muted); line-height:1.2; margin-top:1px; }
.tb-field-item{
  display:flex; align-items:center; gap:.5rem; width:100%; text-align:left;
  padding:.4rem .55rem; border-radius:8px; border:none; background:transparent; transition:background .12s ease;
}
.tb-field-item:hover{ background:var(--xi-orange-light); }
.tb-field-item code{
  font-size:11px; color:var(--xi-orange-dark); background:var(--xi-orange-light);
  border:1px solid rgba(var(--xi-accent-rgb),.25); border-radius:5px; padding:1px 6px; font-weight:700; white-space:nowrap;
}
.tb-field-item .fl{ font-size:12px; color:var(--xi-text); }

/* ---- Start-from gallery ---- */
.tb-start-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:.6rem; }
.tb-start-card{
  text-align:left; padding:.8rem; border-radius:12px; border:1px solid var(--xi-border);
  background:var(--xi-surface); transition:all .15s ease; cursor:pointer;
}
.tb-start-card:hover{ border-color:var(--xi-accent); box-shadow:0 6px 18px rgba(var(--xi-accent-rgb),.12); transform:translateY(-1px); }
.tb-start-card i{ font-size:20px; color:var(--xi-orange-dark); }
.tb-start-card .st{ font-size:12.5px; font-weight:700; color:var(--xi-text); margin-top:.45rem; }
.tb-start-card .sd{ font-size:11px; color:var(--xi-muted); margin-top:2px; line-height:1.25; }

/* ---- Live preview panel ---- */
.tb-preview{ position:sticky; top:64px; }
.tb-preview__head{
  display:flex; align-items:center; gap:.6rem; padding:.7rem .9rem;
  border-bottom:1px solid var(--xi-border); background:var(--xi-surface);
}
.tb-preview__title{ font-size:13px; font-weight:700; color:var(--xi-text); display:flex; align-items:center; gap:.45rem; }
.tb-preview__title .live{ font-size:9.5px; font-weight:800; letter-spacing:.06em; color:#16a34a; background:rgba(22,163,74,.12); border-radius:20px; padding:2px 7px; }
.tb-seg{ display:inline-flex; border:1px solid var(--xi-border); border-radius:8px; overflow:hidden; }
.tb-seg button{ border:none; background:var(--xi-surface); color:var(--xi-muted); padding:.28rem .5rem; font-size:12px; line-height:1; }
.tb-seg button.active{ background:var(--xi-accent); color:#fff; }
.tb-preview__stage{ background:var(--xi-body-bg); padding:14px; max-height:calc(100vh - 190px); overflow:auto; }
.tb-envelope{
  background:var(--xi-surface); border:1px solid var(--xi-border); border-radius:10px;
  padding:.6rem .8rem; margin-bottom:12px; font-size:12px; line-height:1.7;
}
.tb-envelope .k{ color:var(--xi-muted); display:inline-block; width:52px; }
.tb-envelope .v{ color:var(--xi-text); }
.tb-envelope .subj{ font-weight:700; }
.tb-frame-wrap{ text-align:center; }
#tbPreviewFrame{
  width:100%; max-width:640px; margin:0 auto; display:block; background:#fff;
  border:1px solid var(--xi-border); border-radius:12px; min-height:360px; transition:max-width .2s ease;
}
.tb-preview__stage.is-mobile #tbPreviewFrame{ max-width:380px; }
.tb-preview__foot{ padding:.55rem .9rem; border-top:1px solid var(--xi-border); font-size:11px; color:var(--xi-muted); display:flex; align-items:center; gap:.4rem; background:var(--xi-surface); }

.tb-note{
  display:flex; gap:.6rem; padding:.7rem .8rem; border-radius:11px;
  background:var(--xi-orange-light); border:1px solid rgba(var(--xi-accent-rgb),.22);
  color:var(--xi-orange-dark); font-size:12px; line-height:1.45;
}
.tb-note i{ font-size:15px; margin-top:1px; }

@media (max-width: 1199.98px){
  .tb-preview{ position:static; }
  .tb-preview__stage{ max-height:none; }
}

/* ── from templates/email_integration/template_form.html ── */
body{margin:0;padding:0;}img{max-width:100%;height:auto;}

/* ── from templates/email_integration/templates_list.html ── */
/* ===== Templates list — premium, theme-aware ===== */
.tpl-kpi{ display:grid; grid-template-columns:repeat(3,1fr); gap:1rem; margin-bottom:1.25rem; }
.tpl-kpi .xi-kpi-card{ margin:0; }
@media (max-width: 767px){ .tpl-kpi{ grid-template-columns:1fr 1fr; } }

.tpl-avatar{
  width:40px; height:40px; flex:0 0 auto; border-radius:12px;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:16px; color:var(--xi-orange-dark);
  background:var(--xi-orange-light);
  border:1px solid rgba(var(--xi-accent-rgb),.20);
}
.tpl-name{ font-weight:600; color:var(--xi-text); text-decoration:none; }
.tpl-name:hover{ color:var(--xi-accent); }
.tpl-subj{
  display:inline-flex; align-items:center; gap:.35rem; flex-wrap:wrap;
  font-size:12.5px; color:var(--xi-muted); margin-top:.15rem;
}
.tpl-subj code{
  background:rgba(var(--xi-accent-rgb),.10); color:var(--xi-orange-dark);
  border:1px solid rgba(var(--xi-accent-rgb),.22); border-radius:5px;
  padding:0 5px; font-weight:600; font-size:11px; white-space:nowrap;
}
.tpl-cat{
  display:inline-flex; align-items:center; gap:.3rem;
  font-size:12px; font-weight:600; padding:.25rem .6rem; border-radius:999px;
  background:rgba(var(--xi-accent-rgb),.08); color:var(--xi-orange-dark);
  border:1px solid rgba(var(--xi-accent-rgb),.16);
}
.tpl-vis{
  display:inline-flex; align-items:center; gap:.35rem;
  font-size:12px; font-weight:600; padding:.25rem .6rem; border-radius:999px;
}
.tpl-vis--team{ background:rgba(var(--xi-accent-rgb),.12); color:var(--xi-orange-dark); border:1px solid rgba(var(--xi-accent-rgb),.22); }
.tpl-vis--me{ background:var(--xi-body-bg); color:var(--xi-muted); border:1px solid var(--xi-border); }
[data-bs-theme="dark"] .tpl-vis--team,
[data-bs-theme="dark"] .tpl-cat{ color:#ffb27a; }
.tpl-row:hover{ cursor:pointer; }
.tpl-actions{ white-space:nowrap; width:150px; text-align:right; }
.tpl-actions .xi-action-btn{ margin-left:.25rem; }
.tpl-actions .xi-action-btn:first-child{ margin-left:0; }
.tpl-action{
  display:inline-flex; align-items:center; justify-content:center;
  width:1.85rem; height:1.85rem; border-radius:7px; border:none; background:transparent;
  font-size:.95rem; text-decoration:none; transition:background .15s, color .15s, transform .1s;
}
.tpl-action:hover{ transform:translateY(-1px); }
.tpl-action--preview{ color:#7c3aed; }
.tpl-action--preview:hover{ background:#f3f0ff; }
.tpl-action--send{ color:#2563eb; }
.tpl-action--send:hover{ background:#eff6ff; }
.tpl-action--edit{ color:#c2410c; }
.tpl-action--edit:hover{ background:#fff4ed; }
.tpl-action--delete{ color:#dc2626; }
.tpl-action--delete:hover{ background:#fee2e2; }
[data-bs-theme="dark"] .tpl-action--preview{ color:#a78bfa; }
[data-bs-theme="dark"] .tpl-action--send{ color:#93c5fd; }
[data-bs-theme="dark"] .tpl-action--edit{ color:#fdba74; }
[data-bs-theme="dark"] .tpl-action--delete{ color:#f87171; }

/* ── from templates/finance/expense_detail.html ── */
.receipt-preview {
  cursor: zoom-in;
}

/* ── from templates/finance/expense_list.html ── */
.receipt-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  cursor: pointer;
}

/* ── from templates/finance/index.html ── */
.receipt-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  cursor: pointer;
}

/* ── from templates/kpis/index.html ── */
:root {
  --kpi-new: #2563eb;
  --kpi-open: #6366f1;
  --kpi-in-progress: #d97706;
  --kpi-open-deal: #059669;
  --kpi-unqualified: #dc2626;
  --kpi-attempted: #ea580c;
  --kpi-connected: #0d9488;
  --kpi-bad-timing: #6b7280;
  --kpi-unassigned: #1f2937;
}
.kpi-card { background: var(--xi-surface); border: 1px solid var(--xi-border); border-radius: 12px; padding: 1rem 1.25rem; display: flex; align-items: center; gap: 1rem; transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.kpi-card:hover { border-color: rgba(var(--xi-accent-rgb), .28); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.kpi-card__icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex: 0 0 auto; }
.kpi-card__body { flex: 1; min-width: 0; }
.kpi-card__count { font-size: 24px; font-weight: 800; color: var(--xi-text); line-height: 1.2; }
.kpi-card__label { font-size: 11px; color: var(--xi-muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-card__bar { height: 3px; border-radius: 2px; margin-top: 6px; background: var(--xi-border); overflow: hidden; }
.kpi-card__bar-fill { height: 100%; border-radius: 2px; transition: width .4s ease; }

.kpi-card--new { border-left: 4px solid var(--kpi-new); }
.kpi-card--new .kpi-card__icon { background: #dbeafe; color: var(--kpi-new); }
.kpi-card--new .kpi-card__bar-fill { background: var(--kpi-new); }

.kpi-card--open { border-left: 4px solid var(--kpi-open); }
.kpi-card--open .kpi-card__icon { background: #e0e7ff; color: var(--kpi-open); }
.kpi-card--open .kpi-card__bar-fill { background: var(--kpi-open); }

.kpi-card--in_progress { border-left: 4px solid var(--kpi-in-progress); }
.kpi-card--in_progress .kpi-card__icon { background: #fef3c7; color: var(--kpi-in-progress); }
.kpi-card--in_progress .kpi-card__bar-fill { background: var(--kpi-in-progress); }

.kpi-card--open_deal { border-left: 4px solid var(--kpi-open-deal); }
.kpi-card--open_deal .kpi-card__icon { background: #d1fae5; color: var(--kpi-open-deal); }
.kpi-card--open_deal .kpi-card__bar-fill { background: var(--kpi-open-deal); }

.kpi-card--unqualified { border-left: 4px solid var(--kpi-unqualified); }
.kpi-card--unqualified .kpi-card__icon { background: #fee2e2; color: var(--kpi-unqualified); }
.kpi-card--unqualified .kpi-card__bar-fill { background: var(--kpi-unqualified); }

.kpi-card--attempted_to_contact { border-left: 4px solid var(--kpi-attempted); }
.kpi-card--attempted_to_contact .kpi-card__icon { background: #ffedd5; color: var(--kpi-attempted); }
.kpi-card--attempted_to_contact .kpi-card__bar-fill { background: var(--kpi-attempted); }

.kpi-card--connected { border-left: 4px solid var(--kpi-connected); }
.kpi-card--connected .kpi-card__icon { background: #ccfbf1; color: var(--kpi-connected); }
.kpi-card--connected .kpi-card__bar-fill { background: var(--kpi-connected); }

.kpi-card--bad_timing { border-left: 4px solid var(--kpi-bad-timing); }
.kpi-card--bad_timing .kpi-card__icon { background: #f3f4f6; color: var(--kpi-bad-timing); }
.kpi-card--bad_timing .kpi-card__bar-fill { background: var(--kpi-bad-timing); }

.kpi-card--unassigned { border-left: 4px solid var(--kpi-unassigned); }
.kpi-card--unassigned .kpi-card__icon { background: #e5e7eb; color: var(--kpi-unassigned); }
.kpi-card--unassigned .kpi-card__bar-fill { background: var(--kpi-unassigned); }

.activity-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.activity-badge i { font-size: 12px; }
.activity-badge--call { background: #dbeafe; color: #1d4ed8; }
.activity-badge--email { background: #ede9fe; color: #7c3aed; }
.activity-badge--meeting { background: #fef3c7; color: #b45309; }
.activity-badge--linkedin { background: #cffafe; color: #0e7490; }
.activity-badge--note { background: #f3f4f6; color: #4b5563; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; flex: 0 0 auto; }
.status-dot--new { background: var(--kpi-new); }
.status-dot--open { background: var(--kpi-open); }
.status-dot--in_progress { background: var(--kpi-in-progress); }
.status-dot--open_deal { background: var(--kpi-open-deal); }
.status-dot--unqualified { background: var(--kpi-unqualified); }
.status-dot--attempted_to_contact { background: var(--kpi-attempted); }
.status-dot--connected { background: var(--kpi-connected); }
.status-dot--bad_timing { background: var(--kpi-bad-timing); }
.status-dot--unassigned { background: var(--kpi-unassigned); }

.summary-stat { text-align: center; padding: 1rem; }
.summary-stat-button { width: 100%; border: 0; }
.summary-stat__value { font-size: 28px; font-weight: 800; line-height: 1.2; }
.summary-stat__label { font-size: 11px; color: var(--xi-muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
.summary-stat__trend { font-size: 11px; font-weight: 700; margin-top: 4px; }

.kpi-pill-group { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--xi-surface); border: 1px solid var(--xi-border); border-radius: 11px; padding: 4px; }
.kpi-pill { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--xi-muted); font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.kpi-pill i { font-size: 13px; }
.kpi-pill:hover { background: rgba(128,128,128,.1); color: var(--xi-text); }
.kpi-pill.is-active { background: var(--xi-accent); color: #fff; box-shadow: 0 2px 8px rgba(var(--xi-accent-rgb), .35); }
.kpi-date-box { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--xi-border); border-radius: 11px; padding: 4px 8px; background: var(--xi-surface); }
.kpi-date-box__icon { color: var(--xi-muted); font-size: 14px; margin-right: 4px; }
.kpi-date-box input[type="date"] { border: 0; background: transparent; padding: 0; width: 132px; font-size: 12px; color: var(--xi-text); }
.kpi-date-nav { border: 0; background: transparent; color: var(--xi-muted); padding: 2px 4px; cursor: pointer; border-radius: 6px; font-size: 12px; text-decoration: none; }
.kpi-date-nav:hover { color: var(--xi-accent); background: rgba(var(--xi-accent-rgb), .1); }
.kpi-apply-btn { border-radius: 10px; }

/* ── from templates/tenders/kpi/dashboard.html ── */
:root {
  --tender-new: #2563eb;
  --tender-in_progress: #0ea5e9;
  --tender-waiting_mgmt_review_1: #f59e0b;
  --tender-waiting_mgmt_review_2: #f97316;
  --tender-ready_for_submission: #15803d;
  --tender-submitted: #1d4ed8;
  --tender-awarded: #16a34a;
  --tender-lost: #6b7280;
  --tender-cancelled: #4b5563;
  --tender-no_bid: #9ca3af;
}
.kpi-card { background: var(--xi-surface); border: 1px solid var(--xi-border); border-radius: 12px; padding: 1rem 1.25rem; display: flex; align-items: center; gap: 1rem; transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.kpi-card:hover { border-color: rgba(var(--xi-accent-rgb), .28); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.kpi-card__icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex: 0 0 auto; }
.kpi-card__body { flex: 1; min-width: 0; }
.kpi-card__count { font-size: 24px; font-weight: 800; color: var(--xi-text); line-height: 1.2; }
.kpi-card__label { font-size: 11px; color: var(--xi-muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-card__bar { height: 3px; border-radius: 2px; margin-top: 6px; background: var(--xi-border); overflow: hidden; }
.kpi-card__bar-fill { height: 100%; border-radius: 2px; transition: width .4s ease; }

.kpi-card--new { border-left: 4px solid var(--tender-new); }
.kpi-card--new .kpi-card__icon { background: #dbeafe; color: var(--tender-new); }
.kpi-card--new .kpi-card__bar-fill { background: var(--tender-new); }
.kpi-card--in_progress { border-left: 4px solid var(--tender-in_progress); }
.kpi-card--in_progress .kpi-card__icon { background: #e0f2fe; color: var(--tender-in_progress); }
.kpi-card--in_progress .kpi-card__bar-fill { background: var(--tender-in_progress); }
.kpi-card--waiting_mgmt_review_1 { border-left: 4px solid var(--tender-waiting_mgmt_review_1); }
.kpi-card--waiting_mgmt_review_1 .kpi-card__icon { background: #fef3c7; color: var(--tender-waiting_mgmt_review_1); }
.kpi-card--waiting_mgmt_review_1 .kpi-card__bar-fill { background: var(--tender-waiting_mgmt_review_1); }
.kpi-card--waiting_mgmt_review_2 { border-left: 4px solid var(--tender-waiting_mgmt_review_2); }
.kpi-card--waiting_mgmt_review_2 .kpi-card__icon { background: #ffedd5; color: var(--tender-waiting_mgmt_review_2); }
.kpi-card--waiting_mgmt_review_2 .kpi-card__bar-fill { background: var(--tender-waiting_mgmt_review_2); }
.kpi-card--ready_for_submission { border-left: 4px solid var(--tender-ready_for_submission); }
.kpi-card--ready_for_submission .kpi-card__icon { background: #dcfce7; color: var(--tender-ready_for_submission); }
.kpi-card--ready_for_submission .kpi-card__bar-fill { background: var(--tender-ready_for_submission); }
.kpi-card--submitted { border-left: 4px solid var(--tender-submitted); }
.kpi-card--submitted .kpi-card__icon { background: #dbeafe; color: var(--tender-submitted); }
.kpi-card--submitted .kpi-card__bar-fill { background: var(--tender-submitted); }
.kpi-card--awarded { border-left: 4px solid var(--tender-awarded); }
.kpi-card--awarded .kpi-card__icon { background: #dcfce7; color: var(--tender-awarded); }
.kpi-card--awarded .kpi-card__bar-fill { background: var(--tender-awarded); }
.kpi-card--lost { border-left: 4px solid var(--tender-lost); }
.kpi-card--lost .kpi-card__icon { background: #f3f4f6; color: var(--tender-lost); }
.kpi-card--lost .kpi-card__bar-fill { background: var(--tender-lost); }
.kpi-card--cancelled { border-left: 4px solid var(--tender-cancelled); }
.kpi-card--cancelled .kpi-card__icon { background: #e5e7eb; color: var(--tender-cancelled); }
.kpi-card--cancelled .kpi-card__bar-fill { background: var(--tender-cancelled); }
.kpi-card--no_bid { border-left: 4px solid var(--tender-no_bid); }
.kpi-card--no_bid .kpi-card__icon { background: #f9fafb; color: var(--tender-no_bid); }
.kpi-card--no_bid .kpi-card__bar-fill { background: var(--tender-no_bid); }

.event-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.event-badge i { font-size: 12px; }
.event-badge--status { background: #dbeafe; color: #1d4ed8; }
.event-badge--assignment { background: #ede9fe; color: #7c3aed; }
.event-badge--deadline { background: #fef3c7; color: #b45309; }
.event-badge--message { background: #d1fae5; color: #047857; }
.event-badge--note { background: #f3f4f6; color: #4b5563; }
.event-badge--created { background: #ccfbf1; color: #0f766e; }
.event-badge--system { background: #e5e7eb; color: #374151; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; flex: 0 0 auto; }
.status-dot--new { background: var(--tender-new); }
.status-dot--in_progress { background: var(--tender-in_progress); }
.status-dot--waiting_mgmt_review_1 { background: var(--tender-waiting_mgmt_review_1); }
.status-dot--waiting_mgmt_review_2 { background: var(--tender-waiting_mgmt_review_2); }
.status-dot--ready_for_submission { background: var(--tender-ready_for_submission); }
.status-dot--submitted { background: var(--tender-submitted); }
.status-dot--awarded { background: var(--tender-awarded); }
.status-dot--lost { background: var(--tender-lost); }
.status-dot--cancelled { background: var(--tender-cancelled); }
.status-dot--no_bid { background: var(--tender-no_bid); }

.summary-stat { text-align: center; padding: 1rem; }
.summary-stat__value { font-size: 28px; font-weight: 800; line-height: 1.2; }
.summary-stat__label { font-size: 11px; color: var(--xi-muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
.summary-stat__trend { font-size: 11px; font-weight: 700; margin-top: 4px; }

/* ── from templates/tenders/list.html ── */
.tender-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: .5rem;
  }
  .tender-tab {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem .9rem;
    border: 1px solid transparent;
    border-radius: .5rem;
    font-size: .875rem;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    background: transparent;
    transition: background-color .15s ease, color .15s ease;
  }
  .tender-tab:hover { background: #f3f4f6; color: #374151; }
  .tender-tab.is-active {
    background: #fff;
    color: #b45309;
    border-color: #e5e7eb;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
  }
  .tender-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    padding: 0 .4rem;
    height: 1.35rem;
    border-radius: 999px;
    background: #e5e7eb;
    color: #4b5563;
    font-size: .75rem;
    font-weight: 700;
  }
  .tender-tab.is-active .tender-tab__count { background: rgba(255,255,255,.25); color: inherit; }

  /* ── Tab status colors ── */
  .tender-tab--new { background: #e0f2fe; color: #0369a1; }
  .tender-tab--new:hover { background: #bae6fd; color: #075985; }
  .tender-tab--new.is-active { background: #0ea5e9; color: #fff; border-color: #0ea5e9; }
  .tender-tab--new.is-active .tender-tab__count { background: #fff; color: #0369a1; }

  .tender-tab--submitted { background: #dcfce7; color: #166534; }
  .tender-tab--submitted:hover { background: #bbf7d0; color: #14532d; }
  .tender-tab--submitted.is-active { background: #22c55e; color: #fff; border-color: #22c55e; }
  .tender-tab--submitted.is-active .tender-tab__count { background: #fff; color: #166534; }

  .tender-tab--expired { background: #fee2e2; color: #991b1b; }
  .tender-tab--expired:hover { background: #fecaca; color: #7f1d1d; }
  .tender-tab--expired.is-active { background: #ef4444; color: #fff; border-color: #ef4444; }
  .tender-tab--expired.is-active .tender-tab__count { background: #fff; color: #991b1b; }
  @media (max-width: 575.98px) {
    .tender-tab__label { display: none; }
  }
  .xi-comment-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border: none;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(var(--xi-accent-rgb), .13), rgba(var(--xi-accent-rgb), .04));
    color: var(--xi-accent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 2px rgba(16, 24, 40, .05);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, color .15s ease, background .2s ease;
  }
  .xi-comment-btn:hover {
    background: linear-gradient(135deg, var(--xi-accent), #f59e0b);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(var(--xi-accent-rgb), .32);
  }
  .xi-comment-btn:active { transform: translateY(0) scale(.96); }
  .xi-comment-btn__badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: #fff;
    border: 1.5px solid var(--xi-accent);
    color: var(--xi-accent);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(232, 92, 0, .25);
  }
  .xi-comment-btn:hover .xi-comment-btn__badge {
    background: var(--xi-accent);
    color: #fff;
    border-color: #fff;
  }
  .xi-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    margin-left: .12rem;
    border-radius: .55rem;
    color: var(--xi-muted, #6b7280);
    text-decoration: none;
    transition: background .15s ease, color .15s ease, transform .15s ease;
  }
  .xi-row-action:hover { background: rgba(var(--xi-accent-rgb), .09); color: var(--xi-accent); transform: translateY(-1px); }
  .xi-row-action--danger:hover { background: #fee2e2; color: #dc2626; }
  .xi-action-btn--small { width: 1.4rem; height: 1.4rem; font-size: .72rem; border-radius: 5px; }
  .tender-comment-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 .3rem;
    border-radius: 999px;
    background: #d1fae5;
    color: #15803d;
    font-size: .65rem;
    font-weight: 700;
    margin-left: .15rem;
  }
  .tender-comment-edit-form { display: none; margin-top: .6rem; }
  .xi-modal__body { max-height: 70vh; overflow-y: auto; }

/* ═══ Utility classes — consolidated from inline style="" attributes */
.xi-fs-8 { font-size: 8px; }
.xi-fs-10 { font-size: 10px; }
.xi-fs-11 { font-size: 11px; }
.xi-fs-12 { font-size: 12px; }
.xi-fs-13 { font-size: 13px; }
.xi-fs-15 { font-size: 15px; }
.xi-fs-16 { font-size: 16px; }
.xi-muted { color: var(--xi-muted); }
.xi-mut-soft { color: #9ca3af; }
.xi-text-accent { color: var(--xi-accent); }
.xi-text-orange { color: #e66100; }
.xi-filter-field { background: #f9fafb; min-height: 38px; border-radius: 10px; font-size: 13px; padding: 8px 12px; }
.xi-chip { border-radius: 8px; font-size: 12px; white-space: nowrap; }
.xi-br-10 { border-radius: 10px; }
.xi-w-auto { width: auto; }
.xi-hidden { display: none; }
.xi-minw-60 { min-width: 60px; }
.xi-minw-70 { min-width: 70px; }
.xi-minw-80 { min-width: 80px; }
.xi-minw-110 { min-width: 110px; }
.xi-minw-130 { min-width: 130px; }
.xi-minw-160 { min-width: 160px; }
.xi-w-30 { width: 30px; }
.xi-w-44 { width: 44px; }
.xi-w-90 { width: 90px; }
.xi-w-110 { width: 110px; }
.xi-minh-50v { min-height: 50vh; }
.xi-maxw-380 { max-width: 380px; }
.xi-maxw-720 { max-width: 720px; }
.xi-maxw-760 { max-width: 760px; }
.xi-maxw-860 { max-width: 860px; }

/* Vendors list — inline editable message cell */
.xi-vmsg-cell { vertical-align: top; }
.xi-vmsg-cell .xi-vmsg-trigger { border-radius: 8px; cursor: pointer; }
.xi-vmsg-cell .xi-vmsg-trigger:hover { background: #f1f5f9; }
.xi-vmsg-cell.is-editing { background-color: #f8fafc; }
.xi-vmsg-cell .xi-vmsg-hint { color: var(--xi-accent); opacity: 0; transition: opacity .15s ease; }
.xi-vmsg-cell .xi-vmsg-trigger:hover .xi-vmsg-hint,
.xi-vmsg-cell.is-editing .xi-vmsg-hint { opacity: 1; }
.xi-vmsg-cell .xi-vmsg-textarea { resize: vertical; min-height: 64px; }

/* Vendors list — compact single-line row action buttons */
.xi-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; flex: 0 0 auto; }

/* Vendors list — colorized inline status dropdown */
.xi-vsel { font-weight: 600; min-width: 150px; border-radius: 8px; cursor: pointer; }
.xi-vsel--new { background-color: #e2e8f0; border-color: #94a3b8; color: #334155; }
.xi-vsel--contacted { background-color: #cffafe; border-color: #22d3ee; color: #0e7490; }
.xi-vsel--applied { background-color: #dbeafe; border-color: #60a5fa; color: #1d4ed8; }
.xi-vsel--follow_up { background-color: #fef3c7; border-color: #fbbf24; color: #b45309; }
.xi-vsel--active { background-color: #dcfce7; border-color: #4ade80; color: #15803d; }
.xi-vsel--inactive { background-color: #f1f5f9; border-color: #cbd5e1; color: #64748b; }

/* Vendors list — inline editable follow-up date */
.xi-vfollowup { min-width: 150px; }
.xi-vfollowup-input { min-width: 150px; }
.xi-vfollowup-input.is-invalid { border-color: #ef4444; }
.xi-vfollowup-input.is-invalid:focus { box-shadow: 0 0 0 0.2rem rgba(239, 68, 68, .25); }
.xi-vfollowup-input.is-valid { border-color: #22c55e; }
.xi-vfollowup-input.is-valid:focus { box-shadow: 0 0 0 0.2rem rgba(34, 197, 94, .25); }

/* Impersonation banner — rendered by templates/includes/impersonation_banner.html.
   Lives here rather than in a per-page <style> block so every base layout that
   ships app.css (app pages, Django admin, sign-in shell) can show the banner
   and its "Stop viewing" control. */
.xi-imp-banner {
  background: #fff3cd; border-bottom: 1px solid #ffe08a; color: #6b5200;
  padding: .45rem .9rem; font-size: .85rem; line-height: 1.4;
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 1040;
}
.xi-imp-banner .xi-imp-who { font-weight: 600; }
.xi-imp-banner form { margin: 0; }

/* ── from templates/dashboard/home.html — ERP overview additions ── */
/* Responsive KPI strip: auto-fits 5–9 cards without breakpoints. */
.db-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.db-kpi__value { font-size: clamp(20px, 2.2vw, 26px); overflow-wrap: anywhere; }
a.db-kpi { display: block; text-decoration: none; color: inherit; }
.db-kpi__go {
  color: var(--xi-muted-2);
  font-size: 13px;
  opacity: 0;
  transition: opacity .15s, transform .15s;
}
.db-kpi:hover .db-kpi__go { opacity: 1; transform: translate(2px, -2px); color: var(--xi-accent); }

.db-kpi--purple::before { background: var(--xi-purple); }
.db-kpi--teal::before   { background: var(--xi-teal); }
.db-kpi__icon-wrap--purple { background: var(--xi-purple-light); color: var(--xi-purple); }
.db-kpi__icon-wrap--teal   { background: #e6fffb; color: var(--xi-teal); }

.db-kpi__chip--brand   { background: var(--xi-accent-light); color: var(--xi-accent); }
.db-kpi__chip--info    { background: var(--xi-blue-light); color: var(--xi-blue); }
.db-kpi__chip--purple  { background: var(--xi-purple-light); color: var(--xi-purple); }
.db-kpi__chip--teal    { background: #e6fffb; color: var(--xi-teal); }

/* Pulse row — a flexible band of module snapshot cards. */
.db-pulse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

/* Clickable pipeline rows / list rows. */
a.db-pip-row, a.db-list-item { text-decoration: none; color: inherit; }
.db-pip-stage--wrap { width: 122px; white-space: normal; line-height: 1.15; word-break: break-word; }
.db-pip-fill--purple { background: linear-gradient(90deg, var(--xi-purple), #a78bfa); }
.db-pip-fill--teal   { background: linear-gradient(90deg, var(--xi-teal), #2dd4bf); }

/* Metric tiles. */
.db-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}
.db-tile { background: #fafafa; border: 1px solid var(--xi-border); border-radius: 10px; padding: 12px 14px; }
.db-tile__icon { font-size: 15px; color: var(--xi-accent); margin-bottom: 6px; }
.db-tile__icon--blue  { color: var(--xi-blue); }
.db-tile__icon--green { color: var(--xi-green); }
.db-tile__icon--red   { color: var(--xi-red); }
.db-tile__value { font-size: 19px; font-weight: 800; color: var(--xi-text); letter-spacing: -.5px; line-height: 1.1; overflow-wrap: anywhere; }
.db-tile__label { font-size: 11px; color: var(--xi-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; margin-top: 3px; }

/* Budget utilisation meter. */
.db-budget { padding: 0 20px 16px; }
.db-budget__head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--xi-muted); font-weight: 600; }
.db-budget__val { color: var(--xi-text-2); }
.db-budget__track { height: 8px; background: #f3f4f6; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.db-budget__fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--xi-green), #34d399); transition: width 1s cubic-bezier(.4,0,.2,1); }

/* Severity + deadline chips. */
.db-sev { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.db-sev--low      { background: var(--xi-blue-light); color: var(--xi-blue); }
.db-sev--medium   { background: var(--xi-amber-light); color: var(--xi-amber); }
.db-sev--high     { background: var(--xi-accent-light); color: var(--xi-accent); }
.db-sev--critical { background: var(--xi-red-light); color: var(--xi-red); }

.db-deadline { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-top: 3px; }
.db-deadline--urgent { background: var(--xi-red-light); color: var(--xi-red); }
.db-deadline--soon   { background: var(--xi-amber-light); color: var(--xi-amber); }

.db-list-item__avatar--purple { background: linear-gradient(135deg, var(--xi-purple), #a78bfa); }
.db-action-item__avatar--danger { background: linear-gradient(135deg, var(--xi-red), #f87171); }
.db-empty--compact { padding: 24px 20px; }
.db-empty--compact i { font-size: 24px; }
