/* =============================================================================
   SAGACE Digital — sistema de diseño (panel interno)
   Reproduce el rediseño de marca: barra lateral verde, tarjetas, KPIs, tablas,
   stepper, pestañas, modales. Tipografía Public Sans alojada localmente.
   Va en archivo aparte (no en <style>) porque el CSP prohíbe estilos en línea.
   ========================================================================== */

@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/publicsans-17936f.woff2') format('woff2');
}

:root {
  --brand: #154854;
  --brand-2: #1c5966;
  --brand-dark: #0f3841;
  --gold: #968c60;
  --gold-dark: #857a4f;

  --ink: #172326;
  --ink-2: #3f4c4f;
  --muted: #5d6a6d;
  --muted-2: #8a9698;
  --muted-3: #a4afb1;

  --line: #e7ecec;
  --line-2: #eef2f2;
  --line-3: #f1f4f4;
  --surface: #f5f7f7;
  --surface-2: #fafbfb;
  --card: #ffffff;

  --gold-tint: #f7f2e4;  --gold-ink: #7a6d38;
  --ok-tint: #e6f1ec;    --ok-ink: #2f7d5b;
  --info-tint: #e6eef0;  --info-ink: #35707f;
  --warn-tint: #fdf3e0;  --warn-ink: #9a6b1e;
  --err-tint: #fbeceb;   --err-ink: #b23b30;  --err-line: #f0d3d0;

  --radius: 14px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(21,72,84,.04);
  --shadow-pop: 0 24px 60px rgba(15,56,65,.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: 'Public Sans', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd8d8; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b3c0c0; background-clip: content-box; }

@keyframes sg-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes sg-pop { from { opacity: 0; transform: translateY(10px) scale(.98) } to { opacity: 1; transform: none } }

/* =========================================================================
   Estructura: barra lateral + área principal
   ========================================================================= */
.shell { display: flex; min-height: 100vh; width: 100%; }

.sidebar {
  width: 256px; flex: 0 0 256px; background: var(--brand); color: #fff;
  display: flex; flex-direction: column; padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.sidebar .brand .mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; letter-spacing: -.5px; color: #fff;
}
.sidebar .brand > span:last-child { display: block; line-height: 1.05; }
.sidebar .brand b { display: block; font-weight: 800; font-size: 17px; letter-spacing: -.3px; color: #fff; }
.sidebar .brand small { display: block; font-size: 11px; letter-spacing: 2px; color: #9fbcc2; font-weight: 600; }

.nav-label { font-size: 11px; letter-spacing: 1.5px; color: #7fa2a9; font-weight: 700; padding: 6px 10px 8px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #cfe0e3; font-size: 14.5px; font-weight: 600;
}
.nav a svg { width: 20px; height: 20px; flex: 0 0 auto; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: rgba(255,255,255,.14); color: #fff; }
.nav a.on .dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: #c9bd85; }

.sidebar .foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.user-chip .av {
  width: 36px; height: 36px; border-radius: 50%; background: var(--gold);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff;
}
.user-chip .who { flex: 1; line-height: 1.2; min-width: 0; }
.user-chip .who b { font-weight: 600; font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { font-size: 12px; color: #9fbcc2; }
.user-chip form { margin: 0; display: flex; }
.user-chip button { background: none; border: 0; color: #9fbcc2; cursor: pointer; display: flex; padding: 0; }
.user-chip button:hover { color: #fff; }
.user-chip svg { width: 18px; height: 18px; }

/* área principal */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  min-height: 66px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 12px 28px;
}
.topbar .heading { flex: 1; min-width: 0; }
.topbar .crumb { font-size: 12px; color: var(--muted-2); font-weight: 600; }
.topbar .title { font-size: 19px; font-weight: 700; letter-spacing: -.4px; }
.searchbox {
  display: flex; align-items: center; background: #fff; border: 1px solid #d5dcdc;
  border-radius: 10px; padding: 0 12px; height: 40px; width: 260px; max-width: 40vw;
  transition: border-color .15s, box-shadow .15s;
}
.searchbox:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(21,72,84,.1); }
.searchbox svg { width: 17px; height: 17px; color: var(--muted-2); flex: 0 0 auto; }
/* El input interno NO lleva su propio marco: el marco es el .searchbox. Se sube
   la especificidad para ganarle a la regla global input[type=text] (que si no,
   por orden de aparición, dibujaba un input dentro de otro). */
.searchbox input,
.searchbox input[type=text],
.searchbox input[type=search] {
  border: 0; background: transparent; outline: none; box-shadow: none;
  font: inherit; font-size: 14px; padding: 0 8px; width: 100%; height: 100%; color: var(--ink);
}
.searchbox input:focus { border: 0; box-shadow: none; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--brand); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .ping { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); border: 1.5px solid #fff; }

.content { flex: 1; padding: 28px; }
.wrap { max-width: 1180px; margin: 0 auto; animation: sg-fade .25s ease; }
.wrap-narrow { max-width: 460px; margin: 48px auto; animation: sg-fade .25s ease; }

/* =========================================================================
   Tarjetas / paneles
   ========================================================================= */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-pad { padding: 22px 24px; }
.card-head { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.card-head .t { font-weight: 700; font-size: 16px; }
.card-head .sub { font-size: 13px; color: var(--muted-2); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.muted { color: var(--muted-2); }
.mono { font-variant-numeric: tabular-nums; }

h1 { font-size: 24px; font-weight: 800; letter-spacing: -.6px; margin: 0 0 6px; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 10px; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 12px; }

/* =========================================================================
   Botones
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; background: var(--brand); color: #fff; text-decoration: none;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn.gold { background: var(--gold); } .btn.gold:hover { background: var(--gold-dark); }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid #dbe4e4; } .btn.secondary:hover { background: var(--surface-2); color: var(--brand); }
.btn.tertiary { background: none; color: var(--brand); } .btn.tertiary:hover { background: var(--line-3); }
.btn.danger { background: #fff; color: var(--err-ink); border: 1px solid var(--err-line); } .btn.danger:hover { background: var(--err-tint); }
.btn.sm { padding: 9px 15px; font-size: 13.5px; }
.btn:disabled, .btn.is-busy { background: #c3cccc; color: #fff; cursor: not-allowed; border: none; }
.btn.block { width: 100%; }

/* botón "···" de fila */
.more-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.more-btn:hover { background: var(--line-3); color: var(--brand); }
.more-btn svg { width: 18px; height: 18px; }

/* icono cuadrado de acción (descargar, adjuntar) */
.sq-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--brand); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.sq-btn:hover { background: var(--line-3); }
.sq-btn svg { width: 18px; height: 18px; }

/* =========================================================================
   Avisos flash
   ========================================================================= */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash-success { background: var(--ok-tint); color: var(--ok-ink); }
.flash-error { background: var(--err-tint); color: var(--err-ink); }
.flash-info { background: var(--info-tint); color: var(--info-ink); }

/* banner de cliente (dashboard) */
.alert-banner {
  display: flex; align-items: center; gap: 14px; color: #fff; border-radius: var(--radius-lg);
  padding: 18px 22px; margin-bottom: 22px; background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.alert-banner .ic { width: 42px; height: 42px; border-radius: 11px; background: rgba(201,189,133,.22); display: flex; align-items: center; justify-content: center; color: #e6dcae; flex: 0 0 auto; }
.alert-banner .ic svg { width: 22px; height: 22px; }
.alert-banner b { font-weight: 700; font-size: 16px; display: block; }
.alert-banner small { font-size: 13.5px; color: #bcd3d8; }

/* =========================================================================
   KPIs
   ========================================================================= */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: 18px; box-shadow: var(--shadow); }
.kpi .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi .ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.kpi .ic svg { width: 20px; height: 20px; }
.kpi .trend { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.kpi .value { font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.kpi .label { font-weight: 600; font-size: 14px; margin-top: 6px; }
.kpi .hint { font-size: 12.5px; color: var(--muted-2); margin-top: 2px; }
/* tintes de KPI */
.tint-gold { background: var(--gold-tint); color: var(--gold-ink); }
.tint-info { background: var(--info-tint); color: var(--info-ink); }
.tint-ok   { background: var(--ok-tint); color: var(--ok-ink); }
.tint-brand{ background: #e6eef0; color: var(--brand); }

/* accesos rápidos del panel */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.quick { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform .12s, box-shadow .2s, border-color .15s; }
.quick:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(21,72,84,.1); border-color: #cdd9d9; }
.quick .ic { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.quick .ic svg { width: 21px; height: 21px; }
.quick > div { flex: 1; min-width: 0; }
.quick b { display: block; font-weight: 600; font-size: 14.5px; }
.quick span { font-size: 12.5px; color: var(--muted-2); }
.quick > svg { width: 18px; height: 18px; color: var(--muted-2); flex: 0 0 auto; }

/* etiqueta de "Proyecto" (cotización aprobada y pagada) */
.tag-proyecto { display: inline-block; margin-left: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: #2f7d5b; background: #e6f1ec; padding: 2px 7px; border-radius: 6px; vertical-align: middle; }

/* =========================================================================
   Etiquetas de estado y rol
   ========================================================================= */
.badge { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; padding: 5px 12px; border-radius: 20px; }
.badge svg { width: 15px; height: 15px; }
.badge-revision   { background: var(--info-tint); color: var(--info-ink); }
.badge-cotizada   { background: var(--gold-tint); color: var(--gold-ink); }
.badge-aceptada   { background: var(--ok-tint); color: var(--ok-ink); }
.badge-finalizada { background: #ece7f5; color: #6b4ea6; }
.badge-rechazada  { background: var(--err-tint); color: var(--err-ink); }
.badge-expirada   { background: #eceeef; color: #6b7679; }

.rol { font-weight: 600; font-size: 12.5px; padding: 4px 11px; border-radius: 20px; }
.rol-admin       { background: #e6eef0; color: var(--brand); }
.rol-cliente     { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.rol-consultor   { background: var(--gold-tint); color: var(--gold-ink); }
.rol-asociacion  { background: var(--ok-tint); color: var(--ok-ink); }
.rol-facturacion { background: #f3e9f7; color: #7d4a9e; }

/* =========================================================================
   Filtros tipo "chip"
   ========================================================================= */
.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 20px;
  padding: 7px 15px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* =========================================================================
   Tabla de datos (grid)
   ========================================================================= */
.dtable { width: 100%; }
.dtable .thead, .dtable .trow {
  display: grid; gap: 12px; align-items: center; padding: 13px 22px;
}
.dtable .thead {
  background: var(--surface-2); border-bottom: 1px solid var(--line-2);
  font-size: 12px; font-weight: 700; color: var(--muted-2); letter-spacing: .3px; text-transform: uppercase;
}
.dtable .trow { border-bottom: 1px solid var(--line-3); }
.dtable .trow:last-child { border-bottom: 0; }
.dtable .trow:hover { background: var(--surface-2); }
.dtable a.folio { font-weight: 700; font-size: 14px; color: var(--gold-ink); }
.dtable .svc b { font-weight: 600; font-size: 14px; }
.dtable .svc span { display: block; font-size: 12.5px; color: var(--muted-2); }
.dtable .cell-r { text-align: right; }
.dtable .total { font-weight: 700; font-size: 14px; }
.sortable svg { width: 12px; height: 12px; opacity: .5; vertical-align: -1px; }

.row-av { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; color: #fff; }

/* estado vacío */
.empty { text-align: center; padding: 52px 24px; }
.empty .ic { width: 60px; height: 60px; border-radius: 16px; background: var(--line-3); display: inline-flex; align-items: center; justify-content: center; color: var(--brand); margin-bottom: 16px; }
.empty .ic svg { width: 30px; height: 30px; }
.empty b { font-weight: 700; font-size: 17px; display: block; }
.empty p { font-size: 14px; color: var(--muted-2); max-width: 360px; margin: 5px auto 0; }

/* =========================================================================
   Detalle de cotización
   ========================================================================= */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; font-weight: 600; margin-bottom: 14px; }
.back-link:hover { color: var(--brand); }
.back-link svg { width: 16px; height: 16px; }

.detail-head { padding: 22px 24px; display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.detail-head .info { flex: 1; min-width: 240px; }
.detail-head .folio { font-weight: 700; font-size: 13px; color: var(--gold); letter-spacing: .5px; }
.detail-head .name { font-size: 24px; font-weight: 800; letter-spacing: -.6px; }
.detail-head .sub { font-size: 14px; color: var(--muted-2); margin-top: 3px; }
.detail-head .cta { display: flex; gap: 10px; flex-wrap: wrap; }

/* stepper */
.stepper { padding: 8px 24px 24px; display: flex; align-items: flex-start; }
.stepper .step { flex: 1; display: flex; flex-direction: column; align-items: center; }
.stepper .bar { display: flex; align-items: center; width: 100%; }
.stepper .bar .line { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.stepper .bar .line.done { background: var(--brand); }
.stepper .dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; z-index: 1; border: 2px solid var(--line); background: #fff; color: var(--muted-2); }
.stepper .dot svg { width: 16px; height: 16px; }
.stepper .step.done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper .step.current .dot { background: #fff; border-color: var(--brand); color: var(--brand); }
.stepper .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted-2); margin-top: 8px; }
.stepper .step.done .lbl, .stepper .step.current .lbl { color: var(--ink); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; border: none; background: none;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none;
}
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.tab .count { background: var(--line-2); color: var(--muted); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.tab.on .count { background: #e6eef0; color: var(--brand); }

.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }

.money-box { display: flex; align-items: flex-end; gap: 14px; padding: 16px 18px; background: var(--gold-tint); border-radius: 12px; margin-bottom: 16px; }
.money-box .k { font-size: 12.5px; font-weight: 700; color: var(--gold-ink); letter-spacing: .5px; }
.money-box .v { font-size: 34px; font-weight: 800; letter-spacing: -1px; color: var(--brand); line-height: 1.1; }
.money-box .v small { font-size: 15px; font-weight: 600; color: var(--muted-2); }

.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini { padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; }
.mini .k { font-size: 12px; color: var(--muted-2); font-weight: 600; }
.mini .v { font-weight: 600; font-size: 14px; margin-top: 2px; }

.side-card .k { font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.person { display: flex; align-items: center; gap: 12px; }
.person .av { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.person b { font-weight: 600; font-size: 14.5px; display: block; }
.person span { font-size: 12.5px; color: var(--muted-2); }
.kv { display: flex; flex-direction: column; gap: 11px; font-size: 14px; }
.kv .row { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.kv .row svg { width: 16px; height: 16px; color: var(--muted-2); }
.dates { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.dates .row { display: flex; justify-content: space-between; }
.dates .row span:first-child { color: var(--muted-2); }
.dates .row span:last-child { font-weight: 600; }
.dates .row.due span:last-child { color: var(--gold); }

/* documentos */
.doc-row { display: flex; align-items: center; gap: 14px; padding: 15px 22px; border-bottom: 1px solid var(--line-3); }
.doc-row:last-child { border-bottom: 0; }
.doc-row:hover { background: var(--surface-2); }
.doc-row .fic { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.doc-row .fic svg { width: 20px; height: 20px; }
.doc-row .meta { flex: 1; min-width: 0; }
.doc-row .meta b { font-weight: 600; font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row .meta span { font-size: 12.5px; color: var(--muted-2); }
.fic-pdf { background: var(--err-tint); color: var(--err-ink); }
.fic-img { background: var(--ok-tint); color: var(--ok-ink); }
.fic-doc { background: var(--info-tint); color: var(--info-ink); }
.fic-xls { background: #e6f1ec; color: #2f7d5b; }
.fic-def { background: var(--line-3); color: var(--muted); }

/* conversación (chat) */
.chat { padding: 22px; display: flex; flex-direction: column; gap: 16px; background: var(--surface-2); }
.msg { display: flex; flex-direction: column; }
.msg.mine { align-items: flex-end; }
.msg .bubble { max-width: 74%; padding: 12px 15px; border-radius: 14px; }
.msg.theirs .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.mine .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg .who { font-size: 12px; font-weight: 700; margin-bottom: 3px; color: var(--brand); }
.msg.mine .who { color: #bcd3d8; }
.msg .txt { font-size: 14px; line-height: 1.5; }
.msg .time { font-size: 11.5px; color: var(--muted-3); margin-top: 4px; }
.chat-input { padding: 16px 22px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.chat-input textarea, .chat-input input[type=text] { flex: 1; border: 1px solid #d5dcdc; border-radius: 10px; padding: 11px 14px; font: inherit; font-size: 14px; outline: none; resize: none; }

/* timeline (historial) */
.tl { position: relative; padding-left: 4px; }
.tl .item { display: flex; gap: 16px; padding-bottom: 22px; }
.tl .item:last-child { padding-bottom: 0; }
.tl .rail { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; }
.tl .node { width: 36px; height: 36px; border-radius: 50%; background: var(--line-3); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.tl .node svg { width: 17px; height: 17px; }
.tl .item:not(:last-child) .line { width: 2px; flex: 1; background: var(--line); margin-top: 2px; }
.tl .txt { padding-top: 6px; }
.tl .txt b { font-weight: 600; font-size: 14px; }
.tl .txt span { font-size: 12.5px; color: var(--muted-2); display: block; margin-top: 2px; }

/* =========================================================================
   Formularios
   ========================================================================= */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; border: 1px solid #d5dcdc; border-radius: 10px; padding: 11px 13px;
  font: inherit; font-size: 14px; outline: none; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(21,72,84,.1); }
input[type=file] { border: 1px dashed #cfd8d8; background: var(--surface-2); padding: 14px; cursor: pointer; }
.field { margin-bottom: 14px; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { font-size: 12px; color: var(--muted-2); margin-top: 5px; }
.input-prefix { display: flex; align-items: center; border: 1px solid #d5dcdc; border-radius: 10px; padding: 0 13px; }
.input-prefix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(21,72,84,.1); }
.input-prefix span { color: var(--muted-2); font-weight: 600; }
.input-prefix input { border: none; box-shadow: none; padding: 11px 8px; }
.input-prefix input:focus { box-shadow: none; }

/* lista de checkboxes (asignados, asistentes) */
.check-list { display: grid; gap: 2px; max-height: 220px; overflow-y: auto; border: 1px solid #d5dcdc; border-radius: 10px; padding: 6px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.check-row:hover { background: var(--surface); }
.check-row input { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; }
.check-row small { margin-left: 6px; }

/* barra de filtros (tabla de cotizaciones) */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar select { width: auto; min-width: 150px; margin: 0; }
.filter-bar .searchbox { margin: 0; }

/* filas de requisitos de un servicio */
.req-list { display: grid; gap: 8px; }
.req-row { display: grid; grid-template-columns: 1fr 130px 130px 34px; gap: 8px; align-items: center; }
.req-row input, .req-row select { margin: 0; }
.req-row .sq-btn { width: 34px; height: 38px; font-size: 18px; line-height: 1; }
@media (max-width: 560px) { .req-row { grid-template-columns: 1fr 1fr; } .req-row .sq-btn { grid-column: 2; justify-self: end; } }

/* =========================================================================
   Modales
   ========================================================================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,56,65,.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; animation: sg-fade .18s ease;
}
.modal {
  background: #fff; border-radius: 18px; width: 520px; max-width: 100%; max-height: 90vh; overflow: auto;
  box-shadow: var(--shadow-pop); animation: sg-pop .22s ease;
}
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 14px; }
.modal-head .t { flex: 1; }
.modal-head .t b { font-weight: 700; font-size: 17px; display: block; }
.modal-head .t span { font-size: 13px; color: var(--muted-2); }
.modal-head .x { width: 34px; height: 34px; border-radius: 9px; border: none; background: var(--line-3); color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.modal-head .x svg { width: 18px; height: 18px; }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; }
.blockquote { margin: 0; padding: 12px 14px; background: var(--surface-2); border-left: 3px solid var(--line); border-radius: 0 8px 8px 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }

/* menú desplegable (acciones "···") */
.menu { position: relative; display: inline-block; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(15,56,65,.14); padding: 6px; min-width: 180px; z-index: 20;
  display: none; animation: sg-pop .15s ease;
}
.menu.open .menu-pop { display: block; }
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 11px;
  border: none; background: none; font: inherit; font-size: 13.5px; color: var(--ink); border-radius: 7px; cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--line-3); }
.menu-pop .danger { color: var(--err-ink); }
.menu-pop form { margin: 0; }
.menu-pop svg { width: 16px; height: 16px; }

/* =========================================================================
   Login / auth (columna centrada)
   ========================================================================= */
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 22px; }
.auth-brand .mark { width: 40px; height: 40px; border-radius: 11px; background: var(--gold); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 19px; color: #fff; }
.auth-brand b { font-weight: 800; font-size: 20px; letter-spacing: -.3px; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; left: -260px; z-index: 40; transition: left .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { left: 0; }
  .topbar .menu-toggle { display: inline-flex; }
  .content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .field-2, .mini-grid { grid-template-columns: 1fr; }
  .searchbox { display: none; }
  .dtable .thead { display: none; }
  .dtable .trow { grid-template-columns: 1fr !important; gap: 6px; }
}
.menu-toggle { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--brand); align-items: center; justify-content: center; cursor: pointer; }
.menu-toggle svg { width: 20px; height: 20px; }

/* Layouts de columnas para tablas (en el CSS, no en línea, para que siempre apliquen) */
.dtable.cols-cli   .thead, .dtable.cols-cli   .trow { grid-template-columns: 1.4fr 2fr 150px 120px; }
.dtable.cols-staff .thead, .dtable.cols-staff .trow { grid-template-columns: 1.2fr 2fr 1.2fr 140px 120px; }
.dtable.cols-users .thead, .dtable.cols-users .trow { grid-template-columns: 1.4fr 1.6fr 150px 44px; }
.dtable.cols-svc   .thead, .dtable.cols-svc   .trow { grid-template-columns: 1.8fr 1.1fr 130px 110px 44px; }
/* transacciones: la fecha compacta y el servicio con espacio para no partirse */
.dtable.tx-table   .thead, .dtable.tx-table   .trow { grid-template-columns: 92px 1.4fr 1.5fr 128px 120px; }
.dtable.cols-clients .thead, .dtable.cols-clients .trow { grid-template-columns: 1.7fr 1.6fr 120px 150px; }
.dtable.cols-2     .thead, .dtable.cols-2     .trow { grid-template-columns: 1fr 44px; }
@media (max-width: 720px) {
  .dtable[class*="cols-"] .trow { grid-template-columns: 1fr !important; }
}

/* pestañas tipo "pill" (admin) */
.tab-pill { display:inline-flex; align-items:center; gap:8px; padding:9px 15px; border-radius:9px;
  font-size:14px; font-weight:600; color:var(--muted); text-decoration:none; }
.tab-pill svg { width:17px; height:17px; }
.tab-pill:hover { background:var(--surface-2); color:var(--ink); }
.tab-pill.on { background:var(--brand); color:#fff; }
.tab-pill.on:hover { color:#fff; }

/* tarjetas de servicio (catálogo dentro del panel) */
.svc-card { padding: 20px; text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.svc-card:hover { border-color: var(--brand); box-shadow: 0 6px 20px rgba(21,72,84,.08); color: inherit; }
.svc-card .tag { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--gold-ink); font-weight: 700; margin-bottom: 6px; }
.svc-card h3 { margin: 0 0 8px; font-size: 16px; }
.svc-card p { font-size: 14px; margin: 0; flex: 1; }
.svc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.svc-card .price { color: var(--ink); font-weight: 700; font-size: 14px; }
.svc-card .pick { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--brand); }
.svc-card .pick svg { width: 16px; height: 16px; }
.side-card .tag { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--gold-ink); font-weight: 700; }

/* acceso rápido de demostración (solo fuera de producción) */
.demo-box { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line); }
.demo-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--gold-ink); margin-bottom: 10px; }
.demo-btns { display: flex; flex-direction: column; gap: 8px; }
.demo-btns form { margin: 0; }
.demo-btns .btn { margin-top: 0; }

/* iconos dentro de etiquetas de formulario: tamaño acotado */
label svg { width: 15px; height: 15px; vertical-align: -2px; color: var(--muted-2); }

/* checkout estilo PayPal (mockup) */
.paypal-box { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; max-width: 420px; }
.paypal-head { background: #003087; padding: 16px 20px; }
.pp-logo, .pp-btn-logo { font-weight: 800; font-size: 20px; font-style: italic; letter-spacing: -.5px; }
.pp-logo .pp-p { color: #fff; } .pp-logo .pp-pal { color: #99c3ff; }
.paypal-body { padding: 24px 20px; text-align: center; }
.pp-amount { font-size: 34px; font-weight: 800; letter-spacing: -1px; color: var(--ink); }
.pp-amount small { font-size: 15px; font-weight: 600; color: var(--muted-2); }
.pp-sub { color: var(--muted-2); font-size: 13.5px; margin: 2px 0 20px; }
.pp-btn { width: 100%; border: none; border-radius: 24px; background: #ffc439; padding: 13px; cursor: pointer; transition: background .15s; }
.pp-btn:hover { background: #f0b429; }
.pp-btn-logo .pp-p { color: #003087; } .pp-btn-logo .pp-pal { color: #0070ba; }
.pp-mock { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; font-size: 12px; color: var(--warn-ink); }
.pp-mock svg { width: 14px; height: 14px; }
