/* ==========================================================================
   HR Labor Cost Dashboard · borrador
   ========================================================================== */

:root {
  --ink: #1a1030;
  --ink-2: #4a3f63;
  --muted: #7c7393;
  --purple: #2a1a4e;
  --purple-2: #3b2769;
  --purple-3: #6b4fb8;
  --red: #e11d3f;
  --red-dark: #b3122f;
  --gray: #6b6b6b;
  --green: #1e9e6a;
  --amber: #f5a623;
  --bg: #f4f1fa;
  --card: #fff;
  --line: #ede8f5;
  --line-2: #e2daef;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(42, 26, 78, 0.06);
  --shadow-lg: 0 18px 50px rgba(26, 16, 48, 0.22);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --num: 'Barlow Condensed', 'Inter', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

/* ---------------------------------------------------------------- ribbon */
.ribbon {
  background: linear-gradient(90deg, #f7b84b, #f5a623);
  color: #3a2600;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ribbon .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8a5a00;
  box-shadow: 0 0 0 3px rgba(138, 90, 0, 0.16);
}

/* ---------------------------------------------------------------- header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 2px solid var(--red);
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 26px;
  box-shadow: 0 3px 18px rgba(42, 26, 78, 0.05);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 0.9;
  flex: 0 0 auto;
  padding-right: 22px;
  border-right: 1px solid var(--line);
}

.brand .mark {
  font-size: 29px;
  font-weight: 900;
  letter-spacing: -0.045em;
  color: #141018;
}

.brand .mark .r {
  font-size: 8px;
  vertical-align: super;
  font-weight: 600;
  letter-spacing: 0;
  color: #6a6376;
}

.brand .mark .o {
  color: var(--red);
}

.brand .sub {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--red);
  margin-top: 3px;
}

.head-title {
  flex: 1 1 auto;
  min-width: 220px;
}

.head-title h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--red);
}

.head-title .sub {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.head-title .sub select {
  border: 0;
  background: transparent;
  font-weight: 700;
  color: var(--ink);
  font-size: 11.5px;
  cursor: pointer;
  padding: 0 2px;
  border-bottom: 1px dashed var(--line-2);
  border-radius: 0;
}

.head-title .sub select:focus {
  outline: none;
  border-bottom-color: var(--purple-3);
}

.head-tools {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.field > label {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 2px;
}

.select,
.input {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  padding: 7px 30px 7px 10px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237c7393' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  max-width: 190px;
}

.select:hover {
  border-color: #cdc1e6;
}

.select:focus,
.input:focus,
textarea:focus {
  outline: none;
  border-color: var(--purple-3);
  box-shadow: 0 0 0 3px rgba(107, 79, 184, 0.14);
}

.select.small,
.select.role {
  max-width: 138px;
}

.divider-v {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 0 2px;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 2px;
  background: #fff;
  gap: 2px;
}

.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
}

.seg button.on {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 1px 4px rgba(42, 26, 78, 0.25);
}

/* ---------------------------------------------------------------- layout */
.app-body {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 104px);
}

.rail {
  width: 74px;
  flex: 0 0 74px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: flex-start;
  z-index: 30;
}

.rail-btn {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #6e6488;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.16s;
  position: relative;
}

.rail-btn svg {
  width: 21px;
  height: 21px;
}

.rail-btn:hover {
  background: #f4f0fb;
  color: var(--purple);
}

.rail-btn.on {
  background: linear-gradient(150deg, #3f2a79, #241645);
  color: #fff;
  box-shadow: 0 4px 13px rgba(42, 26, 78, 0.28);
}

.rail-btn.on::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: var(--red);
}

.rail-spacer {
  flex: 1;
}

.view {
  flex: 1 1 auto;
  min-width: 0;
  padding: 16px 22px 48px;
  max-width: 1640px;
  margin: 0 auto;
  width: 100%;
}

/* ---------------------------------------------------------------- kpis */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 13px 15px 12px;
  min-height: 108px;
  color: #fff;
  background: linear-gradient(150deg, #3a2568 0%, #251545 100%);
  box-shadow: 0 4px 16px rgba(42, 26, 78, 0.16);
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s;
}

.kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(42, 26, 78, 0.24);
}

.kpi.gray {
  background: linear-gradient(150deg, #7b7b7b 0%, #5d5d5d 100%);
  box-shadow: 0 4px 16px rgba(60, 60, 60, 0.18);
}

.kpi.gray:hover {
  box-shadow: 0 10px 26px rgba(60, 60, 60, 0.26);
}

.kpi.variance-card {
  background: linear-gradient(150deg, #43183a 0%, #2a1026 100%);
}

.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.005em;
  color: rgba(255, 255, 255, 0.88);
  max-width: 150px;
  min-height: 27px;
}

.kpi-label.wide {
  max-width: none;
}

.kpi-delta {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  white-space: nowrap;
}

.kpi-delta.up {
  color: #ffc4ce;
}

.kpi-delta.down {
  color: #a6ebc6;
}

.kpi-delta.flat {
  color: rgba(255, 255, 255, 0.65);
}

.kpi-value {
  font-family: var(--num);
  font-size: 33px;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1.05;
  margin-top: 6px;
}

.kpi-value.red {
  color: #ff4d63;
}

.kpi.gray .kpi-value.red {
  color: #ffd2d9;
}

.kpi-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 3px;
  padding-right: 52px;
}

.kpi-spark {
  position: absolute;
  right: 8px;
  bottom: 24px;
  width: 74px;
  height: 30px;
  opacity: 0.65;
  pointer-events: none;
}

/* ---------------------------------------------------------------- cards */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.card {
  background: var(--card);
  border: 1.5px solid rgba(225, 29, 63, 0.7);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 13px 16px 10px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s;
}

.card:hover {
  border-color: rgba(225, 29, 63, 0.95);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  min-height: 26px;
}

.card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1.15;
}

.card-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 4px;
  border-radius: 6px;
  opacity: 0.55;
  transition: all 0.15s;
  white-space: nowrap;
}

.card-link:hover {
  opacity: 1;
  color: var(--purple-3);
  background: #f4f0fb;
}

.legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
}

.legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: -1px;
}

.legend i.line {
  width: 14px;
  height: 2.5px;
  border-radius: 2px;
  position: relative;
}

.legend i.line::after {
  content: '';
  position: absolute;
  left: 4px;
  top: -2.5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid currentColor;
}

.chart {
  width: 100%;
  height: 272px;
  min-width: 0;
}

.chart.tall {
  height: 300px;
}

.chart-fill {
  height: 100%;
  min-height: 0;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.split-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 4px;
  align-items: center;
}

.callouts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.callout {
  background: #faf8fe;
  border: 1px solid #efe9f8;
  border-radius: 11px;
  padding: 9px 10px;
  text-align: center;
}

.callout .c-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.2;
  display: block;
}

.callout .c-value {
  font-family: var(--num);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  display: block;
  margin-top: 2px;
}

.callout .c-value.red {
  color: var(--red);
}

.callout .c-value.green {
  color: var(--green);
}

.callout .c-value.ink {
  color: var(--ink);
}

/* composition legend */
.comp-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
  gap: 2px;
  align-items: center;
  height: 272px;
}

.comp-legend {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-left: 4px;
}

.comp-legend .row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.comp-legend .row i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.comp-legend .row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comp-legend .row .val {
  font-family: var(--num);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

/* hr indicators */
.hr-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

.hr-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px dashed var(--line);
}

.hr-list li:last-child {
  border-bottom: 0;
}

.hr-ico {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #f4f0fb;
  color: var(--purple-2);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.hr-ico svg {
  width: 16px;
  height: 16px;
}

.hr-label {
  flex: 1;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.2;
}

.hr-value {
  font-family: var(--num);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- pages */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.page-head h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  max-width: 720px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-title .hint {
  font-size: 11.5px;
  color: var(--muted);
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn:hover {
  border-color: #c9bee6;
  background: #faf8fe;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #3f2a79, #241645);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(42, 26, 78, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4a3390, #2b1a52);
  filter: brightness(1.05);
}

.btn-danger {
  color: var(--red);
  border-color: #f3c4cd;
  background: #fff7f9;
}

.btn-danger:hover {
  background: #ffeef2;
  border-color: #eaa3b1;
}

.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--purple-3);
  padding: 6px 8px;
}

.btn-ghost:hover {
  background: #f4f0fb;
}

.btn-sm {
  padding: 5px 9px;
  font-size: 11.5px;
  border-radius: 8px;
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.btn-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.table th {
  text-align: left;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: #fcfbfe;
}

table.table th.th-num {
  text-align: right;
}

table.table td {
  padding: 9px 10px;
  border-bottom: 1px solid #f5f2fa;
  vertical-align: middle;
}

table.table tr:last-child td {
  border-bottom: 0;
}

table.table tbody tr:hover {
  background: #fbf9fe;
}

table.table tr.is-deleted td {
  background: #fff7f9;
  color: #a99aae;
}

table.table tr.is-deleted td .num,
table.table tr.is-deleted td .dept-name {
  text-decoration: line-through;
}

table.table tfoot td {
  border-top: 1.5px solid var(--line-2);
  font-weight: 700;
  background: #fcfbfe;
  border-bottom: 0;
}

.num {
  text-align: right;
  font-family: var(--num);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.dept-name {
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 11px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge.ok {
  background: #e8f7ef;
  color: #157a52;
}

.badge.garbage {
  background: #fde8ec;
  color: var(--red-dark);
}

.badge.import {
  background: #efe9fb;
  color: var(--purple-2);
}

.badge.demo {
  background: #f1eef7;
  color: #6d6486;
}

.badge.manual {
  background: #fdf3e3;
  color: #9a6207;
}

/* ---------------------------------------------------------------- trend */
.trend-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.trend-kpi {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.trend-kpi .big {
  font-family: var(--num);
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}

.trend-deltas {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.delta-box {
  border: 1px solid var(--line);
  background: #fcfbfe;
  border-radius: 10px;
  padding: 7px 11px;
  min-width: 104px;
}

.delta-box .l {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  display: block;
}

.delta-box .v {
  font-family: var(--num);
  font-size: 21px;
  font-weight: 700;
  display: block;
  line-height: 1.15;
}

.delta-box .v.red {
  color: var(--red);
}

.delta-box .v.green {
  color: var(--green);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  background: #fcfbfe;
}

.stat .l {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.stat .v {
  font-family: var(--num);
  font-size: 22px;
  font-weight: 700;
  margin-top: 2px;
}

/* ---------------------------------------------------------------- import */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.step {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.step .n {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f0ecf8;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 auto;
}

.step.active {
  border-color: #cabee8;
  background: #faf8fe;
  color: var(--ink);
}

.step.active .n {
  background: var(--purple);
  color: #fff;
}

.step.done {
  color: var(--ink-2);
  border-color: #cdeadd;
  background: #f7fdfa;
}

.step.done .n {
  background: var(--green);
  color: #fff;
}

.dropzone {
  border: 2px dashed #d8cff0;
  border-radius: 16px;
  background: #fcfaff;
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
}

.dropzone:hover,
.dropzone.drag {
  border-color: #8b6fd4;
  background: #f8f3ff;
}

.dz-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto 10px;
  border-radius: 14px;
  background: linear-gradient(150deg, #efe7ff, #e2d7fb);
  color: var(--purple-2);
  display: grid;
  place-items: center;
}

.dz-icon svg {
  width: 24px;
  height: 24px;
}

.dropzone .dz-main {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dropzone .dz-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #faf8fe;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 12px;
  font-size: 12.5px;
}

.file-chip .fi {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #e8f7ef;
  color: var(--green);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.file-chip .fname {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warn-box {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: #fffaf0;
  border: 1px solid #f7e0b0;
  color: #7a5203;
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 12px;
  margin-top: 12px;
}

.warn-box.info {
  background: #f7f4ff;
  border-color: #ddd2f6;
  color: #4a3681;
}

.warn-box svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  background: #fcfbfe;
}

.stat-card .l {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.stat-card .v {
  font-family: var(--num);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 2px;
}

.stat-card .v.green {
  color: var(--green);
}

.stat-card .v.red {
  color: var(--red);
}

.stat-card .h {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 1px;
}

.mapping-row {
  display: grid;
  grid-template-columns: 178px 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

.mapping-row:last-child {
  border-bottom: 0;
}

.mapping-row .arrow {
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.mapping-row .target {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
}

.tag-auto {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #157a52;
  background: #e8f7ef;
  border-radius: 4px;
  padding: 1px 4px;
}

.tag-manual {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a6207;
  background: #fdf3e3;
  border-radius: 4px;
  padding: 1px 4px;
}

.confirm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(135deg, #faf8ff, #f3eefc);
  border: 1px solid #e2d8f6;
  border-radius: 13px;
  padding: 13px 16px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.confirm-bar .txt {
  font-size: 12.5px;
  color: var(--ink-2);
}

.confirm-bar .txt b {
  color: var(--ink);
}

/* ---------------------------------------------------------------- export */
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 14px;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12.5px;
  transition: background 0.14s;
}

.check:hover {
  background: #faf8fe;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--purple-2);
  cursor: pointer;
}

.check .rows {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.radio-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}

.radio-pill input {
  accent-color: var(--purple-2);
  margin: 0;
}

.radio-pill.on {
  border-color: #b9a8e2;
  background: #faf8ff;
  color: var(--purple-2);
}

.sheet-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 12px;
  background: #fcfbfe;
}

.sheet-item .ic {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #e8f7ef;
  color: #157a52;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 800;
  flex: 0 0 auto;
}

/* ---------------------------------------------------------------- misc */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: flex-end;
}

.toast {
  background: #fff;
  border-left: 4px solid var(--green);
  border-radius: 11px;
  box-shadow: 0 12px 34px rgba(26, 16, 48, 0.18);
  padding: 11px 15px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 360px;
  animation: toastIn 0.22s ease-out;
}

.toast.warn {
  border-left-color: var(--amber);
}

.toast.err {
  border-left-color: var(--red);
}

.toast svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(26, 16, 48, 0.46);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 0.16s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: min(520px, 100%);
  max-height: 92vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  padding: 20px 22px;
  animation: pop 0.18s ease-out;
}

@keyframes pop {
  from {
    transform: translateY(10px) scale(0.985);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.modal h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal .m-sub {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 14px;
}

.modal .m-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.field-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
  display: block;
}

textarea.input {
  resize: vertical;
  min-height: 74px;
  padding-right: 10px;
  background-image: none;
  cursor: text;
}

.empty {
  text-align: center;
  padding: 26px 10px;
  color: var(--muted);
  font-size: 12px;
}

.audit-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.audit-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--line);
  align-items: start;
}

.audit-item:last-child {
  border-bottom: 0;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(140deg, #4b3287, #2a1a4e);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.audit-item .who {
  font-size: 12px;
  font-weight: 700;
}

.audit-item .what {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-top: 1px;
}

.audit-item .why {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  font-style: italic;
}

.audit-item .when {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  background: #f6f3fc;
  border: 1px solid #ece5f8;
  border-radius: 999px;
  padding: 3px 9px;
}

.chip-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.how-card {
  display: flex;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fcfbfe;
}

.how-n {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #efe7ff;
  color: var(--purple-2);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 11px;
  flex: 0 0 auto;
}

.how-card b {
  display: block;
  font-size: 12.5px;
  margin-bottom: 2px;
}

.how-card p {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

.lock-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fdf3e3;
  border: 1px solid #f5dfb6;
  color: #7a5203;
  border-radius: 11px;
  padding: 9px 12px;
  font-size: 12px;
  margin-bottom: 12px;
}

.lock-banner svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.inline-edit {
  width: 96px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 5px 7px;
  font-family: var(--num);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  background: #fff;
}

.inline-edit:focus {
  outline: none;
  border-color: var(--purple-3);
  box-shadow: 0 0 0 3px rgba(107, 79, 184, 0.13);
}

.fade-in {
  animation: fadeUp 0.24s ease-out;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #d8cfe9;
  border-radius: 8px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: #c2b5dd;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------------------------------------------------------------- one-screen */
.view-fit {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 12px;
  padding-bottom: 12px;
  min-height: 0;
}

.view-fit > .fade-in {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.view-fit .kpi-grid {
  flex: 0 0 auto;
  margin-bottom: 10px;
  gap: 10px;
}

.view-fit .kpi {
  min-height: 92px;
  padding: 10px 13px;
}

.view-fit .kpi-value {
  font-size: 30px;
  margin-top: 4px;
}

.view-fit .kpi-label {
  min-height: 26px;
}

.view-fit .kpi-spark {
  width: 64px;
  height: 26px;
  bottom: 18px;
}

.view-fit .dash-grid {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.view-fit .card {
  min-height: 0;
  overflow: hidden;
  padding: 10px 14px 8px;
}

.view-fit .card-head {
  margin-bottom: 2px;
  min-height: 22px;
}

.view-fit .card h2 {
  font-size: 16.5px;
}

.view-fit .card-body {
  flex: 1 1 auto;
  min-height: 0;
}

.view-fit .split-2 {
  height: 100%;
  align-items: stretch;
}

.view-fit .callouts {
  justify-content: center;
}

.view-fit .chart {
  height: 100%;
  min-height: 0;
}

.view-fit .comp-wrap {
  height: 100%;
  min-height: 0;
}

.view-fit .chart-fill {
  height: 100%;
}

.view-fit .hr-list li {
  padding: 7px 2px;
}

.view-fit .callout {
  padding: 7px 9px;
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kpi {
    min-height: 100px;
  }
}

@media (max-width: 1180px) {
  .dash-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-header {
    gap: 16px;
  }

  .head-title h1 {
    font-size: 20px;
  }

  .brand {
    padding-right: 14px;
  }

  .trend-hero {
    grid-template-columns: 1fr;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-body {
    flex-direction: column;
    min-height: 0;
  }

  .rail {
    width: 100%;
    flex: 0 0 auto;
    height: auto;
    position: static;
    flex-direction: row;
    justify-content: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 7px 10px;
    gap: 4px;
  }

  .rail-btn {
    width: 44px;
    height: 40px;
  }

  .rail-btn.on::before {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: -7px;
    width: auto;
    height: 3px;
  }

  .rail-spacer {
    display: none;
  }

  .view {
    padding: 14px 14px 40px;
  }

  .app-header {
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 10px;
  }

  .brand {
    border-right: 0;
  }

  .head-title {
    order: 2;
    flex-basis: 100%;
    min-width: 0;
  }

  .head-tools {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .select {
    max-width: 150px;
  }
}

@media (max-width: 760px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .comp-wrap {
    grid-template-columns: 1fr;
    height: auto;
  }

  .comp-wrap > .chart-fill {
    height: 240px;
  }

  .comp-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    padding-bottom: 8px;
  }

  .split-2 {
    grid-template-columns: 1fr;
  }

  .callouts {
    flex-direction: row;
    padding: 0 4px 6px;
  }

  .callout {
    flex: 1;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .how-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid,
  .stat-row {
    grid-template-columns: 1fr 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .mapping-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .mapping-row .arrow {
    display: none;
  }

  .trend-kpi .big {
    font-size: 42px;
  }

  .head-title h1 {
    font-size: 18px;
  }

  .page-head h1 {
    font-size: 20px;
  }
}

/* ---------------------------------------------------------------- alturas */
@media (max-height: 900px) {
  .view-fit .kpi {
    min-height: 84px;
  }

  .view-fit .kpi-value {
    font-size: 27px;
  }

  .view-fit .kpi-label {
    font-size: 10px;
    min-height: 24px;
  }

  .view-fit .kpi-sub {
    font-size: 9.5px;
  }

  .view-fit .card h2 {
    font-size: 15.5px;
  }

  .view-fit .hr-list li {
    padding: 6px 2px;
  }

  .view-fit .hr-value {
    font-size: 17px;
  }
}

@media (max-height: 800px) {
  .ribbon {
    padding: 4px 10px;
    font-size: 9px;
  }

  .app-header {
    padding: 7px 18px;
  }

  .head-title h1 {
    font-size: 19px;
  }

  .head-title .sub {
    font-size: 10.5px;
  }

  .view-fit {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .view-fit .kpi {
    min-height: 74px;
    padding: 8px 11px;
  }

  .view-fit .kpi-value {
    font-size: 24px;
  }

  .view-fit .kpi-sub {
    font-size: 9px;
  }

  .view-fit .kpi-spark {
    display: none;
  }

  .view-fit .card {
    padding: 8px 12px 6px;
  }

  .view-fit .card h2 {
    font-size: 15px;
  }

  .view-fit .hr-ico {
    width: 25px;
    height: 25px;
  }

  .view-fit .hr-value {
    font-size: 15.5px;
  }

  .view-fit .hr-label {
    font-size: 11px;
  }
}
