/* ReformayVivelo · interfaz. Tipografías y colores de www.reformayvivelo.com:
   títulos Poppins, texto Rubik; azul #302D87 y naranja #EA6013.
   Fuentes servidas desde la propia app (public/assets/fonts, licencia OFL). */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/poppins-700.woff2") format("woff2"); }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("fonts/rubik-var.woff2") format("woff2"); }

:root {
  --azul: #302D87; --azul-osc: #1D1B5C; --azul-2: #4B47B8; --naranja: #EA6013; --naranja-osc: #C84E0A;
  --bg: #F3F4FA; --surface: #FFFFFF; --surface-2: #F1F2F9; --line: #E3E5F0; --line-2: #D4D7E6;
  --fg: #1C1B3F; --muted: #64667E;
  --accent: #302D87; --accent-ink: #FFFFFF; --accent-soft: #ECEBFA;
  --cta: #EA6013; --cta-ink: #FFFFFF; --cta-soft: #FDEDE3;
  --ok: #18794A; --ok-soft: #DDF3E6;
  --warn: #9A5A00; --warn-soft: #FDF1CF;
  --bad: #B42318; --bad-soft: #FBE1DD;
  --vio: #6B4FC3; --vio-soft: #ECE7FA;
  /* Gráficas: pasos validados (CVD, banda de luminosidad, contraste) */
  --serie-1: #4B47B8; --serie-2: #EA6013; --grid: #E7E9F2; --pista: #ECEBFA;
  --r: 18px; --r-sm: 12px;
  --font-display: "Poppins", "Segoe UI", Arial, sans-serif;
  --font-body: "Rubik", "Segoe UI", Arial, sans-serif;
  --font-data: "Rubik", "Segoe UI", Arial, sans-serif;
  --shadow: 0 1px 2px rgba(28, 27, 63, .05), 0 6px 20px -10px rgba(48, 45, 135, .18);
  --shadow-up: 0 2px 4px rgba(28, 27, 63, .06), 0 16px 32px -14px rgba(48, 45, 135, .32);
  --side-bg: linear-gradient(175deg, #302D87 0%, #24226F 55%, #1B1957 100%);
  --top-bg: rgba(255, 255, 255, .82);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0F1D; --surface: #171A2E; --surface-2: #1F2339; --line: #2A2F4B; --line-2: #383E5E;
    --fg: #ECEDF8; --muted: #A2A5C0;
    --accent: #A9A6F5; --accent-ink: #12132A; --accent-soft: #272A50;
    --cta: #F07A36; --cta-ink: #170C04; --cta-soft: #3A2215;
    --ok: #5CC28A; --ok-soft: #15301F; --warn: #E3AE4F; --warn-soft: #362A10;
    --bad: #F08A80; --bad-soft: #3B1B19; --vio: #B3A1F0; --vio-soft: #2B2445;
    --serie-1: #8682EA; --serie-2: #E26B28; --grid: #262A44; --pista: #272A50;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-up: 0 2px 4px rgba(0, 0, 0, .4), 0 18px 36px -14px rgba(0, 0, 0, .7);
    --side-bg: linear-gradient(175deg, #1E1C5E 0%, #15143F 60%, #0F0E2C 100%);
    --top-bg: rgba(23, 26, 46, .82);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0F1D; --surface: #171A2E; --surface-2: #1F2339; --line: #2A2F4B; --line-2: #383E5E;
  --fg: #ECEDF8; --muted: #A2A5C0;
  --accent: #A9A6F5; --accent-ink: #12132A; --accent-soft: #272A50;
  --cta: #F07A36; --cta-ink: #170C04; --cta-soft: #3A2215;
  --ok: #5CC28A; --ok-soft: #15301F; --warn: #E3AE4F; --warn-soft: #362A10;
  --bad: #F08A80; --bad-soft: #3B1B19; --vio: #B3A1F0; --vio-soft: #2B2445;
  --serie-1: #8682EA; --serie-2: #E26B28; --grid: #262A44; --pista: #272A50;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-up: 0 2px 4px rgba(0, 0, 0, .4), 0 18px 36px -14px rgba(0, 0, 0, .7);
  --side-bg: linear-gradient(175deg, #1E1C5E 0%, #15143F 60%, #0F0E2C 100%);
  --top-bg: rgba(23, 26, 46, .82);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.22; margin: 0 0 .5em; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: 1.6rem; display: flex; align-items: center; gap: .4em; }
h2 { font-size: 1.05rem; letter-spacing: -.01em; font-weight: 600; }
a { color: var(--accent); text-underline-offset: 3px; }
code, .mono { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-size: .95em; }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.center { text-align: center; }
.wrap { word-break: break-all; white-space: normal; }
.txt-bad { color: var(--bad); } .txt-warn { color: var(--warn); }
.falta { color: var(--warn); font-weight: 600; }
:focus-visible { outline: 3px solid var(--cta); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.ico { width: 20px; height: 20px; flex: none; }
.ico-sm { width: 15px; height: 15px; vertical-align: -2px; }
::selection { background: var(--cta-soft); }

/* Armazón: menú lateral de marca + columna de contenido */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 20px 14px 16px; background: var(--side-bg); color: #fff; }
.side::after { content: ""; position: absolute; right: -60px; bottom: 60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(234, 96, 19, .28), transparent 70%); pointer-events: none; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; text-decoration: none; color: #fff; }
.side-brand img { max-width: 190px; max-height: 44px; object-fit: contain; }
.side-brand img.logo-claro { background: #fff; border-radius: 8px; padding: 4px 6px; }
.side-g { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.side-gt { margin: 10px 12px 4px; font: 600 .68rem var(--font-display); text-transform: uppercase; letter-spacing: .12em; color: rgba(255, 255, 255, .5); }
.nav-pill { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: rgba(255, 255, 255, .82); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav-pill:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-pill.active { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.nav-pill.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--naranja); }
.nav-pill.active .ico { color: #FFB27F; }
.nav-pill .fase { margin-left: auto; font-size: .66rem; color: rgba(255, 255, 255, .6); border: 1px solid rgba(255, 255, 255, .25); border-radius: 99px; padding: 0 6px; }
.side-cta { display: flex; align-items: center; justify-content: center; gap: 8px; margin: auto 4px 12px; padding: 11px 14px; border-radius: 14px; background: var(--naranja); color: #fff; text-decoration: none; font: 600 .92rem var(--font-display); box-shadow: 0 10px 22px -10px rgba(234, 96, 19, .9); transition: transform .15s, box-shadow .15s; }
.side-cta:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -10px rgba(234, 96, 19, 1); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; line-height: 1.2; }
.side-user:hover { background: rgba(255, 255, 255, .12); }
.side-user strong { display: block; font-size: .88rem; font-weight: 600; }
.side-user small { color: rgba(255, 255, 255, .62); font-size: .74rem; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: linear-gradient(135deg, #EA6013, #F59A52); color: #fff; font: 700 .82rem var(--font-display); }
.col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 28px; min-height: 62px; background: var(--top-bg); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--line); }
.top-brand { display: none; }
.top-brand img { height: 30px; max-width: 160px; object-fit: contain; }
.top-info { display: flex; align-items: center; gap: 10px; }
.save-state { font-size: .82rem; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); }
.save-state[data-state="ok"] { color: var(--ok); background: var(--ok-soft); }
.save-state[data-state="err"] { color: var(--bad); background: var(--bad-soft); }
.save-state[data-state="ro"], .save-state[data-state="idle"] { color: var(--muted); }
.save-state[data-state="busy"] { color: var(--warn); background: var(--warn-soft); }
.env-tag { background: var(--warn-soft); color: var(--warn); border-radius: 99px; padding: 2px 10px; font-size: .74rem; font-weight: 600; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.top-right form { margin: 0; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--fg); cursor: pointer; transition: background .15s; }
.icon-btn:hover { background: var(--surface-2); }
.badge { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--naranja); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; box-shadow: 0 0 0 2px var(--surface); }
.menu-btn { display: none; }
.main { padding: 28px; min-width: 0; width: 100%; max-width: 1440px; animation: entrar .35s ease both; }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--naranja); color: #fff; font: 700 1.1rem var(--font-display); }
.brand-name { font: 700 1.05rem var(--font-display); }

/* Cajón de avisos */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); background: var(--surface); border-left: 1px solid var(--line); z-index: 40; display: flex; flex-direction: column; padding: 18px; box-shadow: -16px 0 40px rgba(20, 18, 70, .18); animation: deslizar .2s ease; }
@keyframes deslizar { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer[hidden] { display: none; }
.drawer-h { display: flex; justify-content: space-between; align-items: center; }
.drawer-f { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.drawer-f form { margin: 0; }
.scrim { position: fixed; inset: 0; background: rgba(14, 13, 45, .4); backdrop-filter: blur(2px); z-index: 30; }
.scrim[hidden] { display: none; }
.avisos { list-style: none; margin: 0; padding: 0; overflow: auto; }
.avisos li form { margin: 0; }
.aviso-btn { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; border: 0; background: transparent; color: var(--fg); padding: 10px 10px; border-bottom: 1px solid var(--line); cursor: pointer; font: inherit; border-radius: 10px; }
.aviso-btn:hover { background: var(--surface-2); }
.avisos .nuevo .aviso-btn { font-weight: 600; border-left: 3px solid var(--naranja); }
.aviso-btn small { color: var(--muted); font-weight: 400; }

/* Tarjetas y rejillas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-h h2 { margin: 0; }
.narrow { max-width: 580px; }
.muted-card { background: var(--surface-2); box-shadow: none; }
.grid { display: grid; gap: 18px; }
.grid > .card { margin-bottom: 0; }
.grid + .grid, .grid + .card { margin-top: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 1fr) 350px; align-items: start; }
.grid-side > div > .card:last-child, .grid-side > aside > .card:last-child { margin-bottom: 0; }
.page-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-h p { margin: 0; }
.page-h h1 { margin-bottom: 4px; }
.section-t { margin-top: 24px; }
.crumbs { font-size: .82rem; color: var(--muted); margin: 0 0 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.meta-line { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0 0; }

/* Cabecera de bienvenida */
.hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 28px 30px; margin-bottom: 18px; border-radius: 22px; color: #fff; background: linear-gradient(120deg, #302D87 0%, #3E3AA6 58%, #4B47B8 100%); box-shadow: var(--shadow-up); }
.hero::before { content: ""; position: absolute; right: -80px; top: -120px; width: 340px; height: 340px; border-radius: 50%; background: radial-gradient(circle, rgba(234, 96, 19, .55), rgba(234, 96, 19, 0) 68%); }
.hero::after { content: ""; position: absolute; left: 38%; bottom: -150px; width: 300px; height: 300px; border-radius: 50%; border: 40px solid rgba(255, 255, 255, .05); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 1.9rem; margin: 2px 0 6px; color: #fff; }
.hero-k { margin: 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255, 255, 255, .7); font-weight: 500; }
.hero-s { margin: 0; color: rgba(255, 255, 255, .86); }
.hero-s strong { color: #FFC59E; }
.hero-acc { display: flex; gap: 10px; flex-wrap: wrap; }
.sec-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 30px 0 14px; }
.sec-h h2 { font-size: 1.25rem; margin: 0; }
.sec-h p { margin: 2px 0 0; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; text-decoration: none; color: var(--fg); box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s; overflow: hidden; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-up); border-color: var(--line-2); }
a.kpi::after { content: "→"; position: absolute; right: 16px; bottom: 14px; color: var(--muted); opacity: 0; transform: translateX(-4px); transition: .18s; }
a.kpi:hover::after { opacity: 1; transform: none; }
.kpi-i { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.kpi-i .ico { width: 19px; height: 19px; }
.kpi-l { font-size: .84rem; color: var(--muted); }
.kpi-v { font: 600 1.75rem/1.15 var(--font-display); letter-spacing: -.02em; }
.kpi-s { font-size: .74rem; color: var(--muted); }
.kpi-bad .kpi-i { background: var(--bad-soft); color: var(--bad); } .kpi-bad .kpi-v { color: var(--bad); }
.kpi-warn .kpi-i { background: var(--cta-soft); color: var(--cta); } .kpi-warn .kpi-v { color: var(--warn); }
.kpi-bad, .kpi-warn { border-left: 0; }
.kpi-bad::before, .kpi-warn::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--bad); }
.kpi-warn::before { background: var(--cta); }
.kpis-mini .kpi { padding: 14px 16px; }
.kpis-mini .kpi-v { font-size: 1.45rem; }

/* Pastillas */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; line-height: 1.3; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill-neutral { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-vio { background: var(--vio-soft); color: var(--vio); }
.serie { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); font: 500 .92rem var(--font-display); text-decoration: none; cursor: pointer; min-height: 40px; transition: background .15s, transform .15s, box-shadow .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cta); color: var(--cta-ink); border-color: var(--cta); box-shadow: 0 8px 18px -10px rgba(234, 96, 19, .85); }
.btn-primary:hover { background: var(--naranja-osc); border-color: var(--naranja-osc); box-shadow: 0 12px 22px -10px rgba(234, 96, 19, .95); }
.btn-light { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .28); }
.btn-light:hover { background: rgba(255, 255, 255, .24); border-color: rgba(255, 255, 255, .4); }
.btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-danger:hover { background: var(--bad); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { padding: 4px 11px; min-height: 32px; font-size: .82rem; border-radius: 10px; }
.btn-lg { padding: 12px 22px; min-height: 48px; font-size: .98rem; }
.btn .ico { width: 17px; height: 17px; }
.btn:disabled { opacity: .55; cursor: progress; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 2px; }
.seg a, .seg button { padding: 7px 14px; border: 0; border-radius: 10px; background: transparent; text-decoration: none; color: var(--muted); font: 500 .86rem var(--font-display); cursor: pointer; transition: background .15s, color .15s; }
.seg a:hover, .seg button:hover { color: var(--fg); }
.seg a.on, .seg button.on, .seg button[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.seg-sm a, .seg-sm button { padding: 5px 10px; font-size: .8rem; }
.seg b { font-weight: 600; margin-left: 2px; color: var(--muted); }
.seg button[aria-selected="true"] b { color: var(--cta); }

/* Pestañas */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 5px; box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.tab { padding: 8px 16px; text-decoration: none; color: var(--muted); font: 500 .9rem var(--font-display); border-radius: 11px; white-space: nowrap; transition: background .15s, color .15s; }
.tab:hover { color: var(--fg); background: var(--surface-2); }
.tab.on { color: var(--accent-ink); background: var(--accent); }
.tab-off { opacity: .45; cursor: not-allowed; }

/* Formularios */
.stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: .8rem; font-weight: 500; color: var(--muted); }
.field-err { color: var(--bad); font-weight: 600; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 12px; min-height: 42px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled, fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: var(--surface-2); color: var(--muted); }
textarea { min-height: auto; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--cta); }
input[type="file"] { padding: 7px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.sub { border: 1px dashed var(--line-2); border-radius: 14px; padding: 12px 14px; }
legend { font-size: .8rem; font-weight: 600; color: var(--muted); padding: 0 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.check, .radio { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checks { justify-content: flex-end; gap: 8px; }
.radios { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .field { min-width: 150px; }
.grow { flex: 1 1 260px; }
.filters-actions { display: flex; gap: 8px; }
.upload-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
form h2 { margin-top: 6px; }

/* Avisos de página */
.alert { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid transparent; animation: entrar .3s ease both; }
.alert::before { font-weight: 700; }
.alert-guardado, .alert-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-guardado::before, .alert-ok::before { content: "✓"; }
.alert-error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-error::before { content: "!"; }
.alert-warn { background: var(--warn-soft); color: var(--warn); display: block; }
.alert-info { background: var(--accent-soft); color: var(--accent); }
.alert p { margin: 6px 0 0; }

/* Tablas */
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.table th { text-align: left; font: 600 .72rem var(--font-display); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th:first-child { border-radius: 10px 0 0 10px; }
.table th:last-child { border-radius: 0 10px 10px 0; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table a { text-decoration: none; font-weight: 500; }
.table a:hover { text-decoration: underline; }
.table th[data-dir]::after { content: " ▲"; font-size: .7em; color: var(--cta); }
.table th[data-dir="desc"]::after { content: " ▼"; }
[data-sortable] th { cursor: pointer; user-select: none; }
[data-sortable] th:hover { color: var(--fg); }
.row-off { opacity: .55; }
.row-mod { background: var(--accent-soft); }
.actions { white-space: nowrap; }
.actions > * { margin: 2px; }
.inline-form { display: inline-block; }
.inline-form summary { list-style: none; }
.inline-form form { display: flex; gap: 6px; margin-top: 6px; }
.paginacion { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* Bloques varios */
.dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; }
.dl dt { color: var(--muted); font-size: .84rem; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.feed li:last-child { border-bottom: 0; }
.feed-t { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.shortcut { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 8px; border-radius: 16px; background: var(--surface-2); border: 1px solid transparent; text-decoration: none; color: var(--fg); font: 500 .88rem var(--font-display); text-align: center; transition: transform .15s, background .15s, border-color .15s; }
.shortcut:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--line); transform: translateY(-2px); }
.shortcut .ico { width: 26px; height: 26px; color: var(--accent); }
.shortcut-accent { background: var(--cta); color: var(--cta-ink); }
.checklist, .rules { margin: 0; padding-left: 0; list-style: none; }
.checklist li, .rules li { padding: 6px 0 6px 26px; position: relative; }
.checklist li::before { content: "○"; position: absolute; left: 4px; color: var(--cta); }
.rules li::before { content: "!"; position: absolute; left: 6px; font-weight: 800; color: var(--warn); }
.funnel { list-style: none; padding: 0; margin: 0; }
.funnel a { display: grid; grid-template-columns: 120px 1fr 40px; gap: 10px; align-items: center; padding: 6px 8px; margin: 0 -8px; border-radius: 10px; text-decoration: none; color: var(--fg); font-size: .88rem; }
.funnel a:hover { background: var(--surface-2); }
.funnel-bar, .load { display: block; height: 10px; background: var(--pista); border-radius: 99px; overflow: hidden; }
.load { display: inline-block; width: 70px; height: 8px; vertical-align: middle; }
.fill { display: block; height: 100%; border-radius: 99px; background: var(--serie-1); }
.fill-ok { background: var(--ok); } .fill-warn { background: var(--warn); } .fill-bad { background: var(--bad); }
.fill-vio { background: var(--vio); } .fill-neutral { background: var(--muted); } .fill-accent { background: var(--serie-1); }
.funnel-n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 18px 1fr; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline p { margin: 0; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--serie-1); margin-top: 4px; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.tl-perdido .tl-dot { background: var(--bad); } .tl-ganado .tl-dot { background: var(--ok); }
.tl-reabierto .tl-dot { background: var(--warn); } .tl-documento .tl-dot { background: var(--vio); }
.tl-datos .tl-dot { background: var(--muted); } .tl-oferta .tl-dot { background: var(--cta); }
.next-action { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.next-action.venc { color: var(--bad); }
details.action > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
details.action > summary::-webkit-details-marker { display: none; }
details.action > summary::after { content: "+"; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--surface-2); font-size: 1.1rem; color: var(--muted); transition: transform .2s; }
details.action[open] > summary::after { content: "–"; }
details.action > summary h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
details.action[open] > summary { margin-bottom: 14px; }
.secret { font: 700 1.15rem var(--font-data); letter-spacing: .08em; background: var(--surface-2); padding: 8px 12px; border-radius: 10px; display: inline-block; margin: 8px 0; cursor: copy; }
.steps { padding-left: 20px; } .steps li { margin-bottom: 10px; }
.perm-table td:first-child { width: 80px; }

/* Ofertas / elaborador */
.logo-prev { max-height: 60px; max-width: 220px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }

.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
a.chip { text-decoration: none; }
.chip-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.num-r { text-align: right; white-space: nowrap; }
.strong { font-weight: 700; }
.mt { margin-top: 10px; }
.inline { display: inline; margin: 0; }
.inline-block { display: block; }
.inline-block > summary { list-style: none; width: 100%; }
.inline-block > summary::-webkit-details-marker { display: none; }
.of-grid { grid-template-columns: minmax(0, 1fr) 320px; }
.of-aside { position: sticky; top: 82px; align-self: start; max-height: calc(100vh - 90px); overflow-y: auto; }
.cap { padding: 14px 16px; }
.cap-h { display: flex; align-items: center; gap: 8px; background: var(--azul); color: #fff; margin: -14px -16px 10px; padding: 8px 12px; border-radius: var(--r) var(--r) 0 0; }
.cap-h.ro { margin: -18px -20px 10px; padding: 8px 14px; }
.cap-h input { background: rgba(255,255,255,.15); color: inherit; border-color: transparent; min-height: 36px; font-weight: 700; }
.cap-h input:focus { background: var(--surface); color: var(--fg); }
.cap-cod { width: 64px; flex: none; text-align: center; }
.cap-tit { flex: 1; text-transform: uppercase; }
.cap-sub { margin-left: auto; font-weight: 700; white-space: nowrap; padding: 0 6px; }
.cap-h .icon-btn { color: inherit; }
.lineas td { padding: 6px 4px; vertical-align: top; }
.lineas th { padding: 6px 4px; }
.lineas .num { width: 46px; padding-top: 14px; }
.lineas .col-desc { min-width: 260px; }
.lineas textarea { min-height: 42px; font-size: .9rem; }
.lineas input.n { width: 84px; text-align: right; }
.lineas input.u { width: 58px; }
.lineas .imp { width: 100px; text-align: right; padding-top: 14px; white-space: nowrap; font-weight: 600; }
.lineas tr.pendiente .imp { color: var(--warn); }
.lineas tr.pendiente input[data-precio] { border-color: var(--warn); background: var(--warn-soft); }
.row-actions { white-space: nowrap; width: 84px; padding-top: 10px !important; }
.row-actions button { border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 8px; width: 26px; height: 28px; cursor: pointer; font-weight: 700; }
.row-actions button:hover { background: var(--surface-2); }
.row-actions [data-del]:hover { background: var(--bad-soft); color: var(--bad); }
.cap-add { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; flex-wrap: wrap; }
.buscador { position: relative; flex: 1 1 320px; }
.sugerencias { position: absolute; left: 0; right: 0; top: 100%; z-index: 15; list-style: none; margin: 4px 0 0; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 340px; overflow-y: auto; }
.sugerencias li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: .88rem; }
.sugerencias li small { color: var(--muted); }
.sugerencias li.on, .sugerencias li[data-id]:hover { background: var(--accent-soft); }
.sugerencias li.vacio { cursor: default; color: var(--muted); }
.add-cap { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.totales .tot { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 0 0 14px; }
.totales dd { margin: 0; text-align: right; }
.tot-total { font-weight: 800; font-size: 1.15rem; border-top: 2px solid var(--fg); padding-top: 6px; }
/* Editor por cantidades: todas las partidas visibles, entra la que tiene cantidad */
.partidas-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; top: 74px; z-index: 6; }
.partidas-bar p { margin: 2px 0 0; }
.partidas-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
details.cap { padding: 0; overflow: hidden; }
details.cap > summary.cap-h { margin: 0; border-radius: 0; cursor: pointer; list-style: none; padding: 10px 14px; background: var(--surface-2); color: var(--fg); }
details.cap > summary::-webkit-details-marker { display: none; }
details.cap > summary.cap-h::before { content: "▸"; color: var(--muted); width: 14px; }
details.cap[open] > summary.cap-h::before { content: "▾"; }
details.cap.usado > summary.cap-h { background: linear-gradient(90deg, var(--azul), var(--azul-2)); color: #fff; }
details.cap.usado > summary.cap-h::before { color: inherit; }
details.cap .cap-cod { width: auto; min-width: 26px; font-weight: 800; text-align: left; }
details.cap .cap-tit { font-weight: 700; text-transform: uppercase; flex: 1; }
.cap-count { font-size: .82rem; opacity: .9; white-space: nowrap; }
.cap-body { padding: 10px 14px 14px; }
.cap-titulo-edit { max-width: 520px; margin-bottom: 8px; }
.lineas td.ud { width: 50px; padding-top: 14px; color: var(--muted); }
.lineas .desc-txt { display: block; padding-top: 8px; font-size: .9rem; }
.lineas input.q { width: 80px; font-weight: 700; }
.lineas tr.incluida { background: var(--accent-soft); }
.lineas tr.incluida input.q { border-color: var(--accent); }
.lineas tr.extra .desc-txt { font-style: italic; }
#capitulos.solo-usadas tr[data-linea]:not(.incluida) { display: none; }
#capitulos.solo-usadas details.cap:not(.usado) { display: none; }
@media (max-width: 1100px) {
  .of-grid { grid-template-columns: 1fr; }
  .of-aside { position: static; max-height: none; }
}
@media (max-width: 820px) {
  .lineas thead { display: none; }
  .lineas tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .lineas td { border: 0; padding: 0; }
  .lineas .col-desc { grid-column: 1 / -1; min-width: 0; }
  .lineas .num { padding-top: 0; }
  .lineas input.n, .lineas input.u { width: 100%; }
  .lineas tr { grid-template-columns: auto 1fr 1fr 1fr; align-items: center; }
  .lineas td.ud, .lineas .imp { padding-top: 0; }
  .partidas-bar { position: static; }
}


/* Panel interactivo de Inicio */
.grid-panel { grid-template-columns: 1.15fr 1fr 1fr; align-items: start; }
.grid-panel-2 { grid-template-columns: 1.6fr 1fr; align-items: start; margin-bottom: 18px; }
.agenda { list-style: none; margin: 0 0 8px; padding: 0; min-height: 120px; }
.agenda li { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 9px 8px; margin: 0 -8px; border-radius: 12px; }
.agenda li:hover { background: var(--surface-2); }
.agenda .ag-i { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font: 600 .72rem/1.1 var(--font-display); text-align: center; }
.agenda .venc .ag-i { background: var(--bad-soft); color: var(--bad); }
.agenda a { text-decoration: none; color: var(--fg); font-weight: 500; }
.agenda a:hover { color: var(--accent); }
.agenda small { display: block; color: var(--muted); }
.agenda .vacio { display: block; color: var(--muted); padding: 24px 0; text-align: center; }
.agenda .vacio:hover { background: none; }
.link-mas { font-size: .86rem; font-weight: 500; text-decoration: none; }
.hbars { display: flex; flex-direction: column; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 48%) 1fr 40px; gap: 10px; align-items: center; padding: 6px 8px; margin: 0 -8px; border-radius: 10px; color: var(--fg); text-decoration: none; font-size: .88rem; }
a.hbar:hover, a.hbar:focus-visible { background: var(--surface-2); }
.hbar-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-b { display: block; height: 12px; border-radius: 0 4px 4px 0; background: var(--grid); position: relative; }
.hbar-b i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--serie-1); width: 0; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
a.hbar:hover .hbar-b i { filter: brightness(1.12); }
.hbar-n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.leyenda { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-1 { background: var(--serie-1); } .sw-2 { background: var(--serie-2); }
.chart { position: relative; height: 260px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .eje { fill: var(--muted); font: 400 11px var(--font-body); font-variant-numeric: tabular-nums; }
.chart .rej { stroke: var(--grid); stroke-width: 1; }
.chart .c1 { fill: var(--serie-1); } .chart .c2 { fill: var(--serie-2); }
.chart .val { fill: var(--fg); font: 600 11px var(--font-body); }
.chart .zona { fill: transparent; cursor: pointer; }
.chart .zona:hover, .chart .zona:focus { fill: var(--surface-2); outline: none; }
.chart rect.c1, .chart rect.c2 { transition: y .5s cubic-bezier(.2, .8, .2, 1), height .5s cubic-bezier(.2, .8, .2, 1); }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--fg); color: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: .82rem; line-height: 1.4; box-shadow: var(--shadow-up); min-width: 140px; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.tip.on { opacity: 1; transform: none; }
.tip .tip-t { font-weight: 600; margin-bottom: 4px; opacity: .75; }
.tip .tip-f { display: flex; align-items: center; gap: 8px; }
.tip .tip-f b { font-weight: 600; min-width: 34px; }
.tip .tip-k { width: 12px; height: 2px; border-radius: 2px; }
.tabla-datos { margin-top: 8px; font-size: .86rem; }
.tabla-datos summary { cursor: pointer; color: var(--muted); }
.tabla-datos table { margin-top: 8px; }
[data-panel].cargando, .cargando { opacity: .6; }

/* Ofertas / pedidos / clientes */
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.barra { height: 6px; border-radius: 99px; background: var(--pista); overflow: hidden; margin-top: 5px; min-width: 70px; }
.barra span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--serie-1), var(--azul-2)); transition: width .6s; }
.barra-lg { height: 10px; margin: -6px 0 18px; }
.cap-res { border-top: 1px solid var(--line); padding: 10px 0; }
.cap-res summary { display: flex; justify-content: space-between; gap: 12px; cursor: pointer; }
.cap-res .feed { margin: 8px 0 0 18px; }

/* Acceso */
.auth-body { min-height: 100vh; }
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-marca { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; align-items: flex-end; padding: 56px; color: #fff; background: linear-gradient(150deg, #302D87 0%, #24226F 60%, #17164A 100%); }
.auth-marca::before { content: ""; position: absolute; right: -140px; top: -140px; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgba(234, 96, 19, .6), rgba(234, 96, 19, 0) 66%); }
.auth-marca::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: #EA6013; }
.auth-agua { position: absolute; left: -40px; top: 50%; width: 420px; transform: translateY(-50%); opacity: .07; }
.auth-marca-txt { position: relative; max-width: 460px; }
.auth-k { margin: 0 0 10px; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.auth-lema { margin: 0 0 22px; font: 700 2.1rem/1.2 var(--font-display); letter-spacing: -.02em; }
.auth-puntos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.auth-puntos li { display: flex; align-items: center; gap: 10px; color: rgba(255, 255, 255, .85); }
.auth-puntos li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #EA6013; box-shadow: 0 0 0 4px rgba(234, 96, 19, .25); }
.auth-wrap { width: min(470px, 100%); margin: auto; padding: 40px 20px; }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 26px; }
.auth-brand img { max-width: 240px; max-height: 56px; object-fit: contain; }
:root[data-theme="dark"] .auth-brand img { filter: brightness(0) invert(1); }
.auth-card { padding: 28px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card > p.muted:first-of-type { margin-top: 0; margin-bottom: 18px; }
.demo-users { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); border-radius: 99px; padding: 5px 11px; cursor: pointer; font: inherit; font-size: .82rem; transition: border-color .15s, background .15s; }
.chip:hover { border-color: var(--cta); }
.chip small { color: var(--muted); }

/* Adaptación a tablet y móvil */
@media (max-width: 1240px) {
  .grid-panel { grid-template-columns: 1fr 1fr; }
  .grid-panel > .panel-agenda { grid-column: 1 / -1; }
}
@media (max-width: 1000px) {
  .grid-side, .grid-panel-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .menu-btn { display: inline-grid; }
  .top-brand { display: block; }
  .top { padding: 8px 14px; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; z-index: 40; transform: translateX(-100%); visibility: hidden; transition: transform .22s ease, visibility .22s; }
  .side.open { transform: none; visibility: visible; box-shadow: 12px 0 40px rgba(14, 13, 45, .35); }
  .top { gap: 6px; }
  .top-brand img { height: 26px; max-width: 130px; }
  .save-state { white-space: nowrap; }
  .save-state[data-state="idle"], .save-state[data-state="ro"] { display: none; }
  .icon-btn { width: 38px; height: 38px; }
  .main { padding: 16px; }
  .grid-2, .grid-panel { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-grid-3, .form-grid-2 { grid-template-columns: 1fr; }
  .top-info .env-tag { display: none; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { margin-top: 6px; }
  .funnel a { grid-template-columns: 100px 1fr 34px; }
  .hero { padding: 22px; }
  .hero h1 { font-size: 1.5rem; }
  .auth { grid-template-columns: 1fr; }
  .auth-marca { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart { height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .side, .top, .drawer, .scrim { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; }
}

/* Código postal → población */
.cp-info { min-height: 1em; font-size: .78rem; color: var(--muted); }
.cp-info.cp-ok { color: var(--ok); }
.cp-info.cp-warn { color: var(--warn); }

/* Ofertas: contacto en la tabla */
.contacto a { display: block; white-space: nowrap; font-weight: 400; }

/* Nuevo presupuesto: elegir cliente existente o nuevo */
.eleccion { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.eleccion-op { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r); border: 2px solid var(--line); background: var(--surface); color: var(--fg); text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s, box-shadow .15s; }
.eleccion-op:hover { border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow-up); }
.eleccion-op.on { border-color: var(--cta); background: color-mix(in srgb, var(--cta-soft) 55%, var(--surface)); }
.eleccion-op strong { display: block; font: 600 1rem var(--font-display); }
.eleccion-op small { color: var(--muted); }
.eleccion-i { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.eleccion-op.on .eleccion-i { background: var(--cta); color: #fff; }
.busca-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.busca-res { margin-top: 14px; transition: opacity .15s; }
.busca-t { margin: 0 0 8px; }
.busca-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.busca-item { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; color: var(--fg); text-decoration: none; transition: border-color .15s, background .15s; }
.busca-item:hover, .busca-item:focus-visible { border-color: var(--cta); background: var(--surface-2); }
.busca-item:hover .btn { background: var(--cta); color: var(--cta-ink); border-color: var(--cta); }
.busca-datos { display: flex; flex-direction: column; min-width: 0; }
.busca-datos small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.busca-vacio { padding: 18px; border: 1px dashed var(--line-2); border-radius: 14px; text-align: center; }
.busca-vacio p { margin: 0 0 10px; }
.avatar-sm { width: 36px; height: 36px; font-size: .8rem; }
.cli-elegido { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px; margin-bottom: 16px; border-radius: 14px; background: var(--surface-2); }
.cli-elegido > div:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 200px; }
.cli-elegido .btn-row { margin-left: auto; }
.coinc { display: block; }
.coinc-t { margin: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.coinc-op { align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .55); color: var(--fg); }
:root[data-theme="dark"] .coinc-op { background: rgba(0, 0, 0, .2); }
.coinc-op input { margin-top: 3px; }
.coinc-pie { margin: 10px 0 0; color: var(--fg); opacity: .8; }
@media (max-width: 860px) {
  .eleccion { grid-template-columns: 1fr; }
  .busca-item { grid-template-columns: 36px 1fr auto; }
  .busca-n { display: none; }
}

/* Duración estimada (primer campo del presupuesto) */
.duracion-card { padding: 14px 18px; }
.duracion { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; cursor: text; }
.duracion-i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.duracion-t strong { display: block; font: 600 1rem var(--font-display); }
.duracion-t small { color: var(--muted); }
.duracion-v { display: flex; align-items: center; gap: 8px; }
.duracion-v input { width: 96px; font: 700 1.3rem var(--font-display); text-align: center; }
.duracion-v em { font-style: normal; color: var(--muted); font-size: .85rem; }
.falta-duracion { border-color: var(--cta); box-shadow: 0 0 0 3px var(--cta-soft), var(--shadow); }
.falta-duracion .duracion-i { background: var(--cta); color: #fff; }

/* Planificación de la obra (pedido) */
.planif-pend { border-color: var(--cta); box-shadow: 0 0 0 3px var(--cta-soft), var(--shadow); }
.planif-form { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 20px; align-items: start; }
.planif-lado { display: flex; flex-direction: column; gap: 10px; }
.planif-res { margin: 0; font-weight: 600; }
.pl-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pl-meses { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pl-tit { font: 600 .95rem var(--font-display); text-transform: capitalize; margin-bottom: 6px; text-align: center; }
.pl-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.pl-dn { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 600; }
.pl-dia { position: relative; aspect-ratio: 1; min-height: 32px; border: 1px solid transparent; border-radius: 9px; background: var(--surface-2); color: var(--fg); font: 500 .85rem var(--font-body); cursor: pointer; padding: 0; transition: background .12s, border-color .12s; }
.pl-dia:hover { border-color: var(--cta); }
.pl-dia.no-lab { background: transparent; color: var(--muted); }
.pl-dia.hoy { border-color: var(--accent); }
.pl-dia.rango { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.pl-dia.ini, .pl-dia.fin { background: var(--serie-1); color: #fff; }
.pl-pts { position: absolute; left: 0; right: 0; bottom: 3px; display: flex; justify-content: center; gap: 3px; }
.pl-pts i { width: 6px; height: 6px; border-radius: 50%; }
.pt-otra { background: var(--serie-2); }
.pt-visita { background: var(--ok); }
.sw-otra { background: var(--serie-2); } .sw-visita { background: var(--ok); } .sw-otro { background: var(--muted); }
.sw-libre { background: transparent; border: 1.5px dashed var(--ok); }

/* Calendario */
.cal-barra { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.cal-titulo { margin: 0 0 0 8px; font-size: 1.15rem; }
.cal-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.cal-principal { padding: 14px; overflow-x: auto; }
.cal-nota { margin: 10px 0 0; }
.cal-ley { flex-wrap: wrap; }
.mes { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.mes-dn { padding: 8px; font: 600 .74rem var(--font-display); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.mes-dia { min-height: 118px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mes-dia:nth-child(7n) { border-right: 0; }
.mes-dia.fuera { background: var(--surface-2); opacity: .55; }
.mes-dia.no-lab { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.mes-num { align-self: flex-start; display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 99px; font-weight: 600; font-size: .85rem; color: var(--fg); text-decoration: none; }
.mes-num:hover { background: var(--surface-2); }
.mes-dia.hoy .mes-num { background: var(--cta); color: #fff; }
.mes-obra, .sem-obra { display: block; padding: 2px 7px; border-radius: 6px; background: color-mix(in srgb, var(--c, var(--serie-1)) 16%, var(--surface)); border-left: 3px solid var(--c, var(--serie-1)); color: var(--fg); font-size: .74rem; font-weight: 500; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mes-ev { display: block; padding: 2px 6px; border-radius: 6px; font-size: .76rem; color: var(--fg); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--ok-soft); }
.mes-ev b { font-weight: 600; }
.mes-ev.ev-otro, .sem-ev.ev-otro, .sem-obra.ev-otro { background: var(--surface-2); border-left-color: var(--muted); --c: var(--muted); }
.ev-hecha { opacity: .55; text-decoration: line-through; }
.mes-libre { margin-top: auto; font-size: .72rem; color: var(--ok); text-decoration: none; padding: 2px 6px; border: 1px dashed color-mix(in srgb, var(--ok) 50%, transparent); border-radius: 6px; text-align: center; }
.mes-libre:hover { background: var(--ok-soft); }
.mes-libre.lleno { color: var(--muted); border-color: var(--line); }

.sem { --sem-cab: 0px; }
.sem-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.sem-grid { display: grid; grid-template-columns: 46px repeat(7, minmax(92px, 1fr)); gap: 0; min-width: 640px; }
.sem-elegir .sem-grid { grid-template-columns: 40px repeat(7, minmax(70px, 1fr)); min-width: 560px; }
.sem-horas .sem-cab-h { height: 56px; }
.sem-elegir .sem-horas .sem-cab-h { height: 50px; }
.sem-grande .sem-horas .sem-cab-h, .sem-grande .sem-cab { height: 64px; }
.sem-horas .sem-todo-h { height: 30px; font-size: .66rem; color: var(--muted); text-align: right; padding-right: 6px; line-height: 30px; }
.sem-horas .sem-cuerpo { position: relative; }
.sem-horas .sem-cuerpo span { position: absolute; right: 6px; transform: translateY(-50%); font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sem-dia { border-left: 1px solid var(--line); min-width: 0; }
.sem-dia.no-lab { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.sem-cab { height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); line-height: 1.15; }
.sem-elegir .sem-cab { height: 50px; }
.sem-dn { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sem-num { font: 600 1.05rem var(--font-display); }
.sem-dia.hoy .sem-num { color: #fff; background: var(--cta); border-radius: 99px; min-width: 28px; text-align: center; }
.sem-cab small { font-size: .66rem; color: var(--ok); }
.sem-todo { height: 30px; padding: 2px 3px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; border-bottom: 1px solid var(--line); }
.sem-todo .sem-obra { font-size: .66rem; padding: 0 5px; line-height: 1.5; }
.sem-cuerpo { position: relative; background-image: linear-gradient(var(--grid) 1px, transparent 1px); background-size: 100% 54px; }
.sem-elegir .sem-cuerpo { background-size: 100% 37.2px; }
.sem-hueco { position: absolute; left: 3px; right: 3px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 0; padding: 3px 6px; border: 1.5px dashed color-mix(in srgb, var(--ok) 60%, transparent); border-radius: 8px; background: color-mix(in srgb, var(--ok-soft) 55%, transparent); color: var(--ok); font: 500 .72rem var(--font-body); text-decoration: none; cursor: pointer; overflow: hidden; text-align: left; transition: background .12s; }
.sem-hueco:hover, .sem-hueco:focus-visible { background: var(--ok-soft); border-style: solid; }
.sem-hueco small { font-size: .66rem; opacity: .85; }
.sem-ev { position: absolute; left: 3px; right: 3px; z-index: 2; padding: 3px 6px; border-radius: 8px; background: var(--ok); color: #fff; font-size: .72rem; line-height: 1.25; text-decoration: none; overflow: hidden; box-shadow: 0 2px 6px -2px rgba(0, 0, 0, .3); }
.sem-ev.ev-otro { background: var(--muted); color: #fff; }
.sem-ev b { font-weight: 700; }
.sem-sel { position: absolute; left: 3px; right: 3px; z-index: 3; padding: 3px 6px; border-radius: 8px; border: 2px solid var(--cta); background: color-mix(in srgb, var(--cta-soft) 85%, transparent); color: var(--cta); font: 600 .72rem var(--font-body); pointer-events: none; }

/* Formularios de visita y alta de cliente */
.visita { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
.visita-campos { display: flex; flex-direction: column; gap: 10px; }
.visita-campos .form-grid { margin-bottom: 0; }
.visita-semana { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; padding: 10px; transition: opacity .15s; }
.agendar { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.agendar-op { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; }
.agendar-op strong { display: block; font: 600 1rem var(--font-display); }
.agendar-op small { color: var(--muted); }
.agendar-op:has(input:checked) { border-color: var(--cta); background: color-mix(in srgb, var(--cta-soft) 55%, var(--surface)); }
.agendar-sec { display: none; margin-top: 14px; }
.agendar:has(#agendar:checked) .agendar-sec { display: block; }
.radios-fila { flex-direction: row; gap: 18px; margin: 0 0 12px; }
@media (max-width: 1100px) {
  .visita, .planif-form, .cal-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .pl-meses { grid-template-columns: 1fr; }
  .duracion { grid-template-columns: 1fr; }
}
.pl-dia.no-lab.rango { background: transparent; color: var(--accent); font-weight: 500; }

/* Calendario interactivo: crear arrastrando, mover y cambiar duración con el ratón */
.sem-grid { min-width: 0; }
.sem-cab-l { display: flex; flex-direction: column; align-items: center; color: inherit; text-decoration: none; border-radius: 10px; padding: 2px 8px; }
.sem-cab-l:hover { background: var(--surface-2); }
.sem-dia .sem-cuerpo { cursor: crosshair; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.sem-dia.pasado .sem-cuerpo { cursor: default; background-color: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.sem-ahora { position: absolute; left: 0; right: 0; height: 2px; background: var(--cta); z-index: 4; pointer-events: none; }
.sem-ahora::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--cta); }
.sem-nuevo { position: absolute; left: 3px; right: 3px; z-index: 5; padding: 3px 6px; border-radius: 8px; border: 2px dashed var(--cta); background: color-mix(in srgb, var(--cta-soft) 80%, transparent); color: var(--cta); font: 600 .74rem var(--font-body); pointer-events: none; }
.sem-nuevo.sem-sel { border-style: solid; }
.sem-ev.movible { cursor: grab; touch-action: none; padding-bottom: 8px; }
.sem-ev.arrastrando { cursor: grabbing; z-index: 6; opacity: .92; box-shadow: 0 10px 24px -6px rgba(0, 0, 0, .45); outline: 2px solid #fff; }
.sem-ev.no-valido { background: var(--bad); }
.sem-ev.guardando, .mes-ev.guardando { opacity: .55; }
.sem-ev small { display: block; font-size: .7rem; opacity: .9; margin-top: 2px; }
.sem-rs { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.sem-rs::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 22px; height: 3px; margin-left: -11px; border-radius: 2px; background: rgba(255, 255, 255, .7); }
.sem-grande .sem-ev { font-size: .82rem; padding: 6px 10px 10px; }
.sem-grande .sem-dn { font-size: .78rem; }
.mes-cab { display: flex; justify-content: space-between; align-items: center; }
.mes-mas { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 700; opacity: 0; transition: opacity .12s, background .12s; }
.mes-dia:hover .mes-mas, .mes-mas:focus-visible { opacity: 1; }
.mes-mas:hover { background: var(--cta); color: #fff; }
.mes-ev[draggable="true"] { cursor: grab; }
.mes-ev.arrastrando { opacity: .4; }
.mes-dia.soltar { background: var(--cta-soft); outline: 2px dashed var(--cta); outline-offset: -3px; }
.sem-grande .sem-cuerpo { background-size: 100% 78px; }
.sem-horas .sem-cuerpo span:first-child { transform: translateY(2px); }

/* ===== Calendario tipo Outlook (FullCalendar) ===== */
.cal-outlook { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; align-items: start; }
.cal-lado .card { margin-bottom: 14px; }
.cal-main { padding: 12px 14px; margin-bottom: 0; }
.cal-page-h { margin-bottom: 14px; }
.fc { --fc-border-color: var(--line); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-neutral-text-color: var(--muted);
      --fc-today-bg-color: color-mix(in srgb, var(--accent-soft) 55%, transparent); --fc-now-indicator-color: var(--cta);
      --fc-highlight-color: color-mix(in srgb, var(--accent) 16%, transparent); --fc-non-business-color: color-mix(in srgb, var(--surface-2) 75%, transparent);
      --fc-event-bg-color: var(--serie-1); --fc-event-border-color: var(--serie-1); --fc-list-event-hover-bg-color: var(--surface-2);
      --fc-button-bg-color: var(--surface); --fc-button-border-color: var(--line-2); --fc-button-text-color: var(--fg);
      --fc-button-hover-bg-color: var(--surface-2); --fc-button-hover-border-color: var(--line-2);
      --fc-button-active-bg-color: var(--accent); --fc-button-active-border-color: var(--accent);
      font-family: var(--font-body); color: var(--fg); }
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.fc .fc-toolbar-title { font: 600 1.15rem var(--font-display); letter-spacing: -.01em; text-transform: capitalize; }
.fc .fc-button { font: 500 .85rem var(--font-display); border-radius: 10px; padding: 6px 12px; box-shadow: none !important; text-transform: none; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { color: var(--accent-ink); }
.fc .fc-button-group > .fc-button { border-radius: 0; }
.fc .fc-button-group > .fc-button:first-child { border-radius: 10px 0 0 10px; }
.fc .fc-button-group > .fc-button:last-child { border-radius: 0 10px 10px 0; }
.fc .fc-today-button { margin-right: 6px; }
.fc .fc-col-header-cell-cushion { font: 600 .78rem var(--font-display); text-transform: capitalize; color: var(--muted); padding: 8px 4px; text-decoration: none; }
.fc .fc-day-today .fc-col-header-cell-cushion { color: var(--cta); }
.fc a.fc-col-header-cell-cushion:hover, .fc .fc-daygrid-day-number:hover { color: var(--accent); }
.fc .fc-timegrid-slot { height: 2.1em; }
.fc .fc-timegrid-slot-minor { border-top-style: dotted; }
.fc .fc-timegrid-slot-label-cushion { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.fc .fc-daygrid-day-number { font-size: .82rem; color: var(--fg); text-decoration: none; padding: 6px 8px; }
.fc .fc-day-today .fc-daygrid-day-number { background: var(--cta); color: #fff; border-radius: 99px; min-width: 24px; text-align: center; margin: 3px; padding: 2px 6px; }
.fc .fc-day-past:not(.fc-col-header-cell) { background-image: linear-gradient(color-mix(in srgb, var(--surface-2) 45%, transparent), color-mix(in srgb, var(--surface-2) 45%, transparent)); }
.fc .fc-timegrid-now-indicator-line { border-width: 2px 0 0; }
.fc .fc-highlight { border-radius: 6px; }
/* Eventos: relleno suave y borde izquierdo de color, como Outlook */
.fc .fc-timegrid-event, .fc .fc-daygrid-block-event { border-radius: 6px; border-width: 0 0 0 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.fc .ev-visita { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); border-left-color: var(--ok) !important; }
.fc .ev-otro { background: color-mix(in srgb, var(--muted) 18%, var(--surface)); border-left-color: var(--muted) !important; }
.fc .ev-visita .fc-event-main, .fc .ev-otro .fc-event-main { color: var(--fg); }
.fc .fc-event-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.fc .fc-event-title { font-weight: 500; }
.fc .ev-hecha { opacity: .5; }
.fc .ev-hecha .fc-event-title { text-decoration: line-through; }
.fc .ev-obra { border-left-width: 0; color: #fff; }
.fc .ev-obra .fc-event-main { color: #fff; font-weight: 500; }
.fc .ev-sel { background: color-mix(in srgb, var(--cta) 22%, var(--surface)); border-left-color: var(--cta) !important; border-left-width: 4px; }
.fc .ev-sel .fc-event-main { color: var(--fg); font-weight: 600; }
.fc .ev-ajeno { opacity: .55; }
.fc .ev-festivo { background: repeating-linear-gradient(135deg, var(--warn-soft) 0 6px, transparent 6px 12px); opacity: .8; }
.fc .fc-event-mirror { opacity: .85; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .45); }
.fc .fc-event.fc-event-dragging { box-shadow: 0 12px 28px -8px rgba(0, 0, 0, .5); }
.fc .fc-daygrid-dot-event .fc-daygrid-event-dot { border-color: var(--ok); }
.fc .fc-daygrid-dot-event.ev-otro .fc-daygrid-event-dot { border-color: var(--muted); }
.fc .fc-daygrid-dot-event { background: transparent; border: 0; }
.fc .fc-daygrid-dot-event.ev-visita, .fc .fc-daygrid-dot-event.ev-otro { background: transparent; }
.fc .fc-daygrid-dot-event .fc-event-title, .fc .fc-daygrid-dot-event .fc-event-time { color: var(--fg); }
.fc .fc-daygrid-more-link { font-size: .75rem; font-weight: 600; color: var(--accent); }
.fc .fc-list-event-dot { border-color: var(--ok); }
.fc .fc-list-day-cushion { background: var(--surface-2); }
.fc .fc-timegrid-event .fc-event-resizer, .fc .fc-event-resizer { height: 8px; }
.fc-theme-standard .fc-scrollgrid { border-radius: 10px; overflow: hidden; }
/* Mini calendario */
.cal-mini-card { padding: 12px; }
.cal-mini .fc-toolbar.fc-header-toolbar { margin-bottom: 6px; }
.cal-mini .fc-toolbar-title { font-size: .95rem; }
.cal-mini .fc-button { padding: 2px 8px; font-size: .8rem; }
.cal-mini .fc-scrollgrid, .cal-mini .fc-scrollgrid td, .cal-mini .fc-scrollgrid th { border: 0 !important; }
.cal-mini .fc-col-header-cell-cushion { font-size: .7rem; padding: 2px; }
.cal-mini .fc-daygrid-day-frame { min-height: 0 !important; cursor: pointer; display: flex; justify-content: center; }
.cal-mini .fc-daygrid-day-top { justify-content: center; }
.cal-mini .fc-daygrid-day-number { font-size: .78rem; padding: 3px 0; width: 28px; text-align: center; border-radius: 8px; }
.cal-mini .fc-daygrid-day-events, .cal-mini .fc-daygrid-day-bg { display: none; }
.cal-mini .fc-day-past { background-image: none !important; }
.cal-mini .fc-day-other .fc-daygrid-day-number { color: var(--muted); opacity: .6; }
.cal-mini .en-vista .fc-daygrid-day-number { background: var(--accent-soft); color: var(--accent); }
.cal-mini .fc-daygrid-day:hover .fc-daygrid-day-number { background: var(--surface-2); }
.cal-mini .fc-day-today .fc-daygrid-day-number { background: var(--cta); color: #fff; margin: 0; padding: 3px 0; }
/* Tarjetas flotantes */
.cal-pop { position: fixed; z-index: 60; width: 340px; max-width: calc(100vw - 20px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: 0 18px 50px -12px rgba(14, 13, 45, .45); animation: entrar .15s ease; }
.cal-pop[hidden] { display: none; }
.cal-pop form { display: flex; flex-direction: column; gap: 10px; }
.cal-pop input { min-height: 38px; padding: 7px 10px; }
.cal-pop-h { display: flex; align-items: center; gap: 8px; }
.cal-pop-h strong { flex: 1; font: 600 .98rem var(--font-display); text-transform: capitalize; }
.cal-pop-h .icon-btn { width: 32px; height: 32px; }
.cal-pop-tipo { align-self: flex-start; }
.cal-pop-res { list-style: none; margin: 4px 0 0; padding: 0; max-height: 190px; overflow-y: auto; }
.cal-pop-res button { width: 100%; text-align: left; display: flex; flex-direction: column; border: 0; background: transparent; color: var(--fg); padding: 7px 8px; border-radius: 8px; cursor: pointer; font: inherit; }
.cal-pop-res button:hover, .cal-pop-res button:focus-visible { background: var(--surface-2); }
.cal-pop-res small { color: var(--muted); font-size: .76rem; }
.cal-pop-res .vacio { color: var(--muted); font-size: .82rem; padding: 6px 8px; }
.cal-pop-cli { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.cal-pop-nuevo { display: flex; flex-direction: column; gap: 8px; }
.cal-pop-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cal-pop-hora { display: flex; align-items: center; gap: 10px; font-size: .84rem; color: var(--muted); }
.cal-pop-hora input { width: 120px; }
.btn-link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 4px 0; font: 500 .84rem var(--font-body); display: inline-flex; align-items: center; gap: 4px; }
.cal-pop-coinc { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; font-size: .84rem; }
.cal-pop-coinc p { margin: 0; font-weight: 600; }
.cal-pop-coinc .btn { justify-content: flex-start; background: var(--surface); }
.cal-pop-err { margin: 0; }
.cal-pop-acc { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.cal-pop-ev .cal-pop-acc { justify-content: flex-start; margin-top: 10px; }
.cal-pop-color { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.cal-pop-color.c-visita { background: var(--ok); } .cal-pop-color.c-otro { background: var(--muted); }
.cal-pop-cuando { margin: 6px 0 8px; color: var(--muted); font-size: .88rem; text-transform: capitalize; }
.cal-pop-dl { display: grid; grid-template-columns: 82px 1fr; gap: 4px 10px; margin: 0; font-size: .86rem; }
.cal-pop-dl dt { color: var(--muted); }
.cal-pop-dl dd { margin: 0; overflow-wrap: anywhere; }
.cal-pop-cancel { display: flex; gap: 6px; margin-top: 10px; }
.cal-toast { position: fixed; z-index: 70; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow-up); font-size: .9rem; max-width: calc(100vw - 32px); animation: entrar .2s ease; }
.cal-toast.malo { background: var(--bad); color: #fff; }
.cal-toast[hidden] { display: none; }
.visita-cal { min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.visita-cal .fc .fc-toolbar-title { font-size: .95rem; }
@media (max-width: 1100px) { .cal-outlook { grid-template-columns: 1fr; } .cal-lado { order: 2; } }
@media (max-width: 700px) { .fc .fc-toolbar.fc-header-toolbar { flex-direction: column; align-items: stretch; } .fc .fc-toolbar-chunk { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; } }
.cal-pop [hidden] { display: none !important; }
.fc .fc-toolbar-title { text-transform: none; }
.fc .fc-toolbar-title::first-letter { text-transform: uppercase; }
.fc .fc-timegrid-axis-cushion { font-size: .68rem; color: var(--muted); }
