:root {
  --ink: #15231c;
  --muted: #647169;
  --paper: #f2f5f2;
  --surface: #ffffff;
  --line: #dce4de;
  --line-soft: #edf1ee;
  --green: #226746;
  --green-dark: #174d34;
  --green-soft: #e4f1e8;
  --amber: #9a6514;
  --amber-soft: #fff2d5;
  --red: #a63d35;
  --red-soft: #f9e7e4;
  --blue: #365f80;
  --blue-soft: #e7eff5;
  --shadow: 0 18px 55px rgba(30, 54, 39, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: radial-gradient(circle at 10% 0, rgba(86, 139, 104, .14), transparent 34rem), var(--paper);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin-top: 0; }

.eyebrow, .section-label {
  margin: 0 0 6px; color: var(--green); font-size: 10px; font-weight: 850; letter-spacing: .16em;
}
.primary, .ghost, .icon-button, .detail-button, .allocate-button, .danger-button {
  border-radius: 10px; cursor: pointer; font-weight: 760; transition: .16s ease;
}
.primary { padding: 11px 16px; border: 0; color: white; background: var(--green); }
.primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.primary:disabled, button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.ghost { padding: 10px 14px; color: var(--ink); border: 1px solid var(--line); background: white; text-decoration: none; }
.ghost:hover { border-color: #aab9ae; }
.icon-button { width: 40px; height: 40px; border: 0; color: var(--muted); background: transparent; font-size: 19px; }
.icon-button:hover { background: #e8ede9; }
.full { width: 100%; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(420px, 100%); padding: 42px; border: 1px solid rgba(34, 103, 70, .14);
  border-radius: 26px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); backdrop-filter: blur(16px);
}
.brand-mark, .mini-mark {
  display: grid; place-items: center; color: white; background: linear-gradient(145deg, #2c7653, #174d34); font-weight: 850;
}
.brand-mark { width: 52px; height: 52px; margin-bottom: 27px; border-radius: 16px; font-size: 22px; }
.mini-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 16px; }
.login-card h1 { margin-bottom: 12px; font-size: 32px; letter-spacing: -.04em; }
.login-copy { margin-bottom: 28px; color: var(--muted); line-height: 1.65; }
label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 750; }
input {
  width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px;
  color: var(--ink); background: white; outline: 0;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34,103,70,.11); }
.login-card input { margin-bottom: 14px; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--red); font-size: 12px; }

.topbar {
  min-height: 78px; padding: 14px clamp(20px,4vw,64px); display: flex; align-items: center; justify-content: space-between; gap: 24px;
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(220,228,222,.9);
  background: rgba(255,255,255,.88); backdrop-filter: blur(18px);
}
.brand-title { display: flex; align-items: center; gap: 12px; }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.035em; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.last-updated { margin-right: 6px; color: var(--muted); font-size: 11px; }
.page-shell { width: min(1500px, calc(100% - 40px)); margin: 28px auto 70px; }
.hero { display: flex; justify-content: space-between; gap: 20px; margin: 0 3px 18px; color: var(--muted); font-size: 12px; }
.hero p { margin: 0; text-align: right; }
.status-dot {
  display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%;
  background: #48a16e; box-shadow: 0 0 0 5px rgba(72,161,110,.12);
}

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; margin-bottom: 12px; }
.stat-card {
  position: relative; overflow: hidden; padding: 20px 21px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--surface); box-shadow: 0 6px 20px rgba(28,48,34,.035);
}
.stat-card::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: var(--line); }
.stat-card.danger::after { background: #cf6f66; }
.stat-card.credit::after { background: #5c83a3; }
.stat-card.success::after { background: #51a576; }
.stat-card.warning::after { background: #d09a43; }
.stat-card.withdrawal::after { background: #c55a11; }
.stat-card span { color: var(--muted); font-size: 11px; font-weight: 750; }
.stat-card strong { display: block; margin: 10px 0 6px; font-size: 28px; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.stat-card small { color: var(--muted); font-size: 11px; }

.aging-strip {
  display: grid; grid-template-columns: 1.2fr repeat(4,1fr); margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: 14px; background: white; overflow: hidden;
}
.aging-title, .aging-cell { min-height: 78px; padding: 15px 18px; border-right: 1px solid var(--line-soft); }
.aging-strip > :last-child { border-right: 0; }
.aging-title { display: flex; justify-content: center; flex-direction: column; background: #f8faf8; }
.aging-title span, .aging-cell span { color: var(--muted); font-size: 10px; font-weight: 750; }
.aging-title strong { margin-top: 5px; font-size: 14px; }
.aging-cell strong { display: block; margin: 7px 0 3px; font-size: 15px; font-variant-numeric: tabular-nums; }
.aging-cell small { color: var(--muted); font-size: 10px; }
.aging-2 strong { color: var(--amber); }
.aging-3 strong { color: var(--red); }

.main-tabs { display: flex; gap: 6px; margin: 0 2px 10px; }
.main-tab {
  padding: 10px 15px; border: 1px solid transparent; border-radius: 10px; color: var(--muted);
  background: transparent; cursor: pointer; font-size: 12px; font-weight: 780;
}
.main-tab:hover { background: rgba(255,255,255,.65); }
.main-tab.active { color: var(--ink); border-color: var(--line); background: white; box-shadow: 0 4px 12px rgba(30,54,39,.04); }

.workspace {
  border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: var(--shadow); overflow: hidden;
}
.workspace-head {
  padding: 23px 25px 17px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
}
.workspace-head h2 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.section-copy { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.workspace-actions { display: flex; align-items: center; gap: 9px; }
.search-box { position: relative; width: 290px; margin: 0; }
.search-box span { position: absolute; left: 14px; top: 10px; color: var(--muted); font-size: 18px; }
.search-box input { height: 42px; padding-left: 40px; }
.filters { display: flex; gap: 7px; padding: 0 25px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.filter-button {
  flex: 0 0 auto; padding: 8px 12px; border: 0; border-radius: 999px; color: var(--muted);
  background: #f0f3f0; cursor: pointer; font-size: 11px; font-weight: 780;
}
.filter-button.active { color: white; background: var(--ink); }
.filter-count { margin-left: 5px; opacity: .72; }
.notice { margin: 0 0 12px; padding: 13px 15px; border-radius: 11px; color: var(--green-dark); background: var(--green-soft); font-size: 12px; }
.notice.error { color: var(--red); background: var(--red-soft); }
.refresh-pending {
  margin: 0 0 12px; padding: 14px 15px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid #e7c980; border-radius: 12px; color: #6f470b; background: var(--amber-soft);
  box-shadow: 0 6px 18px rgba(154, 101, 20, .08);
}
.refresh-pending div { min-width: 0; }
.refresh-pending strong { display: block; margin-bottom: 4px; font-size: 13px; }
.refresh-pending span { display: block; font-size: 11px; line-height: 1.5; }
.refresh-pending .primary { flex: 0 0 auto; background: var(--amber); }
.refresh-pending .primary:hover { background: #7e500e; }

.review-item {
  display: grid; grid-template-columns: 34px 90px minmax(190px,1fr) minmax(125px,.65fr) 150px minmax(210px,1.15fr) 88px;
  align-items: center; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--line-soft); transition: background .14s ease;
}
.review-item:hover { background: #fafcf9; }
.review-item:last-child { border-bottom: 0; }
.review-item.candidate { box-shadow: inset 3px 0 var(--green); }
.review-item.mismatch { box-shadow: inset 3px 0 #d0a04e; }
.review-item.hold { box-shadow: inset 3px 0 #c96d65; }
.select-cell { display: grid; place-items: center; }
.select-cell input { width: 17px; height: 17px; accent-color: var(--green); }
.status-cell small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.badge, .account-status, .history-status, .alias-status {
  display: inline-flex; width: fit-content; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 820;
}
.badge.candidate, .account-status.settled, .history-status.active, .alias-status { color: var(--green); background: var(--green-soft); }
.badge.mismatch, .account-status.due { color: var(--amber); background: var(--amber-soft); }
.badge.hold { color: var(--red); background: var(--red-soft); }
.main-copy strong, .ledger-copy strong, .amount-copy strong, .reason-copy strong { display: block; margin-bottom: 4px; font-size: 13px; }
.main-copy span, .main-copy small, .ledger-copy span, .ledger-copy small, .amount-copy span, .reason-copy span {
  display: block; color: var(--muted); font-size: 10.5px; line-height: 1.45;
}
.main-copy small { margin-top: 3px; }
.amount-copy { text-align: right; font-variant-numeric: tabular-nums; }
.amount-copy.positive strong { color: var(--red); }
.amount-copy.negative strong { color: var(--blue); }
.amount-copy.zero strong { color: var(--green); }
.reason-copy span { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.row-actions { display: flex; flex-direction: column; gap: 5px; }
.detail-button, .allocate-button {
  padding: 7px 10px; border: 1px solid var(--line); color: var(--ink); background: white; font-size: 10.5px;
}
.allocate-button { color: var(--green); border-color: #bcd4c4; }
.detail-button:hover, .allocate-button:hover { border-color: var(--green); }
.breakdown-cell { grid-column: 3 / -1; width: 100%; }
.payment-breakdown {
  margin-top: 4px; border: 1px solid #d7e5da; border-radius: 13px;
  background: linear-gradient(135deg, #f8fbf8, #f3f8f4); overflow: hidden;
}
.payment-breakdown summary {
  min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 11px 14px; cursor: pointer; list-style: none;
}
.payment-breakdown summary::-webkit-details-marker { display: none; }
.payment-breakdown summary::after {
  content: "＋"; flex: 0 0 auto; color: var(--green); font-size: 17px; font-weight: 700;
}
.payment-breakdown[open] summary::after { content: "−"; }
.payment-breakdown summary > span { min-width: 0; }
.payment-breakdown summary b, .payment-breakdown summary small { display: block; }
.payment-breakdown summary b { margin-bottom: 3px; color: var(--green-dark); font-size: 11px; }
.payment-breakdown summary small { color: var(--muted); font-size: 9.5px; font-weight: 500; }
.payment-breakdown summary > strong {
  margin-left: auto; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.payment-flow { padding: 4px 14px 0; border-top: 1px solid #dfe9e1; background: rgba(255,255,255,.68); }
.payment-step {
  display: grid; grid-template-columns: 25px minmax(150px,1fr) 120px 120px; align-items: center; gap: 10px;
  position: relative; min-height: 56px; padding: 8px 0; border-bottom: 1px dashed var(--line);
}
.payment-step:last-child { border-bottom: 0; }
.payment-step:not(:last-child)::after {
  content: ""; position: absolute; left: 12px; top: 40px; width: 1px; height: 31px; background: #bfd3c4;
}
.step-number {
  width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%;
  color: white; background: var(--green); font-size: 9px; font-weight: 850; z-index: 1;
}
.payment-step.withdrawal .step-number { background: var(--red); }
.payment-step > div > strong, .payment-step > div > small { display: block; }
.payment-step > div > strong { margin-bottom: 3px; font-size: 10.5px; }
.payment-step > div > small { color: var(--muted); font-size: 9.5px; }
.payment-step > em { color: var(--green); font-size: 12px; font-style: normal; font-weight: 820; text-align: right; }
.payment-step.withdrawal > em { color: var(--red); }
.running-total { padding-left: 11px; border-left: 1px solid var(--line); text-align: right; }
.running-total span, .running-total strong { display: block; }
.running-total span { margin-bottom: 2px; color: var(--muted); font-size: 8.5px; }
.running-total strong { font-size: 11.5px !important; font-variant-numeric: tabular-nums; }
.payment-equation {
  display: flex; align-items: center; justify-content: space-between; gap: 15px;
  padding: 10px 14px; color: var(--muted); background: #f1f6f2; font-size: 10px;
}
.payment-equation strong { color: var(--ink); font-size: 11px; font-variant-numeric: tabular-nums; }
.reconcile-equation {
  display: grid; grid-template-columns: 1fr 24px 1fr 24px 1fr; align-items: stretch;
  gap: 7px; padding: 12px 14px 14px; border-top: 1px solid #dfe9e1; background: white;
}
.reconcile-equation > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fafbf9; }
.reconcile-equation > div span, .reconcile-equation > div strong { display: block; }
.reconcile-equation > div span { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.reconcile-equation > div strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.reconcile-equation > i { align-self: center; color: var(--muted); font-size: 16px; font-style: normal; text-align: center; }
.reconcile-equation > div.balanced { color: var(--green-dark); border-color: transparent; background: var(--green-soft); }
.reconcile-equation > div.unbalanced { color: var(--red); border-color: transparent; background: var(--red-soft); }
.loading-state, .empty-state {
  min-height: 220px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; color: var(--muted);
}
.spinner { width: 24px; height: 24px; border: 3px solid #dce4dd; border-top-color: var(--green); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state strong { color: var(--ink); }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { padding: 12px 18px; color: var(--muted); background: #f7f9f7; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; }
.data-table td { padding: 15px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table td strong, .data-table td small { display: block; }
.data-table td small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.data-table .money { text-align: right; font-variant-numeric: tabular-nums; font-weight: 760; }
.data-table .money.due { color: var(--red); }
.data-table .money.credit { color: var(--blue); }
.account-status.credit { color: var(--blue); background: var(--blue-soft); }
.age-pill { color: var(--muted); font-size: 10px; white-space: nowrap; }
.table-empty { height: 180px; text-align: center !important; color: var(--muted); }

.history-list { border-top: 1px solid var(--line); }
.source-sync-summary { color: var(--muted); font-size: 11px; text-align: right; }
.source-sync-summary strong { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.source-anomaly-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.source-anomaly-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfb; }
.source-anomaly-card span { display: block; color: var(--muted); font-size: 10px; }
.source-anomaly-card strong { display: block; margin-top: 6px; font-size: 22px; }
.source-anomaly-card.warn strong { color: var(--amber); }
.source-anomaly-card.danger strong { color: var(--red); }
.direction-deposit { color: var(--green); font-weight: 760; }
.direction-withdrawal { color: var(--red); font-weight: 760; }
.history-card {
  display: grid; grid-template-columns: minmax(280px,1fr) minmax(260px,1.2fr) 95px; align-items: center; gap: 20px;
  padding: 17px 24px; border-bottom: 1px solid var(--line-soft);
}
.history-card strong { display: block; margin: 7px 0 4px; font-size: 13px; }
.history-card p, .history-card small, .history-money span { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.history-money strong { margin: 0 0 5px; font-size: 15px; }
.history-status.reversed { color: var(--muted); background: #ecefed; }
.danger-button { padding: 8px 10px; border: 1px solid #e7b8b3; color: var(--red); background: white; font-size: 10.5px; }
.danger-button:hover { background: var(--red-soft); }

.alias-head { align-items: flex-start; }
.alias-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; width: min(780px,65%); }
.alias-form input { height: 42px; }
.alias-list { border-top: 1px solid var(--line); }
.alias-row {
  display: grid; grid-template-columns: 1fr 35px 1fr 1.2fr 70px; align-items: center; gap: 12px;
  padding: 15px 24px; border-bottom: 1px solid var(--line-soft);
}
.alias-row div span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9.5px; }
.alias-row strong, .alias-row p { margin: 0; font-size: 12px; }
.alias-arrow { color: var(--muted); text-align: center; }

dialog { border: 0; padding: 0; color: var(--ink); box-shadow: 0 30px 90px rgba(17,28,21,.24); }
dialog::backdrop { background: rgba(18,28,22,.5); backdrop-filter: blur(4px); }
.detail-dialog { width: min(820px,calc(100% - 34px)); border-radius: 19px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 23px 26px 17px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 21px; }
.detail-body { padding: 22px 26px 28px; }
.detail-summary { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding: 14px 17px; border-radius: 12px; }
.detail-summary.ok { color: var(--green); background: var(--green-soft); }
.detail-summary.due { color: var(--red); background: var(--red-soft); }
.detail-summary.credit { color: var(--blue); background: var(--blue-soft); }
.detail-summary span { font-size: 11px; font-weight: 750; }
.detail-summary strong { font-size: 19px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fafbf9; }
.detail-card span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 750; }
.detail-card strong { font-size: 13px; line-height: 1.5; }
.detail-reason { margin-top: 12px; padding: 15px; border-radius: 12px; background: var(--amber-soft); color: #6e4e1c; font-size: 12px; line-height: 1.6; }
.detail-reason p { margin: 5px 0 0; }
.detail-links { display: flex; gap: 8px; margin-top: 16px; }
.confirm-dialog { width: min(450px,calc(100% - 34px)); padding: 28px; border-radius: 19px; }
.confirm-dialog h2 { margin-bottom: 10px; font-size: 21px; }
.confirm-dialog p:not(.section-label) { color: var(--muted); line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

.allocation-dialog { width: min(900px,calc(100% - 34px)); max-height: min(850px,calc(100vh - 34px)); border-radius: 19px; }
.allocation-body { padding: 22px 26px 28px; overflow-y: auto; }
.allocation-body section + section { margin-top: 22px; }
.allocation-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 11px; }
.allocation-section-head h3 { margin: 0 0 4px; font-size: 15px; }
.allocation-section-head p { margin: 0; color: var(--muted); font-size: 11px; }
.allocation-total { color: var(--green); font-size: 17px; font-weight: 820; }
.allocation-sources { max-height: 250px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.allocation-source { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 11px; min-height: 60px; margin: 0; padding: 9px 13px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.allocation-source:last-child { border-bottom: 0; }
.allocation-source:hover { background: #fafcf9; }
.allocation-source input { width: 17px; height: 17px; margin: 0; accent-color: var(--green); }
.allocation-source strong, .allocation-source small { display: block; }
.allocation-source strong { margin-bottom: 3px; font-size: 12px; }
.allocation-source small { color: var(--muted); font-size: 10px; }
.allocation-source em { font-size: 12px; font-style: normal; font-weight: 800; }
.allocation-row-input { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.allocation-preview { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fafbf9; }
.allocation-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.allocation-summary > div { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.allocation-summary span, .allocation-summary strong { display: block; }
.allocation-summary span { margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.allocation-summary strong { font-size: 16px; }
.allocation-summary .balanced { color: var(--green); background: var(--green-soft); border-color: transparent; }
.allocation-summary .positive { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.allocation-summary .negative { color: var(--red); background: var(--red-soft); border-color: transparent; }
.allocation-targets { margin-top: 10px; }
.allocation-targets > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 4px; border-bottom: 1px dashed var(--line); font-size: 11px; }
.allocation-targets span { color: var(--muted); }
.allocation-issues, .allocation-ready { margin-top: 11px; padding: 11px 13px; border-radius: 9px; font-size: 11px; line-height: 1.5; }
.allocation-issues { color: var(--red); background: var(--red-soft); }
.allocation-issues p { margin: 0; }
.allocation-ready { color: var(--green-dark); background: var(--green-soft); font-weight: 750; }
.allocation-confirm { display: flex; align-items: center; gap: 9px; margin: 14px 0 0; padding: 12px 13px; border-radius: 10px; background: var(--green-soft); cursor: pointer; }
.allocation-confirm input { width: 17px; height: 17px; margin: 0; accent-color: var(--green); }
.allocation-confirm span { font-size: 11px; font-weight: 750; }

.main-tab span { display: inline-grid; min-width: 19px; height: 19px; place-items: center; margin-left: 4px; padding: 0 5px; border-radius: 10px; color: #9b4310; background: #fce4d6; font-size: 10px; }
.withdrawal-summary { display: flex; gap: 9px; }
.withdrawal-summary > div { min-width: 110px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fafbf9; }
.withdrawal-summary span, .withdrawal-summary strong { display: block; }
.withdrawal-summary span { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.withdrawal-summary strong { font-size: 15px; }
.withdrawal-guide { display: flex; gap: 12px; margin-bottom: 14px; padding: 12px 15px; border-left: 3px solid #c55a11; border-radius: 8px; color: #6b422b; background: #fff8f3; font-size: 11px; line-height: 1.55; }
.withdrawal-guide strong { flex: 0 0 auto; }
.withdrawal-bulkbar {
  position: sticky; top: 79px; z-index: 8; display: flex; align-items: center; gap: 9px; margin-bottom: 12px; padding: 11px 13px;
  border: 1px solid #e7c9b6; border-radius: 12px; background: rgba(255, 248, 243, .96); box-shadow: 0 7px 20px rgba(104, 61, 31, .06);
  backdrop-filter: blur(12px);
}
.withdrawal-select-all { display: flex; align-items: center; gap: 7px; margin: 0; cursor: pointer; }
.withdrawal-select-all input, .withdrawal-select input { width: 17px; height: 17px; accent-color: #c55a11; cursor: pointer; }
.withdrawal-bulkbar strong { margin-right: auto; color: #7a431e; font-size: 12px; }
.withdrawal-select { display: grid; place-items: start center; margin: 10px 0 0; }
.withdrawal-list { display: grid; gap: 10px; }
.withdrawal-card { display: grid; grid-template-columns: 24px 42px minmax(0,1fr) auto; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: 0 5px 16px rgba(28,48,34,.03); }
.withdrawal-card.selected { border-color: #d6a681; background: #fffaf7; box-shadow: 0 0 0 2px rgba(197, 90, 17, .08); }
.withdrawal-card.linked { border-left: 4px solid #c55a11; }
.withdrawal-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: #9b4310; background: #fce4d6; font-size: 23px; font-weight: 800; }
.withdrawal-main { min-width: 0; }
.withdrawal-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.withdrawal-title > div { display: flex; align-items: center; gap: 8px; }
.withdrawal-title > div > strong { font-size: 15px; }
.withdrawal-title > em { color: var(--red); font-size: 17px; font-style: normal; font-weight: 850; font-variant-numeric: tabular-nums; }
.withdrawal-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 7px; color: var(--muted); font-size: 10px; }
.withdrawal-evidence { display: grid; grid-template-columns: 155px minmax(0,1fr); gap: 9px; margin-top: 12px; }
.impact-box, .suggestion-box { padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: #fafbf9; }
.impact-box span, .impact-box strong, .impact-box small { display: block; }
.impact-box span, .suggestion-box > span { color: var(--muted); font-size: 9px; font-weight: 760; }
.impact-box strong { margin: 7px 0 3px; color: var(--red); font-size: 16px; }
.impact-box small { color: var(--muted); font-size: 9px; }
.suggestion-box > p { margin: 8px 0 0; color: var(--muted); font-size: 10px; }
.withdrawal-suggestion { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line); }
.withdrawal-suggestion strong, .withdrawal-suggestion small { display: block; }
.withdrawal-suggestion strong { margin-bottom: 2px; font-size: 11px; }
.withdrawal-suggestion small { color: var(--muted); font-size: 9px; }
.withdrawal-suggestion em { flex: 0 0 auto; font-size: 11px; font-style: normal; font-weight: 800; }
.withdrawal-actions { display: flex; align-items: flex-end; flex-direction: column; justify-content: space-between; gap: 8px; }
.workspace-subhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 28px 0 10px; padding-top: 22px; border-top: 1px solid var(--line); }
.workspace-subhead h3 { margin: 0; font-size: 17px; }
.workspace-subhead > span { color: var(--muted); font-size: 10px; }
.withdrawal-history .history-money strong { color: var(--red); }
.withdrawal-dialog { width: min(560px,calc(100% - 34px)); border-radius: 19px; }
.withdrawal-dialog-body { padding: 22px 26px 27px; }
.withdrawal-dialog-summary { display: grid; grid-template-columns: 1fr auto; gap: 5px 14px; margin-bottom: 18px; padding: 15px; border-radius: 12px; background: #fff8f3; }
.withdrawal-dialog-summary span { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }
.withdrawal-dialog-summary strong { font-size: 15px; }
.withdrawal-dialog-summary em { color: var(--red); font-style: normal; font-weight: 850; }
.withdrawal-dialog-summary p { grid-column: 1 / -1; margin: 3px 0 0; color: #6b422b; font-size: 10px; }
.withdrawal-dialog-body select, .withdrawal-dialog-body textarea { width: 100%; margin-bottom: 13px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; outline: 0; }
.withdrawal-dialog-body textarea { resize: vertical; }
.withdrawal-dialog-body select:focus, .withdrawal-dialog-body textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34,103,70,.11); }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .review-item { grid-template-columns: 32px 82px 1fr 130px 1fr 78px; }
  .ledger-copy { display: none; }
  .alias-form { width: 100%; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .topbar { align-items: flex-start; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .last-updated { width: 100%; text-align: right; }
  .page-shell { width: min(100% - 20px,1500px); margin-top: 18px; }
  .hero { flex-direction: column; }
  .hero p { text-align: left; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .aging-strip { grid-template-columns: 1fr 1fr; }
  .aging-title { grid-column: 1 / -1; }
  .aging-cell { border-top: 1px solid var(--line-soft); }
  .workspace-head { align-items: stretch; flex-direction: column; }
  .workspace-actions, .search-box { width: 100%; }
  .search-box { flex: 1; }
  .review-item { grid-template-columns: 28px 78px 1fr 78px; gap: 9px; padding: 14px 12px; }
  .reason-copy { grid-column: 3 / 5; }
  .amount-copy { grid-column: 3; text-align: left; }
  .row-actions { grid-column: 4; grid-row: 1 / 3; }
  .breakdown-cell { grid-column: 3 / 5; }
  .payment-step { grid-template-columns: 25px 1fr 100px; }
  .running-total { grid-column: 2 / 4; display: flex; align-items: center; justify-content: space-between; border-left: 0; }
  .history-card { grid-template-columns: 1fr; gap: 9px; }
  .alias-row { grid-template-columns: 1fr 24px 1fr; }
  .alias-row > :nth-child(4), .alias-row > :nth-child(5) { grid-column: 1 / -1; }
  .detail-grid, .allocation-summary { grid-template-columns: 1fr; }
  .withdrawal-card { grid-template-columns: 24px 38px 1fr; }
  .withdrawal-main { grid-column: 3; }
  .withdrawal-actions { grid-column: 3; align-items: stretch; flex-direction: row; justify-content: flex-start; }
  .withdrawal-evidence { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .topbar { position: static; min-height: 68px; }
  .brand-title > div:last-child, .top-actions .last-updated, #sheet-link { display: none; }
  .stats-grid { gap: 8px; }
  .stat-card { padding: 15px; }
  .stat-card strong { font-size: 21px; }
  .main-tabs { overflow-x: auto; }
  .source-anomaly-grid { grid-template-columns: 1fr; }
  .main-tab { flex: 0 0 auto; }
  .workspace-actions, .alias-form { grid-template-columns: 1fr; flex-direction: column; }
  .workspace-actions .primary { width: 100%; }
  .refresh-pending { align-items: stretch; flex-direction: column; }
  .refresh-pending .primary { width: 100%; }
  .review-item { grid-template-columns: 24px 1fr 70px; }
  .status-cell { grid-column: 2; }
  .main-copy { grid-column: 2; }
  .amount-copy { grid-column: 2; }
  .reason-copy { display: none; }
  .row-actions { grid-column: 3; grid-row: 1 / 4; }
  .breakdown-cell { grid-column: 2 / 4; }
  .payment-breakdown summary small { display: none; }
  .payment-step { grid-template-columns: 25px 1fr; }
  .payment-step > em { grid-column: 2; text-align: left; }
  .running-total { grid-column: 2; }
  .payment-equation { align-items: flex-start; flex-direction: column; }
  .reconcile-equation { grid-template-columns: 1fr; }
  .reconcile-equation > i { line-height: 12px; }
  .login-card { padding: 30px 23px; }
  .allocation-row-input { grid-template-columns: 1fr; }
  .withdrawal-summary { width: 100%; }
  .withdrawal-summary > div { flex: 1; min-width: 0; }
  .withdrawal-guide { flex-direction: column; }
  .withdrawal-bulkbar { top: 0; align-items: stretch; flex-wrap: wrap; }
  .withdrawal-bulkbar strong { width: calc(100% - 110px); margin: 0; }
  .withdrawal-bulkbar .ghost, .withdrawal-bulkbar .danger-button { flex: 1 1 140px; }
  .withdrawal-title { flex-direction: column; }
  .withdrawal-title > div { align-items: flex-start; flex-direction: column; }
  .withdrawal-actions { flex-direction: column; }
}

/* Reconciliation workspace v3 */
.status-dot.pending {
  background: #d09a43;
  box-shadow: 0 0 0 5px rgba(208,154,67,.14);
}
.sync-progress {
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  margin: 0 0 14px; padding: 14px 17px; border: 1px solid #bdd5c4;
  border-radius: 14px; background: rgba(245,250,246,.96); box-shadow: 0 7px 22px rgba(34,103,70,.06);
}
.sync-progress-copy { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sync-progress-copy strong, .sync-progress-copy span { display: block; }
.sync-progress-copy strong { margin-bottom: 4px; font-size: 13px; }
.sync-progress-copy span { color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.sync-pulse {
  width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 0 rgba(34,103,70,.3); animation: sync-pulse 1.5s infinite;
}
.sync-progress-meta { width: min(300px,30%); flex: 0 0 auto; }
.sync-progress-meta > span { display: block; margin-bottom: 7px; color: var(--green-dark); font-size: 10px; font-weight: 800; text-align: right; }
.sync-progress-track { height: 5px; overflow: hidden; border-radius: 99px; background: #dce9df; }
.sync-progress-track span {
  display: block; width: 42%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg,var(--green),#69a582); animation: sync-track 1.8s ease-in-out infinite;
}
@keyframes sync-pulse {
  70% { box-shadow: 0 0 0 9px rgba(34,103,70,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,103,70,0); }
}
@keyframes sync-track {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(250%); }
}

.workspace-actions { flex-wrap: wrap; justify-content: flex-end; }
.review-list-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 11px 25px; border-bottom: 1px solid var(--line-soft); color: var(--muted); background: #fbfcfb;
}
.review-list-summary > div { display: flex; align-items: center; gap: 9px; }
.review-list-summary strong { color: var(--ink); font-size: 12px; }
.review-list-summary span { font-size: 10px; }
.keyboard-hint { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: white; }

.review-card {
  grid-template-columns: 32px 148px minmax(220px,1.05fr) minmax(330px,1.35fr) minmax(210px,.9fr) 96px;
  align-items: center; gap: 16px; min-height: 142px; padding: 19px 22px;
  cursor: pointer; outline: 0;
}
.review-card:focus-visible { box-shadow: inset 3px 0 var(--green), 0 0 0 3px rgba(34,103,70,.12); }
.review-card.selected {
  background: #f5faf6;
  box-shadow: inset 4px 0 var(--green), inset 0 0 0 1px #c5daca;
}
.review-card.master { box-shadow: inset 3px 0 var(--blue); }
.review-card.master.selected { box-shadow: inset 4px 0 var(--blue), inset 0 0 0 1px #cbdde9; }
.review-card .status-cell small, .review-card .status-cell em { display: block; }
.review-card .status-cell small { margin-top: 7px; color: var(--ink); line-height: 1.35; }
.review-card .status-cell em { margin-top: 6px; color: var(--muted); font-size: 9px; font-style: normal; }
.badge.master { color: var(--blue); background: var(--blue-soft); }
.badge.unmatched { color: var(--red); background: var(--red-soft); }
.field-label {
  display: block; margin-bottom: 5px; color: var(--green); font-size: 9px !important;
  font-weight: 850; letter-spacing: .08em;
}
.review-card .main-copy strong { margin-bottom: 6px; font-size: 16px; line-height: 1.25; }
.review-card .main-copy p {
  margin: 0 0 7px; color: var(--ink); font-size: 11px; line-height: 1.45;
  display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.review-card .main-copy small { font-size: 9.5px; line-height: 1.5; }
.money-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.money-grid > div { min-width: 0; padding: 12px 11px; border-right: 1px solid var(--line-soft); background: #fafbf9; text-align: right; }
.money-grid > div:last-child { border-right: 0; }
.money-grid span, .money-grid strong { display: block; white-space: nowrap; }
.money-grid span { margin-bottom: 7px; color: var(--muted); font-size: 9px; }
.money-grid strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.deposit-money strong { color: var(--green); }
.balance-money.zero { color: var(--green-dark); background: var(--green-soft); }
.balance-money.positive { color: var(--red); background: var(--red-soft); }
.balance-money.negative { color: var(--blue); background: var(--blue-soft); }
.review-card .reason-copy {
  min-height: 72px; padding: 12px 13px; border-radius: 11px; background: #f7f9f7;
}
.review-card .reason-copy strong { font-size: 11px; }
.review-card .reason-copy span { -webkit-line-clamp: 3; }
.review-card .row-actions { align-self: stretch; justify-content: center; }
.review-card .detail-button, .review-card .allocate-button { min-height: 34px; }
.review-card .breakdown-cell { grid-column: 3 / -1; }

.selection-dock {
  position: fixed; z-index: 55; left: 50%; bottom: 22px; transform: translateX(-50%);
  width: min(820px,calc(100% - 30px)); display: grid; grid-template-columns: auto minmax(180px,1fr) auto auto;
  align-items: center; gap: 12px; padding: 12px 14px 12px 17px; border: 1px solid rgba(34,103,70,.26);
  border-radius: 16px; color: white; background: rgba(21,35,28,.95);
  box-shadow: 0 18px 50px rgba(13,30,20,.28); backdrop-filter: blur(18px);
}
.selection-dock > div span, .selection-dock > div strong { display: block; }
.selection-dock > div span { margin-bottom: 3px; color: #c6d7cc; font-size: 9px; }
.selection-dock > div strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.selection-dock p { margin: 0; color: #c6d7cc; font-size: 10px; line-height: 1.45; }
.selection-dock .ghost { color: white; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.06); }
.selection-dock .primary { background: #4a9c6c; }

.detail-dialog {
  width: min(760px,calc(100% - 28px)); height: 100vh; max-height: 100vh;
  inset: 0 0 0 auto; margin: 0; border-radius: 22px 0 0 22px; overflow: hidden;
  animation: drawer-in .2s ease-out;
}
@keyframes drawer-in { from { transform: translateX(28px); opacity: .6; } }
.detail-dialog .dialog-head { position: sticky; top: 0; z-index: 2; background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.detail-body { height: calc(100vh - 82px); padding: 20px 24px 34px; overflow-y: auto; }
.detail-status-row { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; color: var(--muted); font-size: 10px; }
.detail-summary > div span, .detail-summary > div small { display: block; }
.detail-summary > div small { margin-top: 4px; opacity: .72; font-size: 9px; }
.detail-comparison { display: grid; grid-template-columns: minmax(0,1fr) 34px minmax(0,1fr); align-items: stretch; gap: 8px; }
.comparison-panel { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #fafbf9; }
.comparison-panel.transaction { border-top: 3px solid var(--green); }
.comparison-panel.ledger { border-top: 3px solid var(--ink); }
.comparison-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.comparison-head span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.comparison-head em { padding: 3px 6px; border-radius: 5px; color: var(--muted); background: #eef2ef; font-size: 8px; font-style: normal; font-weight: 800; }
.comparison-panel > strong { display: block; min-height: 40px; font-size: 14px; line-height: 1.45; }
.comparison-panel > p { min-height: 31px; margin: 5px 0 14px; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.comparison-panel > div:last-child { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
.comparison-panel > div:last-child span { color: var(--muted); font-size: 9px; }
.comparison-panel > div:last-child b { color: var(--green); font-size: 16px; font-variant-numeric: tabular-nums; }
.comparison-panel.ledger > div:last-child b { color: var(--ink); }
.comparison-arrow { display: grid; place-items: center; color: var(--muted); font-size: 17px; }
.detail-section { margin-top: 14px; }
.detail-section-head { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 7px; }
.detail-section-head span { font-size: 11px; font-weight: 820; }
.detail-section-head small { color: var(--muted); font-size: 9px; }
.detail-reason > span { display: block; margin-bottom: 5px; color: #947022; font-size: 8.5px; font-weight: 850; letter-spacing: .08em; }
.simple-reconciliation {
  display: grid; grid-template-columns: 1fr 28px 1fr 28px 1fr; align-items: stretch;
  gap: 7px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #fafbf9;
}
.simple-reconciliation > div { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.simple-reconciliation > div span, .simple-reconciliation > div strong { display: block; }
.simple-reconciliation > div span { margin-bottom: 6px; color: var(--muted); font-size: 9px; }
.simple-reconciliation > div strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.simple-reconciliation > i { align-self: center; color: var(--muted); font-size: 16px; font-style: normal; text-align: center; }
.simple-reconciliation .balanced { color: var(--green); border-color: transparent; background: var(--green-soft); }
.simple-reconciliation .unbalanced { color: var(--red); border-color: transparent; background: var(--red-soft); }
.simple-reconciliation .credit { color: var(--blue); border-color: transparent; background: var(--blue-soft); }
.detail-links { position: sticky; bottom: -1px; z-index: 2; padding: 13px 0 0; background: linear-gradient(transparent,white 22%); }

.allocation-flow { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: white; overflow: hidden; }
.allocation-flow-head, .allocation-flow-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; }
.allocation-flow-head { color: var(--muted); background: #f5f8f5; font-size: 9px; }
.allocation-flow-row { border-top: 1px solid var(--line-soft); font-size: 10px; }
.allocation-flow-row span { min-width: 0; }
.allocation-flow-row b { display: inline-grid; width: 20px; height: 20px; place-items: center; margin-right: 8px; border-radius: 50%; color: white; background: var(--green); font-size: 8px; }
.allocation-flow-row strong { flex: 0 0 auto; color: var(--green); font-size: 11px; }

@media (max-width: 1200px) {
  .review-card {
    grid-template-columns: 30px 130px minmax(210px,1fr) minmax(300px,1.2fr) 90px;
  }
  .review-card .reason-copy { grid-column: 3 / 5; min-height: auto; }
  .review-card .row-actions { grid-column: 5; grid-row: 1 / 3; }
  .review-card .breakdown-cell { grid-column: 3 / 6; }
}
@media (max-width: 800px) {
  .sync-progress { align-items: stretch; flex-direction: column; gap: 10px; }
  .sync-progress-meta { width: 100%; }
  .review-list-summary .keyboard-hint { display: none; }
  .review-card { grid-template-columns: 28px 1fr 92px; gap: 10px; padding: 15px 13px; }
  .review-card .select-cell { grid-column: 1; grid-row: 1; }
  .review-card .status-cell { grid-column: 2; grid-row: 1; }
  .review-card .main-copy { grid-column: 2 / 4; }
  .review-card .money-grid { grid-column: 2 / 4; }
  .review-card .reason-copy { grid-column: 2 / 4; }
  .review-card .row-actions { grid-column: 3; grid-row: 1; align-self: start; }
  .review-card .breakdown-cell { grid-column: 2 / 4; }
  .selection-dock { grid-template-columns: 1fr auto auto; }
  .selection-dock p { display: none; }
  .detail-dialog { width: min(680px,calc(100% - 12px)); }
  .detail-comparison { grid-template-columns: 1fr; }
  .comparison-arrow { height: 20px; transform: rotate(90deg); }
}
@media (max-width: 540px) {
  .workspace-actions #select-zero-button, .workspace-actions #clear-selection-button { width: 100%; }
  .review-list-summary { padding: 10px 14px; }
  .review-list-summary > div span { display: none; }
  .review-card { grid-template-columns: 24px 1fr; }
  .review-card .status-cell { grid-column: 2; }
  .review-card .main-copy, .review-card .money-grid, .review-card .reason-copy,
  .review-card .row-actions, .review-card .breakdown-cell { grid-column: 2; }
  .review-card .row-actions { grid-row: auto; flex-direction: row; }
  .review-card .row-actions button { flex: 1; }
  .money-grid { grid-template-columns: 1fr; }
  .money-grid > div { display: flex; justify-content: space-between; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .money-grid > div:last-child { border-bottom: 0; }
  .money-grid span { margin: 0; }
  .selection-dock { bottom: 10px; grid-template-columns: 1fr 1fr; padding: 10px; }
  .selection-dock > div { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
  .selection-dock > div span { margin: 0; }
  .selection-dock .ghost, .selection-dock .primary { width: 100%; }
  .detail-dialog { width: 100%; max-width: 100%; height: 100vh; border-radius: 0; }
  .detail-body { padding: 16px 14px 28px; }
  .simple-reconciliation { grid-template-columns: 1fr; }
  .simple-reconciliation > i { line-height: 9px; }
  .detail-links { align-items: stretch; flex-direction: column; }
  .detail-links > * { width: 100%; text-align: center; }
}

/* Reconciliation workspace v4 */
.sort-box {
  display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: white;
  font-size: 9px; font-weight: 800;
}
.sort-box select {
  min-height: 40px; border: 0; color: var(--ink); background: transparent;
  font: inherit; font-size: 10px; outline: 0; cursor: pointer;
}

.sync-result {
  margin-bottom: 14px; border: 1px solid rgba(34,103,70,.16); border-radius: 15px;
  background: linear-gradient(135deg,rgba(239,248,242,.96),rgba(250,252,249,.98)); overflow: hidden;
}
.sync-result-head {
  display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 16px;
}
.sync-result-head > div { display: flex; align-items: center; gap: 8px; }
.sync-result-head strong { font-size: 11px; }
.sync-result-head small { color: var(--muted); font-size: 9px; }
.sync-result-check {
  display: inline-grid; width: 22px; height: 22px; place-items: center; border-radius: 50%;
  color: white; background: var(--green); font-size: 10px; font-weight: 900;
}
.sync-result-toggle { border: 0; color: var(--green); background: transparent; font-size: 9px; font-weight: 800; cursor: pointer; }
.sync-result-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); border-top: 1px solid rgba(34,103,70,.12); }
.sync-result-grid > div { padding: 11px 15px; border-right: 1px solid rgba(34,103,70,.1); }
.sync-result-grid > div:last-child { border-right: 0; }
.sync-result-grid span, .sync-result-grid strong { display: block; }
.sync-result-grid span { margin-bottom: 4px; color: var(--muted); font-size: 8.5px; }
.sync-result-grid strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.sync-result.collapsed .sync-result-grid { display: none; }

.status-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.status-meta em { margin: 0 !important; }
.priority-pill {
  display: inline-flex; padding: 4px 7px; border-radius: 999px; color: #5f6e64;
  background: #eef2ee; font-size: 7.5px; font-style: normal; font-weight: 850;
}
.priority-pill.medium { color: #7d5c14; background: #fff3cf; }
.priority-pill.high { color: #9a4b25; background: #ffeadf; }
.priority-pill.critical { color: #9d2b30; background: #ffe1e3; }
.badge.error { color: #a92b33; background: #ffe5e7; }
.review-card.error { border-left-color: #cf3f49; background: linear-gradient(90deg,#fff7f7,white 24%); }
.review-card.error .reason-copy { border-color: #f3c9cc; background: #fff4f5; }

.transaction-timeline { position: relative; padding: 4px 0 0; }
.transaction-timeline::before {
  content: ""; position: absolute; top: 20px; bottom: 20px; left: 15px; width: 1px; background: var(--line);
}
.timeline-event {
  position: relative; display: grid; grid-template-columns: 31px minmax(0,1fr) auto;
  align-items: center; gap: 10px; min-height: 54px; padding: 7px 10px 7px 0;
}
.timeline-dot {
  z-index: 1; display: grid; width: 29px; height: 29px; place-items: center;
  border: 3px solid white; border-radius: 50%; color: white; background: var(--green);
  box-shadow: 0 0 0 1px var(--line); font-size: 8px; font-weight: 900;
}
.timeline-event.withdrawal .timeline-dot { background: var(--red); }
.timeline-event.ledger .timeline-dot { background: var(--ink); }
.timeline-event.unlinked .timeline-dot { color: #8a6d28; background: #fff0bd; }
.timeline-event > div strong, .timeline-event > div small { display: block; }
.timeline-event > div strong { margin-bottom: 4px; font-size: 10px; }
.timeline-event > div small { color: var(--muted); font-size: 8.5px; }
.timeline-event > em { color: var(--green); font-size: 11px; font-style: normal; font-weight: 850; font-variant-numeric: tabular-nums; }
.timeline-event > em.negative { color: var(--red); }
.timeline-running { grid-column: 2 / 4; color: var(--muted); font-size: 8px; }

.counterparty-suggestions { display: grid; gap: 8px; }
.suggestion-loading, .counterparty-empty {
  display: flex; align-items: center; gap: 9px; padding: 15px; border: 1px dashed var(--line);
  border-radius: 12px; color: var(--muted); background: #fafbf9; font-size: 9px;
}
.counterparty-empty { align-items: flex-start; flex-direction: column; }
.counterparty-empty strong, .counterparty-empty span { display: block; }
.counterparty-empty.error { color: var(--red); border-color: #edc9cc; background: var(--red-soft); }
.counterparty-match {
  display: grid; grid-template-columns: 43px minmax(0,1fr) auto; align-items: center; gap: 12px;
  padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: white;
}
.counterparty-match.exact { border-color: rgba(34,103,70,.28); background: #f7fbf8; }
.counterparty-rank span {
  display: grid; width: 39px; height: 39px; place-items: center; border-radius: 50%;
  color: #89651d; background: #fff0bd; font-size: 8px; font-weight: 850;
}
.counterparty-match.exact .counterparty-rank span { color: var(--green); background: var(--green-soft); }
.counterparty-match > div:nth-child(2) strong, .counterparty-match > div:nth-child(2) p,
.counterparty-match > div:nth-child(2) small { display: block; }
.counterparty-match > div:nth-child(2) strong { margin-bottom: 4px; font-size: 11px; }
.counterparty-match > div:nth-child(2) p { margin: 0 0 3px; color: var(--muted); font-size: 8.5px; }
.counterparty-match > div:nth-child(2) small { color: #718077; font-size: 8px; }
.counterparty-actions { display: flex; align-items: center; gap: 6px; }
.counterparty-actions .primary, .counterparty-actions .ghost { white-space: nowrap; font-size: 8.5px; }
.directory-confirmed { padding: 7px 9px; border-radius: 8px; color: var(--green); background: var(--green-soft); font-size: 8px; font-weight: 850; }

.confirm-dialog { width: min(720px,calc(100% - 34px)); max-height: min(820px,calc(100vh - 34px)); overflow-y: auto; }
.confirm-list { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.confirm-item {
  display: grid; grid-template-columns: 26px minmax(0,1.2fr) minmax(0,1fr) auto;
  align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--line-soft);
}
.confirm-item:last-child { border-bottom: 0; }
.confirm-item > span { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; color: white; background: var(--ink); font-size: 8px; }
.confirm-item strong, .confirm-item small { display: block; }
.confirm-item strong { margin-bottom: 3px; font-size: 10px; }
.confirm-item small { color: var(--muted); font-size: 8px; }
.confirm-item em { color: var(--green); font-size: 11px; font-style: normal; font-weight: 850; white-space: nowrap; }
.confirm-conflicts { margin-top: 12px; padding: 10px 12px; border-radius: 10px; color: #9a2e35; background: #fff0f1; }
.confirm-dialog .confirm-conflicts p { margin: 2px 0; color: inherit; font-size: 9px; }

.apply-result-dialog, .quick-alias-dialog { width: min(680px,calc(100% - 34px)); border-radius: 19px; }
.apply-result-body, .quick-alias-body { padding: 20px 24px 25px; }
.apply-result-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 13px; }
.apply-result-summary > div { padding: 12px; border-radius: 11px; background: #f4f6f4; }
.apply-result-summary span, .apply-result-summary strong { display: block; }
.apply-result-summary span { margin-bottom: 5px; color: var(--muted); font-size: 8px; }
.apply-result-summary strong { font-size: 17px; }
.apply-result-summary .result-success { color: var(--green); background: var(--green-soft); }
.apply-result-summary .result-failed { color: var(--red); background: var(--red-soft); }
.apply-result-list { max-height: 420px; border: 1px solid var(--line); border-radius: 12px; overflow-y: auto; }
.apply-result-row {
  display: grid; grid-template-columns: 31px minmax(0,1fr) minmax(160px,1.2fr); align-items: center;
  gap: 10px; padding: 12px; border-bottom: 1px solid var(--line-soft);
}
.apply-result-row:last-child { border-bottom: 0; }
.result-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 10px; font-weight: 900; }
.apply-result-row.failed .result-icon { background: var(--red); }
.apply-result-row strong, .apply-result-row small { display: block; }
.apply-result-row strong { margin-bottom: 3px; font-size: 10px; }
.apply-result-row small, .apply-result-row p { color: var(--muted); font-size: 8.5px; }
.apply-result-row p { margin: 0; }
.apply-result-row.failed p { color: #9a2e35; }

.quick-alias-body { display: grid; gap: 12px; }
.quick-alias-body label { color: var(--muted); font-size: 9px; font-weight: 750; }
.quick-alias-body input {
  width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); background: white; outline: 0;
}
.quick-alias-body input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34,103,70,.11); }
.quick-alias-help { margin: 0; padding: 11px; border-radius: 10px; color: #547060; background: #f1f7f3; font-size: 8.5px; line-height: 1.55; }
.quick-alias-body .dialog-actions { margin-top: 4px; }

@media (max-width: 980px) {
  .sync-result-grid { grid-template-columns: repeat(3,1fr); }
  .sync-result-grid > div:nth-child(3n) { border-right: 0; }
  .sync-result-grid > div:nth-child(-n+3) { border-bottom: 1px solid rgba(34,103,70,.1); }
}
@media (max-width: 680px) {
  .sort-box { width: 100%; justify-content: space-between; }
  .sort-box select { flex: 1; }
  .sync-result-head > div { align-items: flex-start; flex-wrap: wrap; }
  .sync-result-head small { width: calc(100% - 30px); margin-left: 30px; }
  .sync-result-grid { grid-template-columns: repeat(2,1fr); }
  .sync-result-grid > div { border-bottom: 1px solid rgba(34,103,70,.1); }
  .sync-result-grid > div:nth-child(2n) { border-right: 0; }
  .counterparty-match { grid-template-columns: 38px 1fr; }
  .counterparty-actions { grid-column: 2; flex-wrap: wrap; }
  .counterparty-actions > * { flex: 1; text-align: center; }
  .confirm-item { grid-template-columns: 24px 1fr auto; }
  .confirm-item > div:nth-of-type(2) { grid-column: 2 / 4; }
  .apply-result-row { grid-template-columns: 28px 1fr; }
  .apply-result-row p { grid-column: 2; }
}
@media (max-width: 480px) {
  .sync-result-grid { grid-template-columns: 1fr 1fr; }
  .timeline-event { grid-template-columns: 31px minmax(0,1fr); }
  .timeline-event > em { grid-column: 2; }
  .timeline-running { grid-column: 2; }
  .confirm-dialog, .apply-result-dialog, .quick-alias-dialog { width: 100%; max-width: 100%; max-height: 100vh; border-radius: 0; }
  .confirm-item { grid-template-columns: 23px 1fr; }
  .confirm-item > div:nth-of-type(2), .confirm-item em { grid-column: 2; }
  .apply-result-summary strong { font-size: 14px; }
}
