.kpimanual-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-size: 13px;
  color: #1e2533;
}

// ── Filter bar ─────────────────────────────────────────────────────────────
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 10px 14px;
  background: #f5f7fa;
  border-bottom: 1px solid #dde2ea;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.filter-field {
  display: flex; flex-direction: column; gap: 3px;
}

.filter-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: #5f6b7a;
}

.filter-input {
  padding: 5px 8px; border: 1px solid #ccd3de; border-radius: 4px;
  font-size: 12px; outline: none; min-width: 130px; box-sizing: border-box;
  &:focus { border-color: #1a73e8; }
}

.btn-load {
  padding: 6px 18px; background: #1a73e8; color: #fff; border: none;
  border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer; align-self: flex-end;
  &:hover:not(:disabled) { background: #1558b0; }
  &:disabled { opacity: 0.6; cursor: default; }
}

.load-msg {
  padding: 6px 14px; font-size: 12px; color: #5f6b7a;
  background: #f9fafc; border-bottom: 1px solid #dde2ea; flex-shrink: 0;
}

// ── Data grid ──────────────────────────────────────────────────────────────
.grid-wrap {
  flex: 1; overflow: auto;
}

.data-table {
  width: 100%; border-collapse: collapse; font-size: 12px;

  th {
    position: sticky; top: 0; z-index: 1;
    background: #eef1f6; color: #5f6b7a; font-weight: 700;
    text-transform: uppercase; font-size: 10px; letter-spacing: 0.4px;
    padding: 6px 10px; text-align: left; border-bottom: 2px solid #dde2ea;
    white-space: nowrap;
  }

  td { padding: 5px 10px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: #f9fafc; }

  tr.row-dirty td { background: #fffde7; }
  tr.row-saved td { background: #f1f8e9; }
}

.th-num, .td-num { text-align: right; }
.th-status, .td-status { width: 28px; text-align: center; }
.th-action, .td-action { width: 60px; text-align: center; white-space: nowrap; }

.td-name { font-weight: 600; min-width: 160px; }

.cell-input {
  padding: 3px 6px; border: 1px solid #ccd3de; border-radius: 3px;
  font-size: 12px; outline: none; width: 90px; text-align: right; box-sizing: border-box;
  &:focus { border-color: #1a73e8; }
}

.badge-saved  { color: #2e7d32; font-weight: 700; font-size: 13px; }
.badge-dirty  { color: #f57c00; font-size: 11px; }
.badge-saving { color: #9eaab6; font-size: 11px; }

.btn-save-row {
  background: #e8f0fe; color: #1a73e8; border: 1px solid #c5d8fc;
  border-radius: 3px; font-size: 12px; padding: 2px 6px; cursor: pointer;
  &:hover:not(:disabled) { background: #d2e3fc; }
  &:disabled { opacity: 0.4; cursor: default; }
}

.btn-remove-row {
  background: none; border: none; color: #b71c1c; cursor: pointer;
  font-size: 12px; padding: 2px 5px; border-radius: 3px; margin-left: 2px;
  &:hover:not(:disabled) { background: #fce8e6; }
  &:disabled { opacity: 0.4; }
}

// ── Add section ────────────────────────────────────────────────────────────
.add-section {
  border-top: 2px solid #dde2ea;
  padding: 10px 14px 12px;
  background: #f9fafc;
  flex-shrink: 0;
}

.add-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: #5f6b7a; margin-bottom: 8px;
}

.add-row {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
}

.add-field {
  display: flex; flex-direction: column; gap: 3px;
}

.add-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: #5f6b7a;
}

.add-input {
  padding: 5px 8px; border: 1px solid #ccd3de; border-radius: 4px;
  font-size: 12px; outline: none; min-width: 110px; box-sizing: border-box;
  &:focus { border-color: #1a73e8; }
}

.required { color: #e53935; }

.btn-add {
  padding: 6px 16px; background: #1a73e8; color: #fff; border: none;
  border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer;
  align-self: flex-end;
  &:hover { background: #1558b0; }
}
