:root {
  --navy: #7f1d1d;
  --navy-2: #991b1b;
  --navy-3: #b4232d;
  --teal: #b4232d;
  --teal-dark: #7f1d1d;
  --cyan: #fdecee;
  --gold: #f5b83d;
  --bg: #f8f8f8;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #15936b;
  --amber: #b66b05;
  --red: #b4232d;
  --blue: #3974bd;
  --shadow: 0 12px 34px rgba(31, 41, 55, .065);
  --shadow-soft: 0 5px 18px rgba(31, 41, 55, .055);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% -5%, #fff1f2 0, transparent 28%), var(--bg); color: var(--ink); font-family: "Assistant", "Heebo", Arial, sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(180,35,45,.2); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 274px; flex: 0 0 274px; height: 100vh; min-height: 100vh; max-height: 100vh; background: linear-gradient(165deg, #681a20 0%, #851f27 52%, #a32630 100%); color: #fff; padding: 28px 17px 19px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; align-self: flex-start; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; }
.sidebar:after { content: ""; position: absolute; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.08); left: -120px; bottom: 70px; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px; position: relative; z-index: 1; }
.brand-mark { width: 44px; height: 44px; border-radius: 15px; background: linear-gradient(135deg, #dc3545, #991b1b); display: grid; place-items: center; font-size: 25px; font-weight: 800; color: #fff; box-shadow: 0 8px 20px rgba(127,29,29,.24); }
.brand strong { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.brand small { display: block; color: #f9cbd0; font-size: 10px; margin-top: 2px; letter-spacing: .25px; direction: ltr; }
.demo-pill { background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16); color: #fff; border-radius: 20px; padding: 7px 12px; font-size: 11px; font-weight: 600; align-self: flex-start; margin-right: 9px; position: relative; z-index: 1; }
.demo-pill.live-pill { color: #fff; border-color: rgba(255,255,255,.22); }
.nav { display: grid; gap: 5px; position: relative; z-index: 1; }
.nav-item { border: 1px solid transparent; background: transparent; color: #f5c8cc; text-align: right; padding: 12px 13px; border-radius: 12px; display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 500; transition: .18s ease; }
.nav-item span { width: 27px; height: 27px; border-radius: 9px; background: rgba(255,255,255,.08); display: grid; place-items: center; font-size: 16px; color: #fff; transition: .18s ease; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(-2px); }
.nav-item.active { background: linear-gradient(90deg, rgba(255,255,255,.18), rgba(255,255,255,.08)); border-color: rgba(255,255,255,.16); color: #fff; box-shadow: inset -3px 0 #fff, 0 8px 18px rgba(0,0,0,.08); }
.nav-item.active span { background: #fff; color: var(--red); box-shadow: 0 5px 13px rgba(60,0,0,.2); }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 16px 10px 0; color: #d0d9e8; font-size: 12px; line-height: 1.8; position: relative; z-index: 1; }
.sidebar-footer small { color: #f0b9bf; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #44db9a; margin-left: 5px; box-shadow: 0 0 0 4px rgba(68,219,154,.12); }

.main-content { flex: 1; min-width: 0; max-width: 1680px; padding: 36px 46px 68px; margin-inline: auto; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 30px; }
.eyebrow { font-size: 12px; color: var(--teal-dark); font-weight: 700; letter-spacing: .25px; }
.topbar h1 { margin: 5px 0 0; font-size: clamp(28px, 2.2vw, 34px); line-height: 1.08; letter-spacing: -.7px; font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 12px; }
.top-actions #last-updated { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; box-shadow: var(--shadow-soft); }
.button { min-height: 40px; border: 1px solid #d8dee8; background: #fff; color: var(--ink); border-radius: 11px; padding: 9px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 700; font-size: 13px; line-height: 1.15; transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease; box-shadow: 0 1px 2px rgba(31,41,55,.03); }
.button:hover { border-color: #c8a0a4; background: #fffafa; transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
.button-primary { background: var(--red); color: #fff; border-color: var(--red); box-shadow: 0 7px 16px rgba(180,35,45,.18); }
.button-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); box-shadow: 0 9px 20px rgba(127,29,29,.22); }
.button-danger { color: var(--red); border-color: #f0c9cd; background: #fffafa; }
.button-small { padding: 7px 11px; font-size: 12px; border-radius: 8px; }

.view { display: none; animation: fade-in .25s ease both; }
.view.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; margin-bottom: 21px; }
.card, .kpi { background: var(--card); border: 1px solid #e8e9ec; border-radius: 17px; box-shadow: var(--shadow); }
.kpi { padding: 19px 20px 18px; position: relative; overflow: hidden; min-height: 162px; }
.kpi:after { content: ""; position: absolute; width: 130px; height: 130px; border-radius: 50%; background: linear-gradient(135deg, rgba(180,35,45,.13), rgba(180,35,45,0)); left: -48px; bottom: -68px; }
.kpi-primary { background: linear-gradient(145deg, #7f1d1d, #b4232d); border-color: transparent; color: #fff; box-shadow: 0 17px 35px rgba(127,29,29,.18); }
.kpi-primary:after { background: rgba(255,255,255,.13); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; margin-bottom: 19px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--cyan); color: var(--red); font-weight: 800; font-size: 17px; }
.kpi-primary .kpi-icon { background: rgba(255,255,255,.17); color: #fff; }
.icon-amber { color: #d58713; background: #fff5e1; }
.icon-blue { color: var(--blue); background: #eaf2ff; }
.icon-red { color: var(--red); background: #ffedf0; }
.kpi-trend { color: var(--muted); font-size: 10px; font-weight: 700; }
.kpi-primary .kpi-trend { color: #8de8df; }
.kpi-trend.positive:before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #55e09d; margin-left: 4px; }
.kpi-label { font-size: 12px; color: var(--muted); position: relative; z-index: 1; font-weight: 600; }
.kpi-primary .kpi-label { color: #b4c8e4; }
.kpi-value { font-size: 30px; line-height: 1; font-weight: 800; letter-spacing: -.5px; margin-top: 8px; position: relative; z-index: 1; }
.kpi-meta { font-size: 11px; color: var(--muted); margin-top: 10px; position: relative; z-index: 1; }
.kpi-primary .kpi-meta { color: #93afd2; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: 19px; }
.card { padding: 22px; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 19px; }
.card-header h2 { font-size: 17px; margin: 0; font-weight: 800; letter-spacing: -.2px; }
.muted { color: var(--muted); }
.chart-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin: 2px 0 10px; }
.chart-header strong, .chart-header span { display: block; }
.chart-header strong { font-size: 13px; }
.chart-header span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.chart-total { color: var(--teal-dark) !important; font-size: 14px !important; font-weight: 800; direction: ltr; }
.chart { height: 222px; display: flex; align-items: flex-end; gap: 8px; padding: 12px 4px 0; border-bottom: 1px solid var(--line); position: relative; }
.chart-grid { position: absolute; inset: 14px 0 28px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-grid i { display: block; border-top: 1px dashed #e8edf4; }
.bar-wrap { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; position: relative; z-index: 1; }
.bar-group { height: calc(100% - 18px); display: flex; align-items: flex-end; gap: 3px; }
.bar { width: clamp(5px, 1.8vw, 17px); border-radius: 5px 5px 2px 2px; min-height: 3px; transition: height .4s ease; }
.bar:hover { filter: brightness(1.08); transform: scaleX(1.08); }
.bar-received { background: linear-gradient(180deg, #68d9d0, #16aaa5); }
.bar-posted { background: linear-gradient(180deg, #1e3d70, #0c214a); }
.bar-expected { background: linear-gradient(180deg, #f5c766, #d99728); }
.bar-overdue { background: linear-gradient(180deg, #f28b9b, #d24a5d); }
.bar-label { font-size: 10px; color: var(--muted); direction: ltr; }
.legend { display: flex; gap: 18px; font-size: 11px; color: var(--muted); margin-top: 13px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-left: 5px; }
.legend-received { background: var(--teal); }
.legend-posted { background: var(--navy-2); }
.trend-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.trend-summary > div { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.trend-summary span, .trend-summary strong { display: block; }
.trend-summary span { color: var(--muted); font-size: 12px; }
.trend-summary strong { margin-top: 5px; font-size: 20px; direction: ltr; text-align: right; }
.trend-source { color: var(--muted); font-size: 11px; margin: 12px 0 4px; }
.trend-list { display: grid; }
.trend-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.trend-row:last-child { border-bottom: 0; }
.trend-period strong, .trend-period small { display: block; }
.trend-period small { color: var(--muted); margin-top: 4px; }
.trend-measures { display: grid; gap: 9px; }
.trend-measures > div > span { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.trend-measures > div > span strong { color: var(--ink); direction: ltr; }
.trend-track { height: 8px; margin-top: 5px; overflow: hidden; border-radius: 999px; background: #edf0f4; }
.trend-track i { display: block; height: 100%; border-radius: inherit; }
.trend-bank { background: linear-gradient(90deg, #f28b94, #b4232d); }
.trend-priority { background: linear-gradient(90deg, #4b5563, #1f2937); }

.mini-list { display: grid; gap: 13px; }
.mini-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 12px; font-size: 13px; }
.mini-row:last-child { border-bottom: 0; padding-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-green { background: #e6f8f0; color: var(--green); }
.badge-amber { background: #fff4df; color: var(--amber); }
.badge-red { background: #ffedf0; color: var(--red); }
.badge-blue { background: #eaf2ff; color: #396aa5; }
.section-grid { display: grid; gap: 19px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 17px; }
.input, .select { min-height: 40px; border: 1px solid #d8dee8; background: #fff; border-radius: 10px; padding: 9px 12px; color: var(--ink); min-width: 180px; outline: none; transition: .18s; }
.input:focus, .select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(180,35,45,.12); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 13px; }
.data-table th { background: #f8fafc; color: var(--muted); font-size: 11px; text-align: right; font-weight: 700; padding: 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 14px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #fbfefd; }
.connections-table th, .connections-table td { text-align: right; }
.connections-table th:nth-child(1), .connections-table td:nth-child(1) { width: 36%; }
.connections-table th:nth-child(2), .connections-table td:nth-child(2) { width: 34%; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px 4px 2px; color: var(--muted); font-size: 12px; }
.pager .button:disabled { opacity: .45; cursor: not-allowed; }
.amount { font-weight: 800; direction: ltr; text-align: right; }
.empty { padding: 50px 25px; text-align: center; color: var(--muted); }
.progress { height: 8px; background: #eaf0f5; border-radius: 20px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--teal); border-radius: 20px; }
.customer-card { display: flex; align-items: center; gap: 12px; }
.avatar { width: 37px; height: 37px; border-radius: 12px; background: linear-gradient(135deg, #d8f7f3, #c2ece9); color: #087f7a; display: grid; place-items: center; font-weight: 800; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.detail-box { display: flex; min-height: 72px; flex-direction: column; align-items: stretch; justify-content: flex-start; background: #f8fafc; border: 1px solid #edf1f6; border-radius: 12px; padding: 14px; text-align: right; }
.detail-box label { display: block; width: 100%; color: var(--muted); font-size: 11px; line-height: 1.4; margin-bottom: 8px; text-align: right; }
.detail-box > strong { display: block; width: 100%; line-height: 1.5; text-align: right; }
.toast { position: fixed; bottom: 25px; left: 25px; background: #2b2021; color: #fff; padding: 13px 17px; border-radius: 11px; box-shadow: 0 14px 32px rgba(31,41,55,.22); opacity: 0; transform: translateY(10px); transition: .2s; z-index: 90; font-size: 13px; font-weight: 600; }
.toast.show { opacity: 1; transform: translateY(0); }
.modal { display: none; position: fixed; inset: 0; z-index: 80; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(7,20,49,.52); backdrop-filter: blur(4px); }
.modal-panel { position: relative; width: min(720px, calc(100vw - 30px)); max-height: calc(100vh - 36px); overflow: auto; margin: 18px auto; padding: 24px; background: #fff; border-radius: 20px; box-shadow: 0 24px 70px rgba(5,18,48,.3); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.modal-header h2 { margin: 5px 0 0; font-size: 22px; }
.modal-close { border: 0; background: #f3f6fa; color: var(--muted); width: 34px; height: 34px; border-radius: 10px; font-size: 22px; line-height: 1; }
.modal-close:hover { background: #eaf1f7; color: var(--ink); }
.customer-modal .modal-backdrop { background: rgba(31, 41, 55, .58); }
.customer-modal-panel { width: min(860px, calc(100vw - 30px)); max-height: calc(100vh - 28px); margin: 14px auto; padding: 22px; }
.customer-modal-panel #customer-modal-content > .card-header { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.customer-invoice-history-note { margin: -6px 0 12px; }
.customer-invoice-history .table-wrap { max-height: 360px; overflow: auto; }
.customer-modal-panel h3 { margin-top: 25px; }
.customer-modal-panel .detail-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.customer-modal-panel .table-wrap { max-height: 260px; }
.auth-gate { display: none; position: fixed; inset: 0; z-index: 50; align-items: center; justify-content: center; padding: 20px; background: rgba(7,20,49,.72); backdrop-filter: blur(9px); }
.auth-gate.open { display: flex; }
.auth-card { width: min(390px, 100%); padding: 30px; border-radius: 22px; background: #fff; box-shadow: 0 25px 80px rgba(3,15,43,.35); text-align: center; }
.auth-card .brand-mark { margin: 0 auto 16px; color: #fff; }
.auth-card h2 { margin: 0; font-size: 24px; }
.auth-card p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 10px 0 18px; }
.auth-card .button { width: 100%; margin-top: 12px; }
.auth-error { display: block; min-height: 18px; margin-top: 10px; color: var(--red); font-size: 12px; }
.detail-list { display: grid; gap: 10px; }
.comparison-intro { margin: -7px 0 13px; }
.candidate-card { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.candidate-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.candidate-card-head strong, .candidate-card-head small { display: block; }
.candidate-card-head small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.candidate-invoices { display: grid; gap: 7px; }
.candidate-invoice { display: grid; grid-template-columns: minmax(120px, 1.5fr) 1fr 1fr; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; }
.candidate-invoice span:nth-child(n+2) { color: var(--muted); }
.candidate-reason { color: var(--muted); font-size: 11px; }
.bank-source-grid { margin-top: 12px; }
.manual-match-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr); gap: 10px; margin-top: 12px; }
.manual-match-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.manual-match-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.manual-match-box { margin: 20px 0; padding: 16px; border: 1px dashed #bfe4df; border-radius: 14px; background: #f3fcfb; }
.manual-match-box h3 { margin-top: 0; }
.detail-list .mini-row { margin: 0; }
.raw-box { direction: ltr; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; background: #f7f9fc; border: 1px solid var(--line); border-radius: 12px; padding: 13px; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; color: #3e4d68; }
.operation-alerts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.operation-alert { border-radius: 13px; padding: 14px; background: #fff8ea; border: 1px solid #f5dfb2; }
.operation-alert strong { display: block; font-size: 21px; color: var(--amber); }
.operation-alert span { color: var(--muted); font-size: 12px; }
.small-note { font-size: 11px; color: var(--muted); line-height: 1.6; }
.notice { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 15px 18px; border-radius: 14px; border: 1px solid #f2d59b; background: #fff9eb; color: #80530b; }
.notice strong { font-size: 13px; }
.notice span { font-size: 12px; color: #9a7441; flex: 1; }
.connection-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px; background: #f8fafc; border: 1px solid #edf1f6; border-radius: 12px; margin-bottom: 10px; }
.connection-onboarding { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding: 16px; border: 1px dashed #bfe4df; border-radius: 14px; background: #f3fcfb; }
.connection-onboarding strong, .connection-onboarding small { display: block; }
.connection-onboarding small { color: var(--muted); font-size: 11px; margin-top: 5px; }
.connection-status { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--green); }
.connection-status:before { content: ""; width: 8px; height: 8px; background: #45d39a; border-radius: 50%; box-shadow: 0 0 0 4px rgba(69,211,154,.13); }
.connection-actions { display: flex; align-items: center; gap: 12px; }
.timeline { display: grid; gap: 10px; }
.timeline-item { border-right: 2px solid var(--cyan); padding: 0 14px 12px; }
.timeline-item strong { font-size: 12px; }
.timeline-item small { display: block; color: var(--muted); margin-top: 4px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.settings-section { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: #fcfdff; }
.settings-section h3 { margin: 0 0 18px; font-size: 15px; }
.setting-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.setting-row strong, .setting-row small { display: block; }
.setting-row small { color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: 5px; }
.setting-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--teal); }
.setting-field { display: grid; gap: 7px; margin-top: 15px; font-size: 12px; color: var(--muted); }
.setting-field .input { width: 100%; min-width: 0; }
.input.wide { width: 100%; resize: vertical; }
.input-suffix { display: flex; align-items: center; gap: 7px; direction: ltr; }
.input-suffix .input { max-width: 100px; }
.settings-actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
.settings-actions .small-note { margin: 0; }
.admin-access-card { margin-top: 22px; padding: 26px; }
.admin-access-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.admin-access-header h2 { margin: 4px 0 3px; font-size: 21px; }
.admin-access-header p, .admin-card-title p, .admin-section-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.section-kicker { display: inline-flex; color: var(--green); background: #e6f8f0; border-radius: 999px; padding: 4px 9px; font-size: 10px; font-weight: 800; }
.admin-access-icon, .admin-card-icon { display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--red), var(--teal-dark)); box-shadow: 0 7px 16px rgba(127,29,29,.18); }
.admin-access-icon { width: 42px; height: 42px; border-radius: 13px; font-size: 19px; }
.admin-create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.admin-create-card { display: flex; flex-direction: column; gap: 2px; padding: 20px; border: 1px solid #e7eaef; border-radius: 16px; background: linear-gradient(180deg, #fff, #fcfdff); }
.admin-card-title { display: flex; align-items: center; gap: 11px; min-height: 44px; margin-bottom: 8px; }
.admin-card-title h3 { margin: 0 0 2px; font-size: 16px; }
.admin-card-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 20px; flex: 0 0 34px; }
.admin-create-card .setting-field { margin-top: 9px; }
.admin-create-card .setting-field > span { color: var(--ink); font-size: 11px; font-weight: 700; }
.admin-create-button { align-self: flex-start; margin-top: 14px; min-width: 128px; }
.admin-info-box { display: grid; gap: 3px; margin-top: 15px; padding: 12px 13px; border: 1px solid #f2d59b; border-radius: 11px; background: #fff9eb; color: #80530b; font-size: 11px; }
.admin-info-box span { color: #9a7441; line-height: 1.55; }
.admin-users-section, .admin-permissions-section { margin-top: 30px; }
.admin-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.admin-section-heading h3 { margin: 0 0 3px; font-size: 16px; }
.admin-users-table .data-table { min-width: 680px; }
.admin-user-identity { display: flex; align-items: center; gap: 10px; }
.admin-user-identity > span:last-child { display: grid; gap: 2px; }
.admin-user-identity strong { font-size: 13px; }
.admin-user-identity small { color: var(--muted); font-size: 10px; }
.admin-user-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--cyan); color: var(--red); font-size: 14px; font-weight: 800; }
.admin-role-select { min-width: 150px; }
.admin-switch { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; cursor: pointer; white-space: nowrap; }
.admin-switch input { position: absolute; opacity: 0; pointer-events: none; }
.admin-switch-track { width: 36px; height: 21px; display: inline-flex; align-items: center; padding: 3px; border-radius: 999px; background: #d9dee6; transition: .18s ease; }
.admin-switch-track i { width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .18s ease; }
.admin-switch input:checked + .admin-switch-track { background: var(--red); }
.admin-switch input:checked + .admin-switch-track i { transform: translateX(-15px); }
.permission-role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.permission-role-card { min-width: 0; padding: 19px; border: 1px solid #e7eaef; border-radius: 16px; background: #fff; box-shadow: 0 5px 18px rgba(31,41,55,.035); }
.permission-role-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.permission-role-header h3 { margin: 0 0 3px; font-size: 16px; }
.permission-role-header code { color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.permission-list { margin-top: 4px; }
.permission-row { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; padding: 10px 0; border-bottom: 1px solid #eef0f3; cursor: pointer; }
.permission-row:last-child { border-bottom: 0; }
.permission-row > span { min-width: 0; display: grid; gap: 2px; }
.permission-row strong { font-size: 12px; font-weight: 700; }
.permission-row small { color: var(--muted); font-size: 10px; }
.permission-row input { position: absolute; opacity: 0; pointer-events: none; }
.permission-check { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 24px; border: 1px solid #cfd6df; border-radius: 7px; color: transparent; background: #fff; font-style: normal; font-size: 14px; font-weight: 800; transition: .16s ease; }
.permission-row input:checked ~ .permission-check { border-color: var(--red); background: var(--red); color: #fff; box-shadow: 0 4px 10px rgba(180,35,45,.18); }
.permission-row:hover .permission-check { border-color: #b4232d; }
.permission-save { margin-top: 15px; min-width: 112px; }
.response-form { display: grid; gap: 10px; margin: 12px 0 22px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fcfdff; }
.filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.transaction-filter-panel { margin-bottom: 18px; padding: 15px; border: 1px solid #ece7e8; border-radius: 15px; background: linear-gradient(180deg, #fffafa 0%, #fff 100%); }
.transaction-filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 11px; }
.filter-field { min-width: 0; display: grid; gap: 6px; }
.filter-span-2 { grid-column: span 2; }
.filter-label { padding-inline: 3px; color: #596170; font-size: 11px; font-weight: 700; }
.filter-control { min-width: 0; min-height: 46px; position: relative; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #dfe2e7; border-radius: 11px; background: #fff; box-shadow: 0 1px 2px rgba(31,41,55,.025); transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.filter-control:hover { border-color: #cfc5c7; background: #fffdfd; }
.filter-control:focus-within { border-color: var(--red); background: #fff; box-shadow: 0 0 0 3px rgba(180,35,45,.1); }
.filter-icon { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 7px; color: var(--red); background: var(--cyan); font-size: 12px; font-weight: 800; }
.filter-input { width: 100%; min-width: 0; height: 42px; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; font-weight: 600; }
.filter-input::placeholder { color: #9aa1ac; font-weight: 500; }
select.filter-input { cursor: pointer; }
.filter-date-control { cursor: pointer; overflow: hidden; }
.filter-date-display { min-width: 0; color: var(--ink); font-size: 13px; font-weight: 700; direction: ltr; text-align: right; }
.date-native-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.filter-panel-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 2px 3px 0; color: var(--muted); font-size: 10px; }
.filter-active-indicator { display: inline-flex; align-items: center; gap: 5px; }
.filter-active-indicator i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(21,147,107,.1); }
.clear-filters-button span { font-size: 17px; line-height: 0; color: var(--red); }
.expectation-form-card { margin-bottom: 18px; }
.view-loading { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 14px; color: var(--muted); font-weight: 700; }
.loading-spinner { width: 34px; height: 34px; border: 4px solid rgba(180,35,45,.18); border-top-color: var(--red); border-radius: 50%; animation: spin .85s linear infinite; }
.view-refresh-bar { min-height: 38px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; border: 1px solid #f1d9dc; border-radius: 11px; color: var(--red); background: #fff8f8; font-size: 12px; font-weight: 700; animation: fade-in .18s ease both; }
.view-refresh-bar .loading-spinner { width: 17px; height: 17px; border-width: 2px; }
.loading-progress { width: min(280px, 70vw); height: 5px; overflow: hidden; border-radius: 999px; background: rgba(180,35,45,.12); }
.loading-progress::after { content: ""; display: block; width: 42%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #56d7ce); animation: loading-slide 1.15s ease-in-out infinite; }
.error-state { text-align: center; padding: 44px 24px; }
.global-date-bar { display: grid; grid-template-columns: minmax(190px, auto) minmax(360px, 1fr) auto; align-items: center; gap: 16px; margin: -8px 0 24px; padding: 14px 16px; background: rgba(255,255,255,.96); border: 1px solid #e7e3e4; border-radius: 16px; box-shadow: var(--shadow-soft); }
.global-date-bar[hidden] { display: none !important; }
.advanced-operations > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.advanced-operations > summary::-webkit-details-marker { display: none; }
.advanced-operations[open] > summary { margin-bottom: 18px; }
.date-range-heading { min-width: 190px; display: flex; align-items: center; gap: 10px; }
.date-range-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 11px; color: var(--red); background: var(--cyan); font-weight: 800; }
.date-range-heading strong, .date-range-heading small, .selected-date-summary { display: block; }
.date-range-heading strong { font-size: 13px; line-height: 1.15; }
.selected-date-summary { color: var(--ink); font-size: 12px; font-weight: 700; margin-top: 2px; }
.date-range-heading small { color: var(--muted); font-size: 9.5px; margin-top: 2px; }
.date-presets { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; }
.date-preset-chip { min-height: 34px; padding: 7px 11px; border: 1px solid transparent; border-radius: 999px; background: #f6f7f8; color: #5d6572; font-size: 12px; font-weight: 700; white-space: nowrap; transition: .16s ease; }
.date-preset-chip:hover { color: var(--red); background: var(--cyan); }
.date-preset-chip.active { color: #fff; background: var(--red); border-color: var(--red); box-shadow: 0 5px 12px rgba(180,35,45,.16); }
.date-controls { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.date-controls > .select { width: 142px; min-width: 142px; }
.date-custom-fields { display: none; align-items: center; gap: 7px; }
.date-custom-fields.is-visible { display: flex; }
.global-date-bar label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.global-date-bar .input { min-width: 132px; width: 132px; padding: 8px 9px; direction: ltr; }
.global-date-bar .select { padding: 8px 10px; }
.date-arrow { color: var(--red); font-weight: 800; }
.pretty-date-control { min-width: 142px; height: 40px; position: relative; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #d8dee8; border-radius: 10px; background: #fff; color: var(--ink); overflow: hidden; transition: .16s ease; }
.pretty-date-control:hover { border-color: #cfc5c7; }
.pretty-date-control:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(180,35,45,.1); }
.pretty-date-icon { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 7px; color: var(--red); background: var(--cyan); font-size: 11px; }
.pretty-date-value { color: var(--ink); font-size: 11px; font-weight: 700; direction: ltr; }
.pretty-date-control input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.history-progress-list { display: grid; gap: 12px; }
.history-job { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fffafa; }
.history-job-head { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.history-job .progress span { background: linear-gradient(90deg, #7f1d1d, #dc3545); }
.historical-row td { background: #fffafa; }
.mailbox-card { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(430px, auto); align-items: center; gap: 24px; border: 1px solid #e6e8ec; border-radius: 18px; padding: 18px 20px; margin-top: 12px; background: linear-gradient(180deg, #fff, #fcfdff); box-shadow: 0 8px 22px rgba(31,41,55,.045); }
.mailbox-identity { min-width: 210px; display: flex; align-items: center; gap: 11px; }
.mailbox-identity > div { display: grid; gap: 2px; }
.mailbox-identity strong { font-size: 14px; }
.mailbox-identity small { color: var(--muted); font-size: 11px; }
.mailbox-avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px; border-radius: 12px; background: var(--cyan); color: var(--red); font-size: 18px; font-weight: 800; }
.mailbox-status { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: 10px; font-weight: 700; }
.mailbox-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(21,147,107,.1); }
.mailbox-controls { display: grid; grid-template-columns: 1fr auto; align-items: center; justify-content: end; gap: 13px; }
.mailbox-defaults { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid #f0e3e5; border-radius: 13px; background: #fff8f8; }
.mailbox-controls-label { width: 100%; color: var(--muted); font-size: 10px; font-weight: 800; }
.mailbox-defaults label { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 5px 9px; border: 1px solid #eadfe1; border-radius: 9px; color: var(--ink); background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.mailbox-defaults label:has(input:checked) { border-color: #e1a6ac; color: var(--red); background: #fff0f1; }
.mailbox-defaults input { width: 14px; height: 14px; margin: 0; accent-color: var(--red); }
.mailbox-actions { display: flex; align-items: center; gap: 7px; }
.sidebar:after { background: rgba(255,255,255,.07); }
.nav-item.active { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.18); box-shadow: inset -3px 0 #fff, 0 8px 18px rgba(0,0,0,.08); }
.nav-item.active span { background: #fff; color: var(--red); box-shadow: 0 5px 13px rgba(0,0,0,.12); }
.button-primary { background: var(--red); box-shadow: 0 7px 16px rgba(127,29,29,.18); }
.button-primary:hover { background: var(--teal-dark); box-shadow: 0 9px 20px rgba(127,29,29,.23); }
.bar-received { background: linear-gradient(180deg, #f28b94, #b4232d); }
.bar-posted { background: linear-gradient(180deg, #4b5563, #1f2937); }
.legend-received { background: var(--red); }
.legend-posted { background: #1f2937; }
.input:focus, .select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(180,35,45,.11); }
.setting-row input[type=checkbox] { accent-color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes loading-slide { 0% { transform: translateX(-120%); } 50% { transform: translateX(150%); } 100% { transform: translateX(260%); } }

@media (max-width: 1180px) {
  .sidebar { width: 240px; flex-basis: 240px; }
  .main-content { padding: 30px 28px 55px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .operation-alerts { grid-template-columns: repeat(2, 1fr); }
  .global-date-bar { grid-template-columns: minmax(190px, auto) 1fr; }
  .date-controls { grid-column: 1 / -1; justify-content: flex-start; }
  .transaction-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; height: calc(70px + env(safe-area-inset-bottom)); min-height: 0; padding: 7px 7px env(safe-area-inset-bottom); gap: 0; position: fixed; inset: auto 0 0; z-index: 50; overflow: visible; background: rgba(255,255,255,.97); border-top: 1px solid #e7e3e4; box-shadow: 0 -8px 28px rgba(31,41,55,.11); backdrop-filter: blur(14px); }
  .sidebar:after, .brand, .demo-pill, .sidebar-footer { display: none; }
  .nav { width: 100%; height: 63px; display: flex; overflow-x: auto; overflow-y: hidden; gap: 3px; scrollbar-width: none; padding: 0; scroll-snap-type: x proximity; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: 0 0 74px; height: 60px; scroll-snap-align: start; white-space: nowrap; padding: 5px 3px; border: 0; border-radius: 12px; color: #707783; background: transparent; flex-direction: column; justify-content: center; text-align: center; font-size: 10px; line-height: 1.05; font-weight: 700; gap: 3px; }
  .nav-item:hover { transform: none; background: var(--cyan); color: var(--red); }
  .nav-item span { width: 25px; height: 25px; border-radius: 8px; font-size: 14px; color: #6b7280; background: #f5f6f7; }
  .nav-item.active { color: var(--red); background: var(--cyan); border: 0; box-shadow: none; }
  .nav-item.active span { color: #fff; background: var(--red); box-shadow: 0 4px 9px rgba(180,35,45,.18); }
  body:not(.capabilities-ready) .nav-item { pointer-events: none; opacity: .55; }
  .main-content { padding: 20px 14px calc(96px + env(safe-area-inset-bottom)); }
  .topbar { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 17px; }
  .eyebrow { font-size: 10px; }
  .topbar h1 { font-size: 27px; }
  .top-actions { width: 100%; justify-content: flex-start; gap: 7px; flex-wrap: wrap; }
  .top-actions #last-updated { font-size: 9px; padding: 6px 9px; order: 3; }
  .top-actions .button { min-height: 36px; padding: 8px 11px; font-size: 11px; margin-right: auto; }
  .small-note { font-size: 10px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { min-height: 145px; padding: 14px; border-radius: 15px; }
  .kpi-top { margin-bottom: 14px; }
  .kpi-icon { width: 29px; height: 29px; border-radius: 9px; font-size: 14px; }
  .kpi-trend { font-size: 9px; }
  .kpi-value { font-size: 22px; }
  .kpi-meta { font-size: 10px; line-height: 1.35; }
  .card { padding: 16px; border-radius: 15px; }
  .card-header { align-items: flex-start; }
  .card-header h2 { font-size: 15px; }
  .mailbox-card { grid-template-columns: 1fr; gap: 15px; padding: 15px; }
  .mailbox-controls { grid-template-columns: 1fr; justify-content: stretch; gap: 10px; }
  .mailbox-defaults { justify-content: flex-start; }
  .mailbox-actions { justify-content: stretch; }
  .mailbox-actions .button { flex: 1; }
  .global-date-bar { grid-template-columns: 1fr; gap: 12px; margin-top: 0; }
  .date-presets { justify-content: flex-start; overflow-x: auto; padding-bottom: 2px; }
  .date-controls { display: grid; grid-template-columns: 1fr; width: 100%; }
  .date-controls > .select { width: 100%; min-width: 0; }
  .date-custom-fields { display: none; grid-template-columns: 1fr; align-items: stretch; }
  .date-custom-fields.is-visible { display: grid; }
  .date-arrow { display: none; }
  .pretty-date-control { width: 100%; }
  #apply-global-date { width: 100%; }
  .chart { gap: 3px; height: 190px; }
  .trend-summary { grid-template-columns: 1fr; }
  .trend-row { grid-template-columns: 1fr; gap: 10px; }
  .bar { width: 6px; }
  .detail-grid, .settings-grid, .filter-grid { grid-template-columns: 1fr; }
  .candidate-invoice, .manual-match-fields { grid-template-columns: 1fr; }
  .customer-modal-panel { width: calc(100vw - 16px); max-height: calc(100vh - 16px); margin: 8px; padding: 16px; border-radius: 18px; }
  .customer-modal-panel .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .customer-modal-panel .detail-box { padding: 11px; }
  .transaction-filter-panel { margin-inline: -3px; padding: 12px; border-radius: 13px; }
  .transaction-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .transaction-filter-grid .filter-span-2 { grid-column: 1 / -1; }
  .filter-control { min-height: 48px; }
  .filter-panel-footer { align-items: flex-start; flex-direction: column; gap: 4px; }
  .operation-alerts { grid-template-columns: 1fr; }
  .settings-actions { align-items: flex-start; flex-direction: column; }
  .admin-access-card { padding: 16px; }
  .admin-access-header { gap: 10px; }
  .admin-access-header h2 { font-size: 18px; }
  .admin-create-grid, .permission-role-grid { grid-template-columns: 1fr; gap: 12px; }
  .admin-create-card, .permission-role-card { padding: 15px; border-radius: 14px; }
  .admin-section-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .admin-users-table { margin-inline: -2px; }
  .admin-users-table .data-table { min-width: 620px; }
  .admin-role-select { min-width: 132px; }
  .mailbox-card { align-items: stretch; flex-direction: column; gap: 15px; padding: 15px; }
  .mailbox-identity { min-width: 0; }
  .mailbox-controls { align-items: flex-start; flex-direction: column; gap: 11px; }
  .mailbox-defaults { align-items: flex-start; flex-direction: column; gap: 8px; }
  .mailbox-controls-label { margin-bottom: 1px; }
  .mailbox-actions { width: 100%; }
  .mailbox-actions .button { flex: 1; }
  .connection-card { align-items: flex-start; flex-direction: column; }
  .connection-actions { width: 100%; justify-content: space-between; }
  .connection-onboarding { align-items: flex-start; flex-direction: column; }
  .notice { align-items: flex-start; flex-direction: column; gap: 7px; }
  .global-date-bar { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0 0 17px; padding: 13px; border-radius: 15px; }
  .date-range-heading { min-width: 0; }
  .date-range-icon { width: 34px; height: 34px; flex-basis: 34px; }
  .date-range-heading small { max-width: 285px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .date-presets { justify-content: flex-start; overflow-x: auto; margin-inline: -4px; padding: 2px 4px 5px; scrollbar-width: none; }
  .date-presets::-webkit-scrollbar { display: none; }
  .date-preset-chip { flex: 0 0 auto; min-height: 34px; }
  .date-controls { grid-column: auto; width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
  .date-controls > .select { width: 100%; min-width: 0; }
  .date-controls > .button { min-width: 108px; }
  .date-custom-fields, .date-custom-fields.is-visible { grid-column: 1 / -1; display: none; grid-template-columns: 1fr 1fr; gap: 8px; }
  .date-custom-fields.is-visible { display: grid; }
  .date-custom-fields.is-visible + #apply-global-date { grid-column: 1 / -1; }
  .date-custom-fields.is-visible ~ .select { display: none; }
  .global-date-bar label { display: grid; gap: 4px; }
  .global-date-bar .input { min-width: 0; width: 100%; }
  .pretty-date-control { width: 100%; min-width: 0; }
  .date-arrow { display: none; }
  .table-wrap { margin: 0 -2px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 390px) {
  .transaction-filter-grid { grid-template-columns: 1fr; }
  .transaction-filter-grid .filter-span-2 { grid-column: auto; }
  .date-controls { grid-template-columns: 1fr; }
  .date-controls > .button { width: 100%; }
}

/* Incoming / outgoing transaction lists */
.segmented { display: inline-flex; gap: 4px; padding: 4px; background: #f3f4f6; border: 1px solid var(--line); border-radius: 12px; }
.segment { border: 0; background: transparent; padding: 8px 18px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.segment span { background: #e5e7eb; color: #4b5563; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.segment.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-soft); }
.segment.active span { background: var(--cyan); color: var(--navy-3); }
.segment:focus-visible { outline: 2px solid var(--navy-3); outline-offset: 2px; }
.direction-note { margin: 9px 2px 0; }
.amount.amount-outgoing { color: var(--red); }
.filter-field.filter-disabled { opacity: .5; }
.link-button { border: 0; background: none; padding: 0 4px; color: var(--navy-3); font-size: 12px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--navy); }

.bar-values { display: flex; flex-direction: column; align-items: center; gap: 1px; margin-bottom: 4px; min-height: 14px; }
.bar-value { font-size: 10px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.bar-value.value-expected { color: #b07515; }
.bar-value.value-overdue { color: var(--red); }

/* A bank account reads as bank, branch and number; the IBAN stays underneath
   for anyone reconciling against the bank statement itself. */
.detail-box .account-readable { display: block; }
.detail-box .account-readable + small { display: block; margin-top: 4px; font-size: 0.78rem; font-weight: 500; letter-spacing: 0.02em; }

/* Reference numbers, IBANs and dates are latin text inside a right-to-left
   table. Without an explicit alignment each cell hangs off a different edge
   depending on its length, which reads as a ragged column. */
.data-table td[dir="ltr"], .data-table th[dir="ltr"] { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.amount { text-align: left; font-variant-numeric: tabular-nums; }

/* A failed attempt stays on the row so the retry is an informed one. */
.receipt-error { color: var(--red, #B4232D); margin-top: 6px; font-size: 0.78rem; }

/* Why a proposal is not certain, next to why it was proposed at all. */
.match-missing { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: rgba(180, 35, 45, 0.06); }
.match-missing strong { display: block; font-size: 0.78rem; margin-bottom: 4px; }
.match-missing ul { margin: 0; padding-inline-start: 18px; }
.match-missing li { font-size: 0.78rem; line-height: 1.6; }
