:root {
  --bg: #f4f6fb; --card: #ffffff; --ink: #1b2333; --muted: #6b7590; --line: #e2e7f0;
  --brand: #2f5bea; --brand-dark: #1f42b5; --ok: #1e7f4f; --warn: #b26a00; --bad: #b3261e;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--brand); }
main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }
code { font-size: 13px; background: #eef1f7; padding: 1px 5px; border-radius: 4px; }
pre { background: #eef1f7; padding: 12px; border-radius: 6px; overflow: auto; font-size: 12px; }

.site-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-size: 20px; font-weight: 700; text-decoration: none; color: var(--brand); }
.brand span { color: var(--ink); font-weight: 500; margin-left: 4px; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.site-header nav a { text-decoration: none; color: var(--ink); }
.site-header nav a:hover { color: var(--brand); }
.site-footer { text-align: center; color: var(--muted); padding: 24px; font-size: 13px; }
.inline-form { display: inline; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card.narrow { max-width: 560px; }
h1 { font-size: 24px; margin: 0 0 14px; } h1 small { font-size: 15px; font-weight: 400; }
h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 18px 0 8px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .ok { color: var(--ok); } .error { color: var(--bad); }
.help { display: block; color: var(--muted); font-size: 12px; }
.break { word-break: break-all; } .nowrap { white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.tile-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tile-value { font-size: 26px; font-weight: 600; margin: 4px 0; } .tile-value small { font-size: 13px; color: var(--muted); font-weight: 400; }
.tile-sub { font-size: 13px; color: var(--muted); }
.tile-warn { border-color: #f0c27a; } .tile-bad { border-color: #f1a8a3; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table.compact td, .table.compact th { padding: 6px 8px; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

.status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e9edf5; color: #3d4a66; white-space: nowrap; }
.status-paid, .status-refunded, .status-partially_refunded { background: #dff3e7; color: var(--ok); }
.status-initiated, .status-created, .status-pending { background: #fff1d6; color: var(--warn); }
.status-failed, .status-canceled { background: #fde2df; color: var(--bad); }
.status-expired { background: #e9edf5; color: var(--muted); }

.dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; }
.filters input[type=text] { flex: 1 1 260px; }
input[type=text], input[type=url], input[type=number], input[type=date], input[type=password], select, textarea {
  font: inherit; padding: 7px 10px; border: 1px solid #c9d1e0; border-radius: 6px; background: #fff; }
input[type=text], input[type=url], input[type=password] { width: 100%; }
.filters input, .filters select { width: auto; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.inline-fields label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.inline-fields input { width: auto; }
label { display: block; font-weight: 500; margin-bottom: 4px; }
.actions { margin-top: 12px; }
.btn { display: inline-block; font: inherit; padding: 8px 14px; border-radius: 6px; border: 0; background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-dark); }
.btn-secondary { background: #e9edf5; color: var(--ink); } .btn-secondary:hover { background: #dbe2ef; }
.btn-danger { background: var(--bad); } .btn-danger:hover { background: #8f1d17; }

.flashes { list-style: none; padding: 0; margin: 0 0 16px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; background: #e6edff; border: 1px solid #c8d6ff; word-break: break-all; }
.flash-success { background: #dff3e7; border-color: #b7e3c8; }
.flash-warning { background: #fff1d6; border-color: #f0c27a; }
.flash-error { background: #fde2df; border-color: #f1a8a3; }
.pagination { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 16px 0; }
details.card summary { cursor: pointer; font-weight: 600; }
