/* ================================================================
   CRM RECHIA STORE — Design System
   ================================================================ */

/* === TOKENS ===================================================== */
:root {
  --bg:             #edf0f4;
  --surface:        #ffffff;
  --surface-soft:   #f7f8fb;
  --surface-hover:  #f0f3f7;

  --text:           #111827;
  --text-2:         #374151;
  --muted:          #6b7280;
  --muted-2:        #9ca3af;

  --border:         #e5e7eb;
  --border-2:       #d1d5db;

  --brand:          #0d6b5e;
  --brand-hover:    #0a5549;
  --brand-soft:     #e3f0ed;
  --brand-muted:    #5a9e95;

  --success:        #166534;
  --success-soft:   #dcfce7;
  --success-border: #86efac;

  --danger:         #991b1b;
  --danger-soft:    #fef2f2;
  --danger-border:  #fca5a5;

  --warn:           #92400e;
  --warn-soft:      #fef3c7;
  --warn-border:    #fcd34d;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.09), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);

  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   18px;
  --r-pill: 9999px;
}

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

/* === BASE ======================================================= */
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* === LAYOUT ===================================================== */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
  background: linear-gradient(180deg, #0c2d37 0%, #081f29 100%);
  color: #e2e8ea;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

/* Brand ---------------------------------------------------------- */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.sidebar-brand > div {
  width: 100%;
  text-align: center;
}

.sidebar-logo {
  width: 100%;
  max-width: 148px;
  height: auto;
  display: block;
  margin: 0 auto 6px;
  filter: brightness(1.1) contrast(1.04);
}

.sidebar-brand-sub {
  display: block;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.38);
  margin-top: 2px;
}

/* Nav ------------------------------------------------------------ */
.sidebar-nav {
  flex: 1;
  padding: 14px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: rgba(255,255,255,0.28);
  padding: 4px 10px 8px;
  display: block;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  color: rgba(255,255,255,0.60);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  transition: background 0.14s, color 0.14s;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-link.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(13,107,94,0.35);
}

.nav-icon {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

.nav-link.active .nav-icon { opacity: 1; }

/* Footer / User -------------------------------------------------- */
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  color: inherit;
  text-decoration: none;
  transition: background 0.14s;
}

.sidebar-user:hover,
.sidebar-user.active {
  background: rgba(255,255,255,0.07);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.user-name {
  display: block;
  font-weight: 600;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: block;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.36);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.logout-button {
  width: 100%;
  padding: 7px 11px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.10);
  background: transparent;
  color: rgba(255,255,255,0.44);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  text-align: left;
}

.logout-button:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.75);
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content {
  padding: 28px 32px;
  overflow: auto;
  min-width: 0;
}

/* Topbar --------------------------------------------------------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--brand-muted);
  margin-bottom: 3px;
}

.topbar h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
}

.user-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 7px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-badge strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.user-badge span {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Content area --------------------------------------------------- */
.content-area { display: grid; gap: 20px; }

/* Flash messages ------------------------------------------------- */
.flash-stack { display: grid; gap: 8px; }

.alert-error,
.alert-success {
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 0.82rem;
  font-weight: 500;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.primary-button,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.14s, transform 0.12s, box-shadow 0.14s;
  box-shadow: 0 1px 3px rgba(13,107,94,0.25);
  white-space: nowrap;
}

.primary-button:hover,
.btn-primary:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(13,107,94,0.28);
}

.secondary-link,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
  white-space: nowrap;
}

.secondary-link:hover,
.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--brand);
  color: var(--brand);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.76rem;
}

.results-count {
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.small-button {
  padding: 7px 12px;
  font-size: 0.78rem;
}

/* ================================================================
   DASHBOARD METRICS
   ================================================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 13px 15px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.045);
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.metric-card.neutral { border-left: 4px solid #94a3b8; }
.metric-card.success { border-left: 4px solid var(--success-border); }
.metric-card.danger  { border-left: 4px solid var(--danger-border); }

.metric-label {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metric-value {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--text);
  line-height: 1;
  white-space: nowrap;
}

.metric-card.success .metric-value { color: #166534; }
.metric-card.danger .metric-value  { color: #991b1b; }
.metric-card.neutral .metric-value { color: #334155; }

.metric-card.compact {
  padding: 14px 16px;
}

.metric-card.compact .metric-value {
  font-size: 1.55rem;
}

/* Progress bar inside metric cards */
.metric-progress {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-progress-track {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.metric-progress-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: #94a3b8;
  transition: width 0.4s ease;
  max-width: 100%;
}

.metric-progress-fill.progress-success { background: var(--success-border); }
.metric-progress-fill.progress-warn    { background: var(--warn-border); }
.metric-progress-fill.progress-danger  { background: var(--danger-border); }

.metric-progress-label {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 600;
}

.money-value {
  white-space: nowrap;
  font-size: clamp(1.05rem, 1.4vw, 1.35rem);
}

/* ================================================================
   FINANCIAL PAGE
   ================================================================ */
.fin-page { display: flex; flex-direction: column; gap: 20px; }

/* Filter bar */
.fin-filter-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  flex-wrap: wrap;
}
.fin-filter-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.fin-filter-quick {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.fin-quick-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.fin-quick-btn {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  background: var(--surface);
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.fin-quick-btn:hover { background: var(--surface-hover); border-color: var(--brand); color: var(--brand); }
.fin-quick-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* KPI row */
.fin-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.fin-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.fin-kpi-card--highlight { border-left: 3px solid var(--success-border); }
.fin-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fin-kpi-icon svg { width: 22px; height: 22px; }
.fin-kpi-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fin-kpi-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.fin-kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}
.fin-kpi-value--green { color: #166534; }
.fin-kpi-trend {
  font-size: 0.7rem;
  font-weight: 600;
}
.trend-up   { color: #15803d; }
.trend-down { color: #dc2626; }
.trend-neutral { color: var(--muted); }
.fin-kpi-progress {
  height: 4px;
  background: var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-top: 4px;
}
.fin-kpi-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 0.4s ease;
}

/* Charts row */
.fin-charts-row {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
}
.fin-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  min-width: 0;
}
.fin-chart-full { width: 100%; }
.fin-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}
.fin-chart-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.fin-chart-subtitle { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.fin-chart-select {
  font-size: 0.78rem;
  padding: 4px 8px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}
.fin-chart-body { position: relative; }
.fin-donut-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Donut legend */
.fin-donut-legend { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.fin-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fin-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fin-legend-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.fin-legend-val {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

/* Bottom row */
.fin-bottom-row {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: start;
}
.fin-section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  min-width: 0;
}
.fin-section-header {
  margin-bottom: 16px;
}
.fin-section-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.fin-section-subtitle { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

/* Seller table extras */
.fin-seller-table td { vertical-align: middle; }
.fin-seller-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.fin-avatar--0 { background: #059669; }
.fin-avatar--1 { background: #0d9488; }
.fin-avatar--2 { background: #7c3aed; }
.fin-avatar--3 { background: #dc2626; }
.fin-avatar--4 { background: #d97706; }
.fin-avatar--5 { background: #2563eb; }
.fin-avatar--6 { background: #db2777; }
.fin-avatar--7 { background: #65a30d; }

.fin-cell-pct { display: flex; flex-direction: column; gap: 3px; }
.fin-cell-pct span { font-size: 0.82rem; font-weight: 600; }
.fin-mini-bar {
  width: 64px;
  height: 4px;
  background: var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.fin-mini-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 0.3s ease;
}

/* Color fills */
.fill-green  { background: #86efac; }
.fill-yellow { background: #fcd34d; }
.fill-red    { background: #fca5a5; }
.fill-purple { background: #c4b5fd; }

/* Table footer */
.fin-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.fin-table-count { font-size: 0.78rem; color: var(--muted); }
.fin-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}
.fin-page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}
.fin-page-btn:hover:not(.disabled):not(.active) {
  background: var(--surface-hover);
  border-color: var(--brand);
  color: var(--brand);
}
.fin-page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.fin-page-btn.disabled { opacity: 0.35; cursor: default; }

/* Goals section */
.fin-goals-section { display: flex; flex-direction: column; gap: 20px; }
.fin-goal-item { display: flex; flex-direction: column; gap: 6px; }
.fin-goal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fin-goal-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.fin-goal-pct {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}
.fin-goal-track {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.fin-goal-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 0.5s ease;
}
.fin-goal-fill--green  { background: #86efac; }
.fin-goal-fill--purple { background: #c4b5fd; }
.fin-goal-detail {
  font-size: 0.72rem;
  color: var(--muted);
}
.fin-goal-bonus {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fin-goal-bonus-value { display: flex; flex-direction: column; gap: 2px; }
.fin-goal-bonus-rate { font-size: 0.72rem; color: var(--muted); }

/* Responsive */
@media (max-width: 1100px) {
  .fin-charts-row { grid-template-columns: 1fr; }
  .fin-bottom-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .fin-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .fin-filter-bar { flex-direction: column; align-items: stretch; }
  .fin-filter-quick { justify-content: flex-start; }
}
@media (max-width: 480px) {
  .fin-kpi-row { grid-template-columns: 1fr; }
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-page {
  min-height: 100vh;
  background: #072229;
}

.login-shell {
  min-height: 100vh;
}

.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(540px, 1.25fr) minmax(460px, 0.75fr);
}

.login-brand-panel {
  background:
    linear-gradient(180deg, rgba(4, 27, 33, 0.28), rgba(7, 34, 41, 0.34)),
    url("../img/login-bg.png") center center / cover no-repeat,
    linear-gradient(180deg, #041b21 0%, #072229 52%, #0a252d 100%);
  color: #eef5f6;
  display: flex;
  align-items: center;
  padding: 54px 56px;
  position: relative;
  overflow: hidden;
}

.login-brand-inner {
  width: min(520px, 100%);
  position: relative;
  z-index: 3;
  margin: 0 auto;
}

.login-brand-logo {
  width: 276px;
  height: auto;
  display: block;
  margin-bottom: 12px;
  filter: brightness(0) invert(1) opacity(0.96);
}

.login-brand-accent {
  width: 88px;
  height: 4px;
  border-radius: 999px;
  display: block;
  background: linear-gradient(90deg, #0ec6a0 0%, rgba(14, 198, 160, 0.16) 100%);
  margin-bottom: 18px;
}

.login-brand-title {
  font-size: clamp(2rem, 3.2vw, 3rem);
  line-height: 1.04;
  letter-spacing: -0.05em;
  color: #ffffff;
  max-width: 12ch;
  margin-bottom: 0;
}

.login-brand-title span {
  color: #0ec6a0;
}

.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 42px;
  background: linear-gradient(180deg, #041b21 0%, #072229 100%);
  position: relative;
}

.login-form-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.05), transparent 16%),
    radial-gradient(circle at 80% 85%, rgba(14,198,160,0.08), transparent 24%);
}

.login-form-wrap {
  width: min(390px, 100%);
  position: relative;
  z-index: 2;
}

.login-form-card {
  width: 100%;
  background: #ffffff;
  border-radius: 22px;
  padding: 34px 34px 26px;
  border: 1px solid rgba(226, 232, 240, 0.72);
  box-shadow: 0 20px 42px rgba(3, 15, 20, 0.18);
}

.login-form-header {
  text-align: center;
  margin-bottom: 26px;
}

.login-form-title {
  font-size: 2rem;
  line-height: 1.04;
  letter-spacing: -0.05em;
  color: #1f2937;
  margin-bottom: 8px;
}

.login-form-subtitle {
  color: #6b7280;
  font-size: 0.94rem;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-field label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-input-shell {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  min-height: 54px;
  border-radius: 14px;
  border: 1px solid #dbe3ea;
  background: #ffffff;
  overflow: hidden;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.login-input-shell:focus-within {
  border-color: #0d6b5e;
  box-shadow: 0 0 0 4px rgba(13,107,94,0.10);
}

.login-input-icon {
  display: grid;
  place-items: center;
  color: #8090a1;
  font-size: 0.95rem;
  font-weight: 700;
}

.login-field input {
  min-height: 54px;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 12px 16px 12px 6px;
  box-shadow: none;
}

.login-field input:focus {
  border: none;
  box-shadow: none;
}

.login-field input::placeholder {
  color: #9aa6b2;
}

.login-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -2px;
}

.login-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #4b5563;
  font-size: 0.86rem;
  cursor: pointer;
}

.login-check input {
  width: 16px;
  height: 16px;
  accent-color: #0d6b5e;
}

.login-link {
  color: #0d6b5e;
  font-size: 0.86rem;
  text-decoration: none;
  font-weight: 500;
}

.login-link:hover {
  text-decoration: underline;
}

.login-error {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #f4b4b4;
  background: #fff6f6;
  color: #a11d1d;
  font-size: 0.83rem;
  font-weight: 500;
}

.login-submit {
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  font-size: 0.95rem;
  background: #0d6b5e;
  box-shadow: 0 10px 20px rgba(13, 107, 94, 0.16);
}

.login-submit:hover {
  background: #0a5549;
}

.login-footer {
  margin-top: 22px;
  color: #6b7280;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  text-align: center;
}

.login-brand-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 15, 18, 0.62), rgba(3, 18, 22, 0.82)),
    linear-gradient(135deg, rgba(7, 34, 41, 0.54), rgba(2, 15, 18, 0.64));
  z-index: 1;
}

.login-brand-decor {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  z-index: 1;
}

.login-brand-decor-top {
  top: -90px;
  left: -80px;
  width: 220px;
  height: 220px;
  background: rgba(14, 198, 160, 0.10);
}

.login-brand-decor-bottom {
  right: -110px;
  bottom: -110px;
  width: 280px;
  height: 280px;
  background: rgba(90, 158, 149, 0.14);
}

.login-brand-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: rgba(233, 241, 242, 0.82);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

/* ================================================================
   FORMS (shared)
   ================================================================ */
.form-group { display: grid; gap: 5px; }

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13,107,94,0.10);
}

.form-group textarea { resize: vertical; }

.form-page { display: grid; gap: 20px; }

.form-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.form-page-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.form-page-header p {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 3px;
}

.edit-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 20px;
}

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

.form-group.full-width { grid-column: 1 / -1; }

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

/* ================================================================
   PIPELINE BOARD
   ================================================================ */
.pipeline-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 284px;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 20px;
  align-items: start;
}

.pipeline-board::-webkit-scrollbar        { height: 5px; }
.pipeline-board::-webkit-scrollbar-track  { background: transparent; }
.pipeline-board::-webkit-scrollbar-thumb  {
  background: var(--border-2);
  border-radius: var(--r-pill);
}

/* ================================================================
   PIPELINE COLUMN
   ================================================================ */
.pipeline-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Colored top accent per column position */
.pipeline-column:nth-child(1) { border-top: 3px solid #60a5fa; }
.pipeline-column:nth-child(2) { border-top: 3px solid #fbbf24; }
.pipeline-column:nth-child(3) { border-top: 3px solid #a78bfa; }
.pipeline-column:nth-child(4) { border-top: 3px solid #34d399; }
.pipeline-column:nth-child(5) { border-top: 3px solid #f87171; }

.pipeline-column-header {
  padding: 13px 15px 11px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pipeline-column-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.pipeline-column-count {
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.70rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.pipeline-cards {
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 160px;
}

.pipeline-empty {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-lg);
  padding: 20px;
  color: var(--muted-2);
  font-size: 0.78rem;
  text-align: center;
}

/* ================================================================
   PIPELINE CARD
   ================================================================ */
.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.pipeline-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Left accent based on readiness state */
.pipeline-card.card-ready   { border-left: 3px solid var(--success-border); }
.pipeline-card.card-pending { border-left: 3px solid var(--warn-border); }
.pipeline-card.card-final   { border-left: 3px solid var(--border-2); }

/* Card head — stage badge + title */
.pipeline-card-head {
  padding: 12px 14px 0;
}

.card-stage-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  margin-bottom: 7px;
}

.card-title {
  font-size: 0.855rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card info rows */
.pipeline-card-info {
  padding: 0 14px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.78rem;
}

.info-lbl {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
  min-width: 58px;
  flex-shrink: 0;
}

.info-val {
  color: var(--text-2);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-val.strong {
  color: var(--text);
  font-weight: 700;
}

.info-val.em {
  font-style: italic;
  color: var(--muted-2);
}

/* Status section */
.card-status {
  padding: 8px 14px 9px;
  border-top: 1px solid var(--border);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
}

.status-pill.ready {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-border);
}

.status-pill.pending {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: var(--warn-border);
}

.status-pill.final {
  background: var(--surface-soft);
  color: var(--muted);
  border-color: var(--border);
}

.missing-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.missing-item {
  font-size: 0.71rem;
  color: var(--warn);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

/* Card actions */
.pipeline-card-actions {
  padding: 9px 12px 11px;
  display: flex;
  gap: 7px;
  align-items: center;
  border-top: 1px solid var(--surface-soft);
}

.advance-form {
  flex: 1;
  display: flex;
}

.advance-form .btn-primary {
  flex: 1;
  width: 100%;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 14px;
    gap: 10px;
  }

  .sidebar-brand       { border-bottom: none; padding: 0; }
  .sidebar-nav         { flex-direction: row; flex: 1; padding: 0; gap: 4px; }
  .sidebar-footer      { border-top: none; padding: 0; margin-left: auto; }
  .sidebar-user        { display: none; }
  .nav-section-label   { display: none; }

  .main-content { padding: 20px 16px; }

  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-brand-panel,
  .login-form-panel {
    padding: 34px 24px;
  }

  .login-brand-title {
    max-width: none;
  }

}

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-page-header,
  .form-actions { flex-direction: column; align-items: stretch; }
  .pipeline-board { grid-auto-columns: 264px; }

  .login-page {
    background: linear-gradient(180deg, #072229 0%, #072229 22%, #f4f7fa 22%, #f4f7fa 100%);
  }

  .login-layout {
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: 0;
    padding: 26px 20px 20px;
  }

  .login-form-panel {
    padding: 22px 18px 34px;
  }

  .login-brand-logo {
    width: 207px;
    margin-bottom: 10px;
  }

  .login-brand-title {
    font-size: 2.05rem;
  }

  .login-form-title {
    font-size: 1.75rem;
  }

  .login-brand-tag {
    margin-bottom: 12px;
  }

  .login-brand-accent {
    margin-bottom: 14px;
  }

  .login-form-card {
    padding: 28px 22px 22px;
    border-radius: 20px;
  }

  .login-brand-decor {
    display: none;
  }
}

/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-header-title h2 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-header-title p {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

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

/* ================================================================
   FILTER BAR
   ================================================================ */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 14px 18px;
  box-shadow: var(--shadow-xs);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.filter-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-group input,
.filter-group select {
  padding: 7px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.83rem;
  font-family: inherit;
  transition: border-color 0.14s;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--brand);
}

/* ================================================================
   DATA LIST
   ================================================================ */
.data-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.data-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
}

.data-card:hover { box-shadow: var(--shadow-sm); }

.data-card-main {
  flex: 1;
  min-width: 0;
}

.data-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-card-sub {
  font-size: 0.77rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.data-card-sub span { white-space: nowrap; }

.data-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.data-card-alert {
  border-left: 3px solid var(--danger-border);
  background: #fff9f9;
}

/* ================================================================
   BADGES
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-open    { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.badge-won     { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge-lost    { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge-person  { background: #f3e8ff; color: #7c3aed; border-color: #ddd6fe; }
.badge-company { background: #fef3c7; color: #92400e; border-color: var(--warn-border); }
.badge-pending { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.badge-done    { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge-overdue { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge-canceled { background: var(--surface-soft); color: var(--muted); border-color: var(--border-2); }

/* ================================================================
   TAB BAR
   ================================================================ */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
}

.tab-link {
  padding: 9px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.14s, border-color 0.14s;
  white-space: nowrap;
}

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

.tab-link.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.tab-link .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--surface-hover);
  color: var(--muted);
  margin-left: 5px;
  vertical-align: middle;
}

.tab-link.active .tab-count {
  background: var(--brand-soft);
  color: var(--brand);
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.85rem;
}

/* ================================================================
   DETAIL LAYOUT
   ================================================================ */
.detail-layout {
  display: grid;
  gap: 18px;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.detail-card-header {
  padding: 13px 20px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-card-header h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.detail-card-body { padding: 18px 20px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.detail-field label {
  display: block;
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 3px;
}

.detail-field p {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
}

.detail-field p.em { color: var(--muted-2); font-style: italic; }

/* ================================================================
   SECTION LIST (interactions, follow-ups)
   ================================================================ */
.section-list {
  display: flex;
  flex-direction: column;
}

.section-item {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

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

.section-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-2);
  margin-top: 6px;
  flex-shrink: 0;
}

.section-item-dot.dot-call        { background: #60a5fa; }
.section-item-dot.dot-note        { background: #a78bfa; }
.section-item-dot.dot-proposal    { background: #fbbf24; }
.section-item-dot.dot-negotiation { background: #f97316; }
.section-item-dot.dot-message     { background: #34d399; }
.section-item-dot.dot-schedule    { background: #fb923c; }
.section-item-dot.dot-followup    { background: #e879f9; }

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

.section-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.section-item-meta {
  font-size: 0.74rem;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.section-item-desc {
  font-size: 0.80rem;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.45;
}

/* ================================================================
   INLINE FORM (detail page)
   ================================================================ */
.inline-form-card {
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: grid;
  gap: 12px;
}

.inline-form-card .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.inline-form-card .form-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inline-form-card .form-group input,
.inline-form-card .form-group select,
.inline-form-card .form-group textarea {
  padding: 7px 10px;
  font-size: 0.82rem;
}

.inline-form-actions {
  display: flex;
  justify-content: flex-end;
}

/* ================================================================
   OPPORTUNITY STATUS SECTION
   ================================================================ */
.opp-status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.opp-status-header h1 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

@media (max-width: 768px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .filter-bar  { flex-direction: column; }
  .data-card   { flex-direction: column; align-items: flex-start; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .inline-form-card .form-row { grid-template-columns: 1fr; }
}

/* ================================================================
   DASHBOARD FILTERS / USERS MODULE
   ================================================================ */
.dashboard-page {
  display: grid;
  gap: 20px;
}

.dashboard-section {
  display: grid;
  gap: 10px;
}

.section-heading h3 {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-panel,
.dashboard-panel,
.table-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  padding: 18px;
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

.dashboard-filter-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-filter-form .form-group {
  min-width: 190px;
}

.dashboard-filter-actions {
  margin-left: auto;
}

.dashboard-clear-link {
  opacity: 0.7;
  font-size: 0.82rem;
}

.dashboard-clear-link:hover {
  opacity: 1;
}

.filter-actions,
.page-toolbar,
.table-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.dashboard-panels {
  display: grid;
  grid-template-columns: minmax(280px, 1.25fr) minmax(260px, 0.85fr);
  gap: 16px;
}

.chart-shell {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chart-shell-sm {
  width: 220px;
  height: 220px;
  margin: 18px auto 0;
}

.dashboard-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
}

.dashboard-commercial-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 12px;
}

.dashboard-overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
}

.dashboard-chart-panel {
  display: flex;
  flex-direction: column;
}

.panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.panel-header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.summary-list {
  list-style: none;
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.summary-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

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

.data-table th,
.data-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 700;
}

.status-chip.success {
  background: var(--success-soft);
  color: var(--success);
}

.status-chip.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

@media (max-width: 980px) {
  .dashboard-panels {
    grid-template-columns: 1fr;
  }

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

  .chart-shell-sm {
    max-width: 70%;
  }
}

@media (max-width: 560px) {
  .dashboard-commercial-grid {
    grid-template-columns: 1fr;
  }
}

/* ================================================================
   PIPELINE SELLER FILTER
   ================================================================ */
.pipeline-filter-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pipeline-filter-bar--combined {
  align-items: flex-end;
  margin: 0;
}

#dnd-toast-area + .pipeline-filter-bar {
  display: none;
}

.pipeline-board-hint {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.pipeline-filter-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pipeline-filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.pipeline-filter-select {
  padding: 7px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 0.83rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.14s, box-shadow 0.14s;
  min-width: 200px;
}

.pipeline-filter-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13,107,94,0.10);
}

.pipeline-filter-clear {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-2);
  background: var(--surface);
  transition: color 0.13s, border-color 0.13s;
  white-space: nowrap;
}

.pipeline-filter-clear:hover {
  color: var(--danger);
  border-color: var(--danger-border);
}

.pipeline-filter-active {
  font-size: 0.80rem;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid rgba(13,107,94,0.18);
  border-radius: var(--r-pill);
  padding: 4px 12px;
}

.pipeline-filter-active strong {
  font-weight: 700;
}

/* ================================================================
   DRAG AND DROP — SORTABLEJS STATES
   ================================================================ */

/* Card chosen (mousedown, before drag starts) */
.sortable-chosen {
  box-shadow: var(--shadow-md);
  cursor: grabbing;
}

/* Ghost placeholder left in source column */
.sortable-ghost {
  opacity: 0.35;
  background: var(--brand-soft);
  border: 1.5px dashed var(--brand-muted);
  box-shadow: none;
  transform: none;
}

/* Floating card while dragging */
.sortable-drag {
  opacity: 0.96;
  box-shadow: var(--shadow-lg);
  transform: rotate(1.5deg) scale(1.02);
  cursor: grabbing;
}

/* Board cursor while drag is active */
.pipeline-dragging .pipeline-board { cursor: grabbing; }

/* Column highlight when a card hovers over it */
.pipeline-dragging .pipeline-cards {
  transition: background 0.14s, border-color 0.14s;
}

.pipeline-dragging .pipeline-cards:hover {
  background: var(--brand-soft);
  border-radius: var(--r-lg);
  outline: 1.5px dashed var(--brand-muted);
  outline-offset: -2px;
}

/* Loading state while API call is in flight */
.card-loading {
  opacity: 0.60;
  pointer-events: none;
  position: relative;
}

.card-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.55)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='%230d6b5e' stroke-width='2.5' stroke-dasharray='31.4' stroke-dashoffset='0'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='0.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E")
    center / 28px no-repeat;
}

/* Drag hint label in card footer */
.card-drag-hint {
  margin-left: auto;
  font-size: 0.67rem;
  color: var(--muted-2);
  font-weight: 500;
  user-select: none;
  cursor: grab;
  letter-spacing: 0.02em;
}

.card-drag-hint:active { cursor: grabbing; }

/* ================================================================
   DRAG AND DROP — BUTTON DANGER
   ================================================================ */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  border: none;
  background: var(--danger);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.14s, transform 0.12s;
  white-space: nowrap;
}

.btn-danger:hover {
  background: #7f1d1d;
  transform: translateY(-1px);
}

/* ================================================================
   DRAG AND DROP — MODALS
   ================================================================ */
.dnd-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 34, 41, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.dnd-modal-overlay[hidden] { display: none; }

.dnd-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.dnd-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.dnd-modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
}

.dnd-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  transition: background 0.12s, color 0.12s;
}

.dnd-modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.dnd-modal-body {
  padding: 20px;
  display: grid;
  gap: 0;
}

.dnd-modal-desc {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.dnd-modal-error {
  font-size: 0.80rem;
  color: var(--danger);
  font-weight: 600;
  margin-top: 10px;
  min-height: 18px;
}

.dnd-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

/* Required field asterisk */
.field-required {
  color: var(--danger);
  font-weight: 700;
  margin-left: 2px;
}

/* ================================================================
   DRAG AND DROP — TOAST NOTIFICATIONS
   ================================================================ */
.dnd-toast-area {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.dnd-toast {
  padding: 11px 16px;
  border-radius: var(--r-lg);
  font-size: 0.83rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  border: 1px solid transparent;
  max-width: 320px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.24s ease, transform 0.24s ease;
  pointer-events: none;
}

.dnd-toast.dnd-toast-show {
  opacity: 1;
  transform: translateY(0);
}

.dnd-toast-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-border);
}

.dnd-toast-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* ================================================================
   ROW ACTION MENU (⋮ dropdown)
   ================================================================ */
.row-menu {
  position: relative;
  display: inline-block;
}

.row-menu-trigger {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  font-family: inherit;
}

.row-menu-trigger:hover,
.row-menu.open .row-menu-trigger {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text);
}

.row-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 152px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 200;
  overflow: hidden;
  padding: 4px 0;
}

.row-menu.open .row-menu-dropdown {
  display: block;
  animation: row-menu-in 0.12s ease;
}

@keyframes row-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.row-menu-dropdown form {
  margin: 0;
}

.row-menu-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
  transition: background 0.10s, color 0.10s;
  white-space: nowrap;
}

.row-menu-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.row-menu-item--danger {
  color: var(--danger);
}

.row-menu-item--danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.row-menu-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Items (proposals) ───────────────────────────────────── */
.item-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}

.item-row-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.item-row-field label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}

.item-row-field--desc {
  flex: 3;
}

.item-row-field--qty,
.item-row-field--price {
  flex: 1;
  min-width: 80px;
}

.item-row-field--sub {
  flex: 1;
  min-width: 90px;
}

.item-row input[type="text"],
.item-row input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.item-row input[type="text"]:focus,
.item-row input[type="number"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13,107,94,0.10);
}

.item-row-field--sub .i-sub {
  display: block;
  padding: 9px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  color: var(--text-2);
  text-align: right;
  white-space: nowrap;
  line-height: 1.4;
}

.btn-item-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--danger-border);
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  transition: background 0.1s;
  margin-bottom: 1px;
}

.btn-item-remove:hover {
  background: #fca5a5;
}

.btn-add-item-dashed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 2px dashed var(--brand);
  border-radius: 8px;
  background: transparent;
  color: var(--brand);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s;
  margin-top: 4px;
}

.btn-add-item-dashed:hover {
  background: var(--brand-soft);
}

.items-totals {
  margin-top: 20px;
  margin-left: auto;
  width: 380px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.items-totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

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

.items-totals-row:not(.items-totals-grand) > span:first-child,
.items-totals-row label {
  color: var(--brand);
  font-weight: 400;
  margin: 0;
}

.items-totals-row > span:not(:first-child) {
  color: var(--text-2);
}

.totals-input {
  width: 130px;
  text-align: right;
  padding: 6px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  font-size: 0.875rem;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.totals-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.items-totals-grand {
  font-weight: 700;
  font-size: 1rem;
  background: var(--surface-soft);
}

.items-totals-grand > span {
  color: var(--text);
}

/* Detail view table */
.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.items-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.items-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.items-tfoot-sub td {
  font-size: 0.85rem;
  color: var(--text-2);
  padding-top: 5px;
  padding-bottom: 5px;
}

.items-tfoot-grand td {
  font-weight: 700;
  font-size: 0.95rem;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ================================================================
   NEW DASHBOARD (SELLER + MANAGER)
   ================================================================ */
.db-page { display: flex; flex-direction: column; gap: 16px; }

/* Filter bar */
.db-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  flex-wrap: wrap;
}
.db-filter-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.db-filter-group { display: flex; flex-direction: column; gap: 3px; }
.db-filter-group label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.db-input {
  padding: 6px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  font-size: 0.82rem;
  background: var(--surface);
  color: var(--text);
}
.db-period-label { font-size: 0.78rem; font-weight: 600; color: var(--text-2); }

/* KPI row */
.db-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.db-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.db-kpi-card.db-kpi-green { border-left: 3px solid var(--success-border); }
.db-kpi-card.db-kpi-red   { border-left: 3px solid var(--danger-border); }
.db-kpi-card.db-kpi-yellow{ border-left: 3px solid var(--warn-border); }
.db-kpi-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.db-kpi-icon svg { width: 20px; height: 20px; fill: currentColor; }
.db-icon-green  { background: var(--success-soft); color: var(--success); }
.db-icon-blue   { background: #dbeafe; color: #1d4ed8; }
.db-icon-purple { background: #ede9fe; color: #7c3aed; }
.db-icon-orange { background: var(--warn-soft); color: var(--warn); }
.db-kpi-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.db-kpi-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.db-kpi-value { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); line-height: 1.2; }
.db-kpi-sub   { font-size: 0.64rem; color: var(--muted); }
.db-kpi-alert { font-size: 0.7rem; font-weight: 700; color: var(--warn); margin-top: 2px; }
.db-value-big { font-size: 1.5rem; }
.db-text-green  { color: var(--success) !important; }
.db-text-red    { color: var(--danger) !important; }
.db-text-yellow { color: var(--warn) !important; }
.db-text-muted  { color: var(--muted) !important; }

/* Progress inside cards */
.db-progress-track {
  width: 100%; height: 7px;
  background: var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-top: 4px;
}
.db-progress-narrow { height: 5px; }
.db-progress-fill { height: 100%; border-radius: var(--r-pill); max-width: 100%; transition: width 0.4s ease; }
.db-fill-green  { background: var(--success-border); }
.db-fill-yellow { background: var(--warn-border); }
.db-fill-red    { background: var(--danger-border); }

/* Mid row */
.db-mid-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 12px;
  align-items: start;
}

/* Generic panel */
.db-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.db-panel-title {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 12px;
}
.db-panel-forecast { background: var(--surface-soft); }

/* Daily target */
.db-daily-grid { display: flex; align-items: stretch; gap: 0; }
.db-daily-item { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.db-daily-divider { width: 1px; background: var(--border); margin: 0 16px; }
.db-daily-label { font-size: 0.7rem; color: var(--muted); font-weight: 600; }
.db-daily-value { font-size: 1.3rem; font-weight: 800; }
.db-daily-sub   { font-size: 0.65rem; color: var(--muted); }

/* Forecast */
.db-forecast-value { font-size: 1.6rem; font-weight: 800; color: var(--text); display: block; margin-bottom: 4px; }
.db-forecast-sub   { font-size: 0.75rem; color: var(--muted); margin-bottom: 8px; }
.db-chance-row { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.db-chance-label { font-size: 0.68rem; color: var(--muted); font-weight: 600; }

/* Rank highlight */
.db-rank-highlight { display: flex; align-items: baseline; gap: 8px; }
.db-rank-num  { font-size: 2.5rem; font-weight: 900; color: var(--brand); line-height: 1; }
.db-rank-label{ font-size: 0.8rem; color: var(--muted); }

/* Badges */
.db-badge {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.db-badge-green  { background: var(--success-soft); color: var(--success); }
.db-badge-yellow { background: var(--warn-soft); color: var(--warn); }
.db-badge-red    { background: var(--danger-soft); color: var(--danger); }

/* Lower row */
.db-lower-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
  align-items: start;
}
.db-panel-attention {}
.db-panel-ranking {}

/* Attention list */
.db-attention-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.db-attention-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.db-att-icon { width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; }
.db-att-icon svg { width: 16px; height: 16px; fill: currentColor; }
.db-att-red    { border-left: 3px solid var(--danger-border); }
.db-att-red .db-att-icon { background: var(--danger-soft); color: var(--danger); }
.db-att-orange { border-left: 3px solid var(--warn-border); }
.db-att-orange .db-att-icon { background: var(--warn-soft); color: var(--warn); }
.db-att-yellow { border-left: 3px solid var(--warn-border); }
.db-att-yellow .db-att-icon { background: var(--warn-soft); color: var(--warn); }
.db-att-blue   { border-left: 3px solid #93c5fd; }
.db-att-blue .db-att-icon { background: #dbeafe; color: #1d4ed8; }
.db-att-ok .db-att-icon  { background: var(--success-soft); color: var(--success); }
.db-att-title { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text); }
.db-att-count { display: inline-block; font-size: 0.75rem; font-weight: 800; color: var(--text); margin-right: 4px; }
.db-att-desc  { font-size: 0.65rem; color: var(--muted); display: block; margin-top: 1px; }

/* Ranking table */
.db-rank-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.db-rank-table th {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 700; padding: 4px 6px 8px;
  text-align: left; border-bottom: 1px solid var(--border);
}
.db-rank-table td { padding: 7px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.db-rank-table tbody tr:last-child td { border-bottom: none; }
.db-rank-me { background: var(--brand-soft); font-weight: 700; }
.db-rank-pos { font-size: 1rem; width: 32px; }
.db-rank-name { font-weight: 600; }
.db-rank-bar-wrap {
  width: 70px; height: 6px; background: var(--border);
  border-radius: 3px; overflow: hidden; display: inline-block;
  vertical-align: middle; margin-right: 6px;
}
.db-rank-bar { height: 100%; border-radius: 3px; }
.db-rank-pct { font-size: 0.75rem; font-weight: 700; }

/* Funnel */
/* ── Tabs: Meu Dashboard / Equipe ─────────────────────────── */
.db-view-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 5px 6px;
  width: fit-content;
}
.db-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  border-radius: var(--r-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.14s, color 0.14s;
}
.db-tab:hover { background: var(--surface-hover); color: var(--text); }
.db-tab-active { background: var(--brand); color: #fff; }
.db-tab-active:hover { background: var(--brand-hover); color: #fff; }

/* ── Funnel filter bar ─────────────────────────────────────── */
.funnel-filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  margin-bottom: 2px;
}
.funnel-filter-form {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.funnel-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.funnel-filter-group label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.funnel-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.funnel-date-range span { font-size: 0.76rem; color: var(--muted); }
.funnel-filter-actions { display: flex; align-items: center; gap: 6px; }

/* ── Two-funnel section wrapper ────────────────────────────── */
.funnel-section-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Individual funnel card ────────────────────────────────── */
.funnel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-sm);
}
.funnel-card-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.funnel-badge {
  font-size: 0.56rem;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--r-pill);
  padding: 2px 7px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.funnel-card-body {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

/* ── Visual trapezoid funnel ───────────────────────────────── */
.vfunnel {
  flex-shrink: 0;
  width: 160px;        /* fixed so percentages are consistent */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.vfunnel-bar {
  /* Width set via inline style (bar_width_pct %) relative to 160px */
  height: 34px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.30);
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.vfunnel-val {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0;
}

/* ── Funnel legend & table ─────────────────────────────────── */
.funnel-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.funnel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.funnel-table th {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  padding: 3px 6px 8px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.funnel-table th:nth-child(3),
.funnel-table th:nth-child(4) { text-align: right; }
.funnel-table td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.8rem;
}
.funnel-table td:nth-child(3),
.funnel-table td:nth-child(4) { text-align: right; }
.funnel-table tbody tr:last-child td { border-bottom: none; }
.funnel-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 2px;
}
.funnel-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-2);
  font-size: 0.82rem;
}
.funnel-total-row span { color: var(--muted); font-weight: 600; }
.funnel-total-row strong { font-size: 1.1rem; font-weight: 800; color: var(--text); }

/* ── Legacy refs (TV dashboard still uses these) ───────────── */
.db-funnel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.db-funnel-wrap-old { display: flex; flex-direction: column; gap: 10px; }
.db-funnel-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.db-funnel-table th { color: var(--muted); font-size: 0.6rem; text-transform: uppercase; padding: 3px 4px 6px; text-align: left; border-bottom: 1px solid var(--border); }
.db-funnel-table td { padding: 5px 4px; border-bottom: 1px solid var(--border); }
.db-funnel-table tbody tr:last-child td { border-bottom: none; }
.db-funnel-table tfoot td { font-weight: 700; border-top: 1px solid var(--border-2); padding-top: 6px; }

/* ================================================================
   PACE BANNER (seller dashboard rhythm indicator)
   ================================================================ */
.pace-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}
.pace-adiantado {
  background: #f0fdf4;
  border-color: #86efac;
}
.pace-no_ritmo {
  background: var(--warn-soft);
  border-color: var(--warn-border);
}
.pace-atrasado {
  background: var(--danger-soft);
  border-color: var(--danger-border);
}
.pace-banner-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.pace-banner-icon svg { width: 20px; height: 20px; fill: currentColor; }
.pace-adiantado .pace-banner-icon { background: #dcfce7; color: #166534; }
.pace-no_ritmo .pace-banner-icon { background: var(--warn-soft); color: var(--warn); }
.pace-atrasado .pace-banner-icon { background: var(--danger-soft); color: var(--danger); }
.pace-banner-body { flex: 1; font-size: 0.83rem; }
.pace-banner-body strong { font-size: 0.82rem; font-weight: 800; }
.pace-adiantado .pace-banner-body { color: #166534; }
.pace-no_ritmo .pace-banner-body { color: var(--warn); }
.pace-atrasado .pace-banner-body { color: var(--danger); }
.pace-banner-detail {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  opacity: 0.75;
}
.pace-banner-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.pace-banner-link:hover { text-decoration: underline; }

/* ================================================================
   GOALS MODAL (manager start-of-month)
   ================================================================ */
.goals-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.goals-modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.goals-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.goals-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 3px;
}
.goals-modal-sub { font-size: 0.8rem; color: var(--muted); }
.goals-modal-form { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.goals-modal-table-wrap { overflow-y: auto; flex: 1; padding: 0 24px; }
.goals-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 16px 0;
}
.goals-modal-table th {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 700;
  padding: 6px 8px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.goals-modal-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.goals-modal-table tbody tr:last-child td { border-bottom: none; }
.goals-modal-row-pending { background: #fff9f9; }
.goals-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ================================================================
   METAS MANAGEMENT PAGE
   ================================================================ */
.metas-page { display: flex; flex-direction: column; gap: 18px; }
.metas-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.metas-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.metas-nav-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.metas-nav-actions { display: flex; gap: 8px; }
.metas-month-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.metas-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.metas-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}
.metas-card-header h3 { font-size: 0.9rem; font-weight: 700; }
.metas-table-wrap { overflow-x: auto; }
.metas-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.metas-table th {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  background: var(--surface-soft);
}
.metas-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.metas-table tbody tr:last-child td { border-bottom: none; }
.metas-table tbody tr:hover { background: var(--surface-hover); }
.metas-seller-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.metas-input {
  padding: 6px 9px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  font-size: 0.82rem;
  width: 120px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.14s;
}
.metas-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.metas-input-sm { width: 64px; text-align: center; }
.metas-calc-cell { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.metas-updated-at { display: block; font-size: 0.64rem; color: var(--muted); margin-top: 2px; }
.metas-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}
.metas-history-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 20px; }
.metas-history-item {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-pill);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  transition: all 0.14s;
}
.metas-history-item:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.metas-history-active { background: var(--brand); border-color: var(--brand); color: #fff; }
