/* ============================================================
   Portal de clientes · Grupo Cematel — canon «premium vivo»
   Navy corporativo + ámbar eléctrico · Archivo / Instrument Sans
   ============================================================ */

:root {
  /* Tinta y superficies */
  --ink: #1b2537;
  --ink-2: #46536a;
  --ink-3: #7d879b;
  --paper: #f6f5f1;
  --surface: #ffffff;
  --line: #e7e4dc;
  --line-2: #d9d5c9;

  /* Azules de marca (derivados de #193B73) */
  --navy-900: #0f2447;
  --navy-800: #16325f;
  --navy-700: #193b73;
  --navy-600: #24509b;
  --navy-500: #2f64be;
  --navy-100: #dfe8f6;
  --navy-50: #eff3fa;

  /* La chispa */
  --spark: #f7a81b;
  --spark-deep: #e08e00;
  --spark-soft: #fff2d9;
  --spark-ink: #142748;

  /* Dataviz (una sola tinta) y estados */
  --data: #2f64be;
  --ok: #22633f;      --ok-soft: #e2f1e8;
  --info: #1e4e96;    --info-soft: #e3ecf9;
  --mut: #5d6675;     --mut-soft: #ecedf1;

  --radius: 16px;
  --radius-s: 12px;
  --shadow-1: 0 1px 2px rgba(15, 36, 71, .05), 0 4px 14px rgba(15, 36, 71, .06);
  --shadow-2: 0 2px 4px rgba(15, 36, 71, .07), 0 12px 32px rgba(15, 36, 71, .12);

  --font-display: "Archivo", sans-serif;
  --font-body: "Instrument Sans", sans-serif;
  --font-mono: "Spline Sans Mono", monospace;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-stretch: 112%;
  letter-spacing: -0.015em;
}

.amount {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ---------- Enlaces y botones ---------- */

.lnk {
  color: var(--navy-600);
  font-weight: 600;
  font-size: .855rem;
  text-decoration: none;
}
.lnk:hover { color: var(--navy-800); text-decoration: underline; }

.btn-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: var(--navy-700);
  color: #fff;
  border: none;
  border-radius: var(--radius-s);
  padding: .78rem 1.35rem;
  font-family: var(--font-display);
  font-stretch: 108%;
  font-weight: 700;
  font-size: .95rem;
  box-shadow: 0 2px 10px rgba(15, 36, 71, .28);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn-main:hover {
  background: var(--navy-800);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15, 36, 71, .34);
}
.btn-main:active { transform: translateY(0); }

.btn-main--invert { background: #fff; color: var(--navy-800); box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.btn-main--invert:hover { background: var(--navy-50); color: var(--navy-900); }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--spark) 60%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Animación de entrada ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise .55s cubic-bezier(.2, .8, .3, 1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes rise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  .btn-spark, .stat, .card { transition: none !important; }
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(247, 168, 27, .16), transparent 60%),
    linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 58%, #1d478d 100%);
  color: #fff;
}

.circuit { position: absolute; inset: 0; width: 100%; height: 100%; }
.c-line { stroke: rgba(255, 255, 255, .13); stroke-width: 1.5; }
.c-node { fill: var(--spark); opacity: .75; }

.brand-inner {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2.5rem, 6vw, 5rem);
  max-width: 620px;
}

.brand-mark { display: inline-flex; align-items: center; gap: .7rem; }
.mark-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .16em;
  white-space: nowrap;
}
.brand-logo { width: min(230px, 58%); height: auto; align-self: flex-start; }
.topbar-logo { height: 26px; width: auto; display: block; }
.topbar-sep { width: 1px; height: 26px; background: rgba(255, 255, 255, .28); }

.brand-claim {
  margin: 2.2rem 0 1rem;
  font-size: clamp(2.5rem, 4.6vw, 3.9rem);
  font-weight: 750;
  line-height: 1.04;
  color: #fff;
}
.brand-claim em { font-style: italic; color: var(--spark); }

.brand-feats {
  list-style: none;
  margin: 1.8rem 0 0;
  padding: 0;
  display: grid;
  gap: .85rem;
  font-size: .98rem;
  color: rgba(255, 255, 255, .92);
}
.brand-feats li { display: flex; align-items: center; gap: .7rem; }
.feat-dot {
  width: 9px;
  height: 9px;
  background: var(--spark);
  transform: rotate(45deg);
  border-radius: 2px;
  flex: none;
}

.brand-foot a { color: rgba(255, 255, 255, .6); }
.brand-foot a:hover { color: #fff; }

.brand-foot {
  position: relative;
  padding: 1.4rem clamp(2.5rem, 6vw, 5rem);
  font-size: .8rem;
  color: rgba(255, 255, 255, .5);
  border-top: 1px solid rgba(255, 255, 255, .1);
  margin: 0;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 3rem 1.5rem;
  background: var(--paper);
}

.login-card {
  width: min(432px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-2);
  padding: 2.3rem 2.2rem 2rem;
}
.login-card h2 {
  font-size: 1.5rem;
  font-weight: 750;
  color: var(--navy-900);
  margin-bottom: .3rem;
}
.login-hint { color: var(--ink-3); font-size: .92rem; margin-bottom: 1.6rem; }

.fld { display: block; margin-bottom: 1.05rem; }
.fld span {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: .38rem;
}
.fld input, .fld textarea {
  width: 100%;
  padding: .72rem .9rem;
  font-size: .95rem;
  color: var(--ink);
  background: #fdfdfb;
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius-s);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fld input::placeholder, .fld textarea::placeholder { color: #b6bcc9; }
.fld input:focus, .fld textarea:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: 0 0 0 4px var(--navy-100);
}

.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem .8rem;
  margin: .2rem 0 1.35rem;
}
.chk { font-size: .855rem; color: var(--ink-2); display: flex; gap: .45rem; align-items: center; }
.chk input { accent-color: var(--navy-600); width: 15px; height: 15px; }

.login-sep {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: 1.5rem 0 .9rem;
  color: var(--ink-3);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.login-invite { font-size: .855rem; line-height: 1.55; color: var(--ink-3); margin: 0; }

.login-wrap.solo { grid-template-columns: 1fr; }

.form-error {
  background: #fdecec;
  border: 1px solid #f3c8c8;
  color: #a03030;
  border-radius: 10px;
  padding: .6rem .9rem;
  font-size: .855rem;
  margin-bottom: 1rem;
}
.fld-error { display: block; margin-top: .35rem; font-size: .8rem; color: #a03030; font-weight: 400; }

/* ============================================================
   APP · topbar, hero, stats, cards
   ============================================================ */

.page-app { background: var(--paper); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(90deg, var(--navy-900), var(--navy-700));
  color: #fff;
  box-shadow: 0 2px 12px rgba(15, 36, 71, .25);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.brand-mark.small { text-decoration: none; color: #fff; }
.brand-mark.small .mark-text { font-size: .74rem; }

.top-nav { display: flex; gap: .35rem; margin-right: auto; }
.top-nav a {
  color: rgba(255, 255, 255, .72);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  padding: .45rem .8rem;
  border-radius: 9px;
  white-space: nowrap;
  transition: color .12s ease, background .12s ease;
}
.top-nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.top-nav a.active { color: #fff; background: rgba(255, 255, 255, .12); box-shadow: inset 0 -2px 0 var(--spark); }

.user-chip { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--spark);
  color: var(--navy-900);
  font-family: var(--font-display);
  font-weight: 750;
  font-size: .78rem;
}
.user-name { font-size: .875rem; font-weight: 600; color: rgba(255, 255, 255, .9);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

.top-salir {
  flex: none;
  color: rgba(255, 255, 255, .88);
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
  padding: .38rem .95rem;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  transition: color .12s ease, background .12s ease, border-color .12s ease;
}
.top-salir:hover { color: var(--navy-900); background: #fff; border-color: #fff; }

/* --- Menú móvil: hamburguesa + drawer lateral --- */
.nav-burger {
  display: none;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.nav-burger span { display: block; width: 20px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .9); }
.nav-burger:active { background: rgba(255, 255, 255, .1); }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 36, 71, .45);
}
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 41;
  width: min(78vw, 300px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--navy-900), var(--navy-700));
  color: #fff;
  box-shadow: 4px 0 24px rgba(15, 36, 71, .35);
  transform: translateX(-102%);
  transition: transform .22s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}
.drawer-head img { height: 26px; }
.drawer-cerrar {
  padding: .2rem .5rem;
  background: none;
  border: 0;
  color: rgba(255, 255, 255, .8);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .8rem .7rem;
  overflow-y: auto;
}
.drawer-nav a {
  color: rgba(255, 255, 255, .78);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
  padding: .62rem .8rem;
  border-radius: 9px;
}
.drawer-nav a.active { color: #fff; background: rgba(255, 255, 255, .12); box-shadow: inset 3px 0 0 var(--spark); }
.drawer-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: 1rem 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, .14);
}
.drawer-user { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.drawer-empresa {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: .82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .9);
}
.drawer-empresa, .drawer-empresa small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-empresa small { font-size: .72rem; font-weight: 400; color: rgba(255, 255, 255, .55); }

.app-main { max-width: 1180px; margin: 0 auto; padding: 2rem 1.25rem 0; }

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
.hero-date {
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .35rem;
}
.hero h1 { font-size: clamp(1.7rem, 3vw, 2.25rem); font-weight: 750; color: var(--navy-900); margin: 0; }
.hero-sub { color: var(--ink-2); margin: .35rem 0 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 1.1rem 1.25rem 1rem;
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat-label {
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .5rem;
}
.stat-value {
  font-family: var(--font-display);
  font-stretch: 110%;
  font-size: 1.9rem;
  font-weight: 750;
  color: var(--navy-900);
  line-height: 1.1;
  margin-bottom: .55rem;
}
.stat-value.amount { font-family: var(--font-mono); font-stretch: 100%; font-size: 1.62rem; }
.stat-foot { font-size: .82rem; color: var(--ink-3); margin: 0; }

.grid-main {
  display: grid;
  grid-template-columns: 1.55fr .9fr;
  gap: 1rem;
  align-items: start;
}
.col-wide, .col-side { display: grid; gap: 1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 1.25rem 1.35rem 1.2rem;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.card-head h2 { font-size: 1.02rem; font-weight: 700; color: var(--navy-900); margin: 0; }
.card-note {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card-kpi { font-size: 1.05rem; font-weight: 600; color: var(--navy-700); white-space: nowrap; }
.card-foot { font-size: .8rem; color: var(--ink-3); margin: .9rem 0 0; line-height: 1.5; }

/* ---------- Sparkline ---------- */

.spark { display: block; width: 100%; height: auto; }
.spark-cursor { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.spark-pt { fill: var(--data); stroke: var(--surface); stroke-width: 2; opacity: 0; }
.spark-hit:hover .spark-cursor, .spark-hit:hover .spark-pt { opacity: 1; }

.spark-axis {
  display: flex;
  justify-content: space-between;
  padding: .35rem 2px 0;
  font-size: .68rem;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------- Barras ---------- */

.bars { display: grid; gap: .72rem; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(96px, 122px) 1fr auto;
  align-items: center;
  gap: .7rem;
}
.bar-label {
  font-size: .82rem;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  display: block;
  height: 10px;
  background: var(--paper);
  border-radius: 5px;
  overflow: hidden;
}
.bar-track i {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  min-width: 2px;
  background: var(--data);
  border-radius: 5px;
}
.bar-val { font-size: .82rem; color: var(--ink-2); min-width: 52px; text-align: right; }

.bars-mini .bar-row { grid-template-columns: 26px 1fr auto; }
.bars-mini .bar-track { height: 8px; }
.bars-mini .bar-track i { background: var(--navy-600); }

.kpi-347 { margin: -.2rem 0 .9rem; display: flex; align-items: baseline; gap: .6rem; }
.kpi-347 .amount { font-size: 1.7rem; font-weight: 600; color: var(--navy-900); }
.kpi-sub { font-size: .82rem; color: var(--ink-3); }

/* ---------- Tabla ---------- */

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  padding: 0 .6rem .55rem;
}
.tbl td {
  padding: .72rem .6rem;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  font-size: .9rem;
}
.tbl tbody tr { transition: background .12s ease; }
.tbl tbody tr:hover { background: var(--navy-50); }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .acts { text-align: right; white-space: nowrap; }
.tbl-title { display: block; font-weight: 600; color: var(--ink); text-decoration: none; }
a.tbl-title:hover { color: var(--navy-600); text-decoration: underline; }
.tbl-sub { display: block; font-size: .755rem; color: var(--ink-3); font-family: var(--font-mono); }
.tbl-dim { color: var(--ink-3); font-size: .84rem; white-space: nowrap; }

/* ---------- Chips de estado ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  padding: .2rem .68rem;
  border-radius: 999px;
  font-size: .755rem;
  font-weight: 700;
  white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-info { color: var(--info); background: var(--info-soft); }
.chip-ok { color: var(--ok); background: var(--ok-soft); }
.chip-mut { color: var(--mut); background: var(--mut-soft); }
.chip-warn { color: #8a5b00; background: var(--spark-soft); }
.chip-alerta { color: #b3261e; background: #fbe4e2; }

/* ---------- Botones de documento ---------- */

.doc-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .6rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.doc-btn:hover { background: var(--navy-50); border-color: var(--navy-100); color: var(--navy-700); }
.doc-btn-spark {
  font-family: var(--font-body);
  font-weight: 700;
  color: #8a5b00;
  background: var(--spark-soft);
  border-color: transparent;
}
.doc-btn-spark:hover { background: #ffe9bd; border-color: transparent; color: #6d4700; }

/* ---------- Lista de documentos ---------- */

.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .62rem 0;
  border-top: 1px solid var(--line);
}
.doc-list li:first-child { border-top: none; }
.doc-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--navy-50);
  color: var(--navy-600);
  flex: none;
}
.doc-body { flex: 1; min-width: 0; }
.doc-name {
  display: block;
  font-size: .865rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-date { display: block; font-size: .755rem; color: var(--ink-3); }

/* ---------- Banda CTA generador ---------- */

.cta-band {
  position: relative;
  overflow: hidden;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 1.9rem 2.1rem;
  border-radius: 20px;
  background:
    radial-gradient(600px 300px at 90% -20%, rgba(247, 168, 27, .22), transparent 60%),
    linear-gradient(120deg, var(--navy-900), var(--navy-700));
  color: #fff;
  box-shadow: var(--shadow-2);
}
.cta-band .circuit { opacity: .45; }
.cta-body { position: relative; flex: 1; min-width: 260px; }
.cta-band h2 { font-size: 1.45rem; font-weight: 750; margin-bottom: .4rem; color: #fff; }
.cta-band h2 em { font-style: italic; color: var(--spark); }
.cta-band p { margin: 0; color: rgba(255, 255, 255, .78); max-width: 62ch; line-height: 1.55; }
.cta-band .btn-spark { position: relative; }

/* ---------- Páginas de consulta ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.page-head h1 { font-size: 1.5rem; font-weight: 750; color: var(--navy-900); margin: 0; }
.page-sub { color: var(--ink-3); font-size: .875rem; margin: .3rem 0 0; }
.page-sub.mono { font-family: var(--font-mono); }

.filter-bar { display: flex; gap: .5rem; align-items: center; }
.filter-bar input[type="search"], .filter-bar select {
  padding: .42rem .7rem;
  font-size: .875rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: 10px;
}
.filter-bar input[type="search"] { min-width: 230px; }
.filter-bar input[type="search"]:focus, .filter-bar select:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: 0 0 0 4px var(--navy-100);
}
.filter-bar .doc-btn { padding: .48rem .8rem; }

.detail-head { align-items: flex-start; }
.detail-side { text-align: right; }
.detail-total {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--navy-900);
  margin: 0 0 .55rem;
}

.tbl tfoot .tbl-total td {
  border-top: 2px solid var(--navy-100);
  font-weight: 700;
  color: var(--navy-900);
}

.empty { padding: 1.6rem .5rem; text-align: center; color: var(--ink-3); font-size: .9rem; margin: 0; }

.grid-347 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }

a.stat { display: block; text-decoration: none; color: inherit; }

.stats-3 { grid-template-columns: repeat(3, 1fr); margin-bottom: 1rem; }
.stat-alerta { color: #b3261e !important; }
.mono { font-family: var(--font-mono); }

.avance { display: flex; align-items: center; gap: .6rem; justify-content: flex-end; }
.avance .bar-track { width: 140px; height: 8px; }
.avance .bar-val { font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
.avance-col { min-width: 100px; }
.avance-col .bar-track { display: block; height: 8px; }
.bar-track.ok i { background: #3d8b62; }

/* ---------- Generador marca blanca ---------- */

.gen-card .fld input, .gen-card .fld select { font-size: .9rem; }
.gen-margen {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .82rem;
  color: var(--ink-2);
  font-weight: 600;
}
.gen-margen input, .gen-tabla .gen-m {
  width: 74px;
  padding: .3rem .45rem;
  font-size: .85rem;
  text-align: right;
  border: 1.5px solid var(--line-2);
  border-radius: 8px;
  font-family: var(--font-mono);
}
.gen-tabla .gen-m { width: 68px; }
.gen-tabla .gen-m:focus, .gen-margen input:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px var(--navy-100);
}
.gen-linea.gen-off td { opacity: .38; }
.gen-linea.gen-off td:first-child { opacity: 1; }

.gen-propia {
  display: grid;
  grid-template-columns: 1fr 84px 108px 110px 40px;
  gap: .55rem;
  align-items: center;
  margin-bottom: .55rem;
}
.gen-propia input {
  padding: .45rem .6rem;
  font-size: .88rem;
  border: 1.5px solid var(--line-2);
  border-radius: 9px;
  min-width: 0;   /* los number no encogen por debajo de su ancho intrínseco */
  width: 100%;
}
.gen-propia .gp-cant, .gen-propia .gp-precio { text-align: right; font-family: var(--font-mono); }
.gen-propia input:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 3px var(--navy-100); }
.gen-propia .gp-imp { text-align: right; font-size: .88rem; }
.gen-propia .gp-quitar { justify-self: center; }

.gen-final {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.gen-total { text-align: right; }
.gen-total .detail-total { margin: 0; }

.doc-btn-borrar { color: #b3261e; }
.doc-btn-borrar:hover { background: #fbe4e2; border-color: #f3c2be; color: #8f1d17; }

.logo-actual { display: flex; align-items: center; gap: .8rem; margin-top: .5rem; }
.logo-actual img { max-height: 44px; max-width: 160px; background: var(--paper); border-radius: 8px; padding: 4px 8px; border: 1px solid var(--line); }

@media (max-width: 640px) {
  /* Móvil: descripción a línea completa; cantidad, precio, importe y quitar
     en una segunda fila (petición usuario 11-jul — antes importe/quitar
     desaparecían y los inputs desbordaban la tarjeta). */
  .gen-propia {
    grid-template-columns: 72px 1fr 88px 34px;
    grid-template-areas: "desc desc desc desc" "cant precio imp quitar";
  }
  .gen-propia .gp-desc { grid-area: desc; }
  .gen-propia .gp-cant { grid-area: cant; }
  .gen-propia .gp-precio { grid-area: precio; }
  .gen-propia .gp-imp { grid-area: imp; }
  .gen-propia .gp-quitar { grid-area: quitar; justify-self: end; }
}

/* --- Tarjeta «Su contacto en Cematel» (dashboard + página Contacto) --- */
.card-contacto {
  background: linear-gradient(165deg, #f7f9fd 0%, #eef3fa 100%);
  border: 1px solid #dfe7f2;
}
.contacto-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .9rem; }
.contacto-list li { display: flex; flex-direction: column; gap: .1rem; }
.contacto-rol { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.contacto-nombre { font-weight: 650; color: var(--ink); }
.contacto-vias { display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: .875rem; }
.contacto-vias a { color: var(--navy-700); text-decoration: none; }
.contacto-vias a:hover { text-decoration: underline; }

.app-foot {
  text-align: center;
  font-size: .8rem;
  color: var(--ink-3);
  padding: 2.4rem 0 1.6rem;
}
.app-foot a { color: var(--ink-3); }
.app-foot a:hover { color: var(--navy-700); }

/* ============================================================
   Navegación agrupada (escritorio) · tab bar (móvil) · seg-tabs
   — 03-ago-2026: la barra superior dejó de escalar al crecer
   las secciones; escritorio agrupa en 6 entradas y el móvil
   pasa a tab bar inferior (zona del pulgar, patrón app).
   ============================================================ */

.nav-grupo { position: relative; }
.nav-grupo > button {
  display: flex;
  align-items: center;
  gap: .35rem;
  color: rgba(255, 255, 255, .72);
  background: none;
  border: 0;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  padding: .45rem .8rem;
  border-radius: 9px;
  white-space: nowrap;
  cursor: pointer;
  transition: color .12s ease, background .12s ease;
}
.nav-grupo > button .caret {
  width: 7px;
  height: 7px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: .7;
}
.nav-grupo:hover > button,
.nav-grupo:focus-within > button { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-grupo.active > button { color: #fff; background: rgba(255, 255, 255, .12); box-shadow: inset 0 -2px 0 var(--spark); }

.nav-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 205px;
  padding: .45rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  z-index: 30;
}
/* Puente invisible para no perder el hover en el hueco de 6px */
.nav-menu::before { content: ""; position: absolute; top: -8px; left: 0; right: 0; height: 8px; }
.nav-grupo:hover .nav-menu,
.nav-grupo:focus-within .nav-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-menu a {
  display: block;
  color: var(--ink-2);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
  padding: .5rem .7rem;
  border-radius: 8px;
}
.nav-menu a:hover { color: var(--navy-700); background: var(--navy-50); }
.nav-menu a.active { color: var(--navy-700); background: var(--navy-50); box-shadow: inset 3px 0 0 var(--spark); }

/* --- Tab bar inferior (solo móvil) --- */
.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 18px rgba(15, 36, 71, .08);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar a, .tabbar button {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: .5rem 0 .55rem;
  background: none;
  border: 0;
  color: var(--ink-3);
  font: inherit;
  font-size: .66rem;
  font-weight: 650;
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  position: relative;
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar .active { color: var(--navy-700); }
.tabbar .active::after {
  content: "";
  position: absolute;
  top: 0;
  width: 26px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--spark);
}

/* --- Segmentado del grupo Pagos (Saldo · Avisos de giro · Su 347) --- */
.seg-tabs {
  display: inline-flex;
  gap: .25rem;
  margin: 0 0 1.2rem;
  padding: .3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
}
.seg-tabs a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 650;
  padding: .42rem 1rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .12s ease, background .12s ease;
}
.seg-tabs a:hover { color: var(--navy-700); background: var(--navy-50); }
.seg-tabs a.active { color: #fff; background: var(--navy-700); }

/* --- Página Avisos de giro --- */
.aviso-card { margin-bottom: 1.4rem; }
.aviso-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .9rem;
}
.aviso-titulo { font-size: 1.12rem; margin: 0; }
.aviso-sub { margin: .15rem 0 0; font-size: .875rem; color: var(--ink-3); }
.aviso-total { font-size: 1.35rem; font-weight: 700; color: var(--navy-700); margin: 0; }
.aviso-bloque { margin-bottom: 1.1rem; }
.aviso-bloque:last-of-type { margin-bottom: .4rem; }
.aviso-corresponde {
  margin: .7rem 0 .35rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.tbl-suave th { color: var(--ink-3); }
.importe-abono { color: #b3261e; }
.chip-info { background: var(--info-soft); color: var(--info); }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1080px) {
  .grid-main { grid-template-columns: 1fr; }
}

@media (max-width: 991px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .top-nav { display: none; }
  .nav-burger { display: flex; }
  .topbar-inner { gap: .9rem; }
  .user-chip { margin-left: auto; }
}

@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { min-height: 0; }
  .brand-inner { padding: 2.2rem 1.6rem 1.6rem; }
  .brand-claim { margin-top: 1.4rem; font-size: 2.1rem; }
  .brand-claim br { display: none; }
  .brand-feats { display: none; }
  .brand-foot { display: none; }
  .login-panel { padding: 1.8rem 1.25rem 2.5rem; }
}

@media (max-width: 640px) {
  /* Con el drawer, la marca queda en el logo: el rótulo cede su sitio a Salir. */
  .topbar .mark-text, .topbar .topbar-sep { display: none; }
  .spark-axis span:nth-child(even) { display: none; }
  .hero { align-items: flex-start; flex-direction: column; }
  .stat-value { font-size: 1.55rem; }
  .stat-value.amount { font-size: 1.3rem; }
  .cta-band { padding: 1.5rem 1.4rem; }
  .stats-3 { grid-template-columns: 1fr; }
  .filter-bar { width: 100%; }
  .filter-bar input[type="search"] { min-width: 0; flex: 1; }

  /* Tablas de listado como tarjetas apiladas (data-label en cada celda). */
  .tbl-cards thead { display: none; }
  .tbl-cards tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: .55rem .9rem;
    margin-bottom: .7rem;
    background: var(--surface);
  }
  .tbl-cards tbody tr:hover { background: var(--surface); }
  .tbl-cards td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    border-top: none;
    padding: .26rem 0;
    text-align: right;
  }
  .tbl-cards td::before {
    content: attr(data-label);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-3);
    text-align: left;
    flex: none;
  }
  .tbl-cards td.td-titulo { display: block; text-align: left; padding-bottom: .45rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
  .tbl-cards td.td-titulo::before { content: none; }
  .tbl-cards td.acts { justify-content: flex-end; }
}

/* ---------- Diálogo modal canon (<dialog> nativo — avisos/confirmaciones) */
dialog.dlg {
  border: 0; border-radius: 16px; padding: 0;
  width: min(30rem, calc(100vw - 2.4rem));
  box-shadow: 0 24px 60px rgba(15, 36, 71, .28);
}
dialog.dlg::backdrop { background: rgba(15, 36, 71, .45); }
.dlg-head {
  background: linear-gradient(120deg, #0F2447, #193B73);
  color: #fff; font-weight: 700; font-size: 1rem; padding: .85rem 1.2rem;
  border-bottom: 3px solid var(--amber, #F7A81B);
}
.dlg-body { padding: 1rem 1.2rem .2rem; color: var(--ink-2); font-size: .92rem; }
.dlg-body p { margin: 0 0 .7rem; }
.dlg-foot {
  display: flex; justify-content: flex-end; gap: .6rem;
  padding: .8rem 1.2rem 1.1rem; align-items: center;
}

/* Chip de usuario y bloque del drawer como enlace a «Mi perfil» (15-jul). */
a.user-chip, a.drawer-user { color: inherit; text-decoration: none; }
a.user-chip:hover .avatar, a.drawer-user:hover .avatar {
  box-shadow: 0 0 0 3px rgba(247, 168, 27, .5);
}

/* ---------- Toasts (django.contrib.messages) ---------- */
.toasts {
  position: fixed; top: 72px; right: 1rem; z-index: 1200;
  display: flex; flex-direction: column; gap: .5rem; max-width: min(26rem, 92vw);
}
.toast-msg {
  background: #fff; border-left: 4px solid var(--navy-600);
  border-radius: 10px; box-shadow: var(--shadow-2);
  padding: .75rem 1rem; font-size: .9rem; color: var(--ink);
  animation: rise .4s cubic-bezier(.2, .8, .3, 1);
  transition: opacity .5s ease, transform .5s ease;
}
.toast-msg.success { border-left-color: #2c7a4b; }
.toast-msg.error { border-left-color: #b3261e; }
.toast-msg.out { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.btn-main-sm { padding: .5rem .95rem; font-size: .85rem; border-radius: 10px; }

/* ── Pedir desde el portal (portal-pedidos) ─────────────────────────── */
.chip-bad { color: #b3261e; background: #fdecea; }
.pedir-add { display: flex; gap: .4rem; justify-content: flex-end; align-items: center; }
.pedir-add input[type="number"] { width: 5.5rem; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 8px; }
.btn-quitar { border: 0; background: none; color: #b3261e; font-size: 1.15rem; line-height: 1; cursor: pointer; padding: .2rem .45rem; border-radius: 6px; }
.btn-quitar:hover { background: #fdecea; }
.pedir-envio { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.pedir-envio-campos { display: flex; flex-wrap: wrap; gap: .8rem; flex: 1; }
.pedir-envio label { display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; color: var(--dim); }
.pedir-envio input, .pedir-envio select { padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; min-width: 11rem; }
.pedir-comentario { flex: 1; }
.pedir-comentario input { width: 100%; }
.pedir-nota { flex-basis: 100%; font-size: .8rem; color: var(--dim); margin: .25rem 0 0; }
.pedir-libre { margin-top: .9rem; }
.pedir-libre summary { cursor: pointer; color: var(--dim); font-size: .88rem; }
.pedir-libre-form { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.pedir-libre-form input[type="text"] { flex: 1; min-width: 14rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; }
.pedir-libre-form input[type="number"] { width: 6rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; }
.pedir-check { display: flex; gap: .5rem; align-items: flex-start; flex-basis: 100%; font-size: .85rem; color: var(--dim); cursor: pointer; }
.pedir-check input { margin-top: .2rem; }

@media (max-width: 767px) {
  /* La tab bar sustituye a la hamburguesa; el drawer se abre desde «Menú». */
  .tabbar { display: flex; }
  .nav-burger { display: none; }
  .app-main { padding-bottom: 84px; }
}
