/* ========================================
   DASHBOARD V2 — Manni design system
   Ported from public/manni-dashboard.html.
   Every rule is scoped under .mv2 so it cannot leak into the rest of the app,
   which still runs on style.css / design-system.css.
   ======================================== */

.mv2 {
  --mv2-ink: #0A2540;
  --mv2-ink-soft: #425466;
  --mv2-ink-mute: #8792A2;
  --mv2-violet: #5B4FE9;
  --mv2-violet-deep: #453BC7;
  --mv2-violet-tint: #EFEDFD;
  --mv2-violet-tint-2: #E4E1FB;
  --mv2-bg: #F6F7FB;
  --mv2-surface: #FFFFFF;
  --mv2-border: #E7E9F1;
  --mv2-green: #0FA968;
  --mv2-green-tint: #E7F8F0;
  --mv2-red: #E5484D;
  --mv2-red-tint: #FCEBEC;
  --mv2-amber: #D98A1B;
  --mv2-amber-tint: #FCF3E3;
  --mv2-radius-sm: 8px;
  --mv2-radius-md: 14px;
  --mv2-radius-lg: 20px;
  --mv2-shadow-card: 0 1px 2px rgba(10, 37, 64, .04), 0 8px 24px rgba(10, 37, 64, .05);
  --mv2-shadow-pop: 0 12px 32px rgba(10, 37, 64, .10);

  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--mv2-bg);
  color: var(--mv2-ink);
  -webkit-font-smoothing: antialiased;

  /* .main-content already applies 1rem 1.5rem of padding. Cancel it with
     negative margins so the v2 canvas bleeds to the edges like the mockup,
     then re-apply the design's own spacing.

     The width must grow by the same amount the margins pull out (2 * 1.5rem),
     otherwise the inherited width:100% from .content-section keeps the box at
     the padded width and only shifts it left, leaving dead space on the right.
     Note this is `width`, not `auto`: .content-section sets width:100%, which
     would otherwise win. */
  margin: -1rem -1.5rem;
  padding: 32px 40px 64px;
  min-height: calc(100vh - 2rem);
}

/* El ancho va en un selector propio (id + clase) porque `.content-section`
   aplica al mismo elemento width:100% Y max-width:100%. Sin levantar el
   max-width, el calc() se recorta de vuelta al ancho con padding y quedan
   48px muertos contra el borde derecho. */
#section-dashboard-v2.mv2 {
  width: calc(100% + 3rem);
  max-width: none;
}

.mv2 *,
.mv2 *::before,
.mv2 *::after { box-sizing: border-box; }

.mv2 h1, .mv2 h3, .mv2 p { margin: 0; }
.mv2 a { text-decoration: none; color: inherit; }
.mv2 button { font-family: inherit; cursor: pointer; }

/* ---------- TOPBAR ---------- */
.mv2-topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}
.mv2-topbar h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.mv2-topbar p { font-size: 14px; color: var(--mv2-ink-soft); margin-top: 4px; }
.mv2-topbar-actions { display: flex; gap: 10px; align-items: center; }

.mv2-select,
.mv2-btn {
  font-size: 13px; font-weight: 500;
  border-radius: var(--mv2-radius-sm);
  border: 1px solid var(--mv2-border);
  background: var(--mv2-surface);
  padding: 9px 14px;
  color: var(--mv2-ink);
}
.mv2-btn-primary {
  background: var(--mv2-violet); color: white; border: none;
  box-shadow: 0 1px 2px rgba(91, 79, 233, .15), 0 4px 10px rgba(91, 79, 233, .22);
}
.mv2-btn-primary:hover { background: var(--mv2-violet-deep); }
.mv2-btn-white { background: white; color: var(--mv2-violet-deep); border: none; font-weight: 600; }

/* ---------- ALERT BANNER ---------- */
.mv2-alert {
  background: linear-gradient(120deg, var(--mv2-violet) 0%, #7A6FF0 100%);
  border-radius: var(--mv2-radius-lg);
  padding: 20px 26px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; margin-bottom: 22px;
  position: relative; overflow: hidden;
  box-shadow: var(--mv2-shadow-pop);
}
.mv2-alert::after {
  content: ""; position: absolute; right: -40px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255, 255, 255, .06);
}
.mv2-alert-left { display: flex; gap: 14px; align-items: flex-start; z-index: 1; }
.mv2-alert-icon {
  width: 38px; height: 38px; border-radius: 11px;
  background: rgba(255, 255, 255, .16);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px; flex-shrink: 0;
}
.mv2-alert-left h3 { color: white; font-size: 14.5px; font-weight: 600; margin-bottom: 3px; }
.mv2-alert-left p { color: rgba(255, 255, 255, .78); font-size: 13px; line-height: 1.5; }
.mv2-alert-left strong { color: white; font-weight: 700; }
.mv2-alert-right { display: flex; align-items: center; gap: 10px; z-index: 1; }

/* ---------- STAT GRID ---------- */
.mv2-stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 24px;
}
.mv2-stat-card {
  background: var(--mv2-surface);
  border: 1px solid var(--mv2-border);
  border-radius: var(--mv2-radius-md);
  padding: 18px 18px 16px;
  box-shadow: var(--mv2-shadow-card);
}
.mv2-stat-top {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.mv2-stat-top i { color: var(--mv2-ink-mute); font-size: 12px; }
.mv2-stat-label { font-size: 12.5px; color: var(--mv2-ink-soft); font-weight: 500; }
.mv2-stat-value { font-size: 23px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 8px; }
.mv2-stat-delta { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.mv2-delta-up-bad { color: var(--mv2-red); }
.mv2-delta-up-good { color: var(--mv2-green); }
.mv2-delta-flat { color: var(--mv2-ink-mute); }

/* ---------- LAYOUT ---------- */
.mv2-split { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }
.mv2-col-stack { display: flex; flex-direction: column; gap: 16px; }

.mv2-card {
  background: var(--mv2-surface);
  border: 1px solid var(--mv2-border);
  border-radius: var(--mv2-radius-lg);
  padding: 22px;
  box-shadow: var(--mv2-shadow-card);
}
.mv2-card-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.mv2-card-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.mv2-card-sub { font-size: 12.5px; color: var(--mv2-ink-mute); margin-top: 2px; }
.mv2-link-quiet {
  font-size: 12.5px; font-weight: 600; color: var(--mv2-violet);
  display: flex; align-items: center; gap: 4px;
}

/* ---------- PAYMENTS LIST ---------- */
.mv2-pay-row { border-top: 1px solid var(--mv2-border); }
.mv2-pay-row:first-child { border-top: none; }
.mv2-pay-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px; cursor: pointer;
}
.mv2-pay-left { display: flex; align-items: center; gap: 12px; }
.mv2-pay-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  flex-shrink: 0;
}
.mv2-pay-name { font-size: 13.5px; font-weight: 600; }
.mv2-pay-meta { font-size: 12px; color: var(--mv2-ink-mute); margin-top: 1px; }
.mv2-pay-right { display: flex; align-items: center; gap: 12px; }
.mv2-pay-amount { font-size: 13.5px; font-weight: 600; }
.mv2-chip { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 100px; white-space: nowrap; }
.mv2-chip-danger { background: var(--mv2-red-tint); color: var(--mv2-red); }
.mv2-chip-warning { background: var(--mv2-amber-tint); color: var(--mv2-amber); }
.mv2-chip-success { background: var(--mv2-green-tint); color: var(--mv2-green); }
.mv2-chip-neutral { background: var(--mv2-bg); color: var(--mv2-ink-soft); }
.mv2-chev { font-size: 12px; color: var(--mv2-ink-mute); transition: transform .2s ease; }
.mv2-pay-row.open .mv2-chev { transform: rotate(180deg); }

.mv2-pay-detail { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.mv2-pay-row.open .mv2-pay-detail { max-height: 260px; }
.mv2-pay-detail-inner {
  background: var(--mv2-bg); border-radius: var(--mv2-radius-md);
  padding: 14px 16px; margin: 2px 4px 14px;
}
.mv2-detail-top { display: flex; justify-content: space-between; margin-bottom: 10px; }
.mv2-detail-top span { font-size: 11.5px; color: var(--mv2-ink-mute); font-weight: 500; }
.mv2-month-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.mv2-month-cell {
  background: var(--mv2-surface); border-radius: 9px; padding: 8px 6px; text-align: center;
  border: 1px solid var(--mv2-border);
}
.mv2-month-cell.bad { background: var(--mv2-red-tint); border-color: transparent; }
.mv2-month-cell .mo {
  font-size: 10.5px; color: var(--mv2-ink-mute); font-weight: 600;
  text-transform: uppercase; margin-bottom: 5px;
}
.mv2-month-cell .amt { font-size: 11.5px; font-weight: 600; margin-top: 4px; }
.mv2-month-cell.bad .amt, .mv2-month-cell.bad .mo { color: var(--mv2-red); }
.mv2-trend-line {
  display: flex; align-items: center; gap: 6px; margin-top: 10px;
  font-size: 12px; color: var(--mv2-amber); font-weight: 500;
}

/* ---------- ANALYSIS BARS ---------- */
.mv2-bar-row { margin-bottom: 14px; }
.mv2-bar-row:last-child { margin-bottom: 0; }
.mv2-bar-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.mv2-bar-top .svc { font-weight: 600; }
.mv2-bar-track { height: 7px; background: var(--mv2-bg); border-radius: 100px; overflow: hidden; }
.mv2-bar-fill { height: 100%; border-radius: 100px; }

/* ---------- DONUT ---------- */
.mv2-donut-wrap { display: flex; align-items: center; gap: 18px; }
.mv2-donut-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.mv2-donut-legend-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; gap: 10px;
}
.mv2-donut-legend-left {
  display: flex; align-items: center; gap: 8px; color: var(--mv2-ink-soft);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mv2-donut-legend-row strong { font-weight: 600; color: var(--mv2-ink); white-space: nowrap; }
.mv2-legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------- MANNI CARD ---------- */
.mv2-manni-card {
  background: linear-gradient(160deg, #2C2470 0%, #453BC7 55%, #5B4FE9 100%);
  border-radius: var(--mv2-radius-lg);
  padding: 20px; color: white;
  position: relative; overflow: hidden;
  box-shadow: var(--mv2-shadow-pop);
}
.mv2-manni-card::before {
  content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, .06); right: -90px; bottom: -110px;
}
.mv2-manni-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 22px; position: relative; z-index: 1;
}
.mv2-tag {
  font-size: 10.5px; font-weight: 700; background: rgba(255, 255, 255, .16);
  padding: 4px 10px; border-radius: 100px; letter-spacing: .03em;
}
.mv2-plastic {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px; padding: 16px; margin-bottom: 16px;
  position: relative; z-index: 1;
}
.mv2-bal-label { font-size: 11px; color: rgba(255, 255, 255, .65); margin-bottom: 6px; }
.mv2-bal-amt { font-size: 22px; font-weight: 700; margin-bottom: 18px; }
.mv2-num { font-size: 13px; letter-spacing: 2px; color: rgba(255, 255, 255, .7); margin-bottom: 2px; }
.mv2-card-foot {
  display: flex; justify-content: space-between; font-size: 10.5px;
  color: rgba(255, 255, 255, .55); margin-top: 10px; gap: 10px;
}
.mv2-card-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv2-manni-copy {
  font-size: 12.5px; color: rgba(255, 255, 255, .82); line-height: 1.55;
  margin-bottom: 14px; position: relative; z-index: 1;
}

/* ---------- ACTIVITY ---------- */
.mv2-activity-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-top: 1px solid var(--mv2-border); gap: 12px;
}
.mv2-activity-row:first-child { border-top: none; }
.mv2-activity-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.mv2-activity-icon {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--mv2-violet-tint); color: var(--mv2-violet-deep);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  flex-shrink: 0;
}
.mv2-activity-title {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mv2-activity-sub { font-size: 11.5px; color: var(--mv2-ink-mute); margin-top: 1px; }
.mv2-activity-right { text-align: right; flex-shrink: 0; }
.mv2-activity-amt { font-size: 13px; font-weight: 600; }
.mv2-activity-time { font-size: 11px; color: var(--mv2-ink-mute); margin-top: 1px; }

/* ---------- EMPTY / LOADING ---------- */
.mv2-empty-inline {
  font-size: 12.5px; color: var(--mv2-ink-mute);
  padding: 18px 4px; text-align: center;
}
.mv2-skeleton-row {
  height: 64px; border-radius: var(--mv2-radius-md);
  background: linear-gradient(90deg, var(--mv2-bg) 25%, #EEF0F6 37%, var(--mv2-bg) 63%);
  background-size: 400% 100%;
  animation: mv2-shimmer 1.4s ease infinite;
  margin-bottom: 8px;
}
@keyframes mv2-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .mv2-skeleton-row { animation: none; }
  .mv2-pay-detail { transition: none; }
  .mv2-chev { transition: none; }
}

@media (max-width: 1080px) {
  .mv2-split { grid-template-columns: 1fr; }
  .mv2-stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .mv2 { margin: -1rem -1.5rem; padding: 20px 16px 48px; }
  .mv2-stat-grid { grid-template-columns: 1fr; }
  .mv2-alert { flex-direction: column; align-items: flex-start; }
  .mv2-month-grid { grid-template-columns: repeat(3, 1fr); }
  .mv2-pay-row.open .mv2-pay-detail { max-height: 340px; }
}
