/* ---------- Grid dashboard ---------- */
.grid{display:grid;gap:18px}
.grid-dash{grid-template-columns:repeat(12,1fr)}
.col-3{grid-column:span 3}
.col-4{grid-column:span 4}
.col-5{grid-column:span 5}
.col-6{grid-column:span 6}
.col-7{grid-column:span 7}
.col-8{grid-column:span 8}
.col-12{grid-column:span 12}
@media (max-width:1200px){
  .grid-dash{grid-template-columns:repeat(6,1fr)}
  .grid-dash .col-3{grid-column:span 3}
  .grid-dash .col-4,.grid-dash .col-5,.grid-dash .col-7,.grid-dash .col-8{grid-column:span 6}
  .grid-dash .col-6{grid-column:span 6}
}
@media (max-width:640px){
  .grid-dash{grid-template-columns:1fr}
  .grid-dash>*{grid-column:1/-1!important}
}

/* ---------- Bar chart ---------- */
.bars{display:flex;align-items:flex-end;gap:10px;height:150px;position:relative;margin-top:8px}
.bar-col{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;gap:8px;position:relative}
.bar{
  width:100%;border-radius:6px 6px 3px 3px;background:var(--line);
  transition:height .3s ease;
}
.bar.hatch{
  background:var(--ink);
}
.bar-tag{
  position:absolute;top:-30px;background:var(--ink);color:#fff;font-size:11px;font-weight:600;
  padding:4px 9px;border-radius:var(--pill);white-space:nowrap;
}
.bar-x{font-size:var(--text-xs);color:var(--muted)}

/* ---------- Line / area chart ---------- */
.line-chart{width:100%;height:150px;position:relative;margin-top:6px}
.line-chart svg{width:100%;height:100%;overflow:visible}
.line-chart .yr{position:absolute;font-size:11px;color:var(--muted)}
.line-chart .yr.top{top:0;left:0}
.line-chart .yr.bottom{bottom:14px;left:0}
.chart-tag{
  position:absolute;background:var(--ink);color:#fff;font-size:11px;font-weight:700;
  padding:4px 9px;border-radius:var(--radius-sm);transform:translate(-50%,-140%);white-space:nowrap;
}
.chart-x{display:flex;justify-content:space-between;margin-top:6px;font-size:11.5px;color:var(--muted)}

/* ---------- Sparkline ---------- */
.spark{width:100%;height:70px}

/* ---------- Split percent bars ---------- */
.split-row{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;background:var(--surface-2);border-radius:var(--radius-md);margin-top:8px}
.card-white .split-row{background:var(--surface)}
.split-row .lbl{font-size:13.5px;color:var(--muted);font-weight:500}
.split-row .val{font-weight:700;font-size:14px}

/* ---------- Heatmap (orders by channel) ---------- */
.heat-grid{display:grid;grid-template-columns:repeat(9,1fr);gap:6px;flex:1}
.heat-cell{aspect-ratio:1;border-radius:6px;background:var(--line)}
.heat-row{display:flex;align-items:center;gap:14px;margin-bottom:10px}
.heat-label{width:70px;font-size:12.5px;color:var(--muted);flex:0 0 auto}

/* ---------- Funnel ---------- */
.funnel-bars{display:flex;align-items:flex-end;gap:14px;height:170px;margin-top:10px}
.funnel-col{flex:1;display:flex;flex-direction:column;align-items:center;gap:8px;height:100%;justify-content:flex-end}
.funnel-bar{width:100%;border-radius:12px 12px 4px 4px;background:var(--line)}
.funnel-bar.on{background:var(--ink)}
.funnel-count{font-size:12px;font-weight:700}
.funnel-stage{font-size:11.5px;color:var(--muted);text-align:center}

/* ---------- Modal ---------- */
.overlay{
  position:fixed;inset:0;background:rgba(12,12,10,.5);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);
  display:flex;align-items:center;justify-content:center;
  z-index:100;padding:20px;opacity:0;pointer-events:none;transition:opacity .2s ease;
}
.overlay.open{opacity:1;pointer-events:auto}
.modal{
  background:var(--surface-2);border-radius:var(--radius-xl);padding:28px;width:100%;max-width:460px;
  max-height:88vh;overflow-y:auto;transform:translateY(14px) scale(.98);transition:transform .22s cubic-bezier(.16,1,.3,1);
  box-shadow:var(--shadow-lg);
}
.overlay.open .modal{transform:translateY(0) scale(1)}
.modal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;padding-bottom:16px;border-bottom:1px solid var(--line)}
.modal-head h3{font-size:var(--text-lg);font-weight:600;letter-spacing:-.01em}
.field{margin-bottom:14px}
.field label{display:block;font-size:12.5px;color:var(--muted);margin-bottom:6px;font-weight:500}
.field input,.field select,.field textarea{
  width:100%;padding:11px 14px;border-radius:var(--radius-sm);border:1.5px solid var(--line);background:var(--surface-3);
  outline:none;color:var(--text);transition:border-color .15s ease, box-shadow .15s ease;
}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--ink);box-shadow:0 0 0 3px rgba(17,26,51,.12)}
.field-row{display:flex;gap:12px}
.field-row .field{flex:1}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}

/* ---------- Table ---------- */
.table-wrap{overflow-x:auto}
table.crm-table{width:100%;border-collapse:collapse;font-size:13.5px}
.crm-table th{
  text-align:left;color:var(--muted);font-weight:500;font-size:12.5px;padding:10px 14px;border-bottom:1px solid var(--line);
  white-space:nowrap;
}
.crm-table td{padding:14px;border-bottom:1px solid var(--line);vertical-align:middle}
.crm-table tr:last-child td{border-bottom:none}
.crm-table tr.row-clickable{cursor:pointer}
.crm-table tr.row-clickable:hover{background:rgba(0,0,0,.02)}
.cell-name{display:flex;align-items:center;gap:10px;font-weight:500}
.cell-name-txt{display:flex;flex-direction:column;gap:1px;min-width:0}
.cell-name-txt b{font-weight:500;font-size:var(--text-base);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cell-name-txt span{font-size:var(--text-xs);color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row-actions{display:flex;gap:6px;justify-content:flex-end}
.th-check{width:36px}

/* ---------- Avatars (initials) ---------- */
.avatar{border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:600;flex:0 0 auto}
.avatar-28,.avatar-36,.avatar-46{box-shadow:inset 0 0 0 1px rgba(255,255,255,.18)}
.avatar-28{width:28px;height:28px;font-size:11px}
.avatar-36{width:36px;height:36px;font-size:12.5px}
.avatar-46{width:46px;height:46px;font-size:14px}

/* ---------- Lead cards (Works Space style) ---------- */
.lead-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(270px,1fr));gap:16px}
.lead-card{
  position:relative;isolation:isolate;overflow:hidden;
  background:linear-gradient(150deg, rgba(255,255,255,.58), rgba(255,255,255,.32));
  backdrop-filter:blur(20px) saturate(1.6);-webkit-backdrop-filter:blur(20px) saturate(1.6);
  border-radius:var(--radius-2xl);padding:20px;border:1px solid rgba(255,255,255,.55);
  box-shadow:0 10px 34px rgba(30,20,60,.09), inset 0 1px 0 rgba(255,255,255,.7), inset 0 0 0 1px rgba(255,255,255,.12);
  transition:transform .18s cubic-bezier(.2,.8,.3,1),box-shadow .18s ease,background .18s ease;
}
.lead-card::before{
  content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;pointer-events:none;
  background:linear-gradient(165deg, rgba(255,255,255,.45) 0%, rgba(255,255,255,0) 45%);
}
.lead-card:hover{
  transform:translateY(-2px);
  background:linear-gradient(150deg, rgba(255,255,255,.7), rgba(255,255,255,.4));
  box-shadow:0 16px 40px rgba(30,20,60,.14), inset 0 1px 0 rgba(255,255,255,.8), inset 0 0 0 1px rgba(255,255,255,.16);
}
.lead-card.selected{background:linear-gradient(150deg, rgba(255,255,255,.85), rgba(255,255,255,.6));border:1px solid var(--ink)}
html[data-theme="dark"] .lead-card{
  background:linear-gradient(150deg, rgba(255,255,255,.09), rgba(255,255,255,.02));
  border-color:rgba(255,255,255,.12);
  box-shadow:0 10px 34px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
}
html[data-theme="dark"] .lead-card::before{background:linear-gradient(165deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,0) 45%)}
html[data-theme="dark"] .lead-card:hover{
  background:linear-gradient(150deg, rgba(255,255,255,.14), rgba(255,255,255,.04));
  box-shadow:0 16px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.12);
}
.lead-card-head{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.lead-card-head .info{flex:1;min-width:0}
.lead-card-head .info b{display:block;font-size:14.5px}
.lead-card-head .info span{font-size:12px;color:var(--muted)}
.lead-card.selected .info span{color:var(--muted)}
.lead-card-open{width:34px;height:34px;border-radius:50%;background:var(--surface-2);display:flex;align-items:center;justify-content:center;flex:0 0 auto;border:none}
.lead-card.selected .lead-card-open{background:rgba(255,255,255,.6)}
.lead-next{display:flex;align-items:center;gap:10px;margin-bottom:16px}
.lead-next .ic{width:32px;height:32px;border-radius:9px;background:var(--surface-2);display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.lead-card.selected .lead-next .ic{background:rgba(255,255,255,.7)}
.lead-next .txt b{display:block;font-size:13.5px}
.lead-next .txt span{font-size:11.5px;color:var(--muted);display:flex;align-items:center;gap:6px}
.lead-card.selected .lead-next .txt span{color:var(--muted)}
.lead-foot{display:flex;align-items:center;gap:6px;flex-wrap:wrap;max-width:100%}
.lead-status-select{
  flex:1 1 100px;min-width:0;border-radius:var(--pill);border:none;padding:9px 12px;font-size:12.5px;font-weight:600;background:var(--surface-2);
  appearance:none;text-overflow:ellipsis;
}
.lead-card.selected .lead-status-select{background:rgba(255,255,255,.6)}
.lead-round-btn{width:36px;height:36px;border-radius:50%;background:var(--surface-2);border:none;display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.lead-card.selected .lead-round-btn{background:rgba(255,255,255,.6)}
.lead-round-btn.dark{background:var(--ink);color:#fff}

/* ---------- Toolbar search ---------- */
.search-box{
  flex:1;min-width:180px;display:flex;align-items:center;gap:10px;background:var(--surface-2);
  border-radius:var(--pill);padding:11px 18px;color:var(--muted);
}
.search-box input{border:none;background:transparent;outline:none;flex:1;font-size:14px;color:var(--text)}
.filter-pills{display:flex;gap:8px;flex-wrap:wrap}
.filter-pill{padding:9px 16px;border-radius:var(--pill);background:var(--surface-2);border:none;font-size:13px;font-weight:500;color:var(--muted)}
.filter-pill.active{background:var(--ink);color:#fff}
.view-toggle{display:flex;background:var(--surface-2);border-radius:var(--pill);padding:4px}
.view-toggle button{border:none;background:transparent;border-radius:var(--pill);padding:8px 14px;font-size:13px;font-weight:500;color:var(--muted);display:flex;align-items:center;gap:6px}
.view-toggle button.active{background:var(--ink);color:#fff}

/* ---------- Order timeline ---------- */
.order-row-detail{background:var(--surface-3);border-radius:var(--radius-md);padding:20px;margin:0 0 12px}
.timeline{display:flex;align-items:flex-start;gap:0;padding:10px 4px 4px}
.tl-step{flex:1;position:relative;text-align:center}
.tl-step:not(:last-child)::after{
  content:'';position:absolute;top:11px;left:56%;width:88%;height:2px;background:var(--line);z-index:0;
}
.tl-step.done:not(:last-child)::after{background:var(--ink)}
.tl-dot{
  width:24px;height:24px;border-radius:50%;background:var(--surface-2);border:2px solid var(--line);
  display:flex;align-items:center;justify-content:center;margin:0 auto 10px;position:relative;z-index:1;color:var(--muted);
}
.tl-step.done .tl-dot{background:var(--ink);border-color:var(--ink);color:#fff}
.tl-step.current .tl-dot{background:var(--ink);border-color:var(--text);color:#fff}
.tl-title{font-size:12.5px;font-weight:600}
.tl-date{font-size:11px;color:var(--muted);margin-top:2px}
.order-meta{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:16px;margin-top:20px}
.order-meta .m-lbl{font-size:11.5px;color:var(--muted);margin-bottom:4px}
.order-meta .m-val{font-size:13.5px;font-weight:500}
.order-items{margin-top:16px;border-top:1px solid var(--line);padding-top:14px}
.order-item-row{display:flex;justify-content:space-between;font-size:13px;padding:6px 0;color:var(--text)}
.order-item-row span:last-child{color:var(--muted)}

/* ---------- Kanban (tasks) ---------- */
.kanban{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
@media (max-width:900px){.kanban{grid-template-columns:1fr}}
.kanban-col{background:var(--surface);border-radius:var(--radius-lg);padding:16px;min-height:120px}
.kanban-col-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;padding:0 4px}
.kanban-col-head .tag{font-weight:600;font-size:14px;display:flex;align-items:center;gap:8px}
.kanban-count{background:var(--surface-2);border-radius:var(--pill);padding:2px 10px;font-size:12px;color:var(--muted);font-weight:600}
.task-card{background:var(--surface-2);border-radius:var(--radius-md);padding:14px;margin-bottom:10px;border:1px solid var(--line);transition:background .12s ease}
.task-card:hover{background:var(--surface-3)}
.task-card.done{opacity:.6}
.task-card.done .task-title{text-decoration:line-through}
.task-top{display:flex;align-items:flex-start;gap:10px}
.task-check{
  width:20px;height:20px;border-radius:6px;border:1.6px solid var(--line);flex:0 0 auto;margin-top:1px;
  display:flex;align-items:center;justify-content:center;background:var(--surface-2);
}
.task-check.on{background:var(--ink);border-color:var(--ink);color:#fff}
.task-title{font-size:13.5px;font-weight:500;flex:1}
.task-meta{display:flex;align-items:center;justify-content:space-between;margin-top:10px;padding-left:30px}
.task-due{font-size:11.5px;color:var(--muted);display:flex;align-items:center;gap:5px}
.task-actions{display:flex;gap:4px}
.prio{width:7px;height:7px;border-radius:50%;flex:0 0 auto}
.prio-high{background:var(--danger)}
.prio-med{background:var(--warn)}
.prio-low{background:var(--ok)}

/* ---------- Activity feed ---------- */
.activity-list{display:flex;flex-direction:column;gap:16px;max-height:520px;overflow-y:auto;padding-right:4px}
.activity-item{display:flex;gap:12px}
.activity-dot{width:34px;height:34px;border-radius:50%;background:var(--surface-2);display:flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--text)}
.activity-item .txt{font-size:13.5px}
.activity-item .txt b{font-weight:600}
.activity-item .time{font-size:11.5px;color:var(--muted);margin-top:3px}

/* ---------- Empty state ---------- */
.empty-state{padding:72px 20px;text-align:center;color:var(--muted)}
.empty-state .icon-lg-wrap{
  width:64px;height:64px;border-radius:50%;background:var(--surface-3);margin:0 auto 18px;
  display:flex;align-items:center;justify-content:center;
}
.empty-state .icon-lg{margin:0;color:var(--muted-2);width:26px;height:26px}
.empty-state b{display:block;color:var(--text);font-size:var(--text-md);font-weight:600;margin-bottom:5px}
.empty-state span{font-size:var(--text-sm)}

/* ---------- Toast ---------- */
.toast{
  position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(16px) scale(.96);
  background:var(--ink);color:#fff;padding:12px 20px 12px 16px;border-radius:var(--pill);font-size:13.5px;font-weight:500;
  display:flex;align-items:center;gap:10px;opacity:0;pointer-events:none;
  transition:opacity .25s cubic-bezier(.16,1,.3,1), transform .25s cubic-bezier(.16,1,.3,1);
  z-index:200;box-shadow:var(--shadow-lg);max-width:calc(100vw - 32px);
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0) scale(1)}
.toast .dot{width:8px;height:8px;border-radius:50%;background:var(--ok);flex:0 0 auto;box-shadow:0 0 0 3px rgba(22,163,74,.3)}
.toast .toast-msg{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.toast .toast-action{
  pointer-events:auto;background:rgba(255,255,255,.15);border:none;color:#fff;font-weight:700;
  font-size:13px;padding:5px 12px;border-radius:var(--radius-sm);cursor:pointer;flex:0 0 auto;margin-left:2px;
}
.toast .toast-action:hover{background:rgba(255,255,255,.25)}

/* ---------- Dropdown (customize columns) ---------- */
.dropdown{position:relative}
.dropdown-panel{
  position:absolute;top:calc(100% + 8px);right:0;background:var(--surface-2);border-radius:var(--radius-md);
  padding:10px;box-shadow:0 12px 30px rgba(0,0,0,.12);min-width:190px;z-index:40;display:none;
}
.dropdown-panel.open{display:block}
.dropdown-panel label{display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:13px;border-radius:var(--radius-sm)}
.dropdown-panel .dropdown-item{
  display:flex;align-items:center;gap:10px;width:100%;padding:9px 10px;border-radius:var(--radius-sm);
  background:none;border:none;text-align:left;font-size:13px;color:var(--text);
}
.dropdown-panel .dropdown-item:hover{background:var(--surface)}
.dropdown-panel hr{border:none;border-top:1px solid var(--line);margin:6px 0}
.dropdown-panel label:hover{background:var(--surface)}

/* ============================================================
   Fase 1 — extensiones: toggles sí/no, notificaciones, pedido
   detallado, clientes, chat interno, plantillas, configuración
   ============================================================ */

/* Toggle Sí/No */
.yn-toggle{
  display:inline-flex;align-items:center;gap:7px;border:1.5px solid var(--line);background:var(--surface-3);
  border-radius:var(--pill);padding:7px 12px;font-size:12.5px;font-weight:600;color:var(--muted);
}
.yn-toggle .yn-dot{width:8px;height:8px;border-radius:50%;background:var(--muted-2)}
.yn-toggle.on{background:var(--ok-pale);color:#2f8f34;border-color:transparent}
.yn-toggle.on .yn-dot{background:#2f8f34}

/* Notificaciones */
.notif-panel{
  position:absolute;top:calc(100% + 10px);right:0;background:var(--surface-2);border-radius:var(--radius-md);
  width:320px;max-height:420px;overflow-y:auto;box-shadow:0 16px 40px rgba(0,0,0,.16);z-index:60;display:none;padding:8px;
}
.notif-panel.open{display:block}
.notif-panel-head{display:flex;align-items:center;justify-content:space-between;padding:8px 10px 4px}
.notif-panel-head b{font-size:13.5px}
.notif-panel-head button{font-size:11.5px;color:var(--muted);background:none;border:none}
.notif-item{display:flex;gap:10px;padding:10px;border-radius:var(--radius-sm)}
.notif-item.unread{background:var(--surface-3)}
.notif-item .ic{width:30px;height:30px;border-radius:50%;background:var(--surface);display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.notif-item .txt{font-size:12.5px;line-height:1.35}
.notif-item .time{font-size:11px;color:var(--muted);margin-top:3px}
.notif-empty{padding:26px 10px;text-align:center;color:var(--muted);font-size:12.5px}
.icon-circle .badge-count{
  position:absolute;top:5px;right:5px;background:var(--danger);color:#fff;font-size:9.5px;font-weight:700;
  min-width:15px;height:15px;border-radius:50%;display:flex;align-items:center;justify-content:center;padding:0 3px;
  box-shadow:0 0 0 0 rgba(223,75,79,.55);animation:ug-pulse 2.2s ease-out infinite;
}
@keyframes ug-pulse{
  0%{box-shadow:0 0 0 0 rgba(223,75,79,.45)}
  70%{box-shadow:0 0 0 6px rgba(223,75,79,0)}
  100%{box-shadow:0 0 0 0 rgba(223,75,79,0)}
}

/* User switcher */
.user-chip-wrap{position:relative}
.user-panel{
  position:absolute;top:calc(100% + 10px);right:0;background:var(--surface-2);border-radius:var(--radius-md);
  width:260px;box-shadow:0 16px 40px rgba(0,0,0,.16);z-index:60;display:none;padding:8px;
  border:1px solid var(--line);
}
.user-panel.open{display:block}
.user-panel .u-plan-row{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:8px 10px 10px;
}
.user-panel .u-plan-row .eyebrow{margin:0}
.user-panel .u-plan-row .dot-indicator{font-size:12px;font-weight:600}
.user-panel .u-me-row{display:flex;align-items:center;gap:10px;padding:6px 10px 12px}
.user-panel .u-me-row .u-name{font-size:13.5px;font-weight:600}
.user-panel .u-me-row .u-role{font-size:11.5px;color:var(--muted)}
.user-panel .u-row{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:var(--radius-sm);width:100%;background:none;border:none;text-align:left}
.user-panel .u-row:hover{background:var(--surface)}
.user-panel .u-row.active{background:var(--surface-3)}
.user-panel .u-row-danger{color:var(--danger)}
.user-panel .u-row-danger:hover{background:rgba(217,80,80,.08)}
.user-panel .u-name{font-size:13px;font-weight:600}
.user-panel .u-role{font-size:11px;color:var(--muted)}
.user-panel .u-group-label{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--muted-2);padding:8px 10px 4px}
.user-panel hr{border:none;border-top:1px solid var(--line);margin:6px 0}

/* Página de detalle de pedido */
.order-detail-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:6px}
.order-detail-head h1{font-size:28px;font-weight:600}
.order-grid{display:grid;grid-template-columns:1.6fr 1fr;gap:18px;align-items:start}
@media (max-width:1000px){.order-grid{grid-template-columns:1fr}}
.line-item{display:flex;align-items:center;gap:14px;padding:14px 0;border-bottom:1px solid var(--line)}
.line-item:last-child{border-bottom:none}
.line-item .li-ic{width:44px;height:44px;border-radius:12px;background:var(--surface);display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.line-item .li-info{flex:1;min-width:0}
.line-item .li-info b{display:block;font-size:14px}
.line-item .li-info span{font-size:12px;color:var(--muted)}
.line-item .li-price{font-size:14px;font-weight:600;text-align:right}
.totals-box{margin-top:14px;padding-top:14px;border-top:1px dashed var(--line)}
.totals-row{display:flex;justify-content:space-between;font-size:13.5px;padding:5px 0}
.totals-row.grand{font-weight:700;font-size:15.5px;border-top:1px solid var(--line);margin-top:6px;padding-top:10px}
.totals-row.profit{color:#2f8f34;font-weight:700}

.tl-entries{display:flex;flex-direction:column;gap:0;margin-top:16px}
.tl-day{font-size:11.5px;color:var(--muted);font-weight:600;margin:16px 0 8px;text-transform:uppercase;letter-spacing:.03em}
.tl-entry{display:flex;gap:12px;padding:10px 0}
.tl-entry .tl-ic{width:32px;height:32px;border-radius:50%;background:var(--surface);display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.tl-entry.comment .tl-ic{background:var(--surface-3);color:var(--navy)}
.tl-entry.file .tl-ic{background:var(--info-pale);color:var(--info)}
.tl-entry .tl-body{flex:1;font-size:13px}
.tl-entry .tl-body .who{font-weight:600;font-size:12.5px}
.tl-entry .tl-body .time{font-size:11px;color:var(--muted)}
.comment-box{display:flex;flex-direction:column;gap:10px;background:var(--surface-3);border-radius:var(--radius-md);padding:14px;margin-top:14px}
.comment-box textarea{width:100%;border:1.5px solid var(--line);border-radius:var(--radius-sm);padding:10px 12px;background:var(--surface-2);color:var(--text);resize:vertical;min-height:64px}
.file-chip{
  display:inline-flex;align-items:center;gap:8px;background:var(--surface-2);border-radius:var(--pill);
  padding:6px 12px 6px 6px;font-size:12px;color:var(--text);transition:background .12s ease;
}
.file-chip .fi{width:22px;height:22px;border-radius:50%;background:var(--info-pale);color:var(--info);display:flex;align-items:center;justify-content:center;flex:0 0 auto}
a.file-chip{cursor:pointer}
a.file-chip:hover{background:var(--surface-3)}
.file-chip-dl{color:var(--muted);flex:0 0 auto}
a.file-chip:hover .file-chip-dl{color:var(--text)}
.file-chip-broken{opacity:.6;cursor:not-allowed}
.file-chip-broken .fi{background:var(--surface-3);color:var(--muted)}

.info-block{margin-bottom:20px}
.info-block:last-child{margin-bottom:0}
.info-block h4{font-size:12.5px;text-transform:uppercase;letter-spacing:.03em;color:var(--muted);margin-bottom:10px;font-weight:600}
.info-line{display:flex;justify-content:space-between;font-size:13px;padding:6px 0;gap:10px;min-width:0}
.info-line span:first-child{color:var(--muted);flex:0 0 auto}
.info-line span:last-child{font-weight:500;text-align:right;overflow-wrap:anywhere;min-width:0;flex:1}

/* Clientes */
.client-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px}
.client-card{
  position:relative;isolation:isolate;overflow:hidden;
  background:linear-gradient(150deg, rgba(255,255,255,.58), rgba(255,255,255,.32));
  backdrop-filter:blur(20px) saturate(1.6);-webkit-backdrop-filter:blur(20px) saturate(1.6);
  border-radius:var(--radius-2xl);padding:20px;display:block;cursor:pointer;
  border:1px solid rgba(255,255,255,.55);
  box-shadow:0 10px 34px rgba(30,20,60,.09), inset 0 1px 0 rgba(255,255,255,.7), inset 0 0 0 1px rgba(255,255,255,.12);
  transition:transform .18s cubic-bezier(.2,.8,.3,1),box-shadow .18s ease,background .18s ease;
}
.client-card::before{
  content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;pointer-events:none;
  background:linear-gradient(165deg, rgba(255,255,255,.45) 0%, rgba(255,255,255,0) 45%);
}
.client-card:hover{
  transform:translateY(-2px);
  background:linear-gradient(150deg, rgba(255,255,255,.7), rgba(255,255,255,.4));
  box-shadow:0 16px 40px rgba(30,20,60,.14), inset 0 1px 0 rgba(255,255,255,.8), inset 0 0 0 1px rgba(255,255,255,.16);
}
html[data-theme="dark"] .client-card{
  background:linear-gradient(150deg, rgba(255,255,255,.09), rgba(255,255,255,.02));
  border-color:rgba(255,255,255,.12);
  box-shadow:0 10px 34px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
}
html[data-theme="dark"] .client-card::before{background:linear-gradient(165deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,0) 45%)}
html[data-theme="dark"] .client-card:hover{
  background:linear-gradient(150deg, rgba(255,255,255,.14), rgba(255,255,255,.04));
  box-shadow:0 16px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.12);
}
.client-card-head{display:flex;align-items:center;gap:12px;margin-bottom:14px;min-width:0}
.client-card-head b{display:block;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.client-card-head span{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}
.client-stats{display:flex;gap:8px;margin-top:14px}
.client-stat{flex:1;min-width:0;background:var(--surface-2);border-radius:var(--radius-sm);padding:8px 6px;text-align:center}
.client-stat b{display:block;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.client-stat span{font-size:10px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}

/* Chat interno */
.chat-people{display:flex;flex-direction:column;gap:2px}
.chat-person{display:flex;align-items:center;gap:10px;padding:10px;border-radius:var(--radius-md);border:none;background:none;width:100%;text-align:left}
.chat-person:hover,.chat-person.active{background:var(--surface)}
.chat-person .nm{font-size:13.5px;font-weight:500}
.chat-person .rl{font-size:11.5px;color:var(--muted)}
.chat-thread{display:flex;flex-direction:column;gap:10px;max-height:320px;overflow-y:auto;padding:6px 2px;margin-bottom:12px}
.chat-msg{max-width:78%;padding:9px 13px;border-radius:var(--radius-lg);font-size:13px;background:var(--surface-2)}
.chat-msg.me{align-self:flex-end;background:var(--ink);color:#fff}
.chat-msg .m-time{font-size:10px;opacity:.6;margin-top:3px}
.chat-input-row{display:flex;gap:8px}
.chat-input-row input{flex:1;border:1.5px solid var(--line);border-radius:var(--pill);padding:10px 16px;background:var(--surface-3);color:var(--text)}

/* Plantillas */
.tpl-card{background:var(--surface);border-radius:var(--radius-lg);padding:18px;margin-bottom:14px}
.tpl-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.tpl-card-head b{font-size:14px}
.tpl-card pre{white-space:pre-wrap;font-family:inherit;font-size:13px;color:var(--muted);background:var(--surface-3);border-radius:var(--radius-sm);padding:12px;margin:0}

/* Tabs (configuración) */
.tabs{display:flex;gap:6px;margin-bottom:20px;flex-wrap:wrap}
.tab-btn{padding:9px 16px;border-radius:var(--pill);border:none;background:var(--surface-2);font-size:13.5px;font-weight:500;color:var(--muted)}
.tab-btn.active{background:var(--ink);color:#fff}
.tab-panel{display:none}
.tab-panel.active{display:block}

/* Roles / permisos */
.role-pill{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:var(--pill);font-size:11px;font-weight:600;background:var(--surface-2);color:var(--muted)}
[data-requires-role]{display:none}

/* Cuentas */
.account-row{display:flex;align-items:center;gap:12px;padding:12px 14px;background:var(--surface);border-radius:var(--radius-md);margin-bottom:10px}
.account-row .info{flex:1}
.account-row .info b{display:block;font-size:13.5px}
.account-row .info span{font-size:12px;color:var(--muted)}

@media (max-width:640px){
  .order-detail-head h1{font-size:22px}
  .client-grid{grid-template-columns:1fr}
}


/* ============================================================
   Nuevos componentes: progreso, drawer, búsqueda global,
   alertas, segmentos, kanban de pedidos, papelera, impresión
   ============================================================ */

/* Barra de progreso */
.progress-wrap{display:flex;align-items:center;gap:8px;width:100%}
.progress-bar{flex:1;height:7px;border-radius:99px;background:var(--line);overflow:hidden;min-width:50px}
.progress-bar span{display:block;height:100%;border-radius:99px;background:var(--ink);transition:width .3s ease}
.progress-bar.full span{background:#2f8f34}
.progress-label{font-size:11.5px;color:var(--muted);white-space:nowrap;font-weight:600}
.progress-big .progress-bar{height:11px}

/* Alertas en línea */
.alert-chip{
  display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:var(--pill);
  font-size:11.5px;font-weight:600;background:var(--danger-pale);color:var(--danger);
}
.alert-chip.warn{background:var(--warn-pale);color:#b9820c}
.alert-chip.info{background:var(--info-pale);color:var(--info)}
.alert-row{
  display:flex;align-items:center;gap:12px;padding:12px 16px;border-radius:var(--radius-md);
  background:var(--warn-pale);color:#8a6206;font-size:13px;margin-bottom:10px;
}
.alert-row.danger{background:var(--danger-pale);color:#a5322f}
.alert-row .grow{flex:1}

/* Banner de copia de seguridad */
.backup-banner{
  display:flex;align-items:center;gap:12px;padding:12px 16px;border-radius:var(--radius-md);
  background:var(--info-pale);color:#2a56b8;font-size:13px;margin-bottom:16px;flex-wrap:wrap;
}
.backup-banner span{flex:1;min-width:180px}

/* Drawer móvil */
.mobile-drawer{
  position:fixed;inset:0;z-index:150;background:rgba(10,10,10,.45);
  opacity:0;pointer-events:none;transition:opacity .2s ease;
}
.mobile-drawer.open{opacity:1;pointer-events:auto}
.drawer-panel{
  position:absolute;top:0;left:0;bottom:0;width:min(300px,86vw);background:var(--surface-2);
  padding:18px;overflow-y:auto;transform:translateX(-100%);transition:transform .24s cubic-bezier(.4,0,.2,1);
  display:flex;flex-direction:column;
}
.mobile-drawer.open .drawer-panel{transform:translateX(0)}
.drawer-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}
.drawer-head .brand-mark{width:34px;height:34px}
.drawer-head .brand-name{font-size:17px}
.drawer-user{display:flex;align-items:center;gap:12px;padding:12px;background:var(--surface);border-radius:var(--radius-md);margin-bottom:16px}
.drawer-user b{display:block;font-size:14px}
.drawer-user span{font-size:11.5px;color:var(--muted)}
.drawer-nav{display:flex;flex-direction:column;gap:2px}
.drawer-link{
  display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:var(--radius-md);
  font-size:14.5px;font-weight:500;color:var(--text);background:none;border:none;text-align:left;width:100%;
}
.drawer-link.active{background:var(--ink);color:#fff}
.drawer-link:hover:not(.active){background:var(--surface)}
.drawer-sep{height:1px;background:var(--line);margin:14px 0}

/* Búsqueda global */
.search-modal{max-width:600px;padding:0;overflow:hidden}
.search-modal-input{display:flex;align-items:center;gap:12px;padding:18px 20px;border-bottom:1px solid var(--line);color:var(--muted)}
.search-modal-input input{flex:1;border:none;background:transparent;outline:none;font-size:16px;color:var(--text)}
.search-results{max-height:min(440px,60vh);overflow-y:auto;padding:8px}
.search-group{margin-bottom:6px}
.search-group h5{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:10px 12px 4px;font-weight:600}
.search-item{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:var(--radius-md)}
.search-item:hover{background:var(--surface)}
.search-item .si-ic{width:32px;height:32px;border-radius:9px;background:var(--surface);display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.search-item div{flex:1;min-width:0}
.search-item b{display:block;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search-item span{font-size:11.5px;color:var(--muted)}

/* Ordenamiento de tablas */
.crm-table th.sortable{cursor:pointer;user-select:none}
.crm-table th.sortable:hover{color:var(--text)}
.sort-arrow{opacity:.35;margin-left:4px;font-size:10px}
.sort-arrow.on{opacity:1;color:var(--text)}

/* Selección múltiple */
.bulk-bar{
  display:flex;align-items:center;gap:12px;padding:12px 18px;border-radius:var(--radius-md);
  background:var(--ink);color:#fff;margin-bottom:14px;flex-wrap:wrap;
}
.bulk-bar .count{font-size:13.5px;font-weight:600;flex:1;min-width:120px}
.bulk-bar select{
  border-radius:var(--pill);border:none;padding:8px 14px;font-size:13px;background:rgba(255,255,255,.15);color:#fff;
}
.bulk-bar select option{color:var(--ink)}
.bulk-bar .btn{padding:8px 14px;font-size:13px}
.row-check{width:17px;height:17px;accent-color:var(--ink);cursor:pointer}

/* Kanban de pedidos */
.order-kanban{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;align-items:start}
.ok-col{background:var(--surface);border-radius:var(--radius-lg);padding:14px;min-height:120px}
.ok-col.drag-over{outline:2px dashed var(--navy);outline-offset:-4px}
.ok-col-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;padding:0 4px}
.ok-col-head b{font-size:13.5px}
.ok-card{
  background:var(--surface-2);border-radius:var(--radius-md);padding:14px;margin-bottom:10px;cursor:grab;
  border:1px solid var(--line);border-left:4px solid transparent;transition:background .12s ease;
}
.ok-card:hover{background:var(--surface-3)}
.ok-card:active{cursor:grabbing}
.ok-card.dragging{opacity:.45}
.ok-card .oc-top{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px}
.ok-card .oc-id{font-size:13px;font-weight:700}
.ok-card .oc-name{font-size:12.5px;color:var(--muted);margin-bottom:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ok-card .oc-foot{display:flex;justify-content:space-between;align-items:center;margin-top:10px;font-size:12px}

/* Segmentos y valor de cartera */
.portfolio-band{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:14px;
  background:var(--ink);color:#fff;border-radius:var(--radius-xl);padding:24px;margin-bottom:20px;
}
.portfolio-band .pb-item .pb-lbl{font-size:11.5px;opacity:.65;margin-bottom:4px}
.portfolio-band .pb-item .pb-val{font-size:24px;font-weight:600;letter-spacing:-.01em}
.seg-bar{display:flex;height:10px;border-radius:99px;overflow:hidden;margin:14px 0 10px}
.seg-bar span{display:block;height:100%}

/* Papelera y auditoría */
.trash-row,.audit-row{
  display:flex;align-items:center;gap:12px;padding:12px 14px;background:var(--surface);
  border-radius:var(--radius-md);margin-bottom:8px;font-size:13px;flex-wrap:wrap;
}
.trash-row .info,.audit-row .info{flex:1;min-width:150px}
.trash-row .info b,.audit-row .info b{display:block;font-size:13.5px}
.trash-row .info span,.audit-row .info span{font-size:11.5px;color:var(--muted)}

/* Textarea genérica */
.plain-textarea{
  width:100%;border:1.5px solid var(--line);border-radius:12px;padding:12px;
  background:var(--surface-3);color:var(--text);font-family:inherit;font-size:14px;resize:vertical;
}
.plain-textarea:focus{outline:none;border-color:var(--ink)}

/* Comentarios editables */
.tl-entry .tl-actions{display:flex;gap:4px;opacity:0;transition:opacity .15s}
.tl-entry:hover .tl-actions,.tl-entry .tl-actions.always{opacity:1}
.tl-entry .tl-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.tl-edited{font-size:10.5px;color:var(--muted);font-style:italic}
.tl-edit-area{width:100%;margin-top:6px}

/* Etiquetas */
.tag-chip{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:var(--pill);background:var(--surface);font-size:11.5px;font-weight:500}
.tag-chip button{border:none;background:none;padding:0;color:var(--muted);display:flex}

/* Factura imprimible */
.invoice-sheet{display:none}
@media print{
  body *{visibility:hidden}
  .invoice-sheet,.invoice-sheet *{visibility:visible}
  .invoice-sheet{display:block;position:absolute;inset:0;padding:40px;background:#fff;color:#000}
  .topbar,.sidebar,.toolbar,.mobile-drawer,.backup-banner,.toast{display:none!important}
}
.invoice-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:34px}
.invoice-brand{display:flex;align-items:center;gap:12px}
.invoice-brand .brand-mark{width:46px;height:46px}
.invoice-table{width:100%;border-collapse:collapse;margin:24px 0}
.invoice-table th{text-align:left;font-size:11px;text-transform:uppercase;color:#666;border-bottom:2px solid #000;padding:8px 0}
.invoice-table td{padding:12px 0;border-bottom:1px solid #ddd;font-size:13px}
.invoice-totals{margin-left:auto;width:260px;margin-top:20px}
.invoice-totals .tr{display:flex;justify-content:space-between;padding:6px 0;font-size:13px}
.invoice-totals .tr.grand{border-top:2px solid #000;margin-top:8px;padding-top:10px;font-weight:700;font-size:16px}

/* ============================================================
   RESPONSIVE — escritorio › tablet › móvil › móvil pequeño
   ============================================================ */

/* Tablet grande / laptop chica */
@media (max-width:1200px){
  .order-kanban{grid-template-columns:repeat(2,1fr)}
  .portfolio-band{padding:20px}
}

/* Tablet: la sidebar se mantiene, solo se ajustan márgenes */
@media (max-width:1024px){
  .content{padding:0 var(--space-5) 40px}
  .card{padding:var(--space-4)}
}

/* Móvil: la sidebar pasa a panel deslizable (ver base.css) */
@media (max-width:900px){
  .page-head{flex-direction:column;align-items:stretch;gap:14px}
  .toolbar{width:100%;gap:8px}
  .toolbar .btn{flex:1;justify-content:center;min-width:0}
  .toolbar .view-toggle{width:100%}
  .toolbar .view-toggle button{flex:1;justify-content:center}
  .date-chip{flex:1;justify-content:center}

  .filter-pills{
    flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px;
    scrollbar-width:none;-ms-overflow-style:none;
  }
  .filter-pills::-webkit-scrollbar{display:none}
  .filter-pill{flex:0 0 auto}

  .card{padding:var(--space-4)}
  .modal{max-width:100%;padding:20px;border-radius:var(--radius-lg);max-height:92vh}
  .field-row{flex-direction:column;gap:0}
  .modal-actions{flex-direction:column-reverse}
  .modal-actions .btn{width:100%;justify-content:center}

  .lead-grid,.client-grid{grid-template-columns:1fr}
  .order-kanban,.kanban{grid-template-columns:1fr}
  .notif-panel{width:min(300px,calc(100vw - 32px))}
  .user-panel{width:min(250px,calc(100vw - 32px))}

  .chat-layout{grid-template-columns:1fr!important}
  .chat-people{flex-direction:row;overflow-x:auto;gap:6px;padding-bottom:6px}
  .chat-person{flex:0 0 auto;width:auto;flex-direction:column;gap:4px;padding:8px}
  .chat-person .rl{display:none}
  .chat-person .nm{font-size:11px;max-width:64px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

  .tabs{overflow-x:auto;flex-wrap:nowrap;padding-bottom:4px}
  .tab-btn{flex:0 0 auto}
  .portfolio-band{padding:18px;gap:12px}
  .portfolio-band .pb-item .pb-val{font-size:20px}
  .bulk-bar{padding:10px 14px}
  .search-modal{max-width:100%}
}

/* Móvil estándar: tablas se convierten en tarjetas apiladas */
@media (max-width:680px){
  .stat-big{font-size:24px}

  /* Tablas apiladas: cada fila pasa a ser una tarjeta con etiquetas */
  .crm-table.stack thead{display:none}
  .crm-table.stack,.crm-table.stack tbody,.crm-table.stack tr,.crm-table.stack td{display:block;width:100%}
  .crm-table.stack tr{
    background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);
    padding:14px;margin-bottom:12px;box-shadow:0 1px 3px rgba(15,15,12,.04);
    border-bottom:1px solid var(--line);position:relative;
  }
  .crm-table.stack tr:last-child{margin-bottom:0}
  .crm-table.stack td{
    border-bottom:none;padding:5px 0;display:flex;justify-content:space-between;
    align-items:center;gap:12px;text-align:right;
  }
  .crm-table.stack td::before{
    content:attr(data-label);font-size:11.5px;color:var(--muted);font-weight:600;
    text-align:left;flex:0 0 auto;
  }
  .crm-table.stack td:empty{display:none}
  .crm-table.stack .cell-name{justify-content:flex-end}
  .crm-table.stack .row-actions{justify-content:flex-end;width:100%}

  .timeline{flex-wrap:wrap;gap:14px;justify-content:flex-start}
  .tl-step{flex:0 0 calc(50% - 7px)}
  .tl-step::after{display:none!important}
  .order-meta{grid-template-columns:1fr}
  .info-line{flex-direction:column;align-items:flex-start;gap:2px}
  .info-line span:last-child{text-align:left}
  .comment-box{padding:12px}
  .backup-banner{font-size:12.5px}
  .backup-banner .btn{width:100%;justify-content:center}
}

/* Móviles pequeños */
@media (max-width:400px){
  .card{padding:var(--space-3)}
  .toolbar{flex-direction:column}
  .toolbar .btn{width:100%}
  .portfolio-band{grid-template-columns:1fr}
  .tl-step{flex:0 0 100%}
}

/* Dispositivos táctiles: objetivos de toque más grandes */
@media (hover:none){
  .mini-icon-btn{width:38px;height:38px}
  .tl-entry .tl-actions{opacity:1}
  .btn{padding:12px 20px}
}

/* Select a ancho completo en paneles laterales */
.full-select{width:100%;background:var(--surface-3);border:1.5px solid var(--line);color:var(--text)}

/* Encabezado de sección dentro de formularios */
.form-section{
  font-size:12px;margin:16px 0 12px;text-transform:uppercase;letter-spacing:.03em;
  font-weight:600;color:var(--muted);
}
.form-section:first-child{margin-top:-6px}

/* ---------- Estado de preparación (estilo Shopify) ---------- */
tr.row-prepared td{background:var(--surface-3)}
.ok-card.row-prepared, .client-card.row-prepared, .lead-card.row-prepared{background:var(--surface-3)}
.card-white tr.row-prepared td{background:var(--surface-3)}

/* ---------- Barra flotante de acciones masivas (clientes) ---------- */
.floating-bulk-bar{
  position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(120%);
  background:var(--ink);color:#fff;border-radius:var(--pill);padding:12px 16px;
  display:flex;align-items:center;gap:12px;box-shadow:0 14px 40px rgba(0,0,0,.25);
  z-index:120;transition:transform .22s ease;flex-wrap:wrap;justify-content:center;max-width:calc(100vw - 32px);
}
.floating-bulk-bar.show{transform:translateX(-50%) translateY(0)}
.floating-bulk-bar .count{font-size:13px;font-weight:600}
.floating-bulk-bar select{border-radius:var(--pill);border:none;padding:8px 12px;font-size:12.5px;background:rgba(255,255,255,.15);color:#fff}
.floating-bulk-bar select option{color:var(--ink)}
.floating-bulk-bar .btn{padding:8px 14px;font-size:12.5px}

/* Checkbox de selección sobre la tarjeta de cliente */
.client-card-select{position:absolute;top:14px;right:14px;z-index:2}
@media (max-width:680px){
  .floating-bulk-bar{flex-direction:column;align-items:stretch;bottom:76px;border-radius:var(--radius-lg);width:calc(100vw - 32px)}
  .floating-bulk-bar select,.floating-bulk-bar .btn{width:100%;justify-content:center}
}

/* Badge clicable para alternar estado de preparación */
.badge-toggle-btn{border:none;background:none;padding:0;cursor:pointer;display:inline-flex}
.badge-toggle-btn:hover .badge{filter:brightness(.95)}
.gap-4{gap:4px}
.gap-6{gap:6px}

/* Pedidos archivados: atenuados en la lista */
tr.row-archived{opacity:.55}

/* Botón de icono destructivo (eliminar) con tinte rojo sutil */
.mini-icon-btn.btn-danger-icon{color:var(--danger)}
.mini-icon-btn.btn-danger-icon:hover{background:var(--danger-pale)}

/* ============================================================
   V8 — Franja de indicadores clave (una sola pieza, no 4 tarjetas repetidas)
   ============================================================ */
.kpi-strip{
  display:grid;grid-template-columns:repeat(4,1fr);
  background:var(--surface-2);border-radius:var(--radius-xl);
  margin-bottom:var(--space-5);overflow:hidden;
}
.kpi-item{
  padding:var(--space-5) var(--space-6);
  border-left:1px solid var(--line);
  display:flex;flex-direction:column;gap:5px;
  min-width:0;
}
.kpi-item:first-child{border-left:none}
.kpi-label{font-size:var(--text-sm);color:var(--muted);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kpi-value{font-size:var(--text-2xl);font-weight:600;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kpi-delta{font-size:var(--text-xs);color:var(--muted)}

@media (max-width:1024px){
  .kpi-strip{grid-template-columns:repeat(2,1fr)}
  .kpi-item:nth-child(3){border-left:none}
  .kpi-item:nth-child(3),.kpi-item:nth-child(4){border-top:1px solid var(--line)}
}
@media (max-width:560px){
  .kpi-strip{grid-template-columns:1fr}
  .kpi-item{border-left:none!important}
  .kpi-item:not(:first-child){border-top:1px solid var(--line)}
}

/* Variante de 5 columnas (franja de comisiones + pago al delegador) */
.kpi-strip-5{grid-template-columns:repeat(5,1fr)}
@media (max-width:1024px){
  .kpi-strip-5{grid-template-columns:repeat(2,1fr)}
  .kpi-strip-5 .kpi-item:nth-child(5){border-left:none;border-top:1px solid var(--line)}
}
@media (max-width:560px){
  .kpi-strip-5{grid-template-columns:1fr}
}

/* ============================================================
   V8 — Indicadores discretos (menos "pastillas de colores" compitiendo
   por atención; el badge de Estado sigue siendo el único elemento fuerte)
   ============================================================ */
.dot-indicator{display:inline-flex;align-items:center;gap:7px;font-size:var(--text-sm);color:var(--text);font-weight:500;white-space:nowrap}
.dot-indicator .dot{width:7px;height:7px;border-radius:50%;flex:0 0 auto}
.dot-indicator-btn{border:none;background:none;padding:0;cursor:pointer}
.dot-indicator-btn:hover .dot-indicator{opacity:.75}

.tag-plain{
  display:inline-flex;align-items:center;padding:3px 11px;border-radius:var(--pill);
  font-size:var(--text-xs);font-weight:500;border:1px solid var(--line);color:var(--muted);white-space:nowrap;
}
.tag-plain.accent{border-color:var(--ink);color:var(--ink);background:transparent}

/* ============================================================
   Fila de stats simple + saludo grande (estilo Ambora Home)
   ============================================================ */
.ambora-stats-row{display:flex;align-items:center;gap:var(--space-6);flex-wrap:wrap;margin-bottom:var(--space-7)}
.as-group{display:flex;flex-direction:column;gap:4px}
.as-label{font-size:var(--text-xs);color:var(--muted)}
.as-value{font-size:var(--text-lg);font-weight:700}
.as-sep{width:1px;height:30px;background:var(--line)}
.as-live{display:flex;flex-direction:column;gap:4px;align-items:flex-end}
.as-live-row{display:flex;align-items:center;gap:7px;font-size:var(--text-sm);font-weight:600}
.live-dot{width:8px;height:8px;border-radius:50%;background:var(--muted-2);flex:0 0 auto}
.live-dot.pulse{box-shadow:0 0 0 0 rgba(22,163,74,.5);animation:ug-livepulse 1.8s ease-out infinite}
@keyframes ug-livepulse{
  0%{box-shadow:0 0 0 0 rgba(22,163,74,.45)}
  70%{box-shadow:0 0 0 7px rgba(22,163,74,0)}
  100%{box-shadow:0 0 0 0 rgba(22,163,74,0)}
}

.greeting-hero{font-size:var(--text-3xl);font-weight:800;letter-spacing:-.02em;text-align:center;margin-bottom:6px}
.greeting-sub{text-align:center;color:var(--muted);font-size:var(--text-md);margin-bottom:var(--space-7)}

@media (max-width:640px){
  .ambora-stats-row{gap:var(--space-4)}
  .as-sep{display:none}
  .as-live{align-items:flex-start}
  .greeting-hero{font-size:26px}
}

/* ============================================================
   Cajas de estadísticas separadas, estilo Ambora (Orders/Unfulfilled/
   Unpaid/Returns): bordeadas, ícono arriba a la derecha, número grande.
   Distinto del kpi-strip del Dashboard (que es una sola pieza fusionada).
   ============================================================ */
.stat-box-row{display:grid;grid-template-columns:repeat(4,1fr);gap:var(--space-4);margin-bottom:var(--space-5)}
.stat-box{
  border:1px solid var(--line);border-radius:var(--radius-xl);padding:var(--space-4) var(--space-5);
  background:var(--surface-2);position:relative;
}
.stat-box .sb-label{font-size:var(--text-sm);color:var(--muted);font-weight:500}
.stat-box .sb-icon{
  position:absolute;top:var(--space-4);right:var(--space-5);color:var(--muted-2);
  width:28px;height:28px;display:flex;align-items:center;justify-content:center;
}
.stat-box .sb-value{font-size:var(--text-2xl);font-weight:700;letter-spacing:-.02em;margin-top:8px}

@media (max-width:1024px){ .stat-box-row{grid-template-columns:repeat(2,1fr)} }
@media (max-width:520px){ .stat-box-row{grid-template-columns:1fr} }

/* Búsqueda ancha con ícono, estilo Ambora */
.search-box-wide{
  display:flex;align-items:center;gap:10px;border:1px solid var(--line);border-radius:var(--radius-md);
  padding:10px 14px;background:var(--surface-2);margin-bottom:var(--space-4);color:var(--muted);
}
.search-box-wide input{flex:1;border:none;outline:none;background:none;font-size:var(--text-md);color:var(--text)}
.search-box-wide .sbw-actions{display:flex;align-items:center;gap:4px}

/* ============================================================
   Tutorial guiado — mascota "Up" + foco en pantalla
   ============================================================ */
.tour-overlay{
  position:fixed;inset:0;z-index:500;pointer-events:none;
  opacity:0;transition:opacity .25s ease;
}
.tour-overlay.show{opacity:1;pointer-events:auto}
.tour-dim{
  position:fixed;border-radius:14px;
  box-shadow:0 0 0 9999px rgba(10,10,12,.72);
  transition:top .35s cubic-bezier(.16,1,.3,1),left .35s cubic-bezier(.16,1,.3,1),
             width .35s cubic-bezier(.16,1,.3,1),height .35s cubic-bezier(.16,1,.3,1);
  pointer-events:none;
}
.tour-dim.no-target{box-shadow:0 0 0 9999px rgba(10,10,12,.72)}
.tour-ring{
  position:fixed;border-radius:14px;border:2px solid var(--lime);
  box-shadow:0 0 0 4px rgba(199,243,60,.25);pointer-events:none;
  transition:top .35s cubic-bezier(.16,1,.3,1),left .35s cubic-bezier(.16,1,.3,1),
             width .35s cubic-bezier(.16,1,.3,1),height .35s cubic-bezier(.16,1,.3,1);
}

.tour-card{
  position:fixed;left:50%;bottom:28px;transform:translateX(-50%);
  width:min(480px,calc(100vw - 32px));
  background:var(--surface-2);border-radius:var(--radius-xl);
  box-shadow:0 24px 60px rgba(0,0,0,.35);
  padding:18px 22px 18px 18px;
  display:flex;gap:14px;align-items:flex-start;
  z-index:501;
}
.tour-mascot{width:56px;height:56px;flex:0 0 auto;animation:tour-bob 2.2s ease-in-out infinite}
@keyframes tour-bob{ 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
.tour-body{flex:1;min-width:0}
.tour-step-count{font-size:11px;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:.04em;margin-bottom:4px}
.tour-title{font-size:14.5px;font-weight:700;margin-bottom:5px}
.tour-text{font-size:13.5px;color:var(--text);line-height:1.5;font-style:italic}
.tour-text::before{content:'“'}
.tour-text::after{content:'”'}
.tour-actions{display:flex;align-items:center;gap:8px;margin-top:14px}
.tour-prev-next{display:flex;gap:8px;flex:0 0 auto}
.tour-progress-dots{display:flex;gap:4px;flex:1}
.tour-progress-dots span{width:5px;height:5px;border-radius:50%;background:var(--line)}
.tour-progress-dots span.done{background:var(--lime-dark)}
.tour-skip{background:none;border:none;color:var(--muted);font-size:12px;padding:6px 4px;text-decoration:underline;cursor:pointer}

@media (max-width:640px){
  .tour-card{bottom:0;padding:16px;border-radius:var(--radius-xl) var(--radius-xl) 0 0;width:100vw;max-width:100vw;left:0;transform:none}
  .tour-mascot{width:40px;height:40px}
  .tour-title{font-size:13.5px}
  .tour-text{font-size:12.5px}
  .tour-actions{flex-wrap:wrap;gap:10px}
  .tour-progress-dots{order:1;flex:1 1 auto}
  .tour-skip{order:2;flex:0 0 auto;padding:6px 0}
  .tour-prev-next{order:3;flex:1 1 100%;display:flex;gap:8px}
  #tourPrev,#tourNext{flex:1;justify-content:center}
}

/* ============================================================
   Configuración → Sonidos
   ============================================================ */
.sound-row{
  display:flex;align-items:center;gap:14px;padding:14px 0;border-bottom:1px solid var(--line);flex-wrap:wrap;
}
.sound-row:last-child{border-bottom:none}
.sound-icon{
  width:38px;height:38px;border-radius:50%;background:var(--surface-3);color:var(--text);
  display:flex;align-items:center;justify-content:center;flex:0 0 auto;
}
.sound-info{flex:1;min-width:160px}
.sound-info b{display:block;font-size:13.5px;font-weight:600}
.sound-info span{display:block;font-size:12px;color:var(--muted);margin-top:1px}
.sound-status{margin-top:4px!important;font-weight:600}
.sound-status.custom{color:var(--ok)}
.sound-status.default{color:var(--muted)}
.sound-status.pending{color:var(--warn)}

.sound-dropzone{
  border:1.5px dashed var(--line);border-radius:var(--radius-md);padding:10px 14px;
  font-size:12px;color:var(--muted);text-align:center;cursor:pointer;min-width:150px;
  transition:border-color .15s ease,background .15s ease;
}
.sound-dropzone:hover{border-color:var(--muted-2)}
.sound-dropzone.drag-over{border-color:var(--ink);background:var(--surface-3);color:var(--text)}

@media (max-width:640px){
  .sound-row{flex-direction:column;align-items:stretch}
  .sound-dropzone{min-width:0}
}

/* Badge de conteo chico, en línea (pestaña de solicitudes de clientes) */
.badge-count-inline{
  display:inline-flex;align-items:center;justify-content:center;min-width:17px;height:17px;
  padding:0 5px;border-radius:99px;background:var(--danger);color:#fff;font-size:10px;font-weight:700;
  margin-left:4px;vertical-align:middle;
}

/* Fila de solicitud de informe en Configuración */
.report-req-row{
  display:flex;align-items:center;gap:14px;padding:14px;border:1px solid var(--line);border-radius:var(--radius-md);
  margin-bottom:10px;flex-wrap:wrap;
}
.report-req-info{flex:1;min-width:180px}
.report-req-info .msg{font-size:12.5px;color:var(--muted);margin-top:2px;font-style:italic}
.report-req-actions{display:flex;gap:8px;flex-wrap:wrap}

/* Fila con checkbox + etiqueta (ej. "Cuenta activa") */
.checkbox-row{ display:flex; align-items:center; gap:8px; font-size:13px; font-weight:500; cursor:pointer; }
.checkbox-row input[type="checkbox"]{ width:16px; height:16px; }

/* Aviso fijo de "sin conexión a la base de datos" + bloqueo de edición */
.conn-banner{
  position:sticky; top:0; z-index:500; display:flex; align-items:center; gap:10px;
  padding:10px 18px; background:var(--danger); color:#fff; font-size:13px; font-weight:600;
}
.conn-banner svg{ width:18px; height:18px; flex:0 0 auto; }
.conn-banner span{ flex:1; }
.conn-banner .btn{ flex:0 0 auto; }
/* Bloqueo visual real: todo lo que sea entrada/edición queda deshabilitado
 * y semi-transparente mientras no haya conexión. Los enlaces de sólo
 * navegación (sidebar, topbar) siguen funcionando. */
body.app-disconnected .content button:not(.conn-banner *),
body.app-disconnected .content input,
body.app-disconnected .content select,
body.app-disconnected .content textarea,
body.app-disconnected .toolbar button,
body.app-disconnected .fab{
  pointer-events:none !important;
  opacity:.5 !important;
  filter:grayscale(.3);
}

/* Pastilla de plataforma en la lista de pedidos */
.platform-badge{
  display:inline-flex;align-items:center;gap:6px;padding:3px 9px 3px 4px;border-radius:99px;
  font-size:11.5px;font-weight:600;line-height:1;white-space:nowrap;
}
.platform-badge-mark{
  width:15px;height:15px;border-radius:50%;color:#fff;display:inline-flex;align-items:center;
  justify-content:center;font-size:9px;font-weight:800;flex:0 0 auto;
}

/* Panel "Mis pedidos activos" en el Dashboard (vista de encargados) */
.my-order-row{
  display:grid;grid-template-columns:110px 1fr 1fr auto;align-items:center;gap:12px;
  padding:11px 14px;border-radius:var(--radius-md);border-bottom:1px solid var(--line);
  text-decoration:none;color:var(--text);
}
.my-order-row:last-child{border-bottom:none}
.my-order-row:hover{background:var(--surface-3)}
.mor-id{display:flex;align-items:center;gap:8px;font-size:13.5px}
.mor-name{font-size:13px}
.mor-name .muted{font-size:12px}
.mor-progress{display:flex;align-items:center;gap:8px}
.mor-badges{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
@media(max-width:700px){
  .my-order-row{grid-template-columns:1fr;gap:6px}
  .mor-id{font-weight:700}
}

/* =====================================================
   Historia de venta — línea de tiempo
   ===================================================== */
.sale-timeline{ padding: 8px 0; }
.stl-item{ display:flex; gap:16px; position:relative; padding-bottom:0; }
.stl-item.stl-last .stl-body{ padding-bottom:8px; }
.stl-line-col{ display:flex; flex-direction:column; align-items:center; flex:0 0 28px; }
.stl-dot{
  width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  flex:0 0 auto;box-shadow:0 0 0 3px var(--surface-3);
}
.stl-connector{ width:2px;flex:1;min-height:24px;background:var(--line);margin:4px 0; }
.stl-body{ flex:1;padding-bottom:24px; }
.stl-meta{ font-size:11px;color:var(--muted);margin-bottom:3px; }
.stl-title{ font-size:13.5px;font-weight:600;margin-bottom:3px; }
.stl-title a{ color:var(--text);text-decoration:underline;text-underline-offset:2px; }
.stl-detail{ font-size:12.5px;color:var(--muted); }

/* =====================================================
   Log de contactos
   ===================================================== */
.contact-log-row{
  display:flex;align-items:flex-start;gap:12px;padding:12px 0;
  border-bottom:1px solid var(--line);
}
.contact-log-row:last-child{ border-bottom:none; }
.clr-chan{
  flex:0 0 auto;padding:3px 10px;border-radius:20px;font-size:11px;font-weight:700;
  color:#fff;white-space:nowrap;margin-top:2px;
}
.clr-body{ flex:1;min-width:0; }
.clr-summary{ font-size:13.5px;font-weight:500;margin-bottom:3px; }
.clr-outcome{ font-size:12.5px;color:var(--ok);margin-bottom:3px; }
.clr-meta{ font-size:11.5px;color:var(--muted); }

/* =====================================================
   Recordatorios
   ===================================================== */
.reminder-row{
  display:flex;align-items:center;gap:10px;padding:9px 0;
  border-bottom:1px solid var(--line);font-size:13px;
}
.reminder-row:last-child{ border-bottom:none; }
.reminder-row.done{ opacity:.5;text-decoration:line-through; }
.reminder-row.late{ color:var(--danger); }
.reminder-row.soon{ color:var(--warn); }

/* =====================================================
   Valoraciones / Rating
   ===================================================== */
.rating-compare-block{ display:grid;grid-template-columns:1fr 1fr;gap:14px; }
.rating-field label{ display:block;font-size:12px;color:var(--muted);margin-bottom:6px; }
.rating-compare-row{ display:flex;align-items:center;gap:24px;justify-content:center;padding:16px 0; }
.rc-block{ text-align:center;flex:1; }
.rc-label{ font-size:11px;text-transform:uppercase;color:var(--muted);margin-bottom:8px; }
.rc-value{ font-size:22px;font-weight:700;margin-top:6px; }
.rc-sub{ font-size:12px;color:var(--muted); }
.rc-arrow{ display:flex;flex-direction:column;align-items:center;gap:4px;flex:0 0 auto; }
.rc-diff{ font-size:16px;font-weight:700; }

/* Plantillas: agrupación por canal y chips de variables */
.tpl-channel-group{ margin-bottom:20px; }
.tpl-channel-label{
  display:inline-block;padding:3px 12px;border-radius:20px;font-size:11.5px;
  font-weight:700;color:#fff;margin-bottom:10px;
}
.tpl-vars-hint{
  margin-top:8px;font-size:11.5px;color:var(--muted);
  display:flex;flex-wrap:wrap;align-items:center;gap:5px;
}
.var-chip{
  display:inline-block;padding:2px 8px;background:var(--surface-3);border-radius:6px;
  font-family:monospace;font-size:11px;cursor:pointer;color:var(--info);
  border:1px solid var(--line);transition:background .1s;user-select:none;
}
.var-chip:hover{ background:var(--info);color:#fff; }

/* =====================================================
   Valoraciones — comparativa antes/después
   ===================================================== */
.val-compare-grid{
  display:grid;grid-template-columns:1fr 60px 1fr;gap:0;
  background:var(--surface);border-radius:var(--radius-xl);overflow:hidden;
  border:1.5px solid var(--line);
}
.val-panel{ padding:24px 20px; }
.val-panel-before{ background:var(--surface-3); }
.val-panel-after{ background:#f0fdf4; }
[data-theme="dark"] .val-panel-after{ background:rgba(34,197,94,.07); }
.val-panel-label{
  font-size:11px;font-weight:700;text-transform:uppercase;
  letter-spacing:.05em;color:var(--muted);margin-bottom:16px;
}
.val-panel-label-after{ color:#16a34a; }

/* Foto */
.val-photo-area{ margin-bottom:16px; }
.val-photo-placeholder{
  border:2px dashed var(--line);border-radius:var(--radius-lg);
  padding:20px 12px;text-align:center;font-size:12.5px;color:var(--muted);
  display:flex;flex-direction:column;align-items:center;gap:4px;
}
.val-photo-preview{ position:relative;border-radius:var(--radius-lg);overflow:hidden; }
.val-photo-preview img{ width:100%;max-height:220px;object-fit:cover;display:block;border-radius:var(--radius-lg); }
.val-photo-remove{
  position:absolute;top:6px;right:6px;width:24px;height:24px;border-radius:50%;
  background:rgba(0,0,0,.55);color:#fff;border:none;cursor:pointer;
  font-size:16px;line-height:1;display:flex;align-items:center;justify-content:center;
}

/* Rating interactivo */
.val-rating-block{ display:flex;align-items:center;gap:8px;margin-bottom:16px; }
.val-stars-interactive{ display:flex;gap:3px;cursor:pointer; }
.val-stars-interactive svg{ width:26px;height:26px;transition:transform .1s; }
.val-stars-interactive svg:hover{ transform:scale(1.15); }
.val-rating-input{
  width:60px;padding:6px 8px;border-radius:8px;border:1.5px solid var(--line);
  background:var(--surface);color:var(--text);font-size:16px;font-weight:700;
  text-align:center;
}
.val-rating-unit{ font-size:13px;color:var(--muted); }
.val-fields .field label{ font-size:12px; }

/* Columna central con mejora */
.val-arrow-col{
  display:flex;align-items:center;justify-content:center;
  background:var(--surface);border-left:1.5px solid var(--line);border-right:1.5px solid var(--line);
}
.val-improvement{ text-align:center;padding:12px 8px; }
.val-imp-rating{ font-size:20px;font-weight:800;color:var(--ok); }
.val-imp-reviews{ font-size:15px;font-weight:700;color:var(--ok); }
.val-imp-label{ font-size:10px;text-transform:uppercase;color:var(--muted);letter-spacing:.04em; }

@media(max-width:600px){
  .val-compare-grid{ grid-template-columns:1fr;grid-template-rows:auto auto auto; }
  .val-arrow-col{ border:none;border-top:1.5px solid var(--line);border-bottom:1.5px solid var(--line);padding:12px; }
  .val-improvement{ display:flex;gap:20px;justify-content:center;align-items:center; }
}

/* =====================================================
   Kanban de leads (Pipeline)
   ===================================================== */
.leads-kanban{
  display:flex;gap:14px;overflow-x:auto;padding-bottom:16px;
  align-items:flex-start;min-height:calc(100vh - 280px);
}
.lk-col{
  flex:0 0 220px;background:var(--surface-3);border-radius:var(--radius-xl);
  padding:12px;display:flex;flex-direction:column;gap:8px;
}
.lk-col-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:0 2px 6px;border-bottom:1.5px solid var(--line);margin-bottom:2px;
}
.lk-col-title{ display:flex;align-items:center;gap:7px;font-size:13px;font-weight:600; }
.lk-dot{ width:9px;height:9px;border-radius:50%;flex:0 0 auto; }
.lk-col-count{ font-size:11.5px;color:var(--muted); }
.lk-cards{ display:flex;flex-direction:column;gap:7px;min-height:40px; }
.lk-card{
  background:#fff;border-radius:var(--radius-lg);padding:10px 12px;
  cursor:grab;border:1.5px solid var(--line);transition:box-shadow .15s,transform .1s;
}
.lk-card:hover{ box-shadow:0 4px 14px rgba(0,0,0,.1);transform:translateY(-1px); }
.lk-card.lk-dragging{ opacity:.4;transform:scale(.97); }
.lk-cards.lk-drag-over{ background:rgba(22,24,29,.05);border-radius:10px; }
.lk-card-name{ font-size:13px;font-weight:600;margin-bottom:2px; }
.lk-card-co{ font-size:11.5px;color:var(--muted);margin-bottom:6px; }
.lk-card-foot{ display:flex;justify-content:space-between;align-items:center;font-size:11.5px; }
.lk-value{ color:var(--ok);font-weight:600; }
.lk-age{ color:var(--muted); }
.lk-card.lk-stale{ border-color:var(--warn);background:#fffdf0; }
.lk-add-btn{
  width:100%;padding:7px;border:none;background:none;cursor:pointer;
  font-size:12.5px;color:var(--muted);border-radius:8px;text-align:left;
}
.lk-add-btn:hover{ background:var(--surface);color:var(--text); }
.lk-drop-target{ min-height:4px; }

/* Drag kanban tareas */
.task-card{ cursor:grab; }
.task-card.lk-dragging{ opacity:.4; }
.kanban-drop-zone.lk-drag-over{ background:rgba(22,24,29,.05);border-radius:10px; }

/* =====================================================
   Recordatorios en el Dashboard
   ===================================================== */
.dash-reminder-row{
  display:flex;align-items:center;gap:10px;padding:9px 0;
  border-bottom:1px solid var(--line);text-decoration:none;color:var(--text);
  font-size:13px;
}
.dash-reminder-row:last-child{ border-bottom:none; }
.dash-reminder-row.late{ color:var(--danger); }
.dash-reminder-row:hover{ background:var(--surface-3);border-radius:8px;padding-left:6px; }

/* =====================================================
   Checklist de preparación en pedido
   ===================================================== */
.checklist-row{
  display:flex;align-items:center;gap:9px;padding:7px 0;
  border-bottom:1px solid var(--line);font-size:13px;
}
.checklist-row:last-child{ border-bottom:none; }
.checklist-row.done .cl-label{ text-decoration:line-through;color:var(--muted); }
.cl-label{ flex:1; }

/* =====================================================
   Portal — comparativa de rating
   ===================================================== */
.p-rating-compare{
  display:flex;align-items:center;justify-content:center;gap:20px;padding:14px 0;flex-wrap:wrap;
}
.p-rc-block{ text-align:center; }
.p-rc-label{ font-size:11px;text-transform:uppercase;color:var(--muted,#888);margin-bottom:8px; }
.p-rc-stars{ display:flex;justify-content:center;gap:2px; }
.p-rc-val{ font-size:20px;font-weight:700;margin-top:6px; }
.p-rc-sub{ font-size:12px;color:var(--muted,#888); }
.p-rc-arrow{ display:flex;flex-direction:column;align-items:center;gap:4px; }
.p-rc-diff{ font-size:16px;font-weight:800; }

/* =====================================================
   Presencia en tiempo real — avatares en topbar
   ===================================================== */
.presence-bar{
  display:flex;align-items:center; /* el solapamiento lo da margin-left negativo en cada avatar */
  margin-right:8px;
}
.presence-avatar{
  position:relative;width:30px;height:30px;border-radius:50%;
  background:var(--ink);color:#fff;
  display:inline-flex;align-items:center;justify-content:center;
  font-size:11px;font-weight:700;cursor:pointer;
  border:2.5px solid var(--bg);
  margin-left:-6px;
  text-decoration:none;
  transition:transform .15s,z-index 0s;
  z-index:1;
}
.presence-avatar:first-child{ margin-left:0; }
.presence-avatar:hover{ transform:scale(1.18) translateY(-2px); z-index:10; }
.presence-avatar img{ width:100%;height:100%;border-radius:50%;object-fit:cover; }
.presence-avatar span{ line-height:1; }

/* Anillo pulsante cuando está en la misma página que yo */
.presence-same-page{
  border-color:var(--ok);
  box-shadow:0 0 0 0 rgba(34,197,94,.6);
  animation:presence-pulse 2s ease-in-out infinite;
}
@keyframes presence-pulse{
  0%,100%{ box-shadow:0 0 0 0 rgba(34,197,94,.5); }
  50%{ box-shadow:0 0 0 5px rgba(34,197,94,0); }
}

/* Tooltip de presencia */
.presence-tooltip{
  position:absolute;top:calc(100% + 8px);right:0;
  background:var(--ink);color:#fff;
  border-radius:10px;padding:8px 12px;
  font-size:12px;white-space:nowrap;
  pointer-events:none;opacity:0;transition:opacity .15s;
  z-index:1000;min-width:160px;
  box-shadow:0 8px 24px rgba(0,0,0,.25);
}
.presence-tooltip::before{
  content:'';position:absolute;bottom:100%;right:10px;
  border:5px solid transparent;border-bottom-color:var(--ink);
}
.presence-avatar:hover .presence-tooltip{ opacity:1; }
.ptt-name{ font-weight:700;margin-bottom:4px; }
.ptt-where{
  display:flex;align-items:center;gap:4px;
  font-size:11px;opacity:.8;margin-bottom:4px;
}
.ptt-tag{
  display:inline-block;padding:2px 7px;border-radius:6px;
  font-size:10.5px;font-weight:600;
}
.ptt-same{ background:rgba(34,197,94,.25);color:#4ade80; }
.ptt-go{ background:rgba(255,255,255,.12);color:#fff; }

/* =====================================================
   Filtros de pedidos — barra compacta + panel expandible
   ===================================================== */
.orders-filter-bar{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  margin-bottom:12px;
}
.filter-sep{
  width:1px;height:22px;background:var(--line);flex:0 0 auto;
  display:none; /* solo aparece si hay quick filters */
}
.orders-filter-bar:has(#quickFilters:not(:empty)) .filter-sep{ display:block; }
.filter-active-chips{
  display:flex;gap:6px;flex-wrap:wrap;align-items:center;flex:1;min-width:0;
}
.active-filter-chip{
  display:inline-flex;align-items:center;gap:4px;padding:3px 6px 3px 10px;
  border-radius:20px;background:var(--ink);color:#fff;
  font-size:12px;font-weight:500;white-space:nowrap;
}
.active-filter-chip button{
  background:none;border:none;color:rgba(255,255,255,.7);cursor:pointer;
  padding:0;display:flex;align-items:center;line-height:1;
}
.active-filter-chip button:hover{ color:#fff; }

.orders-filter-panel{
  background:var(--surface-3);border-radius:var(--radius-lg);
  padding:14px 16px;margin-bottom:14px;
  display:flex;flex-wrap:wrap;gap:14px;align-items:flex-start;
}
.filter-group{ display:flex;align-items:center;gap:8px;flex-wrap:wrap; }
.filter-group-label{
  font-size:11.5px;font-weight:600;color:var(--muted);white-space:nowrap;
  text-transform:uppercase;letter-spacing:.03em;
}

/* Modal shake — cuando se intenta cerrar un formulario con click afuera */
@keyframes modal-shake{
  0%,100%{transform:translateY(0) scale(1)}
  20%{transform:translateX(-6px) scale(1)}
  40%{transform:translateX(6px) scale(1)}
  60%{transform:translateX(-4px) scale(1)}
  80%{transform:translateX(4px) scale(1)}
}
.modal-shake{ animation:modal-shake .35s ease; }

/* =====================================================
   Modo oscuro — correcciones elementos que no respondían
   ===================================================== */

/* Tarjetas del kanban de leads */
html[data-theme="dark"] .lk-card{
  background:var(--surface-2);border-color:var(--line);
}
html[data-theme="dark"] .lk-card:hover{ box-shadow:0 4px 14px rgba(0,0,0,.3); }
html[data-theme="dark"] .lk-card.lk-stale{ background:rgba(180,83,9,.12);border-color:var(--warn); }
html[data-theme="dark"] .lk-col{ background:var(--surface-3); }
html[data-theme="dark"] .lk-cards.lk-drag-over{ background:rgba(255,255,255,.04); }

/* Hover de filas de tabla — invisible en oscuro */
html[data-theme="dark"] .crm-table tr.row-clickable:hover{ background:rgba(255,255,255,.04); }

/* Ganancia neta — verde que en oscuro se ve bien */
html[data-theme="dark"] .totals-row.profit{ color:#4ade80; }

/* Alertas con color de texto hardcodeado */
html[data-theme="dark"] .alert-row.warn{ background:var(--warn-pale); color:var(--warn); }
html[data-theme="dark"] .alert-row.info{ background:var(--info-pale); color:var(--navy); }

/* Liquidación de comisiones */
html[data-theme="dark"] .commission-seller-block{
  background:var(--surface-2);border-color:var(--line);
}

/* Checklist rows */
html[data-theme="dark"] .checklist-row{ border-color:var(--line); }

/* Chat interno con cliente */
html[data-theme="dark"] .chat-bubble.staff{
  background:var(--surface-2);border-color:var(--line);
}

/* Recordatorios dashboard */
html[data-theme="dark"] .dash-reminder-row:hover{
  background:var(--surface-3);
}

/* Input de monto de comisión */
html[data-theme="dark"] .comm-amount-input{
  background:var(--surface-3);color:var(--text);border-color:var(--line);
}

/* Filtros barra de pedidos */
html[data-theme="dark"] .orders-filter-panel{
  background:var(--surface-3);
}

/* Portal — comparativa rating */
html[data-theme="dark"] .p-rating-compare .p-rc-block{ color:var(--text); }

/* Columna de kanban de tareas */
html[data-theme="dark"] .kanban-drop-zone.lk-drag-over{ background:rgba(255,255,255,.04); }

/* Stat boxes — fondo visible en oscuro */
html[data-theme="dark"] .stat-box{
  background:var(--surface-2);border-color:var(--line);
}

/* =====================================================
   Mascota UpGrowth — widget de pendientes flotante
   ===================================================== */
#ug-mascot{
  position:fixed;bottom:24px;right:24px;z-index:900;display:flex;flex-direction:column;align-items:flex-end;gap:10px;
}
.ug-mascot-btn{
  width:52px;height:52px;border-radius:50%;border:none;padding:0;cursor:pointer;
  background:#16181D;box-shadow:0 4px 20px rgba(0,0,0,.30);
  position:relative;transition:transform .2s,box-shadow .2s;
  display:flex;align-items:center;justify-content:center;
}
.ug-mascot-btn:hover{ transform:scale(1.08);box-shadow:0 6px 28px rgba(0,0,0,.40); }
.ug-mascot-icon{ width:34px;height:34px;display:block; }
.ug-mascot-badge{
  position:absolute;top:-4px;right:-4px;
  min-width:18px;height:18px;border-radius:9px;
  background:var(--danger);color:#fff;font-size:10px;font-weight:700;
  display:flex;align-items:center;justify-content:center;padding:0 4px;
  border:2px solid var(--bg);
}
.ug-mascot-panel{
  width:300px;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--radius-xl);box-shadow:0 16px 40px rgba(0,0,0,.20);
  overflow:hidden;animation:ug-rise .18s ease;
}
.ug-mascot-panel-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 14px;border-bottom:1px solid var(--line);
  font-size:13px;font-weight:700;background:var(--surface-2);
}
.ug-mascot-list{ display:flex;flex-direction:column;max-height:360px;overflow-y:auto; }
.ug-mascot-item{
  display:flex;align-items:flex-start;gap:10px;padding:10px 14px;
  border-bottom:1px solid var(--line);font-size:12.5px;
  color:var(--text);text-decoration:none;transition:background .12s;
}
.ug-mascot-item:last-child{ border-bottom:none; }
.ug-mascot-item:hover{ background:var(--surface-3); }
.ug-mi-dot{ flex:0 0 auto;margin-top:1px; }
.ug-mascot-empty{
  padding:28px 16px;text-align:center;color:var(--muted);font-size:12.5px;line-height:1.6;
}

html[data-theme="dark"] .ug-mascot-btn{
  background:#f4f4f5;box-shadow:0 4px 20px rgba(0,0,0,.5);
}
html[data-theme="dark"] .ug-mascot-icon circle:first-child{ fill:#16181D; }

/* Liquidación de comisiones — bloque por vendedor */
.commission-seller-block{
  border:1px solid var(--line);border-radius:var(--radius-lg);margin-bottom:14px;overflow:hidden;
}
.commission-seller-head{
  display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;
  gap:8px;padding:12px 16px;background:var(--surface-2);border-bottom:1px solid var(--line);
}
.commission-seller-summary{ display:flex;flex-direction:column;align-items:flex-end;gap:2px; }
.commission-due{ font-size:14px;font-weight:700;color:var(--danger); }

/* =====================================================
   Editor inline del delegador en panel económico
   ===================================================== */
.delegator-inline-editor{
  background:var(--surface-3);border-radius:10px;padding:10px 12px;
  display:flex;flex-direction:column;gap:7px;margin-top:4px;
}
.die-row{
  display:flex;align-items:center;gap:7px;flex-wrap:wrap;
}
.die-label{
  font-size:11.5px;color:var(--muted);white-space:nowrap;
}
.die-input{
  flex:1;min-width:70px;max-width:120px;
  padding:4px 8px;border-radius:7px;border:1.5px solid var(--line);
  background:var(--surface);color:var(--text);font-size:13px;
  font-family:inherit;
}
.die-input:focus{ outline:none;border-color:var(--ink); }
.die-eq{
  font-size:12.5px;font-weight:600;color:var(--ok);white-space:nowrap;
}
html[data-theme="dark"] .die-input{
  background:var(--surface-2);border-color:var(--line);
}

/* =====================================================
   MODO OSCURO — correcciones completas
   Todos los elementos con colores hardcoded que no
   respondían al tema oscuro.
   ===================================================== */

/* Inputs y selects — el focus ring es casi invisible en oscuro */
html[data-theme="dark"] .field input:focus,
html[data-theme="dark"] .field select:focus,
html[data-theme="dark"] .field textarea:focus{
  box-shadow:0 0 0 3px rgba(244,244,245,.12);
}

/* Topbar — fondo */
html[data-theme="dark"] .topbar{
  background:var(--sidebar-bg);
  border-bottom-color:var(--line);
}

/* Sidebar */
html[data-theme="dark"] .sidebar{
  background:var(--sidebar-bg);
  border-right-color:var(--line);
}

/* Card blanca — en modo oscuro usa surface-2 */
html[data-theme="dark"] .card-white{
  background:var(--surface-2);
  border-color:var(--line);
}

/* Tablas — header */
html[data-theme="dark"] .crm-table th{
  background:var(--surface-3);
  border-color:var(--line);
}
html[data-theme="dark"] .crm-table td{
  border-color:var(--line);
}

/* Kanban de tareas */
html[data-theme="dark"] .kanban-col{
  background:var(--surface-3);
}
html[data-theme="dark"] .task-card{
  background:var(--surface-2);
  border-color:var(--line);
}
html[data-theme="dark"] .task-card:hover{
  background:var(--surface-3);
}
html[data-theme="dark"] .kanban-col-head{
  border-color:var(--line);
}

/* Toggle Sí/No */
html[data-theme="dark"] .yn-toggle{
  background:var(--surface-3);
  border-color:var(--line);
}
html[data-theme="dark"] .yn-toggle.on{
  background:rgba(34,197,94,.2);
  border-color:rgba(34,197,94,.4);
}
html[data-theme="dark"] .yn-toggle.on .yn-dot{
  background:#4ade80;
}

/* Progress bar */
html[data-theme="dark"] .progress-bar.full span{
  background:#4ade80;
}

/* Alert rows */
html[data-theme="dark"] .alert-row.danger{
  background:var(--danger-pale);
  color:var(--danger);
}
html[data-theme="dark"] .backup-banner{
  background:var(--info-pale);
  color:var(--navy);
}

/* Barra de selección masiva */
html[data-theme="dark"] .bulk-bar,
html[data-theme="dark"] .floating-bulk-bar{
  background:var(--surface-2);
  border-color:var(--line);
  color:var(--text);
}
html[data-theme="dark"] .bulk-bar select,
html[data-theme="dark"] .floating-bulk-bar select{
  background:var(--surface-3);
  color:var(--text);
  border-color:var(--line);
}

/* Panel de conexión */
html[data-theme="dark"] .conn-banner{
  background:var(--surface-2);
  border-color:var(--line);
}

/* Valoraciones — panel después */
html[data-theme="dark"] .val-panel-after{
  background:rgba(34,197,94,.07);
}
html[data-theme="dark"] .val-panel-label-after{
  color:#4ade80;
}

/* Portfolio band */
html[data-theme="dark"] .portfolio-band{
  background:var(--surface-3);
  border-color:var(--line);
}

/* Info block */
html[data-theme="dark"] .info-block{
  background:var(--surface-3);
}

/* Drawer links */
html[data-theme="dark"] .drawer-link{
  border-color:var(--line);
}
html[data-theme="dark"] .drawer-link:hover{
  background:var(--surface-3);
}

/* Tags de plataforma */
html[data-theme="dark"] .platform-badge{
  background:var(--surface-3);
  border-color:var(--line);
}

/* Chip de canal de plantilla */
html[data-theme="dark"] .tpl-channel-label{
  background:var(--surface-3);
  color:var(--text);
}

/* Variable chips en plantillas */
html[data-theme="dark"] .var-chip{
  background:var(--surface-3);
  border-color:var(--line);
}
html[data-theme="dark"] .var-chip:hover{
  background:var(--surface-2);
}

/* Progress steps del timeline */
html[data-theme="dark"] .tl-step .tl-dot{
  background:var(--surface-3);
  border-color:var(--line);
}
html[data-theme="dark"] .tl-step.done .tl-dot{
  background:#4ade80;
  border-color:#4ade80;
}
html[data-theme="dark"] .tl-step.current .tl-dot{
  background:var(--navy);
  border-color:var(--navy);
}
html[data-theme="dark"] .tl-line{
  background:var(--line);
}

/* File chips en cronología */
html[data-theme="dark"] .file-chip{
  background:var(--surface-3);
  border-color:var(--line);
  color:var(--text);
}
html[data-theme="dark"] .file-chip:hover{
  background:var(--surface-2);
}
html[data-theme="dark"] .file-chip-broken{
  background:var(--surface-3);
  border-color:var(--line);
  color:var(--muted);
}

/* Panel de notas */
html[data-theme="dark"] .notes-panel{
  background:var(--surface-2);
  border-color:var(--line);
}

/* Checklist de pedido */
html[data-theme="dark"] .cl-check{
  accent-color:#4ade80;
}

/* Ganancia neta */
html[data-theme="dark"] .totals-row.profit{
  color:#4ade80;
}

/* Badge inline (ej: vencidos en recordatorios) */
html[data-theme="dark"] .badge-count-inline{
  /* ya tiene colores inline — no necesita override */
}

/* Mascota panel */
html[data-theme="dark"] .ug-mascot-panel{
  background:var(--surface-2);
  border-color:var(--line);
}
html[data-theme="dark"] .ug-mascot-panel-head{
  background:var(--surface-3);
  border-color:var(--line);
}
html[data-theme="dark"] .ug-mascot-item:hover{
  background:var(--surface-3);
}

/* Editor inline del delegador */
html[data-theme="dark"] .delegator-inline-editor{
  background:var(--surface-3);
  border-color:var(--line);
}

/* Modal de factura */
html[data-theme="dark"] .invoice-form-section{
  color:var(--text);
}

/* Panel de timeline entry */
html[data-theme="dark"] .tl-entry{
  background:var(--surface-2);
  border-color:var(--line);
}
html[data-theme="dark"] .tl-entry:hover{
  background:var(--surface-3);
}

/* Tabs */
html[data-theme="dark"] .tabs{
  border-color:var(--line);
}

/* Opciones de la barra lateral de clientes / pedidos */
html[data-theme="dark"] .ok-card{
  background:var(--surface-2);
  border-color:var(--line);
}

/* Split rows */
html[data-theme="dark"] .split-row{
  border-color:var(--line);
}

/* Checklist dark mode ya cubierto arriba, este cubre el input type=checkbox */
html[data-theme="dark"] input[type="checkbox"]{
  accent-color:#4ade80;
}

/* Dropdown menus */
html[data-theme="dark"] .dropdown-menu{
  background:var(--surface-2);
  border-color:var(--line);
  box-shadow:0 8px 24px rgba(0,0,0,.4);
}
html[data-theme="dark"] .dropdown-item:hover{
  background:var(--surface-3);
}

/* Recalc btn */
html[data-theme="dark"] .btn:not(.btn-dark):not(.btn-ghost):not(.btn-navy){
  background:var(--surface-3);
  border-color:var(--line);
  color:var(--text);
}
html[data-theme="dark"] .btn:not(.btn-dark):not(.btn-ghost):not(.btn-navy):hover{
  background:var(--surface-2);
}

/* =====================================================
   MODO OSCURO — correcciones completas
   ===================================================== */

html[data-theme="dark"] .field input:focus,
html[data-theme="dark"] .field select:focus,
html[data-theme="dark"] .field textarea:focus{
  box-shadow:0 0 0 3px rgba(244,244,245,.12);
}
html[data-theme="dark"] .topbar{
  background:var(--sidebar-bg);border-bottom-color:var(--line);
}
html[data-theme="dark"] .sidebar{
  background:var(--sidebar-bg);border-right-color:var(--line);
}
html[data-theme="dark"] .card-white{
  background:var(--surface-2);border-color:var(--line);
}
html[data-theme="dark"] .crm-table th{
  background:var(--surface-3);border-color:var(--line);
}
html[data-theme="dark"] .crm-table td{ border-color:var(--line); }
html[data-theme="dark"] .kanban-col{ background:var(--surface-3); }
html[data-theme="dark"] .task-card{ background:var(--surface-2);border-color:var(--line); }
html[data-theme="dark"] .task-card:hover{ background:var(--surface-3); }
html[data-theme="dark"] .kanban-col-head{ border-color:var(--line); }
html[data-theme="dark"] .yn-toggle{ background:var(--surface-3);border-color:var(--line); }
html[data-theme="dark"] .yn-toggle.on{ background:rgba(34,197,94,.2);border-color:rgba(34,197,94,.4); }
html[data-theme="dark"] .yn-toggle.on .yn-dot{ background:#4ade80; }
html[data-theme="dark"] .progress-bar.full span{ background:#4ade80; }
html[data-theme="dark"] .alert-row.danger{ background:var(--danger-pale);color:var(--danger); }
html[data-theme="dark"] .backup-banner{ background:var(--info-pale);color:var(--navy); }
html[data-theme="dark"] .bulk-bar,
html[data-theme="dark"] .floating-bulk-bar{
  background:var(--surface-2);border-color:var(--line);color:var(--text);
}
html[data-theme="dark"] .bulk-bar select,
html[data-theme="dark"] .floating-bulk-bar select{
  background:var(--surface-3);color:var(--text);border-color:var(--line);
}
html[data-theme="dark"] .conn-banner{ background:var(--surface-2);border-color:var(--line); }
html[data-theme="dark"] .portfolio-band{ background:var(--surface-3);border-color:var(--line); }
html[data-theme="dark"] .info-block{ background:var(--surface-3); }
html[data-theme="dark"] .drawer-link{ border-color:var(--line); }
html[data-theme="dark"] .drawer-link:hover{ background:var(--surface-3); }
html[data-theme="dark"] .platform-badge{ background:var(--surface-3);border-color:var(--line); }
html[data-theme="dark"] .tpl-channel-label{ background:var(--surface-3);color:var(--text); }
html[data-theme="dark"] .var-chip{ background:var(--surface-3);border-color:var(--line); }
html[data-theme="dark"] .var-chip:hover{ background:var(--surface-2); }
html[data-theme="dark"] .tl-step .tl-dot{ background:var(--surface-3);border-color:var(--line); }
html[data-theme="dark"] .tl-step.done .tl-dot{ background:#4ade80;border-color:#4ade80; }
html[data-theme="dark"] .tl-step.current .tl-dot{ background:var(--navy);border-color:var(--navy); }
html[data-theme="dark"] .tl-line{ background:var(--line); }
html[data-theme="dark"] .file-chip{
  background:var(--surface-3);border-color:var(--line);color:var(--text);
}
html[data-theme="dark"] .file-chip:hover{ background:var(--surface-2); }
html[data-theme="dark"] .file-chip-broken{
  background:var(--surface-3);border-color:var(--line);color:var(--muted);
}
html[data-theme="dark"] .notes-panel{ background:var(--surface-2);border-color:var(--line); }
html[data-theme="dark"] input[type="checkbox"]{ accent-color:#4ade80; }
html[data-theme="dark"] .dropdown-menu{
  background:var(--surface-2);border-color:var(--line);box-shadow:0 8px 24px rgba(0,0,0,.4);
}
html[data-theme="dark"] .dropdown-item:hover{ background:var(--surface-3); }
html[data-theme="dark"] .ug-mascot-panel{ background:var(--surface-2);border-color:var(--line); }
html[data-theme="dark"] .ug-mascot-panel-head{ background:var(--surface-3);border-color:var(--line); }
html[data-theme="dark"] .ug-mascot-item:hover{ background:var(--surface-3); }
html[data-theme="dark"] .delegator-inline-editor{ background:var(--surface-3);border-color:var(--line); }
html[data-theme="dark"] .tl-entry{ background:var(--surface-2);border-color:var(--line); }
html[data-theme="dark"] .tl-entry:hover{ background:var(--surface-3); }
html[data-theme="dark"] .tabs{ border-color:var(--line); }
html[data-theme="dark"] .ok-card{ background:var(--surface-2);border-color:var(--line); }
html[data-theme="dark"] .split-row{ border-color:var(--line); }
html[data-theme="dark"] .totals-row.profit{ color:#4ade80; }
html[data-theme="dark"] .filter-group-label{ color:var(--muted); }
html[data-theme="dark"] .orders-filter-bar .filter-sep{ background:var(--line); }
html[data-theme="dark"] .lead-card-co{ color:var(--muted); }
html[data-theme="dark"] .commission-due{ color:#f87171; }
html[data-theme="dark"] .search-group h5{ color:var(--muted); border-color:var(--line); }
html[data-theme="dark"] .search-item:hover{ background:var(--surface-3); }
html[data-theme="dark"] .global-search-modal{ background:var(--surface-2); }
html[data-theme="dark"] .modal-backdrop{ background:rgba(0,0,0,.6); }
html[data-theme="dark"] .tab-panel{ background:transparent; }
html[data-theme="dark"] .p-order-row{ border-color:var(--line); }
html[data-theme="dark"] .p-order-row:hover{ background:var(--surface-3); }
html[data-theme="dark"] .dash-reminder-row{ border-color:var(--line); }
html[data-theme="dark"] .presence-tooltip{
  background:var(--surface-2);border:1px solid var(--line);
  box-shadow:0 8px 24px rgba(0,0,0,.4);
}
html[data-theme="dark"] .presence-tooltip::before{ border-bottom-color:var(--surface-2); }
html[data-theme="dark"] .ptt-name{ color:var(--text); }
html[data-theme="dark"] .ptt-where{ color:var(--muted); }
html[data-theme="dark"] .active-filter-chip{ background:var(--text);color:var(--bg); }
html[data-theme="dark"] .btn:not(.btn-dark):not(.btn-ghost):not(.btn-navy):not([style*="background"]){
  background:var(--surface-3);border-color:var(--line);color:var(--text);
}
html[data-theme="dark"] .btn:not(.btn-dark):not(.btn-ghost):not(.btn-navy):not([style*="background"]):hover{
  background:var(--surface-2);
}
