/* Sistema MASEIN · interfaz. Layout: barra lateral fija + área de trabajo con retícula de plano técnico. */
@font-face { font-family: "Clash Display"; src: url("fonts/ClashDisplay-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
:root {
  --azul: #0B5396; --verde: #0A8941; --rojo: #C4352B; --ambar: #D98E04; --morado: #7B4FC9;
  --bg: #F1F4F7; --surface: #FFFFFF; --surface-2: #E8EDF2; --surface-3: #DCE4EC;
  --fg: #0B1A2B; --muted: #55677D; --line: rgba(11, 83, 150, .14); --grid: rgba(11, 83, 150, .045);
  --accent: #0B5396; --accent-2: #0A8941; --side: #0B2A4A; --side-fg: #E6EEF6; --side-muted: #9DB3CB; --side-active: rgba(255,255,255,.1);
  --ok-bg: #E3F4EA; --ok-fg: #08703A; --warn-bg: #FFF1D6; --warn-fg: #8A5A00; --danger-bg: #FBE5E3; --danger-fg: #A3271E; --info-bg: #E2EEFA; --info-fg: #0B5396;
  --shadow: 0 18px 50px -24px rgba(11, 40, 75, .35); --shadow-sm: 0 1px 2px rgba(11, 40, 75, .08), 0 2px 8px -4px rgba(11, 40, 75, .12);
  --f-display: "Clash Display", "Arial Black", Arial, sans-serif; --f-body: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 14px; --side-w: 248px; color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #07121D; --surface: #0E1E2E; --surface-2: #142839; --surface-3: #1C3348;
  --fg: #E6EEF6; --muted: #93A7BD; --line: rgba(120, 170, 225, .16); --grid: rgba(120, 170, 225, .04);
  --accent: #6AAEF0; --accent-2: #34C274; --side: #050E17; --side-fg: #E6EEF6; --side-muted: #8AA0B8; --side-active: rgba(106,174,240,.12);
  --ok-bg: rgba(52,194,116,.14); --ok-fg: #5BD993; --warn-bg: rgba(232,163,23,.15); --warn-fg: #F2C062; --danger-bg: rgba(228,84,72,.16); --danger-fg: #FF8A80; --info-bg: rgba(106,174,240,.14); --info-fg: #8CC2F5;
  --shadow: 0 18px 50px -24px rgba(0,0,0,.8); --shadow-sm: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 500 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 200; }
.skip:focus { top: 8px; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.mono { font-family: var(--f-mono); }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- Iconos (máscaras SVG) ---------- */
.i { display: inline-block; width: 20px; height: 20px; background: currentColor; flex: none; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.i-menu { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h16'/%3E%3C/svg%3E"); }
.i-plus { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.i-bell { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.9 1.9 0 0 0 3.4 0'/%3E%3C/svg%3E"); }
.i-moon { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z'/%3E%3C/svg%3E"); }
.i-sun { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E"); }
.i-home { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 10.5 12 3l9 7.5V21h-6v-6H9v6H3z'/%3E%3C/svg%3E"); }
.i-users { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='8' r='4'/%3E%3Cpath d='M2 21a7 7 0 0 1 14 0M16 4a4 4 0 0 1 0 8M22 21a6 6 0 0 0-4-5.6'/%3E%3C/svg%3E"); }
.i-cal { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.i-doc { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 2h9l5 5v15H6z'/%3E%3Cpath d='M14 2v6h6M9 13h8M9 17h6'/%3E%3C/svg%3E"); }
.i-cash { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='2' y='6' width='20' height='12' rx='2'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M6 9v.01M18 15v.01'/%3E%3C/svg%3E"); }
.i-hammer { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 21l9-9M14 4l6 6-3 3-6-6zM11 7l3-3'/%3E%3C/svg%3E"); }
.i-snow { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 2v20M4.9 7l14.2 10M4.9 17 19.1 7M9 4l3 3 3-3M9 20l3-3 3 3'/%3E%3C/svg%3E"); }
.i-box { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 7.5 12 3l9 4.5v9L12 21l-9-4.5z'/%3E%3Cpath d='M3 7.5 12 12l9-4.5M12 12v9'/%3E%3C/svg%3E"); }
.i-hardhat { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 18h18M5 18v-3a7 7 0 0 1 14 0v3M10 8V5h4v3'/%3E%3C/svg%3E"); }
.i-check { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='17' rx='2'/%3E%3Cpath d='m8 13 3 3 5-6M8 2v4M16 2v4'/%3E%3C/svg%3E"); }
.i-pay { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 4h16v16H4zM8 9h8M8 13h8M8 17h5'/%3E%3C/svg%3E"); }
.i-chart { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 20V10M10 20V4M16 20v-7M22 20H2'/%3E%3C/svg%3E"); }
.i-print { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M6 9V3h12v6M6 18H4v-7h16v7h-2M6 14h12v7H6z'/%3E%3C/svg%3E"); }
.i-gear { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z'/%3E%3C/svg%3E"); }
.i-wa { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M20 12a8 8 0 0 1-11.6 7.1L4 20l1-4.2A8 8 0 1 1 20 12z'/%3E%3C/svg%3E"); }
.i-x { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E"); }
.i-left { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 6-6 6 6 6'/%3E%3C/svg%3E"); }
.i-right { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E"); }
.i-edit { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16z'/%3E%3C/svg%3E"); }
.i-trash { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3'/%3E%3C/svg%3E"); }

/* ---------- Pantallas de acceso ---------- */
body.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 40px 40px; }
.auth__card { width: min(420px, 100%); background: var(--surface); border-radius: 22px; padding: 32px 28px; box-shadow: var(--shadow); border: 1px solid var(--line); display: grid; gap: 14px; position: relative; overflow: hidden; }
.auth__card::before { content: ""; position: absolute; right: -90px; top: -90px; width: 220px; height: 220px; border-radius: 50%; border: 18px solid var(--azul); border-bottom-color: var(--verde); border-left-color: var(--verde); opacity: .12; }
.auth__logo { width: 150px; }
.auth h1 { font: 700 1.6rem/1.05 var(--f-display); text-transform: uppercase; margin: 6px 0 4px; }
.auth__form { display: grid; gap: 8px; }
.auth__form label { font: 500 .72rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 8px; }
.auth__form input { padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); }
.auth__form input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 18%, transparent); }
.auth__form .btn { margin-top: 14px; justify-content: center; }
.auth__err { background: var(--danger-bg); color: var(--danger-fg); padding: 12px 14px; border-radius: 12px; margin: 0; font-weight: 700; }
.auth__ok { background: var(--ok-bg); color: var(--ok-fg); padding: 12px 14px; border-radius: 12px; margin: 0; font-weight: 700; }
.auth__link { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 6px; }
.auth__foot { font-size: .8rem; color: var(--muted); margin: 8px 0 0; }

/* ---------- Botones y controles ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 0; cursor: pointer; font-weight: 800; font-size: .92rem; text-decoration: none; background: var(--surface-2); color: var(--fg); transition: background .2s, transform .15s, box-shadow .2s; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--verde); color: #fff; }
.btn--primary:hover { background: #087535; }
.btn--blue { background: var(--azul); color: #fff; }
.btn--blue:hover { background: #094579; }
.btn--danger { background: var(--danger-bg); color: var(--danger-fg); }
.btn--ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: .84rem; border-radius: 8px; }
.btn .i { width: 18px; height: 18px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--fg); display: grid; place-items: center; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .dot { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rojo); color: #fff; font: 800 .68rem/18px var(--f-body); }
.row-acts { display: flex; gap: 4px; justify-content: flex-end; }
.row-acts .icon-btn { width: 32px; height: 32px; }
.row-acts .i { width: 16px; height: 16px; }

/* ---------- Estructura de la app ---------- */
body.app { display: flex; min-height: 100%; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: var(--side-fg); display: flex; flex-direction: column; z-index: 40; transition: transform .3s ease; }
.side__brand { padding: 18px 20px 10px; }
.side__brand img { width: 128px; height: auto; }
.side__brand .logo-light { filter: brightness(0) invert(1); }
.side__nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.side__group { font: 500 .66rem/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--side-muted); padding: 16px 12px 8px; }
.side__nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--side-fg); text-decoration: none; font-weight: 700; font-size: .92rem; opacity: .86; }
.side__nav a:hover { background: var(--side-active); opacity: 1; }
.side__nav a.on { background: var(--side-active); opacity: 1; box-shadow: inset 3px 0 0 #34C274; }
.side__nav a .i { width: 19px; height: 19px; }
.side__nav a .badge-n { margin-left: auto; background: var(--rojo); color: #fff; font-size: .7rem; border-radius: 9px; padding: 1px 7px; }
.side__foot { border-top: 1px solid rgba(255,255,255,.08); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side__user { font-size: .85rem; color: var(--side-muted); overflow: hidden; text-overflow: ellipsis; }
.side__foot .btn { color: var(--side-fg); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18); }
.scrim { position: fixed; inset: 0; background: rgba(3, 12, 22, .5); z-index: 35; }
.main { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; min-height: 100vh;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 40px 40px; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top__menu { display: none; }
.top__title { font: 700 1.35rem/1 var(--f-display); text-transform: uppercase; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top__search { margin-left: auto; position: relative; width: min(380px, 40vw); }
.top__search input { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; padding: 6px; z-index: 50; }
.search-results a { display: grid; grid-template-columns: 90px 1fr; gap: 8px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--fg); }
.search-results a:hover, .search-results a:focus { background: var(--surface-2); }
.search-results .t { font: 500 .68rem/1.6 var(--f-mono); text-transform: uppercase; color: var(--muted); }
.top__acts { display: flex; gap: 4px; }
.view { padding: 24px; flex: 1; outline: none; }
.loading { padding: 40px; color: var(--muted); }
@media (max-width: 960px) {
  .side { transform: translateX(-100%); }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .main { margin-left: 0; }
  .top__menu { display: grid; }
  .top { padding: 10px 14px; }
  .top__search { width: auto; flex: 1; }
  .view { padding: 16px 14px 90px; }
}
@media (max-width: 600px) { .top__title { display: none; } }

/* ---------- Bloques comunes ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.page-head h2 { font: 700 clamp(1.4rem, 2.6vw, 2rem)/1 var(--f-display); text-transform: uppercase; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-sm); min-width: 0; }
.card h3 { font: 800 1rem/1.2 var(--f-body); margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 small { font: 500 .72rem var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .g2, .g3, .g-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .g4 { grid-template-columns: minmax(0, 1fr); } }
.kpi { display: grid; gap: 6px; position: relative; overflow: hidden; }
.kpi__label { font: 500 .7rem/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kpi__val { font: 700 1.75rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.kpi__sub { font-size: .85rem; color: var(--muted); }
.kpi::after { content: ""; position: absolute; right: -26px; top: -26px; width: 80px; height: 80px; border-radius: 50%; border: 8px solid var(--k, var(--azul)); opacity: .1; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 800; white-space: nowrap; background: var(--surface-2); color: var(--fg); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.b-ok { background: var(--ok-bg); color: var(--ok-fg); } .b-warn { background: var(--warn-bg); color: var(--warn-fg); } .b-danger { background: var(--danger-bg); color: var(--danger-fg); } .b-info { background: var(--info-bg); color: var(--info-fg); } .b-muted { color: var(--muted); }
.bar { height: 8px; background: var(--surface-2); border-radius: 8px; overflow: hidden; position: relative; min-width: 60px; }
.bar > i { display: block; height: 100%; border-radius: 8px; background: var(--verde); }
.bar--time > i { background: var(--azul); opacity: .55; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.bar-row b { font-variant-numeric: tabular-nums; font-size: .85rem; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty strong { color: var(--fg); font-size: 1.05rem; }
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.list-item { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; text-decoration: none; color: var(--fg); }
.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.alert-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--fg); font-size: .9rem; }
.alert-item:hover { background: var(--surface-2); }
.alert-item i { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--azul); }
.alert-item.danger i { background: var(--rojo); } .alert-item.warn i { background: var(--ambar); }

/* ---------- Tablas ---------- */
.tbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.tbar input[type=search], .tbar select, .tbar input[type=date] { padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); min-width: 0; }
.tbar input[type=search] { flex: 1 1 220px; }
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t th { text-align: left; font: 500 .7rem/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; white-space: nowrap; cursor: default; }
.t th[data-sort] { cursor: pointer; }
.t th[data-sort]:hover { color: var(--fg); }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--surface-2); }
.t tfoot td { font-weight: 800; border-top: 2px solid var(--line); background: var(--surface-2); }
.t .strong { font-weight: 800; }
.t .wrap { white-space: normal; min-width: 180px; }
.count { font-size: .85rem; color: var(--muted); margin-top: 8px; }

/* ---------- Formularios y modales ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(3, 12, 22, .55); animation: fade .15s; }
.modal__box { width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); border: 1px solid var(--line); animation: pop .2s ease; }
.modal__box.wide { width: min(980px, 100%); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal__head h2 { font: 700 1.2rem/1.1 var(--f-display); text-transform: uppercase; margin: 0; }
.modal__body { padding: 18px 20px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .lbl { font: 500 .7rem/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.field input, .field select, .field textarea, .inp { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); min-width: 0; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 16%, transparent); }
.field input[type=color] { padding: 4px; height: 42px; }
.field input[type=range] { padding: 0; accent-color: var(--verde); }
.field .req { color: var(--rojo); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.check input { width: 18px; height: 18px; accent-color: var(--verde); }
.form-err { background: var(--danger-bg); color: var(--danger-fg); padding: 10px 12px; border-radius: 10px; font-weight: 700; margin-bottom: 12px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: .86rem; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 800; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--fg); border-bottom-color: var(--verde); }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 120; display: grid; gap: 8px; }
.toast { background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 700; max-width: 360px; animation: pop .2s; }
.toast.err { background: var(--rojo); color: #fff; }

/* ---------- Embudo (kanban) ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kcol { background: var(--surface-2); border-radius: var(--r); padding: 10px; display: grid; gap: 8px; align-content: start; min-height: 200px; border-top: 4px solid var(--c, var(--azul)); }
.kcol.over { outline: 2px dashed var(--c); outline-offset: -4px; }
.kcol__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 4px 6px; }
.kcol__head b { font-weight: 800; }
.kcol__head span { font: 500 .74rem var(--f-mono); color: var(--muted); }
.kcard { background: var(--surface); border-radius: 12px; padding: 12px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); display: grid; gap: 6px; cursor: grab; touch-action: none; user-select: none; }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .4; }
.kcard__name { font-weight: 800; line-height: 1.25; }
.kcard__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .8rem; color: var(--muted); }
.kcard__val { font-weight: 800; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.kcard__foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.kcard select { font-size: .78rem; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); max-width: 60%; }
.ghost-card { position: fixed; pointer-events: none; z-index: 150; transform: rotate(2deg); box-shadow: var(--shadow); }
.prio-alta { color: var(--danger-fg); } .prio-media { color: var(--warn-fg); } .prio-baja { color: var(--muted); }

/* ---------- Proyectos ---------- */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.pcard { display: grid; gap: 12px; text-decoration: none; color: var(--fg); transition: transform .2s, box-shadow .2s; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pcard__top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pcard__name { font: 800 1.05rem/1.25 var(--f-body); }
.pcard__code { font: 500 .72rem var(--f-mono); color: var(--muted); }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--verde) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; font: 700 .95rem var(--f-display); }
.ring.lg { width: 120px; height: 120px; } .ring.lg::before { inset: 12px; } .ring.lg b { font-size: 1.6rem; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric { background: var(--surface-2); border-radius: 10px; padding: 10px; display: grid; gap: 2px; min-width: 0; }
.metric span { font: 500 .64rem/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.metric b { font-variant-numeric: tabular-nums; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 74px 18px 1fr; gap: 10px; }
.tl__d { font: 500 .74rem/1.6 var(--f-mono); color: var(--muted); text-align: right; padding-top: 2px; }
.tl__dot { position: relative; } .tl__dot::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--line); } .tl__dot::after { content: ""; position: absolute; left: 3px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--verde); border: 2px solid var(--surface); }
.tl__b { padding-bottom: 16px; min-width: 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { border-radius: 12px; overflow: hidden; background: var(--surface-2); position: relative; aspect-ratio: 4 / 3; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px; font-size: .75rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.photo button { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.55); color: #fff; }
.health-ok { color: var(--ok-fg); } .health-risk { color: var(--warn-fg); } .health-late { color: var(--danger-fg); }

/* ---------- Asistencia semanal ---------- */
.att-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
table.att { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 900px; }
.att th, .att td { border-bottom: 1px solid var(--line); padding: 8px; }
.att thead th { font: 500 .7rem/1.3 var(--f-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; background: var(--surface); }
.att thead th.today { color: var(--accent-2); }
.att thead th b { display: block; font: 700 1.1rem var(--f-display); color: var(--fg); }
.att td.wname { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 190px; border-right: 1px solid var(--line); }
.att td.wname b { display: block; }
.att td.wname span { font-size: .78rem; color: var(--muted); }
.att td.sum { text-align: center; font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.cell { width: 100%; min-height: 66px; border-radius: 10px; border: 1.5px dashed var(--line); background: transparent; cursor: pointer; display: grid; align-content: center; justify-items: center; gap: 2px; padding: 6px 4px; font-size: .74rem; font-weight: 800; color: var(--muted); transition: transform .12s; }
.cell:hover { transform: scale(1.03); border-color: var(--accent); }
.cell .st { font-size: .8rem; }
.cell .ln { font-size: .68rem; opacity: .9; }
.cell .ds { font-weight: 600; font-size: .66rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.cell.s-presente.l-1 { background: #0A8941; color: #fff; border: 0; }
.cell.s-presente.l-0 { background: #0B5396; color: #fff; border: 0; }
.cell.s-medio { background: #E8A317; color: #241600; border: 0; }
.cell.s-falta { background: #C4352B; color: #fff; border: 0; }
.cell.s-permiso { background: #8A9BB0; color: #fff; border: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .82rem; color: var(--muted); margin: 10px 0 0; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }

/* ---------- Agenda ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-head h3 { font: 700 1.3rem var(--f-display); text-transform: uppercase; margin: 0 8px; min-width: 180px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--line); gap: 1px; }
.cal__dow { background: var(--surface); padding: 8px; font: 500 .7rem var(--f-mono); text-transform: uppercase; color: var(--muted); text-align: center; }
.cal__day { background: var(--surface); min-height: 112px; padding: 6px; display: grid; align-content: start; gap: 3px; cursor: pointer; min-width: 0; }
.cal__day:hover { background: var(--surface-2); }
.cal__day.other { background: var(--bg); color: var(--muted); }
.cal__day.today .cal__n { background: var(--verde); color: #fff; }
.cal__n { font: 700 .85rem var(--f-display); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.ev { font-size: .74rem; font-weight: 700; padding: 3px 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--info-bg); color: var(--info-fg); border-left: 3px solid var(--azul); }
.ev.k-mantenimiento { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--verde); }
.ev.k-instalacion { background: rgba(123,79,201,.12); color: var(--morado); border-color: var(--morado); }
.ev.st-por_confirmar { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--ambar); }
.ev.st-cancelada { text-decoration: line-through; opacity: .6; }
.ev.st-realizada { opacity: .65; }
.ev.dl { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--rojo); }
.ev.mt { background: transparent; border: 1px dashed var(--verde); color: var(--ok-fg); }
@media (max-width: 700px) { .cal__day { min-height: 64px; } .ev { font-size: 0; height: 6px; padding: 0; border-left-width: 0; } .cal__dow { font-size: .6rem; padding: 6px 2px; } }

/* ---------- Documentos (cotización / factura) ---------- */
.items { width: 100%; border-collapse: collapse; }
.items th { font: 500 .68rem var(--f-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.items td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.items input { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--bg); }
.items td.num input { text-align: right; }
.totals { display: grid; gap: 6px; justify-items: end; margin-top: 12px; }
.totals div { display: grid; grid-template-columns: 180px 160px; gap: 10px; align-items: center; }
.totals span { color: var(--muted); text-align: right; }
.totals b { text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand b { font: 700 1.4rem var(--f-display); color: var(--accent-2); }
.totals input { width: 100%; padding: 6px 8px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--bg); text-align: right; }
.paybox { display: grid; gap: 10px; }
.payprog { height: 14px; border-radius: 8px; background: var(--surface-2); position: relative; overflow: hidden; }
.payprog i { position: absolute; inset: 0 auto 0 0; background: var(--verde); border-radius: 8px; }
.payprog em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--fg); opacity: .6; }

/* ---------- Gráficos ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 500 11px var(--f-mono); }
.chart .gridl { stroke: var(--line); }
.chart .b-in { fill: var(--verde); } .chart .b-out { fill: var(--azul); opacity: .75; }
.legend-inline { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
.legend-inline i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.funnel { display: grid; gap: 8px; }
.funnel__row { display: grid; grid-template-columns: 130px 1fr 90px; gap: 10px; align-items: center; font-size: .86rem; }
.funnel__bar { height: 24px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.funnel__bar i { display: block; height: 100%; border-radius: 6px; min-width: 2px; }

/* ---------- Reportes ---------- */
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.rep { display: grid; gap: 10px; align-content: start; }
.rep h3 { margin: 0; }
.rep p { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---------- Impresión / PDF ---------- */
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block !important; }
  body.printing { background: #fff !important; color: #0B1A2B !important; display: block; font-size: 11pt; }
}
.pr { color: #0B1A2B; font-family: var(--f-body); }
.pr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 3px solid #0B5396; padding-bottom: 12px; margin-bottom: 14px; }
.pr-head img { width: 150px; }
.pr-co { text-align: right; font-size: 9pt; line-height: 1.45; color: #33475C; }
.pr-co b { color: #0B1A2B; font-size: 10.5pt; }
.pr-title { font: 700 18pt/1.05 var(--f-display); text-transform: uppercase; color: #0B5396; margin: 0 0 4px; }
.pr-sub { color: #55677D; font-size: 9.5pt; margin: 0 0 12px; }
.pr table { width: 100%; border-collapse: collapse; font-size: 9pt; margin: 8px 0 14px; page-break-inside: auto; }
.pr th { background: #0B5396; color: #fff; text-align: left; padding: 6px 7px; font-weight: 700; font-size: 8pt; text-transform: uppercase; letter-spacing: .03em; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pr td { padding: 5px 7px; border-bottom: 1px solid #D5DEE8; vertical-align: top; }
.pr tr { page-break-inside: avoid; }
.pr tfoot td { font-weight: 800; background: #EEF3F8; border-top: 2px solid #0B5396; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pr .num { text-align: right; white-space: nowrap; }
.pr-boxes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 14px; }
.pr-box { border: 1px solid #D5DEE8; border-radius: 6px; padding: 8px; }
.pr-box span { display: block; font-size: 7.5pt; text-transform: uppercase; color: #55677D; letter-spacing: .05em; }
.pr-box b { font-size: 12pt; }
.pr-foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid #D5DEE8; font-size: 8pt; color: #55677D; display: flex; justify-content: space-between; }
.pr h4 { font: 800 10.5pt var(--f-body); margin: 14px 0 4px; color: #0B5396; text-transform: uppercase; letter-spacing: .03em; }
.pr-doc-meta { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-bottom: 10px; font-size: 9.5pt; }
.pr-doc-meta .bx { border: 1px solid #D5DEE8; border-radius: 6px; padding: 10px; }
.pr-doc-meta .bx span { display: block; font-size: 7.5pt; text-transform: uppercase; color: #55677D; margin-bottom: 2px; }
.pr-tot { margin-left: auto; width: 280px; font-size: 10pt; }
.pr-tot div { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #E4EAF1; }
.pr-tot .g { font-size: 13pt; font-weight: 800; color: #0A8941; border-bottom: 2px solid #0A8941; }
.pr-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; margin-top: 50px; font-size: 9pt; text-align: center; }
.pr-sign div { border-top: 1px solid #0B1A2B; padding-top: 6px; }
.pr .c-p1 { background: #DFF2E7; } .pr .c-p0 { background: #DCE8F6; } .pr .c-m { background: #FCEBC6; } .pr .c-f { background: #F7D6D3; } .pr .c-x { background: #E6EAF0; }
.pr td.att-c { text-align: center; font-size: 8pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.list-item > .badge, .list-item > .btn, .list-item > .icon-btn, .list-item > b.num { flex-shrink: 0; }
.card, .grid > * { min-width: 0; }
.acts { flex-wrap: wrap; }
table.att { table-layout: fixed; }
.att thead th:first-child { width: 200px; }
.att thead th:nth-last-child(-n+2) { width: 84px; }
.att .cell { width: 100%; overflow: hidden; }
.att .cell .ds { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 100%; }
.pr, .pr * { box-sizing: border-box; }
.pr-doc-meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
