:root{
  --bg: #ffffff;
  --text: #111111;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #111111;
  --accent-weak: #f3f4f6;
  --success: #0ea5e9;
  --btn-bg: #111111;
  --btn-text: #ffffff;
}

*{ box-sizing: border-box; }

html,body{
  margin:0;
  padding:0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.4;
}

.container{
  max-width: 980px;
  margin: 0 auto;
  padding: 20px;
}

h1{
  margin: 12px 0 4px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.subvalue{
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.toolbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 16px;
  flex-wrap: wrap;
}

.period{
  display:flex;
  align-items:center;
  gap: 8px;
}

.salary{
  display:flex;
  align-items:center;
  gap:8px;
}

select{
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.actions{
  display:flex;
  gap: 8px;
}

.btn{
  appearance: none;
  border: none;
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
  font-weight: 600;
}

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

.btn.secondary{
  background: var(--accent-weak);
  color: var(--text);
  border: 1px solid var(--line);
}

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

.card{
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 12px;
  background: #fff;
}

.card .label{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.card .value{
  font-size: 22px;
  font-weight: 600;
}

.card.highlight{
  border-color: #dbeafe;
  background: #f8fbff;
}

.table-wrap{
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

table{
  width:100%;
  border-collapse: collapse;
}

/* Dar más espacio a la primera columna (concepto) */
thead th:first-child,
tbody td:first-child{
  width: 50%;
}

thead th{
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  background: #fafafa;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

tbody td{
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:last-child td{
  border-bottom: none;
}

.right{ text-align: right; }
.center{ text-align: center; }

.input-money{
  width: 160px;
  text-align: right;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor:pointer;
  transition: background 120ms ease, color 120ms ease, border 120ms ease;
  font-weight: 600;
}

.toggle.on{ background:#16a34a; color:#fff; border-color:#16a34a; }
.toggle:not(.on){ background:#ef4444; color:#fff; border-color:#ef4444; }

.badge{
  display:inline-block;
  min-width: 52px;
  text-align:right;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  font-feature-settings: "tnum";
}

.row-dim{
  opacity: .55;
}

.name-input{
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.row-actions{
  display:flex;
  gap: 6px;
  justify-content: center;
}

.icon-btn{
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  cursor:pointer;
}
.icon-btn:hover{ background: #f5f5f5; }

.segmented{
  display:inline-flex; gap:4px; background:#fff; border:1px solid var(--line);
  border-radius:999px; padding:4px;
}

.seg-btn{
  border:none; background:transparent; padding:6px 10px; border-radius:999px;
  cursor:pointer; font-weight:600;
}

.seg-btn.active{ background:#0f172a; color:#fff; }

.row-top{
  border-left: 4px solid #ef4444;
  background: #fff5f5;
}

dialog{ border:none; border-radius:12px; padding:16px 18px; box-shadow:0 10px 30px rgba(0,0,0,.15); }
dialog::backdrop{ background: rgba(0,0,0,.3); }

/* Responsive */
@media (max-width: 780px){
  .summary{ grid-template-columns: 1fr; }
  .input-money{ width: 120px; }
  thead th:nth-child(3),
  tbody td:nth-child(3){
    display:none; /* oculta % en móvil para simplificar */
  }
}