/* capital.css — capital and related-party ledger (lane/capital).
   Neutral surfaces, one accent, no gradients, glows or coloured edges.
   Existing theme variables only, so dark and light both follow the shell. */

.cap-section { margin: 32px 0; font-size: 13px; line-height: 20px; color: var(--text-primary); }
.cap-section .section-title { font-size: 20px; line-height: 28px; font-weight: 600; margin: 0; text-transform: none; letter-spacing: 0; }
.cap-head { margin-bottom: 16px; }
.cap-lede { color: var(--text-secondary); font-size: 13px; margin: 4px 0 0; }
.cap-muted { color: var(--text-muted); }
.cap-tnum, .cap-section .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* One language at a time; both show only if no preference is set. */
.cap-section :is(span)[lang="en"] + :is(span)[lang="zh"]::before { content: " "; }
html[data-lang="en"] .cap-section span[lang="en"] + span[lang="zh"],
html[data-lang="zh"] .cap-section span[lang="en"]:has(+ span[lang="zh"]) { display: none; }

.cap-block {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; margin-bottom: 16px;
}
.cap-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cap-block-head h5 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.cap-block-actions { display: flex; align-items: center; gap: 8px; }
.cap-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); color: var(--text-secondary); font-variant-numeric: tabular-nums;
}

.cap-table { width: 100%; border-collapse: collapse; }
.cap-table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--text-muted);
  padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.cap-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.cap-table tbody tr:last-child td { border-bottom: 0; }
.cap-table .num { text-align: right; white-space: nowrap; }
.cap-table th.num { text-align: right; }
.cap-name { font-weight: 500; }
.cap-table td.cap-tnum, .cap-table td[data-label="Account"] { white-space: nowrap; }
.cap-deadline { display: flex; flex-direction: column; gap: 0; }
.cap-sub { display: block; font-size: 12px; line-height: 16px; margin-top: 2px; }
.cap-past { color: var(--red); }
.cap-ok { color: var(--green); font-weight: 500; }
.cap-bad { color: var(--red); font-weight: 500; }
.cap-flag {
  margin-top: 8px; padding: 8px 12px; font-size: 12px; line-height: 16px;
  background: var(--bg-tertiary); border-radius: 10px; color: var(--text-secondary);
}
.cap-row-actions { display: flex; gap: 8px; justify-content: flex-end; white-space: nowrap; }

.cap-empty {
  padding: 24px 16px; text-align: center; color: var(--text-secondary);
  border: 1px dashed var(--border); border-radius: 10px;
}

.cap-queue { list-style: none; margin: 0; padding: 0; }
.cap-queue-row { border-bottom: 1px solid var(--border); padding: 8px 0; }
.cap-queue-row:last-child { border-bottom: 0; }
.cap-queue-main { display: grid; grid-template-columns: 112px 128px 1fr auto; gap: 12px; align-items: center; min-height: 32px; }
.cap-queue-amt { text-align: right; font-weight: 500; }
.cap-queue-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cap-gaps { list-style: none; margin: 4px 0 0; padding: 0 0 0 124px; font-size: 12px; line-height: 16px; color: var(--text-muted); }
.cap-needs p { margin: 0; }
.cap-btn { min-height: 32px; transition: background-color 150ms cubic-bezier(.2,.8,.2,1), border-color 150ms cubic-bezier(.2,.8,.2,1); }
.cap-btn:focus-visible, .cap-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cap-form { margin: 12px 0 4px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-secondary); }
.cap-form-row > td { padding: 0 12px 12px; }
.cap-form-note { margin: 0 0 12px; color: var(--text-secondary); }
.cap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.cap-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cap-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.cap-hint { font-size: 12px; color: var(--text-muted); }
.cap-input {
  height: 32px; padding: 0 8px; border: 1px solid var(--border-light, var(--border)); border-radius: 8px;
  background: var(--bg-input); color: var(--text-primary); font: inherit; font-size: 13px; min-width: 0; width: 100%;
}
.cap-check { display: flex; align-items: center; gap: 8px; min-height: 32px; align-self: end; }
.cap-needs { grid-column: 1 / -1; font-size: 12px; color: var(--text-secondary); }
.cap-needs:empty { display: none; }
.cap-needs-title { font-weight: 500; margin-bottom: 4px; }
.cap-needs ul { margin: 0; padding-left: 16px; }
.cap-error { display: none; margin-top: 12px; color: var(--red); font-size: 13px; }
.cap-error.is-visible { display: block; }
.cap-actions { display: flex; gap: 8px; margin-top: 12px; }

.cap-disclaimer { margin: 16px 0 0; font-size: 12px; color: var(--text-muted); }

.cap-skel { display: grid; gap: 8px; }
.cap-skel span { height: 48px; border-radius: 10px; background: var(--bg-tertiary); animation: cap-pulse 1.2s ease-in-out infinite; }
@keyframes cap-pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) {
  .cap-skel span { animation: none; }
  .cap-btn { transition: none; }
}

@media (max-width: 768px) {
  .cap-block { padding: 12px; }
  .cap-grid { grid-template-columns: 1fr; }
  .cap-input, .cap-btn, .cap-check { min-height: 44px; height: 44px; }
  .cap-check { height: auto; }
  .cap-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cap-table, .cap-table tbody, .cap-table tr, .cap-table td { display: block; width: 100%; }
  .cap-table tr { padding: 8px 0; border-bottom: 1px solid var(--border); }
  .cap-table tbody tr:last-child { border-bottom: 0; }
  .cap-table td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 16px; text-align: right; }
  .cap-table td::before { content: attr(data-label); color: var(--text-muted); font-size: 12px; text-align: left; flex: none; }
  .cap-table td:first-child { display: block; text-align: left; }
  .cap-deadline { align-items: flex-end; }
  .cap-table td:first-child::before { display: none; }
  .cap-table .num { text-align: right; }
  .cap-table td.cap-row-actions { justify-content: flex-start; gap: 8px; padding-top: 8px; }
  .cap-row-actions .cap-btn { flex: 1; }
  .cap-form-row, .cap-form-row > td { display: block; }
  .cap-gaps { padding-left: 0; }
  .cap-queue-main { grid-template-columns: 1fr auto; }
  .cap-queue-desc { grid-column: 1 / -1; white-space: normal; order: 3; }
  .cap-queue-main .cap-btn { grid-column: 1 / -1; order: 4; }
  .cap-actions .cap-btn { flex: 1; }
}
