/* =========================================================
   PROWIK OS · Sistema de diseño
   Verde PROWIK como color corporativo · oscuro por defecto
   ========================================================= */
:root {
  --g300: #86EFAC; --g400: #4ADE80; --g500: #22C55E; --g600: #16A34A; --g700: #15803D; --g800: #0F5C2E;
  --bg: #0C1713;
  --bg-2: #0F1D18;
  --surface: #12211B;
  --surface-2: #172A22;
  --surface-3: #1D3329;
  --line: rgba(190, 255, 215, .085);
  --line-2: rgba(190, 255, 215, .14);
  --ink: #ECF6F0;
  --ink-2: #A9BDB2;
  --ink-3: #6F877A;
  --accent: var(--g500);
  --accent-ink: #062611;
  --accent-soft: rgba(34, 197, 94, .12);
  --amber: #E8B44C; --amber-soft: rgba(232, 180, 76, .13);
  --red: #F07167; --red-soft: rgba(240, 113, 103, .13);
  --teal: #4FD1C5; --teal-soft: rgba(79, 209, 197, .12);
  --violet: #B49CF5; --violet-soft: rgba(180, 156, 245, .13);
  --lime: #BEF264; --lime-soft: rgba(190, 242, 100, .12);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -12px rgba(0,0,0,.55);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.7);
  --r: 14px; --r-sm: 10px; --r-lg: 20px;
  --font: 'Geist', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #EAF7EE; --bg-2: #E1F2E7;
  --surface: #FFFFFF; --surface-2: #F5FBF7; --surface-3: #EAF5EE;
  --line: rgba(12, 40, 25, .08); --line-2: rgba(12, 40, 25, .14);
  --ink: #0C1713; --ink-2: #44594D; --ink-3: #7C9086;
  --accent: var(--g600); --accent-ink: #FFFFFF; --accent-soft: rgba(22, 163, 74, .1);
  --amber: #B7791F; --amber-soft: rgba(183, 121, 31, .1);
  --red: #C24135; --red-soft: rgba(194, 65, 53, .09);
  --teal: #0F8A80; --teal-soft: rgba(15, 138, 128, .1);
  --violet: #6D4FD1; --violet-soft: rgba(109, 79, 209, .09);
  --lime: #4D7C0F; --lime-soft: rgba(77, 124, 15, .1);
  --shadow: 0 1px 2px rgba(12, 40, 25, .05), 0 8px 24px -14px rgba(12, 40, 25, .25);
  --shadow-lg: 0 30px 70px -24px rgba(12, 40, 25, .35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: 'ss01', 'cv11'; letter-spacing: -.005em;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.ic { flex: none; display: inline-block; vertical-align: -3px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; font-weight: 600; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--g500); outline-offset: 2px; border-radius: 6px; }

/* ---------- Logo ---------- */
.logo { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.02em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(145deg, #2BD66A, #0F7A35); box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset, 0 6px 18px -6px rgba(34,197,94,.6); }
.logo-mark svg { width: 17px; height: 17px; }
.logo small { font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--g400); background: var(--accent-soft); padding: 2px 6px; border-radius: 6px; letter-spacing: .04em; }
:root[data-theme="light"] .logo small { color: var(--g700); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); font-weight: 520; font-size: 13.5px; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 600; box-shadow: 0 6px 18px -8px rgba(34,197,94,.55); }
.btn-primary:hover { background: var(--g400); }
:root[data-theme="light"] .btn-primary:hover { background: var(--g700); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: transparent; }
.btn-danger:hover { background: var(--red-soft); filter: brightness(1.15); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; position: relative; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .dot-badge { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--g500); box-shadow: 0 0 0 2px var(--bg); }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.input, select.input, textarea.input { height: 40px; width: 100%; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--g600); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--g600); width: 16px; height: 16px; }
.hint { font-size: 12px; color: var(--ink-3); }
.warn-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: 13px; margin-bottom: 14px; }
.info-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink-2); font-size: 13px; margin-bottom: 14px; border: 1px solid var(--line); }
.info-box .ic, .warn-box .ic { margin-top: 2px; }
.info-box .ic { color: var(--g500); }
.danger-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--red-soft); color: var(--ink); font-size: 13px; margin-bottom: 14px; }
.danger-box .ic { color: var(--red); margin-top: 2px; }

/* ---------- Chips / estados ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.plain::before { display: none; }
.c-green { background: var(--accent-soft); color: var(--g400); }
:root[data-theme="light"] .c-green { color: var(--g700); }
.c-amber { background: var(--amber-soft); color: var(--amber); }
.c-red { background: var(--red-soft); color: var(--red); }
.c-teal { background: var(--teal-soft); color: var(--teal); }
.c-violet { background: var(--violet-soft); color: var(--violet); }
.c-lime { background: var(--lime-soft); color: var(--lime); }
.c-grey { background: var(--surface-3); color: var(--ink-3); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 550; background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line); }
.tag-pending { background: transparent; color: var(--amber); border: 1px dashed color-mix(in srgb, var(--amber) 55%, transparent); }
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); }
.prio i { display: inline-flex; gap: 2px; align-items: flex-end; }
.prio i b { width: 3px; border-radius: 2px; background: var(--line-2); }
.prio i b:nth-child(1) { height: 6px; } .prio i b:nth-child(2) { height: 9px; } .prio i b:nth-child(3) { height: 12px; }
.prio.alta i b { background: var(--red); } .prio.media i b:nth-child(-n+2) { background: var(--amber); } .prio.baja i b:nth-child(1) { background: var(--g500); }

/* ---------- Avatares ---------- */
.av { --h: 140; width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 650; color: #fff; flex: none; background: linear-gradient(140deg, hsl(var(--h) 45% 46%), hsl(calc(var(--h) + 40) 45% 30%)); box-shadow: 0 0 0 2px var(--surface); letter-spacing: 0; }
.av.lg { width: 44px; height: 44px; font-size: 15px; } .av.xl { width: 64px; height: 64px; font-size: 21px; border-radius: 18px; } .av.sm { width: 24px; height: 24px; font-size: 10px; }
.av.client { border-radius: 10px; }
.av-stack { display: flex; } .av-stack .av { margin-left: -8px; } .av-stack .av:first-child { margin-left: 0; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who > div > b { font-weight: 560; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who > div > span { font-size: 12px; color: var(--ink-3); display: block; }

/* =========================================================
   LOGIN
   ========================================================= */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art { position: relative; overflow: hidden; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(900px 600px at 15% 10%, rgba(34,197,94,.22), transparent 60%), radial-gradient(700px 500px at 90% 90%, rgba(22,163,74,.18), transparent 60%), #08110D; color: #ECF6F0; border-right: 1px solid rgba(190,255,215,.08); }
.login-art::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(190,255,215,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(190,255,215,.045) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(600px 500px at 40% 40%, #000, transparent 75%); pointer-events: none; }
.login-art > * { position: relative; z-index: 1; }
.login-art h1 { font-size: 44px; line-height: 1.05; letter-spacing: -.035em; max-width: 520px; font-weight: 620; }
.login-art h1 em { font-style: normal; color: var(--g400); }
.login-art p { color: #9DB5A8; max-width: 440px; font-size: 15px; }
.flow-preview { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.flow-preview .fp { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: rgba(18, 33, 27, .8); border: 1px solid rgba(190,255,215,.1); font-size: 13px; color: #CFE3D7; backdrop-filter: blur(6px); animation: rise .7s var(--ease) both; }
.flow-preview .fp .ic { color: var(--g400); }
.flow-preview .arrow { color: #4B6457; display: flex; align-items: center; }
.login-form-wrap { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.login-form { width: 100%; max-width: 400px; }
.login-form h2 { font-size: 26px; margin: 26px 0 6px; }
.profiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.profile-pill { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; transition: border-color .15s, background .15s, transform .15s; }
.profile-pill:hover { border-color: var(--g600); transform: translateY(-1px); }
.profile-pill.on { border-color: var(--g500); background: var(--accent-soft); }
.profile-pill div b { font-size: 12.5px; font-weight: 600; display: block; line-height: 1.2; }
.profile-pill div span { font-size: 11px; color: var(--ink-3); display: block; line-height: 1.2; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 12px; margin: 22px 0 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.demo-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--amber); background: var(--amber-soft); padding: 4px 10px; border-radius: 999px; }

/* =========================================================
   HUB (acceso maestro)
   ========================================================= */
.hub { min-height: 100vh; padding: 28px clamp(16px, 4vw, 56px) 60px; background: radial-gradient(1000px 520px at 50% -10%, rgba(34,197,94,.14), transparent 70%), var(--bg); }
.hub-top { display: flex; align-items: center; justify-content: space-between; max-width: 1180px; margin: 0 auto; }
.hub-hero { max-width: 1180px; margin: 64px auto 34px; }
.hub-hero .eyebrow { font-family: var(--mono); font-size: 12px; color: var(--g400); letter-spacing: .08em; text-transform: uppercase; }
.hub-hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.04; letter-spacing: -.04em; margin-top: 12px; font-weight: 620; }
.hub-hero h1 span { color: var(--ink-3); }
.hub-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.dept-card { position: relative; overflow: hidden; padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); cursor: pointer; min-height: 250px; display: flex; flex-direction: column; transition: transform .25s var(--ease), border-color .25s, box-shadow .25s; animation: rise .6s var(--ease) both; box-shadow: var(--shadow); text-align: left; }
.dept-card:nth-child(2) { animation-delay: .06s; } .dept-card:nth-child(3) { animation-delay: .12s; }
.dept-card::before { content: ''; position: absolute; inset: -1px; background: radial-gradient(400px 220px at 100% 0%, rgba(34,197,94,.16), transparent 60%); opacity: .7; transition: opacity .25s; pointer-events: none; }
.dept-card:hover { transform: translateY(-4px); border-color: rgba(34,197,94,.4); box-shadow: var(--shadow-lg); }
.dept-card:hover::before { opacity: 1; }
.dept-card .dc-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--g400); border: 1px solid rgba(34,197,94,.25); }
:root[data-theme="light"] .dept-card .dc-icon { color: var(--g700); }
.dept-card h2 { font-size: 22px; margin-top: 22px; letter-spacing: -.03em; }
.dept-card p { color: var(--ink-2); margin: 6px 0 0; font-size: 13.5px; }
.dept-card .dc-stats { margin-top: auto; padding-top: 22px; display: flex; gap: 22px; }
.dept-card .dc-stats div b { display: block; font-size: 20px; font-weight: 620; letter-spacing: -.02em; }
.dept-card .dc-stats div span { font-size: 12px; color: var(--ink-3); }
.dept-card .dc-go { position: absolute; right: 20px; top: 22px; color: var(--ink-3); transition: transform .25s var(--ease), color .2s; }
.dept-card:hover .dc-go { transform: translate(3px, -3px); color: var(--g400); }
.hub-sub { max-width: 1180px; margin: 16px auto 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sub-card { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, transform .2s; text-align: left; animation: rise .6s .18s var(--ease) both; }
.sub-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.sub-card .si { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.sub-card div b { display: block; font-weight: 600; } .sub-card div span { font-size: 12.5px; color: var(--ink-3); }
.sub-card .ic:last-child { margin-left: auto; color: var(--ink-3); }
.hub-flow { max-width: 1180px; margin: 34px auto 0; padding: 18px 20px; border-radius: var(--r); border: 1px dashed var(--line-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--ink-2); font-size: 12.5px; }
.hub-flow b { color: var(--ink); font-weight: 560; }
.hub-flow .ic { color: var(--ink-3); }

/* =========================================================
   SHELL (departamentos)
   ========================================================= */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--bg-2); overflow-y: auto; }
.sidebar .logo { padding: 4px 8px 16px; }
.dept-switch { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; margin-bottom: 14px; text-align: left; }
.dept-switch:hover { border-color: var(--line-2); }
.dept-switch .ds-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--g400); }
:root[data-theme="light"] .dept-switch .ds-ic { color: var(--g700); }
.dept-switch div b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; } .dept-switch div span { font-size: 11.5px; color: var(--ink-3); }
.dept-switch > .ic:last-child { margin-left: auto; color: var(--ink-3); }
.nav-group { margin-bottom: 14px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 6px 10px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 9px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; cursor: pointer; background: transparent; border: 0; text-align: left; transition: background .12s, color .12s; position: relative; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.on { background: var(--surface-2); color: var(--ink); }
.nav-item.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--g500); }
.nav-item.on .ic { color: var(--g400); }
:root[data-theme="light"] .nav-item.on .ic { color: var(--g700); }
.nav-item .count { margin-left: auto; font-size: 11px; font-family: var(--mono); color: var(--ink-3); background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
.nav-item .count.hot { color: var(--accent-ink); background: var(--g500); }
.nav-item .pend { margin-left: auto; font-size: 10px; color: var(--amber); border: 1px dashed color-mix(in srgb, var(--amber) 50%, transparent); padding: 0 5px; border-radius: 5px; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; width: 100%; background: transparent; border: 0; text-align: left; }
.me:hover { background: var(--surface-2); }
.me div b { font-size: 13px; display: block; font-weight: 580; } .me div span { font-size: 11.5px; color: var(--ink-3); display: block; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-3); min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a:hover { color: var(--ink); }
.topbar .grow { flex: 1; }
.search-btn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3); cursor: pointer; min-width: 240px; font-size: 13px; }
.search-btn kbd { margin-left: auto; font-family: var(--mono); font-size: 11px; border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; }
.scope { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); white-space: nowrap; }
.scope .ic { color: var(--g500); }
.content { padding: 24px; max-width: 1440px; width: 100%; margin: 0 auto; animation: fade .35s var(--ease); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; letter-spacing: -.03em; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tarjetas, KPIs ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-h h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.card-h .sub { font-size: 12.5px; color: var(--ink-3); }
.card-b { padding: 16px 18px 18px; }
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mt { margin-top: 16px; }
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .k-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); font-weight: 520; }
.kpi .k-label .ic { color: var(--ink-3); }
.kpi .k-value { font-size: 26px; font-weight: 620; letter-spacing: -.035em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi .k-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12px; color: var(--g400); }
:root[data-theme="light"] .delta { color: var(--g700); }
.delta.down { color: var(--red); }
.kpi .spark { width: 90px; height: 28px; }
.kpi.accent { background: linear-gradient(160deg, color-mix(in srgb, var(--g600) 22%, var(--surface)), var(--surface) 70%); border-color: rgba(34,197,94,.25); }

/* ---------- Gráficos ---------- */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-family: var(--mono); }
.chart .dot { transition: r .15s; } .chart .dot:hover { r: 6; }
.chart .bar { transition: opacity .2s; } .chart .bar:hover { opacity: 1 !important; }
.line-draw { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.4s var(--ease) forwards; }
.line-draw[stroke-dasharray="5 5"] { stroke-dasharray: 5 5; stroke-dashoffset: 0; animation: none; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-c { fill: var(--ink); font-size: 20px; font-weight: 650; letter-spacing: -.03em; }
.donut-s { fill: var(--ink-3); font-size: 10.5px; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; display: grid; gap: 8px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.donut-legend i { width: 8px; height: 8px; border-radius: 3px; }
.donut-legend b { margin-left: auto; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.ring text { fill: var(--ink); font-size: 12px; font-weight: 650; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 70px; gap: 12px; align-items: center; padding: 7px 0; font-size: 13px; }
.bar-row .track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--g700), var(--g500)); animation: grow .9s var(--ease) both; transform-origin: left; }
.bar-row .fill.over { background: linear-gradient(90deg, #B45309, var(--amber)); }
.bar-row .fill.full { background: linear-gradient(90deg, #9F2D24, var(--red)); }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 580; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--g600), var(--g400)); animation: grow 1s var(--ease) both; transform-origin: left; }

/* ---------- Tablas ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .input-icon { flex: 1; min-width: 200px; max-width: 340px; }
.toolbar .input { height: 34px; }
.toolbar select.input { width: auto; min-width: 140px; height: 34px; padding-right: 28px; }
.toolbar .count-lbl { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 550; font-size: 12px; color: var(--ink-3); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .r { text-align: right; }
.tbl .actions { display: flex; gap: 4px; justify-content: flex-end; }
.tbl tr.off td { opacity: .5; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.empty .ic { margin: 0 auto 10px; color: var(--ink-3); }
.no-results { display: none; padding: 30px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ---------- Listas ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); cursor: pointer; transition: background .12s; min-width: 0; }
.li:first-child { border-top: 0; }
.li:hover { background: var(--surface-2); }
.li .li-main { flex: 1; min-width: 0; }
.li .li-main b { display: block; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.li .li-main span { font-size: 12px; color: var(--ink-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .li-end { display: flex; align-items: center; gap: 8px; flex: none; }
.li .li-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }

/* ---------- Segmentado / pestañas ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { height: 30px; padding: 0 12px; border: 0; background: transparent; border-radius: 8px; font-size: 13px; font-weight: 520; color: var(--ink-2); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 0 0 1px var(--line); }
.seg button .n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 18px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; padding: 10px 12px; border: 0; background: transparent; color: var(--ink-3); font-weight: 540; cursor: pointer; white-space: nowrap; font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); }
.tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--g500); }
.tabs .n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); background: var(--surface-3); padding: 0 5px; border-radius: 5px; }

/* ---------- Kanban ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(272px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.col { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; min-height: 200px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 4px 4px 6px; font-size: 13px; font-weight: 600; }
.col-h .n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.col-h .chip { height: 22px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; box-shadow: var(--shadow); }
.kcard:hover { border-color: var(--line-2); transform: translateY(-1px); }
.kcard .k-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }
.kcard b { display: block; margin: 6px 0 2px; font-weight: 580; font-size: 13.5px; line-height: 1.35; }
.kcard .k-client { font-size: 12.5px; color: var(--ink-2); }
.kcard .k-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.kcard .k-date { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); }
.kcard .k-date.late { color: var(--red); }
.kcard .k-actions { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.kcard.rejected { border-color: color-mix(in srgb, var(--red) 40%, transparent); }

/* ---------- Stepper de estados ---------- */
.flow { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.flow::-webkit-scrollbar { display: none; }
.flow .st { flex: 1; min-width: 104px; position: relative; text-align: center; font-size: 11.5px; color: var(--ink-3); }
.flow .st .b { width: 26px; height: 26px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); border: 2px solid var(--line-2); color: var(--ink-3); position: relative; z-index: 1; font-size: 11px; font-weight: 650; }
.flow .st::before { content: ''; position: absolute; top: 12px; left: -50%; right: 50%; height: 2px; background: var(--line-2); }
.flow .st:first-child::before { display: none; }
.flow .st.done .b { background: var(--g600); border-color: var(--g600); color: #fff; }
.flow .st.done::before, .flow .st.cur::before { background: var(--g600); }
.flow .st.cur .b { background: var(--bg); border-color: var(--g500); color: var(--g400); box-shadow: 0 0 0 5px var(--accent-soft); }
.flow .st.done, .flow .st.cur { color: var(--ink); }
.flow .st.cur { font-weight: 600; }
.flow.rej .st.cur .b { border-color: var(--red); color: var(--red); box-shadow: 0 0 0 5px var(--red-soft); }

/* Etapas verticales (portal y ficha) */
.vsteps { list-style: none; margin: 0; padding: 0; }
.vsteps li { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.vsteps li:last-child { padding-bottom: 0; }
.vsteps li::before { content: ''; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 2px; background: var(--line-2); border-radius: 2px; }
.vsteps li:last-child::before { display: none; }
.vsteps li.done::before { background: var(--g600); }
.vsteps .vb { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); border: 2px solid var(--line-2); color: var(--ink-3); font-size: 11px; font-weight: 650; z-index: 1; }
.vsteps li.done .vb { background: var(--g600); border-color: var(--g600); color: #fff; }
.vsteps li.cur .vb { border-color: var(--g500); color: var(--g400); box-shadow: 0 0 0 5px var(--accent-soft); background: var(--bg); }
.vsteps .vt b { display: block; font-weight: 580; font-size: 14px; }
.vsteps .vt span { font-size: 12.5px; color: var(--ink-3); }
.vsteps li.cur .vt b { color: var(--g400); }
:root[data-theme="light"] .vsteps li.cur .vt b { color: var(--g700); }
.vsteps li.todo .vt b { color: var(--ink-2); font-weight: 500; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 0 0 16px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 13px; top: 30px; bottom: 4px; width: 1px; background: var(--line-2); }
.timeline li:last-child::before { display: none; }
.timeline .tl-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.timeline .tl-ic.g { background: var(--accent-soft); color: var(--g400); }
.timeline .tl-b { font-size: 13px; }
.timeline .tl-b span { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------- Ficha de cliente (expediente) ---------- */
.dossier-head { padding: 22px; display: flex; gap: 18px; align-items: flex-start; position: relative; overflow: hidden; }
.dossier-head::after { content: ''; position: absolute; right: -80px; top: -120px; width: 340px; height: 340px; background: radial-gradient(circle, rgba(34,197,94,.14), transparent 65%); pointer-events: none; }
.dossier-head h1 { font-size: 24px; letter-spacing: -.03em; }
.dossier-head .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.dossier-head .meta span { display: inline-flex; align-items: center; gap: 6px; }
.dossier-head .meta .ic { color: var(--ink-3); }
.dossier-head .d-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; position: relative; z-index: 1; }
.quick { display: none; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.facts div { padding: 14px 22px; border-left: 1px solid var(--line); }
.facts div:first-child { border-left: 0; }
.facts span { display: block; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 550; }
.facts b { display: block; margin-top: 4px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.svc { padding: 16px 18px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; cursor: pointer; transition: background .12s; }
.svc:first-child { border-top: 0; }
.svc:hover { background: var(--surface-2); }
.svc b { font-weight: 580; }
.svc .svc-meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 4px 12px; flex-wrap: wrap; }
.svc .svc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.svc .progress { grid-column: 1 / -1; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; font-weight: 520; min-width: 0; overflow-wrap: anywhere; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.file { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; min-width: 0; transition: border-color .15s; }
.file:hover { border-color: var(--line-2); }
.file .fi { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--g400); flex: none; }
.file div b { display: block; font-size: 13px; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file div span { font-size: 11.5px; color: var(--ink-3); }
.note { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 10px; }
.note .n-h { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.note .n-h b { color: var(--ink); font-weight: 560; }
.note p { margin: 0; font-size: 13.5px; }

/* ---------- Pendiente de integración ---------- */
.pending-hero { padding: 40px 28px; text-align: center; border: 1px dashed color-mix(in srgb, var(--amber) 45%, transparent); border-radius: var(--r-lg); background: repeating-linear-gradient(-45deg, transparent 0 12px, color-mix(in srgb, var(--amber) 4%, transparent) 12px 24px); }
.pending-hero .ph-ic { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); }
.pending-hero h2 { font-size: 22px; }
.pending-hero p { color: var(--ink-2); max-width: 560px; margin: 10px auto 0; }
.pending-list { text-align: left; max-width: 560px; margin: 22px auto 0; display: grid; gap: 8px; }
.pending-list div { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.pending-list .ic { color: var(--amber); margin-top: 2px; }

/* ---------- Modal / hoja / drawer ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(4, 10, 7, .62); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fade .2s ease; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: pop .28s var(--ease); }
.modal.wide { max-width: 760px; }
.modal-h { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 4px; }
.modal-h h3 { font-size: 18px; letter-spacing: -.02em; }
.modal-h p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.modal-h .icon-btn { margin-left: auto; margin-top: -6px; margin-right: -8px; }
.modal-b { padding: 16px 22px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
.drawer-back { position: fixed; inset: 0; z-index: 70; background: rgba(4,10,7,.45); animation: fade .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 71; width: min(400px, 100vw); background: var(--surface); border-left: 1px solid var(--line-2); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slideL .3s var(--ease); }
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-h h3 { font-size: 16px; }
.drawer-b { overflow-y: auto; flex: 1; }
.notif { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif .ndot { width: 8px; height: 8px; border-radius: 50%; background: var(--g500); margin-top: 6px; flex: none; }
.notif.read .ndot { background: transparent; }
.notif p { margin: 0; font-size: 13px; } .notif div span { font-size: 11.5px; color: var(--ink-3); }

/* Paleta de comandos */
.cmdk { max-width: 600px; align-self: start; margin-top: 10vh; }
.cmdk .ck-in { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.cmdk .ck-in input { flex: 1; border: 0; background: transparent; outline: none; font-size: 15px; }
.cmdk .ck-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.cmdk .ck-group { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; padding: 10px 12px 4px; font-weight: 600; }
.cmdk .ck-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 13.5px; }
.cmdk .ck-item:hover, .cmdk .ck-item.sel { background: var(--surface-2); }
.cmdk .ck-item span { margin-left: auto; font-size: 12px; color: var(--ink-3); }

/* Toast */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastIn .35s var(--ease); max-width: 380px; pointer-events: auto; }
.toast .ic { color: var(--g400); }
.toast.warn .ic { color: var(--amber); }
.toast.out { animation: toastOut .3s var(--ease) forwards; }

/* Menú contextual */
.menu-pop { position: fixed; z-index: 90; min-width: 220px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: pop .18s var(--ease); }
.menu-pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font-size: 13.5px; text-align: left; color: var(--ink); }
.menu-pop button:hover { background: var(--surface-2); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-pop .mp-h { padding: 8px 10px; font-size: 12px; color: var(--ink-3); }

/* Bottom nav móvil interno */
.bottomnav { display: none; }

/* Permisos (matriz) */
.perm { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm th, .perm td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.perm th:first-child, .perm td:first-child { text-align: left; }
.perm th { font-size: 11.5px; color: var(--ink-3); font-weight: 550; }
.switch { position: relative; width: 36px; height: 20px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink-3); transition: transform .2s var(--ease), background .2s; }
.switch input:checked + span { background: var(--g600); border-color: var(--g600); }
.switch input:checked + span::after { transform: translateX(16px); background: #fff; }

/* Zonas (matriz exclusividad) */
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.zone { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.zone h4 { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.zone h4 .ic { color: var(--g500); }
.zone .z-sub { font-size: 12px; color: var(--ink-3); margin: 2px 0 10px; }
.zone .z-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.zone .z-tags .tag.taken { background: var(--accent-soft); color: var(--g400); border-color: transparent; }
:root[data-theme="light"] .zone .z-tags .tag.taken { color: var(--g700); }

/* Rankings */
.rank { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.rank:first-child { border-top: 0; }
.rank .pos { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--ink-2); flex: none; }
.rank .pos.p1 { background: linear-gradient(140deg, #F5D27A, #B7852A); color: #2B1D00; }
.rank .pos.p2 { background: linear-gradient(140deg, #E4ECE7, #95A79C); color: #172019; }
.rank .pos.p3 { background: linear-gradient(140deg, #E8B38A, #9A5A2E); color: #2A1405; }
.rank .r-val { margin-left: auto; text-align: right; }
.rank .r-val b { display: block; font-variant-numeric: tabular-nums; }
.rank .r-val span { font-size: 11.5px; color: var(--ink-3); }

/* Mensualidades */
.months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.mcell { height: 28px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 600; cursor: default; }
.mcell.paid { background: var(--accent-soft); color: var(--g400); }
:root[data-theme="light"] .mcell.paid { color: var(--g700); }
.mcell.pend { background: var(--amber-soft); color: var(--amber); }
.mcell.na { background: var(--surface-2); color: var(--ink-3); }
.mcell.late { background: var(--red-soft); color: var(--red); }

/* =========================================================
   PORTAL DEL CLIENTE
   ========================================================= */
.portal-stage { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(0, 440px) 1fr; background: radial-gradient(800px 500px at 50% 0%, rgba(34,197,94,.12), transparent 70%), var(--bg); }
.portal-side { position: sticky; top: 0; height: 100vh; align-self: start; padding: 40px 32px; display: flex; flex-direction: column; justify-content: center; max-width: 360px; justify-self: end; color: var(--ink-2); font-size: 13.5px; }
.portal-side h3 { color: var(--ink); font-size: 18px; margin: 14px 0 8px; }
.portal-side ul { padding-left: 18px; margin: 10px 0 0; } .portal-side li { margin-bottom: 6px; }
.portal-side.right { justify-self: start; }
.portal { position: relative; min-height: 100vh; background: var(--bg); border-left: 1px solid var(--line); border-right: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.p-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.p-top .grow { flex: 1; }
.p-body { flex: 1; padding: 6px 18px 110px; animation: fade .3s var(--ease); }
.p-hello { padding: 10px 2px 18px; }
.p-hello span { font-size: 13px; color: var(--ink-3); }
.p-hello h1 { font-size: 26px; line-height: 1.12; letter-spacing: -.035em; margin-top: 4px; }
.p-hello p { margin: 8px 0 0; color: var(--ink-2); font-size: 14px; }
.p-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.p-card.hero { background: linear-gradient(155deg, color-mix(in srgb, var(--g600) 30%, var(--surface)) 0%, var(--surface) 65%); border-color: rgba(34,197,94,.25); }
.p-card h3 { font-size: 16px; letter-spacing: -.02em; }
.p-card .pc-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.p-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; margin: 22px 2px 10px; display: flex; justify-content: space-between; align-items: center; }
.p-label a { text-transform: none; letter-spacing: 0; color: var(--g400); font-weight: 550; font-size: 13px; }
:root[data-theme="light"] .p-label a { color: var(--g700); }
.p-svc { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 10px; cursor: pointer; transition: transform .15s, border-color .15s; min-height: 76px; }
.p-svc:active { transform: scale(.985); }
.p-svc:hover { border-color: var(--line-2); }
.p-svc .ps-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--g400); flex: none; }
:root[data-theme="light"] .p-svc .ps-ic { color: var(--g700); }
.p-svc .ps-m { flex: 1; min-width: 0; }
.p-svc .ps-m b { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.p-svc .ps-m span { font-size: 12.5px; color: var(--ink-3); }
.p-svc .ps-m .progress { margin-top: 8px; }
.p-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 4px; }
.p-quick button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; font-size: 12px; color: var(--ink-2); font-weight: 520; }
.p-quick button .ic { color: var(--g400); }
:root[data-theme="light"] .p-quick button .ic { color: var(--g700); }
.p-quick button:active { transform: scale(.96); }
.contact { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 10px; }
.contact .c-m { flex: 1; min-width: 0; }
.contact .c-m b { display: block; font-size: 15px; font-weight: 600; } .contact .c-m span { font-size: 12.5px; color: var(--ink-3); }
.contact .c-btns { display: flex; gap: 8px; }
.round { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); cursor: pointer; }
.round.g { background: var(--g600); border-color: var(--g600); color: #fff; }
.round:active { transform: scale(.94); }
.p-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(440px, 100vw); z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.p-nav button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; border: 0; background: transparent; color: var(--ink-3); font-size: 10.5px; font-weight: 550; cursor: pointer; border-radius: 12px; min-height: 48px; justify-content: center; }
.p-nav button.on { color: var(--g400); }
:root[data-theme="light"] .p-nav button.on { color: var(--g700); }
.p-nav button.on .ic { transform: translateY(-1px); }
.big-progress { display: flex; align-items: center; gap: 16px; }
.big-progress .bp-t b { display: block; font-size: 15px; font-weight: 600; } .big-progress .bp-t span { font-size: 12.5px; color: var(--ink-3); }
.measure-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--ink-3); margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.measure-note .ic { margin-top: 1px; color: var(--g500); }

/* Activación de acceso */
.activate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(700px 400px at 50% 0%, rgba(34,197,94,.14), transparent 70%), var(--bg); }
.activate .card { width: 100%; max-width: 420px; padding: 28px; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.pw-meter i { height: 4px; border-radius: 4px; background: var(--surface-3); transition: background .2s; }
.pw-meter i.on { background: var(--g500); }

/* ---------- Animaciones ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slideL { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } .line-draw { stroke-dashoffset: 0; } }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-stage { grid-template-columns: 1fr minmax(0, 440px); }
  .portal-side.right { display: none; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 14px; height: 56px; }
  .search-btn { min-width: 0; width: 36px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .search-btn span, .search-btn kbd { display: none; }
  .scope { display: none; }
  .content { padding: 16px 14px 100px; }
  .g-3, .g-21, .g-12 { grid-template-columns: minmax(0, 1fr); }
  .hub-grid, .hub-sub { grid-template-columns: 1fr; }
  .dept-card { min-height: 0; }
  .hub-hero { margin: 40px auto 24px; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
  .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--ink-3); font-size: 10.5px; font-weight: 550; padding: 6px 0; min-height: 50px; cursor: pointer; border-radius: 12px; position: relative; }
  .bottomnav button.on { color: var(--g400); }
  :root[data-theme="light"] .bottomnav button.on { color: var(--g700); }
  .bottomnav .bn-badge { position: absolute; top: 4px; right: calc(50% - 18px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--g500); color: var(--accent-ink); font-size: 10px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
  .toasts { left: 14px; right: 14px; bottom: 84px; align-items: center; }
  .overlay { align-items: end; padding: 0; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; max-height: 92vh; animation: slideUp .32s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
  .modal::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 10px auto 0; }
  .cmdk { margin-top: 0; align-self: end; }
  .modal-f { position: sticky; bottom: 0; background: var(--surface); }
  .modal-f .btn { flex: 1; height: 44px; }
  /* Ficha cliente móvil */
  .dossier-head { flex-direction: column; padding: 18px; gap: 14px; }
  .dossier-head .d-actions { display: none; }
  .dossier-head h1 { font-size: 22px; }
  .quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 18px 18px; }
  .quick button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 550; cursor: pointer; }
  .quick button .ic { color: var(--g400); }
  :root[data-theme="light"] .quick button .ic { color: var(--g700); }
  .facts { grid-template-columns: 1fr 1fr; }
  .facts div:nth-child(3) { border-left: 0; }
  .facts div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .facts div { padding: 12px 18px; }
  .tabs { position: sticky; top: 56px; z-index: 15; background: var(--bg); margin: 0 -14px 16px; padding: 0 8px; }
  .kv { grid-template-columns: 110px 1fr; }
  /* Tablas → tarjetas */
  .tbl.stack thead { display: none; }
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; }
  .tbl.stack td { padding: 0; border: 0; white-space: normal; }
  .tbl.stack td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
  .tbl.stack td.primary { grid-column: 1 / -1; }
  .tbl.stack td.r { text-align: left; }
  .tbl.stack td.end { grid-column: 1 / -1; }
  .tbl.stack .actions { justify-content: flex-start; flex-wrap: wrap; }
  .toolbar .input-icon { max-width: none; min-width: 100%; }
  .toolbar select.input { flex: 1 1 45%; min-width: 0; width: auto !important; max-width: none !important; }
  .toolbar .count-lbl { width: 100%; margin: 0; }
  .board { grid-auto-columns: 86%; margin: 0 -14px; padding: 0 14px 8px; }
  .page-head h1 { font-size: 21px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .card-h { flex-wrap: wrap; }
  .bar-row { grid-template-columns: 96px 1fr 56px; font-size: 12.5px; }
  .hub-flow { display: none; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 22px 30px; min-height: auto; }
  .login-art h1 { font-size: 30px; margin-top: 30px; }
  .flow-preview { display: none; }
  .login-art .art-foot { display: none; }
  .login-form-wrap { padding: 28px 20px 40px; align-items: start; }
  .login-form h2 { margin-top: 0; }
  .portal-stage { grid-template-columns: 1fr; }
  .portal-side { display: none; }
  .portal { border: 0; box-shadow: none; }
}
@media (max-width: 560px) {
  .g-4, .g-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .g-2.solo { grid-template-columns: 1fr; }
  .chart .axis { font-size: 19px; }
  .kpi { padding: 14px; } .kpi .k-value { font-size: 21px; } .kpi .spark { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .profiles { grid-template-columns: 1fr 1fr; }
  .card-h { padding: 14px 14px 0; } .card-b { padding: 14px; }
  .li { padding: 12px 14px; }
  .li .li-end { flex-wrap: wrap; justify-content: flex-end; max-width: 46%; row-gap: 6px; }
  .bar-row { grid-template-columns: 1fr auto !important; gap: 6px 10px; }
  .bar-row .track { grid-column: 1 / -1; order: 3; }
}

/* =========================================================
   PROWIK OS · Versión instalable (servidor real)
   ========================================================= */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--ink-3); font-size: 13px; background: radial-gradient(700px 400px at 50% 0%, rgba(34,197,94,.14), transparent 70%), var(--bg); }
.boot .logo-mark { animation: bootPulse 1.4s var(--ease) infinite; }
@keyframes bootPulse { 50% { transform: scale(.92); opacity: .8; } }
.srv-err { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.srv-card { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow-lg); }
.srv-card h1 { font-size: 22px; margin: 22px 0 8px; }
.srv-card li { margin: 8px 0; color: var(--ink); } .srv-card p { color: var(--ink-2); }
.syncbar { position: fixed; z-index: 120; left: 50%; transform: translateX(-50%); top: 10px; display: flex; gap: 8px; align-items: center; max-width: calc(100% - 24px); padding: 9px 14px; border-radius: 12px; background: var(--red-soft); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); font-size: 12.5px; font-weight: 550; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.only-sm { display: none !important; }
.rot180 { transform: rotate(180deg); }
/* Instalador */
.login-form.setup h2 { margin: 6px 0 6px; font-size: 24px; }
.setup-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 26px; }
.setup-steps div { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--ink-3); font-weight: 550; }
.setup-steps div span { height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.setup-steps div.cur { color: var(--ink); } .setup-steps div.cur span { background: var(--accent-soft); border-color: color-mix(in srgb, var(--g500) 50%, transparent); color: var(--g400); }
.setup-steps div.done span { background: var(--g600); border-color: var(--g600); color: #fff; }
.check-list { display: grid; gap: 10px; margin-top: 18px; }
.check-list div { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; }
.check-list .ok .ic { color: var(--g500); } .check-list .warn .ic { color: var(--amber); }
.setup-done { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); color: var(--g500); margin-bottom: 18px; }
.input-icon.pw .input { padding-right: 42px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink-3); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.pw-eye .ic { position: static; transform: none; pointer-events: none; }
.pw-eye:hover { background: var(--surface-2); color: var(--ink); }
/* Formularios */
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); max-height: 260px; overflow: auto; }
.chk-list { display: grid; gap: 6px; }
.chk-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.chk-row .check { gap: 0; }
.chips-edit { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-edit .tag { display: inline-flex; align-items: center; gap: 4px; }
.chips-edit .x { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 2px; }
.chips-edit .x:hover { color: var(--red); }
.file { position: relative; }
.file .f-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; opacity: .55; }
.file .f-del:hover { opacity: 1; color: var(--red); }
/* Editor de bloques */
.blk { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.blk-h { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 0 16px; }
.blk-t { display: inline-flex; gap: 7px; align-items: center; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--g400); }
:root[data-theme="light"] .blk-t { color: var(--g700); }
.blk-a { display: flex; gap: 2px; } .blk-a .icon-btn { width: 30px; height: 30px; } .blk-a .icon-btn:disabled { opacity: .3; cursor: default; }
.blk-b { padding: 10px 16px 16px; display: grid; gap: 8px; }
.blk-b .grid-2 { margin: 0; }
/* Conversaciones */
.thread { display: grid; gap: 8px; margin-bottom: 14px; }
.msg { max-width: 88%; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.msg.out { justify-self: end; background: var(--accent-soft); border-color: color-mix(in srgb, var(--g500) 30%, transparent); }
.msg b { font-size: 12px; } .msg p { margin: 4px 0; white-space: pre-wrap; font-size: 13.5px; } .msg span { font-size: 11px; color: var(--ink-3); }
/* Reparto */
.rep-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; margin-bottom: 6px; }
input.bulk { margin-right: 4px; flex: none; }
@media (max-width: 960px) {
  .hide-sm { display: none !important; }
}
@media (max-width: 860px) {
  .only-sm { display: flex !important; }
  .login-art { display: none; }
  .login-form-wrap { min-height: 100vh; padding-top: 40px; background: radial-gradient(600px 360px at 50% 0%, rgba(34,197,94,.16), transparent 70%), var(--bg); }
}
@media (max-width: 560px) {
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .chk-grid { grid-template-columns: 1fr; }
  .rep-row { grid-template-columns: 1fr 96px auto; }
  .setup-steps div { font-size: 10px; }
  .srv-card { padding: 20px; }
}

/* ===== Paridad con los CRM anteriores: calendario, meses, Prowi IA ===== */
.facts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-h { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: .06em; padding: 2px 0 4px; }
.cal-d { position: relative; aspect-ratio: 1 / .82; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-size: 13px; display: flex; align-items: flex-start; justify-content: flex-start; padding: 7px 8px; cursor: pointer; transition: border-color .15s, background .15s; }
.cal-d:hover { border-color: color-mix(in srgb, var(--g500) 45%, transparent); }
.cal-d.out { background: transparent; border-color: transparent; cursor: default; }
.cal-d.today { border-color: var(--g500); }
.cal-d.sel { background: var(--accent-soft); border-color: var(--g500); font-weight: 650; }
.cal-d i { position: absolute; right: 6px; bottom: 6px; font-style: normal; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--g600); color: #fff; font-size: 11px; font-weight: 650; display: grid; place-items: center; }
.month-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mtile { position: relative; overflow: hidden; text-align: left; display: grid; gap: 3px; padding: 14px 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; cursor: pointer; transition: transform .15s, border-color .15s; }
.mtile:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--g500) 45%, transparent); }
.mtile .mt-n { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.mtile b { font-size: 19px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mtile .mt-s { font-size: 11.5px; color: var(--ink-3); }
.mtile i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--g500); border-radius: 0 3px 3px 0; }
.mtile.cur { border-color: var(--g500); }
.mtile.sel { background: var(--accent-soft); border-color: var(--g500); }
.mtile.zero b { color: var(--ink-3); }
.rep-row.conc { grid-template-columns: 1fr 110px 130px auto; }
.tbl tr.grp td { border-top: 1px solid var(--line); }
.ia-chat { display: flex; flex-direction: column; min-height: calc(100vh - 210px); }
.ia-msgs { flex: 1; display: grid; align-content: start; gap: 10px; padding: 18px; overflow-y: auto; max-height: calc(100vh - 300px); }
.ia-msgs .msg { max-width: 760px; }
.ia-msgs .msg p { white-space: normal; line-height: 1.55; }
.ia-msgs .msg > span { display: block; margin-top: 6px; }
.ia-hello { text-align: center; padding: 40px 10px 20px; display: grid; justify-items: center; gap: 6px; }
.ia-hello h3 { margin: 10px 0 0; font-size: 20px; }
.ia-hello p { max-width: 520px; margin: 0; }
.ia-sug { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 12px; }
.ia-sug .tag { cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font: inherit; font-size: 12.5px; }
.ia-sug .tag:hover { border-color: var(--g500); color: var(--ink); }
.ia-in { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
@media (max-width: 960px) {
  .cal-grid { gap: 4px; }
  .cal-d { padding: 5px; font-size: 12px; }
  .cal-d i { min-width: 16px; height: 16px; font-size: 10px; right: 3px; bottom: 3px; }
  .month-tiles { grid-template-columns: repeat(2, 1fr); }
  .rep-row.conc { grid-template-columns: 1fr 90px; }
  .rep-row.conc select { grid-column: 1; }
  .ia-chat { min-height: calc(100vh - 230px); }
  .ia-msgs { max-height: none; padding: 12px; }
  .ia-in { position: sticky; bottom: 64px; background: var(--surface); }
}

/* Tarjetas comerciales: acciones completas en el mismo bloque. */
.lead-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,370px),1fr));gap:16px;padding:16px}.lead-card{min-width:0}.lead-card .card-h{align-items:start}.lead-card h3{white-space:normal}.lead-card .actions{flex-wrap:wrap}.lead-card p{overflow-wrap:anywhere}.lead-card textarea{width:100%}
