/* ==========================================================================
   Ubicar4G · Panel administrativo
   ========================================================================== */
:root {
    --blue: #0A66C2;
    --blue-600: #0857A6;
    --blue-50: #EAF3FC;
    --red: #E3000F;
    --ink: #0F172A;
    --ink-2: #334155;
    --muted: #64748B;
    --line: #E2E8F0;
    --line-2: #EEF2F7;
    --bg: #F4F6FA;
    --card: #FFFFFF;
    --green: #059669;  --green-50: #ECFDF5;
    --amber: #D97706;  --amber-50: #FFFBEB;
    --rose: #E11D48;   --rose-50: #FFF1F2;
    --violet: #7C3AED;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -8px rgba(15, 23, 42, .12);
    --shadow-lg: 0 24px 64px -16px rgba(15, 23, 42, .35);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
a { color: var(--blue); }
.muted { color: var(--muted); margin: 0; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.uppercase { text-transform: uppercase; }
.text-sm { font-size: 13px; color: var(--muted); }

/* ---------- Marca ---------- */
.brand-logo { font-weight: 800; font-size: 19px; letter-spacing: -.03em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: baseline; gap: 1px; }
.brand-logo span { color: var(--blue); }
.brand-logo small { margin-left: 8px; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--line-2); padding: 2px 8px; border-radius: 99px; letter-spacing: 0; align-self: center; }
.brand-logo--light { color: #fff; font-size: 26px; }
.brand-logo--light span { color: #7CC0FF; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--blue); margin-bottom: 8px; }

/* ---------- Botones ---------- */
.btn { --bh: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--bh); padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .1s, border-color .15s, color .15s; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .stat:focus-visible, .filter-chip:focus-visible { outline: 3px solid rgba(10, 102, 194, .35); outline-offset: 2px; }
.btn--primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -6px rgba(10, 102, 194, .6); }
.btn--primary:hover { background: var(--blue-600); }
.btn--warning { background: #F59E0B; color: #fff; box-shadow: 0 6px 16px -6px rgba(245, 158, 11, .6); }
.btn--warning:hover { background: #D97706; }
.btn--danger { background: var(--rose); color: #fff; box-shadow: 0 6px 16px -6px rgba(225, 29, 72, .55); }
.btn--danger:hover { background: #BE123C; }
.btn--ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn--ghost:hover { background: var(--line-2); }
.btn--outline { background: var(--card); color: var(--ink-2); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn--outline:hover, .btn--outline[aria-expanded="true"] { border-color: var(--blue); color: var(--blue); }
.btn--soft { background: var(--blue-50); color: var(--blue); }
.btn--soft:hover { background: #D6E8FA; }
.btn--sm { --bh: 34px; padding: 0 12px; font-size: 13px; }
.btn--xs { --bh: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn--lg { --bh: 48px; font-size: 15px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .65; pointer-events: none; }
.link { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--blue); cursor: pointer; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn--danger:hover { background: var(--rose-50); color: var(--rose); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

/* ---------- Campos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .field-label { margin-bottom: 0; }
.field-hint { font-size: 12px; color: var(--amber); font-weight: 500; }
input[type=text], input[type=password], input[type=search], input[type=tel], input[type=date], textarea, select {
    width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(10, 102, 194, .12); }
input::placeholder, textarea::placeholder { color: #A0AEC0; }
.field--success input { border-color: #6EE7B7; background: var(--green-50); }
.input-icon { position: relative; display: block; }
.input-icon > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #94A3B8; pointer-events: none; }
.input-icon input { padding-left: 42px; height: 48px; }
.input-icon .input-action { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: transparent; color: #94A3B8; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.input-icon .input-action:hover { color: var(--ink); background: var(--line-2); }
.input-icon:has(.input-action) input { padding-right: 46px; }

/* ---------- Alertas ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin: 18px 0 0; border: 1px solid; }
.alert--error { background: var(--rose-50); border-color: #FECDD3; color: #9F1239; }
.alert--info { background: var(--blue-50); border-color: #BFDBFE; color: #1E40AF; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login-body { min-height: 100vh; background: #fff; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 20% 0%, #1A73D9 0%, transparent 60%), linear-gradient(160deg, #0A2540 0%, #071A2F 100%); color: #fff; display: flex; align-items: flex-end; padding: 56px; }
.login-brand::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle at 60% 35%, #000 0%, transparent 70%); -webkit-mask-image: radial-gradient(circle at 60% 35%, #000 0%, transparent 70%); }
.login-brand-copy { position: relative; max-width: 460px; }
.login-brand-copy h2 { font-size: 34px; line-height: 1.15; font-weight: 700; margin: 22px 0 12px; }
.login-brand-copy p { color: #B8C7DB; font-size: 15.5px; margin: 0 0 28px; }
.login-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.login-features li { display: flex; align-items: center; gap: 12px; color: #DCE6F2; font-size: 14px; }
.login-features svg { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.08); color: #7CC0FF; }

.radar { position: absolute; top: 12%; right: 10%; width: 340px; height: 340px; }
.radar-ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(124, 192, 255, .22); }
.radar-ring.r2 { inset: 18%; } .radar-ring.r3 { inset: 36%; }
.radar-sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(124,192,255,.35), transparent 22%); animation: sweep 4s linear infinite; }
.radar-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #7CC0FF; box-shadow: 0 0 0 0 rgba(124,192,255,.6); animation: ping 2.4s ease-out infinite; }
.radar-dot.d1 { top: 28%; left: 62%; } .radar-dot.d2 { top: 64%; left: 30%; animation-delay: .8s; background: #34D399; } .radar-dot.d3 { top: 46%; left: 78%; animation-delay: 1.6s; background: #FBBF24; }
@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(124,192,255,.55); } 100% { box-shadow: 0 0 0 18px rgba(124,192,255,0); } }

.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; background: linear-gradient(180deg, #fff, #F8FAFC); }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { font-size: 30px; font-weight: 800; margin-bottom: 6px; }
.login-card form { margin-top: 26px; }
.login-card .btn--lg { margin-top: 8px; }
.login-back { display: inline-block; margin-top: 22px; font-size: 13px; color: var(--muted); text-decoration: none; }
.login-back:hover { color: var(--blue); }
.login-foot { margin-top: 36px; font-size: 12px; color: #94A3B8; text-align: center; }
.brand-logo--mobile { display: none; margin-bottom: 28px; }

@media (max-width: 900px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .brand-logo--mobile { display: inline-flex; }
}
@media (prefers-reduced-motion: reduce) {
    .radar-sweep, .radar-dot { animation: none; }
}

/* ==========================================================================
   PANEL
   ========================================================================== */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1480px; margin: 0 auto; height: 64px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.session-pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px; background: var(--line-2); color: var(--muted); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.session-pill svg { width: 15px; height: 15px; }
.session-pill.is-warning { background: var(--amber-50); color: var(--amber); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 99px; border: 1px solid var(--line); background: #fff; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #1E88E5, #0A4FA0); color: #fff; font-weight: 700; font-size: 12.5px; }
.user-name { font-size: 13px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.container { max-width: 1480px; margin: 0 auto; padding: 28px 24px 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 800; }

/* Toast */
.toast { position: fixed; top: 80px; right: 24px; z-index: 60; display: flex; align-items: center; gap: 10px; max-width: 440px; padding: 12px 12px 12px 16px; border-radius: 12px; background: #fff; box-shadow: var(--shadow-lg); border-left: 4px solid; font-weight: 500; animation: toast-in .35s cubic-bezier(.16, 1, .3, 1); }
.toast--ok { border-color: var(--green); } .toast--ok > svg { color: var(--green); }
.toast--error { border-color: var(--rose); } .toast--error > svg { color: var(--rose); }
.toast-close { margin-left: auto; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; }
.toast.is-leaving { opacity: 0; transform: translateY(-8px); transition: .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } }

/* Tarjetas resumen */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat.is-active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(10, 102, 194, .12); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon--blue { background: var(--blue-50); color: var(--blue); }
.stat-icon--green { background: var(--green-50); color: var(--green); }
.stat-icon--amber { background: var(--amber-50); color: var(--amber); }
.stat-icon--red { background: var(--rose-50); color: var(--rose); }
.stat-body { display: flex; flex-direction: column; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* Barra de herramientas */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar-right { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; min-width: 0; }
.segmented { display: inline-flex; padding: 4px; background: #E8ECF2; border-radius: 12px; }
.segmented a { padding: 7px 18px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; transition: .15s; }
.segmented a.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.search { position: relative; flex: 0 1 340px; min-width: 0; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94A3B8; pointer-events: none; }
.search input { height: 40px; padding-left: 38px; box-shadow: var(--shadow-sm); }

.filter-wrap { position: relative; }
.filter-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 320px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px; animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.filter-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
.filter-head--sub { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.filter-options { display: grid; gap: 6px; }
.filter-options--row { display: flex; flex-wrap: wrap; }
.filter-chip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; text-align: left; transition: .15s; }
.filter-chip:hover { background: var(--line-2); }
.filter-chip.is-active { border-color: var(--blue); background: var(--blue-50); color: var(--blue); font-weight: 600; }
.filter-chip img { width: 28px; height: 28px; border-radius: 8px; object-fit: contain; }
.filter-chip em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); background: var(--line-2); padding: 1px 8px; border-radius: 99px; }
.filter-chip .chip-all { padding: 4px 0 4px 2px; }
.filter-chip--sm { width: auto; padding: 6px 12px; font-size: 12.5px; gap: 6px; }

.result-count { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; min-height: 19px; }

/* Tabla */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table thead th { position: sticky; top: 0; background: #F8FAFC; text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.data-table tbody tr.fila-dato { transition: background .12s; }
.data-table tbody tr.fila-dato:hover { background: #F8FAFF; }
.col-n { width: 48px; text-align: center !important; color: #94A3B8; font-weight: 600; font-size: 12.5px; }
.col-acciones { text-align: right !important; }
.grupo-row td { background: linear-gradient(90deg, #F1F5FB, #F8FAFC); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.grupo-head { display: flex; align-items: center; gap: 12px; }
.grupo-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; background: #fff; box-shadow: var(--shadow-sm); }
.grupo-nombre { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; }
.grupo-count { font-size: 12px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 2px 10px; border-radius: 99px; }
.cell-cliente, .cell-fecha { display: flex; flex-direction: column; line-height: 1.3; }
.cell-cliente strong, .cell-fecha strong { font-weight: 600; font-size: 13.5px; }
.cell-cliente span, .cell-fecha span { font-size: 12px; color: var(--muted); }
.placa { display: inline-block; font-family: var(--mono); font-weight: 700; font-size: 12.5px; letter-spacing: .06em; padding: 3px 9px; border-radius: 6px; background: #FFF9DB; border: 1px solid #F5D565; color: #4A3B00; }
.na { font-family: var(--font); font-size: 12px; color: #A0AEC0; font-style: italic; }
.actions { display: inline-flex; align-items: center; gap: 4px; }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--aldia { background: var(--green-50); color: var(--green); }
.status--porvencer { background: var(--amber-50); color: var(--amber); }
.status--vencido { background: var(--rose-50); color: var(--rose); }
.status--vencido i { animation: blink 1.6s ease-in-out infinite; }
.status--inactivo { background: var(--line-2); color: var(--muted); }
@keyframes blink { 50% { opacity: .3; } }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot--green { background: var(--green); } .dot--amber { background: var(--amber); } .dot--red { background: var(--rose); } .dot--blue { background: var(--blue); } .dot--gray { background: #94A3B8; }

.empty { text-align: center; padding: 56px 16px !important; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: #CBD5E1; display: block; margin: 0 auto 10px; }
.empty strong { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 2px; }

/* ---------- Modales (<dialog>) ---------- */
.modal { width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 18px; background: #fff; color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal[open] { display: flex; flex-direction: column; animation: modal-in .25s cubic-bezier(.16, 1, .3, 1); }
.modal::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal--lg { width: min(720px, calc(100% - 32px)); }
.modal--sm { width: min(420px, calc(100% - 32px)); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 24px 14px; }
.modal-head h3 { font-size: 19px; font-weight: 700; }
.modal-head .muted { font-size: 13px; margin-top: 2px; }
.modal-x { border: 0; background: var(--line-2); width: 34px; height: 34px; border-radius: 10px; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; flex-shrink: 0; }
.modal-x:hover { background: var(--line); color: var(--ink); }
.modal-body { padding: 6px 24px 8px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--line-2); background: #FBFCFE; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.note { display: flex; align-items: center; gap: 8px; margin: -4px 0 16px; padding: 10px 12px; border-radius: 10px; background: #F5F3FF; color: #5B21B6; font-size: 13px; }

.grupo-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.grupo-option input { position: absolute; opacity: 0; pointer-events: none; }
.grupo-option-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--ink-2); transition: .15s; height: 100%; }
.grupo-option-card img { width: 44px; height: 44px; border-radius: 11px; object-fit: contain; transition: transform .2s; }
.grupo-option-card:hover { border-color: #93C5FD; background: #FAFCFF; }
.grupo-option input:checked + .grupo-option-card { border-color: var(--blue); background: var(--blue-50); color: var(--blue); box-shadow: 0 0 0 3px rgba(10, 102, 194, .12); }
.grupo-option input:checked + .grupo-option-card img { transform: scale(1.06); }
.grupo-option input:focus-visible + .grupo-option-card { outline: 3px solid rgba(10, 102, 194, .35); outline-offset: 2px; }

.historial { background: #F8FAFC; border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-height: 120px; max-height: 50vh; overflow-y: auto; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; color: var(--ink-2); }
.historial.is-empty { color: #A0AEC0; font-style: italic; display: grid; place-items: center; }

.choice-list { display: grid; gap: 10px; margin-bottom: 16px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; transition: .15s; }
.choice-card strong { display: block; font-size: 14px; }
.choice-card small { color: var(--muted); font-size: 12.5px; }
.choice-card:hover { border-color: #93C5FD; }
.choice input:checked + .choice-card { border-color: var(--blue); background: var(--blue-50); box-shadow: 0 0 0 3px rgba(10, 102, 194, .12); }
.choice input:focus-visible + .choice-card { outline: 3px solid rgba(10, 102, 194, .35); outline-offset: 2px; }

.confirm { padding: 28px 26px 24px; text-align: center; }
.confirm h3 { font-size: 19px; font-weight: 700; margin: 14px 0 6px; }
.confirm .muted { font-size: 14px; }
.confirm-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--rose-50); color: var(--rose); }
.confirm-icon svg { width: 26px; height: 26px; }
.confirm-icon.is-warning { background: var(--amber-50); color: var(--amber); }
.confirm-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.confirm-actions .btn { flex: 1; }

/* Aviso de inactividad */
.countdown { position: relative; width: 120px; height: 120px; margin: 0 auto; }
.countdown svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.countdown-track { stroke: var(--line-2); stroke-width: 8; }
.countdown-bar { stroke: var(--amber); stroke-width: 8; stroke-dasharray: 326.73; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke .3s; }
.countdown-bar.is-critical { stroke: var(--rose); }
.countdown span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .topbar-inner { padding: 0 16px; }
    .container { padding: 20px 16px 48px; }
    .user-chip, .hide-sm, .brand-logo small { display: none; }
    .page-head h1 { font-size: 23px; }
    .stats { gap: 10px; }
    .stat { padding: 14px; gap: 10px; }
    .stat-icon { width: 38px; height: 38px; }
    .stat-value { font-size: 21px; }
    .toolbar-right { width: 100%; }
    .search { flex: 1 1 auto; }
    .filter-panel { width: min(320px, calc(100vw - 32px)); }
    .grid-2 { grid-template-columns: 1fr; }
    .grupo-picker { grid-template-columns: repeat(2, 1fr); }
    .toast { left: 16px; right: 16px; top: 74px; }
    .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   v3 · Clientes, colores por cliente, "sin vencimiento"
   ========================================================================== */
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 10px; flex-wrap: wrap; }
.segmented a { display: inline-flex; align-items: center; gap: 6px; }
.segmented a svg { width: 15px; height: 15px; }
.stats { grid-template-columns: repeat(5, 1fr); }
.stat-icon--gray { background: var(--line-2); color: var(--muted); }
.status--sinfecha { background: #F1F5F9; color: #475569; }
.status--sinfecha i { background: #94A3B8; }

/* Paleta sutil por cliente: --cc (acento) y --cc-bg (fondo muy suave) */
.cc-0 { --cc: #6366F1; --cc-bg: #F5F6FF; }
.cc-1 { --cc: #0EA5E9; --cc-bg: #F2FAFE; }
.cc-2 { --cc: #10B981; --cc-bg: #F1FBF7; }
.cc-3 { --cc: #F59E0B; --cc-bg: #FFFAF0; }
.cc-4 { --cc: #EC4899; --cc-bg: #FEF4F9; }
.cc-5 { --cc: #8B5CF6; --cc-bg: #F8F5FF; }
.cc-6 { --cc: #14B8A6; --cc-bg: #F0FBFA; }
.cc-7 { --cc: #F97316; --cc-bg: #FFF7F1; }
.cc-8 { --cc: #3B82F6; --cc-bg: #F3F7FF; }
.cc-9 { --cc: #84CC16; --cc-bg: #F7FCEE; }

.seccion-row td { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.cliente-row td { background: var(--cc-bg); box-shadow: inset 4px 0 0 var(--cc); border-top: 1px solid var(--line); }
.seccion-head { display: flex; align-items: center; gap: 12px; }
.seccion-titulo { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.seccion-titulo strong { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; white-space: normal; }
.seccion-titulo small { font-size: 12px; color: var(--muted); }
.seccion-acciones { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.seccion-acciones .btn svg { width: 14px; height: 14px; }
.cliente-avatar { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; background: var(--cc, var(--blue)); box-shadow: 0 4px 10px -4px var(--cc, var(--blue)); }
.data-table tbody tr.fila-dato td:first-child { box-shadow: inset 4px 0 0 var(--cc); }
.cliente-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cc); margin-right: 7px; vertical-align: 1px; }
.grupo-mini { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.grupo-mini img { width: 24px; height: 24px; border-radius: 7px; }
.fila-vacia td { padding: 14px 16px 14px 62px; box-shadow: inset 4px 0 0 transparent; }

/* Cliente fijo dentro del formulario de registro */
.cliente-fijo { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 18px; border-radius: 12px; background: var(--cc-bg, var(--blue-50)); border: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--cc, var(--blue)); }
.cliente-fijo small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.cliente-fijo strong { font-size: 15px; }
.cliente-fijo .link { margin-left: auto; }

@media (max-width: 1250px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .stats { grid-template-columns: repeat(2, 1fr); } .page-actions { width: 100%; } .page-actions .btn { flex: 1; } }

/* Página de actualización / importación */
.container--narrow { max-width: 980px; }
.paso { padding: 22px 24px; margin-bottom: 18px; }
.paso h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 6px; }
.paso-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #fff; font-size: 14px; }
.paso form { margin-top: 14px; }
.paso-accion { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.paso-sub { font-size: 15px; margin: 26px 0 4px; }
.paso .table-scroll { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; max-height: 420px; }
.resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.resumen div { padding: 14px; border-radius: 12px; background: var(--line-2); display: flex; flex-direction: column; }
.resumen strong { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.resumen span { font-size: 12.5px; color: var(--muted); }
.cell-cliente { max-width: 260px; white-space: normal; }
