:root { --ink: #222; --muted: #666; --line: #d9d9d9; --blue: #0b5394; --bg: #f4f5f7; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bar .spacer { flex: 1; }
.bar .user { color: var(--muted); }
.status { color: var(--muted); }
.status.ok { color: #38761d; }
.status.bad { color: #cc0000; }
.btn, button { font: inherit; padding: 6px 12px; border: 1px solid #bbb; border-radius: 4px; background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; }
button.primary, .btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.small { padding: 3px 8px; font-size: 12px; }
.tabs { display: flex; gap: 4px; padding: 12px 16px 0; }
.tabs button { border-bottom: none; border-radius: 6px 6px 0 0; background: #e9ebef; }
.tabs button.active { background: #fff; font-weight: 600; }
.tab { display: none; padding: 0 16px 24px; }
.tab.active { display: block; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 0 6px 6px 6px; padding: 16px 20px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.grid { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; align-items: start; }
.grid > label { text-align: right; padding-top: 5px; }
.grid small { display: block; color: var(--muted); margin-top: 2px; }
.grid input[type=text], .grid input:not([type]) { padding: 4px 6px; border: 1px solid #bbb; border-radius: 3px; }
label.inline { display: inline-block; margin-right: 12px; }
.buttons { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; flex-wrap: wrap; }
.hint { color: var(--muted); }
.hint.busy::before { content: "⏳ "; }
pre.out { font: 12.5px/1.35 Consolas, "Courier New", monospace; background: #fafafa; border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; min-height: 120px; max-height: 60vh; overflow: auto; white-space: pre; margin: 0; }
pre.out .customer { color: var(--blue); font-weight: 700; }
pre.out .check { color: #b45f06; font-weight: 700; }
pre.out .bad { color: #cc0000; font-weight: 700; }
pre.out .good { color: #38761d; font-weight: 700; }
pre.out .head { color: #444; font-weight: 700; }
pre.out .section { color: #555; }
.flash { margin: 10px 16px 0; padding: 8px 12px; background: #fff4e5; border: 1px solid #f0c48a; border-radius: 4px; }
.help p, .help li { max-width: 80ch; }
body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 340px; border-radius: 6px; }
.login-card h1 { font-size: 18px; margin: 0 0 14px; }
.login-card label { display: block; margin-bottom: 10px; }
.login-card input { display: block; width: 100%; padding: 6px 8px; margin-top: 3px; border: 1px solid #bbb; border-radius: 3px; font: inherit; }
.login-card button { width: 100%; margin-top: 6px; }
@media (max-width: 700px) { .grid { grid-template-columns: 1fr; } .grid > label { text-align: left; padding-top: 0; } }

/* ---- document previews, in the spirit of the QuickBooks PDF */
.docs { display: flex; flex-direction: column; gap: 18px; margin: 6px 0 12px; }
.doc { background: #fff; border: 1px solid #cfd3d8; box-shadow: 0 2px 8px rgba(0,0,0,.08); padding: 26px 32px; max-width: 900px; font-size: 13px; }
.doc .badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 2px 8px; border-radius: 3px; margin-bottom: 12px; text-transform: uppercase; }
.doc.internal .badge { background: #eef1f5; color: #555; }
.doc.customer .badge { background: #e3effb; color: var(--blue); }
.doc .doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.doc .company { font-weight: 700; font-size: 15px; }
.doc .company small { display: block; font-weight: 400; color: var(--muted); }
.doc .doc-type { text-align: right; }
.doc .doc-type h3 { margin: 0 0 6px; font-size: 22px; letter-spacing: .06em; color: #333; }
.doc .doc-type table { margin-left: auto; }
.doc .doc-type table td { padding: 1px 0 1px 14px; text-align: right; }
.doc .doc-type table td:first-child { color: var(--muted); }
.doc .parties { display: flex; gap: 40px; margin: 18px 0 14px; flex-wrap: wrap; }
.doc .party b { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; margin-bottom: 3px; }
.doc .party div { white-space: pre-line; }
.doc table.lines { width: 100%; border-collapse: collapse; margin-top: 6px; }
.doc table.lines th { text-align: left; background: #f1f3f5; padding: 6px 8px; font-size: 11px; text-transform: uppercase; color: #555; border-bottom: 1px solid #cfd3d8; }
.doc table.lines td { padding: 7px 8px; border-bottom: 1px solid #eceff2; vertical-align: top; }
.doc table.lines .num { text-align: right; white-space: nowrap; }
.doc table.lines .note td { color: var(--muted); font-style: italic; }
.doc table.lines .item { color: var(--muted); font-size: 11px; }
.doc .totals { display: flex; justify-content: flex-end; margin-top: 10px; }
.doc .totals table td { padding: 3px 0 3px 24px; text-align: right; }
.doc .totals .grand td { font-weight: 700; font-size: 15px; border-top: 2px solid #333; }
.doc .memo { margin-top: 16px; color: #333; white-space: pre-line; }
.doc .memo b, .doc .pnote b { color: var(--muted); font-size: 11px; text-transform: uppercase; display: block; margin-bottom: 2px; }
.doc .pnote { margin-top: 10px; color: var(--muted); }
.doc .title { color: var(--muted); margin: -6px 0 10px; }
details.printout summary { cursor: pointer; color: var(--muted); margin: 4px 0 6px; }
