/* ============================================================
   OPSIS — DESIGN SYSTEM & STYLES
   ============================================================ */

/* ---- Design Tokens ---- */
:root {
  --bg:           #F4F3F0;
  --card:         #FFFFFF;
  --sidebar-bg:   #0D1425;
  --accent:       #4361EE;
  --accent-light: #EEF1FF;
  --text-1:       #0F1729;
  --text-2:       #6B7280;
  --text-3:       #9CA3AF;
  --border:       rgba(0,0,0,0.07);
  --border-soft:  rgba(0,0,0,0.04);
  --green:        #10B981;
  --green-bg:     #ECFDF5;
  --amber:        #F59E0B;
  --amber-bg:     #FFFBEB;
  --red:          #EF4444;
  --red-bg:       #FEF2F2;
  --r-sm:         8px;
  --r-md:         12px;
  --r-lg:         16px;
  --r-xl:         24px;
  --shadow-xs:    0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-md:    0 2px 8px rgba(0,0,0,0.05), 0 8px 24px rgba(0,0,0,0.08);
  --font:         'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --sidebar-w:    244px;
  --topbar-h:     64px;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a    { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input  { font-family: var(--font); }

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
  display: none;
  width: 100%;
  height: 100vh;
}
.screen.active { display: flex; }


/* ============================================================
   LOGIN
   ============================================================ */
.login-split {
  display: flex;
  width: 100%;
  height: 100%;
}

/* Left brand panel */
.login-brand {
  flex: 0 0 46%;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px;
  position: relative;
  overflow: hidden;
}

/* Ambient glow blobs */
.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 15% 75%, rgba(67,97,238,0.2) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 85% 20%, rgba(67,97,238,0.1) 0%, transparent 50%);
  pointer-events: none;
}

/* Subtle grid texture */
.login-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}

.login-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 400px;
  width: 100%;
  animation: fadeUp 0.5s ease both;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 60px;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon.small svg { width: 20px; height: 20px; }

.logo-wordmark {
  font-size: 17px;
  font-weight: 600;
  color: white;
  letter-spacing: -0.3px;
}

.login-copy { margin-bottom: 48px; }

.login-headline {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.6px;
  color: white;
  margin-bottom: 18px;
}

.login-subtext {
  font-size: 14.5px;
  line-height: 1.75;
  color: rgba(255,255,255,0.45);
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.65);
}

.feature-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(67,97,238,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Right form panel */
.login-form-panel {
  flex: 1;
  background: #FAFAF8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px;
}

.login-form-inner {
  width: 100%;
  max-width: 360px;
  animation: fadeUp 0.5s 0.1s ease both;
}

.login-form-header {
  margin-bottom: 36px;
}

.login-form-header h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

.login-form-header p {
  font-size: 14px;
  color: var(--text-2);
}

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 7px;
}

.form-group input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #E5E7EB;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text-1);
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.text-link {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}
.text-link:hover { opacity: 0.8; }

.login-footer-note {
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  margin-top: 22px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.1px;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-primary:hover   { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active  { transform: translateY(0); }
.btn-full            { width: 100%; height: 44px; font-size: 14px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  background: white;
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-secondary:hover { background: #F9FAFB; border-color: #D1D5DB; }

.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }

.pill-btn {
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.pill-btn:hover  { background: white; color: var(--text-1); }
.pill-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ============================================================
   APP SHELL
   ============================================================ */
#screen-app {
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 10px;
}

.sidebar-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-close-mobile {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -6px -8px -6px 0;
  border-radius: 10px;
  color: rgba(255,255,255,0.55);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.sidebar-close-mobile:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.95);
}

.sidebar-section-label {
  padding: 6px 18px 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.22);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8.5px 11px;
  border-radius: var(--r-sm);
  color: rgba(255,255,255,0.45);
  font-size: 13.5px;
  font-weight: 450;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav-item:hover  { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.75); }
.nav-item.active { background: rgba(255,255,255,0.08); color: white; }

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.45);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 100px;
}
.nav-badge.alert { background: rgba(239,68,68,0.25); color: #FCA5A5; }

.sidebar-user {
  margin-top: auto;
  padding: 14px 14px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #7C5CFC);
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-org {
  font-size: 10.5px;
  color: rgba(255,255,255,0.3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.sidebar-logout:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); }

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---- Top Bar ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 4px;
}

.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -6px 4px -6px -10px;
  border-radius: 12px;
  color: var(--text-1);
  flex-shrink: 0;
  transition: background 0.15s;
}
.mobile-nav-toggle:hover { background: rgba(0,0,0,0.06); }
.mobile-nav-toggle:active { background: rgba(0,0,0,0.08); }

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-1);
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 13px;
  width: 240px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.08);
}

.search-bar input {
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text-1);
  background: transparent;
  width: 100%;
}
.search-bar input::placeholder { color: var(--text-3); }

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: white;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.15s;
}
.topbar-icon-btn:hover { background: #F9FAFB; }

.alert-dot {
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
  position: absolute;
  top: 7px;
  right: 7px;
  border: 1.5px solid var(--bg);
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #7C5CFC);
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ============================================================
   PAGES
   ============================================================ */
.page {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 28px 48px;
}
.page.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

.page-heading {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--text-1);
  margin-bottom: 4px;
}

.page-subheading {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.filter-strip {
  display: flex;
  gap: 6px;
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-grid.three-col { grid-template-columns: repeat(3, 1fr); }

.kpi-card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.kpi-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.kpi-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-blue  { background: var(--accent-light); color: var(--accent); }
.kpi-green { background: var(--green-bg);     color: var(--green); }
.kpi-amber { background: var(--amber-bg);     color: var(--amber); }
.kpi-red   { background: var(--red-bg);       color: var(--red); }

.kpi-body { flex: 1; }

.kpi-value {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 11.5px;
  color: var(--text-2);
  margin-bottom: 6px;
}

.kpi-delta { font-size: 11.5px; font-weight: 500; }
.kpi-delta.positive { color: var(--green); }
.kpi-delta.negative { color: var(--red); }
.kpi-delta.warning  { color: var(--amber); }

/* ============================================================
   CARD COMPONENT
   ============================================================ */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.15px;
  color: var(--text-1);
  margin-bottom: 2px;
}

.card-sub {
  font-size: 11.5px;
  color: var(--text-3);
}

.card-link {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.card-link:hover { opacity: 0.8; }

.card-actions { display: flex; gap: 6px; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dash-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 14px;
}

/* ---- Spend Chart ---- */
/* ---- Spend Donut Chart ---- */
.spend-donut-wrap { padding: 12px 20px 20px; }
.spend-donut-inner {
  display: flex;
  align-items: center;
  gap: 24px;
}
.donut-svg-wrap { flex-shrink: 0; }

/* Center labels */
.donut-center-total {
  font-size: 15px;
  font-weight: 700;
  fill: var(--text-1);
}
.donut-center-label {
  font-size: 10px;
  fill: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.donut-center-hover-val {
  font-size: 14px;
  font-weight: 700;
  fill: var(--text-1);
}
.donut-center-hover-name {
  font-size: 10px;
  fill: var(--text-2);
}
.donut-center-hover-pct {
  font-size: 10px;
  fill: var(--text-3);
}

/* Legend */
.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.donut-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  border-radius: 6px;
  padding: 3px 4px;
  transition: background .12s;
}
.donut-legend-row:hover { background: var(--bg); }
.donut-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.donut-leg-name {
  flex: 1;
  color: var(--text-1);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.donut-leg-pct {
  color: var(--text-3);
  font-size: 11px;
  flex-shrink: 0;
}
.donut-leg-val {
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 40px;
  text-align: right;
}
.donut-empty {
  padding: 24px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 560px) {
  .spend-donut-inner { flex-direction: column; }
  .donut-legend { width: 100%; }
}

/* ---- Renewal List ---- */
.renewal-list { padding: 4px 0; }

.renewal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  cursor: pointer;
  transition: background 0.1s;
}
.renewal-item:hover { background: #FAFAF8; }

.renewal-info { flex: 1; }

.renewal-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 1px;
}

.renewal-date {
  font-size: 11.5px;
  color: var(--text-3);
}

.renewal-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.renewal-cost {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
}

/* ---- Health Grid ---- */
.health-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px 22px 22px;
}

.health-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #FAFAFA;
  transition: box-shadow .15s, border-color .15s;
}
.health-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: rgba(0,0,0,0.10);
  background: #fff;
}

.health-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.health-vendor {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.health-vendor-info { min-width: 0; }
.health-vendor-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.health-vendor-cat {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-score-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.health-score-num {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.health-trend {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.health-trend.trend-up   { color: #10B981; }
.health-trend.trend-mid  { color: #F59E0B; }
.health-trend.trend-down { color: #EF4444; }

.bar-track {
  height: 4px;
  background: #EDEEF0;
  border-radius: 100px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.health-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.health-trend-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.health-trend-label.trend-up   { color: #10B981; }
.health-trend-label.trend-mid  { color: #F59E0B; }
.health-trend-label.trend-down { color: #EF4444; }
.health-renewal {
  font-size: 10px;
  color: var(--text-3);
}

/* ============================================================
   VENDOR GRID
   ============================================================ */
.vendor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.vendor-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 22px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  color: var(--text-2);
}

.vendor-empty-icon {
  color: var(--text-3);
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
}

.vendor-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
}

.vendor-empty-desc {
  font-size: 13px;
  line-height: 1.55;
  max-width: 380px;
  margin: 0 auto 16px;
}

.vendor-empty-retry {
  margin-top: 4px;
}

.vendor-card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.vendor-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
  border-color: rgba(67,97,238,0.15);
}

.vc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.vc-id {
  display: flex;
  align-items: center;
  gap: 11px;
}

.vc-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-1);
  margin-bottom: 2px;
}

.vc-category {
  font-size: 11.5px;
  color: var(--text-3);
}

.vc-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 14px 0;
}

.vc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 3px;
}

.stat-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}

.vc-footer {
  margin-top: 14px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.score-label {
  font-size: 10.5px;
  color: var(--text-3);
}

.score-num {
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   VENDOR AVATAR
   ============================================================ */
.v-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.v-avatar.xs {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 9px;
}
.v-avatar.lg {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 15px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-success      { background: var(--green-bg);      color: #065F46; }
.badge-warn         { background: #FFFBEB;               color: #92400E; }
.badge-danger       { background: var(--red-bg);         color: #991B1B; }
.badge-danger-soft  { background: #FEE2E2;               color: #B91C1C; }
.badge-neutral      { background: #F3F4F6;               color: #6B7280; }

/* ============================================================
   BACK BUTTON
   ============================================================ */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 20px;
  transition: color 0.15s;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}
.back-btn:hover { color: var(--text-1); }

/* ============================================================
   VENDOR DETAIL
   ============================================================ */
.detail-hero {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 26px;
  margin-bottom: 18px;
}

.detail-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.detail-hero-id {
  display: flex;
  align-items: center;
  gap: 16px;
}

.detail-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.4px;
  margin-bottom: 3px;
}

.detail-category {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 10px;
}

.detail-badges { display: flex; gap: 7px; }

.detail-hero-actions { display: flex; gap: 8px; flex-shrink: 0; }

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}

.d-stat {
  background: #FAFAF8;
  padding: 16px 20px;
}

.d-stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 5px;
}

.d-stat-value {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text-1);
}

/* ---- Health score modal & clickable stat ---- */
.d-stat--clickable {
  cursor: pointer;
  transition: background .15s;
}
.d-stat--clickable:hover {
  background: #EEF3FF !important;
}
.d-stat--clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.d-stat-hint {
  font-size: 10px;
  color: var(--accent);
  font-weight: 700;
  margin-left: 3px;
  opacity: 0.85;
}
.d-stat-value--interactive {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.health-score-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 41, 0.48);
  backdrop-filter: blur(4px);
  z-index: 8500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.health-score-modal-overlay.visible {
  opacity: 1;
}

.health-score-modal {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: min(85vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  transform: translateY(12px);
  transition: transform 0.25s ease;
}
.health-score-modal-overlay.visible .health-score-modal {
  transform: translateY(0);
}

.health-score-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px 20px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-soft);
}
.health-score-modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.35;
  padding-right: 8px;
}
.health-score-modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.health-score-modal-close:hover {
  background: var(--bg);
  color: var(--text-1);
}

.health-score-modal-body {
  padding: 0 20px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-health-lead {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2);
  margin: 16px 0 14px;
}
.modal-health-lead strong {
  color: var(--text-1);
  font-weight: 600;
}

.health-score-modal-ver {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.03em;
  margin-top: 14px;
  text-align: right;
}

.health-factor-table {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #fafafa;
}
.health-factor-header {
  display: grid;
  grid-template-columns: 1fr 52px 52px;
  gap: 8px;
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  background: #f3f4f6;
  border-bottom: 1px solid var(--border-soft);
}
.health-factor-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--card);
}
.health-factor-row:last-child {
  border-bottom: none;
}
.health-factor-grid {
  display: grid;
  grid-template-columns: 1fr 52px 52px;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 6px;
}
.health-factor-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}
.health-factor-delta {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-align: right;
}
.health-factor-run {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  text-align: right;
}
.health-factor-detail {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
  margin: 0;
}
.health-factor-detail strong {
  color: var(--text-1);
  font-weight: 600;
}
.health-score-clamp {
  font-size: 12px;
  color: var(--text-2);
  margin: 12px 0 0;
  padding: 10px 12px;
  background: #fffbeb;
  border-radius: var(--r-sm);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* ---- Tabs ---- */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  background: var(--card);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 0 22px;
  overflow: hidden;
}

.tab-btn {
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  cursor: pointer;
}
.tab-btn:hover { color: var(--text-1); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel {
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-xs);
}
.tab-panel.active { display: block; }

/* ---- Detail Content Grid ---- */
.detail-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.detail-section { display: flex; flex-direction: column; gap: 20px; }

.detail-field {}

.field-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 4px;
}

.field-value {
  font-size: 13.5px;
  color: var(--text-1);
  line-height: 1.55;
}

.field-value.muted { color: var(--text-2); }
.field-value.large { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }

.contact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #FAFAF8;
  border-radius: var(--r-md);
  border: 1px solid var(--border-soft);
}

.contact-info {}
.contact-name { font-size: 13.5px; font-weight: 500; margin-bottom: 2px; }
.contact-title { font-size: 12px; color: var(--text-2); margin-bottom: 3px; }
.contact-email { font-size: 11.5px; color: var(--accent); }

.upload-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #FAFAF8;
  border-radius: var(--r-md);
  border: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-3);
}

.contract-upload-prompt { align-items: flex-start; flex-wrap: wrap; }
.contract-upload-main { flex: 1; min-width: 0; }
.contract-file-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  width: 100%;
}
.contract-open-pdf { flex-shrink: 0; text-decoration: none; display: inline-flex; align-items: center; }
.contract-filename {
  font-size: 12px;
  color: var(--text-2);
  flex: 1;
  min-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-link-subtle {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.btn-link-subtle:hover { color: var(--text-1); text-decoration: underline; }
.btn-link-accent {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.btn-link-accent:hover { text-decoration: underline; }
.contract-upload-label-text { color: var(--text-3); }
.contract-upload-status { margin-top: 6px; line-height: 1.4; }

/* ============================================================
   DATA TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  background: #FAFAF8;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

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

.table-row { cursor: pointer; transition: background 0.1s; }
.table-row:hover { background: #FAFAF8; }

.t-vendor {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.t-mono { font-variant-numeric: tabular-nums; font-weight: 500; }
.t-muted  { color: var(--text-2); }
.t-danger { color: var(--red); }
.t-success{ color: var(--green); }
.t-neutral{ color: var(--text-2); }
.t-rec    { color: var(--text-2); font-size: 12.5px; max-width: 230px; }

.cat-tag {
  display: inline-block;
  padding: 3px 9px;
  background: #F3F4F6;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

/* ============================================================
   INSIGHTS
   ============================================================ */
.insights-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.insight-card { padding: 22px; }

.insight-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.insight-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 6px;
}

.insight-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-1);
  margin-bottom: 8px;
}

.insight-text {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
  margin-bottom: 16px;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

/* ============================================================
   COMMUNITY — LAYOUT
   ============================================================ */

.community-layout {
  display: grid;
  grid-template-columns: 1fr 284px;
  gap: 20px;
  align-items: start;
}

.community-main { min-width: 0; }

.community-aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
}

/* Feed Controls */
.feed-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
}

.sort-pills, .type-pills { display: flex; gap: 5px; }

/* ============================================================
   COMMUNITY — POST CARDS (feed)
   ============================================================ */

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

.post-card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  display: flex;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
}
.post-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  border-color: rgba(67,97,238,0.18);
}
.post-card.pinned { border-top: 2.5px solid var(--accent); }

/* Vote Column */
.vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 16px 10px;
  background: #FAFAF8;
  border-right: 1px solid var(--border-soft);
  min-width: 50px;
  flex-shrink: 0;
}

.vote-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.vote-btn:hover  { background: #EDEDEB; color: var(--text-2); }
.vote-btn.voted-up   { color: var(--accent); }
.vote-btn.voted-down { color: var(--red); }

.vote-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1;
  text-align: center;
  min-width: 24px;
}

/* Post Content */
.post-content {
  flex: 1;
  padding: 15px 18px;
  min-width: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.post-category { font-size: 11.5px; font-weight: 600; }

.post-type-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 100px;
  background: #F3F4F6;
  color: var(--text-3);
}

.post-dot  { color: var(--text-3); font-size: 10px; }
.post-time { font-size: 11.5px; color: var(--text-3); }

.pinned-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent-light);
  padding: 2px 7px;
  border-radius: 100px;
}

.post-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.15px;
  color: var(--text-1);
  line-height: 1.45;
  margin-bottom: 8px;
}

.post-body-preview {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Poll Preview (in card) */
.poll-preview {
  background: #FAFAF8;
  border-radius: var(--r-md);
  border: 1px solid var(--border-soft);
  padding: 11px 14px;
  margin-bottom: 10px;
}

.poll-preview-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  padding: 2.5px 0;
}

.poll-preview-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}

.poll-preview-meta {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 6px;
}

/* Post Footer */
.post-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.post-author-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-3);
  margin-right: 6px;
}

.post-author-name { font-weight: 500; color: var(--text-2); }

.post-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  padding: 4px 9px;
  border-radius: 7px;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.post-action-btn:hover { background: #F1F2F4; color: var(--text-2); }

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.post-tag {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: 100px;
}

/* ============================================================
   COMMUNITY — ASIDE CARDS
   ============================================================ */

.c-aside-card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 16px 18px;
}

.c-aside-header {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 11px;
}

.c-aside-text {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
  margin-bottom: 14px;
}

.c-community-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
}

.c-stat { text-align: center; }
.c-stat-value { font-size: 15px; font-weight: 600; letter-spacing: -0.3px; color: var(--text-1); }
.c-stat-label { font-size: 10px; color: var(--text-3); margin-top: 2px; }

.c-rules-list {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-2);
  padding-left: 17px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.c-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.c-tag {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.12s;
}
.c-tag:hover { background: #D9E0FF; }

/* ============================================================
   COMMUNITY — POST DETAIL
   ============================================================ */

.post-detail-card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  margin-bottom: 16px;
}

.post-detail-inner-layout {
  display: flex;
  overflow: hidden;
}

.post-detail-body {
  flex: 1;
  padding: 22px;
  min-width: 0;
}

.post-detail-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.35px;
  line-height: 1.4;
  color: var(--text-1);
  margin-bottom: 14px;
}

.post-detail-text {
  font-size: 13.5px;
  line-height: 1.78;
  color: var(--text-2);
  white-space: pre-line;
  margin-bottom: 16px;
}

/* Poll Widget */
.poll-widget {
  background: #FAFAF8;
  border-radius: var(--r-md);
  border: 1px solid var(--border-soft);
  padding: 16px;
  margin-bottom: 16px;
}

.poll-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-1);
  cursor: pointer;
  text-align: left;
  margin-bottom: 8px;
  transition: border-color 0.15s, background 0.15s;
  font-family: var(--font);
}
.poll-option-btn:last-of-type { margin-bottom: 0; }
.poll-option-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.poll-option-btn.selected { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

.poll-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.poll-option-btn.selected .poll-radio {
  border-color: var(--accent);
  background: var(--accent);
}
.poll-option-btn.selected .poll-radio::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}

.poll-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.poll-peek-btn {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
}
.poll-peek-btn:hover { opacity: 0.8; }

/* Poll Results */
.poll-result-row { margin-bottom: 12px; }
.poll-result-row:last-of-type { margin-bottom: 0; }

.poll-result-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 5px;
}
.poll-result-top.my-vote { color: var(--accent); }

.poll-result-pct { font-size: 12.5px; font-weight: 600; color: var(--text-2); }

.poll-result-bar-track {
  height: 7px;
  background: #ECEDEF;
  border-radius: 100px;
  overflow: hidden;
}

.poll-result-bar {
  height: 100%;
  border-radius: 100px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.poll-result-bar.leading { background: var(--accent); }
.poll-result-bar.other   { background: #CBD5E1; }
.poll-result-bar.my-vote { background: var(--accent); }

.poll-result-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--text-3);
}

/* ============================================================
   COMMUNITY — COMMENTS
   ============================================================ */

.comment-section {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.comment-section-header {
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
}

/* New comment form */
.new-comment-form {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.new-comment-input {
  flex: 1;
}

.new-comment-input textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text-1);
  background: white;
  resize: none;
  min-height: 76px;
  outline: none;
  line-height: 1.6;
  transition: border-color 0.15s;
}
.new-comment-input textarea:focus { border-color: var(--accent); }
.new-comment-input textarea::placeholder { color: var(--text-3); }

.new-comment-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Comment */
.comments-list { padding: 4px 0; }

.comment {
  display: flex;
  gap: 11px;
  padding: 14px 22px;
}

.comment-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.c-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: white;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.c-thread-line {
  width: 2px;
  flex: 1;
  background: #ECEDEF;
  margin: 6px auto 0;
  border-radius: 1px;
  min-height: 16px;
}

.comment-body { flex: 1; min-width: 0; }

.comment-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.c-name  { font-size: 12.5px; font-weight: 600; color: var(--text-1); }
.c-org   { font-size: 11.5px; color: var(--text-3); }
.c-dot   { color: var(--text-3); font-size: 9px; }
.c-time  { font-size: 11.5px; color: var(--text-3); }

.comment-text {
  font-size: 13.5px;
  line-height: 1.68;
  color: var(--text-2);
  margin-bottom: 8px;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.c-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  padding: 3px 8px;
  border-radius: 6px;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-family: var(--font);
}
.c-action:hover { background: #F1F2F4; color: var(--text-2); }
.c-action.voted { color: var(--accent); }

/* Reply thread (indented) */
.reply-thread {
  margin-left: 0;
  margin-top: 6px;
  border-left: 2px solid #ECEDEF;
  padding-left: 14px;
}

/* Inline reply form */
.inline-reply-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reply-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-1);
  background: white;
  resize: none;
  min-height: 68px;
  outline: none;
  line-height: 1.6;
  transition: border-color 0.15s;
}
.reply-textarea:focus { border-color: var(--accent); }
.reply-textarea::placeholder { color: var(--text-3); }

.reply-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.no-comments-msg {
  padding: 32px 22px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

/* ============================================================
   COMMUNITY — MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,20,37,0.45);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

.modal-box {
  background: white;
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1), 0 20px 64px rgba(0,0,0,0.12);
  overflow: hidden;
  animation: fadeUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 0;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-1);
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #F3F4F6;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background 0.12s;
  font-family: var(--font);
}
.modal-close:hover { background: #E5E7EB; }

.modal-tab-bar {
  display: flex;
  padding: 12px 22px 0;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}

.modal-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font);
}
.modal-tab:hover  { color: var(--text-1); }
.modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.modal-body { display: none; padding: 18px 22px 0; }
.modal-body.active { display: block; }

.modal-body .form-group { margin-bottom: 15px; }

.modal-body .form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 6px;
}

.modal-body .form-group input[type="text"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #E5E7EB;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text-1);
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-body .form-group input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}

.modal-body textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #E5E7EB;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text-1);
  background: white;
  resize: vertical;
  min-height: 110px;
  outline: none;
  line-height: 1.6;
  transition: border-color 0.15s;
}
.modal-body textarea:focus { border-color: var(--accent); }
.modal-body textarea::placeholder { color: var(--text-3); }

.form-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #E5E7EB;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text-1);
  background: white;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-select:focus { border-color: var(--accent); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px;
  border-top: 1px solid var(--border-soft);
  margin-top: 16px;
}

/* Poll builder */
.poll-options-builder {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.poll-opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.poll-opt-input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #E5E7EB;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text-1);
  outline: none;
  transition: border-color 0.15s;
}
.poll-opt-input:focus { border-color: var(--accent); }
.poll-opt-input::placeholder { color: var(--text-3); }

.poll-opt-remove {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #FEE2E2;
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.12s;
}
.poll-opt-remove:hover { background: #FECACA; }


/* ============================================================
   COMMUNITY — SEARCH BAR
   ============================================================ */

.community-search-wrap {
  margin-bottom: 14px;
}

.community-search-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.community-search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}

.community-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text-1);
  background: transparent;
}
.community-search-bar input::placeholder { color: var(--text-3); }

.search-clear-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #F1F2F4;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.search-clear-btn:hover { background: #E5E7EB; color: var(--text-2); }

.search-results-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
}

.search-highlight {
  background: #FFF3B0;
  border-radius: 2px;
  padding: 0 1px;
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */

.settings-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  align-items: start;
}

/* Settings Left Nav */
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 8px;
  position: sticky;
  top: 0;
}

.settings-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.12s, color 0.12s;
}
.settings-nav-item:hover  { background: #F3F4F6; color: var(--text-1); }
.settings-nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

/* Settings Tab Panels */
.settings-tab { display: none; }
.settings-tab.active { display: block; }

/* Settings Card */
.settings-section-card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.settings-section-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.15px;
  color: var(--text-1);
  margin-bottom: 3px;
}

.settings-section-sub {
  font-size: 12.5px;
  color: var(--text-3);
}

.settings-rows { padding: 4px 0; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
}

.settings-row-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-row-info { flex: 1; }

.settings-row-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-row-sub {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 520px;
}

.settings-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 7px;
  border-radius: 100px;
}

.settings-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 0 24px;
}

.settings-avatar-preview {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #7C5CFC);
  color: white;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Toggle Switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.toggle-switch {
  width: 42px;
  height: 24px;
  background: #D1D5DB;
  border-radius: 100px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
  user-select: none;
}
.toggle-switch.on  { background: var(--accent); }
.toggle-switch::after {
  content: '';
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.toggle-switch.on::after { transform: translateX(18px); }

.toggle-state-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  min-width: 22px;
}

/* Anonymous preview card */
.anon-preview-card {
  margin: 0 24px 4px;
  padding: 14px 16px;
  background: #FAFAF8;
  border-radius: var(--r-md);
  border: 1px solid var(--border-soft);
}

.anon-preview-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}


/* ============================================================
   ADD VENDOR FORM PAGE
   ============================================================ */

/* Page Header */
.av-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.av-header-title { flex: 1; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: white;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.back-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-xs);
}

/* Stepper */
.form-stepper {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 20px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  cursor: pointer;
}

.step-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #F3F4F6;
  border: 2px solid #E5E7EB;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  letter-spacing: -0.3px;
}

.step-circle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 0 3px rgba(67,97,238,0.15);
}

.step-circle.done {
  background: var(--green);
  border-color: var(--green);
  color: white;
  font-size: 13px;
}

.step-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  transition: color 0.2s;
}

.step-label.active {
  color: var(--accent);
  font-weight: 600;
}

.step-label.done {
  color: var(--green);
}

.step-connector {
  flex: 1;
  min-width: 16px;
  height: 2px;
  background: #E5E7EB;
  margin: 0 8px;
  border-radius: 2px;
  transition: background 0.3s;
  flex-shrink: 0;
}

.step-connector.done {
  background: var(--green);
}

/* Form Body */
.form-body {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  margin-bottom: 14px;
}

.form-section {
  display: none;
}

.form-section.active {
  display: block;
}

.form-section-header {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: #FAFAF9;
}

.form-step-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(67,97,238,0.08);
  padding: 3px 8px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.form-section-title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-1);
  margin-bottom: 3px;
}

.form-section-sub {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.5;
}

.form-fields {
  padding: 24px 28px 28px;
}

/* Subsection labels */
.form-subsection-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 12px;
  margin-top: 22px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.form-subsection-label:first-child {
  margin-top: 0;
}

/* Form Grids */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 22px;
  margin-bottom: 4px;
}

.form-grid-1col {
  grid-template-columns: 1fr;
}

.form-grid-3col {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-grid-2col-inline {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.form-field {
  display: flex;
  flex-direction: column;
}

/* Field Labels */
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 5px;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.field-required {
  color: #EF4444;
  margin-left: 2px;
  font-weight: 700;
}

.field-auto-tag {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  background: #F3F4F6;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
  letter-spacing: 0;
}

.field-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.5;
}

/* Field Inputs */
.field-input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid #E2E4E9;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-1);
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.09);
}

.field-input::placeholder { color: #BBC1CF; }

input[type="date"].field-input {
  cursor: pointer;
}

.field-textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #E2E4E9;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-1);
  background: white;
  resize: vertical;
  min-height: 80px;
  outline: none;
  line-height: 1.6;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.field-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.09);
}

.field-textarea::placeholder { color: #BBC1CF; }

/* Radio Pill Groups */
.radio-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.radio-pill {
  padding: 6px 14px;
  border: 1.5px solid #E2E4E9;
  border-radius: 20px;
  background: white;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.radio-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.radio-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Document Upload Zone */
.upload-drop-zone {
  border: 2px dashed #D1D5DB;
  border-radius: var(--r-md);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-top: 12px;
}

.upload-drop-zone:hover {
  border-color: var(--accent);
  background: rgba(67,97,238,0.03);
}

.upload-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.upload-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
}

.upload-sub {
  font-size: 12px;
  color: var(--text-3);
}

/* Form Complete Banner */
.form-complete-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(16,185,129,0.06);
  border: 1.5px solid rgba(16,185,129,0.2);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-top: 24px;
}

.form-complete-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.form-complete-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 3px;
}

.form-complete-sub {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
}

/* Form Footer */
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 20px;
  box-shadow: var(--shadow-xs);
}

.form-footer-meta {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
}

.form-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}


/* ============================================================
   SETTINGS — USERS TAB
   ============================================================ */

.settings-nav-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 8px 0;
}

.settings-nav-item--admin {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
}

.settings-nav-item--admin.active {
  color: var(--accent);
}

.settings-nav-admin-badge {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(67,97,238,0.1);
  color: var(--accent);
}

/* Users toolbar */
.users-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 16px;
  flex-wrap: wrap;
}

.users-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
  height: 34px;
  background: #F9FAFB;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 12px;
}

.users-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-1);
  outline: none;
}

.users-search-input::placeholder { color: var(--text-3); }

.users-filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Users table */
.users-table-wrap {
  padding: 0 24px 8px;
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.users-table thead tr {
  border-bottom: 1px solid var(--border-soft);
}

.users-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 8px 12px 10px;
}

.users-table td {
  padding: 11px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-1);
}

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

.users-table tbody tr:hover td {
  background: #FAFAF9;
}

/* User cell */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.2;
}

.user-email {
  font-size: 11.5px;
  color: var(--text-3);
}

/* Role badges */
.role-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.role-admin  { background: rgba(67,97,238,0.1);  color: #4361EE; }
.role-member { background: rgba(16,185,129,0.1); color: #059669; }
.role-viewer { background: rgba(156,163,175,0.15); color: #6B7280; }

/* Status badges */
.user-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
}

.user-status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-status-badge.active::before  { background: var(--green); }
.user-status-badge.pending::before { background: #F59E0B; }
.user-status-badge.inactive::before { background: #D1D5DB; }

.user-status-badge.active  { color: var(--green); }
.user-status-badge.pending { color: #B45309; }
.user-status-badge.inactive { color: var(--text-3); }

/* Row actions */
.users-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.15s;
}

.users-table tbody tr:hover .users-row-actions {
  opacity: 1;
}

.user-action-btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: white;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.user-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.user-action-btn.danger:hover {
  border-color: rgba(239,68,68,0.4);
  color: var(--red);
}

/* Roles reference grid */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 0 24px 24px;
}

.role-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  background: #FAFAF9;
}

.role-card-header {
  margin-bottom: 12px;
}

.role-perms {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.role-perms li {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.4;
  padding-left: 16px;
  position: relative;
}

.role-perms li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--text-3);
  font-weight: 700;
}

/* Invite modal overrides */
#invite-modal .modal-box {
  padding: 0;
}

#invite-modal .modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#invite-modal .modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 2px;
}

#invite-modal .modal-sub {
  font-size: 12.5px;
  color: var(--text-3);
}


/* ============================================================
   OPSIS SIGNALS PANEL
   ============================================================ */

.signals-panel {
  margin-top: 18px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

/* Header */
.signals-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: #FAFAF9;
}

.signals-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.15px;
  margin-bottom: 3px;
}

.signals-logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.signals-alert-count {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  color: #DC2626;
  background: rgba(239,68,68,0.09);
  border: 1px solid rgba(239,68,68,0.18);
  border-radius: 20px;
  padding: 2px 8px;
  letter-spacing: 0.01em;
}

.signals-count-neutral {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-3);
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  padding: 2px 8px;
}

.signals-sub {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.4;
  padding-left: 30px;
}

.signals-data-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  padding: 4px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Signal cards */
.signals-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Signal Card ─────────────────────────────────────────── */
.sc-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
  transition: background 0.12s;
}
.sc-card:last-child { border-bottom: none; }
.sc-card:hover { background: #FAFBFC; }

.sc-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
}
.sc-card--alert::before   { background: #EF4444; }
.sc-card--caution::before { background: #F59E0B; }
.sc-card--positive::before { background: #10B981; }
.sc-card--info::before    { background: var(--accent); }

/* Card header row */
.sc-card-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
}

.sc-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sig-icon-alert    { background: rgba(239,68,68,0.1);   color: #DC2626; }
.sig-icon-caution  { background: rgba(245,158,11,0.1);  color: #B45309; }
.sig-icon-positive { background: rgba(16,185,129,0.1);  color: #059669; }
.sig-icon-info     { background: rgba(67,97,238,0.1);   color: #4361EE; }

.sc-header-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.sc-type {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sc-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.sig-badge-alert    { background: rgba(239,68,68,0.1);   color: #DC2626; }
.sig-badge-caution  { background: rgba(245,158,11,0.1);  color: #92400E; }
.sig-badge-positive { background: rgba(16,185,129,0.1);  color: #047857; }
.sig-badge-info     { background: rgba(67,97,238,0.1);   color: #4361EE; }

.sc-confidence {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Insight text */
.sc-insight {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 10px 0;
}

/* Impact row */
.sc-impact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 11.5px;
}
.sc-impact--savings  { background: rgba(5,150,105,0.07);  border: 1px solid rgba(5,150,105,0.14); }
.sc-impact--risk     { background: rgba(239,68,68,0.07);  border: 1px solid rgba(239,68,68,0.14); }
.sc-impact--positive { background: rgba(5,150,105,0.07);  border: 1px solid rgba(5,150,105,0.14); }

.sc-impact-icon {
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.sc-impact--savings .sc-impact-icon,
.sc-impact--positive .sc-impact-icon { color: #059669; }
.sc-impact--risk .sc-impact-icon     { color: #DC2626; }

.sc-impact-label {
  font-weight: 500;
  color: var(--text-2);
  flex: 1;
}

.sc-impact-value {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.sc-impact--savings .sc-impact-value,
.sc-impact--positive .sc-impact-value { color: #047857; }
.sc-impact--risk .sc-impact-value     { color: #DC2626; }

/* Recommendation block */
.sc-rec {
  border-radius: 8px;
  padding: 10px 13px;
  border-left: 2.5px solid transparent;
}
.sc-rec--alert    { background: rgba(239,68,68,0.04);  border-color: rgba(239,68,68,0.25); }
.sc-rec--caution  { background: rgba(245,158,11,0.04); border-color: rgba(245,158,11,0.25); }
.sc-rec--positive { background: rgba(16,185,129,0.04); border-color: rgba(16,185,129,0.25); }
.sc-rec--info     { background: rgba(67,97,238,0.04);  border-color: rgba(67,97,238,0.25); }

.sc-rec-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.sc-card--alert    .sc-rec-label { color: #B91C1C; }
.sc-card--caution  .sc-rec-label { color: #92400E; }
.sc-card--positive .sc-rec-label { color: #047857; }
.sc-card--info     .sc-rec-label { color: var(--accent); }

.sc-rec-text {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.58;
}

/* Alternative vendor tags */
.sc-rec-alts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.sc-rec-alts-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}

.sc-alt-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: rgba(67,97,238,0.06);
  border: 1px solid rgba(67,97,238,0.15);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
}


/* ============================================================
   RUN SCENARIO PANEL
   ============================================================ */

/* Header button group */
.header-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Overlay */
.scenario-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  pointer-events: none;
  visibility: hidden;
}

.scenario-overlay.active {
  pointer-events: auto;
  visibility: visible;
}

.scenario-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(13, 20, 37, 0.4);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.scenario-overlay.active::before {
  opacity: 1;
}

/* Panel */
.scenario-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 468px;
  max-width: 100vw;
  background: white;
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 60px rgba(0, 0, 0, 0.14);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 1px solid var(--border);
}

.scenario-panel.open {
  transform: translateX(0);
}

/* Header */
.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: #FAFAF9;
  flex-shrink: 0;
}

.sp-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sp-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sp-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.2px;
  margin-bottom: 2px;
}

.sp-sub {
  font-size: 11.5px;
  color: var(--text-3);
}

.sp-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  transition: all 0.15s;
  flex-shrink: 0;
}

.sp-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Views */
.sp-view {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sp-view.active {
  display: flex;
}

/* Scrollable content */
.sp-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

/* Footer */
.sp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: white;
  flex-shrink: 0;
  gap: 10px;
}

/* Form sections */
.sp-form-section {
  padding: 20px 20px 0;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 20px;
}

.sp-form-section--last {
  border-bottom: none;
  padding-bottom: 28px;
}

.sp-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sp-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sp-prefilled-tag {
  font-size: 10px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--green);
  background: rgba(16,185,129,0.1);
  padding: 1px 6px;
  border-radius: 10px;
}

.sp-opt-tag {
  font-size: 10.5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-3);
}

/* ── Results ── */

.sp-results-wrap {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Estimate card */
.sp-estimate-card {
  background: #FAFAF9;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.sp-estimate-meta {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sp-estimate-meta-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-1);
}

.sp-estimate-meta-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  padding: 2px 8px;
  border-radius: 20px;
}

.sp-estimate-rows {
  padding: 4px 0;
}

.sp-estimate-row {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-soft);
  gap: 10px;
}

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

.sp-estimate-row-label {
  font-size: 12px;
  color: var(--text-3);
  flex: 1;
  min-width: 0;
}

.sp-estimate-range {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.3px;
  text-align: right;
  white-space: nowrap;
}

.sp-estimate-range--secondary {
  font-size: 14px;
  color: var(--text-1);
}

.sp-estimate-range--total {
  font-size: 13.5px;
  color: var(--text-2);
}

.sp-estimate-unit {
  font-size: 10.5px;
  color: var(--text-3);
  text-align: right;
  white-space: nowrap;
  min-width: 48px;
}

/* Confidence bar */
.sp-confidence {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border-soft);
}

.sp-conf-bars {
  display: flex;
  gap: 3px;
}

.sp-conf-bar {
  width: 16px;
  height: 5px;
  border-radius: 3px;
  background: #E5E7EB;
  transition: background 0.2s;
}

.sp-conf-bar.active {
  background: currentColor;
}

.sp-confidence-label {
  font-size: 11.5px;
  font-weight: 600;
}

.sp-confidence-note {
  font-size: 11px;
  color: var(--text-3);
}

/* Section blocks */
.sp-block {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.sp-block-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  padding: 11px 16px 10px;
  border-bottom: 1px solid var(--border-soft);
  background: #FAFAF9;
}

.sp-drivers-list {
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

.sp-driver-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 12.5px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border-soft);
  line-height: 1.4;
}

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

.sp-driver-item::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}

.sp-driver-rank {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(67,97,238,0.1);
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Opsis Take */
.sp-opsis-take {
  background: rgba(67,97,238,0.04);
  border: 1.5px solid rgba(67,97,238,0.14);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.sp-take-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px 10px;
  border-bottom: 1px solid rgba(67,97,238,0.1);
}

.sp-take-logomark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sp-take-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
}

.sp-take-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sp-take-body p {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.65;
  margin: 0;
}

/* Disclaimer */
.sp-disclaimer {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.55;
  padding: 0 2px 4px;
  border-top: none;
}

/* ============================================================
   TOPBAR — GLOBAL SEARCH DROPDOWN
   ============================================================ */
.search-bar { position: relative; }

.topbar-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 340px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 900;
  overflow: hidden;
}
.tsearch-empty {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-3);
}
.tsearch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}
.tsearch-item:hover { background: var(--bg); }
.tsearch-abbrev {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tsearch-info { flex: 1; min-width: 0; }
.tsearch-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tsearch-cat { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.tsearch-status {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.tsearch-status--active   { background: var(--green-bg); color: var(--green); }
.tsearch-status--inactive { background: var(--bg); color: var(--text-3); }
.tsearch-status--atrisk,
.tsearch-status--at_risk  { background: var(--amber-bg); color: var(--amber); }

/* ============================================================
   TOPBAR — NOTIFICATION PANEL
   ============================================================ */
.topbar-icon-btn { position: relative; }

.topbar-notif-panel {
  position: absolute;
  top: calc(var(--topbar-h) - 8px);
  right: 52px;
  width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  z-index: 900;
  overflow: hidden;
}
.tnp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  border-bottom: 1px solid var(--border-soft);
}
.tnp-count {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--red-bg);
  color: var(--red);
  border-radius: 99px;
}
.tnp-loading {
  padding: 20px 16px;
  font-size: 13px;
  color: var(--text-3);
}
.tnp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  color: var(--text-3);
  font-size: 13px;
}
.tnp-list { max-height: 340px; overflow-y: auto; }
.tnp-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  align-items: flex-start;
}
.tnp-item:last-child { border-bottom: none; }
.tnp-sev {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
}
.tnp-sev--high   { background: var(--red-bg);   color: var(--red); }
.tnp-sev--medium { background: var(--amber-bg);  color: var(--amber); }
.tnp-sev--low    { background: var(--green-bg);  color: var(--green); }
.tnp-body { flex: 1; min-width: 0; }
.tnp-type {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-1);
  text-transform: capitalize;
}
.tnp-insight {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  margin-top: 2px;
}
.tnp-footer {
  display: block;
  width: 100%;
  padding: 11px 16px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  background: var(--bg);
  border: none;
  border-top: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.12s;
}
.tnp-footer:hover { background: var(--accent-light); }

/* ============================================================
   AI CHAT DRAWER
   ============================================================ */

/* Floating action button — bottom right */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 0 16px;
  height: 48px;
  background: var(--accent);
  color: white;
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(67,97,238,0.45), 0 1px 4px rgba(0,0,0,0.15);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  border: none;
  white-space: nowrap;
}
.chat-fab:hover {
  background: #3451d1;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(67,97,238,0.5), 0 2px 6px rgba(0,0,0,0.15);
}
.chat-fab:active { transform: translateY(0); }
.chat-fab-icon { flex-shrink: 0; }
.chat-fab-badge {
  background: var(--red);
  color: white;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  margin-left: 2px;
}

/* Overlay */
.chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 20, 37, 0.35);
  z-index: 999;
  backdrop-filter: blur(2px);
}
.chat-overlay.visible { display: block; }

/* Drawer */
.chat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  background: var(--card);
  box-shadow: -4px 0 32px rgba(0,0,0,0.12);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-drawer.open { transform: translateX(0); }

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--card);
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-ai-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4361EE 0%, #6A8DFF 100%);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(67,97,238,0.3);
}
.chat-ai-dot::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
  opacity: 0.9;
}
.chat-header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.2;
}
.chat-header-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 1px;
}
.chat-header-actions {
  display: flex;
  gap: 4px;
}
.chat-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.chat-icon-btn:hover {
  background: var(--bg);
  color: var(--text-1);
}

/* Session history strip */
.chat-sessions-strip {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  scrollbar-width: none;
}
.chat-sessions-strip:empty { display: none; }
.chat-sessions-strip::-webkit-scrollbar { display: none; }
.chat-session-chip-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.chat-session-chip-wrap:hover .chat-session-delete { opacity: 1; }

.chat-session-chip {
  padding: 4px 22px 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 11.5px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.chat-session-chip:hover,
.chat-session-chip.active {
  background: var(--accent-light);
  border-color: rgba(67,97,238,0.2);
  color: var(--accent);
}

.chat-session-delete {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-3);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.12s;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
}
.chat-session-delete:hover { background: var(--red); }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Welcome state */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px 16px;
  gap: 12px;
}
.chat-welcome-icon { opacity: 0.85; }
.chat-welcome-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
}
.chat-welcome-sub {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
}
.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  margin-top: 8px;
}
.chat-suggestion {
  padding: 9px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12.5px;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  line-height: 1.4;
}
.chat-suggestion:hover {
  background: var(--accent-light);
  border-color: rgba(67,97,238,0.2);
  color: var(--accent);
}

/* Message bubbles */
.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 92%;
}
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.assistant { align-self: flex-start; align-items: flex-start; }

.chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.user .chat-bubble {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant .chat-bubble {
  background: var(--bg);
  color: var(--text-1);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 4px;
}

/* Markdown formatting inside assistant bubble */
.chat-bubble strong { font-weight: 600; }

.chat-bubble ul {
  padding-left: 18px;
  margin: 4px 0;
  list-style-type: disc;
}
.chat-bubble ul li { margin: 2px 0; }

/* Ordered list — use CSS counter so global * reset doesn't kill numbering */
.chat-bubble ol {
  padding-left: 0;
  margin: 6px 0;
  list-style: none;
  counter-reset: opsis-ol;
}
.chat-bubble ol > li {
  counter-increment: opsis-ol;
  position: relative;
  padding-left: 28px;
  margin: 6px 0;
}
.chat-bubble ol > li::before {
  content: counter(opsis-ol) ".";
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 700;
  color: var(--accent);
  min-width: 20px;
}

.chat-bubble p { margin: 0 0 6px; }
.chat-bubble p:last-child { margin: 0; }
.chat-md-heading {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-1);
  margin: 10px 0 4px;
  letter-spacing: 0.01em;
}
.chat-md-heading:first-child { margin-top: 0; }

/* Nested bullets inside a numbered item */
.chat-bubble ol > li > ul {
  margin: 4px 0 6px;
  padding-left: 14px;
  list-style-type: disc;
}
.chat-bubble ol > li > ul > li { margin: 2px 0; }
.chat-bubble ol > li > span { font-weight: 500; }

.chat-msg-time {
  font-size: 10.5px;
  color: var(--text-3);
  padding: 0 4px;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 4px 16px 8px;
  align-items: center;
  flex-shrink: 0;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  animation: chatBounce 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(1) { animation-delay: 0s; }
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* Input area */
.chat-input-area {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--card);
}
.chat-disclaimer {
  font-size: 10.5px;
  color: var(--text-3);
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.4;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 9px 13px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text-1);
  background: var(--bg);
  resize: none;
  outline: none;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
  transition: border-color 0.15s;
  scrollbar-width: thin;
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-3); }
.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, opacity 0.15s;
}
.chat-send-btn:hover { background: #3451d1; }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   ONBOARDING MODAL
   ============================================================ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,41,0.5);
  backdrop-filter: blur(4px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s;
}
.onboarding-overlay.visible { opacity: 1; }

.onboarding-modal {
  background: white;
  border-radius: 20px;
  width: 520px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.22);
  overflow: hidden;
  transform: translateY(16px);
  transition: transform .3s;
}
.onboarding-overlay.visible .onboarding-modal { transform: translateY(0); }

.onboarding-header {
  padding: 36px 36px 24px;
  text-align: center;
  background: linear-gradient(180deg, #F8F9FF 0%, white 100%);
  border-bottom: 1px solid var(--border);
}
.onboarding-logo { margin-bottom: 16px; }
.onboarding-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 8px;
}
.onboarding-sub {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 380px;
  margin: 0 auto;
}

.onboarding-steps {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ob-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  transition: background .15s;
}
.ob-step--active {
  background: var(--accent-light);
  border: 1px solid rgba(67,97,238,0.15);
}
.ob-step-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.ob-step--active .ob-step-icon { background: white; }
.ob-step-text { flex: 1; }
.ob-step-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 2px;
}
.ob-step-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}
.ob-step-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: white;
  border: 1px solid rgba(67,97,238,0.2);
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}

.onboarding-actions {
  padding: 16px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.onboarding-cta {
  width: 100%;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
}
.btn-ghost {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .15s;
}
.btn-ghost:hover { color: var(--text-2); }

/* ============================================================
   MOBILE & TABLET — collapsible nav + readable layouts
   ============================================================ */

.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(13, 20, 37, 0.48);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-nav-toggle {
    display: inline-flex;
  }

  .sidebar-close-mobile {
    display: inline-flex;
  }

  .sidebar {
    width: min(288px, 86vw);
    z-index: 120;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    will-change: transform;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.35);
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }

  body.nav-open {
    overflow: hidden;
  }

  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 14px 12px;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    gap: 10px;
  }

  .topbar-left {
    flex: 1;
    min-width: 0;
  }

  .topbar-title {
    font-size: 16px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-right {
    flex: 1 1 100%;
    order: 3;
    min-width: 0;
    justify-content: flex-start;
    gap: 8px;
  }

  .search-bar {
    flex: 1;
    min-width: 0;
    width: auto;
    max-width: none;
  }

  .topbar-icon-btn,
  .topbar-avatar {
    flex-shrink: 0;
  }

  .page {
    padding: 18px 16px 96px;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .page-heading {
    font-size: 19px;
    line-height: 1.25;
  }

  .page-subheading {
    font-size: 13px;
  }

  .kpi-grid,
  .kpi-grid.three-col {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kpi-card {
    padding: 16px;
  }

  .kpi-value {
    font-size: 22px;
  }

  .dash-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .health-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 16px 18px;
  }

  .vendor-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    flex-shrink: 1;
    min-width: 0;
    width: 100%;
  }

  .filter-strip {
    justify-content: flex-start;
  }

  .header-btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .header-btn-group .btn-secondary,
  .header-btn-group .btn-primary {
    width: 100%;
    justify-content: center;
  }

  /* iOS/small screens: avoid flex height collapse hiding the vendor grid */
  #page-vendors.page.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  #page-vendors .vendor-grid {
    flex: 1 1 auto;
    min-height: 160px;
    align-content: start;
  }

  .vc-stats {
    grid-template-columns: 1fr 1fr;
  }

  .settings-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .settings-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
  }

  .settings-nav-item {
    flex: 1 1 auto;
    min-width: calc(50% - 4px);
    text-align: center;
    padding: 10px 8px;
    font-size: 12.5px;
  }

  .chat-fab {
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    right: max(16px, env(safe-area-inset-right, 16px));
    padding: 0 16px 0 14px;
    height: 46px;
    font-size: 13px;
    z-index: 95;
  }

  body.nav-open .chat-fab {
    opacity: 0.35;
    pointer-events: none;
  }

  .topbar-notif-panel {
    left: 12px;
    right: 12px;
    max-width: none;
  }

  .topbar-search-results {
    left: 0;
    right: 0;
    max-height: min(50vh, 320px);
  }

  .community-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .community-aside {
    position: static;
  }

  .filter-strip {
    flex-wrap: wrap;
  }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .sidebar,
  body.nav-open .sidebar {
    transition: none;
  }
  .sidebar-backdrop {
    transition: none;
  }
}
