/* A LEDGER ON SCREEN (ledger-panel.js): the balance first, then a stretch of dates,
 * then every line, then whether the lines agree with what they explain.
 * The look is job work's ledger, so every ledger reads the same (D431). */
.k-ledger {
  display: block;
  min-width: 0;
}

.k-ledger__balance {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.k-ledger__totals {
  color: var(--text-muted);
  margin: 0 0 12px;
}

.k-ledger__card:empty {
  display: none;
}

.k-ledger__card {
  margin: 0 0 12px;
}

/* THE STRIP UNDER THE TABLE (his drawing, Part 2): green when the lines come to what
 * the shelf holds, amber when they do not. A dot, then one line of words. */
.k-ledger__strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 0;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-weight: 500;
  line-height: 1.4;
}

.k-ledger__strip::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 0.45em;
  border-radius: 50%;
  background: currentColor;
}

.k-ledger__strip--agrees {
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid var(--ok-border);
}

.k-ledger__strip--differs {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-edge);
}

/* From and To sit IN the bar of buttons, beside the table names, each label beside its box so the
 * row is no taller than a button. The boxes keep their own width -- a form field would stretch. */
.k-range__pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.k-range__pair .k-form__label {
  margin: 0;
}

.k-range__date {
  width: 10.5rem;
}

/* THE ROW THE DATES SIT IN when a ledger has the screen to itself. */
.k-ledger__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

/* WHERE ONE PURCHASE WENT (his drawing, Part 1, the plain list): the bill on top, then one
 * line per use, each opening in place to what is behind it; a quiet line for what nothing traces. */
.k-trace {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 560px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.k-trace__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px 12px;
}

.k-trace__from {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.k-trace__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.k-trace__list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.k-trace__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
}

.k-trace__press {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: inherit;
  font-family: var(--font);
  font-size: inherit;
  text-align: left;
  cursor: pointer;
}

.k-trace__press:hover {
  background: var(--surface-raised);
}

.k-trace__amount {
  min-width: 4rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
}

.k-trace__words {
  flex: 1;
}

.k-trace__chevron {
  color: var(--accent);
  font-size: 0.75rem;
}

.k-trace__items {
  flex: 1 1 100%;
  margin: 0 0 10px;
  padding: 4px 12px;
  background: var(--surface-raised);
  border-radius: 8px;
}

.k-trace__item {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.k-trace__code,
.k-trace__qty {
  font-family: var(--font-mono);
  color: var(--text);
}

.k-trace__untraced {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-subtle);
}

/* A "NOT RECORDED" LINE (his drawing, Part 3): quiet, grey and slanted, so it reads as
 * something whose detail was never kept rather than as an ordinary line. */
.k-ledger__row--not-recorded .k-table__cell {
  background: var(--bg);
  color: var(--text-subtle);
  font-style: italic;
}

/* THE SHARED DATE BOX (date-box.js): DD-MM-YYYY, wide enough for it and no wider. */
.k-date-box {
  width: 8.5rem;
}

.k-date-box--wrong {
  border-color: var(--warn);
}

.k-range__wrong {
  color: var(--warn);
  font-size: 0.85rem;
}
