/* Opening-balance migration screen. One card per budget line / ToR line item,
   surfacing the stored terms for context above the editable opening fields.
   (The app has no global .form-control, so the inputs are styled here.) */
.opening-input {
  width: 7rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-input);
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--gray-dark);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.opening-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 153, 153, 0.12);
}

/* Type-only fields — drop the up/down spinner buttons. */
.opening-input {
  -moz-appearance: textfield;
  appearance: textfield;
}

.opening-input::-webkit-outer-spin-button,
.opening-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Group heading above the ToR sections, parallel to the direct-section title. */
.ob-group-title {
  margin: 0.5rem 0 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-dark);
}

/* ── Cards ───────────────────────────────────────────────────────── */
.ob-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Single horizontal band: identity on the left, stored terms inline, then the
   editable fields + button pushed right. Wraps on narrow screens. */
.ob-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.2rem;
  background: var(--white);
}

.ob-card-head {
  flex: 1 1 200px;
  min-width: 0;
}

.ob-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--gray-dark);
}

.ob-card-meta {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--gray-mid);
}

/* Stored terms, surfaced read-only for context — inline label/value pairs. */
.ob-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  margin: 0;
  padding: 0;
}

.ob-facts > div { display: flex; flex-direction: column; }

.ob-facts dt {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-mid);
}

.ob-facts dd {
  margin: 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--gray-dark);
}

/* Spend already captured by the open-ToR rows — the admin subtracts it from the
   line total to reach the direct figure, so call it out with the help cursor. */
.ob-fact-subtract { cursor: help; }

.ob-fact-subtract dt { color: var(--teal); }

.ob-fact-subtract dd { color: var(--teal); font-weight: 600; }

/* Editable opening fields + button, pushed to the right edge of the band. */
.ob-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-left: auto;
}

.ob-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.ob-inputs label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-mid);
}

.ob-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Fixed width so the row doesn't shift when the label flips Create ↔ Save edits. */
.ob-actions .btn {
  min-width: 6.5rem;
  text-align: center;
}

/* Floats above the button so it pops in without shifting the row. */
.ob-saved {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--teal);
  white-space: nowrap;
}

/* ── Overflow to the Flexible Remuneration line ──────────────────────── */

/* Direct rows wrap the editable form and the optional Allocate-overflow button
   together, pushed to the right edge of the band (the ToR row keeps using
   .ob-form's own margin-left:auto). */
.ob-form-wrap {
  margin-left: auto;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.ob-form-wrap .ob-form { margin-left: 0; }

/* button_to renders its own <form>; strip its block spacing so the button sits
   on the same baseline as the Save button beside it. */
.ob-inline-form { margin: 0; display: flex; align-items: flex-end; }

/* Allocate control: the info tooltip stacks above the button, both pinned to the
   band's right edge so the button stays level with Save beside it. */
.ob-allocate {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.ob-allocate-btn { white-space: nowrap; }

/* Shown instead of the allocate button when a row is over budget but carries no
   EUR cost yet — the flexible line can't be costed until Actual EUR is entered. */
.ob-allocate-hint {
  align-self: center;
  font-size: 0.78rem;
  color: var(--gray-mid);
  cursor: help;
  white-space: nowrap;
}

/* Allocated state: the read-only overflow figure + Unallocate, right-aligned. */
.ob-overflow {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.ob-overflow-note { display: flex; flex-direction: column; gap: 0.15rem; }

.ob-overflow-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--teal);
  font-weight: 600;
}

.ob-overflow-figs {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--gray-dark);
}

/* A titled block header with a status badge beside the heading. Named for the
   controlling ToR section it came from, which is now a flat table; this page is
   its only remaining user, so the rule moved here out of controlling.css. */
.controlling-tor-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.controlling-tor-header h3 {
  margin: 0;
  font-size: 1rem;
}
