/* The invoice needs its own workbench width; it cannot inherit the small side editor. */
html[data-theme] .modal:has(> .invoice-workbench){
  position:fixed;top:76px;right:24px;bottom:24px;
  width:min(1180px,calc(100vw - 48px));max-width:calc(100vw - 48px)!important;
  max-height:calc(100svh - 100px);padding:24px;overflow:auto;
}
html[data-theme] .modal:has(> .invoice-workbench)>header{
  position:static;top:auto;margin:0 0 24px;padding:0 0 20px;
  border-bottom:1px solid var(--line);background:none;backdrop-filter:none;
  -webkit-backdrop-filter:none;min-height:40px;align-items:center;
}
html[data-theme] .modal:has(> .invoice-workbench)>header h2{
  font:italic 400 32px/1.15 'Instrument Serif',Georgia,serif!important;
  letter-spacing:-.02em;
}
html[data-theme] .invoice-workbench{display:block;min-width:0;width:100%;margin:0}
html[data-theme] .invoice-workbench .billing-editor-grid{
  display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);
  gap:32px;align-items:start;min-width:0;
}
html[data-theme] .invoice-workbench .billing-editor-fields{min-width:0;width:100%}
html[data-theme] .invoice-workbench .billing-editor-section{
  display:grid;gap:16px;padding:24px 0;border-bottom:1px solid var(--line);
  min-width:0;
}
html[data-theme] .invoice-workbench .billing-editor-section:first-child{padding-top:0}
/* Only the dialog title is a dialog header; form and document headers stay in flow. */
html[data-theme] .invoice-workbench :is(.billing-editor-section,.billing-paper)>header{
  position:static;top:auto;z-index:auto;background:none;backdrop-filter:none;
  -webkit-backdrop-filter:none;filter:none;box-shadow:none;
}
html[data-theme] .invoice-workbench .billing-editor-section>header{
  display:block;padding:0;margin:0 0 4px;min-height:0;border:0;
}
html[data-theme] .invoice-workbench .billing-editor-section h3{
  font:italic 400 27px/1.2 'Instrument Serif',Georgia,serif;
  letter-spacing:-.015em;margin:0 0 8px;
}
html[data-theme] .invoice-workbench .billing-editor-section header p{
  font:400 12px/1.6 var(--font-ui);color:var(--muted);margin:0;max-width:48ch;
}
html[data-theme] .invoice-workbench .form-grid{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;
  min-width:0;width:100%;
}
html[data-theme] .invoice-workbench label{
  display:grid;gap:8px;min-width:0;margin:0;
  font:500 12px/1.5 var(--font-ui);color:var(--text);
}
html[data-theme] .invoice-workbench label small{
  font:400 11px/1.6 var(--font-ui);color:var(--muted);
}
html[data-theme] .invoice-workbench :is(input,select,textarea){
  box-sizing:border-box;width:100%;min-width:0;max-width:100%;
  font:400 13px/1.5 var(--font-ui);letter-spacing:normal;
}
html[data-theme] .invoice-workbench textarea{resize:vertical;min-height:80px}
html[data-theme] .invoice-workbench .date-trigger{
  width:100%;min-width:0;white-space:nowrap;flex-wrap:nowrap;text-align:left;
}
html[data-theme] .invoice-workbench .invoice-line-editor{
  display:grid;grid-template-columns:minmax(0,1fr) 60px 104px 32px;
  gap:10px;align-items:end;padding:16px 0;min-width:0;
}
html[data-theme] .invoice-workbench .invoice-remove-line{
  width:32px;min-width:32px;min-height:42px;padding:0;align-self:end;
}
html[data-theme] .invoice-workbench .billing-paper{
  position:sticky;top:0;left:auto;right:auto;bottom:auto;align-self:start;
  width:100%;min-width:0;max-width:100%;margin:0;padding:28px 24px;
  color:#242722;background:#f5f2e9;border:1px solid #2427221f;border-radius:6px;
  box-shadow:0 8px 24px #00000012;overflow:hidden;
  font:400 11px/1.6 var(--font-ui);
}
html[data-theme] .invoice-workbench .billing-paper>header{
  display:flex;justify-content:space-between;align-items:flex-start;gap:16px;
  padding:0 0 20px;margin:0 0 24px;border-bottom:1px solid #2427222b;
}
html[data-theme] .invoice-workbench .billing-paper>header>strong{
  min-width:0;overflow-wrap:anywhere;font:600 23px/1.25 var(--font-ui);
  letter-spacing:-.04em;color:#242722;
}
html[data-theme] .invoice-workbench .billing-paper>header>span{
  flex:none;font:400 10px/1.7 var(--font-ui);color:#4f534b;text-align:right;
}
html[data-theme] .invoice-workbench .billing-paper h3{
  font:italic 400 25px/1.2 'Instrument Serif',Georgia,serif;
  letter-spacing:-.015em;color:#242722;margin:8px 0;
}
html[data-theme] .invoice-workbench .billing-paper :is(p,small,dt,dd,th,td){
  font:400 11px/1.6 var(--font-ui);color:#4f534b;
}
html[data-theme] .invoice-workbench .billing-paper-address{
  display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;
}
html[data-theme] .invoice-workbench .billing-paper table{
  display:table;width:100%;min-width:0;table-layout:fixed;
}
html[data-theme] .invoice-workbench .billing-paper :is(th,td){
  padding:10px 4px;background:transparent;border-bottom:1px solid #24272224;
}
html[data-theme] .invoice-workbench .billing-paper th{font-weight:600}
html[data-theme] .invoice-workbench .billing-paper th:first-child{width:45%}
html[data-theme] .invoice-workbench .billing-paper-balance :is(dt,dd){
  font-size:13px;font-weight:600;color:#242722;
}
html[data-theme] .invoice-workbench>footer{
  position:static;display:flex;justify-content:flex-end;flex-wrap:wrap;gap:10px;
  margin:24px 0 0;padding:20px 0 0;border-top:1px solid var(--line);
  background:none;backdrop-filter:none;
}
@media(max-width:1100px){
  html[data-theme] .invoice-workbench .billing-editor-grid{grid-template-columns:minmax(0,1fr);gap:28px}
  html[data-theme] .invoice-workbench .billing-paper{position:static;max-width:640px;margin-inline:auto}
}
@media(max-width:740px){
  html[data-theme] .modal:has(> .invoice-workbench){
    top:72px!important;bottom:12px!important;left:12px!important;right:12px!important;
    width:calc(100vw - 24px)!important;max-width:calc(100vw - 24px)!important;
    max-height:calc(100svh - 84px);padding:20px!important;
  }
  html[data-theme] .invoice-workbench .form-grid{grid-template-columns:minmax(0,1fr)!important}
  html[data-theme] .invoice-workbench .invoice-line-editor{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 32px}
  html[data-theme] .invoice-workbench .invoice-line-editor>label:first-child{grid-column:1/-1}
  html[data-theme] .invoice-workbench .billing-paper{padding:24px 16px}
  html[data-theme] .invoice-workbench .billing-paper-address{grid-template-columns:minmax(0,1fr);gap:20px}
  html[data-theme] .invoice-workbench .billing-paper>header>strong{font-size:20px}
  html[data-theme] .invoice-workbench>footer>button{flex:1 1 42%}
}
