/* HeadTeam CRM · identidad tomada de headteam.marketing:
   fondo negro con retícula vertical, texto blanco, azul eléctrico de marca,
   Plus Jakarta Sans para titulares y navegación, Manrope para el texto, esquinas rectas.
   Para cambiar el azul, toca --blue (relleno de botones) y --blue-text (enlaces sobre negro). */
:root {
  --bg: #0b0b0d;
  --grid: rgba(255, 255, 255, .035);
  --surface: #131317;
  --surface-2: #1a1a1f;
  --surface-3: #212127;
  --line: #25252c;
  --line-strong: #34343d;
  --ink: #f3f3f5;
  --muted: #a0a1ae;
  --faint: #70717e;
  --blue: #2251ea;
  --blue-hover: #3561f0;
  --blue-text: #829fff;
  --blue-soft: rgba(34, 81, 234, .16);
  --violet: #a597ff;
  --violet-soft: rgba(165, 151, 255, .14);
  --ok: #4fd69b;      --ok-soft: rgba(79, 214, 155, .12);
  --warn: #f3b850;    --warn-soft: rgba(243, 184, 80, .12);
  --danger: #ff7068;  --danger-soft: rgba(255, 112, 104, .12);
  --off: #8f909c;     --off-soft: rgba(143, 144, 156, .14);
  --f-display: "Plus Jakarta Sans", "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --r: 2px;
  --topbar-h: 64px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px);
  background-size: calc(100% / 6) 100%;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-text); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; }
h3 {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}
h3::after { content: "_"; color: var(--blue-text); }
p { margin: 0; }
code, .mono { font-family: var(--f-mono); font-size: .86em; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue-text); outline-offset: 2px; }
::selection { background: var(--blue); color: #fff; }

/* ---------- Marca ---------- */
.brand-logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; }
.brand-mark { flex: none; }
.brand-word { font-family: var(--f-display); font-size: 1.12rem; letter-spacing: -.01em; font-weight: 400; }
.brand-word b { font-weight: 800; }
.brand-tag {
  font-family: var(--f-display); font-size: .66rem; font-weight: 700; letter-spacing: .14em;
  color: var(--blue-text); border: 1px solid var(--line-strong); padding: 2px 6px 1px;
}

/* ---------- Barra superior ---------- */
.topbar { background: #000; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: stretch; min-height: var(--topbar-h); padding-left: 24px; }
.brand { display: flex; align-items: center; text-decoration: none; margin-right: 40px; }
.mainnav { display: flex; align-items: stretch; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
  display: flex; align-items: center; padding: 0 12px; color: #d6d7de; text-decoration: none; white-space: nowrap;
  font-family: var(--f-display); font-size: .82rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 2px solid transparent;
}
.mainnav a::after { content: "_"; }
.mainnav a:hover { color: #fff; }
.mainnav a[aria-current="page"] { color: #fff; border-bottom-color: var(--blue); }
.mainnav a[aria-current="page"]::after { color: var(--blue-text); }
.usermenu { display: flex; align-items: center; gap: 6px; padding: 0 16px; }
.usermenu form { margin: 0; }
.user { display: flex; align-items: center; gap: 8px; color: #d6d7de; text-decoration: none; padding: 6px 8px; font-size: .88rem; font-weight: 600; }
.user:hover, .user[aria-current="page"] { color: #fff; }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; background: var(--surface-3);
  border: 1px solid var(--line-strong); font-family: var(--f-display); font-size: .78rem; font-weight: 700; color: #fff;
}
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-size: .86rem; font-weight: 600; padding: 6px 8px; cursor: pointer; }
.linkbtn:hover { color: #fff; }
.topcta {
  display: flex; align-items: center; gap: 10px; padding: 0 28px; background: var(--blue); color: #fff; text-decoration: none;
  font-family: var(--f-body); font-size: .92rem; font-weight: 600; white-space: nowrap;
}
.topcta:hover { background: var(--blue-hover); }
.topcta span { font-size: .7rem; }
/* Con seis apartados el menú no cabe al lado del logo por debajo de ~1180 px: pasa a su propia fila */
@media (max-width: 1180px) {
  .topbar-in { flex-wrap: wrap; padding-left: 16px; }
  .brand { margin-right: auto; min-height: 56px; }
  .user-name { display: none; }
  .usermenu { padding: 0 8px; }
  .topcta { padding: 0 16px; }
  .mainnav { order: 3; flex-basis: 100%; border-top: 1px solid var(--line); margin-left: -16px; padding-left: 8px; min-height: 44px; }
}
@media (max-width: 460px) {
  .brand-tag { display: none; }
  .topcta { font-size: 0; gap: 0; padding: 0 18px; }
  .topcta::before { content: "+"; font-size: 1.4rem; font-weight: 400; }
  .topcta span { display: none; }
}

/* ---------- Estructura ---------- */
.page { max-width: 1320px; margin: 0 auto; padding-inline: 24px; padding-block: 28px 64px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 600px) { .page { padding-inline: 16px; padding-block: 20px 48px; } }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.pagehead a:not(.btn) { font-size: .9rem; font-weight: 600; text-decoration: none; }
.pagehead a:not(.btn):hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); padding: 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card > h2 + p { margin-top: -6px; }
.card.narrow { width: 100%; max-width: 460px; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Pantallas de acceso ---------- */
.is-auth {
  background-image:
    radial-gradient(60vw 40vw at 0% 0%, rgba(214, 222, 255, .16), transparent 60%),
    radial-gradient(55vw 45vw at 15% 30%, rgba(34, 81, 234, .35), transparent 65%),
    radial-gradient(50vw 40vw at 85% 20%, rgba(124, 96, 220, .28), transparent 65%),
    linear-gradient(to right, var(--grid) 1px, transparent 1px);
  background-size: auto, auto, auto, calc(100% / 6) 100%;
}
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding-inline: 16px; padding-block: 40px; }
.auth-logo { margin-bottom: 6px; }
.auth-logo .brand-word { font-size: 1.35rem; }
.auth .card { background: rgba(19, 19, 23, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 32px; }
.auth .card h1 { font-size: 1.6rem; }
.auth .flash { max-width: 460px; }

/* ---------- Mensajes ---------- */
.flash { padding: 12px 16px; border: 1px solid var(--line-strong); background: var(--surface); width: 100%; font-weight: 600; font-size: .92rem; }
.flash-ok { border-color: rgba(79, 214, 155, .45); background: var(--ok-soft); color: var(--ok); }
.flash-error { border-color: rgba(255, 112, 104, .45); background: var(--danger-soft); color: var(--danger); }
.flash-info { border-color: rgba(130, 159, 255, .45); background: var(--blue-soft); color: #dfe5ff; }
.error { color: var(--danger); background: var(--danger-soft); border-left: 3px solid var(--danger); padding: 10px 14px; font-size: .92rem; }
.warnbox, .notice-inline { color: var(--warn); background: var(--warn-soft); border-left: 3px solid var(--warn); padding: 10px 14px; font-size: .9rem; }
.notice-strong { border-color: var(--blue); box-shadow: inset 0 3px 0 var(--blue); }
.copyline code {
  display: inline-block; padding: 8px 12px; background: var(--surface-3); border: 1px solid var(--line-strong);
  font-size: 1rem; word-break: break-all; user-select: all; color: #fff;
}

/* ---------- Formularios ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; color: var(--muted); font-weight: 600; }
input, select, textarea {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--r); padding: 10px 12px; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #454550; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
input:disabled { background: var(--surface); color: var(--faint); }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
input[type="file"] { padding: 8px; cursor: pointer; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; border: 0; background: var(--surface-3); color: var(--ink); padding: 6px 12px; cursor: pointer; }
input.otp { font-family: var(--f-mono); font-size: 1.6rem; letter-spacing: .4em; text-align: center; padding: 12px; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; font-size: .92rem; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; margin: 0; flex: none; accent-color: var(--blue); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--f-body); font-size: .9rem; font-weight: 700;
  text-decoration: none; cursor: pointer; padding: 10px 18px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: transparent; color: var(--ink); white-space: nowrap; line-height: 1.3; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: #55555f; background: var(--surface-2); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(255, 112, 104, .5); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger-solid { background: #d93a31; border-color: #d93a31; color: #fff; }
.btn.small-btn { padding: 6px 12px; font-size: .82rem; }
.form fieldset { border: 1px solid var(--line); padding: 18px; margin: 0; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.form legend, .radios legend { font-family: var(--f-display); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; padding: 0 8px; }
.form legend::after, .radios legend::after { content: "_"; color: var(--blue-text); }
.form fieldset > legend + * { margin-top: -2px; }
.radios { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.radios legend { padding: 0; margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label.check { border: 1px solid var(--line-strong); padding: 7px 12px; font-size: .86rem; background: var(--surface-2); }
.checks label.check:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.hint { margin-top: -6px; font-size: .8rem; color: var(--faint); }
.linkrows { display: flex; flex-direction: column; gap: 8px; }
.linkrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { .linkrow { grid-template-columns: minmax(0, 1fr) auto; } .linkrow .lurl { grid-column: 1 / -1; grid-row: 2; } }
.formfoot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.pwfield { display: flex; gap: 8px; }
.narrowform { max-width: 760px; width: 100%; }
.steps { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: .92rem; }
.steps li::marker { color: var(--blue-text); font-weight: 700; }
.qr { align-self: center; background: #fff; padding: 14px; line-height: 0; }
.qr img { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
.manual summary { cursor: pointer; color: var(--blue-text); font-weight: 600; font-size: .9rem; }
.manual[open] summary { margin-bottom: 8px; }
.rolehelp { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 4px; }
.rolehelp strong { color: var(--ink); }

/* ---------- Filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters > label { flex: 0 1 210px; }
.filters > label.grow { flex: 1 1 280px; }
.filters select { width: 100%; }
.filters a.small { color: var(--muted); }
@media (max-width: 600px) { .filters > label { flex: 1 1 140px; } .filters > label.grow { flex-basis: 100%; } .filters .btn { flex: 1 1 100%; } }

/* ---------- Lista de clientes + ficha ---------- */
.split { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.list { background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; max-height: calc(100vh - var(--topbar-h) - 40px); overflow-y: auto; position: sticky; top: calc(var(--topbar-h) + 20px); }
@media (max-width: 900px) { .list { max-height: 60vh; position: static; } }
.list-count {
  position: sticky; top: 0; z-index: 1; background: var(--surface); font-family: var(--f-display); font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.list-empty { padding: 16px; color: var(--muted); font-size: .9rem; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; position: relative;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row[aria-current="true"] { background: var(--blue-soft); }
.row[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--blue); }
.row-name { font-family: var(--f-display); font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { grid-column: 1 / -1; color: var(--faint); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail { background: var(--surface); border: 1px solid var(--line); padding: 28px; display: flex; flex-direction: column; gap: 26px; min-width: 0; scroll-margin-top: calc(var(--topbar-h) + 16px); }
@media (max-width: 600px) { .detail { padding: 20px; } }
.detail-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 72px 0; color: var(--faint); text-align: center; }
.detail-empty .brand-mark { color: var(--line-strong); }
.dhead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.dtitle { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; min-width: 0; }
.dtitle h2 { font-size: 1.7rem; font-weight: 700; letter-spacing: -.025em; overflow-wrap: anywhere; }
.slug { color: var(--faint); background: var(--surface-2); border: 1px solid var(--line); padding: 2px 8px; font-size: .78rem; }
.dgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 36px; }
@media (max-width: 700px) { .dgrid { grid-template-columns: minmax(0, 1fr); } }
.block { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.blockhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 7px 16px; margin: 0; align-items: baseline; }
.kv dt { color: var(--faint); font-size: .84rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; font-size: .93rem; }
.kv a { text-decoration: none; }
.kv a:hover { text-decoration: underline; }
.copyable { user-select: all; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .8rem; font-weight: 600; border: 1px solid var(--line-strong); padding: 3px 10px; color: #dcdde4; }
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.links li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.links a { text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
.links a::after { content: " ↗"; font-size: .8em; color: var(--faint); }
.links a:hover { text-decoration: underline; }
.links .url { color: var(--faint); }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; color: #d6d7de; font-size: .92rem; }
.cred { display: flex; gap: 12px; align-items: flex-start; border: 1px dashed var(--line-strong); padding: 12px 14px; font-size: .9rem; color: #d6d7de; }
.cred svg { flex: none; margin-top: 3px; color: var(--blue-text); }
.dfoot { color: var(--faint); font-size: .8rem; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Etiquetas de estado y rol ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-display); font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; white-space: nowrap; line-height: 1.4; justify-self: start;
}
.pill::before { content: ""; width: 6px; height: 6px; background: currentColor; flex: none; }
.row .pill { justify-self: end; }
.st-activo { background: var(--ok-soft); color: var(--ok); }
.st-revisar { background: var(--warn-soft); color: var(--warn); }
.st-potencial { background: var(--violet-soft); color: var(--violet); }
.st-pausado, .st-baja { background: var(--off-soft); color: var(--off); }
.rol-admin { background: rgba(255, 255, 255, .1); color: #fff; }
.rol-editor { background: var(--blue-soft); color: var(--blue-text); }
.rol-lectura { background: var(--off-soft); color: var(--off); }

/* ---------- Tablas ---------- */
.tablewrap { overflow-x: auto; margin-inline: -1px; position: relative; }
.table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .9rem; }
.table th {
  text-align: left; font-family: var(--f-display); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--faint); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.table tbody tr:last-child td { border-bottom: 0; }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.act, .table td.act { text-align: right; }
.table td.act a { font-weight: 600; text-decoration: none; }
.table td.act a:hover { text-decoration: underline; }
.table tr.inactive td { opacity: .55; }
.table .sub { display: block; color: var(--faint); font-size: .82rem; margin-top: 2px; }
.table .cellname { font-weight: 600; color: var(--ink); }
.table .empty-row td { color: var(--muted); text-align: center; padding: 28px; }

/* Columnas */
.c-fecha { width: 150px; } .c-ip { width: 140px; } .c-rol { width: 150px; } .c-2fa { width: 120px; }
.c-acceso { width: 150px; } .c-usuario { width: 190px; } .c-acc { width: 90px; } .c-n { width: 110px; } .c-fila { width: 70px; } .c-res { width: 160px; }

/* Accesos */
.table.accesos col.a-acceso { width: 31%; } .table.accesos col.a-usuario { width: 31%; }
.table.accesos col.a-pass { width: 28%; } .table.accesos col.a-act { width: 10%; }
.table.accesos td { vertical-align: top; }
.ac-name { font-weight: 600; display: block; }
.ac-url { display: block; font-size: .8rem; margin-top: 3px; text-decoration: none; overflow-wrap: anywhere; color: var(--blue-text); }
.ac-url:hover { text-decoration: underline; }
.ac-val { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.ac-val .v { min-width: 0; overflow-wrap: anywhere; font-family: var(--f-mono); font-size: .84rem; }
.pw { white-space: nowrap; letter-spacing: .06em; }
.pw.revealed { flex: 1 1 100%; white-space: normal; overflow-wrap: anywhere; word-break: break-all; letter-spacing: 0; color: #fff; background: var(--surface-3); border: 1px solid var(--line-strong); padding: 4px 8px; user-select: all; }
.linkish {
  background: none; border: 1px solid var(--line-strong); padding: 2px 8px; font: inherit; font-family: var(--f-body);
  font-size: .74rem; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; flex: none;
}
.linkish:hover { color: #fff; border-color: var(--blue); background: var(--blue-soft); }
.linkish:disabled { opacity: .5; cursor: wait; }
.acnotes { margin-top: 6px; }
.acnotes summary { cursor: pointer; color: var(--faint); font-size: .78rem; font-weight: 600; }
.acnotes .notes { margin-top: 6px; font-size: .84rem; padding: 8px 10px; background: var(--surface-2); border-left: 2px solid var(--line-strong); }
.ac-intro { color: var(--faint); font-size: .82rem; }

/* Tablas en móvil: cada fila pasa a ser una tarjeta con etiquetas */
@media (max-width: 720px) {
  .table.tstack, .table.tstack tbody, .table.tstack tr, .table.tstack td { display: block; width: 100%; }
  .table.tstack thead, .table.tstack colgroup { display: none; }
  .table.tstack tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table.tstack tr:last-child { border-bottom: 0; }
  .table.tstack td { border: 0; padding: 4px 0; text-align: left; }
  .table.tstack td[data-label]::before {
    content: attr(data-label); display: block; font-family: var(--f-display); font-size: .66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-bottom: 2px;
  }
  .table.tstack td.act { text-align: left; padding-top: 8px; }
  .table.tstack tbody tr:hover td { background: none; }
}

/* ---------- Resumen de importación ---------- */
.summary { display: flex; flex-wrap: wrap; gap: 8px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Ajustes finos */
input.mono { font-size: .9rem; letter-spacing: .01em; }
.table td.mono { white-space: nowrap; }
.table .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-fecha { width: 172px; }
.card ul.small { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 8px; color: #cfd0d8; }
.card ul.small code { font-size: .82em; color: #fff; }
@media (max-width: 900px) { .detail.is-empty { display: none; } }

/* ---------- Mantenimiento ---------- */
.navbadge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 7px;
  background: var(--warn); color: #111; font-size: .68rem; font-weight: 800; letter-spacing: 0; line-height: 1; order: 2;
}
.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 14px 18px; text-decoration: none;
  background: var(--warn-soft); border: 1px solid rgba(243, 184, 80, .35); border-left: 3px solid var(--warn); color: var(--ink);
}
.banner:hover { background: rgba(243, 184, 80, .18); }
.banner-k { font-family: var(--f-display); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--warn); }
.banner-t { font-weight: 700; flex: 1; min-width: 200px; }
.banner-go { font-size: .86rem; font-weight: 700; color: var(--warn); }

.yearnav { display: flex; align-items: center; border: 1px solid var(--line-strong); }
.yearnav a, .yearnav span { display: grid; place-items: center; width: 40px; height: 40px; text-decoration: none; color: var(--ink); font-size: 1.2rem; }
.yearnav a:hover { background: var(--surface-2); }
.yearnav .disabled { color: var(--line-strong); }
.yearnav strong { font-family: var(--f-display); font-size: 1rem; padding: 0 14px; border-inline: 1px solid var(--line-strong); line-height: 40px; }

.eyebrow { font-family: var(--f-display); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--blue-text); margin-bottom: 4px; }
.mes-actual { gap: 18px; }
.mes-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.mes-head h2 { font-size: 1.5rem; letter-spacing: -.02em; }
.progress { display: flex; align-items: center; gap: 12px; min-width: 220px; flex: 0 1 320px; }
.progress-num { font-family: var(--f-display); font-size: .95rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-num b { color: #fff; font-size: 1.3rem; }
.progress-bar { flex: 1; height: 8px; background: var(--surface-3); position: relative; }
.progress-bar span { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ok); transition: width .4s; }
.allgood { color: var(--ok); font-weight: 700; }
.pendlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.pendlist li { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr); gap: 10px 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pend-name { font-family: var(--f-display); font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.pend-name:hover { text-decoration: underline; }
.pend-form { display: flex; gap: 8px; align-items: center; min-width: 0; }
.pend-form input { padding: 8px 10px; font-size: .88rem; }
.pend-form .btn { flex: none; }
@media (max-width: 700px) {
  .pendlist li { grid-template-columns: minmax(0, 1fr); }
  .pend-form { flex-wrap: wrap; }
  .pend-form .btn { flex: 1 1 100%; }
}
.hechos summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9rem; }
.hechos ul { margin: 10px 0 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 6px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.mchip {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; width: 100%; min-height: 28px; padding: 0 6px;
  font-family: var(--f-display); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.legend .mchip { width: auto; padding: 0 10px; }
.m-hecho { background: var(--ok-soft); color: var(--ok); }
.m-pendiente { background: var(--warn-soft); color: var(--warn); }
.m-atrasado { background: var(--danger-soft); color: var(--danger); }
.m-futuro, .m-na { background: transparent; color: var(--faint); border: 1px dashed var(--line); }
.mcell { display: block; margin: 0; }
.mcell button { all: unset; display: block; width: 100%; cursor: pointer; }
.mcell button:focus-visible { outline: 2px solid var(--blue-text); outline-offset: 1px; }
.mcell button:hover .m-pendiente, .mcell button:hover .m-atrasado { background: var(--ok-soft); color: var(--ok); }
.mcell button:hover .m-pendiente span, .mcell button:hover .m-atrasado span { visibility: hidden; position: relative; }
.mcell button:hover .m-pendiente span::after, .mcell button:hover .m-atrasado span::after { content: "Marcar"; visibility: visible; position: absolute; left: 50%; transform: translateX(-50%); }
.mcell button:hover .m-hecho { outline: 1px solid var(--ok); }

.gridwrap { overflow-x: auto; margin-inline: -1px; position: relative; }
.mgrid { width: 100%; min-width: 980px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .88rem; }
.mgrid th, .mgrid td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.mgrid thead th { font-family: var(--f-display); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); padding-block: 10px; border-bottom-color: var(--line-strong); }
.mgrid .mg-name { width: 200px; text-align: left; padding-left: 0; padding-right: 12px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.mgrid tbody .mg-name { font-family: var(--f-display); font-weight: 600; font-size: .9rem; }
.mgrid tbody .mg-name a { color: var(--ink); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgrid tbody .mg-name a:hover { text-decoration: underline; }
.mgrid .mg-act { width: 70px; text-align: right; padding-right: 0; }
.mgrid .is-now { background: rgba(34, 81, 234, .08); }
.mgrid thead th.is-now { color: var(--blue-text); box-shadow: inset 0 -2px 0 var(--blue); }
.mgrid tbody tr:last-child th, .mgrid tbody tr:last-child td { border-bottom: 0; }
.mgrid tbody tr:hover th, .mgrid tbody tr:hover td:not(.is-now) { background-color: var(--surface-2); }
.mgrid tbody tr:hover td.is-now { background-color: rgba(34, 81, 234, .14); }

.mstrip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.mstrip-m { display: grid; place-items: center; height: 30px; font-family: var(--f-display); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.mstrip-m.is-now { box-shadow: inset 0 -2px 0 var(--blue); }
@media (max-width: 520px) { .mstrip { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.toggle-line { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.kv-wide { grid-template-columns: 130px minmax(0, 1fr); }
.warn-txt { color: var(--warn); }
.warn-txt a { color: var(--warn); }
.avisos-form { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 600px) { .mgrid { min-width: 860px; } .mgrid .mg-name { width: 130px; } .mgrid tbody .mg-name { font-size: .84rem; } }

/* ---------- Caducidades ---------- */
.cad-caducado, .cad-urgente { background: var(--danger-soft); color: var(--danger); }
.cad-proximo { background: var(--warn-soft); color: var(--warn); }
.cad-ok { background: var(--off-soft); color: var(--off); }
.banner-danger { background: var(--danger-soft); border-color: rgba(255, 112, 104, .35); border-left-color: var(--danger); }
a.banner-danger:hover { background: rgba(255, 112, 104, .18); }
.banner-danger .banner-k, .banner-danger .banner-go { color: var(--danger); }
.banner + .banner { margin-top: -8px; }
.sub-pill { display: block; margin-top: 4px; }
.cadtable col.k-fecha { width: 170px; } .cadtable col.k-cliente { width: 26%; }
.cadtable col.k-act { width: 190px; } .cadtable col.k-act-s { width: 80px; }
.cadtable td { vertical-align: top; }
.cadtable .sub { white-space: normal; overflow: visible; }
.cad-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px 12px; }
.cad-acts form { margin: 0; }
@media (max-width: 720px) { .cad-acts { justify-content: flex-start; } }

/* ---------- App instalable (PWA) ---------- */
.pwa-ok { color: var(--ok); font-weight: 700; }
[data-pwa] [hidden] { display: none !important; }
/* Instalada (sin barra del navegador): respeta la muesca y la barra de estado del móvil */
@media (display-mode: standalone) {
  .topbar-in { padding-left: max(16px, env(safe-area-inset-left)); padding-right: env(safe-area-inset-right); }
  .page { padding-bottom: max(48px, env(safe-area-inset-bottom)); }
}
