/* Paletas completas: superficies, texto, bordes, estados y controles nativos. */
/* Paleta 1.8.0: teal = acciones positivas, violeta = navegación activa, naranja = pendiente, rojo suave = crítico. */
:root,[data-theme="light"] {
  --canvas:#f1f3f6;--surface:#fbfaf8;--surface-soft:#eff1f4;--ink:#1d2f42;--title:#0f2233;--muted:#55687c;
  --line:#dde3ea;--accent:#6a45c2;--accent-soft:#eee8fa;--primary:#0b7f6b;--primary-hover:#096858;
  --on-primary:#fff;--on-brand:#fff;--teal:#08705f;--green-soft:#dcf3ec;--violet:#6a45c2;--violet-soft:#eee8fa;
  --amber:#a34805;--amber-soft:#fdebd6;--red:#b3283f;--red-soft:#fde8ec;--blue:#4777b8;
  --glass:#ffffff69;--shadow:#15384a1a;--overlay:#13243180;--focus:#7d5bd0;
  color-scheme:light;
}
[data-theme="dark"] {
  --canvas:#0f1720;--surface:#182430;--surface-soft:#1f2f3d;--ink:#e6eef6;--title:#ffffff;--muted:#a9bccd;
  --line:#33475a;--accent:#c4aaff;--accent-soft:#2f2650;--primary:#2bc4a4;--primary-hover:#4dd5b8;
  --on-primary:#fff;--on-brand:#04251e;--teal:#5fe0c1;--green-soft:#17403a;--violet:#c4aaff;--violet-soft:#332a52;
  --amber:#ffb26b;--amber-soft:#48321e;--red:#ff9fb0;--red-soft:#4a2634;--blue:#8bbbea;
  --glass:#ffffff08;--shadow:#00000040;--overlay:#02060bb3;--focus:#c4aaff;
  color-scheme:dark;
}
[data-theme="rest"] {
  --canvas:#eee7d9;--surface:#f7f0e3;--surface-soft:#eae2d2;--ink:#443d30;--title:#2f2a20;--muted:#685e4e;
  --line:#d7cbb6;--accent:#7a5490;--accent-soft:#eadfee;--primary:#2e7b66;--primary-hover:#25655a;
  --on-primary:#fff9ee;--on-brand:#fff9ee;--teal:#2a6f5b;--green-soft:#dfe8d3;--violet:#7a5490;--violet-soft:#eadfee;
  --amber:#9a4a0e;--amber-soft:#f1dfc0;--red:#a03f45;--red-soft:#f0dad2;--blue:#567880;
  --glass:#fff9ec59;--shadow:#4b3c281a;--overlay:#392f2280;--focus:#7a5490;
  color-scheme:light;
}
body{background:var(--canvas);color:var(--ink)}
button,input,select,textarea{color:inherit}
button:focus-visible,a:focus-visible,summary:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid var(--focus);outline-offset:3px}
input,textarea,select{background:var(--surface);color:var(--ink);border-color:var(--line);accent-color:var(--primary)}
input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}
.crm-dialog{background:var(--surface)}
.crm-dialog::backdrop{background:var(--overlay)}
.card input,.card textarea{background:var(--surface);color:var(--ink)}
.auth{background:radial-gradient(ellipse at top,var(--accent-soft),var(--canvas) 70%);color:var(--ink)}
.auth-panel{background:var(--surface);border-color:var(--line);box-shadow:0 20px 60px var(--shadow)}
.auth-panel h1{color:var(--ink)}
.auth-panel h2.auth-headline,.link-btn{color:var(--accent)}
.auth-panel input,.auth-social button{background:var(--surface-soft);border-color:var(--line);color:var(--ink)}
.auth-panel .btn-primary{background:var(--primary);color:var(--on-primary)}
.auth-copy,.auth-sub,.auth-alt{color:var(--muted)}
.auth-msg{color:var(--red)}
.auth-appearance{display:flex;justify-content:flex-end;margin-bottom:14px}
.theme-switch{display:grid;gap:5px;min-width:145px}
.theme-switch>span{color:var(--muted);font-size:10px;font-weight:600}
.theme-switch select,.analytics-toolbar select{padding:9px 11px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);font-size:12px;cursor:pointer;max-width:100%}
.header-right{flex-wrap:wrap;justify-content:flex-end}
.trial-banner:empty{display:none}
.sidebar .nav-label{color:var(--muted)}
.sidebar button.active{background:var(--accent-soft);color:var(--accent)}
.brand-mark{background:var(--green-soft);color:var(--teal)}
.primary,.card button{background:var(--primary);color:var(--on-primary)}
.primary:hover{background:var(--primary-hover)}
.status.green{background:var(--green-soft);color:var(--teal)}
.status.amber{background:var(--amber-soft);color:var(--amber)}
.status.red,.trial-warning,.trial-banner.trial-warning{background:var(--red-soft);color:var(--red)}
.trial-note{background:var(--accent-soft);color:var(--accent)}
.data-table th{color:var(--muted);font-size:10px}
.data-table td{color:var(--muted)}
.metric>span{font-size:12px;color:var(--muted)}
.metric small{font-size:11px;line-height:1.55;color:var(--muted)}
.metric strong{color:var(--ink)}
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
/* Planes y precios */
.plans-heading{text-align:center;margin:12px auto 28px;max-width:740px}
.plans-heading .eyebrow{color:var(--teal);font-size:10px}
.plans-heading h2{font-size:36px;line-height:1.16;letter-spacing:-1px;margin:13px 0 15px;font-weight:700}
.plans-heading p{font-size:14px;color:var(--muted);line-height:1.6;margin:0}
.subscription-strip{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:18px 23px;border:1px solid var(--line);border-radius:12px;background:var(--surface);margin-bottom:25px}
.subscription-strip strong{margin-left:12px;font-size:13px}
.subscription-strip p{color:var(--muted);font-size:12px;margin:10px 0 0;line-height:1.6}
.subscription-detail{color:var(--teal);font-size:11px}
.pricing-toolbar{display:flex;justify-content:space-between;align-items:center;gap:15px;flex-wrap:wrap;margin-bottom:22px}
.pricing-toolbar>span{font-size:11px;color:var(--muted)}
.segmented{display:inline-flex;padding:4px;background:var(--surface-soft);border:1px solid var(--line);border-radius:11px;gap:3px}
.segmented button{border:0;padding:10px 23px;background:transparent;color:var(--muted);font-size:12px;border-radius:7px;font-weight:600}
.segmented button[aria-pressed="true"]{color:var(--on-primary);background:var(--primary);box-shadow:0 2px 6px var(--shadow)}
.plans-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(265px,100%),1fr));gap:18px;margin-bottom:30px}
.plan-card{display:flex;flex-direction:column;min-width:0;background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:24px;box-shadow:0 4px 20px var(--shadow)}
.current-plan{border:2px solid var(--teal);padding:23px}
.plan-card-heading{display:flex;gap:8px;align-items:center;justify-content:space-between;flex-wrap:wrap}
.plan-card h3{margin:0;font-size:20px;letter-spacing:-.4px;overflow-wrap:anywhere}
.plan-currency{color:var(--muted);font-size:10px;letter-spacing:1px}
.plan-description{font-size:12px;color:var(--muted);line-height:1.6;min-height:38px;margin:12px 0 18px}
.plan-price{display:flex;align-items:baseline;gap:7px;flex-wrap:wrap;overflow-wrap:anywhere}
.plan-price strong{font-size:33px;letter-spacing:-1px}
.plan-price>span{font-size:12px;color:var(--muted)}
.plan-frequency{font-size:11px;color:var(--muted);line-height:1.6;min-height:35px;margin:8px 0 18px}
.plan-both-prices{display:grid;grid-template-columns:1fr 1fr;gap:5px;background:var(--surface-soft);border:1px solid var(--line);border-radius:10px;padding:5px;margin:0}
.plan-both-prices>div{padding:10px 7px;border-radius:6px;min-width:0}
.plan-both-prices>div.selected{background:var(--surface);box-shadow:0 2px 5px var(--shadow)}
.plan-both-prices dt{font-size:10px;color:var(--muted);margin-bottom:6px}
.plan-both-prices dd{font-size:14px;font-weight:650;margin:0;overflow-wrap:anywhere}
.plan-both-prices small{display:block;font-size:10px;font-weight:400;color:var(--muted);margin-top:4px}
.plan-saving{font-size:11px;line-height:1.5;color:var(--teal);min-height:34px;margin:13px 0 12px}
.plan-features{list-style:none;border-top:1px solid var(--line);padding:19px 0 12px;margin:0 0 12px;display:grid;gap:12px;font-size:12px;color:var(--muted)}
.plan-features li{display:flex;align-items:baseline;gap:9px;line-height:1.4}
.plan-features li>span{font-weight:bold;color:var(--teal)}
.plan-card>button{margin-top:auto;width:100%;color:var(--accent);font-size:12px}
.comparison{scroll-margin-top:25px}
.comparison .data-table th[scope="row"]{background:transparent;text-transform:none;letter-spacing:0;font-size:12px;padding:15px 14px}
.included{color:var(--teal);font-weight:600}
.pricing-footnote,.analytics-footnote{font-size:11px;line-height:1.8;color:var(--muted);margin:20px 0}
/* Dashboard */
.analytics-welcome{gap:20px;background:linear-gradient(110deg,var(--green-soft),var(--accent-soft))}
.analytics-welcome h2{font-size:29px}
.analytics-welcome p{font-size:13px}
.analytics-toolbar{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:23px}
.analytics-toolbar>div{display:grid;gap:7px}
.analytics-toolbar>div>strong{font-size:15px}
.analytics-toolbar [data-updated]{font-size:11px;color:var(--muted)}
.analytics-toolbar label{display:grid;gap:6px;font-size:11px;color:var(--muted)}
.dashboard-metrics{grid-template-columns:repeat(4,minmax(0,1fr))}
.dashboard-metrics .metric strong{font-size:28px;margin:3px 0}
.data-notice{padding:14px 18px;border:1px solid var(--line);border-radius:10px;background:var(--accent-soft);color:var(--ink);font-size:12px;line-height:1.7;margin-bottom:20px}
.financial-grid{display:grid;grid-template-columns:1.4fr 1fr;gap:18px;margin-bottom:22px}
.financial-grid h2{font-size:16px;letter-spacing:-.3px;margin:10px 0 17px}
.financial-grid .eyebrow{font-size:9px;color:var(--muted)}
.sales-totals{display:flex;flex-wrap:wrap;gap:18px 30px}
.sales-totals>div{display:grid;gap:8px}
.sales-totals strong,.inventory-value>strong{font-size:28px;letter-spacing:-.7px;color:var(--teal);overflow-wrap:anywhere}
.sales-totals span{font-size:11px;color:var(--muted);line-height:1.5}
.inventory-value p{font-size:12px;color:var(--muted);line-height:1.7}
.chart-caption{font-size:11px;color:var(--muted);line-height:1.65;margin:13px 0 0}
.trend-panel{margin-bottom:22px}
.trend-panel .section-title{align-items:flex-start;gap:15px;flex-wrap:wrap}
.trend-panel .chart-caption{margin-top:8px;max-width:550px}
.chart-legend{display:flex;gap:15px;flex-wrap:wrap;font-size:11px;color:var(--muted)}
.chart-legend>span{display:inline-flex;align-items:center;gap:7px}
.chart-legend i{display:block;width:9px;height:9px;border-radius:3px}
.chart-legend .blue,.trend-bar.blue,.chart-fill.blue{background:var(--blue)}
.chart-legend .teal,.trend-bar.teal,.chart-fill.teal{background:var(--teal)}
.chart-fill.orange{background:var(--amber)}
.chart-fill.violet{background:var(--violet)}
.trend-scroll{overflow:auto}
.trend-chart{display:grid;grid-template-columns:repeat(var(--months),minmax(48px,1fr));min-width:calc(var(--months) * 48px);gap:8px;padding:33px 7px 0}
.trend-bars{height:150px;display:flex;justify-content:center;gap:5px;align-items:flex-end;border-bottom:1px solid var(--line);background:repeating-linear-gradient(to top,transparent 0,transparent 49px,var(--line) 50px,transparent 51px)}
.trend-bar{position:relative;border-radius:4px 4px 0 0;width:25%;max-width:25px;min-width:10px}
.trend-bar>span{position:absolute;bottom:calc(100% + 7px);left:50%;transform:translateX(-50%);font-size:10px;font-weight:600;color:var(--ink);white-space:nowrap}
.trend-label{display:block;text-align:center;font-size:10px;color:var(--muted);margin-top:13px;white-space:nowrap}
.empty-chart-note{padding:12px;background:var(--surface-soft);color:var(--muted);font-size:12px;border-radius:8px}
.chart-data{margin-top:22px;border-top:1px solid var(--line);padding-top:15px;font-size:11px;color:var(--muted)}
.chart-data summary{cursor:pointer;color:var(--accent);padding:5px 0}
.chart-data table{margin-top:12px}
.statistics-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.chart-panel .section-title{align-items:flex-start;flex-wrap:wrap}
.distribution{display:grid;gap:17px;margin-top:22px}
.distribution-row>div:first-child{display:flex;gap:7px;align-items:center;margin-bottom:8px;font-size:12px}
.distribution-row span{flex:1;color:var(--muted)}
.distribution-row small{font-size:10px;color:var(--muted);min-width:43px;text-align:right}
.bar-track{height:7px;border-radius:5px;background:var(--surface-soft);overflow:hidden}
.bar-track .chart-fill{display:block;height:100%;border-radius:5px}
.analytics-page .quick-card small{font-size:10px}
.analytics-page .activity-row b{font-size:12px}
.analytics-page .activity-row div span{font-size:11px;line-height:1.6}
@media(max-width:1200px){.statistics-grid{grid-template-columns:1fr}.distribution{grid-template-columns:repeat(2,minmax(0,1fr));gap:17px 24px}.financial-grid{grid-template-columns:1fr}.plans-grid{gap:14px}.plan-card{padding:21px}}
@media(max-width:850px){.dashboard-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.topbar .header-right{max-width:60%;align-items:flex-end}.plans-heading h2{font-size:30px}.analytics-welcome{align-items:flex-start;flex-direction:column}.analytics-toolbar{align-items:flex-start;flex-wrap:wrap}.plans-grid{grid-template-columns:1fr}.plan-card{padding:24px}.plan-description,.plan-frequency,.plan-saving{min-height:0}.plan-features{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 20px}}
@media(max-width:650px){.topbar .header-right{max-width:none;align-items:center}.theme-switch{min-width:140px}.topbar .theme-switch{width:100%;grid-template-columns:auto minmax(140px,190px);align-items:center;margin-top:3px}.theme-switch>span{font-size:11px}.header-right .trial-banner{max-width:70%}.plans-heading{margin-top:2px}.plans-heading h2{font-size:28px}.plans-heading p{font-size:12px}.subscription-strip{padding:16px;align-items:flex-start;flex-direction:column}.pricing-toolbar{gap:12px}.pricing-toolbar>span{font-size:10px}.plan-price strong{font-size:35px}.plan-features{grid-template-columns:1fr}.analytics-welcome h2{max-width:none;font-size:26px}.analytics-toolbar label{width:100%;grid-template-columns:auto 170px;align-items:center}.dashboard-metrics .metric strong{font-size:25px}.metric>span{font-size:11px}.metric small{font-size:10px}.financial-grid h2{font-size:15px}.financial-grid .workspace-panel{padding:20px}.sales-totals strong,.inventory-value>strong{font-size:26px}.distribution{grid-template-columns:1fr}.trend-panel{padding:19px 14px}.chart-legend{font-size:10px}.chart-caption{font-size:10px}.trend-chart{gap:5px}.quick-grid{grid-template-columns:1fr 1fr}.analytics-page .quick-card{min-height:72px}.analytics-page .quick-card small{font-size:9px}.analytics-page .quick-card b{font-size:11px}.analytics-page .activity-row{flex-wrap:wrap}.analytics-page .quiet-empty p{font-size:11px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important}}
@media print{:root{color-scheme:light}#printArea{--ink:#172b3a;--muted:#465563;--line:#ccd5dc;--surface:#fff;--surface-soft:#eef3f6;--on-primary:#172b3a;--accent:#244e72;--teal:#225c49;background:#fff;color:#172b3a}}

.danger{background:var(--red);color:var(--surface)}

.scroll-hint{display:none;color:var(--muted);font-size:10px;line-height:1.6}
@media(max-width:650px){.scroll-hint{display:block}}

.terms-check{display:flex;gap:9px;align-items:flex-start;font-size:12px;color:var(--muted);line-height:1.6;margin:0 0 14px}.terms-check input{margin-top:3px}.terms-check a{color:var(--accent)}

/* ===== 1.7.0 · Personal: modos de vista y visor de fotos ===== */
.view-switch{flex-wrap:wrap}
.avatar[data-open-photo]{cursor:zoom-in}.avatar[data-open-photo]:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.employee-grid.large{grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr))}
.employee-card.big{padding:0;overflow:hidden;display:flex;flex-direction:column}
.employee-card.big .emp-body{padding:16px 18px 6px}.employee-card.big .row-actions{padding:0 18px 16px;border-top:0}
.emp-title{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}.emp-title h3{margin:0 0 4px;font-size:16px}
.avatar.square{width:100%;height:auto;aspect-ratio:1/1;border-radius:0;font-size:48px;min-width:0}
.avatar.square.small{border-radius:12px;font-size:28px}
.avatar.thumb{width:40px;height:40px;min-width:40px;border-radius:10px;font-size:13px}
.avatar img,.avatar.square img{object-fit:cover}
.emp-cell{display:flex;align-items:center;gap:12px}.emp-list td small{color:var(--muted);font-size:10px}
.emp-list td{white-space:normal}
.emp-mosaic{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(140px,45%),1fr));gap:14px}
.emp-tile{display:flex;flex-direction:column;align-items:flex-start;gap:4px;border:1px solid var(--line);border-radius:14px;padding:10px;background:var(--surface)}
.emp-tile .avatar{margin-bottom:6px}.emp-tile strong{font-size:12px;color:var(--ink);overflow-wrap:anywhere}.emp-tile span{font-size:11px;color:var(--muted)}
.emp-gallery{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:22px;align-items:center}
.gallery-stage{position:relative;display:flex;align-items:center;justify-content:center;background:var(--surface-soft);border-radius:18px;padding:14px}
.avatar.stage{width:min(100%,360px);height:auto;aspect-ratio:1/1;border-radius:14px;font-size:96px;min-width:0}
.gallery-stage .pv-nav{position:absolute;top:50%;transform:translateY(-50%);z-index:2}.gallery-stage .pv-nav:first-child{left:10px}.gallery-stage .pv-nav:nth-child(3){right:10px}
.gallery-caption h3{font-size:22px;margin:0 0 6px;letter-spacing:-.4px}.gallery-caption p{color:var(--muted);margin:0 0 12px;font-size:13px}.gallery-caption small{display:block;color:var(--muted);margin:14px 0}
.gallery-thumbs,.pv-thumbs{grid-column:1/-1;display:flex;gap:10px;overflow-x:auto;padding:4px 2px;justify-content:center}
.thumb-btn{position:relative;flex:0 0 auto;width:58px;height:58px;padding:0;border:2px solid transparent;border-radius:12px;overflow:hidden;background:var(--accent-soft);color:var(--muted);display:grid;place-items:center;font-weight:600;font-size:14px}
.thumb-btn img{grid-area:1/1;width:100%;height:100%;object-fit:cover}.thumb-btn .initials{grid-area:1/1}.thumb-btn.active{border-color:var(--accent)}
.pv-nav{width:42px;height:42px;border-radius:50%;border:1px solid var(--line);background:var(--surface);color:var(--ink);font-size:26px;line-height:1;display:grid;place-items:center;box-shadow:0 2px 10px var(--shadow);flex:0 0 auto}
.pv-nav:hover{background:var(--surface-soft)}
.crm-dialog.photo-dialog{width:min(860px,96vw)}
.pv{display:flex;align-items:center;gap:14px}.pv-stage{flex:1;margin:0;text-align:center;min-width:0}
.pv-img{position:relative;width:min(100%,50vh,520px);aspect-ratio:1/1;margin:0 auto 12px;border-radius:16px;overflow:hidden;background:var(--accent-soft);display:grid;place-items:center}
.pv-img img{grid-area:1/1;width:100%;height:100%;object-fit:contain;background:var(--surface-soft)}.pv-initials{grid-area:1/1;font-size:88px;font-weight:700;color:var(--muted)}
.pv-stage figcaption{display:grid;gap:3px}.pv-stage figcaption strong{font-size:17px;color:var(--ink)}.pv-stage figcaption span,.pv-stage figcaption small{color:var(--muted);font-size:12px}
.pv-thumbs{margin-top:14px}
@media(max-width:850px){.emp-gallery{grid-template-columns:1fr}.pv{gap:6px}.pv-nav{width:36px;height:36px}}

/* ===== 1.7.0 · Facturas ===== */
.crm-dialog.wide-dialog{width:min(980px,96vw)}
.inv-edit{width:100%;border-collapse:collapse;min-width:640px}.inv-edit th{font-size:10px;text-align:left;color:var(--muted);padding:6px 6px;text-transform:uppercase;letter-spacing:.4px}
.inv-edit td{padding:4px}.inv-edit input,.inv-edit select{width:100%;min-width:0;border:1px solid var(--line);border-radius:7px;padding:8px;background:var(--surface);color:var(--ink);font-size:12px}
.inv-edit td:nth-child(2) input,.inv-edit td:nth-child(3) input,.inv-edit td:nth-child(4) input{min-width:70px}.inv-edit td:first-child{min-width:220px}
.line-total{font-size:12px;color:var(--ink);white-space:nowrap;text-align:right;padding-right:8px}
.inv-live-total{display:flex;gap:18px;justify-content:flex-end;flex-wrap:wrap;margin-top:14px;font-size:12px;color:var(--muted)}.inv-live-total b{color:var(--ink);margin-left:4px}.inv-live-total .grand{font-size:15px}
.logo-box{width:120px;height:80px;border:1px dashed var(--line);border-radius:10px;display:grid;place-items:center;background:var(--surface);color:var(--muted);font-size:11px;overflow:hidden}.logo-box img{max-width:100%;max-height:100%;object-fit:contain}
.inv-preview{overflow:auto;background:var(--surface-soft);border-radius:12px;padding:16px;max-height:68vh}

/* Hoja de factura: siempre "papel" claro, también en modo oscuro y al imprimir. */
.inv-sheet{position:relative;background:#fff;color:#1b2430;max-width:816px;margin:0 auto;padding:36px 40px;font:13px/1.5 Arial,Helvetica,sans-serif;box-shadow:0 2px 16px rgba(0,0,0,.18);overflow:hidden}
.inv-sheet *{box-sizing:border-box}.inv-sheet h1,.inv-sheet h2,.inv-sheet h3,.inv-sheet p,.inv-sheet dl,.inv-sheet dd{margin:0}
.inv-head{display:flex;justify-content:space-between;gap:24px;align-items:flex-start;padding-bottom:18px;border-bottom:2px solid #1b2430}
.inv-company{display:flex;gap:14px;align-items:flex-start;min-width:0}.inv-logo{max-width:150px;max-height:80px;object-fit:contain}
.inv-company h2{font-size:18px;margin-bottom:4px}.inv-company p{font-size:11.5px;color:#4a5566}
.inv-meta{text-align:right;flex:0 0 auto}.inv-meta h1{font-size:24px;letter-spacing:1px}.inv-number{font-size:15px;font-weight:700;margin:4px 0 8px}
.inv-meta dl{display:grid;grid-template-columns:auto auto;gap:2px 10px;justify-content:end;font-size:11.5px}.inv-meta dt{color:#4a5566}.inv-meta dd{font-weight:600}
.inv-client{margin:18px 0}.inv-client h3,.inv-notes h3{font-size:10.5px;text-transform:uppercase;letter-spacing:1px;color:#4a5566;margin-bottom:4px}.inv-client p{font-size:12.5px}
.inv-items{width:100%;border-collapse:collapse;margin-top:6px;white-space:normal}
.inv-items th{background:#eef1f5;color:#1b2430;font-size:10.5px;text-transform:uppercase;letter-spacing:.5px;padding:8px;text-align:left;border-bottom:1px solid #c9d1db}
.inv-items td{padding:9px 8px;border-bottom:1px solid #e3e8ee;vertical-align:top;font-size:12px;color:#1b2430}.inv-items .r{text-align:right;white-space:nowrap}
.inv-totals{margin:16px 0 0 auto;width:min(300px,100%)}.inv-total-row{display:flex;justify-content:space-between;padding:5px 0;font-size:12.5px;border-bottom:1px solid #e3e8ee}
.inv-total-row.grand{font-size:16px;border-bottom:0;border-top:2px solid #1b2430;margin-top:4px;padding-top:9px}
.inv-notes{margin-top:18px}.inv-notes p{white-space:pre-line;font-size:12px;color:#33404f}
.inv-foot{margin-top:26px;padding-top:12px;border-top:1px solid #c9d1db;text-align:center;font-size:11px;color:#4a5566;white-space:pre-line}
.inv-watermark{position:absolute;inset:0;display:grid;place-items:center;font-size:110px;font-weight:800;letter-spacing:6px;color:rgba(190,30,45,.11);transform:rotate(-28deg);pointer-events:none;user-select:none}
.inv-sheet.pagada .inv-watermark{color:rgba(20,130,80,.12)}.inv-sheet.borrador .inv-watermark{color:rgba(90,100,120,.14)}
@media(max-width:850px){.inv-preview .inv-sheet{min-width:640px}}
.inv-edit td:nth-child(5) select{min-width:76px}
@page{size:letter;margin:12mm}
@media print{
 #printArea.print-invoice{padding:0;font:inherit}
 #printArea.print-invoice .inv-sheet{box-shadow:none;max-width:none;padding:0;margin:0}
 #printArea.print-invoice .inv-items th{background:#eef1f5!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
 #printArea.print-invoice .inv-items th,#printArea.print-invoice .inv-items td{padding:6px 8px;text-align:inherit}
 #printArea.print-invoice .inv-items .r{text-align:right}
 #printArea.print-invoice .inv-watermark{-webkit-print-color-adjust:exact;print-color-adjust:exact}
 #printArea.print-invoice h1{font-size:24px;margin:0}#printArea.print-invoice .inv-items tr{break-inside:avoid}
}
@media print{dialog.crm-dialog,dialog.crm-dialog::backdrop{display:none!important;background:none!important;backdrop-filter:none!important}}
@media print{html,body{background:#fff!important}}

/* ===== 1.8.0 · Color y jerarquía ===== */
.primary,.card button,#appToast,.auth-panel .btn-primary,.segmented button[aria-pressed="true"],#appView .card button{color:var(--on-brand)}
.primary{box-shadow:0 4px 14px color-mix(in srgb,var(--primary) 35%,transparent)}
.topbar h1,.page-intro h2,.dialog-heading h2,.gallery-caption h3,.pv-stage figcaption strong{color:var(--title)}
.metric strong{color:var(--title)}
.metric.teal strong{color:var(--teal)}.metric.orange strong{color:var(--amber)}.metric.violet strong{color:var(--violet)}
.metric{border-top:3px solid transparent}.metric.blue{border-top-color:var(--blue)}.metric.teal{border-top-color:var(--teal)}.metric.orange{border-top-color:var(--amber)}.metric.violet{border-top-color:var(--violet)}
.metric.orange:before{background:var(--amber)}
.sidebar button.active{background:var(--accent-soft);color:var(--accent);box-shadow:inset 3px 0 0 var(--accent)}
.sidebar button.active span{color:var(--accent)}
.trial-banner{background:var(--surface-soft);color:var(--muted);border:1px solid var(--line)}
.trial-banner.trial-warning{background:var(--red-soft);color:var(--red);border-color:transparent}
.status{font-weight:600}
.status.violet{background:var(--violet-soft);color:var(--violet)}
.status.blue{background:var(--accent-soft);color:var(--accent)}
.text-button,.row-action{color:var(--accent)}
.primary:hover{background:var(--primary-hover)}
.danger{color:var(--on-brand)}
.thumb-btn.active{border-color:var(--accent)}
.segmented button[aria-pressed="true"]{background:var(--primary)}

/* ===== 1.8.0 · Agenda, avatares, franjas de estado, drawer, vacío ===== */
:root{--stripe-green:var(--teal);--stripe-amber:var(--amber);--stripe-red:var(--red);--stripe-blue:var(--blue)}
.chip-avatar{display:inline-grid;place-items:center;width:30px;height:30px;min-width:30px;border-radius:50%;font-size:11px;font-weight:700;color:var(--chip);background:color-mix(in srgb,var(--chip) 16%,transparent);border:1px solid color-mix(in srgb,var(--chip) 35%,transparent)}
.name-cell{display:inline-flex;align-items:center;gap:10px}
/* franja lateral por estado */
.data-table tbody tr td:first-child{box-shadow:inset 4px 0 0 transparent}
.data-table tr[data-state="pendiente"] td:first-child,.data-table tr[data-state="programada"] td:first-child,.data-table tr[data-state="borrador"] td:first-child,.data-table tr[data-state="emitida"] td:first-child{box-shadow:inset 4px 0 0 var(--stripe-amber)}
.data-table tr[data-state="confirmada"] td:first-child,.data-table tr[data-state="completada"] td:first-child,.data-table tr[data-state="activo"] td:first-child,.data-table tr[data-state="pagada"] td:first-child,.data-table tr[data-state="presente"] td:first-child,.data-table tr[data-state="ganada"] td:first-child{box-shadow:inset 4px 0 0 var(--stripe-green)}
.data-table tr[data-state="cancelada"] td:first-child,.data-table tr[data-state="no_asistio"] td:first-child,.data-table tr[data-state="anulada"] td:first-child,.data-table tr[data-state="inactivo"] td:first-child,.data-table tr[data-state="perdida"] td:first-child,.data-table tr[data-state="ausente"] td:first-child{box-shadow:inset 4px 0 0 var(--stripe-red)}
/* acciones rápidas: visibles al pasar el cursor (siempre en táctil) */
@media(hover:hover){.data-table tbody .row-actions{opacity:.0;transition:opacity .15s}.data-table tbody tr:hover .row-actions,.data-table tbody tr:focus-within .row-actions{opacity:1}}
.row-action[data-action="remind"]{color:var(--teal);font-weight:600}
/* KPI sparkline */
.spark{display:block;margin-top:10px;color:var(--teal)}
.trend{display:block;font-size:10px;color:var(--muted);margin-top:6px}.trend.up{color:var(--teal)}.trend.down{color:var(--red)}
/* estado vacío */
.empty-art{color:var(--muted);margin:0 auto 6px;display:block;opacity:.85}.empty-art .art-accent{stroke:var(--teal)}
/* barra de agenda */
.view-switch{margin-bottom:14px}
.quick-chips{display:inline-flex;gap:8px;flex-wrap:wrap;margin:0 0 14px 12px;vertical-align:middle}
.chip{border:1px solid var(--line);background:var(--surface);color:var(--muted);border-radius:999px;padding:6px 13px;font-size:11px;font-weight:600}
.chip:hover{background:var(--surface-soft);color:var(--ink)}
.chip.on{background:var(--green-soft);color:var(--teal);border-color:color-mix(in srgb,var(--teal) 45%,transparent)}
.cal-nav{display:flex;align-items:center;gap:8px;margin:0 0 14px;flex-wrap:wrap}
.cal-label{margin-left:8px;font-size:14px;color:var(--title);text-transform:capitalize}
.cal-scroll{overflow:auto;border:1px solid var(--line);border-radius:12px}
.cal-month{display:grid;grid-template-columns:repeat(7,minmax(104px,1fr));min-width:730px}
.cal-head{background:var(--surface-soft);color:var(--muted);font-size:10px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;padding:9px 8px;text-align:center;border:0;border-bottom:1px solid var(--line)}
button.cal-head{cursor:pointer}button.cal-head b{color:var(--title);font-size:13px}
.cal-head.today,.cal-head.today b{color:var(--accent)}
.cal-cell{min-height:104px;padding:6px;border-right:1px solid var(--line);border-bottom:1px solid var(--line);display:flex;flex-direction:column;gap:4px;min-width:0}
.cal-cell.other{background:var(--surface-soft);opacity:.6}
.cal-cell.today{background:var(--accent-soft)}
.cal-cell-top{display:flex;justify-content:space-between;align-items:center}
.cal-daynum{border:0;background:none;color:var(--ink);font-size:12px;font-weight:600;border-radius:6px;padding:2px 6px}
.cal-cell.today .cal-daynum{background:var(--primary);color:var(--on-brand)}
.cal-add,.cal-slot{border:1px dashed var(--line);background:transparent;color:var(--teal);border-radius:6px;width:22px;height:22px;line-height:1;font-size:14px;opacity:0;transition:opacity .15s}
.cal-cell:hover .cal-add,.cal-tcell:hover .cal-slot,.cal-add:focus-visible,.cal-slot:focus-visible{opacity:1}
@media(hover:none){.cal-add{opacity:.8}}
.cal-ev{display:block;width:100%;text-align:left;border:0;border-left:3px solid var(--amber);background:var(--amber-soft);color:var(--ink);border-radius:5px;padding:3px 6px;font-size:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cal-ev b{font-weight:700}
.cal-more{border:0;background:none;color:var(--accent);font-size:10px;text-align:left;padding:2px 4px}
.cal-week{display:grid;grid-template-columns:56px repeat(7,minmax(104px,1fr));min-width:800px}
.cal-tcell{min-height:46px;padding:3px;border-right:1px solid var(--line);border-bottom:1px solid var(--line);display:flex;flex-direction:column;gap:3px;min-width:0}
.cal-tcell.corner{background:var(--surface-soft);border-bottom:1px solid var(--line)}
.cal-tcell.time{font-size:10px;color:var(--muted);justify-content:flex-start;padding:6px 6px;background:var(--surface-soft)}
.cal-tcell.today{background:var(--accent-soft)}
.cal-day{border:1px solid var(--line);border-radius:12px;overflow:hidden}
.cal-hour{display:grid;grid-template-columns:64px 1fr;border-bottom:1px solid var(--line);min-height:52px}.cal-hour:last-child{border-bottom:0}
.cal-time{font-size:11px;color:var(--muted);padding:10px;background:var(--surface-soft)}
.cal-slotcol{padding:6px 8px;display:flex;flex-direction:column;gap:6px}
.cal-block{display:block;text-align:left;border:0;border-left:4px solid var(--amber);background:var(--amber-soft);color:var(--ink);border-radius:8px;padding:8px 12px;font-size:12px}
.cal-block small{display:block;color:var(--muted);font-size:10px;margin-top:3px}
.cal-free{border:0;background:none;color:var(--muted);font-size:11px;text-align:left;padding:4px 0;opacity:.7}button.cal-free:hover{color:var(--teal);opacity:1}
.st-confirmada,.st-completada{border-left-color:var(--teal)!important;background:var(--green-soft)!important}
.st-cancelada,.st-no_asistio{border-left-color:var(--red)!important;background:var(--red-soft)!important;text-decoration:line-through;text-decoration-color:color-mix(in srgb,var(--red) 50%,transparent)}
.st-pendiente,.st-programada{border-left-color:var(--amber)!important;background:var(--amber-soft)!important}
/* drawer lateral derecho */
dialog.crm-dialog.drawer{position:fixed;inset:0 0 0 auto;margin:0;width:min(460px,100vw);max-width:100vw;height:100dvh;max-height:100dvh;border-radius:18px 0 0 18px;border-right:0;overflow:auto;animation:drawer-in .26s cubic-bezier(.2,.8,.2,1)}
dialog.crm-dialog.drawer .form-fields{grid-template-columns:1fr}
dialog.crm-dialog.drawer .dialog-actions{position:sticky;bottom:-26px;background:var(--surface);padding-bottom:6px}
@keyframes drawer-in{from{transform:translateX(100%)}to{transform:none}}
@media(prefers-reduced-motion:reduce){dialog.crm-dialog.drawer{animation:none}}
@media(max-width:650px){dialog.crm-dialog.drawer{border-radius:0;width:100vw}.quick-chips{margin-left:0;display:flex}}
.cal-label{text-transform:lowercase}.cal-label::first-letter{text-transform:uppercase}

/* ===== 1.9.0 · Paletas de apariencia (menú lateral y botones) ===== */
html[data-palette="slate"]{--primary:#4a6684;--primary-hover:#3c556f;--accent:#4a6684;--accent-soft:#e4ebf3;--on-brand:#fff;--focus:#4a6684}
html[data-palette="forest"]{--primary:#22764a;--primary-hover:#1a5f3b;--accent:#22764a;--accent-soft:#dcf0e3;--on-brand:#fff;--focus:#22764a}
html[data-palette="purple"]{--primary:#6a45c2;--primary-hover:#5735a8;--accent:#6a45c2;--accent-soft:#eee8fa;--on-brand:#fff;--focus:#6a45c2}
html[data-palette="wine"]{--primary:#a1284a;--primary-hover:#841f3c;--accent:#a1284a;--accent-soft:#fbe6ec;--on-brand:#fff;--focus:#a1284a}
html:is([data-theme="dark"],[data-theme="soft"])[data-palette="slate"]{--primary:#9db9d6;--primary-hover:#b4cae2;--accent:#b4cae2;--accent-soft:#26384b;--on-brand:#0d1a26;--focus:#b4cae2}
html:is([data-theme="dark"],[data-theme="soft"])[data-palette="forest"]{--primary:#63d88f;--primary-hover:#85e4a8;--accent:#85e4a8;--accent-soft:#1a3d2a;--on-brand:#06210f;--focus:#85e4a8}
html:is([data-theme="dark"],[data-theme="soft"])[data-palette="purple"]{--primary:#b79cff;--primary-hover:#cbb6ff;--accent:#cbb6ff;--accent-soft:#34285a;--on-brand:#170d33;--focus:#cbb6ff}
html:is([data-theme="dark"],[data-theme="soft"])[data-palette="wine"]{--primary:#ff8fa9;--primary-hover:#ffabc0;--accent:#ffabc0;--accent-soft:#4d2231;--on-brand:#33081a;--focus:#ffabc0}
html[data-palette="slate"] .sidebar{--surface:#2b3644;--surface-soft:#38465a;--line:#42536a}
html[data-palette="forest"] .sidebar{--surface:#14382a;--surface-soft:#1f4b39;--line:#2b5a47}
html[data-palette="purple"] .sidebar{--surface:#2c1f4e;--surface-soft:#3b2b66;--line:#493780}
html[data-palette="wine"] .sidebar{--surface:#4a1626;--surface-soft:#5e2033;--line:#712c41}
html[data-palette="slate"] .sidebar,html[data-palette="forest"] .sidebar,html[data-palette="purple"] .sidebar,html[data-palette="wine"] .sidebar{--ink:#f1f5f9;--muted:#c5d0dc;--title:#fff;--accent:#fff;--accent-soft:#ffffff26;--teal:#8ff0d3;--green-soft:#ffffff1f;background:var(--surface);color:var(--ink)}
html[data-palette="claro"] .sidebar{--surface:#f6f8fb;--surface-soft:#e7ebf1;--ink:#1d2f42;--muted:#55687c;--line:#dde3ea;--title:#0f2233;--accent:#6a45c2;--accent-soft:#eee8fa;--teal:#08705f;--green-soft:#dcf3ec;background:var(--surface);color:var(--ink)}

/* ===== Página Apariencia ===== */
.appearance{display:grid;gap:22px;max-width:920px}
.ap-block h3{margin:0 0 4px;font-size:15px;color:var(--title)}.ap-block>p{margin:0 0 16px;font-size:12px;color:var(--muted)}
.swatches{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:12px}
.swatch{display:grid;justify-items:center;gap:9px;padding:14px 8px 12px;border:2px solid var(--line);border-radius:14px;background:var(--surface);color:var(--ink);font-size:12px;font-weight:600}
.swatch:hover{background:var(--surface-soft)}
.swatch[aria-pressed="true"]{border-color:var(--primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 25%,transparent)}
.swatch small{display:block;font-weight:400;color:var(--muted);font-size:10px;margin-top:2px}
.dot{width:44px;height:44px;border-radius:50%;border:3px solid var(--surface);box-shadow:0 0 0 1px var(--line);background:linear-gradient(135deg,var(--side) 0 55%,var(--btn) 55% 100%)}
.mode-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}
.mode-card{display:grid;gap:8px;padding:12px;border:2px solid var(--line);border-radius:14px;background:var(--surface);color:var(--ink);text-align:left;font-size:12px;font-weight:600}
.mode-card[aria-pressed="true"]{border-color:var(--primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 25%,transparent)}
.mode-prev{height:54px;border-radius:9px;border:1px solid var(--line);display:grid;grid-template-columns:28% 1fr}
.mode-prev i{display:block}
.ap-preview{border:1px solid var(--line);border-radius:14px;overflow:hidden;display:grid;grid-template-columns:150px 1fr;min-height:150px;background:var(--canvas)}
.ap-preview .ap-side{background:var(--surface);padding:14px;display:grid;align-content:start;gap:8px;font-size:11px;color:var(--muted)}
.ap-preview .ap-side b{color:var(--accent);background:var(--accent-soft);padding:6px 9px;border-radius:7px}
.ap-preview .ap-main{padding:16px;display:grid;align-content:start;gap:10px}
@media(max-width:650px){.ap-preview{grid-template-columns:100px 1fr}}

/* ===== Pipeline · tablero Kanban ===== */
.kanban{display:flex;gap:14px;overflow-x:auto;padding:4px 2px 14px;align-items:flex-start;scroll-snap-type:x proximity}
.kb-col{flex:0 0 268px;min-width:268px;background:var(--surface-soft);border:1px solid var(--line);border-top:4px solid var(--stage);border-radius:12px;padding:12px;display:flex;flex-direction:column;gap:10px;scroll-snap-align:start;transition:background .15s,box-shadow .15s}
.kb-col.over{box-shadow:0 0 0 2px var(--stage);background:color-mix(in srgb,var(--stage) 10%,var(--surface-soft))}
.kb-head{display:grid;gap:3px}
.kb-title{display:flex;align-items:center;gap:8px}.kb-title strong{font-size:13px;color:var(--title);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.kb-count{background:var(--surface);border:1px solid var(--line);border-radius:999px;font-size:11px;font-weight:700;padding:1px 8px;color:var(--ink)}
.kb-add{border:1px dashed var(--line);background:transparent;color:var(--teal);width:24px;height:24px;border-radius:7px;font-size:15px;line-height:1}
.kb-add:hover{background:var(--surface)}
.kb-total{font-size:12px;color:var(--muted);font-weight:600}
.kb-cards{display:grid;gap:10px;min-height:44px}
.kb-empty{margin:0;padding:14px 8px;text-align:center;font-size:11px;color:var(--muted);border:1px dashed var(--line);border-radius:9px}
.kb-card{background:var(--surface);border:1px solid var(--line);border-radius:11px;padding:12px;display:grid;gap:7px;box-shadow:0 2px 8px var(--shadow);cursor:grab;transition:transform .12s,box-shadow .12s}
.kb-card:hover{box-shadow:0 6px 18px var(--shadow);transform:translateY(-1px)}
.kb-card.dragging{opacity:.45;cursor:grabbing}
.kb-card.late{border-left:3px solid var(--red)}
.kb-top{display:flex;justify-content:space-between;align-items:center}
.kb-owner .chip-avatar{width:24px;height:24px;min-width:24px;font-size:9px}
.prio{font-size:10px;font-weight:700;border-radius:999px;padding:3px 9px}
.prio-alta{background:var(--red-soft);color:var(--red)}.prio-media{background:var(--amber-soft);color:var(--amber)}.prio-baja{background:var(--green-soft);color:var(--teal)}
.kb-name{border:0;background:none;padding:0;text-align:left;font-size:13px;font-weight:650;color:var(--title);line-height:1.35}
.kb-name:hover{text-decoration:underline}
.kb-client{font-size:11px;color:var(--muted)}
.kb-value{font-size:17px;font-weight:700;color:var(--title);letter-spacing:-.3px}
.kb-foot{display:flex;justify-content:space-between;align-items:center;gap:8px}
.kb-date{font-size:10px;color:var(--muted)}.kb-date.late{color:var(--red);font-weight:700}
.kb-move select{width:100%;font-size:11px;padding:6px 8px;border:1px solid var(--line);border-radius:7px;background:var(--surface-soft);color:var(--muted)}
@media(hover:hover){.kb-move{display:none}.kb-card:hover .kb-move,.kb-card:focus-within .kb-move{display:block}}
@media(max-width:650px){.kb-col{flex-basis:84vw;min-width:84vw}}
.sidebar .nav-list{gap:1px}.sidebar .nav-list button{padding:8px 12px}.sidebar .nav-label{padding:12px 12px 6px}.sidebar .company-switch{margin-bottom:12px}.sidebar .brand{padding-bottom:16px}

/* ===== 1.9.1 · La paleta tiñe todo el entorno (fondo, tarjetas, bordes) ===== */
html[data-theme="dark"][data-palette="slate"]{--canvas:#141a22;--surface:#1d2530;--surface-soft:#26303d;--line:#37455a;--muted:#aab8c7}
html[data-theme="dark"][data-palette="forest"]{--canvas:#0c1912;--surface:#13261c;--surface-soft:#1a3426;--line:#2b4a3a;--muted:#a7c3b3}
html[data-theme="dark"][data-palette="purple"]{--canvas:#130e23;--surface:#1c1533;--surface-soft:#261d44;--line:#3d3068;--muted:#b9aed9}
html[data-theme="dark"][data-palette="wine"]{--canvas:#1a0c12;--surface:#27121a;--surface-soft:#341a24;--line:#57303d;--muted:#d6adb9}
html[data-theme="light"][data-palette="slate"]{--canvas:#e9edf2;--surface:#f8f9fb;--surface-soft:#e9edf1;--line:#d3dae3}
html[data-theme="light"][data-palette="forest"]{--canvas:#e7f0ea;--surface:#f6faf7;--surface-soft:#e3eee7;--line:#cbddd2}
html[data-theme="light"][data-palette="purple"]{--canvas:#eeeaf7;--surface:#faf9fd;--surface-soft:#ebe6f5;--line:#dad2ec}
html[data-theme="light"][data-palette="wine"]{--canvas:#f5eaea;--surface:#fcf8f7;--surface-soft:#f3e6e7;--line:#e6d0d3}
html[data-theme="rest"][data-palette="slate"]{--canvas:#e6e6e0;--surface:#f0efe9;--surface-soft:#e2e2dc}
html[data-theme="rest"][data-palette="forest"]{--canvas:#e5e9d6;--surface:#eff1e2;--surface-soft:#e0e5d0}
html[data-theme="rest"][data-palette="purple"]{--canvas:#e8e2dc;--surface:#f2ede8;--surface-soft:#e4dcd8}
html[data-theme="rest"][data-palette="wine"]{--canvas:#ede1d6;--surface:#f6ede3;--surface-soft:#eadbcf}
.form-fields [hidden],.field[hidden]{display:none!important}

/* ===== 1.10.0 · Oscuro suave (gris pizarra) ===== */
[data-theme="soft"] {
  --canvas:#1e293b;--surface:#3a485e;--surface-soft:#2f3c50;--ink:#f1f5f9;--title:#ffffff;--muted:#b8c4d4;
  --line:#52627b;--accent:#c4b5fd;--accent-soft:#3f3a66;--primary:#34d3b0;--primary-hover:#5ce0c4;
  --on-primary:#062a22;--on-brand:#062a22;--teal:#5fe0c1;--green-soft:#24473f;--violet:#c4b5fd;--violet-soft:#3f3a66;
  --amber:#fbbf6b;--amber-soft:#4f4030;--red:#ff9fb0;--red-soft:#573242;--blue:#8bbbea;
  --glass:#ffffff0d;--shadow:#0f172a66;--overlay:#0b1220b3;--focus:#c4b5fd;
  color-scheme:dark;
}
html[data-theme="soft"][data-palette="navy"] .sidebar{--surface:#334155;--surface-soft:#3f4e64}
html[data-theme="soft"][data-palette="forest"]{--canvas:#1c2f27;--surface:#2e4a3d;--surface-soft:#253d33;--line:#47675a;--muted:#b5cdbf}
html[data-theme="soft"][data-palette="purple"]{--canvas:#261f3f;--surface:#3d3260;--surface-soft:#322a52;--line:#574a82;--muted:#c6bce3}
html[data-theme="soft"][data-palette="wine"]{--canvas:#35202a;--surface:#543440;--surface-soft:#452a35;--line:#6f4a58;--muted:#e0bcc8}

/* ===== 1.10.0 · Estadísticas ===== */
.stats-filters{display:grid;gap:12px;margin-bottom:18px}.stats-filters .quick-chips{margin:0}
.stats-filters .range{display:flex;gap:12px;align-items:end;flex-wrap:wrap}.stats-filters .field{min-width:150px}
.cur-pick{max-width:220px;margin-bottom:12px}
.stats-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.stats-grid .wide-card{grid-column:1/-1}
@media(max-width:900px){.stats-grid{grid-template-columns:1fr}}
.ch-svg{width:100%;height:auto;display:block}
.ch-grid{stroke:var(--line);stroke-width:1}.ch-tick{fill:var(--muted);font-size:10px}
.ch-line{fill:none;stroke:var(--teal);stroke-width:2.5;stroke-linejoin:round;stroke-linecap:round}.ch-area{fill:var(--teal);opacity:.12}
.ch-dot{fill:var(--teal);stroke:var(--surface);stroke-width:2}
.hbars{list-style:none;margin:0;padding:0;display:grid;gap:11px}
.hbars li{display:grid;grid-template-columns:minmax(80px,32%) 1fr auto;align-items:center;gap:10px;font-size:12px}
.hb-name{color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hb-val{color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}
.hb-track{height:10px;background:var(--surface-soft);border-radius:6px;overflow:hidden;display:grid;align-content:center;gap:2px}
.hb-track.two{height:16px;gap:2px}.hb-track.two .hb-fill{height:7px}
.hb-fill{display:block;height:10px;border-radius:0 4px 4px 0}
.hb-fill.teal,.sw.teal{background:var(--teal)}.hb-fill.cyan,.sw.cyan{background:var(--blue)}.hb-fill.amber,.sw.amber{background:var(--amber)}.hb-fill.violet,.sw.violet{background:var(--violet)}.hb-fill.red,.sw.red{background:var(--red)}
.donut-wrap{display:flex;align-items:center;gap:22px;flex-wrap:wrap}.donut{width:150px;height:150px;flex:none}
.dn.teal{stroke:var(--teal)}.dn.cyan{stroke:var(--blue)}.dn.red{stroke:var(--red)}.dn.violet{stroke:var(--violet)}
.dn-total{fill:var(--title);font-size:24px;font-weight:700}
.legend{list-style:none;margin:0;padding:0;display:grid;gap:8px;font-size:12px;color:var(--ink)}.legend.inline{display:flex;gap:16px;margin-bottom:12px}
.sw{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:7px}

/* ===== 1.10.0 · Ver en móvil (QR) y PWA ===== */
.mobile-open{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:8px;padding:8px 11px;font-size:11px;font-weight:600}
.mobile-open svg{width:16px;height:16px}.mobile-open:hover{background:var(--surface-soft)}
.mobile-body{display:grid;justify-items:center;gap:12px;text-align:center;max-width:380px;margin:0 auto}
.qr-box{background:#fff;padding:10px;border-radius:14px;width:min(300px,72vw);box-shadow:0 4px 18px var(--shadow)}.qr-box svg{display:block;width:100%;height:auto}
.qr-box.expired{opacity:.25;filter:grayscale(1)}
.qr-text{margin:0;font-size:13px;color:var(--ink);line-height:1.5}.qr-timer{margin:0;font-size:13px;font-weight:700;color:var(--teal)}
.qr-url{width:100%;text-align:left;font-size:12px;color:var(--muted)}.qr-url input{width:100%;margin:8px 0;padding:8px;border:1px solid var(--line);border-radius:7px;background:var(--surface-soft);color:var(--ink);font-size:11px}
@media(max-width:650px){.mobile-open span{display:none}}
.hbars+.table-wrap{margin-top:18px}

/* ===== 1.10.1 · Móvil: tablas como tarjetas y barra superior compacta ===== */
@media(max-width:650px){
  .data-table.stack thead{display:none}
  .data-table.stack,.data-table.stack tbody{display:block;white-space:normal}
  .data-table.stack tr{display:block;background:var(--surface);border:1px solid var(--line);border-radius:12px;margin:0 0 12px;padding:6px 12px;overflow:hidden}
  .data-table.stack td{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:9px 0!important;border:0!important;border-bottom:1px solid var(--line)!important;text-align:right;white-space:normal;box-shadow:none!important;background:none!important}
  .data-table.stack td:last-child{border-bottom:0!important}
  .data-table.stack td::before{content:attr(data-label);color:var(--muted);font-size:10px;font-weight:700;letter-spacing:.4px;text-transform:uppercase;text-align:left;flex:none}
  .data-table.stack td:first-child{justify-content:flex-start;text-align:left}.data-table.stack td:first-child::before{display:none}
  .data-table.stack td[data-label="Acciones"]{display:block;text-align:left}.data-table.stack td[data-label="Acciones"]::before{display:none}
  .data-table.stack tr[data-state]{border-left-width:4px}
  .data-table.stack tr[data-state="pendiente"],.data-table.stack tr[data-state="programada"],.data-table.stack tr[data-state="borrador"],.data-table.stack tr[data-state="emitida"]{border-left-color:var(--amber)}
  .data-table.stack tr[data-state="confirmada"],.data-table.stack tr[data-state="completada"],.data-table.stack tr[data-state="activo"],.data-table.stack tr[data-state="pagada"],.data-table.stack tr[data-state="presente"],.data-table.stack tr[data-state="ganada"]{border-left-color:var(--teal)}
  .data-table.stack tr[data-state="cancelada"],.data-table.stack tr[data-state="no_asistio"],.data-table.stack tr[data-state="anulada"],.data-table.stack tr[data-state="inactivo"],.data-table.stack tr[data-state="perdida"],.data-table.stack tr[data-state="ausente"]{border-left-color:var(--red)}
  .data-table.stack .row-actions{opacity:1!important}
  .table-wrap{overflow:visible}
  .header-right{display:grid;grid-template-columns:1fr auto;gap:8px}
  .header-right .trial-banner{grid-column:1/-1;justify-self:start}
  .header-right .user-label{max-width:none}
  .header-right .theme-switch{grid-column:1/-1;display:flex;align-items:center;gap:10px}.header-right .theme-switch select{flex:1}
  .toolbar-filters,.toolbar-filters .search,.toolbar .search input{width:100%}
  .toolbar-filters select{max-width:none;flex:1}
  .stats-filters .range .field{flex:1;min-width:130px}
  .cal-nav .cal-label{flex-basis:100%;margin-left:0}
}
.paypal-panel { margin-bottom: 20px; }
.paypal-panel .toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.paypal-panel [data-paypal-result] { overflow-wrap: anywhere; }
