.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-md); font-size: 13px; font-weight: 500;
  cursor: pointer; border: 0.5px solid var(--c-border-2);
  background: var(--c-surface); color: var(--c-text);
  transition: all .15s; text-decoration: none; font-family: inherit;
}
.btn:hover { background: var(--c-bg); text-decoration: none; }
.btn-primary {
  background: var(--c-primary); color: white; border-color: var(--c-primary);
}
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn i { font-size: 14px; }

.form-input {
  width: 100%; padding: 8px 12px; font-size: 13px; font-family: inherit;
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border-2); border-radius: var(--r-md);
  transition: border .15s, box-shadow .15s;
}
.form-input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(83,74,183,.12); }
.form-input.form-inline { width: auto; min-width: 140px; }
textarea.form-input { resize: vertical; min-height: 60px; font-family: inherit; }
.form-label { display: block; font-size: 12px; color: var(--c-text-secondary); margin-bottom: 6px; margin-top: 2px; font-weight: 500; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.grid-form .form-row { display: flex; flex-direction: column; gap: 4px; }
.grid-form .form-row label { font-size: 12px; color: var(--c-text-secondary); font-weight: 500; }
.grid-form .form-row-full { grid-column: 1 / -1; }
.grid-form .form-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
@media (max-width: 600px) {
  .grid-form { grid-template-columns: 1fr; }
}

.table { width: 100%; border-collapse: collapse; }
.table th {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-text-secondary); padding: 10px 20px; text-align: left;
  font-weight: 500; background: var(--c-surface-2);
}
.table td {
  padding: 11px 20px; font-size: 13px; color: var(--c-text);
  border-top: 0.5px solid var(--c-border); vertical-align: middle;
}
.table tbody tr:hover td { background: var(--c-surface-2); }
.cell-with-avatar { display: flex; align-items: center; gap: 9px; }

.status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 3px 9px; border-radius: var(--r-full);
  font-weight: 500;
}
.dot { width: 5px; height: 5px; border-radius: 50%; }
.status.st-new          { background: var(--c-new-bg);         color: var(--c-new); }
.status.st-new .dot     { background: var(--c-new); }
.status.st-contacted    { background: var(--c-contacted-bg);   color: var(--c-contacted); }
.status.st-contacted .dot { background: var(--c-contacted); }
.status.st-contact      { background: var(--c-contacted-bg);   color: var(--c-contacted); }
.status.st-contact .dot { background: var(--c-contacted); }
.status.st-proposal     { background: var(--c-proposal-bg);    color: var(--c-proposal); }
.status.st-proposal .dot { background: var(--c-proposal); }
.status.st-negotiation  { background: var(--c-negotiation-bg); color: var(--c-negotiation); }
.status.st-negotiation .dot { background: var(--c-negotiation); }
.status.st-signed       { background: var(--c-signed-bg);      color: var(--c-signed); }
.status.st-signed .dot  { background: var(--c-signed); }
.status.st-lost         { background: var(--c-lost-bg);        color: var(--c-lost); }
.status.st-lost .dot    { background: var(--c-lost); }
.status.st-pending      { background: var(--c-pending-bg);     color: var(--c-pending); }
.status.st-pending .dot { background: var(--c-pending); }
.status.st-active       { background: var(--c-active-bg);      color: var(--c-active); }
.status.st-active .dot  { background: var(--c-active); }
.status.st-inactive,
.status.st-suspended    { background: var(--c-inactive-bg);    color: var(--c-inactive); }
.status.st-inactive .dot, .status.st-suspended .dot { background: var(--c-inactive); }

.tier { font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: var(--r-full); }
.tier-silver { background: var(--c-silver-bg); color: var(--c-silver); }
.tier-gold { background: var(--c-gold-bg); color: var(--c-gold); }
.tier-platinum { background: var(--c-platinum-bg); color: var(--c-platinum); }
.tier-bg-silver { background: var(--c-silver-bg); color: var(--c-silver); }
.tier-bg-gold { background: var(--c-gold-bg); color: var(--c-gold); }
.tier-bg-platinum { background: var(--c-platinum-bg); color: var(--c-platinum); }

.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: var(--r-full); font-weight: 500;
}
.badge-green { background: var(--c-active-bg); color: var(--c-active); }
.badge-amber { background: var(--c-pending-bg); color: var(--c-pending); }
.badge-blue { background: var(--c-new-bg); color: var(--c-new); }
.badge-count { display: inline-block; background: #ef4444; color: white; font-size: 9px; padding: 1px 5px; border-radius: 99px; margin-left: 6px; min-width: 14px; text-align: center; }
.badge-count:empty { display: none; }
.row-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; margin-right: 8px; vertical-align: 1px;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, .15);
}
tr.row-unseen td { background: rgba(239, 68, 68, .03); }
tr.row-deleted td { color: var(--c-text-muted); }
tr.row-deleted td:first-child .cell-strong { text-decoration: line-through; text-decoration-color: rgba(163, 45, 45, .55); }
tr.row-deleted td:first-child .cell-strong .badge-deleted { text-decoration: none; }
.badge-deleted {
  display: inline-block; background: var(--c-lost-bg); color: var(--c-lost);
  font-size: 9px; font-weight: 700; padding: 2px 7px;
  border-radius: 4px; letter-spacing: .04em; vertical-align: 2px;
  margin-right: 4px;
}

/* ── Danger button ────────────────────────────────────────────────────────── */
.btn-danger {
  background: transparent; color: var(--c-lost);
  border: 0.5px solid var(--c-border);
}
.btn-danger:hover:not(:disabled) { background: var(--c-lost-bg); border-color: var(--c-lost); }
.btn-danger:disabled, .btn:disabled {
  opacity: .45; cursor: not-allowed;
}

/* ── Tooltip (data-tooltip on disabled buttons) ──────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a; color: #fff;
  padding: 6px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 400; white-space: nowrap;
  max-width: 280px; white-space: normal; min-width: 180px;
  text-align: center; line-height: 1.4; z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
[data-tooltip]:hover::before {
  content: ''; position: absolute;
  bottom: calc(100% + 2px); left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: #1a1a1a;
  pointer-events: none; z-index: 9999;
}

/* ── Modal (delete-lead with reason) ─────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(20, 20, 30, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--c-surface); border-radius: var(--r-lg);
  width: 100%; max-width: 460px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 0.5px solid var(--c-border);
}
.modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-close {
  background: transparent; border: 0; cursor: pointer;
  color: var(--c-text-muted); padding: 4px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--c-bg); color: var(--c-text); }
.modal-body { padding: 18px 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; background: var(--c-surface-2);
  border-top: 0.5px solid var(--c-border);
}

/* ── Lead chat (WhatsApp-style) ──────────────────────────────────────────── */
.chat-wrap { display: flex; flex-direction: column; max-height: 480px; }
.chat-thread {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  background: var(--c-surface-2);
  display: flex; flex-direction: column; gap: 8px;
}
.chat-thread .empty { background: transparent; }
.chat-msg { max-width: 78%; display: flex; flex-direction: column; }
.chat-msg-bubble {
  padding: 8px 12px; border-radius: 12px; font-size: 13.5px;
  line-height: 1.45; word-wrap: break-word; white-space: pre-wrap;
}
.chat-msg-meta {
  font-size: 10px; color: var(--c-text-muted);
  margin-top: 3px; padding: 0 4px;
}
.chat-msg-mine { align-self: flex-end; align-items: flex-end; }
.chat-msg-mine .chat-msg-bubble {
  background: #dcf8c6; color: #1a1a1a;
  border-bottom-right-radius: 4px;
}
.chat-msg-them { align-self: flex-start; align-items: flex-start; }
.chat-msg-them .chat-msg-bubble {
  background: var(--c-surface); color: var(--c-text);
  border: 0.5px solid var(--c-border);
  border-bottom-left-radius: 4px;
}
.chat-input {
  display: flex; gap: 8px; padding: 12px 16px;
  background: var(--c-surface); border-top: 0.5px solid var(--c-border);
}
.chat-input textarea {
  flex: 1; resize: none; min-height: 38px; max-height: 100px;
  padding: 8px 12px; border: 1px solid var(--c-border);
  border-radius: 20px; font-size: 13.5px; font-family: inherit;
  outline: none; line-height: 1.4;
}
.chat-input textarea:focus { border-color: var(--c-primary); }
.chat-input button {
  border: 0; background: var(--c-primary); color: #fff;
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.chat-input button:disabled { background: var(--c-border); cursor: not-allowed; }
.chat-input { align-items: flex-end; }
.chat-attach-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: transparent; border: 1px solid var(--c-border); color: var(--c-text-secondary);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  flex-shrink: 0; transition: background .12s, color .12s, border-color .12s;
}
.chat-attach-btn:hover { background: var(--c-surface-2); color: var(--c-primary); border-color: var(--c-primary); }
.chat-attach-btn i { font-size: 17px; }

.chat-file-preview { display: flex; flex-direction: column; gap: 4px; }
.chat-file-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; background: var(--c-surface-2);
  border: 0.5px solid var(--c-border); border-radius: var(--r-md);
  font-size: 12px; color: var(--c-text);
}
.chat-file-chip i { color: var(--c-text-muted); font-size: 13px; }
.chat-file-chip > span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file-chip .sz { flex: 0; color: var(--c-text-muted); font-size: 11px; }

/* Attachments rendered inside chat bubbles */
.chat-msg-attachments { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.chat-msg-mine .chat-msg-attachments { align-items: flex-end; }
.chat-att {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px; font-size: 12px;
  text-decoration: none; max-width: 100%; min-width: 200px;
  transition: filter .12s;
}
.chat-att:hover { text-decoration: none; filter: brightness(.95); }
.chat-msg-mine .chat-att { background: #c8edaa; color: #1a1a1a; }
.chat-msg-them .chat-att { background: var(--c-surface); border: 0.5px solid var(--c-border); color: var(--c-text); }
.chat-att i { font-size: 14px; flex-shrink: 0; }
.chat-att-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.chat-att-size { color: var(--c-text-muted); font-size: 11px; flex-shrink: 0; }
.chat-readonly {
  padding: 10px 16px; background: var(--c-pending-bg); color: var(--c-pending);
  font-size: 12px; text-align: center; border-top: 0.5px solid var(--c-border);
}

/* New-message highlight: section ring pulse + bubble glow */
.section.chat-pulse {
  box-shadow: 0 0 0 3px rgba(83, 74, 183, .35), 0 0 24px rgba(83, 74, 183, .25);
  transition: box-shadow .4s ease-out;
}
.chat-msg.chat-msg-new .chat-msg-bubble {
  animation: chatNewPulse 2s ease-out 1;
  box-shadow: 0 0 0 0 rgba(83, 74, 183, .55);
}
@keyframes chatNewPulse {
  0%   { box-shadow: 0 0 0 0   rgba(83, 74, 183, .55); transform: scale(1); }
  20%  { box-shadow: 0 0 0 8px rgba(83, 74, 183, .35); transform: scale(1.02); }
  100% { box-shadow: 0 0 0 0   rgba(83, 74, 183, 0);   transform: scale(1); }
}

/* Banner alert linking down to chat */
.alert-chat-new { cursor: pointer; transition: filter .12s; }
.alert-chat-new:hover { filter: brightness(.96); text-decoration: none; }
.alert-chat-new i { font-size: 16px; vertical-align: -3px; margin-right: 4px; }

.action-btns { display: flex; gap: 6px; }

.alert { padding: 10px 14px; border-radius: var(--r-md); font-size: 13px; line-height: 1.45; }
.alert i { vertical-align: -2px; margin-right: 4px; }
.alert a { color: inherit; text-decoration: underline; font-weight: 500; }
.alert-error   { background: var(--c-lost-bg);    color: var(--c-lost); border-left: 3px solid var(--c-lost); }
.alert-success { background: var(--c-active-bg);  color: var(--c-active); border-left: 3px solid var(--c-active); }
.alert-warn,
.alert-warning { background: var(--c-pending-bg); color: var(--c-pending); border-left: 3px solid var(--c-pending); }
.alert-info    { background: var(--c-new-bg);     color: var(--c-new);     border-left: 3px solid var(--c-new); }

.flash {
  position: fixed; top: 14px; right: 14px; z-index: 1000;
  padding: 10px 16px; border-radius: var(--r-md); font-size: 13px;
  box-shadow: var(--shadow-lg); max-width: 380px;
  animation: flashIn .3s ease-out;
}
.flash-error   { background: #fff; color: var(--c-lost); border-left: 3px solid var(--c-lost); }
.flash-success { background: #fff; color: var(--c-active); border-left: 3px solid var(--c-active); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } }

.notif-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 20px; border-top: 0.5px solid var(--c-border);
  font-size: 13px;
}
.notif-row:first-child { border-top: none; }
.notif-row.unread { background: var(--c-primary-light); }
a.notif-row { color: inherit; text-decoration: none; transition: background .12s; }
a.notif-row:hover { background: var(--c-surface-2); text-decoration: none; }
a.notif-row.unread:hover { background: var(--c-primary-light); filter: brightness(.97); }
.notif-cta { font-size: 11px; color: var(--c-primary); margin-top: 4px; font-weight: 500; }
.notif-cta i { font-size: 12px; vertical-align: -2px; }
.notif-body { flex: 1; min-width: 0; }
.notif-icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.icon-green { background: var(--c-active-bg); color: var(--c-active); }
.icon-blue { background: var(--c-new-bg); color: var(--c-new); }
.icon-amber { background: var(--c-pending-bg); color: var(--c-pending); }
.icon-purple { background: var(--c-proposal-bg); color: var(--c-proposal); }
.notif-title { font-weight: 500; color: var(--c-text); margin-bottom: 2px; }
.notif-sub { color: var(--c-text-secondary); font-size: 12px; }
.notif-time { font-size: 10px; color: var(--c-text-muted); margin-left: auto; white-space: nowrap; }

.comm-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-top: 0.5px solid var(--c-border);
  font-size: 13px;
}
.comm-row span { color: var(--c-text-secondary); }
.comm-row strong { color: var(--c-text); }

.def-list {
  display: grid; grid-template-columns: 180px 1fr; gap: 12px 18px;
}
.def-list dt { color: var(--c-text-secondary); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.def-list dd { color: var(--c-text); font-size: 14px; }

/* ── Timeline (CRM-style, light) ──────────────────────────────────────────── */
.tl-wrap { padding: 8px 20px 20px; }
.tl-count {
  font-size: 11px; background: var(--c-surface-2); border: 0.5px solid var(--c-border);
  border-radius: 99px; padding: 2px 10px; color: var(--c-text-secondary);
}
.tl-create { display: flex; align-items: center; gap: 10px; padding: 12px 0 4px; }
.tl-create-label { font-size: 11px; color: var(--c-text-muted); white-space: nowrap; }
.tl-create-line { height: 1px; flex: 1; background: var(--c-border); }

.tl-item { display: flex; gap: 0; position: relative; }
.tl-left { display: flex; flex-direction: column; align-items: center; width: 44px; flex-shrink: 0; }
.tl-dot-wrap { padding-top: 16px; }
.tl-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; line-height: 1; flex-shrink: 0;
  border: 2px solid transparent;
}
.tl-dot i { font-size: 17px; line-height: 1; display: block; }
.tl-line { width: 1.5px; flex: 1; min-height: 16px; background: var(--c-border); margin-top: 6px; }
.tl-item:last-child .tl-line { display: none; }
.tl-content { flex: 1; padding: 14px 0 20px 12px; }
.tl-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.tl-arrow { display: flex; align-items: center; gap: 5px; }
.tl-arrow-icon { color: var(--c-text-muted); font-size: 12px; }
.tl-meta { display: flex; align-items: center; gap: 10px; }
.tl-who { font-size: 12px; font-weight: 500; color: var(--c-text); }
.tl-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--c-border-2); }
.tl-when { font-size: 12px; color: var(--c-text-secondary); }
.tl-note {
  margin-top: 6px; font-size: 12px; color: var(--c-text-secondary);
  background: var(--c-surface-2); border: 0.5px solid var(--c-border);
  border-left: 2px solid var(--c-border-2);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 8px 12px; line-height: 1.5;
}
.tl-note.is-signed { border-left-color: var(--c-signed); }
.tl-note.is-lost   { border-left-color: var(--c-lost); }
.tl-commission {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; background: var(--c-signed-bg); color: var(--c-signed);
  border-radius: var(--r-md); padding: 6px 12px; font-weight: 500;
}
.tl-commission strong { font-weight: 700; }

/* Mini status badges (used in timeline header for from→to) */
.tl-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 99px;
  white-space: nowrap;
}
.tl-badge .dot-sm { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.tl-badge-new          { background: var(--c-new-bg); color: var(--c-new); }
.tl-badge-new .dot-sm  { background: var(--c-new); }
.tl-badge-contacted          { background: var(--c-contacted-bg); color: var(--c-contacted); }
.tl-badge-contacted .dot-sm  { background: var(--c-contacted); }
.tl-badge-proposal          { background: var(--c-proposal-bg); color: var(--c-proposal); }
.tl-badge-proposal .dot-sm  { background: var(--c-proposal); }
.tl-badge-negotiation          { background: var(--c-negotiation-bg); color: var(--c-negotiation); }
.tl-badge-negotiation .dot-sm  { background: var(--c-negotiation); }
.tl-badge-signed          { background: var(--c-signed-bg); color: var(--c-signed); }
.tl-badge-signed .dot-sm  { background: var(--c-signed); }
.tl-badge-lost          { background: var(--c-lost-bg); color: var(--c-lost); }
.tl-badge-lost .dot-sm  { background: var(--c-lost); }

/* Colored circle icons (the dot in tl-left) */
.tl-dot-new          { background: var(--c-new-bg);          border-color: var(--c-new);          color: var(--c-new); }
.tl-dot-contacted    { background: var(--c-contacted-bg);    border-color: var(--c-contacted);    color: var(--c-contacted); }
.tl-dot-proposal     { background: var(--c-proposal-bg);     border-color: var(--c-proposal);     color: var(--c-proposal); }
.tl-dot-negotiation  { background: var(--c-negotiation-bg);  border-color: var(--c-negotiation);  color: var(--c-negotiation); }
.tl-dot-signed       { background: var(--c-signed-bg);       border-color: var(--c-signed);       color: var(--c-signed); }
.tl-dot-lost         { background: var(--c-lost-bg);         border-color: var(--c-lost);         color: var(--c-lost); }

/* ── Lead reference code badge (WB-LEAD-{id}) ───────────────────────────── */
.lead-ref {
  display: inline-block;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px; font-weight: 600;
  color: var(--c-text-secondary);
  background: var(--c-surface-2);
  padding: 3px 8px; border-radius: 4px;
  letter-spacing: .03em;
  white-space: nowrap;
}

/* ── Language badge (partner request origin) ────────────────────────────── */
.lang-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 99px;
  background: var(--c-surface-2); color: var(--c-text-secondary);
  border: 0.5px solid var(--c-border);
  letter-spacing: .05em;
}
.lang-es { background: #ffe8e8; color: #a32d2d; border-color: #ffc0c0; }
.lang-en { background: #e8efff; color: #185FA5; border-color: #c0d6ff; }
.lang-it { background: #e8f7ee; color: #3B6D11; border-color: #c0e8c8; }

/* ── Sortable table headers ──────────────────────────────────────────────── */
.sortable-th {
  display: inline-flex; align-items: center; gap: 4px;
  color: inherit; text-decoration: none;
  font: inherit; padding: 0; cursor: pointer;
  transition: color .12s;
}
.sortable-th i { font-size: 13px; opacity: .35; transition: opacity .12s; }
.sortable-th:hover { color: var(--c-primary); text-decoration: none; }
.sortable-th:hover i { opacity: .85; }
.sortable-th.active { color: var(--c-primary); }
.sortable-th.active i { opacity: 1; }

/* ── Search bar (leads list) ─────────────────────────────────────────────── */
.search-bar { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; align-items: center; }
.search-input-wrap {
  position: relative; flex: 1; min-width: 200px; max-width: 360px;
}
.search-input-wrap > i {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--c-text-muted); font-size: 14px; pointer-events: none;
}
.search-input-wrap input { padding-left: 32px; padding-right: 30px; }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--c-surface-2); color: var(--c-text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; transition: background .12s, color .12s;
}
.search-clear:hover { background: var(--c-lost-bg); color: var(--c-lost); text-decoration: none; }
/* Mobile: full-width search + stacked dropdowns instead of cramped flex row */
@media (max-width: 600px) {
  .search-bar { flex-direction: column; align-items: stretch; gap: 6px; }
  .search-input-wrap { max-width: none; min-width: 0; width: 100%; }
  .search-bar select, .search-bar .btn { width: 100%; }
}

/* ── Dashboard analytics — bar chart + mini-bars + ranks ─────────────────── */
.analytics-row { margin-bottom: 22px; }
.analytics-trend { padding: 0; }
.bar-chart {
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: 6px; padding: 22px 22px 14px;
  height: 200px; align-items: end;
}
.bar-col { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 6px; }
.bar-bar {
  position: relative; width: 100%; max-width: 32px;
  background: linear-gradient(180deg, var(--c-primary) 0%, #6b5fd1 100%);
  border-radius: 4px 4px 0 0; min-height: 2px;
  transition: opacity .12s; cursor: pointer;
}
.bar-bar:hover { opacity: .85; }
.bar-bar.is-current { background: linear-gradient(180deg, #00b894 0%, #00d4a8 100%); }
.bar-val {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 600; color: var(--c-text);
}
.bar-label { font-size: 10px; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* Mini bar (used in per-service conversion table) */
.mini-bar {
  height: 6px; background: rgba(83, 74, 183, .12);
  border-radius: 99px; overflow: hidden;
}
.mini-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--c-primary), #6b5fd1);
  border-radius: 99px;
}
.mini-bar-val { font-size: 11px; color: var(--c-text-secondary); margin-top: 2px; font-weight: 500; }

/* Ranking badge (top partners) */
.rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 11px; font-weight: 700;
  background: var(--c-surface-2); color: var(--c-text-secondary);
}
.rank-1 { background: #FFD700; color: #5C4B00; }
.rank-2 { background: #C0C0C0; color: #333; }
.rank-3 { background: #CD7F32; color: #fff; }

@media (max-width: 768px) {
  .bar-chart { padding: 18px 12px 10px; height: 160px; gap: 4px; }
  .bar-label { font-size: 9px; }
  .bar-val { font-size: 9px; }
}

/* ── Partner onboarding checklist ───────────────────────────────────────── */
.onb-card {
  background: linear-gradient(135deg, #EEEDFE 0%, #FAFAFA 100%);
  border: 0.5px solid var(--c-border); border-radius: var(--r-lg);
  padding: 20px 22px; margin-bottom: 22px;
  box-shadow: 0 1px 3px rgba(83, 74, 183, .05);
}
.onb-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 18px; margin-bottom: 16px; flex-wrap: wrap;
}
.onb-title { font-size: 16px; font-weight: 700; color: var(--c-text); margin-bottom: 4px; }
.onb-sub { font-size: 13px; color: var(--c-text-secondary); }
.onb-progress-wrap { min-width: 160px; }
.onb-progress-bar { height: 6px; background: rgba(83, 74, 183, .15); border-radius: 99px; overflow: hidden; }
.onb-progress-bar span { display: block; height: 100%; background: var(--c-primary); border-radius: 99px; transition: width .4s; }
.onb-progress-text { font-size: 11px; color: var(--c-text-secondary); text-align: right; margin-top: 4px; font-weight: 500; }

.onb-steps { display: flex; flex-direction: column; gap: 6px; }
.onb-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  background: rgba(255,255,255,.55); border: 0.5px solid transparent;
  transition: background .12s;
}
.onb-step.done {
  background: var(--c-active-bg); border-color: rgba(59, 109, 17, .25);
  opacity: .85;
}
.onb-step.pending { border-color: var(--c-border); background: #fff; }
.onb-step.pending:hover { border-color: var(--c-primary); background: rgba(255,255,255,1); }
.onb-step-icon {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.onb-step.done .onb-step-icon { background: var(--c-signed); color: white; }
.onb-step.pending .onb-step-icon { background: var(--c-surface-2); color: var(--c-text-muted); border: 1px dashed var(--c-border); }
.onb-step-label { flex: 1; font-size: 13.5px; color: var(--c-text); font-weight: 500; }
.onb-step.done .onb-step-label { text-decoration: line-through; color: var(--c-text-secondary); font-weight: 400; }
.onb-step-cta {
  font-size: 12px; font-weight: 600; color: var(--c-primary);
  text-decoration: none; padding: 4px 10px; border-radius: 6px;
  background: var(--c-new-bg); transition: background .12s;
  white-space: nowrap;
}
.onb-step-cta:hover { background: rgba(83, 74, 183, .15); text-decoration: none; }

@media (max-width: 600px) {
  .onb-card { padding: 16px; }
  .onb-header { flex-direction: column; gap: 12px; }
  .onb-progress-wrap { width: 100%; min-width: 0; }
  .onb-step { padding: 12px 10px; }
  .onb-step-cta { padding: 8px 12px; }
}

/* ── Partner-grouped payment blocks (admin commissions) ────────────────── */
.pay-partner-block { border-bottom: 6px solid var(--c-bg); }
.pay-partner-block:last-child { border-bottom: none; }
.pay-partner-head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 20px;
  background: linear-gradient(180deg, var(--c-surface-2) 0%, #f0f0f6 100%);
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
}
.pay-partner-block:first-of-type .pay-partner-head { border-top: none; }
.pay-partner-id { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.pay-partner-name { font-weight: 600; font-size: 14px; color: var(--c-text); }
.pay-partner-iban {
  font-family: "SF Mono", Menlo, monospace; font-size: 11px;
  color: var(--c-text-secondary); margin-top: 3px; letter-spacing: .04em;
}
.pay-partner-iban.missing { color: var(--c-lost); font-family: inherit; letter-spacing: 0; }
.pay-partner-totals { text-align: right; flex-shrink: 0; }
.pay-partner-subtotal-lbl { font-size: 10px; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .05em; }
.pay-partner-subtotal-val { font-size: 18px; font-weight: 700; color: var(--c-primary); margin-top: 2px; }

@media (max-width: 600px) {
  .pay-partner-head { flex-direction: column; align-items: flex-start; padding: 14px 16px; }
  .pay-partner-totals { text-align: left; width: 100%; padding-top: 6px; border-top: 0.5px dashed var(--c-border); }
}

/* ── Payment schedule (commissions page) ─────────────────────────────────── */
.pay-schedule { display: flex; flex-direction: column; }
.pay-row {
  display: grid; grid-template-columns: 72px 1fr auto;
  align-items: center; gap: 16px;
  padding: 14px 20px;
  border-top: 0.5px solid var(--c-border);
  transition: background .12s;
}
.pay-row:first-child { border-top: none; }
.pay-row:hover { background: var(--c-surface-2); }
.pay-date {
  width: 60px; padding: 10px 6px;
  border-radius: var(--r-md);
  background: var(--c-bg); border: 0.5px solid var(--c-border);
  text-align: center; line-height: 1.1;
}
.pay-date-day { font-size: 22px; font-weight: 700; color: var(--c-text); }
.pay-date-mon { font-size: 10px; text-transform: uppercase; color: var(--c-text-muted); letter-spacing: .05em; margin-top: 2px; }
.pay-body { min-width: 0; }
.pay-company { font-size: 14px; font-weight: 600; color: var(--c-text); }
.pay-service { font-size: 12px; margin-top: 2px; }
.pay-eta { font-size: 12px; margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; color: var(--c-text-secondary); }
.pay-eta i { font-size: 13px; }
.pay-amount { font-size: 18px; font-weight: 700; color: var(--c-text); white-space: nowrap; }

.pay-upcoming .pay-date { background: var(--c-new-bg); border-color: var(--c-new); }
.pay-upcoming .pay-date-day { color: var(--c-new); }
.pay-upcoming .pay-eta { color: var(--c-new); }

.pay-today .pay-date { background: var(--c-pending-bg); border-color: var(--c-pending); }
.pay-today .pay-date-day { color: var(--c-pending); }
.pay-today .pay-eta { color: var(--c-pending); font-weight: 500; }

.pay-overdue .pay-date { background: var(--c-lost-bg); border-color: var(--c-lost); }
.pay-overdue .pay-date-day { color: var(--c-lost); }
.pay-overdue .pay-eta { color: var(--c-lost); font-weight: 500; }
.pay-overdue .pay-amount { color: var(--c-lost); }

.pay-paid .pay-date { background: var(--c-signed-bg); border-color: var(--c-signed); }
.pay-paid .pay-date-day { color: var(--c-signed); }
.pay-paid .pay-eta { color: var(--c-signed); }

/* ── Mini rich-text editor ───────────────────────────────────────────────── */
.rt-wrap {
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-surface); overflow: hidden;
}
.rt-toolbar {
  display: flex; gap: 2px; padding: 6px 8px;
  background: var(--c-surface-2); border-bottom: 0.5px solid var(--c-border);
}
.rt-toolbar button {
  width: 30px; height: 28px; border: 0; background: transparent;
  border-radius: 4px; color: var(--c-text-secondary);
  cursor: pointer; font-size: 14px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.rt-toolbar button:hover { background: rgba(0,0,0,.06); color: var(--c-text); }
.rt-toolbar button i { font-size: 16px; }
.rt-toolbar .rt-sep { width: 1px; height: 18px; background: var(--c-border); margin: 5px 4px; }
.rt-editor {
  min-height: 140px; max-height: 360px; overflow-y: auto;
  padding: 12px 14px; font-size: 14px; line-height: 1.55;
  color: var(--c-text); outline: none;
}
.rt-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--c-text-muted); pointer-events: none;
}
.rt-editor p { margin: 0 0 8px; }
.rt-editor p:last-child { margin-bottom: 0; }
.rt-editor ul, .rt-editor ol { margin: 6px 0 8px; padding-left: 22px; }
.rt-editor a { color: var(--c-primary); text-decoration: underline; }

/* Render output (read-only display) */
.rt-output { font-size: 14px; line-height: 1.6; color: var(--c-text); }
.rt-output p { margin: 0 0 8px; }
.rt-output p:last-child { margin-bottom: 0; }
.rt-output ul, .rt-output ol { margin: 6px 0 8px; padding-left: 22px; }
.rt-output a { color: var(--c-primary); text-decoration: underline; }

/* ── File drop zone ──────────────────────────────────────────────────────── */
.file-drop {
  border: 1.5px dashed var(--c-border); border-radius: var(--r-md);
  padding: 22px 18px; text-align: center; background: var(--c-surface-2);
  transition: background .15s, border-color .15s;
  cursor: default;
}
.file-drop.drop-hover { background: var(--c-new-bg); border-color: var(--c-new); }
.file-drop-prompt { color: var(--c-text-secondary); font-size: 13px; margin-bottom: 6px; }
.file-drop-prompt i { font-size: 28px; display: block; margin: 0 auto 8px; color: var(--c-text-muted); }
.file-drop-or { font-size: 11px; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .05em; margin: 6px 0; }
.file-drop-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; background: var(--c-surface); border: 0.5px solid var(--c-border);
  border-radius: var(--r-md); font-size: 13px; color: var(--c-text);
  cursor: pointer; transition: background .12s;
}
.file-drop-btn:hover { background: var(--c-bg); }
.file-drop input[type="file"] { display: none; }
.file-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; text-align: left; }
.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--c-surface);
  border: 0.5px solid var(--c-border); border-radius: var(--r-md);
  font-size: 13px;
}
.file-row > i { color: var(--c-text-secondary); flex-shrink: 0; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text); }
.file-size { color: var(--c-text-muted); font-size: 12px; }
.file-remove {
  border: 0; background: transparent; color: var(--c-text-muted); cursor: pointer;
  width: 24px; height: 24px; border-radius: 4px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.file-remove:hover { background: var(--c-lost-bg); color: var(--c-lost); }

/* File list (read-only — admin/partner viewing lead) */
.file-list-readonly .file-row { background: var(--c-surface); }
.file-list-readonly .file-row a {
  margin-left: auto; padding: 4px 10px;
  background: var(--c-surface-2); border: 0.5px solid var(--c-border);
  border-radius: var(--r-md); font-size: 12px; color: var(--c-text);
  text-decoration: none;
}
.file-list-readonly .file-row a:hover { background: var(--c-bg); text-decoration: none; }

/* Contact preference pills */
.pref-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pref-pills label {
  cursor: pointer; padding: 6px 12px; font-size: 12px;
  background: var(--c-surface); border: 0.5px solid var(--c-border);
  border-radius: 99px; color: var(--c-text-secondary);
  display: inline-flex; align-items: center; gap: 5px;
  transition: all .12s;
}
.pref-pills label:hover { background: var(--c-surface-2); color: var(--c-text); }
.pref-pills input[type="radio"] { display: none; }
.pref-pills input[type="radio"]:checked + label,
.pref-pills label:has(input[type="radio"]:checked) {
  background: var(--c-new-bg); color: var(--c-new); border-color: var(--c-new);
}

.filter-tabs { display: flex; gap: 4px; }
.filter-tabs a {
  padding: 6px 14px; font-size: 12px; border-radius: var(--r-md);
  color: var(--c-text-secondary); text-decoration: none;
}
.filter-tabs a:hover { background: var(--c-bg); }
.filter-tabs a.active { background: var(--c-primary); color: white; }
