:root {
  --blue:     #1A8FE3;
  --blue2:    #39aff0;
  --blue-dim: rgba(26,143,227,.08);
  --green:    #2ECC6A;
  --green2:   #5cd97b;
  --green-dim:rgba(46,204,106,.07);
  --grad:     linear-gradient(125deg,#1A8FE3 0%,#2ECC6A 100%);
  --bg:       #080d12;
  --surface:  #121b25;
  --surface2: #18232f;
  --surface3: #1f2d3d;
  --border:   rgba(26,143,227,.14);
  --border2:  rgba(46,204,106,.12);
  --ink:      #e2eaf4;
  --ink2:     #8fa8c0;
  --muted:    #445a70;
  --accent:   #2ECC6A;
  --accent2:  #5cd97b;
  --wa:       #25D366;
  --warn:     #e5943a;
  --danger:   #e05444;
  --ok:       #2ECC6A;
  --head:     'Bebas Neue', sans-serif;
  --body:     'Outfit', sans-serif;
  --mono:     'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg:       #f4f7fb;
  --surface:  #ffffff;
  --surface2: #f0f4f9;
  --surface3: #e8eef6;
  --border:   rgba(26,143,227,.15);
  --border2:  rgba(46,204,106,.12);
  --ink:      #0c1828;
  --ink2:     #3a5068;
  --muted:    #8fa8c0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { width: 100%; overflow-x: hidden; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); min-height: 100vh; width: 100%; overflow-x: hidden; }

/* El grid hace que el sidebar estire hasta la altura del contenido */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  width: 100%;
  align-items: start; /* cada columna arranca desde arriba */
}

/* ── Sidebar ── */
.sidebar {
  background: var(--ink);
  display: flex; flex-direction: column;
  /* sticky: se pega al top y baja con el scroll */
  position: sticky; top: 0;
  /* min-height: al menos la pantalla; height: auto para crecer si hay muchos items */
  min-height: 100vh;
  height: 100vh;           /* queda dentro de la ventana */
  overflow-y: auto;        /* scroll interno si el menú es muy largo */
  /* Sin esto el sidebar se quedaba a mitad de página cuando el contenido era largo:
     align-self: stretch hace que el sidebar estire JUNTO con el main */
  align-self: stretch;
  /* Restablece height a auto para estirarse */
  height: auto;
  min-height: 100vh;
}
.brand { padding: 22px 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-name { font-family: var(--head); font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -1px; }
.brand-tag { font-size: 9px; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: 2px; margin-top: 2px; }
.nav { padding: 12px 0; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; cursor: pointer; font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.45); border-left: 2px solid transparent; transition: all .15s;
}
.nav-item:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.04); }
.nav-item.active { color: #fff; border-left-color: var(--accent2); background: rgba(37,162,68,.12); }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 10px; font-size: 10px; padding: 1px 6px; display: none; }
.sidebar-bottom { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.stat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.stat-lbl { font-size: 10px; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: 1px; }
.stat-num { font-family: var(--mono); font-size: 14px; color: #fff; }

/* ── Main ── */
.main { display: flex; flex-direction: column; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 26px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.page-title { font-family: var(--head); font-size: 18px; font-weight: 700; letter-spacing: -.5px; }
.content { flex: 1; padding: 24px 26px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer;
  font-family: var(--body); font-size: 13px; font-weight: 600; transition: all .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: #1eb856; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: rgba(192,57,43,.1); color: var(--danger); border: 1px solid rgba(192,57,43,.3); }
.btn-sm { padding: 5px 10px; font-size: 11px; }

/* ── Panel ── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 20px; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--surface2); }
.panel-title { font-family: var(--head); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--ink2); }
.panel-body { padding: 20px; }

/* ── Form ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 13px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
input, select, textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--ink); padding: 8px 11px; font-family: var(--body); font-size: 13px;
  transition: border-color .15s; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,107,60,.1); }
textarea { resize: vertical; min-height: 68px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 9px 14px; text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); border-bottom: 2px solid var(--border); white-space: nowrap; font-weight: 600; background: var(--surface2); }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(26,107,60,.03); }
.no-data { text-align: center; padding: 50px; color: var(--muted); font-size: 13px; font-style: italic; }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; border: 1px solid; }
.badge-recibido    { background: #f0f0f0; color: #666; border-color: #ddd; }
.badge-diagnostico { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge-reparacion  { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.badge-listo       { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge-entregado   { background: #f0fdf4; color: #15803d; border-color: #d1fae5; }
.badge-cancelado   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.days-ok   { font-family: var(--mono); font-size: 12px; color: var(--ok); }
.days-warn { font-family: var(--mono); font-size: 12px; color: var(--warn); font-weight: 700; }
.days-over { font-family: var(--mono); font-size: 12px; color: var(--danger); font-weight: 700; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 100; animation: fadeIn .15s; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: 92%; max-width: 680px; max-height: 92vh; overflow-y: auto; animation: slideUp .2s; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--surface2); }
.modal-title { font-family: var(--head); font-size: 15px; font-weight: 700; }
.modal-close { background: none; border: 1px solid var(--border); color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 8px; border-radius: 4px; }
.modal-close:hover { background: var(--surface2); color: var(--ink); }
.modal-body { padding: 20px; }

/* ── Detail ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.detail-item { background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 10px 13px; }
.detail-key { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; margin-bottom: 3px; }
.detail-val { font-size: 13px; color: var(--ink); }

/* ── Timeline ── */
.timeline { margin-bottom: 18px; }
.tl-step { display: flex; gap: 12px; }
.tl-dc { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); flex-shrink: 0; margin-top: 4px; border: 2px solid var(--border); }
.tl-dot.done   { background: var(--accent2); border-color: var(--accent2); }
.tl-dot.active { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,107,60,.2); }
.tl-line { width: 1px; flex: 1; background: var(--border); min-height: 18px; }
.tl-content { padding-bottom: 16px; }
.tl-label { font-size: 13px; font-weight: 600; }
.tl-time { font-size: 11px; color: var(--muted); }

/* ── Notes ── */
.note-item { background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px; padding: 9px 12px; margin-bottom: 7px; }
.note-meta { font-size: 10px; color: var(--muted); margin-bottom: 3px; }
.note-text { font-size: 12px; }

/* ── WhatsApp msg preview ── */
.wa-preview { background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 8px; padding: 12px 14px; font-size: 12px; font-family: var(--mono); white-space: pre-wrap; line-height: 1.6; color: #1b5e20; margin: 12px 0; }

/* ── Receipt print ── */
.receipt { background: #fff; color: #000; border-radius: 6px; padding: 22px; font-family: 'Courier New', monospace; font-size: 11.5px; line-height: 1.65; max-width: 360px; margin: 0 auto; }
.r-brand { font-size: 20px; font-weight: 900; font-family: 'Outfit', sans-serif; letter-spacing: -1px; text-align: center; }
.r-sub { font-size: 9px; color: #555; text-transform: uppercase; letter-spacing: 2px; text-align: center; }
.r-id { text-align: center; font-size: 24px; font-weight: 900; letter-spacing: 5px; margin: 8px 0; }
.r-divider { border: none; border-top: 1px dashed #bbb; margin: 9px 0; }
.r-table { width: 100%; font-size: 11px; border-collapse: collapse; }
.r-table td { padding: 2px 0; vertical-align: top; }
.r-table td:first-child { color: #666; width: 42%; }
.r-legal { background: #fffde7; border: 1px solid #f9a825; border-radius: 4px; padding: 8px; margin-top: 10px; font-size: 10px; line-height: 1.55; }
.r-footer { text-align: center; margin-top: 12px; font-size: 9.5px; color: #888; }

/* ── Alertas ── */
.alert-card { border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; border: 1px solid; }

/* ── Firebase status ── */
.fb-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 4px 10px; border-radius: 20px; }
.fb-online { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.fb-offline { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Fotos ── */
.foto-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.foto-slot {
  aspect-ratio: 1; border-radius: 8px; overflow: hidden; position: relative;
  background: var(--surface2); border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color .15s;
}
.foto-slot:hover { border-color: var(--accent); }
.foto-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-slot .foto-del {
  position: absolute; top: 4px; right: 4px;
  background: rgba(192,57,43,.85); color: #fff; border: none; border-radius: 50%;
  width: 20px; height: 20px; font-size: 11px; cursor: pointer; display: none;
  align-items: center; justify-content: center; line-height: 1;
}
.foto-slot:hover .foto-del { display: flex; }
.foto-slot .foto-add { font-size: 22px; color: var(--muted); pointer-events: none; }
.foto-uploading { opacity: .5; pointer-events: none; }
.foto-spinner { position: absolute; inset: 0; background: rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; }

/* ── Lightbox ── */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 200; display: flex; align-items: center; justify-content: center; animation: fadeIn .15s; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 6px; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.lightbox-close { position: absolute; top: 16px; right: 20px; background: none; border: none; color: #fff; font-size: 28px; cursor: pointer; opacity: .7; }
.lightbox-close:hover { opacity: 1; }

/* ── Calendario ── */
.cal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.cal-nav { display:flex; align-items:center; gap:10px; }
.cal-month { font-family:var(--head); font-size:18px; font-weight:700; min-width:180px; text-align:center; }
.cal-btn { background:var(--surface2); border:1px solid var(--border); border-radius:6px; padding:6px 12px; cursor:pointer; font-size:13px; font-weight:600; color:var(--ink); transition:all .15s; }
.cal-btn:hover { border-color:var(--accent); color:var(--accent); }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.cal-dayname { text-align:center; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:var(--muted); padding:6px 0; }
.cal-day {
  min-height:80px; background:var(--surface); border:1px solid var(--border);
  border-radius:8px; padding:6px; cursor:pointer; transition:all .15s; position:relative;
}
.cal-day:hover { border-color:var(--accent); background:rgba(26,107,60,.03); }
.cal-day.today { border-color:var(--accent); background:rgba(26,107,60,.05); }
.cal-day.other-month { background:var(--surface2); opacity:.5; cursor:default; }
.cal-day.full { background:#fef2f2; border-color:#fecaca; }
.cal-day.full:hover { background:#fee2e2; }
.cal-day-num { font-size:12px; font-weight:700; color:var(--ink2); margin-bottom:4px; }
.cal-day.today .cal-day-num { color:var(--accent); }
.cal-day.other-month .cal-day-num { color:var(--muted); }
.cal-event {
  font-size:10px; padding:2px 5px; border-radius:3px; margin-bottom:2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer;
  font-weight:500; line-height:1.4;
}
.cal-event.entrada  { background:#dbeafe; color:#1e40af; }
.cal-event.entrega  { background:#dcfce7; color:#166534; }
.cal-event.vence    { background:#fef3c7; color:#92400e; }
.cal-capacity {
  position:absolute; bottom:4px; right:5px;
  font-size:9px; font-weight:700; padding:1px 5px; border-radius:10px;
}
.cap-ok   { background:#dcfce7; color:#166534; }
.cap-warn { background:#fef3c7; color:#92400e; }
.cap-full { background:#fef2f2; color:#991b1b; }

.cal-legend { display:flex; gap:14px; flex-wrap:wrap; margin-bottom:16px; }
.cal-leg-item { display:flex; align-items:center; gap:5px; font-size:11px; color:var(--muted); }
.cal-leg-dot { width:10px; height:10px; border-radius:2px; }

.cal-sidebar { display:grid; grid-template-columns:1fr 300px; gap:16px; }
.cal-detail-panel { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:16px; height:fit-content; position:sticky; top:80px; }
.cal-detail-title { font-family:var(--head); font-size:14px; font-weight:700; margin-bottom:12px; color:var(--ink); }
.cal-detail-empty { color:var(--muted); font-size:12px; font-style:italic; text-align:center; padding:20px 0; }
.cal-order-card { background:var(--bg); border:1px solid var(--border); border-radius:7px; padding:10px 12px; margin-bottom:8px; cursor:pointer; transition:border-color .15s; }
.cal-order-card:hover { border-color:var(--accent); }
.cal-order-id { font-family:var(--mono); font-size:10px; color:var(--accent); font-weight:600; }
.cal-order-name { font-size:13px; font-weight:600; margin:2px 0; }
.cal-order-info { font-size:11px; color:var(--muted); }

.tecnico-tag { display:inline-block; padding:2px 7px; border-radius:10px; font-size:10px; font-weight:600; }
.tec-0 { background:#dbeafe; color:#1e40af; }
.tec-1 { background:#f3e8ff; color:#6b21a8; }

@media(max-width:900px){ .cal-sidebar { grid-template-columns:1fr; } }

/* ── Inventario & Bodega ── */
.inv-summary { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:10px; margin-bottom:20px; }
.inv-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:14px 16px; }
.inv-card-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:var(--muted); margin-bottom:4px; }
.inv-card-val { font-family:var(--mono); font-size:20px; font-weight:700; }
.inv-form { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:10px; align-items:end; margin-bottom:16px; }
.inv-form .form-group { margin:0; }
.cat-badge { display:inline-block; padding:2px 8px; border-radius:4px; font-size:10px; font-weight:600; }
.cat-electronico { background:#dbeafe; color:#1e40af; }
.cat-repuesto    { background:#f3e8ff; color:#6b21a8; }
.cat-filamento   { background:#dcfce7; color:#166534; }
.cat-otro        { background:#f0f0f0; color:#555; }
.stock-low  { color:var(--danger); font-weight:700; }
.stock-ok   { color:var(--ok); }
.bod-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:14px 16px; margin-bottom:10px; display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.bod-info { flex:1; }
.bod-id   { font-family:var(--mono); font-size:11px; color:var(--accent); font-weight:600; margin-bottom:3px; }
.bod-name { font-size:14px; font-weight:700; margin-bottom:2px; }
.bod-meta { font-size:12px; color:var(--muted); }
.bod-val  { text-align:right; }
.bod-precio { font-family:var(--mono); font-size:16px; font-weight:700; color:var(--warn); }
.bod-dias   { font-size:10px; color:var(--muted); margin-top:2px; }
.bod-estado { display:inline-block; padding:3px 8px; border-radius:4px; font-size:10px; font-weight:600; margin-top:4px; }
.bod-disponible { background:#dcfce7; color:#166534; }
.bod-vendido    { background:#f0f0f0; color:#555; }
.bod-desechado  { background:#fef2f2; color:#991b1b; }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }

/* ── Login ── */
#login-screen { position:fixed; inset:0; background:var(--ink); display:none; align-items:center; justify-content:center; z-index:999; animation:fadeIn .3s; }
#login-screen.visible { display:flex !important; }
#splash-screen { position:fixed; inset:0; background:var(--ink); display:flex; flex-direction:column; align-items:center; justify-content:center; z-index:1000; transition:opacity .5s; }
#splash-screen.oculto { opacity:0; pointer-events:none; }
.splash-logo { font-family:'Outfit',sans-serif; font-size:42px; font-weight:800; color:#fff; letter-spacing:-2px; margin-bottom:8px; }
.splash-tag  { font-size:11px; color:rgba(255,255,255,.4); text-transform:uppercase; letter-spacing:2px; margin-bottom:32px; }
.splash-spinner { width:28px; height:28px; border:3px solid rgba(255,255,255,.15); border-top-color:var(--accent2); border-radius:50%; animation:spin .7s linear infinite; }
.login-box { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:36px 32px; width:340px; box-shadow:0 24px 60px rgba(0,0,0,.5); }
.login-logo { font-family:var(--head); font-size:28px; font-weight:800; color:var(--accent); letter-spacing:-1px; text-align:center; margin-bottom:4px; }
.login-sub  { font-size:11px; color:var(--muted); text-align:center; text-transform:uppercase; letter-spacing:2px; margin-bottom:28px; }
.login-error { background:#fef2f2; border:1px solid #fecaca; border-radius:6px; padding:8px 12px; font-size:12px; color:var(--danger); margin-bottom:12px; display:none; }

/* ── Clientes ── */
.cli-star { color:#f59e0b; font-size:16px; cursor:pointer; }
.cli-star.off { color:var(--border); }
.cli-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:14px 16px; margin-bottom:10px; display:flex; justify-content:space-between; align-items:flex-start; gap:12px; transition:border-color .15s; cursor:pointer; }
.cli-card:hover { border-color:var(--accent); }
.cli-tier { display:inline-block; padding:2px 8px; border-radius:10px; font-size:10px; font-weight:700; }
.tier-bronce { background:#fef3c7; color:#92400e; }
.tier-plata  { background:#f1f5f9; color:#475569; }
.tier-oro    { background:#fef9c3; color:#854d0e; }
.tier-vip    { background:#f3e8ff; color:#6b21a8; }
.desc-badge  { background:#dcfce7; color:#166534; border:1px solid #bbf7d0; padding:2px 8px; border-radius:10px; font-size:10px; font-weight:700; }

/* ── Contabilidad ── */
.conta-kpi { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:10px; margin-bottom:20px; }
.kpi-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:14px 16px; }
.kpi-lbl  { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:var(--muted); margin-bottom:4px; }
.kpi-val  { font-family:var(--mono); font-size:20px; font-weight:700; }
.chart-wrap { overflow-x:auto; }
.chart-inner { display:flex; align-items:flex-end; gap:8px; height:140px; padding:0 4px 24px; min-width:400px; }
.chart-grp   { flex:1; display:flex; gap:3px; align-items:flex-end; position:relative; }
.chart-b     { flex:1; border-radius:3px 3px 0 0; min-width:10px; transition:opacity .2s; }
.chart-b:hover { opacity:.8; }
.chart-lbl   { position:absolute; bottom:-20px; left:50%; transform:translateX(-50%); font-size:9px; color:var(--muted); white-space:nowrap; }
.mov-row { display:flex; justify-content:space-between; align-items:center; padding:9px 14px; border-bottom:1px solid var(--border); font-size:13px; }
.mov-row:last-child { border-bottom:none; }
.mov-ing  { color:var(--ok); font-family:var(--mono); font-weight:700; }
.mov-gas  { color:var(--danger); font-family:var(--mono); font-weight:700; }
.mov-tipo { display:inline-block; padding:2px 7px; border-radius:4px; font-size:10px; font-weight:600; }
.t-ingreso { background:#dcfce7; color:#166534; }
.t-gasto   { background:#fef2f2; color:#991b1b; }
.t-bodega  { background:#fef3c7; color:#92400e; }


/* ── Roles ── */
.jefe-only   { /* mostrado por defecto, ocultado por JS para trabajadores */ }
.worker-only { display:none; /* mostrado por JS para trabajadores */ }
.rol-badge { display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:20px;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.5px; }

/* ── Pantalla splash ── */
#splash-screen { position:fixed;inset:0;background:var(--ink);display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:1000;transition:opacity .5s; }
#splash-screen.oculto { opacity:0;pointer-events:none; }
.splash-logo { font-family:'Outfit',sans-serif;font-size:42px;font-weight:800;color:#fff;letter-spacing:-2px;margin-bottom:8px; }
.splash-tag  { font-size:11px;color:rgba(255,255,255,.4);text-transform:uppercase;letter-spacing:2px;margin-bottom:32px; }
.splash-spinner { width:28px;height:28px;border:3px solid rgba(255,255,255,.15);border-top-color:var(--accent2);border-radius:50%;animation:spin .7s linear infinite; }


/* ── Chat interno ── */
.chat-msg {
  display: flex; gap: 8px; align-items: flex-end; max-width: 85%;
}
.chat-msg.mine { flex-direction: row-reverse; align-self: flex-end; }
.chat-msg.other { align-self: flex-start; }
.chat-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.avatar-jefe { background: #6b21a8; }
.avatar-worker { background: var(--accent); }
.chat-bubble {
  padding: 9px 13px; border-radius: 14px; font-size: 13px; line-height: 1.5;
  max-width: 100%; word-break: break-word; position: relative;
}
.chat-msg.mine .chat-bubble {
  background: var(--accent); color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.other .chat-bubble {
  background: var(--surface); border: 1px solid var(--border);
  border-bottom-left-radius: 4px; color: var(--ink);
}
.chat-meta { font-size: 10px; color: var(--muted); margin-top: 3px; text-align: right; }
.chat-msg.other .chat-meta { text-align: left; }
.chat-sender { font-size: 10px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.chat-orden-ref {
  background: rgba(26,107,60,.1); border: 1px solid rgba(26,107,60,.25);
  border-radius: 8px; padding: 5px 10px; font-size: 11px; margin-top: 5px;
  cursor: pointer; display: inline-block; color: var(--accent); font-weight: 600;
}
.chat-orden-ref:hover { background: rgba(26,107,60,.18); }
.hilo-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); margin-bottom: 6px; transition: all .15s;
}
.hilo-item:hover { border-color: var(--accent); background: rgba(26,107,60,.04); }
.hilo-item.active { border-color: var(--accent); background: rgba(26,107,60,.08); }
.hilo-badge { background: var(--danger); color: #fff; border-radius: 50%;
  width: 18px; height: 18px; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }


/* ══════════════════════════════════════════════════
   MÓDULO COTIZACIÓN / FACTURA
══════════════════════════════════════════════════ */
.doc-tabs { display:flex; gap:6px; margin-bottom:16px; flex-wrap:wrap; }
.doc-tab {
  padding:8px 20px; border-radius:8px; border:2px solid var(--border);
  background:var(--surface); font-size:13px; font-weight:600; cursor:pointer;
  color:var(--muted); transition:all .15s;
}
.doc-tab.active { border-color:var(--accent); color:var(--accent); background:rgba(26,107,60,.06); }
.doc-tab:hover:not(.active) { border-color:var(--accent2); color:var(--ink); }

/* Preview del documento */
.doc-preview {
  background:#fff; border:1px solid var(--border); border-radius:10px;
  box-shadow:0 4px 24px rgba(0,0,0,.08); overflow:hidden;
  font-family:'Arial', sans-serif; max-width:780px; margin:0 auto;
}
.doc-preview * { box-sizing:border-box; }
.doc-header-band {
  background:linear-gradient(135deg,#1a6b3c 0%,#0f4a28 100%);
  padding:24px 32px; color:#fff; display:flex; justify-content:space-between; align-items:flex-start;
}
.doc-brand-name { font-size:26px; font-weight:900; letter-spacing:-1px; margin-bottom:2px; }
.doc-brand-sub  { font-size:10px; opacity:.65; text-transform:uppercase; letter-spacing:2px; }
.doc-brand-contact { font-size:11px; opacity:.75; margin-top:8px; }
.doc-tipo-badge {
  background:rgba(255,255,255,.15); border:1px solid rgba(255,255,255,.3);
  border-radius:8px; padding:8px 16px; text-align:right;
}
.doc-tipo-label { font-size:11px; opacity:.7; text-transform:uppercase; letter-spacing:2px; }
.doc-tipo-num   { font-size:22px; font-weight:800; letter-spacing:-0.5px; margin-top:2px; }
.doc-tipo-fecha { font-size:11px; opacity:.7; margin-top:4px; }

.doc-body { padding:28px 32px; }
.doc-parties { display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-bottom:24px; }
.doc-party-box {
  background:#f8f9fa; border-radius:8px; padding:14px 16px; border:1px solid #e9ecef;
}
.doc-party-label { font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:1.5px; color:#6c757d; margin-bottom:8px; }
.doc-party-name  { font-size:14px; font-weight:700; color:#1a1814; margin-bottom:3px; }
.doc-party-info  { font-size:11px; color:#6c757d; line-height:1.6; }

.doc-desc-box {
  background:#f0fdf4; border:1px solid #bbf7d0; border-radius:8px;
  padding:12px 16px; margin-bottom:20px; font-size:12px; color:#166534; line-height:1.6;
}
.doc-desc-label { font-weight:700; font-size:11px; text-transform:uppercase; letter-spacing:1px; margin-bottom:5px; }

.doc-table { width:100%; border-collapse:collapse; margin-bottom:20px; font-size:12px; }
.doc-table thead tr { background:#1a6b3c; }
.doc-table thead th { padding:9px 12px; text-align:left; color:#fff; font-size:10px; text-transform:uppercase; letter-spacing:.8px; font-weight:600; }
.doc-table thead th:last-child { text-align:right; }
.doc-table tbody tr { border-bottom:1px solid #e9ecef; }
.doc-table tbody tr:nth-child(even) { background:#f8f9fa; }
.doc-table tbody td { padding:9px 12px; color:#333; vertical-align:top; }
.doc-table tbody td:last-child { text-align:right; font-weight:600; color:#1a6b3c; white-space:nowrap; }
.doc-table tfoot td { padding:7px 12px; font-weight:700; border-top:2px solid #1a6b3c; }
.doc-table tfoot .total-row { background:#f0fdf4; font-size:14px; color:#1a6b3c; }

.doc-conditions {
  display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:20px;
}
.doc-cond-box { border:1px solid #e9ecef; border-radius:8px; padding:12px 14px; }
.doc-cond-title { font-size:11px; font-weight:700; color:#1a6b3c; text-transform:uppercase; letter-spacing:.8px; margin-bottom:8px; }
.doc-cond-item { font-size:11px; color:#555; line-height:1.7; }
.doc-cond-item::before { content:'• '; color:#1a6b3c; }

.doc-incl-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:20px; }
.doc-incl-box { border-radius:8px; padding:12px 14px; }
.doc-incl-si  { background:#f0fdf4; border:1px solid #bbf7d0; }
.doc-incl-no  { background:#fff5f5; border:1px solid #fecaca; }
.doc-incl-title { font-size:11px; font-weight:700; margin-bottom:8px; }
.doc-incl-si .doc-incl-title { color:#166534; }
.doc-incl-no .doc-incl-title { color:#dc2626; }

.doc-notas-box {
  background:#fffde7; border:1px solid #f9a825; border-radius:8px;
  padding:14px 16px; margin-bottom:24px; font-size:11px; color:#5f4200; line-height:1.7;
}
.doc-notas-title { font-weight:700; font-size:12px; margin-bottom:8px; }

.doc-firmas { display:grid; grid-template-columns:1fr 1fr; gap:40px; margin-bottom:24px; }
.doc-firma-box { text-align:center; }
.doc-firma-line { border-top:2px solid #333; margin-top:48px; padding-top:8px; font-size:11px; font-weight:700; }
.doc-firma-sub  { font-size:10px; color:#666; margin-top:2px; }

.doc-footer {
  background:#f8f9fa; border-top:1px solid #e9ecef;
  padding:12px 32px; font-size:10px; color:#888; text-align:center; line-height:1.6;
}

/* Items table editor */
.cotiz-items-editor { background:var(--surface); border:1px solid var(--border); border-radius:8px; overflow:hidden; margin-bottom:12px; }
.cotiz-item-row { display:grid; grid-template-columns:2fr 80px 80px 90px 36px; gap:6px; padding:8px 10px; border-bottom:1px solid var(--border); align-items:center; }
.cotiz-item-row:last-child { border-bottom:none; }
.cotiz-item-row input { font-size:12px; padding:5px 8px; border-radius:5px; border:1px solid var(--border); background:var(--bg); color:var(--ink); }
.cotiz-item-row input:focus { border-color:var(--accent); outline:none; }
.cotiz-item-head { background:var(--surface2); font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:var(--muted); }

@media (max-width:768px) {
  .doc-parties, .doc-conditions, .doc-incl-row, .doc-firmas { grid-template-columns:1fr !important; }
  .doc-header-band { flex-direction:column; gap:12px; }
  .cotiz-item-row { grid-template-columns:1fr 60px 60px 70px 32px; }
  .doc-body { padding:16px; }
}


/* ══ WEB MANAGER ══ */
.web-tabs { display:flex; gap:0; border:1px solid var(--border); border-radius:8px; overflow:hidden; margin-bottom:20px; }
.web-tab  { flex:1; padding:10px; text-align:center; cursor:pointer; font-size:12px; font-weight:600;
            background:var(--surface2); color:var(--muted); border:none; transition:all .15s; }
.web-tab.active { background:var(--accent); color:#fff; }
.web-tab:hover:not(.active) { background:var(--surface); color:var(--ink); }

.gallery-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:10px; }
.gallery-item { position:relative; border-radius:10px; overflow:hidden; background:var(--surface2);
                border:2px solid var(--border); aspect-ratio:4/3; cursor:pointer; transition:border-color .15s; }
.gallery-item:hover { border-color:var(--accent); }
.gallery-item img, .gallery-item video { width:100%; height:100%; object-fit:cover; display:block; }
.gallery-item .gal-del { position:absolute; top:6px; right:6px; background:rgba(192,57,43,.9);
  color:#fff; border:none; border-radius:50%; width:24px; height:24px; font-size:12px;
  cursor:pointer; display:none; align-items:center; justify-content:center; }
.gallery-item:hover .gal-del { display:flex; }
.gallery-item .gal-label { position:absolute; bottom:0; left:0; right:0; background:rgba(0,0,0,.55);
  color:#fff; font-size:10px; padding:4px 8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.gallery-add { border:2px dashed var(--border); display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:6px; cursor:pointer; color:var(--muted);
  font-size:12px; font-weight:600; transition:all .15s; aspect-ratio:4/3; border-radius:10px; }
.gallery-add:hover { border-color:var(--accent); color:var(--accent); background:rgba(26,107,60,.04); }

.review-card { background:var(--surface); border:1px solid var(--border); border-radius:10px;
  padding:14px 16px; margin-bottom:10px; }
.review-stars { color:#f59e0b; font-size:14px; letter-spacing:1px; margin-bottom:4px; }
.review-text { font-size:13px; color:var(--ink2); line-height:1.6; margin-bottom:8px; }
.review-author { font-size:11px; color:var(--muted); display:flex; align-items:center; gap:8px; }
.review-avatar { width:28px; height:28px; border-radius:50%; background:var(--accent);
  color:#fff; font-size:12px; font-weight:700; display:flex; align-items:center; justify-content:center; }

.web-preview-frame { background:#fff; border:1px solid var(--border); border-radius:10px;
  overflow:hidden; box-shadow:0 4px 20px rgba(0,0,0,.08); }
.web-section-editor { background:var(--surface); border:1px solid var(--border); border-radius:8px;
  padding:14px 16px; margin-bottom:10px; }
.web-sec-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.8px;
  color:var(--muted); margin-bottom:8px; }

.rating-badge { display:inline-flex; align-items:center; gap:6px; background:#fef3c7;
  border:1px solid #fde68a; border-radius:8px; padding:6px 14px; }
.rating-num { font-size:28px; font-weight:800; color:#92400e; font-family:var(--mono); }
.rating-stars-big { font-size:18px; color:#f59e0b; }
.rating-count { font-size:11px; color:#92400e; }

@media print {
  body { background: #fff; }
  .app, .sidebar, .topbar, .content { display: none !important; }
  .modal-overlay { position: static; background: none; backdrop-filter: none; }
  .modal { border: none; box-shadow: none; max-height: none; width: 100%; }
  .modal-head, .btn { display: none !important; }
  .modal-body { padding: 0; }
}

/* ── Responsive móvil ── */
.menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 7px; cursor: pointer;
  font-size: 18px; flex-shrink: 0; line-height: 1;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 499;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
  .usr-form-grid { grid-template-columns: 1fr !important; }
  /* Grid: una sola columna, sidebar fuera del flujo */
  #app-screen { grid-template-columns: 1fr !important; }

  .sidebar {
    position: fixed !important;
    top: 0; left: -260px; width: 250px; height: 100vh;
    z-index: 500; transition: left .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }
  .sidebar.show { left: 0; }

  .main {
    grid-column: 1;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
  }

  /* Topbar */
  .topbar {
    padding: 10px 14px !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    min-height: 54px;
  }
  .topbar > div:first-child { flex-shrink: 0; }
  .topbar > div:last-child  { min-width: 0; overflow: hidden; }
  .page-title { font-size: 14px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
  #search-input { width: 100px !important; font-size: 12px; }
  #filter-estado { display: none !important; }
  .menu-toggle { display: flex; }

  /* Contenido */
  .content { padding: 12px !important; overflow-x: hidden; }

  /* Grids */
  .form-grid   { grid-template-columns: 1fr !important; }
  .detail-grid { grid-template-columns: 1fr !important; }
  .inv-form    { grid-template-columns: 1fr !important; }
  .cal-sidebar { grid-template-columns: 1fr !important; }
  .inv-summary { grid-template-columns: 1fr 1fr !important; }
  .conta-kpi   { grid-template-columns: 1fr 1fr !important; }

  /* Cards */
  .bod-card   { flex-direction: column !important; }
  .cli-card   { flex-direction: column !important; }
  .alert-card { flex-direction: column !important; gap: 10px; }

  /* Tablas */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 580px; }
  th, td { padding: 7px 10px !important; font-size: 11px; }
  .col-hide-mobile { display: none !important; }

  /* Modal */
  .modal { width: 97% !important; max-height: 92vh; }

  /* Calendario */
  .cal-day { min-height: 58px; }
  .cal-day-num { font-size: 11px; }
  .cal-event { font-size: 9px; padding: 1px 3px; }

  /* Gráfica */
  .chart-inner { min-width: 320px; }

  /* Misc */
  .panel-body { padding: 12px !important; }
  .foto-grid { grid-template-columns: repeat(3, 1fr); }
}


/* ══════════════════════════════════════════════════
   DARK MODE
══════════════════════════════════════════════════ */

/* Dark mode overrides */
[data-theme="dark"] .sidebar        { background: #0a120d; }
[data-theme="dark"] body            { background: var(--bg); color: var(--ink); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea        { background: var(--surface2); color: var(--ink); border-color: var(--border); }
[data-theme="dark"] .modal          { background: var(--surface); }
[data-theme="dark"] .receipt        { background: #161b18; color: #e8ede9; }
[data-theme="dark"] .doc-preview    { background: #161b18; color: #e8ede9; }
[data-theme="dark"] .doc-party-box  { background: #1e2620; border-color: var(--border); }
[data-theme="dark"] .doc-table tbody tr:nth-child(even) { background: #1a2218; }
[data-theme="dark"] .doc-table tbody td { color: #c8d5ca; }
[data-theme="dark"] .wa-preview     { background: #1a2f1c; }
[data-theme="dark"] .chat-msg.other .chat-bubble { background: var(--surface2); border-color: var(--border); color: var(--ink); }
[data-theme="dark"] .splash-logo,
[data-theme="dark"] .brand-name     { color: #fff; }
[data-theme="dark"] .login-box      { background: var(--surface); }

/* Dark mode toggle button */
.dark-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink2);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .2s;
  white-space: nowrap;
}
.dark-toggle:hover { border-color: var(--accent); color: var(--accent); }

.perm-label-hover:hover { border-color: var(--accent) !important; }

/* ══════════════════════════════════════════════════
   TABLA DINÁMICA — Ordenable + Paginación
══════════════════════════════════════════════════ */
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color .15s, background .15s;
}
th.sortable:hover { color: var(--accent); background: rgba(26,107,60,.06); }
th.sortable::after {
  content: ' ⇅';
  font-size: 10px;
  opacity: .35;
  font-weight: 400;
}
th.sort-asc::after  { content: ' ↑'; opacity: 1; color: var(--accent); }
th.sort-desc::after { content: ' ↓'; opacity: 1; color: var(--accent); }
th.sort-asc, th.sort-desc { color: var(--accent); }

/* Paginación */
.pagination-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-top: 1px solid var(--border);
  background: var(--surface2); flex-wrap: wrap; gap: 8px;
}
.pagination-info { font-size: 12px; color: var(--muted); }
.pagination-btns { display: flex; gap: 4px; align-items: center; }
.pg-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--ink2); transition: all .15s;
  font-family: var(--body);
}
.pg-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pg-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pg-btn:disabled { opacity: .35; cursor: not-allowed; }
.pg-size {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 8px; font-size: 12px;
  color: var(--ink2); cursor: pointer; font-family: var(--body);
}

/* Fila hover mejorada */
tbody tr { transition: background .1s; }
tbody tr:hover td { background: rgba(26,107,60,.04); cursor: pointer; }

/* ══════════════════════════════════════════════════
   MODALES MEJORADOS
══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: modalFadeIn .18s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 94%; max-width: 700px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.1);
  animation: modalSlideUp .22s cubic-bezier(.16,1,.3,1);
  position: relative;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface2);
  border-radius: 14px 14px 0 0;
  position: sticky; top: 0; z-index: 2;
}
.modal-title { font-family: var(--head); font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: 1px solid var(--border);
  color: var(--muted); font-size: 18px; cursor: pointer;
  padding: 3px 9px; border-radius: 6px; line-height: 1;
  transition: all .15s;
}
.modal-close:hover { background: rgba(192,57,43,.1); color: var(--danger); border-color: rgba(192,57,43,.3); }
.modal-body { padding: 22px; }

/* Cerrar modal al click en el overlay */
.modal-overlay:not(.modal *) { cursor: default; }

/* ══════════════════════════════════════════════════
   SIDEBAR — fix franja blanca al final
   El sidebar usa position:sticky + min-height:100vh
   y align-self:stretch para estirarse con el contenido
══════════════════════════════════════════════════ */
.sidebar {
  /* override: nav fijo mientras scrolleas, pero crece con el contenido */
  position: sticky;
  top: 0;
  /* la altura mínima es la ventana, pero puede crecer */
  min-height: 100vh;
  align-self: stretch;
  /* scroll interno solo si el menú supera la ventana */
  overflow-y: auto;
  overflow-x: hidden;
}

/* El nav flex:1 empuja el sidebar-bottom hacia abajo */
.nav { flex: 1; padding: 12px 0; overflow-y: auto; }

/* sidebar-bottom siempre pegado al fondo dentro del sidebar */
.sidebar-bottom {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto; /* empuja hacia abajo */
  flex-shrink: 0;
}


/* ── Perfil de usuario en sidebar ── */
.sidebar-profile {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 4px;
}
.profile-row {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; border-radius: 8px; padding: 6px 8px;
  transition: background .15s;
}
.profile-row:hover { background: rgba(255,255,255,.06); }
.profile-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover; border: 2px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #fff;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.profile-role { font-size: 10px; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: 1px; }

/* Modal de perfil */
.profile-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px); z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.profile-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; width: 92%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden;
}
.profile-modal-header {
  background: linear-gradient(135deg, #1a3a2a, #0f4a28);
  padding: 28px 24px 20px; text-align: center; position: relative;
}
.profile-avatar-big {
  width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 12px;
  border: 3px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800; color: #fff;
  overflow: hidden; cursor: pointer; position: relative;
  transition: all .2s;
}
.profile-avatar-big:hover::after {
  content: '📷 Cambiar';
  position: absolute; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff; border-radius: 50%;
}
.profile-avatar-big img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-modal-name { font-size: 20px; font-weight: 800; color: #fff; }
.profile-modal-email { font-size: 12px; color: rgba(255,255,255,.55); margin-top: 3px; }
.profile-modal-body { padding: 20px 24px; }


/* ── Tipo pills ── */
.tipo-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--ink2); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.tipo-pill:hover { border-color: var(--accent); color: var(--accent); background: rgba(26,107,60,.06); }
.tipo-pill.active { border-color: var(--accent); background: var(--accent); color: #fff; }

/* Nueva orden — step blocks */
.orden-step-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--accent); margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}

/* ── Tipo de cliente badges ── */
.cli-tipo-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; border-radius: 10px;
  padding: 2px 8px; letter-spacing: .3px;
}
.tipo-natural {
  background: #dbeafe; color: #1e40af;
  border: 1px solid #bfdbfe;
}
.tipo-empresa {
  background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a;
}
.cli-card-empresa {
  border-left: 3px solid #f59e0b !important;
}

/* ── Consecutivo visible en tabs ── */
.doc-tab { position: relative; }
.doc-tab.active { border-color: var(--accent); color: var(--accent); }
#tab-cuenta.active { border-color: #1d4ed8; color: #1d4ed8; }

/* ── Cuenta de cobro bank box in preview ── */
.cc-bank-box {
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 8px; padding: 14px 16px; margin-bottom: 16px;
}
.cc-bank-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: #1d4ed8; margin-bottom: 10px;
}
.cc-bank-row {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 4px 0;
  border-bottom: 1px solid rgba(147,197,253,.3);
}
.cc-bank-row:last-child { border: none; }
.cc-bank-label { color: var(--muted); }
.cc-bank-val { font-weight: 700; color: #1d4ed8; }

/* perm-label-hover */
.perm-label-hover:hover { border-color: var(--accent) !important; }

/* ── Dark mode element overrides ── */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea { background:var(--surface2); color:var(--ink); border-color:var(--border); }
[data-theme="dark"] .modal  { background:var(--surface); }
[data-theme="dark"] .receipt { background:var(--surface); color:var(--ink); }
[data-theme="dark"] .doc-preview { background:var(--surface); color:var(--ink); }
[data-theme="dark"] .doc-party-box { background:var(--surface2); border-color:var(--border); }
[data-theme="dark"] .login-box { background:var(--surface); }
[data-theme="dark"] .wa-preview { background:rgba(46,204,106,.08); }
[data-theme="dark"] .chat-msg.other .chat-bubble { background:var(--surface2); color:var(--ink); }
