.ledger-app { max-width: 1440px; }
.ledger-app .content { padding-bottom: 24px; }
.ledger-app .refresh-btn { text-decoration: none; }
.ledger-app .refresh-btn i, .back-link i { width: 15px; height: 15px; }

.ledger-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 38px; margin: 4px 0 10px; }
.ledger-title-row { display: flex; align-items: center; min-width: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 34px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink-2); background: #fff; text-decoration: none; font-size: 12px; transition: border-color .15s, color .15s, background .15s; }
.back-link:hover { color: var(--blue); border-color: #b9cbff; background: var(--blue-soft); }
.title-divider { width: 1px; height: 28px; margin: 0 12px; background: var(--line); }
.ledger-head h1 { font-size: 21px; line-height: 1.15; letter-spacing: -.4px; }
.ledger-head p { margin-top: 3px; color: var(--muted); font-size: 11px; }

.ledger-months { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 10px; padding: 3px; border-radius: 10px; scrollbar-width: thin; }
.ledger-months .month-btn { min-height: 34px; flex: 1 0 64px; padding: 5px 10px; font-size: 12px; }

.ledger-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.summary-card { width: 100%; min-width: 0; min-height: 82px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.summary-card:hover { border-color: #adc5ff; box-shadow: 0 6px 18px rgba(36, 80, 155, .1); transform: translateY(-1px); }.summary-card.is-active { border-color: var(--blue); box-shadow: 0 0 0 3px #eaf0ff, var(--shadow); }.summary-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.summary-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.summary-top em { padding: 2px 7px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-style: normal; }
.summary-main { margin: 5px 0 7px; line-height: 1; }
.summary-main b { font-size: 24px; }
.summary-main span { margin-left: 2px; color: var(--muted); font-size: 15px; }
.summary-bar { height: 5px; overflow: hidden; border-radius: 999px; background: #edf0f5; }
.summary-bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .25s ease; }
.summary-progress p { margin-top: 6px; color: var(--muted); font-size: 10px; }.summary-progress p b { color: var(--ink-2); font-size: inherit; }
.summary-metric { display: flex; align-items: center; gap: 10px; }
.summary-metric > i { width: 32px; height: 32px; flex: none; padding: 8px; border-radius: 9px; }
.summary-metric div { min-width: 0; }
.summary-metric span, .summary-metric small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-metric span { margin-bottom: 4px; font-size: 11px; }
.summary-metric b { display: block; font-size: 17px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.summary-metric small { margin-top: 3px; font-size: 9.5px; }
.tone-orange > i { color: #a86600; background: #fff5e6; }.tone-purple > i { color: #7049c9; background: #f3efff; }
.tone-blue > i { color: var(--blue); background: #edf3ff; }.tone-green > i { color: #008f59; background: #eaf8f2; }
.tone-skip > i { color: #86909c; background: #f2f3f5; }

.ledger-workbench { overflow: hidden; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.workbench-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 16px 13px; border-bottom: 1px solid #edf0f5; background: linear-gradient(115deg, #fbfcff, #fff 65%); }
.workbench-head > div { min-width: 0; }.workbench-head h2 { margin: 0; color: var(--ink); font-size: 16px; letter-spacing: -.01em; }
.stage-progress { padding: 10px 14px 7px; background: #f8faff; border-bottom: 1px solid #e5ebf5; }
.stage-scroll { overflow-x: auto; scrollbar-width: thin; }
.stage-track { display: grid; grid-template-columns: repeat(7, minmax(108px, 1fr)); min-width: 760px; }
.stage-step { position: relative; min-width: 0; padding: 4px 4px 6px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; text-align: center; }
.stage-step::before { content: ''; position: absolute; z-index: 0; top: 19px; left: 0; right: 0; height: 1px; background: #dfe4ed; }
.stage-step:first-child::before { left: 50%; }.stage-step:last-child::before { right: 50%; }
.stage-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; margin: 0 auto 5px; border: 1px solid #d8deea; border-radius: 50%; background: #f7f9fc; color: #6f7c91; transition: .16s ease; }
.stage-icon i { width: 14px; height: 14px; }
.stage-copy { display: flex; justify-content: center; align-items: center; gap: 6px; min-width: 0; }
.stage-name { font-size: 11px; font-weight: 600; white-space: nowrap; }
.stage-count { min-width: 19px; padding: 1px 5px; border-radius: 999px; background: #edf0f5; color: #6b778c; font-size: 10px; font-weight: 650; }
.stage-step:hover .stage-icon { border-color: #adc5ff; color: var(--blue); background: #f2f6ff; }
.stage-step.active { color: var(--blue); }
.stage-step.active .stage-icon { border-color: var(--blue); color: #fff; background: var(--blue); box-shadow: 0 0 0 4px #edf3ff; }
.stage-step.active .stage-name { font-weight: 700; }.stage-step.active .stage-count { color: var(--blue); background: #e8f0ff; }
.stage-step.active::after { content: ''; position: absolute; left: 26%; right: 26%; bottom: 0; height: 2px; border-radius: 2px; background: var(--blue); }
.stage-step:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 8px; }

.ledger-list { overflow: hidden; background: #fff; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 16px 9px; }
.list-toolbar h3 { font-size: 13px; }
.search-box { display: flex; align-items: center; gap: 7px; width: 244px; min-height: 34px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(51,112,255,.1); }
.search-box i { width: 14px; height: 14px; color: var(--muted); }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--ink); font-size: 12px; }
.ledger-table-wrap { overflow-x: auto; padding: 0 16px 16px; }
.ledger-table { width: 100%; min-width: 1080px; border: 1px solid #e6ebf3; border-collapse: separate; border-spacing: 0; border-radius: 10px; background: #fff; }
.ledger-table th { padding: 9px 12px; border-bottom: 1px solid #e6ebf3; color: #86909c; background: #f8faff; font-size: 10.5px; font-weight: 650; text-align: left; white-space: nowrap; }
.ledger-table td { padding: 10px 12px; border-bottom: 1px solid #edf0f5; color: var(--ink-2); font-size: 12px; vertical-align: middle; }
.ledger-table tbody tr:last-child td { border-bottom: 0; }
.ledger-table tbody tr:hover { background: #fbfdff; }
.ledger-table th:nth-child(n+2):nth-child(-n+6), .ledger-table td:nth-child(n+2):nth-child(-n+6) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger-table th:last-child, .ledger-table td:last-child { width: 1%; text-align: right; white-space: nowrap; }
.lawyer-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lawyer-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: #edf3ff; color: var(--blue); font-size: 12px; font-weight: 700; }
.lawyer-cell b, .cell-value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.income-drill, .amount-link { color: var(--ink); font-weight: 650; text-decoration: none; outline: 0; }.amount-link { color: var(--ink-2); font-weight: 600; }.income-drill:hover, .amount-link:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }.income-drill:focus-visible, .amount-link:focus-visible { box-shadow: 0 0 0 3px rgba(51,112,255,.18); }
.payout-value { font-weight: 650; }
.status-chip { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 7px; border-radius: 999px; background: #f2f5f9; color: #66758a; font-size: 10.5px; font-weight: 650; white-space: nowrap; }
.row-action { display: inline-flex; align-items: center; gap: 5px; justify-content: center; align-self: end; justify-self: start; min-height: 32px; padding: 6px 10px; border: 1px solid #b8ccff; border-radius: 8px; color: var(--blue); background: #fff; text-decoration: none; font-size: 11.5px; font-weight: 650; }
.row-action:hover { color: #fff; border-color: var(--blue); background: var(--blue); }.row-action i { width: 14px; height: 14px; }
.empty-ledger { padding: 48px 20px; text-align: center; color: var(--muted); }.empty-ledger i { width: 30px; height: 30px; margin-bottom: 10px; color: #b8c0cd; }.empty-ledger b { display: block; color: var(--ink-2); font-size: 14px; }.empty-ledger p { margin-top: 6px; font-size: 11px; }

@media (max-width: 720px) {
  .ledger-app { padding: 0 14px 22px; }.ledger-app .topbar { padding-top: 12px; }.ledger-app .brand-sub { display: none; }
  .ledger-head { align-items: flex-start; margin-top: 8px; }.title-divider { display: none; }.ledger-head h1 { font-size: 21px; }.back-link span { display: none; }
  .ledger-months { margin-bottom: 12px; }.ledger-months .month-btn { flex-basis: 58px; padding-inline: 9px; }
  .ledger-summary { grid-template-columns: 1fr 1fr; }.summary-progress { grid-column: 1 / -1; grid-row: auto; border-right: 0; border-bottom: 1px solid var(--line); }.summary-metric { padding: 13px; }.summary-metric > i { width: 32px; height: 32px; padding: 8px; }.summary-metric b { font-size: 15px; }.summary-metric small { display: none; }
  .workbench-head { align-items: stretch; flex-direction: column; padding: 14px; }.search-box { width: 100%; }
  .stage-progress { padding-inline: 10px; }.stage-track { min-width: 820px; }
  .ledger-table-wrap { padding: 0 12px 12px; }.ledger-table { min-width: 1080px; }.list-toolbar { padding-inline: 14px; }
}
