:root {
  --bg: #f4f6fa; --card: #fff; --ink: #1b2333; --muted: #64708a; --line: #e2e7f0;
  --brand: #2f4bd8; --brand-dark: #2238a8; --pos: #0f9d6b; --neg: #d6455d; --warn: #c27a06;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { background: #101a3d; color: #fff; }
header.top .bar { max-width: 1100px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; }
header.top a { color: #dbe3ff; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; color: #fff !important; }
.spacer { flex: 1; }
nav.tabs { background: #fff; border-bottom: 1px solid var(--line); }
nav.tabs .inner { max-width: 1100px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; }
nav.tabs a { padding: 12px 14px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500; }
nav.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); text-decoration: none; }
main { max-width: 1100px; margin: 24px auto; padding: 0 20px 60px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 1px 2px rgba(16,26,61,.04); margin-bottom: 18px; }
.grid .card { margin-bottom: 0; }
.stat { font-size: 26px; font-weight: 700; }
.muted { color: var(--muted); }
.pos { color: var(--pos); } .neg { color: var(--neg); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: #e9edf8; color: var(--brand-dark); }
.btn.danger { background: #fde7ea; color: var(--neg); }
.btn.small { padding: 4px 10px; font-size: 13px; }
form.inline { display: inline; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], input[type=file], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd6e4; border-radius: 8px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b7c3ff; border-color: var(--brand); }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.errorlist { list-style: none; padding: 0; margin: 4px 0; color: var(--neg); }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: #e8efff; }
.alert.error { background: #fde7ea; color: #8a1f33; } .alert.success { background: #e3f6ee; color: #0b6b49; }
.bars .line { display: grid; grid-template-columns: 110px 1fr 110px; gap: 10px; align-items: center; padding: 6px 0; }
.bars .track { position: relative; height: 16px; background: #f0f3f9; border-radius: 8px; }
.bars .track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: #b5bed1; }
.bars .fill { position: absolute; top: 0; bottom: 0; border-radius: 8px; }
.bars .fill.pos { left: 50%; background: var(--pos); } .bars .fill.neg { right: 50%; background: var(--neg); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #e9edf8; color: var(--brand-dark); }
.pill.green { background: #e3f6ee; color: #0b6b49; } .pill.warn { background: #fff1d6; color: #8a5600; }
.chart { width: 100%; height: auto; } .chart-label { font-size: 12px; fill: var(--muted); } .chart-value { font-size: 12px; fill: var(--ink); }
.split-panel { display: none; border: 1px dashed #cfd6e4; border-radius: 8px; padding: 12px; margin-bottom: 14px; }
.split-panel.active { display: block; }
.member-line { display: grid; grid-template-columns: 28px 1fr 130px; gap: 8px; align-items: center; padding: 4px 0; }
.member-line.payer { grid-template-columns: 1fr 140px; }
.item { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.item .chips label { display: inline-flex; gap: 4px; font-weight: 500; margin-right: 12px; align-items: center; }
#preview { background: #f0f5ff; border: 1px solid #cdd9ff; border-radius: var(--radius); padding: 14px; position: sticky; top: 12px; }
#preview .err { color: var(--neg); }
.layout-form { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.qr svg { width: 120px; height: 120px; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
@media (max-width: 800px) { .layout-form { grid-template-columns: 1fr; } .bars .line { grid-template-columns: 80px 1fr 90px; } }
@media print { header.top, nav.tabs, .noprint, .btn { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
