/* Metalconf CRM — prototipo presentación gerencial */
:root {
  --mc-primary: #58af91;
  --mc-primary-dark: #12876f;
  --mc-navy: #192f3f;
  --mc-navy-light: #243d4f;
  --mc-accent: #e79f4b;
  --mc-charcoal: #313131;
  --mc-surface: #f0f3f5;
  --mc-white: #ffffff;
  --mc-border: #dde3e8;
  --mc-text: #2c3e50;
  --mc-text-muted: #6b7c8f;
  --mc-danger: #dc3545;
  --mc-warning: #f0ad4e;
  --mc-success: #28a745;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(25, 47, 63, 0.08);
  --shadow-lg: 0 12px 48px rgba(25, 47, 63, 0.14);
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--mc-text);
  background: var(--mc-surface);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ─── Portada presentación ─── */
.cover {
  min-height: 100vh;
  background: radial-gradient(circle at 85% 15%, var(--mc-primary) 0%, transparent 45%),
              linear-gradient(145deg, var(--mc-navy) 0%, #0d1922 100%);
  color: var(--mc-white);
  display: flex;
  flex-direction: column;
}
.cover__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 3rem;
}
.cover__logo { height: 42px; width: auto; }
.cover__badge {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.75;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
}
.cover__main {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
  padding: 2rem 3rem 4rem;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}
.cover__title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 1rem;
}
.cover__title span { color: var(--mc-primary); }
.cover__lead {
  font-size: 1.125rem;
  opacity: 0.88;
  max-width: 34rem;
  margin: 0 0 2rem;
}
.cover__pillars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.cover__pillar {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.cover__pillar strong {
  display: block;
  color: var(--mc-accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}
.cover__pillar span { font-size: 0.9rem; opacity: 0.9; }
.cover__actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary {
  background: var(--mc-primary);
  color: var(--mc-white);
  box-shadow: 0 4px 16px rgba(88, 175, 145, 0.35);
}
.btn--primary:hover { background: var(--mc-primary-dark); }
.btn--ghost {
  background: transparent;
  color: var(--mc-white);
  border: 1px solid rgba(255,255,255,0.35);
}
.btn--ghost:hover { background: rgba(255,255,255,0.08); }
.btn--accent {
  background: var(--mc-accent);
  color: var(--mc-navy);
}
.cover__preview {
  background: var(--mc-white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  color: var(--mc-text);
}
.cover__preview-bar {
  background: var(--mc-navy);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cover__dot { width: 10px; height: 10px; border-radius: 50%; }
.cover__dot--r { background: #ff5f57; }
.cover__dot--y { background: #febc2e; }
.cover__dot--g { background: #28c840; }
.cover__preview-body { padding: 1.25rem; }
.mini-radar-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  border-left: 3px solid;
}
.mini-radar-item--crit { background: #fef2f2; border-color: var(--mc-danger); }
.mini-radar-item--warn { background: #fff8eb; border-color: var(--mc-warning); }
.mini-radar-item--ok { background: #f0faf4; border-color: var(--mc-success); }
.cover__footer {
  padding: 1rem 3rem 1.5rem;
  font-size: 0.8rem;
  opacity: 0.55;
  text-align: center;
}

/* ─── App shell ─── */
.app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w);
  background: var(--mc-navy);
  color: var(--mc-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}
.sidebar__brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar__brand img { height: 36px; width: auto; display: block; margin-bottom: 0.35rem; }
.sidebar__brand small {
  font-size: 0.7rem;
  opacity: 0.55;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sidebar__nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.72);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  margin-bottom: 0.15rem;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--mc-white); }
.nav-item.active {
  background: var(--mc-primary);
  color: var(--mc-white);
}
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.sidebar__user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--mc-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.sidebar__user-info { flex: 1; min-width: 0; }
.sidebar__user-info strong { display: block; font-size: 0.85rem; }
.sidebar__user-info span { font-size: 0.75rem; opacity: 0.6; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: var(--topbar-h);
  background: var(--mc-white);
  border-bottom: 1px solid var(--mc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar__title { font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--mc-navy); }
.topbar__subtitle { font-size: 0.8rem; color: var(--mc-text-muted); margin: 0; }
.topbar__actions { display: flex; align-items: center; gap: 0.75rem; }
.topbar__sync {
  font-size: 0.78rem;
  color: var(--mc-text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mc-success);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.btn--sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  background: var(--mc-surface);
  color: var(--mc-navy);
  border: 1px solid var(--mc-border);
}
.btn--sm:hover { background: var(--mc-border); }
.content { padding: 1.5rem 1.75rem 2.5rem; flex: 1; }

/* ─── Screens ─── */
.screen { display: none; animation: fadeIn 0.35s ease; }
.screen.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* KPI row */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi {
  background: var(--mc-white);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--mc-border);
}
.kpi__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mc-text-muted);
  margin-bottom: 0.35rem;
}
.kpi__value { font-size: 1.65rem; font-weight: 700; color: var(--mc-navy); line-height: 1.1; }
.kpi__delta { font-size: 0.78rem; margin-top: 0.35rem; }
.kpi__delta--up { color: var(--mc-success); }
.kpi__delta--down { color: var(--mc-danger); }
.kpi__delta--neutral { color: var(--mc-text-muted); }

.grid-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

.card {
  background: var(--mc-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--mc-border);
  overflow: hidden;
}
.card__head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--mc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card__head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--mc-navy);
}
.card__body { padding: 1rem 1.25rem; }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.badge--crit { background: #fde8ea; color: var(--mc-danger); }
.badge--warn { background: #fff3cd; color: #856404; }
.badge--ok { background: #d4edda; color: #155724; }
.badge--info { background: #e8f4fd; color: #0c5460; }
.badge--accent { background: #fef3e2; color: #b45309; }
.badge--erp { background: #eef1f4; color: var(--mc-text-muted); }

/* Radar items */
.radar-list { list-style: none; margin: 0; padding: 0; }
.radar-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--mc-border);
}
.radar-item:last-child { border-bottom: none; }
.radar-item__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.radar-item__icon--crit { background: #fde8ea; }
.radar-item__icon--warn { background: #fff8eb; }
.radar-item__icon--hot { background: #fef3e2; }
.radar-item__icon--ok { background: #e8f8ef; }
.radar-item__title { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.15rem; }
.radar-item__meta { font-size: 0.8rem; color: var(--mc-text-muted); }
.radar-item__action .btn--sm { background: var(--mc-navy); color: white; border: none; }

/* Team table */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.data th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mc-text-muted);
  border-bottom: 2px solid var(--mc-border);
}
table.data td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--mc-border);
  vertical-align: middle;
}
table.data tr:hover td { background: #fafbfc; }
.bar-inline {
  height: 6px;
  background: var(--mc-border);
  border-radius: 999px;
  overflow: hidden;
  min-width: 80px;
}
.bar-inline span {
  display: block;
  height: 100%;
  background: var(--mc-primary);
  border-radius: 999px;
}

/* Client header */
.client-header {
  background: var(--mc-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--mc-border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.client-header__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.client-header h1 { margin: 0 0 0.25rem; font-size: 1.35rem; color: var(--mc-navy); }
.client-header__code { font-size: 0.82rem; color: var(--mc-text-muted); }
.client-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--mc-border);
}
.client-kpi__label { font-size: 0.72rem; text-transform: uppercase; color: var(--mc-text-muted); }
.client-kpi__val { font-weight: 700; font-size: 0.95rem; }

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--mc-border);
}
.tab {
  padding: 0.65rem 1.1rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--mc-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s;
}
.tab:hover { color: var(--mc-navy); }
.tab.active { color: var(--mc-primary-dark); border-bottom-color: var(--mc-primary); }

/* Timeline */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--mc-border);
}
.tl-group { margin-bottom: 1.5rem; }
.tl-group__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mc-text-muted);
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
}
.tl-item {
  position: relative;
  padding: 0 0 1rem 1.25rem;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--mc-white);
  box-shadow: 0 0 0 2px var(--mc-border);
  background: var(--mc-text-muted);
}
.tl-item--erp::before { background: #6b7c8f; }
.tl-item--crm::before { background: var(--mc-primary); }
.tl-item--radar::before { background: var(--mc-accent); }
.tl-item--crit::before { background: var(--mc-danger); }
.tl-card {
  background: var(--mc-white);
  border: 1px solid var(--mc-border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}
.tl-card__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.tl-card__title { font-weight: 600; font-size: 0.9rem; }
.tl-card__text { font-size: 0.85rem; color: var(--mc-text-muted); margin: 0; }
.tl-card__amount { font-weight: 700; color: var(--mc-navy); font-size: 0.9rem; margin-top: 0.35rem; }

/* Cuenta comercial */
.cc-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
}
.semaforo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.2;
}
.semaforo--warn { background: #fff3cd; color: #856404; border: 3px solid #f0ad4e; }
.semaforo--ok { background: #d4edda; color: #155724; border: 3px solid var(--mc-success); }
.cc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.cc-stat {
  background: var(--mc-surface);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}
.cc-stat__label { font-size: 0.72rem; color: var(--mc-text-muted); text-transform: uppercase; }
.cc-stat__val { font-size: 1.2rem; font-weight: 700; color: var(--mc-navy); }

/* Pipeline kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  min-height: 420px;
}
.kanban-col {
  background: var(--mc-surface);
  border-radius: var(--radius);
  padding: 0.75rem;
  border: 1px solid var(--mc-border);
}
.kanban-col__head {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mc-text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
}
.kanban-col__count {
  background: var(--mc-white);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
}
.kanban-card {
  background: var(--mc-white);
  border: 1px solid var(--mc-border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.kanban-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--mc-primary);
}
.kanban-card strong { display: block; font-size: 0.85rem; margin-bottom: 0.25rem; }
.kanban-card span { font-size: 0.78rem; color: var(--mc-text-muted); }
.kanban-card__amt { font-weight: 700; color: var(--mc-primary-dark); font-size: 0.85rem; margin-top: 0.35rem; }

/* Agenda */
.agenda-day { margin-bottom: 1.5rem; }
.agenda-day__title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--mc-navy);
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--mc-primary);
  display: inline-block;
}
.agenda-item {
  display: flex;
  gap: 1rem;
  padding: 0.85rem;
  background: var(--mc-white);
  border: 1px solid var(--mc-border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  align-items: flex-start;
}
.agenda-item__time {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--mc-primary-dark);
  min-width: 3.5rem;
}
.agenda-item__type {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--mc-text-muted);
}

/* Client list */
.client-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--mc-border);
  cursor: pointer;
}
.client-row:hover { background: #fafbfc; margin: 0 -1.25rem; padding-left: 1.25rem; padding-right: 1.25rem; }
.client-row__name { flex: 1; font-weight: 600; font-size: 0.92rem; }
.client-row__meta { font-size: 0.8rem; color: var(--mc-text-muted); }

/* Presentation toolbar */
.demo-toolbar {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  gap: 0.5rem;
  background: var(--mc-navy);
  padding: 0.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.demo-toolbar .btn { font-size: 0.8rem; padding: 0.5rem 0.85rem; }
.demo-toolbar .btn--ghost { border-color: rgba(255,255,255,0.2); }

/* Mobile preview frame */
.mobile-frame {
  max-width: 375px;
  margin: 0 auto;
  border: 8px solid var(--mc-navy);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.mobile-frame__screen {
  background: var(--mc-surface);
  min-height: 640px;
  padding: 1rem;
}
.mobile-nav {
  display: flex;
  justify-content: space-around;
  background: var(--mc-white);
  border-top: 1px solid var(--mc-border);
  padding: 0.65rem 0;
  margin: 0 -1rem -1rem;
}
.mobile-nav span { font-size: 0.65rem; color: var(--mc-text-muted); text-align: center; }
.mobile-nav .active { color: var(--mc-primary-dark); font-weight: 700; }

@media (max-width: 1100px) {
  .cover__main { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .sidebar.open { transform: none; }
  .kpi-row { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr 1fr; }
  .cc-summary { grid-template-columns: 1fr; text-align: center; }
  .cc-stats { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .demo-toolbar, .topbar__actions, .cover__actions { display: none !important; }
  .cover { break-after: page; }
  .main { margin-left: 0; }
}
