/* ────────────────────────────────────────────────────────────────
   ABC Comercializadora Industrial — Panel de gestión
   REDISEÑO CLARO — grafito claro + azul acero + más aire
   Tipografía neutra (sin mayúsculas gritonas, tracking reducido)
   ──────────────────────────────────────────────────────────────── */

:root {
  /* Fondos claros */
  --bg-0: #eef1f5;   /* página */
  --bg-1: #ffffff;   /* tarjetas / paneles */
  --bg-2: #f6f8fa;   /* superficie sutil */
  --bg-3: #eef1f4;   /* hover / segment activo bg */
  --surface:   #f6f8fa;
  --surface-2: #eef1f4;
  --border:    #e3e7ec;
  --border-2:  #cfd6de;

  /* Texto (cool near-black → grises) */
  --ink-0: #1b2430;
  --ink-1: #3d4653;
  --ink-2: #6b7683;
  --ink-3: #98a2b0;

  /* Azul acero (acento de marca) */
  --accent:      #2f6690;
  --accent-2:    #285880;   /* hover / más oscuro */
  --accent-soft: #eaf1f7;   /* tinte de fondo */
  --accent-line: #cfe0ee;   /* borde sobre tinte */
  /* Acero secundario */
  --steel:       #4a7ca6;
  --steel-soft:  #eaf1f7;

  --ok: #1f8a5b;
  --warn: #b26a00;
  --danger: #c0392b;

  --radius: 16px;
  --radius-sm: 12px;

  --shadow-1: 0 1px 2px rgba(20,26,34,0.05);
  --shadow-2: 0 40px 90px -30px rgba(20,26,34,0.35);

  --font-sans: 'Manrope', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: 'Manrope', ui-sans-serif, system-ui, sans-serif;
  --font-wordmark: 'Manrope', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --ok-soft: #e6f4ee;
  --warn-soft: #fbf1dd;
  --danger-soft: #fbece9;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.003em;
}
body { min-height: 100vh; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
ul { list-style: none; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; color: var(--ink-0); }

::selection { background: var(--accent-line); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #d3dae2; border-radius: 8px; border: 3px solid var(--bg-0); }

/* LAYOUT */
.app { display: grid; grid-template-columns: 246px 1fr; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--border);
  padding: 26px 18px 18px;
  display: flex; flex-direction: column; gap: 26px;
  background: var(--bg-1);
}
.brand { padding: 0 6px 6px; }
.brand-wordmark { display: flex; flex-direction: column; align-items: flex-start; color: var(--ink-0); line-height: 1; gap: 7px; }
.brand-wordmark .bw-top {
  font-family: var(--font-wordmark); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1;
}
.brand-wordmark .bw-rule { width: 34px; height: 4px; background: var(--accent); margin: 0; border-radius: 3px; }
.brand-wordmark .bw-bot {
  font-family: var(--font-display); font-size: 10px; font-weight: 600; letter-spacing: 0.14em;
  color: var(--ink-2); align-self: stretch;
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); padding: 16px 10px 6px; font-weight: 700; font-family: var(--font-display);
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px;
  font-size: 13.5px; font-family: var(--font-display); letter-spacing: 0;
  color: var(--ink-1); font-weight: 500; position: relative; transition: background 120ms, color 120ms;
}
.nav-item:hover { background: var(--surface); color: var(--ink-0); }
.nav-item .ni-ico { width: 18px; text-align: center; font-size: 14px; color: var(--ink-3); opacity: .8; }
.nav-item.is-active, .nav-item.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 700; }
.nav-item.is-active .ni-ico, .nav-item.active .ni-ico { color: var(--accent); opacity: 1; }
.nav-item.is-active::before, .nav-item.active::before {
  content: ''; position: absolute; left: -18px; top: 9px; bottom: 9px;
  width: 3px; background: var(--accent); border-radius: 0 3px 3px 0;
}

.side-footer { padding: 0; }
.conn {
  display: flex; gap: 11px; align-items: center; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--bg-2);
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(31,138,91,0.14); flex-shrink: 0; }
.conn > div { min-width: 0; flex: 1; }
.conn b { display: block; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn span { display: block; font-size: 11px; color: var(--ink-2); font-family: var(--font-mono); }

/* MAIN */
.main { min-width: 0; padding: 34px 44px 64px; display: flex; flex-direction: column; gap: 28px; max-width: 1180px; width: 100%; margin: 0 auto; }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.page-header h2 { font-family: var(--font-display); font-size: 27px; font-weight: 800; letter-spacing: -0.02em; text-transform: none; }
.page-header .ph-sub { font-size: 14.5px; color: var(--ink-2); margin-top: 5px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* KPIS */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi {
  background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 8px; min-height: 116px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-1);
}
.kpi-hl { border-color: var(--accent-line); }
.kpi-hl::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); }
.kpi-l { font-family: var(--font-display); font-size: 11.5px; color: var(--ink-2); letter-spacing: 0; font-weight: 600; }
.kpi-v { font-family: var(--font-display); font-size: 34px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink-0); line-height: 1; }
.kpi-v small { font-size: 13px; color: var(--ink-2); font-weight: 500; margin-left: 4px; }
.kpi-foot { font-size: 11.5px; color: var(--ink-2); margin-top: auto; }
.kpi-foot b { color: var(--ink-0); font-family: var(--font-mono); }
.kpi-delta { font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: 0; padding: 3px 8px; border-radius: 6px; align-self: flex-start; }
.kpi-delta.up { color: var(--ok); background: var(--ok-soft); }
.kpi-delta.down { color: var(--danger); background: var(--danger-soft); }
.kpi-delta.warn { color: var(--warn); background: var(--warn-soft); }

/* PANEL */
.panel { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; position: relative; box-shadow: var(--shadow-1); }
.panel-h { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; margin-bottom: 20px; }
.panel-h > :first-child { flex: 1; min-width: 0; }
.panel-h h2 { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; text-transform: none; color: var(--ink-0); }
.panel-sub { display: block; font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.link { font-size: 13px; color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

/* SEG CONTROL / FILTERS */
.seg-ctrl { display: inline-flex; padding: 5px; background: #e4e9ee; border: none; border-radius: 12px; gap: 4px; }
.seg-ctrl button { padding: 9px 18px; font-size: 13.5px; font-weight: 600; border-radius: 9px; color: var(--ink-1); transition: background 120ms, color 120ms; }
.seg-ctrl button.is-on { background: var(--bg-1); color: var(--accent-2); font-weight: 700; box-shadow: 0 1px 3px rgba(20,26,34,0.14); }
.filter { padding: 8px 14px; font-size: 12.5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); cursor: pointer; }
.filter.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 9px;
  font-family: var(--font-display); font-size: 13.5px; font-weight: 600; letter-spacing: 0; text-transform: none;
  transition: transform 120ms, background 120ms, color 120ms, box-shadow 120ms;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(20,26,34,0.12); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: var(--bg-1); border: 1px solid var(--border-2); color: var(--ink-1); }
.btn-ghost:hover { background: var(--surface); }
.btn-arrow { transition: transform 200ms; }
.btn:hover .btn-arrow { transform: translateX(3px); }
.btn-mini { font-size: 12.5px; font-weight: 600; padding: 8px 13px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--accent); }
.btn-mini:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

/* CHIPS / TAGS / DOTS */
.chip { font-family: var(--font-display); font-size: 12px; font-weight: 600; padding: 3px 9px; letter-spacing: 0; text-transform: none; background: var(--surface-2); color: var(--ink-1); border-radius: 6px; white-space: nowrap; }
.chip-accent { background: var(--accent-soft); color: var(--accent-2); }
.chip-steel { background: var(--steel-soft); color: var(--accent-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.acc { background: var(--accent); } .dot.danger { background: var(--danger); }

/* SEO ROWS */
.seo { display: flex; flex-direction: column; }
.seo-row { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 13px 4px; border-top: 1px solid var(--border); }
.seo-row:first-child { border-top: none; }
.seo-pos { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.pos-top3 { background: var(--ok-soft); color: var(--ok); }
.pos-top10 { background: var(--accent-soft); color: var(--accent-2); }
.pos-top20 { background: var(--warn-soft); color: var(--warn); }
.pos-none { background: var(--danger-soft); color: var(--danger); }
.seo-kw b { display: block; font-size: 13.5px; font-weight: 600; }
.seo-kw span { font-size: 11.5px; color: var(--ink-2); font-family: var(--font-mono); }
.seo-trend { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; text-align: right; }
.seo-trend.up { color: var(--ok); } .seo-trend.down { color: var(--danger); }

/* CARDS */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: #fdfefe; border-radius: var(--radius-sm); padding: 18px; border: 1px solid #e6eaef; transition: border-color 120ms, box-shadow 120ms; display: flex; flex-direction: column; gap: 11px; }
.card.clickable { cursor: pointer; }
.card:hover, .card.clickable:hover { border-color: var(--accent); box-shadow: 0 6px 18px -10px rgba(47,102,144,0.4); }
.card-title { font-size: 15.5px; font-weight: 700; font-family: var(--font-display); line-height: 1.3; color: var(--ink-0); text-wrap: pretty; }
.card-meta { font-size: 11.5px; color: var(--ink-2); margin-top: 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card-meta span:not([class]) { font-family: var(--font-mono); color: var(--ink-3); }

/* EMPTY / LOADING */
.empty { text-align: center; padding: 44px 20px; color: var(--ink-2); font-size: 14px; }
.loading { text-align: center; padding: 44px; color: var(--ink-2); font-family: var(--font-mono); font-size: 12.5px; }

/* RESPONSIVE */
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; width: 100%; flex-direction: row; padding: 0; border-right: none; border-top: 1px solid var(--border); z-index: 999; overflow-x: auto; gap: 0; box-shadow: 0 -4px 20px -8px rgba(20,26,34,0.12); }
  .brand, .nav-label, .side-footer { display: none; }
  .nav { flex-direction: row; gap: 0; flex: 1; overflow-x: auto; }
  .nav-item { flex-direction: column; gap: 2px; padding: 10px 8px; font-size: 9px; letter-spacing: 0; min-width: 60px; text-align: center; justify-content: center; border-radius: 0; }
  .nav-item .ni-ico { font-size: 17px; width: auto; }
  .nav-item.is-active, .nav-item.active { background: transparent; }
  .nav-item.is-active::before, .nav-item.active::before { display: none; }
  .main { padding: 20px 16px 96px; }
}
