/* FACU Social PRO V2 — Premium Dashboard. Se carga después de app.css y solo redefine el aspecto. */
:root {
  --bg: #121214; --surface: #1b1b1f; --surface-2: #232328; --surface-3: #2c2c33; --line: #33333b;
  --text: #f4f1ec; --muted: #9a9aa4;
  --primary: #f28c28; --primary-2: #ffb15c; --on-primary: #1a0f05; --copper: #b87333; --copper-2: #d9965b;
  --teal: #3fb8a0; --radius: 18px;
  --shadow: 0 14px 34px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04);
  --wood-a: #8a5530; --wood-b: #4a2a14; --wood-c: #2f190b;
  --inset: inset 0 2px 6px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.04);
}
:root[data-theme="light"] {
  --bg: #e6e7ea; --surface: #f6f6f8; --surface-2: #ffffff; --surface-3: #ebecef; --line: #d9dadf;
  --text: #1c1c20; --muted: #6a6a74; --primary: #e8780f; --primary-2: #b85a05; --on-primary: #fff;
  --shadow: 0 12px 28px rgba(40,40,60,.14), inset 0 1px 0 #fff; --inset: inset 0 2px 5px rgba(0,0,0,.08), 0 1px 0 #fff;
}
html, body { background: var(--bg); }
body, :root[data-theme="light"] body { background: radial-gradient(900px 500px at 100% -10%, rgba(242,140,40,.08), transparent 60%), var(--bg); }
.shell { grid-template-columns: 268px 1fr; gap: 0; padding: 14px; }
.main { padding: 0 6px 60px 18px; }

/* Sidebar madera */
.sidebar, :root[data-theme="light"] .sidebar { top: 14px; height: calc(100vh - 28px); border: 0; border-radius: 26px; padding: 12px 10px; gap: 6px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.10) 0 2px, transparent 2px 9px), repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 23px), linear-gradient(180deg, var(--wood-a), var(--wood-b) 55%, var(--wood-c));
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,200,140,.14); }
.logo { background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(0,0,0,.28)); border-radius: 16px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--inset); }
.logo img { border-radius: 11px; box-shadow: 0 4px 10px rgba(0,0,0,.4); }
.logo strong { color: #fff; } .logo span { color: var(--primary-2); }
.nav-group { color: #1a0f05; background: linear-gradient(180deg, #e8c46a, #c9a24a); width: fit-content; border-radius: 4px; padding: 2px 8px; margin: 12px 6px 4px; font-weight: 800; font-size: 10px; letter-spacing: .14em; }
.nav-link { position: relative; color: #e9d8c6; background: linear-gradient(180deg, rgba(40,30,25,.88), rgba(24,18,15,.92)); border: 1px solid rgba(255,255,255,.06); box-shadow: 0 2px 5px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.06); padding: 9px 12px 9px 16px; margin-bottom: 2px; transition: transform .15s, background .15s, color .15s; }
.nav-link::before { content: ""; position: absolute; left: 6px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: #5c4a3a; }
.nav-link:hover { color: #fff; transform: translateX(2px); background: linear-gradient(180deg, rgba(54,40,32,.95), rgba(32,24,20,.95)); }
.nav-link.active { color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.1); }
.nav-link.active::before { background: linear-gradient(180deg, var(--primary-2), var(--primary)); box-shadow: 0 0 8px rgba(242,140,40,.7); }
.nav-link:focus-visible, .btn:focus-visible, .v2-search input:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; }
.nav-sub { display: none; margin: -2px 0 4px 18px; padding: 6px 4px 6px 10px; border-left: 1px solid rgba(255,200,140,.25); }
.nav-sub.open { display: block; }
.nav-sub a { display: block; padding: 5px 8px; border-radius: 8px; color: #d8c3ad; font-size: 13px; text-decoration: none; }
.nav-sub a:hover, .nav-sub a.active { background: rgba(0,0,0,.3); color: #fff; }
.nav-caret { margin-left: auto; opacity: .6; font-size: 11px; transition: transform .2s; }
.nav-link.expanded .nav-caret { transform: rotate(90deg); }
.sidebar-foot { color: #d8c3ad; background: rgba(0,0,0,.28); border-radius: 14px; padding: 10px 12px; box-shadow: var(--inset); }
.sidebar-foot a { color: var(--primary-2); }

/* Barra superior */
.topbar { background: var(--surface); border-radius: 22px; padding: 12px 16px; box-shadow: var(--shadow); border: 1px solid var(--line); position: sticky; top: 14px; z-index: 30; backdrop-filter: blur(10px); margin-bottom: 18px; }
.topbar h1 { font-size: 20px; } .topbar p { font-size: 12px; }
.v2-search { display: flex; align-items: center; gap: 8px; background: var(--surface-3); border-radius: 14px; padding: 0 12px; box-shadow: var(--inset); min-width: 220px; flex: 1; max-width: 420px; }
.v2-search input { background: transparent; border: 0; outline: 0; padding: 10px 0; width: 100%; }
.v2-search kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.v2-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-3); border-radius: 99px; padding: 4px 12px 4px 4px; box-shadow: var(--inset); font-weight: 700; font-size: 13px; }
.v2-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: radial-gradient(circle at 30% 30%, #ffb15c, #c4560a); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.btn { border-radius: 13px; background: linear-gradient(180deg, var(--surface-2), var(--surface-3)); border-color: var(--line); box-shadow: 0 2px 5px rgba(0,0,0,.25); }
.btn.primary { background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: var(--on-primary); }
.brand-switch { background: var(--surface-3); border: 0; box-shadow: var(--inset); border-radius: 14px; }
.brand-switch button.active { background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: var(--on-primary); }
.panel { background: var(--surface); border-radius: var(--radius); border-color: var(--line); }
:root[data-theme="light"] .panel { background: var(--surface-2); }

/* Dashboard V2 */
.v2-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.v2-head h2 { margin: 0; font-size: 22px; } .v2-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.v2-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.v2-card { position: relative; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; transition: transform .2s, border-color .2s; animation: v2in .5s both; }
.v2-card:hover { transform: translateY(-3px); border-color: rgba(242,140,40,.5); }
.v2-card:nth-child(2) { animation-delay: .06s; } .v2-card:nth-child(3) { animation-delay: .12s; } .v2-card:nth-child(4) { animation-delay: .18s; }
.v2-card .t { font-size: 13px; font-weight: 700; color: var(--text); opacity: .85; }
.v2-card .ic { position: absolute; right: 16px; top: 14px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; box-shadow: var(--inset); }
.v2-card .ic.c1 { background: rgba(242,140,40,.18); } .v2-card .ic.c2 { background: rgba(140,110,230,.2); } .v2-card .ic.c3 { background: rgba(63,184,160,.2); } .v2-card .ic.c4 { background: rgba(90,130,230,.2); }
.v2-card .v { font-size: 32px; font-weight: 800; margin: 12px 0 4px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.v2-card .n { font-size: 12px; color: var(--muted); min-height: 18px; }
.v2-card .more { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--muted); }
.up { color: #34d399; font-weight: 700; } .down { color: #f87171; font-weight: 700; }
.v2-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.v2-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
.v2-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.v2-select { width: auto; flex: 0 0 auto; min-width: 150px; background: var(--surface-3); border: 0; border-radius: 12px; padding: 8px 12px; box-shadow: var(--inset); font-weight: 700; cursor: pointer; }
.v2-chart { position: relative; width: 100%; }
.v2-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.v2-chart .vbar { transform-box: fill-box; transform-origin: bottom; animation: v2grow .7s cubic-bezier(.2,.8,.2,1) both; }
.v2-chart .line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: v2draw 1.2s .3s forwards; }
.v2-chart .hit:hover { fill: rgba(242,140,40,.08); }
.v2-tip { position: absolute; pointer-events: none; background: #111; color: #fff; border: 1px solid #444; border-radius: 10px; padding: 6px 10px; font-size: 12px; opacity: 0; transform: translate(-50%, -110%); transition: opacity .12s; white-space: nowrap; z-index: 5; }
.v2-tip.show { opacity: 1; }
.v2-gauge { text-align: center; }
.v2-gauge svg { width: 100%; max-width: 280px; }
.v2-gauge .seg { transition: fill .4s; }
.v2-gauge .big { font-size: 34px; font-weight: 800; fill: var(--text); } .v2-gauge .sm { font-size: 12px; fill: var(--muted); }
.v2-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.v2-mini div { background: var(--surface-3); border-radius: 14px; padding: 10px 12px; box-shadow: var(--inset); text-align: left; }
.v2-mini span { display: block; font-size: 11px; color: var(--muted); } .v2-mini strong { font-size: 18px; }
.v2-note { font-size: 12px; color: var(--muted); background: var(--surface-3); border-radius: 12px; padding: 8px 10px; margin-top: 8px; }
.v2-skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: v2sh 1.3s infinite; border-radius: 10px; height: 18px; }
@keyframes v2in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes v2grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes v2draw { to { stroke-dashoffset: 0; } }
@keyframes v2sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .v2-card, .v2-chart .vbar, .v2-chart .line, .v2-skel { animation: none !important; } .v2-chart .line { stroke-dashoffset: 0; } }
@media (max-width: 1100px) { .v2-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .v2-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { padding: 0; grid-template-columns: 1fr; }
  .sidebar, :root[data-theme="light"] .sidebar { top: 0; height: 100vh; border-radius: 0 26px 26px 0; }
  .main { padding: 10px 10px 90px; }
  .topbar { top: 6px; border-radius: 18px; }
  .v2-search { order: 5; max-width: none; flex-basis: 100%; }
}
@media (max-width: 480px) { .v2-cards { grid-template-columns: 1fr 1fr; gap: 10px; } .v2-card { padding: 12px; } .v2-card .v { font-size: 24px; } .v2-card .ic { width: 30px; height: 30px; font-size: 14px; right: 10px; top: 10px; } }
.v2-card .t { display: block; padding-right: 48px; }
@media (max-width: 860px) { .topbar { position: static; } .topbar .v2-chip { display: none; } }
/* Modo claro: el sidebar de madera conserva sus colores */
:root[data-theme="light"] .nav-link, :root[data-theme="light"] .nav-link:hover, :root[data-theme="light"] .nav-link.active { color: #f3e6d6; background: linear-gradient(180deg, rgba(40,30,25,.88), rgba(24,18,15,.92)); }
:root[data-theme="light"] .nav-link.active { color: #fff; }
:root[data-theme="light"] .logo { background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.4)); }
:root[data-theme="light"] .logo span { color: #ffc27d; }
:root[data-theme="light"] .v2-search input { background: transparent; }
:root[data-theme="light"] .nav-sub a { color: #e6d3bd; }
/* Barra superior: una sola fila en escritorio; el subtítulo se recorta con puntos suspensivos */
.topbar { flex-wrap: nowrap; }
.topbar > .row { flex: 1 1 200px; min-width: 0; }
.topbar > .row > div { min-width: 0; }
.topbar p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.topbar h1 { white-space: nowrap; }
.v2-search { flex: 0 1 300px; min-width: 150px; }
.top-actions { flex-wrap: nowrap; flex: 0 0 auto; }
@media (max-width: 1180px) { .topbar { flex-wrap: wrap; } .v2-search { order: 5; flex: 1 1 100%; max-width: none; } .topbar .v2-chip { display: none; } }
@media (max-width: 860px) { .topbar > .row { flex-basis: 100%; } .topbar p { white-space: normal; } .top-actions { flex-wrap: wrap; } }
:root[data-theme="light"] .btn.primary { background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: #fff; }
:root[data-theme="light"] .brand-switch button.active { color: #fff; }
.tabbar { background: rgba(27,27,31,.97); } .tabbar a.active { color: var(--primary-2); }
:root[data-theme="light"] .tabbar { background: rgba(246,246,248,.97); } :root[data-theme="light"] .tabbar a.active { color: var(--primary); }
.tabs button.active, .chip.active { background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: var(--on-primary); border-color: transparent; }
.grp-head, .grp-head td { background: rgba(242,140,40,.07); }
:root[data-theme="light"] .grp-head, :root[data-theme="light"] .grp-head td { background: var(--surface-3); }
:root[data-theme="light"] .badge.s-SCHEDULED, :root[data-theme="light"] .badge.s-QUOTE_SENT, :root[data-theme="light"] .badge.s-FOLLOW_UP { color: #6d4bd1; }
:root[data-theme="light"] .badge.s-FAILED, :root[data-theme="light"] .badge.s-LOST, :root[data-theme="light"] .badge.s-ALTA { color: #c62828; }
:root[data-theme="light"] .badge.s-PUBLISHED, :root[data-theme="light"] .badge.s-WON, :root[data-theme="light"] .badge.s-USED { color: #15803d; }
:root[data-theme="light"] .badge.s-APPROVED, :root[data-theme="light"] .badge.s-QUALIFIED { color: #b45309; }
:root[data-theme="light"] .badge.s-READY, :root[data-theme="light"] .badge.s-CONTACTED { color: #0369a1; }

.v2-hide { display: none !important; }
.v2-tabs { margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: var(--surface-3); color: var(--text); border: 1px solid var(--line); border-radius: 99px; padding: 7px 14px; font-weight: 700; cursor: pointer; }
.tabs button:hover { border-color: rgba(242,140,40,.6); }
.tabs button.active { background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: var(--on-primary); border-color: transparent; }
:root[data-theme="light"] .tabs button.active { color: #fff; }
