/* A2D2 · zona privada de felipelovera.com (CRM + proyectos)
   Misma identidad que el sitio: Raleway, casi negro, azul y verde lima. */
:root {
  --ink: #15181B; --ink-2: #262B30; --blue: #4A9ACA; --blue-d: #377397;
  --lime: #B6C833; --lime-d: #6D781E; --lime-l: #DCE596;
  --bg: #EEF3F8; --panel: #FFFFFF; --fg: #1F2328; --muted: #5C6670; --line: #D9DEE4;
  --tint: #E6EEF6; --track: #E3EAF2; --ok: #2E7D32; --warn: #9A5B00; --bad: #B3261E;
  --label: #5E6A10; --chip-bg: #EEF4C9;
  --font: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 12px;
}
:root[data-tema="oscuro"] {
  --bg: #0F1215; --panel: #181C20; --fg: #E9EDF1; --muted: #A2ACB6; --line: #2B3238;
  --tint: #20262C; --track: #262D34; --ok: #7BC67E; --warn: #F2B35B; --bad: #FF8A80;
  --label: #DCE596; --chip-bg: #2B3112; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --bg: #0F1215; --panel: #181C20; --fg: #E9EDF1; --muted: #A2ACB6; --line: #2B3238;
    --tint: #20262C; --track: #262D34; --ok: #7BC67E; --warn: #F2B35B; --bad: #FF8A80;
    --label: #DCE596; --chip-bg: #2B3112; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--fg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Encabezado */
.top { background: var(--ink); color: #fff; }
.top-in, .wrap { max-width: 1240px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.top-in { display: flex; flex-direction: column; gap: 14px; padding-block: 16px 0; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo { height: 28px; width: auto; display: block; }
.top-tools { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: #C3CCD5; flex-wrap: wrap; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(255,255,255,.22); background: transparent; color: #C3CCD5; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.icon-btn:hover { color: #fff; border-color: rgba(255,255,255,.5); }
.link-btn { background: none; border: 0; color: #C3CCD5; cursor: pointer; font-weight: 600; padding: 6px 4px; }
.link-btn:hover { color: #fff; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; overflow-x: auto; }
.nav a, .nav button { color: #C3CCD5; text-decoration: none; font-weight: 600; font-size: .92rem; padding: 12px 14px; border: 0; border-bottom: 3px solid transparent; background: none; cursor: pointer; white-space: nowrap; }
.nav a[aria-current="page"], .nav button[aria-selected="true"] { color: #fff; font-weight: 700; border-bottom-color: var(--lime); }
.stripe { height: 5px; display: flex; } .stripe i { display: block; }

/* Contenido */
.wrap { padding-block: 24px 48px; display: flex; flex-direction: column; gap: 22px; width: 100%; }
/* Una hoja dentro de la página (p. ej. las pestañas del CRM) ocupa todo el ancho de la página:
   sin esto, los márgenes automáticos la encogen al ancho de su contenido en pantallas grandes. */
.wrap .wrap { max-width: none; margin: 0; padding-left: 0; padding-right: 0; align-self: stretch; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.eyebrow { margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--label); }
h1 { margin: 4px 0 0; font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; line-height: 1.1; text-wrap: balance; }
h2 { margin: 0; font-size: 1.08rem; font-weight: 800; }
.note { margin: 0; font-size: .82rem; color: var(--muted); max-width: 78ch; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.filters label { display: flex; gap: 6px; align-items: center; }
select, input[type=text], input[type=email], input[type=number], input[type=date], input[type=url], textarea {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); min-height: 38px; }
textarea { resize: vertical; }

.xf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 40px; padding: 8px 12px; border-radius: 10px; background: var(--tint); font-size: .85rem; }
.xf > b { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-size: .76rem; font-weight: 700; padding: 5px 10px 5px 12px; cursor: pointer; }
:root[data-tema="oscuro"] .chip { background: var(--blue-d); }
.clear { border: 0; background: none; color: var(--blue); font-weight: 700; cursor: pointer; padding: 4px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--c, var(--ink)); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tile .lbl { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--label); }
.tile .num { font-size: 1.65rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .sub { font-size: .8rem; color: var(--muted); }
.tile .sub b { color: var(--fg); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-direction: column; gap: 6px; text-align: left; border: 0; background: transparent; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; color: var(--fg); width: calc(100% + 16px); }
button.row { cursor: pointer; }
button.row:hover { background: var(--tint); }
.row[aria-pressed="true"] { background: color-mix(in srgb, var(--blue) 14%, var(--panel)); box-shadow: inset 3px 0 0 var(--blue); }
.row.dim { opacity: .42; }
.row-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; font-size: .9rem; }
.row-top b { font-weight: 700; }
.row-top small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.val { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.val b { color: var(--fg); }
.track { position: relative; display: block; height: 12px; border-radius: 4px; background: var(--track); overflow: hidden; }
.seg { position: absolute; top: 0; bottom: 0; }
.ref { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--fg); }
.pill { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 9px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; line-height: 1.7; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.mute { color: var(--muted); }
.tag { font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--chip-bg); color: var(--label); white-space: nowrap; }

.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-weight: 700; font-size: .8rem; padding: 8px 12px; border-radius: 8px; cursor: pointer; min-height: 36px; }
.btn:hover { border-color: var(--blue); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
:root[data-tema="oscuro"] .btn.primary { background: var(--blue-d); border-color: var(--blue-d); }
.btn.win { border-color: var(--lime-d); color: var(--label); }
.btn.lose { color: var(--muted); }
.btn.conf { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

.curso { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.log { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; }
.log div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.prox { margin-left: auto; font-size: .78rem; color: var(--muted); }

.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.form .wide { grid-column: 1 / -1; }
.msg { font-size: .82rem; color: var(--muted); }
.msg.ok { color: var(--ok); } .msg.err { color: var(--bad); }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: top; }
thead th { background: var(--ink); color: #fff; font-weight: 700; position: sticky; top: 0; }
td.r, th.r { text-align: right; }
td.wrap-txt { white-space: normal; min-width: 220px; }

.det { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kv { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--tint); }
.kv span { font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kv b { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--fg); padding: 22px; width: min(640px, 92vw); }
dialog::backdrop { background: rgba(10, 12, 14, .55); }

.foot { background: var(--ink); color: #C3CCD5; font-size: .78rem; }
.foot .wrap { padding-block: 14px; flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.foot img { height: 20px; width: auto; }

/* Acceso */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ink); }
.gate-card { width: min(420px, 100%); background: #FFFFFF; color: #1F2328; border-radius: 16px; padding: 30px 28px; display: flex; flex-direction: column; gap: 16px; color-scheme: light;
  --panel: #FFFFFF; --fg: #1F2328; --muted: #5C6670; --line: #D9DEE4; --label: #5E6A10; --bad: #B3261E; }
.gate-card .logo-dark { height: 30px; width: auto; align-self: flex-start; }
.sso { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-weight: 700; cursor: pointer; }
.sso:hover { border-color: var(--blue); }
.sso.apple { background: #000; color: #fff; border-color: #000; }
.skeleton { color: transparent !important; background: var(--track); border-radius: 6px; }
@media (prefers-reduced-motion: no-preference) { .fade { animation: fade .25s ease-out; } @keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } } }
