:root{color-scheme:light;--ink:#253137;--muted:#647078;--teal:#0f766e;--teal-hover:#0b5f59;--teal-light:#e8f4f2;--line:#dce3e5;--bg:#f3f5f6;font-family:Inter,Arial,sans-serif;font-size:16px}
*{box-sizing:border-box}body{margin:0;color:var(--ink);background:var(--bg)}button,input,select,textarea{font:inherit}button{cursor:pointer;background:#fff;border:1px solid #ccd5d8;border-radius:4px;padding:.7rem 1rem;font-weight:600;color:var(--ink);transition:background .12s,border-color .12s}button:hover{background:#f4f7f7;border-color:#a9babc}button:disabled{cursor:wait;opacity:.55}.primary{background:var(--teal);color:#fff;border-color:var(--teal)}.primary:hover{background:var(--teal-hover);border-color:var(--teal-hover)}.text-button{border:0;background:transparent;padding:.4rem 0;font-size:.875rem;color:var(--teal);font-weight:500}.text-button:hover{background:transparent;color:var(--teal-hover);text-decoration:underline}a{color:var(--teal)}label{display:flex;flex-direction:column;gap:.5rem;margin:1rem 0;font-size:.875rem;font-weight:600}input,select,textarea{width:100%;background:#fff;border:1px solid #ccd5d8;padding:.75rem;border-radius:4px;color:var(--ink)}input::placeholder,textarea::placeholder{color:#727e84}textarea{min-height:95px;resize:vertical}input:focus,select:focus,textarea:focus,button:focus-visible,a:focus-visible{outline:2px solid var(--teal);outline-offset:2px}h1,h2,h3,p{margin-top:0}h1{font-size:2rem;font-weight:600;letter-spacing:-.035em;line-height:1.2}h2{font-size:1.5rem;font-weight:600;letter-spacing:-.025em}h3{font-size:1.1rem;font-weight:600}.muted{color:var(--muted)}.hidden{display:none!important}.eyebrow{font-size:.75rem;font-weight:600;letter-spacing:.12em;color:var(--teal)}
.auth-layout{min-height:100vh;display:grid;place-items:center;padding:2rem 1rem;background:var(--bg)}.login-panel{width:100%;display:grid;place-items:center}.login-card{width:min(440px,100%);background:#fff;border:1px solid var(--line);border-radius:6px;padding:2.5rem}.login-brand{display:flex;align-items:center;gap:1rem;padding-bottom:1.5rem;margin-bottom:2rem;border-bottom:1px solid var(--line)}.login-brand img{width:170px;filter:brightness(0);opacity:.82}.login-brand span{font-size:.875rem;color:var(--teal);border-left:1px solid var(--line);padding-left:1rem;font-weight:600}.login-card h1{font-size:1.75rem;margin-bottom:.75rem}.login-card>p{font-size:1rem;line-height:1.6}.login-card form button{width:100%;margin-top:.5rem}.auth-actions{display:flex;justify-content:space-between;gap:1rem;margin:1.25rem 0}.setup-note{border-top:1px solid var(--line);padding-top:1.25rem;margin-top:1.5rem;font-size:.875rem;color:var(--muted);line-height:1.6}.setup-note strong{color:var(--ink);font-weight:500}.setup-note p{margin:.5rem 0 0}#authError,#verifyError,#modalError{color:#a42e38;font-size:.875rem;line-height:1.6}#verify .login-card>button{margin:0 .4rem .8rem 0}
.sidebar{position:fixed;width:232px;inset:0 auto 0 0;background:#fff;border-right:1px solid var(--line);display:flex;flex-direction:column;padding:1.75rem 1rem}.brand{display:block;padding:.25rem .75rem}.brand img{width:170px;max-width:100%;filter:brightness(0);opacity:.82}.sidebar-label{font-size:.75rem;letter-spacing:.09em;color:var(--muted);margin:2.5rem .75rem 1rem}.sidebar nav{display:grid;gap:.25rem}.sidebar nav button{border:0;background:transparent;color:#53626a;text-align:left;font-size:.875rem;font-weight:500;padding:.85rem .9rem;border-radius:4px}.sidebar nav button.active{background:var(--teal-light);color:#0b655f;font-weight:600}.sidebar nav button:hover{background:#f0f5f5}.sidebar-bottom{margin-top:auto;font-size:.875rem;padding:1rem .75rem 0;border-top:1px solid var(--line);overflow-wrap:anywhere}.sidebar-bottom strong{font-weight:500}.sidebar-bottom p{color:var(--muted);margin:.5rem 0;line-height:1.5}.sidebar-bottom button{color:var(--teal)}main{margin-left:232px}.topbar{min-height:72px;border-bottom:1px solid var(--line);background:#fff;padding:1.25rem 2.25rem;display:flex;align-items:center;justify-content:space-between;gap:1rem;font-size:.875rem}.pill{display:inline-block;font-size:.75rem;padding:.3rem .55rem;background:#edf0f1;color:#58666d;border-radius:4px;white-space:nowrap}.pill.issued{color:#42545c;background:#e9eef0}.pill.paid{color:#0b655f;background:var(--teal-light)}#content{padding:2.25rem;max-width:1450px;margin:auto}.heading{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;margin-bottom:1.75rem}.heading .eyebrow{display:none}.heading h1{margin-bottom:.6rem}.heading p{color:var(--muted);font-size:1rem;line-height:1.6;margin-bottom:0}.actions{display:flex;gap:.6rem;flex-wrap:wrap}.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem;margin-bottom:1.75rem}.stat{background:#fff;border:1px solid var(--line);padding:1.5rem;border-radius:5px}.stat span{display:block;font-size:.875rem;color:var(--muted)}.stat strong{display:block;font-size:1.9rem;margin-top:.75rem;font-weight:500;font-variant-numeric:tabular-nums}.panel{background:#fff;border:1px solid var(--line);border-radius:5px;overflow:hidden}.panel-padding{padding:1.5rem}.toolbar{padding:1.1rem 1.25rem;display:flex;gap:1rem;border-bottom:1px solid var(--line)}.toolbar input{max-width:340px}.toolbar select{max-width:220px}table{width:100%;border-collapse:collapse;text-align:left}th{font-size:.875rem;font-weight:600;background:#f7f9f9;color:#5c6a71}td,th{padding:1rem 1.25rem;border-bottom:1px solid #e8edee}td{font-size:.875rem;line-height:1.6}tr:last-child td{border-bottom:0}tbody tr:hover{background:#fafcfc}td small{display:block;color:var(--muted);font-size:.75rem}td button{padding:.4rem .65rem;font-size:.875rem;font-weight:500}.table-wrap{overflow:auto}.empty{text-align:center;padding:4rem 2rem;color:var(--muted)}.empty h3{color:var(--ink)}.empty p{max-width:440px;margin:auto auto 1.5rem;line-height:1.7;font-size:1rem}.notice{padding:1rem 1.25rem;background:#eef6f5;border:1px solid #d1e5e1;border-left:3px solid var(--teal);border-radius:3px;font-size:.875rem;line-height:1.6;margin-bottom:1.5rem}.message{margin:1rem 2.25rem;padding:1rem;border:1px solid var(--line);background:#fff;border-radius:4px;font-size:.875rem;line-height:1.6}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 1.25rem}.span2{grid-column:1/-1}.section-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(260px,1fr);gap:1.5rem}.mini-preview{background:#fff;border:1px solid var(--line);padding:2rem;border-radius:5px;min-height:350px}.mini-preview .eyebrow{margin-bottom:2rem;display:block}.mini-preview h3{font-size:1.6rem;color:var(--ink)}.mini-preview p{color:var(--muted);white-space:pre-line;font-size:.875rem;line-height:1.7}.mini-preview hr{border:0;border-top:1px solid var(--line);margin:2rem 0}.tag{display:inline-block;padding:.2rem .5rem;margin:.2rem .2rem .2rem 0;background:#edf3f2;color:#3c6863;font-size:.75rem;border-radius:3px}.check-label{display:flex;flex-direction:row;align-items:center;font-weight:400}.check-label input{width:auto}
dialog{width:min(860px,calc(100% - 2rem));max-height:90vh;border:1px solid var(--line);border-radius:6px;padding:2rem;color:var(--ink);background:#fff;box-shadow:none}dialog::backdrop{background:#25313788}.dialog-heading{display:flex;justify-content:space-between;align-items:center;gap:1rem;margin-bottom:1.5rem}.dialog-heading button{padding:.2rem .6rem;border:0;font-size:1.5rem;font-weight:400}.dialog-heading h2{margin:0}.dialog-footer{display:flex;justify-content:flex-end;gap:.7rem;margin-top:1.5rem;flex-wrap:wrap}.line-item{display:grid;grid-template-columns:minmax(0,1fr) 80px 120px 40px;gap:.6rem;margin:.7rem 0}.line-item label{margin:0}.line-item button{padding:.5rem;margin-top:1.7rem}.invoice-paper{background:#fff;color:var(--ink);padding:2rem;font-size:.875rem;line-height:1.6}.invoice-top{display:flex;justify-content:space-between;border-bottom:2px solid var(--teal);padding-bottom:2rem;margin-bottom:2rem;gap:1rem}.invoice-top h2{font-size:2rem}.invoice-paper .address{white-space:pre-line}.invoice-totals{margin:2rem 0 2rem auto;max-width:300px;display:flex;justify-content:space-between;font-size:1.4rem;font-weight:600;gap:1rem;font-variant-numeric:tabular-nums}.invoice-footer{border-top:1px solid var(--line);padding-top:1rem;font-size:.75rem;color:var(--muted)}.busy{opacity:.7;pointer-events:none}
@media(max-width:1000px){.section-grid{grid-template-columns:1fr}.heading{flex-wrap:wrap}.topbar{padding:1rem 1.5rem}#content{padding:1.5rem}}
@media(max-width:760px){.auth-layout{padding:1rem}.login-card{padding:1.75rem}.sidebar{position:static;width:100%;padding:1rem;border-right:0;border-bottom:1px solid var(--line)}.brand{padding:0}.brand img{width:140px}.sidebar-label{display:none}.sidebar nav{display:flex;overflow:auto;gap:.3rem;margin-top:1rem}.sidebar nav button{white-space:nowrap;padding:.65rem .85rem}.sidebar-bottom{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.75rem 0 0;margin-top:.75rem}.sidebar-bottom strong{display:none}.sidebar-bottom p{margin:0;font-size:.75rem}main{margin:0}.topbar{padding:1rem;flex-wrap:wrap}#content{padding:1.25rem}.stats{gap:.5rem}.stat{padding:1rem}.stat strong{font-size:1.4rem}.toolbar{flex-wrap:wrap}.toolbar input,.toolbar select{max-width:none}.form-grid{grid-template-columns:1fr}.span2{grid-column:auto}.line-item{grid-template-columns:minmax(0,1fr) 65px 95px 35px;gap:.3rem}dialog{padding:1rem}.line-item input{padding:.5rem}.invoice-paper{padding:1rem}.message{margin:1rem}.invoice-top{flex-wrap:wrap}}
@media(max-width:430px){.line-item{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 40px}.line-item label:first-child{grid-column:1/-1}.line-item button{margin-top:1.7rem}.stat strong{font-size:1.15rem}.stat span{font-size:.75rem}.auth-actions{flex-wrap:wrap}.login-brand img{width:145px}}
@media(prefers-reduced-motion:reduce){button{transition:none}}
@media print{body{background:#fff}body>*:not(dialog){display:none!important}dialog{display:block!important;position:static;max-height:none;width:100%;padding:0;border:0;box-shadow:none}dialog::backdrop,.dialog-heading,.dialog-footer,#modalError{display:none!important}.invoice-paper{padding:0}tbody tr:hover{background:#fff}tr{break-inside:avoid}.invoice-footer{margin-top:2rem}@page{size:A4;margin:18mm}}

.theme-toggle{position:fixed;right:1rem;bottom:1rem;z-index:20;font-size:.875rem}
:root[data-theme="dark"]{color-scheme:dark;--ink:#e7edf0;--muted:#a5b4bb;--teal:#5ee0cf;--teal-hover:#87eadc;--teal-light:#173d3a;--line:#34444b;--bg:#141c20}
[data-theme="dark"] button,[data-theme="dark"] input,[data-theme="dark"] select,[data-theme="dark"] textarea,[data-theme="dark"] .login-card,[data-theme="dark"] .sidebar,[data-theme="dark"] .topbar,[data-theme="dark"] .stat,[data-theme="dark"] .panel,[data-theme="dark"] .message,[data-theme="dark"] .mini-preview,[data-theme="dark"] dialog{background:#202b31;border-color:var(--line)}
[data-theme="dark"] button:hover,[data-theme="dark"] tbody tr:hover,[data-theme="dark"] .sidebar nav button:hover{background:#2a3940}
[data-theme="dark"] .primary{background:var(--teal);color:#102a27;border-color:var(--teal)}[data-theme="dark"] .primary:hover{background:var(--teal-hover)}
[data-theme="dark"] .text-button,[data-theme="dark"] .sidebar nav button{background:transparent;color:var(--teal)}
[data-theme="dark"] .sidebar nav button.active{background:var(--teal-light);color:var(--teal)}
[data-theme="dark"] .login-brand img,[data-theme="dark"] .brand img{filter:none;opacity:1}
[data-theme="dark"] th{background:#26343b;color:#c1cdd2}[data-theme="dark"] td,[data-theme="dark"] th{border-color:var(--line)}
[data-theme="dark"] .pill,[data-theme="dark"] .pill.issued{background:#34444b;color:#d0dce0}[data-theme="dark"] .pill.paid,[data-theme="dark"] .tag,[data-theme="dark"] .notice{background:var(--teal-light);color:#a9eee3;border-color:var(--line)}
[data-theme="dark"] #authError,[data-theme="dark"] #verifyError,[data-theme="dark"] #modalError{color:#ffabb3}
.invoice-paper{color:#253137;--ink:#253137;--muted:#647078;--line:#dce3e5;--teal:#0f766e}.invoice-paper th{background:#f7f9f9;color:#5c6a71}.invoice-paper td,.invoice-paper th{border-color:#e8edee}
[data-theme="dark"] .invoice-paper th{background:#f7f9f9;color:#5c6a71}[data-theme="dark"] .invoice-paper td,[data-theme="dark"] .invoice-paper th{border-color:#e8edee}[data-theme="dark"] .invoice-paper tbody tr:hover{background:#fafcfc}
@media print{.theme-toggle{display:none!important}:root[data-theme="dark"]{color-scheme:light}}

.invoice-folders{display:flex;gap:.75rem;overflow-x:auto;padding-bottom:1rem;margin-bottom:.75rem}.folder-button{display:flex;align-items:center;gap:.75rem;text-align:left;min-width:170px;max-width:280px;flex-shrink:0;font-weight:500}.folder-button svg{width:24px;height:24px;flex-shrink:0;color:var(--teal)}.folder-button small{display:block;margin-top:.35rem;color:var(--muted);font-size:.75rem}.folder-button.active,[data-theme="dark"] .folder-button.active{border-color:var(--teal);background:var(--teal-light)}.invoice-toolbar{flex-wrap:wrap}.invoice-toolbar select{max-width:160px}.recipient-list{max-height:260px;overflow:auto;border:1px solid var(--line);border-radius:4px;padding:.5rem 1rem;margin:.75rem 0}.recipient-list small{display:block;color:var(--muted);font-size:.875rem}.recipient-list .check-label{gap:.75rem}.recipient-list p{padding:.5rem 0;margin:0;border-bottom:1px solid var(--line)}.recipient-list p:last-child{border:0}.recipient-actions{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap;font-size:.875rem}.recipient-actions button{padding:.4rem .65rem;font-size:.875rem}.batch-summary{background:var(--teal-light);border:1px solid var(--line);border-radius:4px;padding:1rem;margin:1rem 0}.batch-summary p{margin:.35rem 0}
