:root {
  --navy: #142235;
  --navy-2: #1d3048;
  --ink: #1d293b;
  --muted: #66758a;
  --line: #e6ebf1;
  --surface: #ffffff;
  --bg: #f4f7fb;
  --green: #18a875;
  --green-dark: #0d855a;
  --green-soft: #e8f8f2;
  --blue: #4078e8;
  --blue-soft: #edf3ff;
  --purple: #7868e8;
  --purple-soft: #f0edff;
  --orange: #ed9a42;
  --orange-soft: #fff3e6;
  --red: #e35d70;
  --red-soft: #fff0f3;
  --shadow: 0 14px 34px rgba(24, 38, 58, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 0%, rgba(24, 168, 117, .12), transparent 26rem),
    radial-gradient(circle at 35% 10%, rgba(64, 120, 232, .08), transparent 20rem),
    var(--bg);
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, label { cursor: pointer; }
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  width: 260px;
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  color: #dbe4f0;
  background: linear-gradient(180deg, var(--navy), #0f1b2c);
  transition: transform .25s ease;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  color: #fff;
  font-family: Manrope, sans-serif;
  font-size: 21px;
  letter-spacing: -.7px;
}
.brand b { color: #75e0bd; }
.brand small {
  display: block;
  color: #91a2b7;
  font-size: 10px;
  letter-spacing: .5px;
}
.brand-mark { position: relative; width: 30px; height: 30px; transform: rotate(-8deg); }
.brand-mark span {
  position: absolute;
  bottom: 3px;
  width: 7px;
  border-radius: 5px;
  background: #75e0bd;
}
.brand-mark span:nth-child(1) { left: 1px; height: 11px; opacity: .65; }
.brand-mark span:nth-child(2) { left: 11px; height: 18px; opacity: .82; }
.brand-mark span:nth-child(3) { left: 21px; height: 25px; }

.source-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 11px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
  background: rgba(255,255,255,.055);
}
.source-logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #123629;
  background: #7ee0be;
  font-size: 11px;
  font-weight: 800;
}
.source-card small,
.source-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-card small {
  margin-bottom: 2px;
  color: #91a0b4;
  font-size: 10px;
}
.source-card strong {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.main-nav { flex: 1; overflow-y: auto; padding-right: 3px; }
.main-nav p {
  margin: 15px 12px 6px;
  color: #68788e;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.3px;
}
.nav-item {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 10px;
  color: #9caabe;
  background: transparent;
  text-align: left;
  font-weight: 600;
  transition: .18s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(117,224,189,.14); }
.nav-item.active svg { color: #75e0bd; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item span { flex: 1; }
.nav-item em {
  min-width: 24px;
  padding: 3px 6px;
  border-radius: 10px;
  color: #123629;
  background: #75e0bd;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  text-align: center;
}
.sidebar-note {
  padding: 14px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 13px;
  background: rgba(255,255,255,.045);
}
.sidebar-note strong,
.sidebar-note span { display: block; }
.sidebar-note strong {
  margin-bottom: 6px;
  color: #fff;
  font-size: 11px;
}
.sidebar-note span {
  color: #a1afc2;
  font-size: 10px;
  line-height: 1.45;
}

.main-area {
  min-height: 100vh;
  margin-left: 260px;
}
.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 68px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
}
.global-search {
  position: relative;
  width: min(520px, 42vw);
  display: flex;
  align-items: center;
}
.global-search svg {
  position: absolute;
  left: 12px;
  width: 17px;
  color: #98a3b2;
}
.global-search input {
  width: 100%;
  height: 39px;
  padding: 0 64px 0 38px;
  border: 1px solid #e3e8ee;
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: #f8fafc;
  transition: .2s;
}
.global-search input:focus {
  border-color: #72d6b5;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(24,168,117,.08);
}
.global-search kbd {
  position: absolute;
  right: 9px;
  padding: 3px 6px;
  border: 1px solid #dfe4ea;
  border-radius: 5px;
  color: #929dab;
  background: #fff;
  font-size: 9px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.live-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 20px;
  color: #536174;
  background: #f5f8fb;
  font-size: 10px;
  white-space: nowrap;
}
.live-status span:first-child {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(24,168,117,.12);
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #667386;
  background: #fff;
}
.primary-btn,
.secondary-btn {
  min-height: 39px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.primary-btn {
  border: 1px solid var(--green);
  color: #fff;
  background: var(--green);
  box-shadow: 0 5px 14px rgba(24,168,117,.18);
}
.primary-btn:hover { border-color: var(--green-dark); background: var(--green-dark); }
.secondary-btn {
  border: 1px solid #dfe5ec;
  color: #485568;
  background: #fff;
}
.secondary-btn:hover { border-color: #c5ced9; background: #fafbfc; }
.primary-btn svg,
.secondary-btn svg { width: 16px; height: 16px; }
.file-action,
.upload-actions label { position: relative; overflow: hidden; }
.file-action input,
.upload-actions input { position: absolute; inset: 0; opacity: 0; }
.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  color: var(--green-dark);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}
.block-btn { width: 100%; margin-top: 14px; }
.menu-btn { display: none; }

.view-container {
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: 30px 30px 48px;
}
.section-block {
  scroll-margin-top: 88px;
  margin-bottom: 34px;
}
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.page-heading.compact { align-items: center; }
.eyebrow {
  margin: 0 0 7px;
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.3px;
}
.page-heading h1 {
  max-width: 760px;
  margin: 0;
  color: #1c293b;
  font-family: Manrope, sans-serif;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -.9px;
}
.page-heading p {
  max-width: 740px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.heading-actions {
  display: flex;
  gap: 9px;
  align-items: center;
}
.section-counter {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #7c8898;
  background: #fff;
  font-size: 10px;
  white-space: nowrap;
}
.section-counter strong { color: #344154; }

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: -2px 0 16px;
}
.workflow-strip button {
  min-width: 0;
  padding: 12px 13px;
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: #657287;
  background: rgba(255,255,255,.88);
  text-align: left;
  transition: .18s ease;
}
.workflow-strip button:hover {
  transform: translateY(-1px);
  border-color: #bce4d6;
  box-shadow: 0 8px 18px rgba(24,38,58,.06);
}
.workflow-strip span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 800;
}
.workflow-strip strong { color: #304055; font-size: 11px; }
.workflow-strip small { margin-top: 2px; color: #8b96a5; font-size: 9px; }

.panel,
.kpi-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(26,38,57,.025);
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.kpi-card { min-width: 0; padding: 18px; }
.kpi-card.featured {
  border-color: #c8ecdf;
  background: linear-gradient(145deg,#fff 55%,#eefbf6);
}
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.kpi-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  color: var(--green);
  background: var(--green-soft);
}
.kpi-icon.blue { color: var(--blue); background: var(--blue-soft); }
.kpi-icon.purple { color: var(--purple); background: var(--purple-soft); }
.kpi-icon.orange { color: var(--orange); background: var(--orange-soft); }
.kpi-icon.red { color: var(--red); background: var(--red-soft); }
.kpi-icon svg { width: 17px; height: 17px; }
.delta {
  padding: 4px 7px;
  border-radius: 12px;
  font-size: 9px;
  font-weight: 800;
}
.delta.positive { color: #11865c; background: #eaf8f3; }
.delta.negative { color: #cf4e60; background: #fff0f3; }
.delta.neutral { color: #5b6879; background: #eef2f6; }
.kpi-card p {
  margin: 0 0 5px;
  color: #69778b;
  font-size: 11px;
  font-weight: 600;
}
.kpi-card strong {
  display: block;
  margin-bottom: 8px;
  color: #1d2a3b;
  font-family: Manrope, sans-serif;
  font-size: 24px;
  letter-spacing: -.6px;
}
.kpi-card small { color: #8994a3; font-size: 10px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.lower-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 14px;
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}
.panel-header h2 {
  margin: 0;
  color: #253247;
  font-family: Manrope, sans-serif;
  font-size: 15px;
  letter-spacing: -.25px;
}
.panel-header p {
  margin: 4px 0 0;
  color: #8390a1;
  font-size: 11px;
}
.chart-panel,
.state-panel,
.panel:not(.data-table-card):not(.upload-card):not(.mapping-card):not(.preview-card):not(.detail-panel) {
  padding: 20px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
  color: #778397;
  font-size: 10px;
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 3px;
}
.legend .paid::before { background: var(--green); }
.legend .expense::before { background: var(--red); }
.legend .debt::before { background: var(--orange); }

.chart-box {
  width: 100%;
  min-height: 280px;
  margin-top: 18px;
}
.chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.chart-grid { stroke: #edf1f5; stroke-width: 1; }
.chart-axis { stroke: #dfe5eb; stroke-width: 1; }
.axis-label { fill: #8994a3; font-size: 11px; }
.bar-paid { fill: var(--green); }
.bar-expense { fill: var(--red); opacity: .7; }
.line-debt {
  fill: none;
  stroke: var(--orange);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-point { fill: var(--orange); stroke: #fff; stroke-width: 2; }

.donut-wrap {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding-top: 20px;
}
.donut {
  width: 152px;
  height: 152px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 25%, var(--blue) 25% 50%, var(--orange) 50% 75%, var(--red) 75% 100%);
  transform: rotate(-45deg);
}
.donut::before {
  content: "";
  grid-area: 1/1;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #fff;
}
.donut div {
  z-index: 1;
  grid-area: 1/1;
  text-align: center;
  transform: rotate(45deg);
}
.donut strong,
.donut span { display: block; }
.donut strong { font: 800 19px Manrope, sans-serif; }
.donut span {
  margin-top: 3px;
  color: #8e98a6;
  font-size: 9px;
}
.donut-legend { min-width: 210px; }
.legend-row {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot.green { background: var(--green); }
.dot.blue { background: var(--blue); }
.dot.orange { background: var(--orange); }
.dot.purple { background: var(--purple); }
.dot.red { background: var(--red); }
.legend-row strong,
.legend-row small { display: block; }
.legend-row strong { color: #354155; font-size: 10px; }
.legend-row small { margin-top: 2px; color: #95a0ad; font-size: 9px; }
.legend-row b { color: #566276; font-size: 10px; }

.rank-list,
.activity-list {
  display: grid;
  gap: 10px;
  margin-top: 15px;
}
.rank-item,
.activity-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid #f0f2f5;
}
.rank-item:first-child,
.activity-item:first-child { border-top: 0; }
.rank-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 800;
  font-size: 10px;
}
.rank-copy strong,
.rank-copy small,
.activity-copy strong,
.activity-copy small { display: block; }
.rank-copy strong,
.activity-copy strong { color: #334154; font-size: 11px; }
.rank-copy small,
.activity-copy small { margin-top: 3px; color: #8c98a7; font-size: 9px; }
.rank-value { font: 800 12px Manrope, sans-serif; color: #c94d60; }
.activity-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: var(--green-dark);
  background: var(--green-soft);
}
.activity-icon svg { width: 14px; height: 14px; }
.activity-time { color: #9aa4b1; font-size: 9px; white-space: nowrap; }

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(360px, 1fr);
  gap: 14px;
  align-items: stretch;
}
.upload-card,
.mapping-card,
.preview-card {
  padding: 20px;
}
.upload-card {
  position: relative;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-style: dashed;
  background:
    radial-gradient(circle at center, rgba(24,168,117,.08), transparent 18rem),
    #fff;
}
.upload-card.dragging {
  border-color: var(--green);
  background: #f2fbf7;
}
.upload-card > input { position: absolute; inset: 0; opacity: 0; }
.upload-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 14px;
  border-radius: 18px;
  color: var(--green);
  background: var(--green-soft);
}
.upload-icon svg { width: 27px; height: 27px; }
.upload-card h2 {
  margin: 0 0 8px;
  font: 800 20px Manrope, sans-serif;
  letter-spacing: -.4px;
}
.upload-card p {
  max-width: 450px;
  margin: 0;
  color: #717e90;
  line-height: 1.5;
}
.upload-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 9px;
  margin: 18px 0 12px;
}
.upload-card small {
  max-width: 500px;
  color: #9aa4b1;
  font-size: 10px;
  line-height: 1.4;
}
.field-label {
  display: block;
  margin-top: 16px;
  color: #566276;
  font-size: 10px;
  font-weight: 800;
}
.field-label select,
.field-label input,
.field-label textarea,
.mapping-grid select,
.mapping-grid input,
.select-control {
  width: 100%;
  height: 38px;
  margin-top: 6px;
  padding: 0 10px;
  border: 1px solid #dfe5ec;
  border-radius: 9px;
  color: #344154;
  background: #fff;
  outline: none;
}
.field-label textarea {
  height: auto;
  min-height: 84px;
  padding: 10px;
  resize: vertical;
}
.select-control {
  width: auto;
  min-width: 150px;
  margin-top: 0;
}
.field-label select:focus,
.field-label input:focus,
.field-label textarea:focus,
.mapping-grid select:focus,
.select-control:focus {
  border-color: #72d6b5;
  box-shadow: 0 0 0 3px rgba(24,168,117,.08);
}
.mapping-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.field-hints {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  color: #5b6879;
  background: #f6f8fb;
  font-size: 10px;
  line-height: 1.35;
}
.hint svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--green-dark);
}
.preview-card { margin-top: 14px; }

.table-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 12px;
  padding: 12px;
}
.table-search {
  position: relative;
  min-width: 250px;
  flex: 1;
  display: flex;
  align-items: center;
}
.table-search svg {
  position: absolute;
  left: 11px;
  width: 15px;
  color: #98a3b1;
}
.table-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 35px;
  border: 1px solid #e3e7eb;
  border-radius: 9px;
  outline: none;
  background: #fafbfc;
  font-size: 11px;
}
.table-search input:focus { border-color: #75d1b2; background: #fff; }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(310px, .6fr);
  gap: 14px;
  align-items: start;
}
.data-table-card { overflow: hidden; }
.table-meta {
  min-height: 50px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.table-meta p {
  margin: 0;
  color: #7b8797;
  font-size: 10px;
}
.table-meta p strong { color: #3e4b5d; }
.table-meta > div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #929ba8;
  font-size: 10px;
}
.table-meta button {
  padding: 0;
  border: 0;
  color: #4e5a6b;
  background: none;
  font-size: 10px;
  font-weight: 800;
}
.table-meta .table-actions { flex-wrap: wrap; justify-content: flex-end; }
.table-meta .compact-btn {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #536176;
  background: #fff;
}
.table-meta .compact-btn:disabled { opacity: .42; cursor: not-allowed; }
#movementRange { margin-left: 4px; color: #9aa4b1; }
.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}
.data-table.compact { min-width: 620px; }
.empty-cell {
  padding: 28px !important;
  color: #8994a3 !important;
  text-align: center !important;
}
.data-table th {
  height: 40px;
  padding: 0 12px;
  color: #909aa8;
  background: #fafbfc;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .25px;
  text-align: left;
  text-transform: uppercase;
}
.data-table td {
  height: 58px;
  padding: 9px 12px;
  border-top: 1px solid #f0f2f4;
  color: #4e5b6e;
  font-size: 10px;
  vertical-align: middle;
}
.data-table tbody tr:hover { background: #fbfdfc; }
.data-table tbody tr.clickable { cursor: pointer; }
.numeric { text-align: right !important; font-variant-numeric: tabular-nums; }
.entity-cell strong,
.entity-cell small {
  display: block;
}
.entity-cell strong { color: #344154; font-size: 10px; }
.entity-cell small { margin-top: 3px; color: #99a3b0; font-size: 9px; }
.amount-positive { color: var(--green-dark); font-weight: 800; }
.amount-warning { color: #bc7126; font-weight: 800; }
.amount-risk { color: #c94d60; font-weight: 800; }
.progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress {
  height: 7px;
  flex: 1;
  overflow: hidden;
  border-radius: 20px;
  background: #edf1f5;
}
.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #75e0bd);
}
.progress-cell b { min-width: 38px; color: #4e5b6e; font-size: 10px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.status-pill.ok,
.status-pill.pagado { color: #12845b; background: var(--green-soft); }
.status-pill.warn,
.status-pill.casi { color: #bc7126; background: var(--orange-soft); }
.status-pill.risk,
.status-pill.vencido,
.status-pill.urgente { color: #c94d60; background: var(--red-soft); }
.status-pill.neutral,
.status-pill.proceso { color: #647285; background: #eff2f5; }
.status-pill.blue { color: #315fb8; background: var(--blue-soft); }

.detail-panel {
  position: sticky;
  top: 86px;
  padding: 18px;
}
.detail-empty {
  display: grid;
  place-items: center;
  min-height: 320px;
  color: #8994a3;
  text-align: center;
  border: 1px dashed #dce2e9;
  border-radius: 14px;
  background: #fbfcfd;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.detail-head h2 {
  margin: 0 0 5px;
  font: 800 18px Manrope, sans-serif;
}
.detail-head p { margin: 0; color: #778397; font-size: 10px; }
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 14px 0;
}
.mini-stat {
  padding: 10px;
  border-radius: 12px;
  background: #f7f9fb;
}
.mini-stat span,
.mini-stat strong { display: block; }
.mini-stat span { color: #8a95a4; font-size: 9px; }
.mini-stat strong { margin-top: 4px; color: #263347; font-size: 13px; }
.timeline {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.timeline-item {
  padding-left: 13px;
  border-left: 2px solid #dce6ee;
}
.timeline-item strong,
.timeline-item small { display: block; }
.timeline-item strong { color: #344154; font-size: 10px; }
.timeline-item small { margin-top: 3px; color: #8793a4; font-size: 9px; line-height: 1.4; }

.followup-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.follow-card,
.publish-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.follow-card.high {
  border-color: #f4c7d0;
  background: linear-gradient(145deg,#fff,#fff6f8);
}
.follow-card.medium {
  border-color: #f4d7b4;
  background: linear-gradient(145deg,#fff,#fff8ef);
}
.follow-card h3 {
  margin: 0 0 6px;
  font: 800 14px Manrope, sans-serif;
}
.follow-card p {
  margin: 0 0 12px;
  color: #667386;
  font-size: 11px;
  line-height: 1.45;
}
.follow-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.expense-grid {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 14px;
}
.report-card {
  padding: 22px;
}
.report-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.report-title h2 {
  margin: 0 0 6px;
  font: 800 20px Manrope, sans-serif;
}
.report-title p { margin: 0; color: #6d7a8d; font-size: 11px; }
.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.report-stat {
  padding: 12px;
  border-radius: 12px;
  background: #f7f9fb;
}
.report-stat span,
.report-stat strong { display: block; }
.report-stat span { color: #8a95a4; font-size: 9px; }
.report-stat strong { margin-top: 5px; font: 800 17px Manrope, sans-serif; }

.publish-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.publish-card h2 {
  margin: 10px 0 7px;
  font: 800 15px Manrope, sans-serif;
}
.publish-card p {
  margin: 0;
  color: #667386;
  font-size: 11px;
  line-height: 1.5;
}
.publish-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
}
.publish-icon.ok { color: var(--green); background: var(--green-soft); }
.publish-icon.warn { color: var(--orange); background: var(--orange-soft); }
.publish-icon.blue { color: var(--blue); background: var(--blue-soft); }

.tutorial-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr);
  gap: 14px;
  align-items: start;
}
.tutorial-main { padding: 24px; }
.tutorial-intro {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.tutorial-badge {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .7px;
}
.tutorial-intro h2 { margin: 11px 0 6px; font: 800 20px Manrope, sans-serif; }
.tutorial-intro p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.tutorial-steps {
  margin: 0;
  padding: 8px 0 0;
  list-style: none;
}
.tutorial-steps li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 13px;
  padding: 15px 0;
  border-bottom: 1px solid #eef1f4;
}
.tutorial-steps li:last-child { border-bottom: 0; padding-bottom: 0; }
.tutorial-steps li > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, var(--navy-2), var(--navy));
  font: 800 11px Manrope, sans-serif;
}
.tutorial-steps strong { color: #2d3b50; font: 800 12px Manrope, sans-serif; }
.tutorial-steps p { margin: 4px 0 7px; color: #748195; font-size: 10px; line-height: 1.5; }
.tutorial-steps .text-btn { padding: 0; font-size: 9px; }
.tutorial-side { display: grid; gap: 14px; }
.tutorial-status { padding: 21px; }
.tutorial-status h2 { margin: 12px 0 14px; font: 800 17px Manrope, sans-serif; }
.data-flow { display: grid; gap: 8px; }
.data-flow div {
  padding: 11px 12px;
  border: 1px solid #e8edf2;
  border-radius: 11px;
  background: #f9fafc;
}
.data-flow span,
.data-flow strong { display: block; }
.data-flow span { color: #8c97a5; font-size: 9px; }
.data-flow strong { margin-top: 3px; color: #354359; font-size: 11px; }
.data-flow i { color: #9aa6b4; font-size: 11px; font-style: normal; text-align: center; }
.tutorial-warning {
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-color: #f2d9bb;
  background: linear-gradient(145deg,#fff,#fff9f1);
}
.tutorial-warning h3 { margin: 1px 0 5px; font: 800 13px Manrope, sans-serif; }
.tutorial-warning p { margin: 0; color: #7d6a55; font-size: 10px; line-height: 1.5; }

.system-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.system-card {
  min-height: 190px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.system-card.featured-system {
  border-color: #c8ecdf;
  background: linear-gradient(145deg,#fff 55%,#eefbf6);
}
.system-card h2 { margin: 2px 0 7px; font: 800 15px Manrope, sans-serif; }
.system-card p { min-height: 50px; margin: 0 0 15px; color: #687589; font-size: 10px; line-height: 1.5; }
.system-card .publish-icon { flex: 0 0 auto; }
.system-card .file-action { display: inline-flex; }
.system-status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16,26,40,.48);
  opacity: 0;
  visibility: hidden;
  transition: .22s;
  backdrop-filter: blur(2px);
}
.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}
.modal {
  width: min(620px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(13,25,40,.23);
  transform: translateY(12px) scale(.98);
  transition: .22s;
}
.modal-backdrop.open .modal { transform: none; }
.modal-header {
  padding: 20px 22px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
}
.modal-kicker {
  color: var(--green-dark);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;
}
.modal-header h2 { margin: 5px 0 0; font: 800 20px Manrope, sans-serif; }
.modal-header .icon-btn { width: 32px; height: 32px; }
#modalBody { padding: 18px 22px 22px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}
.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  z-index: 140;
  right: 22px;
  bottom: 22px;
  width: 330px;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid #ccecdf;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 15px 40px rgba(20,45,35,.15);
  transform: translateY(90px);
  opacity: 0;
  transition: .3s;
}
.toast.show { transform: none; opacity: 1; }
.toast > span {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
}
.toast svg { width: 16px; height: 16px; }
.toast strong,
.toast p { display: block; margin: 0; }
.toast strong { color: #334054; font-size: 11px; }
.toast p { margin-top: 3px; color: #84909f; font-size: 9px; }
.mobile-overlay { display: none; }

@media print {
  .sidebar, .topbar, .page-heading, .table-toolbar, .toast, .mobile-overlay, .modal-backdrop { display: none !important; }
  .main-area { margin: 0; }
  .view-container { padding: 0; }
  .section-block:not(#reportes) { display: none; }
  .panel { box-shadow: none; border: 0; }
}

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid,
  .lower-grid,
  .upload-grid,
  .workspace-grid,
  .expense-grid,
  .tutorial-layout { grid-template-columns: 1fr; }
  .detail-panel { position: static; }
  .followup-grid,
  .publish-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .system-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .sidebar {
    transform: translateX(-102%);
    box-shadow: 15px 0 40px rgba(10,20,35,.18);
  }
  .sidebar.open { transform: none; }
  .main-area { margin-left: 0; }
  .menu-btn { display: grid; }
  .global-search { width: auto; flex: 1; }
  .live-status { display: none; }
  .mobile-overlay {
    position: fixed;
    z-index: 45;
    inset: 0;
    display: block;
    background: rgba(16,26,40,.4);
    opacity: 0;
    visibility: hidden;
    transition: .2s;
  }
  .mobile-overlay.open { opacity: 1; visibility: visible; }
}

@media (max-width: 680px) {
  .topbar {
    height: 60px;
    padding: 0 14px;
    gap: 9px;
  }
  .global-search kbd,
  .top-actions .secondary-btn { display: none; }
  .top-actions .primary-btn {
    width: 38px;
    padding: 0;
    font-size: 0;
  }
  .top-actions .primary-btn svg { width: 17px; height: 17px; }
  .view-container { padding: 22px 14px 36px; }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .page-heading h1 { font-size: 24px; }
  .heading-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .heading-actions button,
  .heading-actions select { flex: 1; }
  .kpi-grid,
  .workflow-strip,
  .mapping-grid,
  .followup-grid,
  .publish-grid,
  .report-grid,
  .mini-grid,
  .form-grid,
  .system-grid,
  .system-status-grid { grid-template-columns: 1fr; }
  .upload-actions {
    width: 100%;
    flex-direction: column;
  }
  .upload-actions label,
  .upload-actions button { width: 100%; }
  .donut-wrap {
    align-items: flex-start;
    flex-direction: column;
  }
  .table-search { min-width: 100%; }
  .table-meta {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }
  .table-meta .table-actions { justify-content: flex-start; }
  .tutorial-main { padding: 18px; }
  .tutorial-steps li { grid-template-columns: 32px 1fr; }
  .tutorial-steps li > span { width: 30px; height: 30px; }
  .system-card { min-height: 0; }
  .form-footer { flex-direction: column-reverse; }
  .form-footer button { width: 100%; }
  .toast {
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }
}
