/* Portal de clientes · Nexum Studio. Marca: #DFF646 con negro (logo). Modo claro y oscuro. */
:root {
  --brand: #DFF646;
  --brand-ink: #000000;
  --bg: #F6F6F1;
  --surface: #FFFFFF;
  --surface-2: #EFEFE8;
  --line: #E2E2D9;
  --text: #121211;
  --muted: #66665E;
  --ok: #1E7B34;
  --ok-bg: #E4F4E7;
  --warn: #8A5D00;
  --warn-bg: #FBF0D4;
  --bad: #B42318;
  --bad-bg: #FCE8E6;
  --info: #3D4500;
  --info-bg: #F4FBC9;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0E0D; --surface: #171716; --surface-2: #20201E; --line: #2C2C29;
    --text: #EDECE5; --muted: #9C9B91;
    --ok: #7EE787; --ok-bg: rgba(126, 231, 135, .12); --warn: #F2CC60; --warn-bg: rgba(242, 204, 96, .12);
    --bad: #FF7B72; --bad-bg: rgba(255, 123, 114, .12); --info: #DFF646; --info-bg: rgba(223, 246, 70, .1);
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0E0D; --surface: #171716; --surface-2: #20201E; --line: #2C2C29;
  --text: #EDECE5; --muted: #9C9B91;
  --ok: #7EE787; --ok-bg: rgba(126, 231, 135, .12); --warn: #F2CC60; --warn-bg: rgba(242, 204, 96, .12);
  --bad: #FF7B72; --bad-bg: rgba(255, 123, 114, .12); --info: #DFF646; --info-bg: rgba(223, 246, 70, .1);
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { border-radius: 12px; opacity: .7; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: var(--brand-ink); font-weight: 650;
  text-decoration: none; cursor: pointer; transition: filter .15s; }
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.field { display: block; margin: 0 0 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type="email"], input[type="search"], select {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
}
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible, .seg button:focus-visible, .tabs a:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.msg { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.err { background: var(--bad-bg); color: var(--bad); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Ingreso ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-weight: 700; font-size: 17px; }
.auth-brand img { width: 36px; height: 36px; border-radius: 9px; }
.auth h1 { font-size: 22px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.01em; }
.auth p { color: var(--muted); margin: 0 0 20px; }
.auth .foot { margin: 20px 0 0; font-size: 13px; }

/* ---------- Estructura ---------- */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.top-in, .tabs-in, main { max-width: 1120px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.top-in { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; flex: none; }
.logo img { width: 32px; height: 32px; border-radius: 8px; }
.logo span { display: none; }
.acc { flex: 1; min-width: 0; }
.acc select { min-height: 40px; max-width: 320px; font-weight: 600; }
.acc .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 48px; min-width: 240px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, .15); }
.menu-pop[hidden] { display: none; }
.menu-pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 13px; color: var(--muted); word-break: break-all; }
.menu-pop .who b { display: block; color: var(--text); font-size: 14px; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 10px; border-radius: 8px; border: 0; background: none;
  cursor: pointer; text-decoration: none; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.tabs { border-top: 1px solid var(--line); }
.tabs-in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs-in::-webkit-scrollbar { display: none; }
.tabs a { position: relative; padding: 12px 12px; white-space: nowrap; text-decoration: none; color: var(--muted); font-weight: 550; }
.tabs a[aria-current="page"] { color: var(--text); }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
main { padding-top: 22px; padding-bottom: 48px; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.head h1 { font-size: 24px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Selector segmentado ---------- */
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; color: var(--muted); font-weight: 550; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---------- Tarjetas ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 30px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat.accent { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.stat.accent .label, .stat.accent .hint { color: rgba(0, 0, 0, .65); }
.section { margin-top: 22px; }
.section h2 { font-size: 16px; margin: 0 0 10px; }
.note { font-size: 14px; color: var(--muted); }
.links { display: grid; gap: 10px; }
.link-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; }
.link-card b { display: block; }
.link-card span { color: var(--muted); font-size: 14px; }
.link-card svg { width: 18px; height: 18px; flex: none; color: var(--muted); }

/* ---------- Listas ---------- */
.list { display: grid; gap: 10px; }
.item { display: grid; gap: 6px; }
.item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.item-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-top time { color: var(--muted); font-size: 13px; flex: none; }
.item .text { color: var(--muted); font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.item .row .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }
.ext { font-size: 14px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.ext:hover { text-decoration: underline; }
.ext svg { width: 14px; height: 14px; }
.table .ext { white-space: nowrap; }
.pager .icon-btn:disabled { opacity: .35; cursor: default; }
.day { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
.day:first-child { margin-top: 0; }
.slot { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; }
.slot .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.slot .time small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }

/* ---------- Leads ---------- */
.filters { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }
.count { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.table tr:last-child td { border-bottom: 0; }
.table .summary { color: var(--muted); max-width: 360px; }
.table-card { padding: 0; overflow: hidden; }
@media (max-width: 759px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 2px 0; }
  .table td[data-label]:not(.main)::before { content: attr(data-label) ": "; color: var(--muted); font-size: 13px; }
  .table td.main { font-weight: 650; font-size: 15px; }
  .table .summary { max-width: none; }
}

/* ---------- Estados ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }
.skeleton { height: 92px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.error { background: var(--bad-bg); color: var(--bad); border-radius: var(--radius); padding: 14px 16px; }
.pager { display: flex; align-items: center; gap: 8px; }
.pager .label { font-weight: 650; min-width: 0; text-align: center; flex: 1; }
.report-head { display: grid; gap: 12px; margin-bottom: 16px; }

@media (min-width: 640px) {
  .logo span { display: inline; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters { grid-template-columns: 2fr 1fr 1fr; }
  .links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-head { grid-template-columns: auto 1fr; align-items: center; }
}
@media (min-width: 960px) {
  .top-in, .tabs-in, main { padding-left: 24px; padding-right: 24px; }
  .head h1 { font-size: 28px; }
}
