/* ============================================================
   SD HUESCA · Gestión Comercial — Sistema visual azulgrana
   ============================================================ */

:root {
  /* Marca */
  --navy:        #0E2148;
  --navy-800:    #122A5C;
  --navy-700:    #1B3A78;
  --navy-600:    #254990;
  --navy-050:    #EEF2FB;
  --grana:       #8E1B2E;
  --grana-700:   #7A1626;
  --grana-050:   #FBEEF0;
  --sanjorge:    #D7263D;   /* cruz de San Jorge */
  --gold:        #E8B23A;   /* franja Aragón, puntual */
  --laurel:      #1F7A52;   /* verde laurentino / éxito */
  --laurel-050:  #E9F4EE;

  /* Neutros cálidos */
  --ink:         #161B26;
  --ink-2:       #3A4254;
  --muted:       #6B7385;
  --muted-2:     #99A0B0;
  --line:        #E3E6EE;
  --line-2:      #EDEFF5;
  --surface:     #FFFFFF;
  --bg:          #F4F5F9;
  --bg-tint:     #F7F8FC;

  /* Estados pipeline */
  --st-prospec:  #8A93A6;
  --st-contacto: #2C7BE5;
  --st-propuesta:#7A5AE0;
  --st-negocia:  --gold;
  --st-ganado:   #1F7A52;
  --st-perdido:  #C0392B;

  --radius:   10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(14,33,72,.06), 0 1px 3px rgba(14,33,72,.05);
  --shadow:    0 4px 16px rgba(14,33,72,.10);
  --shadow-lg: 0 18px 48px rgba(14,33,72,.22);

  --sidebar-w: 248px;
  --topbar-h: 60px;

  --font: 'Archivo', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* densidad (ajustable por Tweaks) */
  --row-h: 46px;
  --pad: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
}
#root { height: 100%; }

.density-compact { --row-h: 38px; --pad: 14px; }
.density-comfy   { --row-h: 54px; --pad: 26px; }

h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--navy); color: #fff; }

.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.tnum { font-variant-numeric: tabular-nums; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 100%;
  height: 100%;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--navy);
  color: #C9D2E8;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.sidebar::before { /* franja inclinada azulgrana, guiño al escudo */
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(118deg, transparent 0 64%, rgba(142,27,46,.55) 64% 73%, transparent 73%);
  opacity: .5; pointer-events: none;
}
.sidebar::after { /* cruz de San Jorge marca de agua */
  content: "";
  position: absolute; right: -40px; bottom: 60px;
  width: 180px; height: 180px;
  background:
    linear-gradient(rgba(255,255,255,.04) 0 0) center / 38px 100% no-repeat,
    linear-gradient(rgba(255,255,255,.04) 0 0) center / 100% 38px no-repeat;
  transform: rotate(0deg); pointer-events: none;
}
.brand {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px;
  padding: 11px 18px;
  height: var(--topbar-h);
  position: relative; z-index: 2;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-logo { height: 26px; width: auto; display: block; }
.brand-sub {
  font-family: var(--mono); font-size: 9px; letter-spacing: .2em;
  text-transform: uppercase; color: #8FA0C4; padding-left: 2px;
}
.crest {
  width: 34px; height: 38px; flex: none;
  position: relative;
  border-radius: 4px 4px 8px 8px;
  background: linear-gradient(180deg, var(--navy-700), var(--navy));
  border: 1.5px solid rgba(255,255,255,.5);
  overflow: hidden;
  display: grid; place-items: center;
}
.crest::before { /* franjas */
  content:""; position:absolute; inset:0;
  background: repeating-linear-gradient(90deg, var(--grana) 0 4px, transparent 4px 8px);
  opacity:.9;
}
.crest::after { /* cruz */
  content:""; position:absolute; inset:0;
  background:
    linear-gradient(var(--sanjorge) 0 0) center / 5px 100% no-repeat,
    linear-gradient(var(--sanjorge) 0 0) center / 100% 5px no-repeat;
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.05; }
.brand-txt b { color: #fff; font-size: 14px; letter-spacing: .02em; }
.brand-txt span { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; color: #8FA0C4; text-transform: uppercase; }

.nav { padding: 12px 12px 8px; overflow-y: auto; flex: 1; position: relative; z-index: 2; }
.nav-group-label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em;
  text-transform: uppercase; color: #6E7FA6;
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; margin: 1px 0;
  border-radius: 8px; color: #C2CCE4;
  font-size: 13.5px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .12s, color .12s;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.10); color: #fff; }
.nav-item.active::before {
  content:""; position:absolute; left:-12px; top:8px; bottom:8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--sanjorge);
}
.nav-item .ico { flex: none; opacity: .9; }
.nav-item .count {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px;
  background: rgba(255,255,255,.12); color:#DCE3F2;
  padding: 1px 7px; border-radius: 20px;
}
.nav-item.active .count { background: var(--sanjorge); color: #fff; }

.side-foot {
  position: relative; z-index: 2;
  padding: 12px; border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 10px;
}
.side-foot .av { flex:none; }
.side-foot .who { line-height: 1.15; min-width: 0; }
.side-foot .who b { color: #fff; font-size: 13px; display:block; white-space: nowrap; overflow:hidden; text-overflow: ellipsis; }
.side-foot .who span { color: #8FA0C4; font-size: 11px; }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; }
.topbar {
  height: var(--topbar-h); flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
}
.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 13px; width: 340px; max-width: 38vw;
  color: var(--muted);
}
.search input { border: none; background: none; outline: none; flex: 1; font-size: 13.5px; color: var(--ink); }
.search kbd {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; background:#fff;
}
.topbar-spacer { flex: 1; }

.matchchip {
  display: flex; align-items: center; gap: 10px;
  background: var(--navy); color: #fff;
  border-radius: 9px; padding: 6px 12px 6px 10px;
}
.matchchip .vs { font-family: var(--mono); font-size: 11px; letter-spacing: .03em; }
.matchchip .jor { font-family: var(--mono); font-size: 9.5px; color: var(--gold); text-transform: uppercase; letter-spacing:.1em; }
.matchchip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }

.iconbtn {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2);
  display: grid; place-items: center; position: relative;
}
.iconbtn:hover { background: var(--bg); }
.iconbtn .badge-dot { position:absolute; top:7px; right:8px; width:7px; height:7px; border-radius:50%; background: var(--sanjorge); border:2px solid #fff; }

.rolepick {
  display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px;
}
.rolepick button {
  border: none; background: none; padding: 6px 12px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.rolepick button.on { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }

.content { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page { padding: var(--pad) 26px 60px; max-width: 1480px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; letter-spacing: -0.02em; line-height: 1.15; }
.page-head .eyebrow { display: block; margin-bottom: 7px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 5px; }

/* ============================================================
   UI PRIMITIVES
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding: 15px 18px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 14.5px; }
.card-head .eyebrow { margin-bottom: 2px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content:center;
  border-radius: 9px; padding: 9px 15px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: .12s; white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-800); }
.btn-grana { background: var(--grana); color: #fff; border-color: var(--grana); }
.btn-grana:hover { background: var(--grana-700); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  background: var(--bg); color: var(--ink-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-soft { border: none; }

.av {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
.av-sm { width: 24px; height: 24px; font-size: 10px; }
.av-lg { width: 42px; height: 42px; font-size: 15px; }

.logo-tile {
  width: 34px; height: 34px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
  font-family: var(--mono); letter-spacing: -.02em;
}

/* línea de negocio pill */
.lob {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 7px;
  border: 1px solid transparent;
}
.lob .gl { width: 9px; height: 9px; border-radius: 3px; flex:none; }

/* progreso */
.bar { height: 7px; border-radius: 20px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: var(--navy); }

/* ============================================================
   KPI / STAT CARDS
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi .eyebrow { display:flex; align-items:center; gap:7px; }
.kpi .val { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin-top: 9px; line-height: 1; }
.kpi .val small { font-size: 15px; font-weight: 700; color: var(--muted); }
.kpi .delta { font-size: 12px; font-weight: 600; margin-top: 7px; display:flex; align-items:center; gap:5px; }
.kpi .delta.up { color: var(--laurel); }
.kpi .delta.down { color: var(--grana); }
.kpi .spark { position:absolute; right:14px; bottom:12px; opacity:.85; }
.kpi.feature { background: var(--navy); color:#fff; border-color: var(--navy); }
.kpi.feature .eyebrow { color: #9DB0D8; }
.kpi.feature .val small { color:#9DB0D8; }

/* ============================================================
   TABLE (CRM denso)
   ============================================================ */
.toolbar { display:flex; align-items:center; gap:10px; flex-wrap: wrap; margin-bottom: 14px; }
.filterchip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 11px; font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.filterchip select { border: none; background: none; outline: none; font-weight: 600; color: var(--ink); font-size: 12.5px; }
.filterchip .lbl { color: var(--muted); }
.seg { display:flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; background:var(--surface); }
.seg button { border:none; background:none; padding:7px 11px; font-size:12.5px; font-weight:600; color:var(--muted); display:flex; align-items:center; gap:6px; }
.seg button.on { background: var(--navy); color:#fff; }

.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table.crm { width: 100%; border-collapse: collapse; }
table.crm thead th {
  text-align: left; font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--bg-tint);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.crm tbody td { padding: 0 14px; height: var(--row-h); border-bottom: 1px solid var(--line-2); font-size: 13px; vertical-align: middle; }
table.crm tbody tr { cursor: pointer; transition: background .1s; }
table.crm tbody tr:hover { background: var(--bg-tint); }
table.crm tbody tr.sel { background: var(--navy-050); }
table.crm tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; color: var(--ink); }
.cell-mut { color: var(--muted); }
.val-eur { font-weight: 700; font-variant-numeric: tabular-nums; }
.acct-cell { display: flex; align-items: center; gap: 10px; }
.acct-cell .nm { font-weight: 600; }
.acct-cell .role2 { font-size: 11px; color: var(--muted); }

.stage-pill {
  display:inline-flex; align-items:center; gap:6px; font-size:11.5px; font-weight:600;
  padding: 3px 10px; border-radius: 20px;
}
.prob {
  display:flex; align-items:center; gap:8px;
}
.prob .ring { width: 26px; height: 26px; flex:none; }

/* ============================================================
   DRAWER (detalle oportunidad)
   ============================================================ */
.scrim { position: fixed; inset: 0; background: rgba(14,33,72,.34); backdrop-filter: blur(2px); z-index: 40; }
@media (prefers-reduced-motion: no-preference){ .scrim { animation: fade .15s ease; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 94vw; z-index: 41;
  background: var(--bg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
@media (prefers-reduced-motion: no-preference){ .drawer { animation: slidein .22s cubic-bezier(.2,.7,.3,1); } }
@keyframes slidein { from { transform: translateX(34px); } to { transform: translateX(0); } }
.drawer-head { background: var(--navy); color: #fff; padding: 20px 22px; position: relative; overflow: hidden; flex:none; }
.drawer-head::after {
  content:""; position:absolute; right:-30px; top:-30px; width:160px; height:160px;
  background: repeating-linear-gradient(118deg, rgba(142,27,46,.45) 0 9px, transparent 9px 26px);
  pointer-events:none;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.drawer-x { position:absolute; top:16px; right:16px; }

.tl { position: relative; margin-left: 7px; padding-left: 24px; }
.tl::before { content:""; position:absolute; left:0; top:6px; bottom:6px; width:2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item::before { content:""; position:absolute; left:-24px; top:3px; width:13px; height:13px; border-radius:50%; background:#fff; border:2.5px solid var(--navy-600); }
.tl-item.win::before { border-color: var(--laurel); }
.tl-time { font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing:.06em; }

/* activity quick-add */
.actbar { display:flex; gap:8px; flex-wrap: wrap; }
.acttype { display:flex; flex-direction:column; align-items:center; gap:5px; padding:11px 8px; border:1px solid var(--line); border-radius:10px; background:#fff; flex:1; min-width:70px; color:var(--ink-2); font-size:11.5px; font-weight:600; }
.acttype:hover { border-color: var(--navy-600); color: var(--navy); }
.acttype.on { border-color: var(--navy); background: var(--navy-050); color: var(--navy); }

.field { display:flex; flex-direction:column; gap:6px; margin-bottom:13px; }
.field label { font-size:12px; font-weight:600; color: var(--ink-2); }
.input, textarea.input, select.input {
  border:1px solid var(--line); border-radius:9px; padding:10px 12px; font-size:13px; background:#fff; color:var(--ink); outline:none; width:100%;
}
.input:focus, textarea.input:focus, select.input:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--navy-050); }
textarea.input { resize: vertical; min-height: 70px; }

/* ============================================================
   INVENTORY / PITCH
   ============================================================ */
.inv-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap:12px; }
.inv-card { border:1px solid var(--line); border-radius:var(--radius); background:#fff; overflow:hidden; box-shadow: var(--shadow-sm); }
.inv-thumb { height: 92px; position: relative; background: var(--navy-050); display:grid; place-items:center; overflow:hidden; }
.inv-thumb .ph-stripe { position:absolute; inset:0; background: repeating-linear-gradient(45deg, #fff 0 9px, #EAEEF8 9px 18px); }
.inv-thumb .tag { position:relative; font-family:var(--mono); font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:.08em; }
.inv-body { padding: 12px 13px; }
.statusdot { width:8px; height:8px; border-radius:50%; display:inline-block; }

.pitch {
  background: linear-gradient(160deg, #14502F, #0E3D24);
  border-radius: var(--radius-lg); padding: 22px; position: relative; overflow:hidden;
  border: 1px solid #0a3019;
}
.pitch::before { content:""; position:absolute; inset:18px; border:2px solid rgba(255,255,255,.25); border-radius:6px; }
.pitch::after { content:""; position:absolute; left:50%; top:18px; bottom:18px; width:2px; background:rgba(255,255,255,.25); transform:translateX(-50%); }

/* ============================================================
   TICKETS
   ============================================================ */
.chan { width:30px; height:30px; border-radius:8px; display:grid; place-items:center; color:#fff; flex:none; }
.ticket-row { display:flex; align-items:center; gap:13px; padding:13px 16px; border-bottom:1px solid var(--line-2); cursor:pointer; }
.ticket-row:hover { background: var(--bg-tint); }
.prio { font-family:var(--mono); font-size:10px; text-transform:uppercase; letter-spacing:.08em; padding:2px 7px; border-radius:5px; font-weight:600; }

/* ============================================================
   AI ASSISTANT
   ============================================================ */
.ai-fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 38;
  height: 52px; padding: 0 20px 0 16px; border-radius: 30px; border: none;
  background: var(--navy); color: #fff; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 13.5px;
}
.ai-fab .spark-i { color: var(--gold); }
.ai-fab:hover { background: var(--navy-800); }

.ai-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 45;
  width: 420px; max-width: 94vw; height: 620px; max-height: 88vh;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line);
}
@media (prefers-reduced-motion: no-preference){ .ai-panel { animation: slidein .2s ease; } }
.ai-head { background: var(--navy); color:#fff; padding: 14px 16px; display:flex; align-items:center; gap:11px; position:relative; overflow:hidden; flex:none; }
.ai-head::after { content:""; position:absolute; right:-20px; top:-20px; width:120px; height:120px; background: repeating-linear-gradient(118deg, rgba(142,27,46,.5) 0 8px, transparent 8px 22px); }
.ai-orb { width:34px; height:34px; border-radius:10px; background: linear-gradient(135deg, var(--sanjorge), var(--gold)); display:grid; place-items:center; flex:none; z-index:1; }
.ai-msgs { flex:1; overflow-y:auto; padding: 16px; display:flex; flex-direction:column; gap:13px; background: var(--bg-tint); }
.ai-msg { max-width: 86%; padding: 11px 14px; border-radius: 13px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.ai-msg.user { align-self: flex-end; background: var(--navy); color:#fff; border-bottom-right-radius: 4px; }
.ai-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); }
.ai-msg.bot b { color: var(--navy); }
.ai-sugg { display:flex; flex-wrap:wrap; gap:7px; padding: 0 16px 12px; background: var(--bg-tint); }
.ai-sugg button { font-size:11.5px; font-weight:600; color:var(--navy); background:#fff; border:1px solid var(--line); border-radius:20px; padding:6px 11px; text-align:left; }
.ai-sugg button:hover { border-color: var(--navy-600); background: var(--navy-050); }
.ai-input { padding: 12px; border-top: 1px solid var(--line); display:flex; gap:9px; align-items:flex-end; flex:none; }
.ai-input textarea { flex:1; border:1px solid var(--line); border-radius:11px; padding:10px 12px; font-size:13.5px; resize:none; outline:none; max-height:110px; }
.ai-input textarea:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--navy-050); }
.ai-send { width:40px; height:40px; border-radius:11px; border:none; background:var(--navy); color:#fff; display:grid; place-items:center; flex:none; }
.ai-send:disabled { opacity:.4; }
.typing { display:flex; gap:4px; padding: 4px 2px; }
.typing i { width:7px; height:7px; border-radius:50%; background: var(--muted-2); animation: bob 1s infinite; }
.typing i:nth-child(2){ animation-delay:.15s; } .typing i:nth-child(3){ animation-delay:.3s; }
@keyframes bob { 0%,60%,100%{ transform: translateY(0); opacity:.5;} 30%{ transform: translateY(-5px); opacity:1;} }

/* misc */
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
.grid-3 { display:grid; grid-template-columns: repeat(3,1fr); gap:14px; }
.row { display:flex; align-items:center; gap:10px; }
.between { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.muted { color: var(--muted); }
.divider { height:1px; background: var(--line-2); margin: 16px 0; }
.scroll-y { overflow-y: auto; }
.empty { text-align:center; color:var(--muted); padding:40px; font-size:13px; }

@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Intensidad de marca (Tweaks) */
.brand-sobria .sidebar::before { opacity:.22; }
.brand-sobria .sidebar::after  { opacity:.5; }
.brand-sobria .drawer-head::after, .brand-sobria .ai-head::after,
.brand-sobria .matchchip + * , .brand-sobria .kpi.feature { }
.brand-neutra .sidebar::before, .brand-neutra .sidebar::after,
.brand-neutra .drawer-head::after, .brand-neutra .ai-head::after { display:none; }
.brand-neutra .sidebar { background:#101725; }
.brand-neutra .drawer-head, .brand-neutra .ai-head { background:#101725; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .search { display:none; }
}

/* ============================================================
   SUB-NAV (pestañas dentro de un módulo)
   ============================================================ */
.subnav { margin: 2px 0 2px 12px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.12); display:flex; flex-direction:column; gap:1px; }
.subnav-item {
  display:flex; align-items:center; gap:9px; padding:7px 11px; border-radius:7px;
  border:none; background:none; width:100%; text-align:left;
  color:#A9B4D0; font-size:12.5px; font-weight:500;
}
.subnav-item:hover { background: rgba(255,255,255,.06); color:#fff; }
.subnav-item.active { background: rgba(255,255,255,.10); color:#fff; }
.subnav-item.active .ico { color: var(--gold); }

/* ============================================================
   TIENDA ONLINE (escaparate)
   ============================================================ */
.shop { background:#fff; min-height:100%; }
.shop-preview-bar {
  display:flex; align-items:center; gap:10px; padding:8px 16px;
  background: var(--bg-tint); border-bottom:1px solid var(--line);
  font-family: var(--mono); font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.08em;
}
.shop-preview-bar .url { background:#fff; border:1px solid var(--line); border-radius:7px; padding:4px 12px; color:var(--ink-2); text-transform:none; letter-spacing:0; }

.shop-nav {
  position:sticky; top:0; z-index:20;
  background: var(--navy); color:#fff;
  display:flex; align-items:center; gap:22px; padding:0 26px; height:62px;
}
.shop-nav img.logo { height:30px; }
.shop-nav .links { display:flex; gap:20px; flex:1; }
.shop-nav .links a { color:#C2CCE4; font-size:13px; font-weight:600; text-transform:uppercase; letter-spacing:.04em; cursor:pointer; position:relative; padding:4px 0; }
.shop-nav .links a:hover, .shop-nav .links a.on { color:#fff; }
.shop-nav .links a.on::after { content:""; position:absolute; left:0; right:0; bottom:-2px; height:2px; background:var(--sanjorge); }
.shop-nav .tools { display:flex; align-items:center; gap:6px; }
.shop-iconbtn { width:38px; height:38px; border-radius:9px; border:none; background:rgba(255,255,255,.10); color:#fff; display:grid; place-items:center; position:relative; }
.shop-iconbtn:hover { background:rgba(255,255,255,.18); }
.cart-count { position:absolute; top:4px; right:4px; min-width:16px; height:16px; padding:0 4px; border-radius:9px; background:var(--sanjorge); color:#fff; font-size:10px; font-weight:700; display:grid; place-items:center; font-family:var(--mono); }

.shop-hero {
  position:relative; overflow:hidden; background:linear-gradient(120deg, #0B1A3A, var(--navy) 55%, var(--grana));
  color:#fff; padding:46px 40px; display:flex; align-items:center; min-height:280px;
}
.shop-hero::before { content:""; position:absolute; inset:0; background:repeating-linear-gradient(118deg, rgba(255,255,255,.05) 0 14px, transparent 14px 40px); }
.shop-hero::after { /* cruz S.Jorge marca de agua */
  content:""; position:absolute; right:6%; top:50%; transform:translateY(-50%) rotate(8deg);
  width:230px; height:230px; opacity:.12;
  background: linear-gradient(#fff 0 0) center / 56px 100% no-repeat, linear-gradient(#fff 0 0) center / 100% 56px no-repeat;
}
.shop-hero .inner { position:relative; max-width:560px; }
.shop-hero .kick { font-family:var(--mono); font-size:12px; letter-spacing:.18em; text-transform:uppercase; color:var(--gold); }
.shop-hero h1 { font-size:42px; line-height:1.02; letter-spacing:-.02em; margin:12px 0; font-weight:800; }
.shop-hero p { font-size:15px; color:#C9D2E8; max-width:420px; }
.shop-hero .lema { font-family:var(--mono); font-size:11px; color:#9DB0D8; margin-top:18px; letter-spacing:.05em; }

.btn-shop { display:inline-flex; align-items:center; gap:9px; background:var(--sanjorge); color:#fff; border:none; border-radius:10px; padding:13px 22px; font-size:14px; font-weight:700; margin-top:20px; }
.btn-shop:hover { filter:brightness(1.08); }

.shop-strip { display:flex; gap:0; border-bottom:1px solid var(--line); background:#fff; }
.shop-strip .it { flex:1; display:flex; align-items:center; gap:11px; padding:15px 22px; border-right:1px solid var(--line-2); }
.shop-strip .it:last-child { border-right:none; }
.shop-strip .it .ic { width:34px; height:34px; border-radius:9px; background:var(--navy-050); color:var(--navy); display:grid; place-items:center; flex:none; }
.shop-strip .it b { font-size:13px; display:block; } .shop-strip .it span { font-size:11.5px; color:var(--muted); }

.shop-body { padding:30px 40px 60px; max-width:1280px; margin:0 auto; }
.shop-section-head { display:flex; align-items:flex-end; justify-content:space-between; margin:8px 0 18px; }
.shop-section-head h2 { font-size:24px; letter-spacing:-.02em; }
.shop-section-head .eyebrow { margin-bottom:4px; }

.cat-pills { display:flex; gap:9px; flex-wrap:wrap; margin-bottom:24px; }
.cat-pill { border:1px solid var(--line); background:#fff; color:var(--ink-2); border-radius:30px; padding:9px 16px; font-size:13px; font-weight:600; }
.cat-pill:hover { border-color:var(--navy-600); }
.cat-pill.on { background:var(--navy); color:#fff; border-color:var(--navy); }

.prod-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px,1fr)); gap:18px; }
.prod {
  border:1px solid var(--line); border-radius:14px; overflow:hidden; background:#fff;
  display:flex; flex-direction:column; transition:box-shadow .15s, transform .15s;
}
.prod:hover { box-shadow:var(--shadow); transform:translateY(-3px); }
.prod-img { aspect-ratio:1/1; position:relative; background:var(--bg-tint); overflow:hidden; display:grid; place-items:center; }
.prod-img .ph { position:absolute; inset:0; background:repeating-linear-gradient(45deg, #EEF1F8 0 12px, #E4E9F4 12px 24px); }
.prod-img .ph-cross { position:absolute; inset:0; opacity:.5; background: linear-gradient(var(--navy-050) 0 0) center / 26px 100% no-repeat, linear-gradient(var(--navy-050) 0 0) center / 100% 26px no-repeat; }
.prod-img .ph-tag { position:relative; font-family:var(--mono); font-size:10.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; text-align:center; padding:0 10px; }
.prod-flag { position:absolute; top:10px; left:10px; z-index:2; font-family:var(--mono); font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; padding:3px 8px; border-radius:6px; color:#fff; }
.prod-fav { position:absolute; top:8px; right:8px; z-index:2; width:32px; height:32px; border-radius:50%; border:none; background:rgba(255,255,255,.9); color:var(--muted); display:grid; place-items:center; }
.prod-fav:hover { color:var(--sanjorge); }
.prod-info { padding:13px 14px 14px; display:flex; flex-direction:column; gap:4px; flex:1; }
.prod-fam { font-family:var(--mono); font-size:10px; text-transform:uppercase; letter-spacing:.08em; color:var(--navy); font-weight:700; }
.prod-cat { font-family:var(--mono); font-size:10px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); }
/* Icono temático de la familia + etiqueta de impuesto, bajo el precio. */
.prod-meta { display:flex; align-items:center; gap:8px; margin-top:2px; }
.prod-ico {
  display:inline-grid; place-items:center; width:30px; height:30px; border-radius:9px;
  background:var(--navy-050); color:var(--navy); flex:none;
}
.prod-ico svg { width:16px; height:16px; }
.prod-tax {
  font:700 10.5px var(--mono); letter-spacing:.03em; padding:3px 9px; border-radius:20px;
  border:1px solid var(--line);
}
.prod-tax.b { color:var(--laurel, #1F7A52); background:rgba(31,122,82,.09); border-color:rgba(31,122,82,.22); }
.prod-tax.s { color:var(--navy); background:var(--navy-050); border-color:rgba(14,33,72,.16); }
.prod-name { font-weight:700; font-size:14px; line-height:1.25; }
.prod-bottom { margin-top:auto; padding-top:11px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.prod-price { font-weight:800; font-size:17px; letter-spacing:-.01em; }
.prod-price s { font-weight:600; font-size:12.5px; color:var(--muted-2); margin-right:5px; }
.prod-add { border:none; background:var(--navy); color:#fff; border-radius:9px; height:38px; padding:0 16px; display:grid; place-items:center; flex:none; font:600 12.5px var(--font); cursor:pointer; transition:.12s; }
.prod-foot-spacer { flex:1; }
.prod-add:hover { background:var(--grana); }

.shop-banner { margin:34px 0; border-radius:16px; overflow:hidden; background:linear-gradient(110deg, var(--grana), #5E1020); color:#fff; padding:32px 36px; position:relative; }
.shop-banner::after { content:""; position:absolute; right:-30px; top:-30px; width:200px; height:200px; background:repeating-linear-gradient(118deg, rgba(255,255,255,.08) 0 10px, transparent 10px 28px); }
.shop-banner h3 { font-size:26px; letter-spacing:-.02em; position:relative; }

.shop-foot { background:var(--navy); color:#9DB0D8; padding:30px 40px; display:flex; align-items:center; justify-content:space-between; gap:20px; flex-wrap:wrap; }
.shop-foot img { height:32px; }

/* mini-cart */
.cart-drawer { position:fixed; top:0; right:0; bottom:0; width:380px; max-width:92vw; z-index:46; background:#fff; box-shadow:var(--shadow-lg); display:flex; flex-direction:column; }
.cart-head { background:var(--navy); color:#fff; padding:16px 18px; display:flex; align-items:center; justify-content:space-between; }
.cart-items { flex:1; overflow-y:auto; padding:14px 18px; }
.cart-line { display:flex; gap:12px; padding:12px 0; border-bottom:1px solid var(--line-2); }
.cart-line .thumb { width:54px; height:54px; border-radius:9px; background:var(--bg-tint); display:grid; place-items:center; flex:none; font-family:var(--mono); font-size:9px; color:var(--muted); }
.qty { display:flex; align-items:center; gap:8px; }
.qty button { width:24px; height:24px; border-radius:6px; border:1px solid var(--line); background:#fff; display:grid; place-items:center; color:var(--ink-2); }
.cart-foot { border-top:1px solid var(--line); padding:16px 18px; }

@media (max-width:760px){ .shop-nav .links { display:none; } .shop-hero h1 { font-size:30px; } .shop-strip { display:none; } }

/* ============================================================
   CATÁLOGO COMERCIAL
   ============================================================ */
.cat-item {
  display:flex; align-items:flex-start; gap:12px; padding:13px 13px 13px 16px;
  border:1px solid var(--line); border-radius:11px; position:relative; overflow:hidden;
  transition:border-color .12s, background .12s;
}
.cat-item:hover { border-color: var(--navy-600); }
.cat-bar { position:absolute; left:0; top:0; bottom:0; width:4px; }
.cat-add { width:38px; height:38px; border-radius:9px; border:none; color:#fff; display:grid; place-items:center; flex:none; align-self:center; transition:.12s; }
.cat-add:hover:not(:disabled) { filter:brightness(1.1); }
.cat-add:disabled { color:var(--muted-2); cursor:not-allowed; }
.btn.pulse { box-shadow:0 0 0 4px var(--grana-050); }