/* ============ PALETA OFICIAL LUM ============ */
:root{
  /* ===== marca (constantes: no cambian con el tema — son rellenos sólidos estables) ===== */
  --smoky:#11120D; --olive:#565449; --bone:#D8CFBC; --floral:#FFFBF4;
  --alert:#9b4a2f; --gold:#a3803c; --green:#3f5636;
  --display:'Manrope',-apple-system,BlinkMacSystemFont,sans-serif;
  --sans:-apple-system,BlinkMacSystemFont,'Inter','Segoe UI',sans-serif;
  color-scheme:light;

  /* ===== semántico (SÍ cambian con el tema) ===== */
  --ink:#1c1d16; --muted:#8b897c; --line:#e4ddcd; --olive-tint:#eeece3;
  --text-1:var(--smoky); --accent-1:var(--olive);
  --surface-0:var(--floral); --surface-1:#fff; --surface-2:var(--olive-tint);
  --border-2:#cfc6ae; --win-edge:rgba(17,18,13,.16);
  --desk-1:#f7f1e3; --desk-2:#eae2d0; --desk-3:#d9cfb8; --desk-body:#ddd4bf;
  --tb-1:#f3edde; --tb-2:#eae3d2;
  --tint-ok-bg:#eaf0e6;    --tint-ok-tx:var(--green);
  --tint-done-bg:#eef0ea;  --tint-done-tx:var(--muted);
  --tint-gold-bg:#f2ead8;  --tint-gold-tx:var(--gold);
  --tint-alert-bg:#f7e7df; --tint-alert-tx:var(--alert);
  --tint-part-bg:var(--olive-tint); --tint-part-tx:var(--olive);
  --dot-ok:#7d8a6d; --dot-err:#c46a4a;

  /* ===== sombras ===== */
  --shadow:0 1px 2px rgba(17,18,13,.04),0 8px 30px rgba(17,18,13,.06);
  --shadow-sm:0 1px 2px rgba(17,18,13,.05);
  --shadow-md:var(--shadow);
  --shadow-lg:0 30px 80px rgba(17,18,13,.4);

  /* ===== escala de espaciado ===== */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:20px; --sp-6:24px; --sp-7:32px; --sp-8:40px;

  /* ===== escala tipográfica ===== */
  --fs-2xs:9.5px; --fs-xs:11px; --fs-sm:12px; --fs-md:13px; --fs-lg:15px; --fs-xl:17px; --fs-2xl:21px; --fs-3xl:28px;

  /* ===== escala de radios ===== */
  --r-sm:6px; --r-md:10px; --r-lg:14px; --r-pill:999px;
}
[data-theme="dark"]{
  color-scheme:dark;
  --ink:#E8E4D9; --muted:#9C9A8E; --line:#34332A; --olive-tint:#23231C;
  --text-1:#FBF8F0; --accent-1:#9A9884;
  --surface-0:#15150F; --surface-1:#1F1F17; --surface-2:#23231C;
  --border-2:#454436; --win-edge:rgba(0,0,0,.5);
  --desk-1:#221F16; --desk-2:#1B1A12; --desk-3:#100F0A; --desk-body:#17160F;
  --tb-1:#211F16; --tb-2:#1A1911;
  --tint-ok-bg:#20301f;    --tint-ok-tx:#8fc17d;
  --tint-done-bg:#26261e;  --tint-done-tx:#9C9A8E;
  --tint-gold-bg:#332a18;  --tint-gold-tx:#dcb977;
  --tint-alert-bg:#33231b; --tint-alert-tx:#e2967c;
  --tint-part-bg:#23231C;  --tint-part-tx:#9A9884;
  --dot-ok:#8fa17d; --dot-err:#d47f5f;
  --shadow-sm:0 1px 2px rgba(0,0,0,.3);
  --shadow-md:0 1px 2px rgba(0,0,0,.3),0 8px 30px rgba(0,0,0,.35);
  --shadow-lg:0 30px 80px rgba(0,0,0,.55);
}
[data-theme="dark"] img,[data-theme="dark"] .mac-window{color-scheme:dark}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{background:var(--desk-body);color:var(--ink);font-family:var(--sans);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;overflow:hidden}
.track-sm{letter-spacing:.22em;text-transform:uppercase;font-size:10.5px}
button{font-family:inherit;cursor:pointer}
input,select,textarea{font-family:inherit;font-size:14px}

/* ============ ESCRITORIO + VENTANA macOS ============ */
.desk{height:100%;padding:16px;background:radial-gradient(120% 130% at 18% 0%,var(--desk-1) 0%,var(--desk-2) 52%,var(--desk-3) 100%)}
.mac-window{height:100%;display:flex;flex-direction:column;background:var(--surface-0);border-radius:12px;overflow:hidden;border:1px solid var(--win-edge);box-shadow:0 24px 70px rgba(17,18,13,.32),0 2px 8px rgba(17,18,13,.12)}
.titlebar{height:46px;flex:none;display:flex;align-items:center;gap:14px;padding:0 14px;background:linear-gradient(180deg,var(--tb-1),var(--tb-2));border-bottom:1px solid var(--line)}
.lights{display:flex;gap:8px;flex:none}
.l{width:12px;height:12px;border-radius:50%;box-shadow:inset 0 0 0 .5px rgba(0,0,0,.18)}
.l.r{background:#ff5f57}.l.y{background:#febc2e}.l.g{background:#28c840}
.tb-title{display:flex;align-items:center;gap:9px;font-family:var(--display);font-weight:700;font-size:13px;color:var(--text-1);white-space:nowrap;overflow:hidden}
.tb-title svg{flex:none}
.tb-title .sub{font-family:var(--sans);font-weight:500;color:var(--muted);font-size:12px;overflow:hidden;text-overflow:ellipsis}
.tb-actions{margin-left:auto;display:flex;align-items:center;gap:8px;flex:none}
.savepill{display:flex;align-items:center;gap:7px;font-size:11px;color:var(--muted)}
.dot{width:7px;height:7px;border-radius:50%;background:var(--dot-ok);transition:.3s}
.dot.saving{background:var(--gold)}
.dot.err{background:var(--dot-err)}
.tb-btn{background:var(--surface-1);border:1px solid var(--line);border-radius:7px;padding:5px 11px;font-size:11px;font-weight:500;color:var(--ink);transition:.15s}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0}
.tb-btn:hover{background:var(--olive-tint)}

/* ============ SIDEBAR + CONTENIDO ============ */
.body-row{flex:1;display:flex;min-height:0}
.sidebar{width:212px;flex:none;background:rgba(240,236,226,.72);backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border-right:1px solid var(--line);padding:8px 9px 16px;overflow-y:auto}
.side-sec{font-size:9.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);font-weight:700;margin:14px 8px 5px}
.side-item{display:flex;align-items:center;gap:9px;width:100%;padding:7px 9px;border:0;border-radius:7px;background:transparent;color:var(--ink);font-size:13px;font-weight:500;text-align:left;transition:.12s;white-space:nowrap}
.side-item svg{width:15px;height:15px;flex:none;opacity:.75}
.side-item:hover{background:rgba(17,18,13,.06)}
.side-item.active{background:var(--smoky);color:var(--floral)}
.side-item.active svg{opacity:1}
.content{flex:1;min-width:0;overflow-y:auto}
.content::-webkit-scrollbar,.sidebar::-webkit-scrollbar{width:11px}
.content::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background:rgba(17,18,13,.16);border-radius:8px;border:3px solid transparent;background-clip:content-box}
main{max-width:1120px;margin:0 auto;padding:28px 28px 84px}
.view{display:none;animation:fade .3s ease}
.view.active{display:block}
@keyframes fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.eyebrow{color:var(--olive);font-weight:600}
.view-title{font-family:var(--display);font-weight:800;font-size:30px;line-height:1.05;margin:8px 0 2px;color:var(--text-1);letter-spacing:-.01em}
.view-desc{color:var(--muted);max-width:64ch;margin:0 0 24px}
.section-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin:0 0 16px;flex-wrap:wrap}
.subhead{font-family:var(--display);font-weight:700;font-size:20px;color:var(--text-1);margin:0 0 4px}
.hr-rule{height:1px;background:var(--line);margin:34px 0 28px}
.btn{background:var(--smoky);color:var(--floral);border:0;border-radius:10px;padding:10px 18px;font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;font-weight:600;transition:.2s}
.btn:hover{background:var(--olive)}
.btn.sec{background:transparent;color:var(--text-1);border:1px solid var(--text-1)}
.btn.sec:hover{background:var(--smoky);color:var(--floral)}
.btn.sm{padding:7px 13px;font-size:9.5px}
.btn:disabled{opacity:.6;cursor:default}

/* ============ STATS / CARDS ============ */
.grid-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:28px}

/* ===== Fase 3: gráficas de Finanzas (hechas con divs, sin librerías) ===== */
.fin-charts-grid{display:grid;grid-template-columns:1.3fr 1fr;gap:16px;margin-bottom:16px}
.fin-charts-grid.three{grid-template-columns:repeat(3,1fr)}
.chart-card .card-b{padding:16px 18px 12px}
.chart-legend-mini{font-size:10.5px;font-weight:600;color:var(--muted);display:inline-flex;align-items:center}
.chart-legend-mini i{width:8px;height:8px;border-radius:2px;display:inline-block;margin-right:5px}

.flujo-wrap{display:flex;align-items:flex-end;gap:6px;height:170px;padding-top:6px}
.flujo-col{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;height:100%;min-width:0}
.flujo-bars{flex:1;display:flex;align-items:flex-end;gap:2px;width:100%;justify-content:center}
.flujo-bar{width:40%;border-radius:3px 3px 0 0;min-height:2px;transition:.15s}
.flujo-bar.ing{background:var(--tint-ok-tx)}
.flujo-bar.gas{background:var(--tint-alert-tx)}
.flujo-lbl{font-size:9.5px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;white-space:nowrap}
.flujo-col.cur .flujo-lbl{color:var(--olive);font-weight:700}

.anual-wrap{display:flex;align-items:flex-end;gap:16px;height:170px;padding-top:6px;justify-content:center}
.anual-col{display:flex;flex-direction:column;align-items:center;gap:8px;height:100%;width:64px}
.anual-bars{flex:1;display:flex;align-items:flex-end;gap:4px}
.anual-bar{width:20px;border-radius:3px 3px 0 0;min-height:2px}
.anual-bar.ing{background:var(--tint-ok-tx)}
.anual-bar.gas{background:var(--tint-alert-tx)}
.anual-yr{font-family:var(--display);font-weight:800;font-size:14px;color:var(--text-1)}

.rank-row{display:flex;align-items:center;gap:10px;padding:7px 0}
.rank-lbl{font-size:12px;color:var(--ink);min-width:92px;max-width:92px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:none}
.rank-track{flex:1;height:9px;background:var(--surface-2);border-radius:5px;overflow:hidden}
.rank-fill{height:100%;border-radius:5px;min-width:3px}
.rank-val{font-size:11.5px;font-weight:700;color:var(--text-1);min-width:64px;text-align:right;flex:none}

/* ===== Fase 3: tablas de rentabilidad (reutilizan .ledger) ===== */
.margin-chip{display:inline-block;padding:2px 7px;border-radius:5px;font-size:10.5px;font-weight:700}
.stat{background:var(--surface-1);border:1px solid var(--line);border-radius:12px;padding:18px 18px 16px;box-shadow:var(--shadow)}
.stat .k{font-size:10px;letter-spacing:.18em;text-transform:uppercase;color:var(--olive);font-weight:600}
.stat .v{font-family:var(--display);font-weight:800;font-size:29px;line-height:1.05;margin-top:9px;color:var(--text-1);letter-spacing:-.01em}
.stat .v.neg{color:var(--alert)}
.stat .n{font-size:12px;color:var(--muted);margin-top:5px}
.panel-cols{display:grid;grid-template-columns:1.2fr 1fr;gap:18px;margin-bottom:18px}
.card{background:var(--surface-1);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);overflow:hidden}
.card .card-h{padding:14px 18px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;gap:10px}
.card .card-h h3{font-family:var(--display);font-weight:700;font-size:16px;margin:0;color:var(--text-1)}
.card .card-b{padding:6px 18px 14px}
.mini-row{display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}
.mini-row:last-child{border-bottom:0}
.mini-row .date-chip{font-family:var(--display);font-weight:700;font-size:13px;color:var(--olive);min-width:70px}
.mini-row .grow{flex:1;min-width:0}
.mini-row .nm{font-weight:500;color:var(--text-1);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mini-row .mt{font-size:12px;color:var(--muted)}
.empty{color:var(--muted);font-style:italic;padding:16px 0;font-size:14px}

/* ============ TABLAS ============ */
.ledger{background:var(--surface-1);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);overflow:hidden;overflow-x:auto}
.ledger table{width:100%;border-collapse:collapse;min-width:640px}
.ledger thead th{text-align:left;font-size:9.5px;letter-spacing:.16em;text-transform:uppercase;color:var(--olive);font-weight:600;padding:13px 14px;border-bottom:1px solid var(--line);white-space:nowrap}
.ledger thead th.r,.ledger td.r{text-align:right}
.ledger tbody td{padding:13px 14px;border-bottom:1px solid var(--line);vertical-align:middle}
.ledger tbody tr{transition:background .15s}
.ledger tbody tr.click{cursor:pointer}
.ledger tbody tr.click:hover{background:var(--olive-tint)}
.ledger tbody tr:last-child td{border-bottom:0}
.cell-date{font-family:var(--display);font-weight:700;font-size:15px;color:var(--text-1);white-space:nowrap}
.cell-date small{display:block;font-family:var(--sans);font-weight:500;font-size:10px;letter-spacing:.08em;color:var(--muted);text-transform:uppercase}
.cell-name{font-weight:600;color:var(--text-1)}
.cell-name small{display:block;font-weight:400;color:var(--muted);font-size:12px}
.cell-money{font-variant-numeric:tabular-nums;white-space:nowrap;font-weight:500}
.cell-money.due{color:var(--alert);font-weight:600}
.cell-money.pos{color:var(--green);font-weight:600}
.paybar{height:4px;border-radius:3px;background:var(--olive-tint);overflow:hidden;margin-top:6px;width:86px;margin-left:auto}
.paybar>i{display:block;height:100%;background:var(--olive)}
.badge{display:inline-block;font-size:9px;letter-spacing:.1em;text-transform:uppercase;padding:4px 8px;border-radius:6px;font-weight:600;white-space:nowrap}
.b-ok{background:var(--tint-ok-bg);color:var(--tint-ok-tx)}
.b-part{background:var(--tint-part-bg);color:var(--tint-part-tx)}
.b-none{background:var(--tint-alert-bg);color:var(--tint-alert-tx)}
.b-done{background:var(--tint-done-bg);color:var(--tint-done-tx)}
.b-gold{background:var(--tint-gold-bg);color:var(--tint-gold-tx)}
.row-actions{display:flex;gap:6px;justify-content:flex-end}
.icon-btn{background:transparent;border:1px solid var(--line);border-radius:8px;width:29px;height:29px;color:var(--muted);font-size:13px;line-height:1;transition:.15s;display:inline-flex;align-items:center;justify-content:center;flex:none}
.icon-btn:hover{border-color:var(--text-1);color:var(--text-1)}
.icon-btn.del:hover{border-color:var(--alert);color:var(--alert)}
.avat{width:25px;height:25px;border-radius:50%;color:var(--floral);font-size:10px;display:inline-flex;align-items:center;justify-content:center;font-weight:700;flex:none;letter-spacing:.02em}
.assign{display:inline-flex;align-items:center;gap:7px;font-size:12px;color:var(--ink)}

/* ============ CHIPS / FILTROS ============ */
.filters{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px;align-items:center}
.flab{font-size:9.5px;letter-spacing:.16em;text-transform:uppercase;color:var(--muted);font-weight:700;margin-right:2px}
.chip{background:transparent;border:1px solid var(--line);color:var(--muted);padding:6px 13px;border-radius:999px;font-size:11px;transition:.15s;display:inline-flex;align-items:center;gap:6px}
.chip:hover{border-color:var(--olive);color:var(--olive)}
.chip.active{background:var(--smoky);border-color:var(--smoky);color:var(--floral)}
.search-in{border:1px solid var(--line);border-radius:9px;padding:9px 13px;background:var(--surface-1);min-width:220px}
.search-in:focus{outline:0;border-color:var(--olive)}

/* ============ WORKSPACE (Drive/Gmail) ============ */
.toolcard{background:var(--surface-1);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);padding:13px 16px;margin-bottom:14px;display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.toolcard select,.toolcard input{padding:9px 12px;border:1px solid var(--line);border-radius:8px;background:var(--surface-1);font-size:13px}
.toolcard select:focus,.toolcard input:focus{outline:0;border-color:var(--olive)}
.finder{background:var(--surface-1);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);overflow:hidden}
.pathbar{display:flex;align-items:center;gap:8px;padding:10px 15px;border-bottom:1px solid var(--line);background:var(--surface-2);font-size:12px;color:var(--muted)}
.pathbar b{color:var(--text-1);font-weight:600}
.file-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(138px,1fr));gap:8px;padding:14px}
.file-grid:empty{padding:0}
.file-it{border:1px solid transparent;border-radius:10px;padding:12px 8px 10px;text-align:center;cursor:pointer;transition:.12s}
.file-it:hover{background:var(--olive-tint);border-color:var(--line)}
.file-it .fi-ico{font-size:30px;line-height:1;margin-bottom:8px}
.file-it .fi-name{font-size:12px;font-weight:500;color:var(--text-1);word-break:break-word;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.file-it .fi-meta{font-size:10.5px;color:var(--muted);margin-top:3px}
.ws-status{padding:12px 15px;font-size:12.5px;color:var(--muted);border-top:1px solid var(--line)}
.finder .file-grid:empty + .ws-status{border-top:0}
.spinner{width:13px;height:13px;border:2px solid var(--line);border-top-color:var(--olive);border-radius:50%;display:inline-block;vertical-align:-2px;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.ws-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--line);font-size:13px}
.ws-row:last-child{border-bottom:0}
.ws-row .wlab{font-weight:600;color:var(--text-1);min-width:72px}
.ws-row .wval{flex:1;min-width:0;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ws-row a{color:var(--olive);font-weight:600;text-decoration:none}
.ws-row a:hover{text-decoration:underline}

/* ============ ENTREGABLES / RECORDATORIOS ============ */
.deliv-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(310px,1fr));gap:16px}
.deliv-card{background:var(--surface-1);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);padding:16px 18px 12px;display:flex;flex-direction:column}
.deliv-card .dc-top{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:2px}
.deliv-card h4{font-family:var(--display);font-weight:700;font-size:17px;margin:0;color:var(--text-1)}
.deliv-card .dc-meta{font-size:12px;color:var(--muted);margin-bottom:12px}
.check{display:flex;align-items:center;gap:11px;padding:7px 0;border-bottom:1px solid var(--line);cursor:pointer;user-select:none}
.check:last-of-type{border-bottom:0}
.check .box{width:19px;height:19px;border:1.5px solid var(--olive);border-radius:5px;flex:none;display:flex;align-items:center;justify-content:center;transition:.15s}
.check .box svg{width:12px;height:12px;stroke:var(--floral);stroke-width:3;fill:none;opacity:0;transition:.15s}
.check.done .box{background:var(--olive);border-color:var(--olive)}
.check.done .box svg{opacity:1}
.check .lbl{font-size:13px;color:var(--ink);transition:.15s}
.check.done .lbl{color:var(--muted);text-decoration:line-through}
.deliv-progress{margin-top:12px;display:flex;align-items:center;gap:10px}
.deliv-progress .bar{flex:1;height:4px;border-radius:3px;background:var(--olive-tint);overflow:hidden}
.deliv-progress .bar>i{display:block;height:100%;background:var(--olive);transition:.3s}
.deliv-progress .pct{font-family:var(--display);font-weight:800;font-size:13px;color:var(--olive)}
.remind{display:flex;align-items:center;gap:13px;background:var(--surface-1);border:1px solid var(--line);border-radius:11px;padding:12px 15px;margin-bottom:9px;box-shadow:var(--shadow)}
.remind .rbox{width:20px;height:20px;border:1.5px solid var(--olive);border-radius:6px;flex:none;cursor:pointer;display:flex;align-items:center;justify-content:center}
.remind .rbox svg{width:12px;height:12px;stroke:var(--floral);stroke-width:3;fill:none;opacity:0}
.remind.done .rbox{background:var(--olive);border-color:var(--olive)}
.remind.done .rbox svg{opacity:1}
.remind .rgrow{flex:1;min-width:0}
.remind .rtxt{font-weight:500;color:var(--text-1)}
.remind.done .rtxt{text-decoration:line-through;color:var(--muted)}
.remind .rdate{font-size:11.5px;color:var(--muted);margin-top:1px}
.remind .rdate.over{color:var(--alert);font-weight:600}

/* ============ PENDIENTES ============ */
.pend-card{background:var(--surface-1);border:1px solid var(--line);border-left:3px solid var(--olive);border-radius:11px;box-shadow:var(--shadow);padding:13px 16px;margin-bottom:10px;display:flex;align-items:flex-start;gap:13px}
.pend-card.s-done{border-left-color:var(--bone);opacity:.7}
.pend-card.s-proc{border-left-color:var(--gold)}
.pend-card.over{border-left-color:var(--alert)}
.pcheck{width:22px;height:22px;border:1.5px solid var(--olive);border-radius:7px;flex:none;cursor:pointer;display:flex;align-items:center;justify-content:center;margin-top:2px}
.pcheck svg{width:13px;height:13px;stroke:var(--floral);stroke-width:3;fill:none;opacity:0}
.pend-card.s-done .pcheck{background:var(--olive);border-color:var(--olive)}
.pend-card.s-done .pcheck svg{opacity:1}
.pend-card .pc-grow{flex:1;min-width:0}
.pend-card .pc-biz{font-size:9px;letter-spacing:.16em;text-transform:uppercase;color:var(--olive);font-weight:700}
.pend-card .pc-task{font-weight:500;color:var(--text-1);margin:2px 0}
.pend-card.s-done .pc-task{text-decoration:line-through;color:var(--muted)}
.pend-card .pc-meta{font-size:12px;color:var(--muted);display:flex;gap:13px;flex-wrap:wrap;margin-top:3px;align-items:center}
.pend-card .pc-meta .over{color:var(--alert);font-weight:600}
.status-sel{border:1px solid var(--line);border-radius:8px;padding:5px 7px;font-size:11px;color:var(--ink);background:var(--surface-1)}

/* ============ CALENDARIO ============ */
.cal-head{display:flex;align-items:center;gap:14px;margin-bottom:16px;flex-wrap:wrap}
.cal-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:14px;margin-bottom:12px}
.seg{display:inline-flex;background:var(--surface-2);border-radius:10px;padding:3px;gap:2px}
.seg button{border:0;background:transparent;padding:7px 14px;font-size:12.5px;font-weight:600;color:var(--muted);border-radius:8px;cursor:pointer;transition:.15s;white-space:nowrap}
.seg button.active{background:var(--surface-1);color:var(--text-1);box-shadow:var(--shadow-sm)}
.cal-nav-row{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.cal-nav{display:flex;gap:6px}
.cal-nav .icon-btn{width:33px;height:33px;font-size:17px}
.cal-title{font-family:var(--display);font-weight:800;font-size:21px;color:var(--text-1);min-width:170px}
.cal-filters{display:flex;flex-wrap:wrap;gap:7px;align-items:center;margin-bottom:16px}
.fchip-dot{width:7px;height:7px;border-radius:50%;display:inline-block;margin-right:5px;vertical-align:middle}
.crew-dot{width:8px;height:8px;border-radius:50%;display:inline-block;flex:none;border:1px solid var(--surface-1)}
.crew-dots{display:inline-flex;gap:-2px;margin-left:5px}
.crew-dots .crew-dot+.crew-dot{margin-left:-3px}

/* ---- vista mensual ---- */
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;background:var(--line);border:1px solid var(--line);border-radius:12px;overflow:hidden;box-shadow:var(--shadow)}
.cal-dow{background:var(--smoky);color:var(--bone);text-align:center;padding:10px 0;font-size:9.5px;letter-spacing:.14em;text-transform:uppercase}
.cal-cell{background:var(--surface-1);min-height:102px;padding:7px 8px 8px;display:flex;flex-direction:column;gap:3px;cursor:pointer;transition:background .12s}
.cal-cell:hover{background:var(--olive-tint)}
.cal-cell.other{background:var(--surface-2)}
.cal-cell.other .dn{color:var(--muted)}
.cal-cell.today{box-shadow:inset 0 0 0 2px var(--olive)}
.cal-cell.dropok{background:var(--tint-ok-bg);box-shadow:inset 0 0 0 2px var(--green)}
.cal-cell .dn{font-family:var(--display);font-weight:700;font-size:13px;color:var(--text-1);line-height:1}
.cal-cell.today .dn{color:var(--olive)}
.cal-pill{font-size:10.5px;line-height:1.3;padding:3px 6px 3px 7px;border-radius:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:grab;border-left:3px solid transparent}
.cal-pill.dragging{opacity:.35}
.cal-ent{background:var(--tint-part-bg);color:var(--tint-part-tx);border:1px solid var(--border-2)}
.cal-pen{font-weight:500}
.cal-more{font-size:10px;color:var(--muted);padding-left:2px}
.cal-legend{display:flex;gap:16px;flex-wrap:wrap;margin-top:14px;font-size:12px;color:var(--muted)}
.cal-legend span{display:inline-flex;align-items:center;gap:7px}
.cal-legend i{width:12px;height:12px;border-radius:3px;display:inline-block;flex:none}

/* ---- vista semanal / diaria (columnas por día con franja "todo el día" + lista por hora) ---- */
.cal-week{display:grid;grid-template-columns:repeat(7,1fr);gap:10px;overflow-x:auto;padding-bottom:4px}
.cal-day-col{background:var(--surface-1);border:1px solid var(--line);border-radius:12px;overflow:hidden;box-shadow:var(--shadow-sm);min-width:132px;display:flex;flex-direction:column}
.cal-day-col.today{box-shadow:0 0 0 2px var(--olive)}
.cal-day-head{padding:9px 10px;text-align:center;border-bottom:1px solid var(--line);background:var(--surface-2)}
.cal-day-head .dname{font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);font-weight:700}
.cal-day-head .dnum{font-family:var(--display);font-weight:800;font-size:19px;color:var(--text-1)}
.cal-day-col.today .dnum{color:var(--olive)}
.cal-day-body{padding:8px;display:flex;flex-direction:column;gap:6px;flex:1;min-height:160px}
.cal-item{border-radius:8px;padding:6px 8px;font-size:11.5px;line-height:1.35;cursor:grab}
.cal-item .hr{font-weight:700;font-size:9.5px;letter-spacing:.04em;opacity:.85;display:block;margin-bottom:1px}
.cal-item .nm2{font-weight:600;display:block}
.cal-item.dragging{opacity:.35}
.cal-daybtn{border:1px dashed var(--line);border-radius:8px;background:transparent;color:var(--muted);font-size:11px;padding:6px;cursor:pointer;margin-top:auto}
.cal-daybtn:hover{border-color:var(--olive);color:var(--olive)}

/* ---- vista diaria: una sola columna ancha con más detalle ---- */
.cal-day-view{background:var(--surface-1);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);overflow:hidden}
.cal-day-view-head{padding:16px 20px;border-bottom:1px solid var(--line);background:var(--surface-2);display:flex;align-items:baseline;gap:10px}
.cal-day-view-head .dnum{font-family:var(--display);font-weight:800;font-size:30px;color:var(--text-1)}
.cal-day-view-head .dname{font-size:13px;color:var(--muted);text-transform:capitalize}
.cal-day-view-body{padding:14px 18px;display:flex;flex-direction:column;gap:10px}
.cal-dev-item{border:1px solid var(--line);border-radius:11px;padding:12px 14px;display:flex;gap:12px;align-items:flex-start;cursor:grab}
.cal-dev-item .hr2{font-family:var(--display);font-weight:800;font-size:14px;min-width:52px}
.cal-dev-item .grow{flex:1;min-width:0}
.cal-dev-item .t1{font-weight:600;color:var(--text-1)}
.cal-dev-item .t2{font-size:12px;color:var(--muted);margin-top:2px}

/* ---- agenda ---- */
.agenda-group{margin-bottom:18px}
.agenda-date{font-family:var(--display);font-weight:800;font-size:14px;color:var(--olive);text-transform:capitalize;margin-bottom:8px;padding-bottom:6px;border-bottom:1px solid var(--line)}
.agenda-item{display:flex;align-items:center;gap:12px;padding:10px 4px;border-bottom:1px solid var(--line)}
.agenda-item:last-child{border-bottom:0}
.agenda-item .achip{width:8px;height:8px;border-radius:50%;flex:none}
.agenda-item .grow{flex:1;min-width:0}
.agenda-item .t1{font-weight:600;color:var(--text-1);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.agenda-item .t2{font-size:12px;color:var(--muted)}
.agenda-item .hr3{font-size:11px;color:var(--muted);font-weight:600;min-width:44px;text-align:right}

/* ---- arrastrar y soltar (fantasma que sigue al dedo/cursor) ---- */
.drag-ghost{position:fixed;z-index:95;pointer-events:none;padding:5px 10px;border-radius:7px;font-size:11.5px;font-weight:600;box-shadow:var(--shadow-lg);opacity:.94;transform:translate(-50%,-50%);white-space:nowrap}

/* ============ EQUIPO ============ */
.equipo-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(290px,1fr));gap:16px}
.eq-sec{grid-column:1/-1;display:flex;align-items:baseline;gap:10px;margin:10px 2px 0;padding-bottom:6px;border-bottom:2px solid var(--olive-tint)}
.eq-sec:first-child{margin-top:0}
.eq-sec h2{font-family:var(--display);font-weight:800;font-size:14px;letter-spacing:.06em;text-transform:uppercase;color:var(--olive);margin:0}
.eq-sec span{font-size:12px;color:var(--muted)}
.cfg-row{display:flex;align-items:center;gap:11px;padding:9px 0;border-bottom:1px solid var(--line)}
.cfg-row:last-child{border-bottom:0}
.cfg-row .grow{flex:1;min-width:0}
.cfg-row .nm{font-weight:600;color:var(--text-1)}
.cfg-row .sub{font-size:12px;color:var(--muted)}

/* ============ MODAL ============ */
.overlay{position:fixed;inset:0;background:rgba(17,18,13,.55);backdrop-filter:blur(3px);z-index:60;display:none;align-items:flex-start;justify-content:center;padding:36px 16px;overflow-y:auto}
.overlay.open{display:flex}
.modal{background:var(--surface-1);width:100%;max-width:600px;border-radius:14px;box-shadow:var(--shadow-lg);overflow:hidden;animation:pop .25s ease}
@keyframes pop{from{opacity:0;transform:translateY(14px) scale(.98)}to{opacity:1;transform:none}}
.modal-h{background:var(--smoky);color:var(--floral);padding:17px 22px;display:flex;justify-content:space-between;align-items:center}
.modal-h h3{font-family:var(--display);font-weight:800;font-size:18px;margin:0;letter-spacing:.01em}
.modal-h .x{background:transparent;border:0;color:var(--bone);font-size:21px;line-height:1;padding:0 4px}
.modal-h .x:hover{color:var(--floral)}
.modal-b{padding:20px 22px}
.field{margin-bottom:14px}
.field label{display:block;font-size:9.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--olive);font-weight:700;margin-bottom:6px}
.field input,.field select,.field textarea{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:9px;background:var(--surface-1);color:var(--ink);transition:.15s}
.field input:focus,.field select:focus,.field textarea:focus{outline:0;border-color:var(--olive);box-shadow:0 0 0 3px rgba(86,84,73,.12)}
.field textarea{resize:vertical;min-height:60px}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.money-trio{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px;margin:4px 0 15px}
.money-trio .mbox{background:var(--olive-tint);border-radius:10px;padding:10px 12px}
.money-trio .lab{font-size:9px;letter-spacing:.12em;text-transform:uppercase;color:var(--olive);font-weight:700}
.money-trio .amt{font-family:var(--display);font-weight:800;font-size:19px;color:var(--text-1);margin-top:3px}
.money-trio .amt.due{color:var(--alert)}
.money-trio .amt.pos{color:var(--green)}
.fin-block{border:1px solid var(--line);border-radius:11px;background:var(--surface-1);padding:13px 14px;margin-bottom:14px}
.fin-block h5{margin:0 0 8px;font-size:9.5px;letter-spacing:.16em;text-transform:uppercase;color:var(--olive)}
.fin-row{display:flex;align-items:center;gap:9px;padding:7px 0;border-bottom:1px solid var(--line);font-size:13px}
.fin-row:last-of-type{border-bottom:0}
.fin-row .fx{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fin-row .fm{font-variant-numeric:tabular-nums;font-weight:600}
.fin-add{display:grid;grid-template-columns:96px 1fr;gap:8px;margin-top:11px}
.fin-add2{display:grid;grid-template-columns:1fr 1fr 40px;gap:8px;margin-top:8px}
.fin-add select,.fin-add input,.fin-add2 select,.fin-add2 input{padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface-1);font-size:13px}
.fin-add2 .addb{background:var(--smoky);color:var(--floral);border:0;border-radius:8px;font-size:17px}
.fin-add2 .addb:hover{background:var(--olive)}
.modal-f{display:flex;justify-content:space-between;gap:10px;padding:16px 22px;border-top:1px solid var(--line);background:var(--surface-1)}

/* ===== Fase 4: ficha de cliente 360° ===== */
.csheet-overlay{align-items:center;padding:24px 16px}
.csheet{background:var(--surface-1);width:100%;max-width:960px;max-height:92vh;border-radius:16px;box-shadow:var(--shadow-lg);overflow-y:auto;animation:pop .25s ease}
.csheet-head{display:flex;align-items:flex-start;gap:14px;padding:22px 26px;border-bottom:1px solid var(--line);position:sticky;top:0;background:var(--surface-1);z-index:2}
.csheet-id{display:flex;align-items:center;gap:14px;flex:1;min-width:0}
.csheet-avat{width:46px;height:46px;border-radius:50%;background:var(--olive);color:var(--floral);display:inline-flex;align-items:center;justify-content:center;font-family:var(--display);font-weight:800;font-size:16px;flex:none}
.csheet-head h2{font-family:var(--display);font-weight:800;font-size:22px;color:var(--text-1);margin:0 0 3px}
.csheet-contact{font-size:12.5px;color:var(--muted);display:flex;gap:12px;flex-wrap:wrap}
.csheet-contact a{color:var(--olive);text-decoration:none}
.csheet-actions{display:flex;gap:8px;flex-wrap:wrap}
.csheet .grid-stats{margin:18px 26px 0;grid-template-columns:repeat(4,1fr)}
.csheet-body{padding:20px 26px 28px;display:flex;flex-direction:column;gap:16px}
.cs-card{border:1px solid var(--line);border-radius:12px;overflow:hidden}
.cs-card-h{padding:12px 16px;border-bottom:1px solid var(--line);background:var(--surface-2);display:flex;justify-content:space-between;align-items:center}
.cs-card-h h4{font-family:var(--display);font-weight:700;font-size:14px;color:var(--text-1);margin:0}
.cs-card-b{padding:6px 16px}
.cs-row{display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}
.cs-row:last-child{border-bottom:0}
.cs-row .grow{flex:1;min-width:0}
.cs-row .t1{font-weight:600;color:var(--text-1);font-size:13px}
.cs-row .t2{font-size:11.5px;color:var(--muted);margin-top:1px}
.cs-cols2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.cs-timeline{display:flex;flex-direction:column;gap:0}
.cs-tl-item{display:flex;gap:12px;padding:9px 0;border-bottom:1px solid var(--line)}
.cs-tl-item:last-child{border-bottom:0}
.cs-tl-dot{width:8px;height:8px;border-radius:50%;flex:none;margin-top:5px}
.cs-tl-item .grow{flex:1;min-width:0}
.cs-tl-item .t1{font-size:12.5px;color:var(--text-1);font-weight:500}
.cs-tl-item .t2{font-size:11px;color:var(--muted)}
.cs-resp{display:flex;flex-wrap:wrap;gap:10px}
.cs-resp-item{display:flex;align-items:center;gap:7px;font-size:12px;color:var(--ink);background:var(--surface-2);padding:5px 10px 5px 5px;border-radius:20px}
.cs-notas textarea{width:100%;min-height:90px;border:1px solid var(--line);border-radius:9px;padding:10px 12px;font-size:13px;font-family:var(--sans);color:var(--ink);background:var(--surface-1);resize:vertical}
.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(20px);background:var(--smoky);color:var(--floral);padding:12px 22px;border-radius:10px;font-size:13px;box-shadow:0 14px 40px rgba(17,18,13,.35);opacity:0;pointer-events:none;transition:.3s;z-index:80;max-width:90vw}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

/* ============ CONFIRMACIÓN PROPIA (reemplaza confirm del navegador) ============ */
.cfm{position:fixed;inset:0;z-index:90;display:none;align-items:center;justify-content:center;background:rgba(17,18,13,.5);backdrop-filter:blur(2px);padding:20px}
.cfm.open{display:flex}
.cfm-box{background:var(--surface-1);border-radius:14px;padding:20px 22px;max-width:420px;width:100%;box-shadow:var(--shadow-lg);animation:pop .2s ease}
.cfm-msg{margin-bottom:18px;font-size:14px;color:var(--ink);line-height:1.55}
.cfm-btns{display:flex;justify-content:flex-end;gap:10px}

/* ============ EVENTO: resumen y filas editables ============ */
.money-quad{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:4px 0 15px}
.money-quad .mbox{background:var(--olive-tint);border-radius:10px;padding:10px 12px}
.money-quad .lab{font-size:9px;letter-spacing:.12em;text-transform:uppercase;color:var(--olive);font-weight:700}
.money-quad .amt{font-family:var(--display);font-weight:800;font-size:17px;color:var(--text-1);margin-top:3px}
.money-quad .amt.due{color:var(--alert)}
.money-quad .amt.pos{color:var(--green)}
.row-line{display:grid;grid-template-columns:1.2fr .9fr .75fr 30px;gap:8px;margin-bottom:8px;align-items:center}
.row-line.prod{grid-template-columns:1.4fr .5fr .75fr 30px}
.row-line select,.row-line input{padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface-1);font-size:13px;width:100%}
.row-line .xdel{background:transparent;border:1px solid var(--line);border-radius:8px;height:34px;color:var(--muted);font-size:13px}
.row-line .xdel:hover{border-color:var(--alert);color:var(--alert)}
.sub-sum{font-size:11.5px;color:var(--muted);text-align:right;margin:2px 0 2px}
.est-dot{width:11px;height:11px;border-radius:50%;display:inline-block;flex:none}

/* ============ RESPONSIVE ============ */
@media(max-width:920px){
  .desk{padding:0}
  .mac-window{border-radius:0;border:0;height:100dvh}
  .body-row{flex-direction:column}
  .sidebar{width:100%;display:flex;flex-direction:row;overflow-x:auto;overflow-y:hidden;padding:7px 10px 5px;gap:4px;border-right:0;border-bottom:1px solid var(--line);scrollbar-width:thin;-webkit-overflow-scrolling:touch}
  .sidebar::-webkit-scrollbar{height:4px}
  .sidebar::-webkit-scrollbar-thumb{background:var(--olive);border-radius:4px}
  .sidebar::-webkit-scrollbar-track{background:transparent}
  .side-sec{display:none}
  .side-item{width:auto;flex:none;padding:7px 11px;font-size:12px}
  .grid-stats{grid-template-columns:repeat(2,1fr)}
  .panel-cols{grid-template-columns:1fr}
  .view-title{font-size:25px}
  .hide-sm{display:none}
  .ledger td.hide-sm,.ledger th.hide-sm{display:none}
  .ledger table{min-width:520px}
  main{padding:22px 16px 70px}
}
@media(max-width:560px){
  .field-row,.money-trio{grid-template-columns:1fr}
  .money-quad{grid-template-columns:1fr 1fr}
  main{padding:18px 12px 64px}
  .tb-title .sub{display:none}
  .cal-cell{min-height:72px;padding:5px 4px}
  .cal-dow{font-size:8px;letter-spacing:.06em}
  .cal-pill{font-size:8.5px;padding:2px 4px}
  .cal-title{font-size:19px;min-width:0}
  .ledger table{min-width:430px}
  .cal-toolbar{gap:10px}
  .seg{width:100%;overflow-x:auto}
  .seg button{flex:1;padding:7px 8px;font-size:11.5px}
  .cal-nav-row{width:100%;justify-content:space-between}
  .cal-day-col{min-width:118px}
  .cal-day-view-head .dnum{font-size:24px}
  .agenda-item .t2{display:none}
  .fin-charts-grid,.fin-charts-grid.three{grid-template-columns:1fr}
  .flujo-wrap{height:130px}
  .rank-lbl{min-width:72px;max-width:72px}
  .csheet .grid-stats{grid-template-columns:repeat(2,1fr);margin:14px 16px 0}
  .csheet-head{padding:16px 16px 14px;flex-wrap:wrap}
  .csheet-body{padding:16px 16px 22px}
  .cs-cols2{grid-template-columns:1fr}
  .csheet-actions{width:100%;order:3}
}

/* =======================================================================
   AÑADIDOS v4 — acceso, documentos (recibos y contratos), utilidades
   ======================================================================= */

/* ---------- Pantalla de acceso ---------- */
.login-layer{
  position:fixed; inset:0; z-index:9000;
  display:none; align-items:center; justify-content:center;
  background:var(--desk-body);
  padding:var(--sp-6);
}
.login-layer.open{display:flex}
.login-card{
  width:100%; max-width:390px;
  background:var(--surface-1); border:1px solid var(--border-2);
  border-radius:var(--r-lg); box-shadow:var(--shadow-lg);
  padding:var(--sp-8) var(--sp-7);
}
.login-mark{display:flex; align-items:center; gap:var(--sp-3); margin-bottom:var(--sp-6)}
.login-mark h1{
  font-family:var(--display); font-size:var(--fs-xl); font-weight:800;
  letter-spacing:-.2px; margin:0; color:var(--text-1);
}
.login-mark p{margin:2px 0 0; font-size:var(--fs-xs); color:var(--muted)}
.login-card label{display:block; margin-bottom:var(--sp-4)}
.login-card label span{
  display:block; font-size:var(--fs-xs); color:var(--muted); margin-bottom:var(--sp-2);
}
.login-card .btn{width:100%; justify-content:center; margin-top:var(--sp-2)}
.login-msg{min-height:18px; font-size:var(--fs-sm); margin-bottom:var(--sp-3)}
.login-msg.err{color:var(--alert)}
.login-pie{
  margin-top:var(--sp-6); padding-top:var(--sp-4); border-top:1px solid var(--line);
  font-size:var(--fs-2xs); color:var(--muted); line-height:1.5;
}

/* ---------- Pastilla de usuario en la barra de título ---------- */
.userpill{
  display:none; align-items:center; gap:var(--sp-2);
  padding:3px var(--sp-3); border-radius:var(--r-pill);
  background:var(--surface-2); border:1px solid var(--line);
  cursor:pointer; font-size:var(--fs-2xs);
}
.userpill:hover{border-color:var(--border-2)}
.userpill .uname{font-weight:600; color:var(--text-1)}
.userpill .urol{color:var(--muted)}

/* ---------- Documentos: recibos y contratos ---------- */
.tbl .num{text-align:right; white-space:nowrap}
.tbl .acciones{text-align:right; white-space:nowrap}
.tbl .acciones .btn{margin-left:var(--sp-1)}
.tbl .tenue{color:var(--muted); font-size:var(--fs-xs)}
.fila-cancelada > td{opacity:.5; text-decoration:line-through}
.fila-cancelada .acciones .btn{text-decoration:none; opacity:1}

.tbl-wrap{overflow-x:auto; -webkit-overflow-scrolling:touch}

.pager{
  display:flex; align-items:center; justify-content:center; gap:var(--sp-3);
  padding-top:var(--sp-4);
}
.pager .pinfo{font-size:var(--fs-xs); color:var(--muted)}
.btn.xs{padding:3px 9px; font-size:var(--fs-2xs); border-radius:var(--r-sm)}
.btn.alerta{color:var(--alert); border-color:color-mix(in srgb, var(--alert) 35%, transparent)}
.btn[disabled]{opacity:.4; cursor:not-allowed}

.row-tools{display:flex; align-items:center; gap:var(--sp-2); flex-wrap:wrap}
.row-tools .inp.sm{padding:5px 9px; font-size:var(--fs-xs); min-width:0}
.row-tools #recQ, .row-tools #ctoQ{min-width:190px}

.doc-ficha{
  background:var(--surface-2); border:1px solid var(--line);
  border-radius:var(--r-md); padding:var(--sp-5); margin-bottom:var(--sp-4);
}
.doc-cifra{
  font-family:var(--display); font-size:var(--fs-3xl); font-weight:800;
  letter-spacing:-.8px; color:var(--text-1); margin-bottom:var(--sp-2);
}
.doc-linea{font-size:var(--fs-md); color:var(--ink); margin-bottom:2px}
.doc-linea.tenue{color:var(--muted); font-size:var(--fs-sm)}
.doc-nota{
  font-size:var(--fs-sm); color:var(--muted); margin-top:var(--sp-3);
  padding-left:var(--sp-3); border-left:2px solid var(--border-2);
}
.doc-nota i{font-style:normal; font-size:var(--fs-2xs); letter-spacing:.6px; color:var(--muted)}
.doc-meta{
  display:flex; flex-wrap:wrap; gap:var(--sp-5);
  margin-top:var(--sp-4); padding-top:var(--sp-4); border-top:1px solid var(--line);
}
.doc-meta span{display:flex; flex-direction:column; font-size:var(--fs-sm); color:var(--ink)}
.doc-meta i{font-style:normal; font-size:var(--fs-2xs); color:var(--muted); margin-bottom:2px}
.doc-acciones{
  display:flex; gap:var(--sp-2); flex-wrap:wrap;
  margin-top:var(--sp-4); padding-top:var(--sp-4); border-top:1px solid var(--line);
}

.aviso-alerta{
  background:var(--tint-alert-bg); color:var(--tint-alert-tx);
  border-radius:var(--r-sm); padding:var(--sp-3) var(--sp-4);
  font-size:var(--fs-sm); margin-bottom:var(--sp-4); line-height:1.45;
}

/* ---------- Plantillas: fichas de variable ---------- */
.chips{display:flex; flex-wrap:wrap; gap:var(--sp-1); margin-top:var(--sp-2)}
.chips-scroll{max-height:96px; overflow-y:auto; padding:var(--sp-2); background:var(--surface-2); border-radius:var(--r-sm)}
.chip-var{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:var(--fs-2xs);
  background:var(--surface-1); border:1px solid var(--line); color:var(--accent-1);
  padding:2px 7px; border-radius:var(--r-sm); white-space:nowrap;
}
button.chip-var.accion{cursor:pointer}
button.chip-var.accion:hover{border-color:var(--accent-1); background:var(--olive-tint)}

.var-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:var(--sp-3); margin-top:var(--sp-2)}
.var-grid .f span{text-transform:capitalize}

.inp.mono{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:var(--fs-sm); line-height:1.55;
}

.hint{font-size:var(--fs-xs); color:var(--muted); line-height:1.5; margin:var(--sp-2) 0 0}
.hint code{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  background:var(--surface-2); padding:1px 5px; border-radius:4px; color:var(--accent-1);
}

/* ---------- Pestañas ---------- */
.tabs{display:flex; gap:var(--sp-1); margin-bottom:var(--sp-4); border-bottom:1px solid var(--line)}
.tabs .tab{
  background:none; border:none; cursor:pointer;
  padding:var(--sp-3) var(--sp-4); font-size:var(--fs-sm); color:var(--muted);
  border-bottom:2px solid transparent; margin-bottom:-1px;
}
.tabs .tab.active{color:var(--text-1); border-bottom-color:var(--accent-1); font-weight:600}

/* ---------- Usuario de sólo consulta ---------- */
body.solo-lectura .btn:not(.sec):not(.xs),
body.solo-lectura #modalSave{display:none !important}

/* ---------- Responsive ---------- */
@media (max-width:820px){
  .row-tools{width:100%}
  .row-tools #recQ, .row-tools #ctoQ{flex:1 1 100%}
  .doc-meta{gap:var(--sp-4)}
  .var-grid{grid-template-columns:1fr}
  .login-card{padding:var(--sp-6) var(--sp-5)}
}
