/* StatementPal dashboard. Sits inside the Wix dashboard, so it follows Wix's
   conventions: Madefor type, Wix blue for actions, light panels on a
   blue-grey page. The one strong element is the amount column. */
:root {
  --page: #F0F4F7;
  --surface: #FFFFFF;
  --ink: #162D3D;
  --muted: #577083;
  --line: #DFE5EB;
  --blue: #116DFF;
  --blue-dark: #0F5FDB;
  --blue-soft: #E7F0FF;
  --green: #1A8A4A;
  --green-soft: #E3F5EA;
  --amber-soft: #FFF4DC;
  --amber-ink: #7A5600;
  --red: #D6331F;
  --red-soft: #FDECEA;
  --radius: 8px;
  font-family: "Wix Madefor Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); }
[hidden] { display: none !important; }

.page { max-width: 1180px; margin: 0 auto; padding: 28px 32px 120px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
h1 { font-size: 28px; line-height: 1.2; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 14px; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.muted { color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 500; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--blue); }
.tabs button:hover { color: var(--ink); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 18px;
  border-radius: 18px; border: 1px solid var(--blue); background: var(--surface); color: var(--blue);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; user-select: none; }
.btn:hover { background: var(--blue-soft); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn.small { height: 30px; padding: 0 14px; font-size: 13px; }
.btn.danger-text { border-color: transparent; color: var(--red); }
.btn.danger-text:hover { background: var(--red-soft); }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(22,45,61,.08); margin-bottom: 18px; }
.toolbar-note { margin: 0; color: var(--muted); flex: 1 1 380px; max-width: 70ch; }
.toolbar-actions { display: flex; gap: 10px; }
.hint { margin: 0; padding: 12px 20px; background: var(--blue-soft); border-bottom: 1px solid var(--line); }
.card-note { margin: 0; padding: 14px 20px; color: var(--muted); border-bottom: 1px solid var(--line); }
.start { padding: 22px 24px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; max-width: 72ch; }
.steps li::marker { color: var(--blue); font-weight: 700; }

/* Notice (import results) */
.notice { background: var(--surface); border-left: 4px solid var(--green); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(22,45,61,.08); }
.notice.warn { border-left-color: #E0A100; }
.notice.error { border-left-color: var(--red); }
.notice p { margin: 0 0 4px; max-width: 90ch; }
.notice p:last-child { margin-bottom: 0; }
.notice .close { float: right; background: none; border: 0; font-size: 18px; color: var(--muted); cursor: pointer; line-height: 1; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 18px; padding: 2px; }
.segmented button { border: 0; background: none; font: inherit; padding: 5px 14px; border-radius: 16px; color: var(--muted); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue); font-weight: 500; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); }
.form-card .check { margin-bottom: 18px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tbody tr:hover { background: #F7FAFC; }
.grid tbody tr.selected { background: var(--blue-soft); }
.grid th:first-child, .grid td:first-child { padding-left: 20px; }
.grid th:last-child, .grid td:last-child { padding-right: 20px; }
.col-check { width: 44px; }
.col-check input, td.col-check input { width: 16px; height: 16px; accent-color: var(--blue); }
.grid .num { text-align: right; }
.amount { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; white-space: nowrap; }
.amount .ccy { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
.who { font-weight: 500; }
.who small { display: block; color: var(--muted); font-weight: 400; }
.type { color: var(--muted); }
.type.other { color: var(--amber-ink); }
.nowrap { white-space: nowrap; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.draft { background: var(--amber-soft); color: var(--amber-ink); }
.pill.issued { background: var(--green-soft); color: var(--green); }
.pill.void { background: var(--line); color: var(--muted); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); margin: 0; }

/* Selection bar */
.selection-bar { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: #fff; padding: 10px 12px 10px 22px; border-radius: 28px; box-shadow: 0 8px 24px rgba(22,45,61,.25); z-index: 10; }
.selection-bar .btn { border-color: rgba(255,255,255,.5); background: transparent; color: #fff; }
.selection-bar .btn.primary { background: var(--blue); border-color: var(--blue); }
#selection-summary { font-variant-numeric: tabular-nums; }

/* Settings */
.settings { max-width: 760px; }
.form-card { padding: 22px 24px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; flex: 1; }
.field > span { font-weight: 500; }
.field small, .form-card > small { color: var(--muted); }
.field.narrow { flex: 0 1 220px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
input:not([type=checkbox]):not([type=color]), textarea, select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #C1CBD3; border-radius: 6px; padding: 8px 12px; width: 100%; }
input:hover, textarea:hover, select:hover { border-color: var(--blue); }
textarea { resize: vertical; }
.color-pair { display: flex; gap: 8px; align-items: center; }
.color-pair input[type=color] { width: 40px; height: 38px; border: 1px solid #C1CBD3; border-radius: 6px; padding: 2px; background: var(--surface); cursor: pointer; }
.logo-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.logo-box { width: 160px; height: 72px; border: 1px dashed #C1CBD3; border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; position: sticky; bottom: 0; padding: 14px 0; background: var(--page); }

/* Toast */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 8px; box-shadow: 0 8px 24px rgba(22,45,61,.25); z-index: 20; max-width: min(560px, 92vw); }
.toast.error { background: var(--red); }
.toast a { color: #fff; font-weight: 700; }

.blocked { max-width: 520px; margin: 18vh auto; text-align: center; padding: 0 24px; }
.blocked p { color: var(--muted); }

@media (max-width: 720px) {
  .page { padding: 20px 16px 120px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .grid .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Processor badge */
.src { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; margin-right: 8px;
  background: var(--page); color: var(--muted); letter-spacing: .02em; vertical-align: 1px; }
.src.stripe { background: #EEEBFF; color: #4B3FB0; }
.src.paypal { background: #E6F2FA; color: #0B5A8C; }

/* Dashboard */
.inline-field { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.inline-field select { width: auto; padding: 5px 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.tile { background: var(--surface); padding: 16px 20px; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }
.chart-block { padding: 20px 20px 8px; border-bottom: 1px solid var(--line); }
.chart-block h2 { margin-bottom: 6px; }
.legend { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: -10px; }
.key.invoiced { background: var(--blue); }
.key.open { background: #A9C8FF; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--line); }
.chart .bar-inv { fill: var(--blue); }
.chart .bar-open { fill: #A9C8FF; }
.chart .bar-group:hover rect { opacity: .8; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; }
.chart .area { fill: var(--blue-soft); }
.chart .dot { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }

/* Column mapping dialog */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(620px, 94vw); box-shadow: 0 16px 48px rgba(22,45,61,.3); color: var(--ink); }
dialog::backdrop { background: rgba(22,45,61,.45); }
dialog form { padding: 24px; }
dialog h2 { font-size: 20px; }
.map-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
.map-row .req { color: var(--red); margin-left: 2px; }
.dialog-actions { position: static; background: none; padding: 16px 0 0; }

/* Clients */
.push-right { margin-left: auto; }
.push-left { margin-right: auto; }
input[type=search] { max-width: 280px; }
.small { font-size: 13px; margin: -8px 0 12px; }
.req { color: var(--red); }
.flag { display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 10px;
  background: var(--amber-soft); color: var(--amber-ink); border: 0; cursor: pointer; font-family: inherit; vertical-align: 1px; }
.flag:hover { background: #FFE9B8; }
button.name-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; color: var(--ink); cursor: pointer; text-align: left; }
button.name-link:hover { color: var(--blue); text-decoration: underline; }
.addr { color: var(--muted); max-width: 36ch; }
.selection-bar .warn-link { background: none; border: 0; color: #FFD27A; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
#client-dialog form { max-height: 88vh; overflow-y: auto; }
.setting-note { display: block; color: var(--muted); margin: -10px 0 18px 24px; max-width: 70ch; }

/* Plan */
.head-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.plan-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.plan-chip strong { color: var(--ink); }
.plan-chip .meter { width: 80px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.plan-chip .meter span { display: block; height: 100%; background: var(--blue); }
.plan-chip .meter.full span { background: #E0A100; }
.btn.upgrade { border-color: #E0A100; color: #7A5600; background: var(--amber-soft); }
.btn.upgrade:hover { background: #FFE9B8; }
.pill.void { text-decoration: line-through; }
.title-block { display: flex; align-items: center; gap: 14px; }
.app-icon { width: 48px; height: 48px; border-radius: 12px; }

/* ---------------------------------------------------------- Web version */
/* Sign-in screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background: radial-gradient(60% 50% at 15% 10%, #D9F5EA 0%, transparent 70%), radial-gradient(50% 50% at 90% 20%, #E6E0FF 0%, transparent 70%), var(--page); }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 32px 30px; box-shadow: 0 20px 60px -20px rgba(22,45,61,.3); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 22px; }
.auth-brand img { border-radius: 11px; }
.auth h1 { font-size: 24px; margin-bottom: 8px; }
.auth .muted { margin: 0 0 18px; }
.auth form > .field { margin-bottom: 14px; }
.auth .wide { width: 100%; height: 44px; border-radius: 22px; margin-top: 4px; }
.auth-error { color: var(--red); min-height: 1.2em; margin: 2px 0 8px; font-size: 13.5px; }
.auth-links { text-align: right; margin: 10px 0 0; font-size: 13.5px; }
.auth-switch { text-align: center; margin: 22px 0 0; color: var(--muted); font-size: 14px; }
.auth-fine { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; text-align: center; }
.auth-fine a { color: var(--blue); }

/* Account menu */
.account-menu { position: relative; }
.account-menu .btn { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border-radius: 10px; box-shadow: 0 12px 32px rgba(22,45,61,.2);
  min-width: 180px; padding: 6px; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 6px; font: inherit; cursor: pointer; color: var(--ink); }
.menu button:hover { background: var(--blue-soft); }

/* Plan & billing */
.billing-current { font-size: 16px; margin: 0 0 12px; max-width: 70ch; }
.billing-current strong { font-size: 18px; }
.choose-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.choose-head h2 { margin: 0; }
.plan-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.plan-option { border: 2px solid var(--line); border-radius: 12px; padding: 16px 18px; cursor: pointer; background: var(--surface); text-align: left; font: inherit; color: var(--ink); }
.plan-option:hover { border-color: #A9C8FF; }
.plan-option[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); }
.plan-option .po-name { font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; }
.plan-option .po-price { font-size: 26px; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.plan-option .po-price small { font-size: 13px; font-weight: 400; color: var(--muted); }
.plan-option .po-note { color: var(--muted); font-size: 13px; }
.plan-option .po-current { font-size: 11px; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 2px 8px; border-radius: 10px; }
.paypal-box { max-width: 360px; min-height: 48px; }
.small-note { font-size: 13px; margin: 0 0 14px; }
.btn-bottom { justify-content: flex-end; }
.danger-zone { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.danger-zone summary { cursor: pointer; color: var(--red); font-weight: 500; }
.danger-zone p { margin: 12px 0; max-width: 70ch; }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-solid:hover { background: #B8281A; }
