:root { color-scheme: light; --bg: #f5f5f7; --paper: #fff; --ink: #1d1d1f; --muted: #6e6e73; --line: #d2d2d7; --blue: #0071e3; --soft: #e8f2ff; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
button { cursor: pointer; }
.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 18px; min-height: 58px; padding: 0 20px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); }
.top strong { font-size: 18px; }
.top nav { display: flex; gap: 14px; }
.top button.link { border: 0; background: none; color: var(--blue); padding: 0; }
.main { width: min(980px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0 64px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.login .card { width: min(420px, 100%); }
h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: -0.03em; }
h2 { margin: 0; font-size: 20px; }
.muted { color: var(--muted); }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.actions, .tools { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { min-height: 42px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.full { width: 100%; }
.field { display: grid; gap: 6px; margin: 12px 0; }
.field span { font-size: 13px; font-weight: 650; color: var(--muted); }
input, textarea, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
textarea { min-height: 72px; resize: vertical; }
.err { color: #b42318; background: #fff1f0; border: 1px solid #ffd2cc; border-radius: 10px; padding: 10px 12px; }
.home { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.home section { display: grid; gap: 10px; align-content: start; }
.list { display: grid; gap: 8px; }
.person { display: grid; gap: 2px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; color: inherit; }
.person small { color: var(--muted); }
.badge { justify-self: end; font-size: 12px; font-weight: 700; color: var(--blue); background: var(--soft); border-radius: 99px; padding: 3px 8px; }
.grid { display: grid; grid-template-columns: 1.4fr .8fr .5fr .5fr auto; gap: 8px; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 420px; }
.pick { position: relative; }
.menu { position: absolute; z-index: 3; left: 0; right: 0; top: calc(100% + 4px); display: grid; max-height: 240px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.menu button { border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; padding: 10px 12px; }
.sheet-wrap { margin-top: 22px; overflow-x: auto; }
.quote-sheet { width: 794px; margin: 0 auto; padding: 32px 36px 40px; background: #fff; color: #243028; border: 1px solid #e4e4e4; }
.quote-sheet h1 { margin: 22px 0 26px; color: #0071e3; font-size: 32px; letter-spacing: .04em; text-align: center; text-transform: uppercase; }
.quote-head, .quote-who { display: flex; justify-content: space-between; gap: 24px; }
.quote-logo { width: 168px; }
.quote-contact, .quote-customer span { color: #3d4a43; }
.quote-contact { width: 280px; text-align: right; }
.quote-customer { width: 260px; }
.quote-customer strong, .quote-customer span, .quote-contact div { display: block; }
.quote-meta { margin: 0; }
.quote-meta div { display: flex; gap: 8px; margin-bottom: 6px; }
.quote-meta dt { font-weight: 750; }
.quote-meta dd { margin: 0; }
.quote-rule { height: 3px; margin: 18px 0; background: #0071e3; }
.quote-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.quote-table th { background: #0071e3; color: #fff; text-align: left; padding: 10px 12px; }
.quote-table td { background: #f3f4f4; padding: 12px; vertical-align: top; }
.quote-table th:nth-child(n+2), .quote-table td:nth-child(n+2) { text-align: right; width: 110px; }
.quote-table small { display: block; margin-top: 3px; color: #5c6b62; white-space: pre-line; }
.quote-sums { width: 280px; margin-left: auto; }
.quote-sums div { display: flex; justify-content: space-between; padding: 3px 8px; }
.quote-sums .due { margin-top: 4px; padding: 8px; background: #0071e3; color: #fff; }
.quote-terms strong { color: #0071e3; letter-spacing: .04em; text-transform: uppercase; }
.quote-terms ul { margin: 8px 0 0; padding: 0; list-style: none; color: #3d4a43; }
.tally-sheet { width: 794px; margin: 0 auto; background: #fff; color: #111; border: 1px solid #333; font-size: 11px; }
.tally-sheet h1 { margin: 0; padding: 8px; border-bottom: 1px solid #333; text-align: center; font-size: 16px; }
.banner { padding: 5px; border-bottom: 1px solid #333; background: #fff4e5; color: #9a4d00; text-align: center; font-weight: 750; }
.tally-head { display: grid; grid-template-columns: 1.15fr 1fr; }
.tally-company, .tally-party, .tally-note { padding: 8px 10px; }
.tally-company, .tally-meta { border-bottom: 1px solid #333; }
.tally-meta { display: grid; grid-template-columns: 1fr 1fr; border-left: 1px solid #333; }
.tally-meta div { padding: 5px 8px; border-bottom: 1px solid #333; }
.tally-meta div:nth-child(odd) { border-right: 1px solid #333; }
.tally-meta .wide { grid-column: 1 / -1; }
.tally-meta small, .tally-party small, .tally-note small { display: block; color: #555; }
.tally-parties { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid #333; }
.tally-parties div + div { border-left: 1px solid #333; }
.tally-table { width: 100%; border-collapse: collapse; }
.tally-table th, .tally-table td { border-right: 1px solid #333; border-bottom: 1px solid #333; padding: 4px 5px; text-align: center; vertical-align: top; }
.tally-table .desc, .tally-table th:nth-child(2) { text-align: left; }
.tally-table .num { text-align: right; font-weight: 700; }
.tally-line-detail { display: block; margin-top: 3px; color: #555; white-space: pre-line; font-weight: 400; }
.tally-words, .tally-foot { display: grid; grid-template-columns: 1.2fr .9fr .7fr; border-bottom: 1px solid #333; }
.tally-words { grid-template-columns: 1fr auto; padding: 8px 10px; }
.tally-foot > div { min-height: 110px; padding: 8px 10px; }
.tally-foot > div + div { border-left: 1px solid #333; }
.tally-sign { text-align: right; }
.tally-sign p { margin: 8px 0 0; }
.generated { margin: 0; padding: 6px; text-align: center; font-size: 10px; }
@media (max-width: 800px) {
  .home, .grid, .dates, .quote-head, .quote-who { display: grid; grid-template-columns: 1fr; }
  .quote-contact, .quote-customer { width: auto; text-align: left; }
  .top { flex-wrap: wrap; padding: 10px 14px; }
}
