/* documents/module.css: the Invoices and Quotes tabs, the quote form and the
   signature strip. */

/* Invoices: number, company, date, due, status, total, actions. Every
   fraction minmax(0, ...) so a long company name cannot make one row resolve
   its columns differently from its neighbours; the last track FIXED, because
   an unpaid row carries Mark paid where a voided one does not. */
.row.invoices{grid-template-columns:minmax(0,1.1fr) minmax(0,1.4fr) minmax(0,0.7fr) minmax(0,0.7fr) minmax(0,0.6fr) minmax(0,0.7fr) 200px;}
/* Quotes: number, company, date, status, total, actions. */
.row.quotes{grid-template-columns:minmax(0,1.1fr) minmax(0,1.6fr) minmax(0,0.8fr) minmax(0,0.7fr) minmax(0,0.8fr) 150px;}
.row.invoices .primary-text,.row.invoices .sub-text,
.row.quotes .primary-text,.row.quotes .sub-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.row.invoices .order-actions,.row.quotes .order-actions{white-space:normal;}

/* The quote form: client, contact and date on one row. */
.quote-who{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1.3fr) minmax(0,1fr);gap:12px;}

/* The line itself is the core's .priced-line. Under it: the detail the client
   reads, two quiet links, and a panel with the statement-of-work fields. */
.qli-detail{grid-column:1 / 5;}
.qli-detail input{width:100%;color:var(--ink-soft);}
.qli-links{grid-column:1 / -1;display:flex;flex-wrap:wrap;gap:2px 16px;margin-top:-3px;}
.qli-links button{background:none;border:none;padding:0;font:inherit;font-size:13px;color:var(--ink-soft);cursor:pointer;text-decoration:underline;text-underline-offset:2px;}
.qli-links button:hover{color:var(--ink);}
.line-item-row.quote-line .qli-more{grid-column:1 / -1;display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1.6fr) 140px auto;gap:10px;align-items:start;padding:10px 12px;border:1px dashed var(--line);border-radius:var(--radius);}
.line-item-row.quote-line .qli-more[hidden]{display:none;}
.line-item-row.quote-line .qli-more .field{margin-bottom:0;}

/* The payment schedule editor: label, percent, what it comes to, remove. */
.quote-schedule-row{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1.5fr) 110px minmax(0,0.7fr) auto;gap:10px;align-items:center;margin-bottom:8px;}
.qs-trigger{display:flex;flex-direction:column;gap:6px;min-width:0;}
.qs-trigger select{width:100%;min-width:0;}
.qs-trigger select[hidden]{display:none;}
.quote-schedule-actions{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:6px;}
#quote-schedule-sum.quote-schedule-off{color:var(--brick);}

/* Terms on the left, the money on the right: the discount and tax sit in the
   sum they change, the box level with the terms under their label. */
.quote-bottom{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:16px;align-items:start;margin-top:14px;}
.quote-bottom > .field{margin:0;}
.quote-bottom textarea{width:100%;}
.quote-sums{margin-top:20px;padding:12px;border:1px solid var(--line-strong);border-radius:var(--radius);font-size:14px;}
.quote-sum{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 0;}
.quote-sum label{color:var(--ink-soft);}
.quote-sum .ctl{display:flex;align-items:center;gap:6px;color:var(--ink-soft);}
.quote-sum .ctl select{width:52px;padding:6px 2px 6px 8px;}
.quote-sum .ctl input{width:76px;padding:6px 8px;text-align:right;}
.quote-sum.total{margin-top:6px;padding-top:10px;border-top:1px solid var(--line);font-size:16px;font-weight:600;font-variant-numeric:tabular-nums;}
.quote-sum-notes{display:flex;flex-direction:column;gap:2px;margin-top:6px;font-size:13px;color:var(--ink-soft);}
.quote-sum-notes:empty{display:none;}

/* The preview: the introduction under the title, a phase heading row and
   its acceptance beneath, and the blocks after the total. */
.quote-intro{margin:0 0 16px;}
.quote-headline{font-size:17px;color:var(--ink);margin-bottom:4px;}
.quote-summary{white-space:pre-wrap;}
table.data tr.quote-phase-row td{font-weight:600;color:var(--ink);border-bottom:1px solid var(--line-strong);}
table.data tr.quote-accept-row td{font-style:italic;color:var(--ink-soft);font-size:12px;}
.quote-block{margin-top:20px;}
.quote-block-title{font-size:15px;margin:0 0 4px;}
.quote-block-totals{display:flex;flex-direction:column;align-items:flex-end;gap:4px;margin-top:10px;}

/* What has happened to a document sent for signature: one line under the
   heading, a dot for the state, the actions on the right. Its own class
   rather than the dashboard's .alert-item, which is inline-flex chrome. */
.sig-strip{display:flex;align-items:center;gap:10px;padding:9px 12px;margin:0 0 14px;border:1px solid var(--line);border-radius:8px;background:var(--subtle-bg);font-size:13px;flex-wrap:wrap;}
.sig-dot{display:inline-block;width:9px;height:9px;border-radius:50%;flex-shrink:0;}
.sig-actions{margin-left:auto;display:flex;gap:6px;flex-wrap:wrap;}

@media (max-width:760px){
  .row.invoices,.row.quotes{grid-template-columns:1fr;gap:4px;}
  .row.invoices .primary-text,.row.invoices .sub-text,
  .row.quotes .primary-text,.row.quotes .sub-text{white-space:normal;}
  /* A phone line stacks (the core's .priced-line): under the subtotal, the
     detail, then the links with the bin beside them, then the panel. */
  .line-item-row.quote-line .line-sub{grid-column:1 / -1;}
  .qli-detail{grid-column:1 / -1;}
  .qli-links{grid-column:1 / 4;order:1;column-gap:12px;margin-top:0;}
  .qli-links button{min-height:44px;}
  #app-shell .qli-links button{font-size:14px;}
  .line-item-row.quote-line .line-bin{order:2;}
  .line-item-row.quote-line .qli-more{order:3;grid-template-columns:minmax(0,1fr);}
  .quote-who{grid-template-columns:minmax(0,1fr);gap:0;}
  .quote-bottom{grid-template-columns:minmax(0,1fr);gap:14px;}
  .quote-sums{margin-top:0;}
  .quote-schedule-row{grid-template-columns:1fr 1fr;}
  .sig-actions{margin-left:0;}
}

/* Invoices: what is owed is the loud state, what is settled the quiet one.
   An open row carries its one action and the row's menu; a settled row only
   the menu. */
.row.invoices .inv-acts{justify-content:flex-end;align-items:center;flex-wrap:nowrap;}
.row.invoices.is-open .primary-text, .row.invoices.is-open .inv-total{color:var(--ink);}
.row.invoices.is-settled > *, .row.invoices.is-settled .primary-text, .row.invoices.is-settled .badge{color:var(--ink-soft);font-weight:400;}
.row.invoices.is-void .primary-text{text-decoration:line-through;}
.inv-more-btn{flex:none;width:32px;height:32px;color:var(--ink-soft);}
.inv-more-btn:hover, .inv-more-btn[aria-expanded="true"]{color:var(--ink);}
.inv-more-btn .ic{width:18px;height:18px;}
.inv-row-menu{min-width:200px;}
/* A stacked row keeps a narrow column at its right for the menu, so a settled
   row (menu only) spends no line on it; an open row's one action sits under it. */
@media (max-width:960px){
  .row.invoices.invoices:not(.head){grid-template-columns:minmax(0,1fr) auto 36px !important;}
  .row.invoices .inv-acts{display:contents;}
  .row.invoices.invoices > :nth-child(4){grid-column:2 / -1;}
  .row.invoices .inv-acts > :not(.inv-more-btn){grid-column:1 / -1;grid-row:4;justify-self:start;margin-top:6px;}
  .row.invoices .inv-acts > .inv-more-btn{grid-column:3;grid-row:1 / span 2;align-self:start;justify-self:end;width:44px;height:44px;margin:-8px -10px 0 0;}
}

/* Some money in, not all of it: a stage part-paid. */
.dot.inv-partial{background:var(--blue);}
.inv-stage{display:block;font-size:12px;color:var(--ink-soft);}

/* The client page's proposals: one row each, the whole row opens it. */
.cq-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:14px;align-items:center;padding:10px 0;border-top:1px solid var(--line);cursor:pointer;}
.cq-row:hover .primary-text{text-decoration:underline;}
.cq-money{text-align:right;font-variant-numeric:tabular-nums;}
.cq-state{min-width:150px;text-align:right;}
@media (max-width:640px){
  .cq-row{grid-template-columns:minmax(0,1fr) auto;}
  .cq-state{grid-column:1 / -1;text-align:left;min-width:0;}
}
/* Terms: the long editors read as prose, not code. */
.ds-terms{font-family:inherit;line-height:1.55;min-height:320px;resize:vertical;}
/* The client's terms line, above their proposals. */
.cq-terms{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:0 0 10px;}
/* The dashboard's Open quotes: the stages as one bar, and a person's own stale age. */
.doc-stale{ display:inline-flex; align-items:center; gap:6px; margin-left:auto; font-size:12px; color:var(--ink-soft); white-space:nowrap; }
.doc-stale .dp-range{ margin-left:0; }
.doc-stack{ margin:12px 16px 6px; }
.doc-legend{ padding:0 16px 10px; flex-wrap:wrap; gap:4px 14px; }
.dp-doc-quotes .dp-head .dp-link{ margin-left:12px; }

/* A document's pop-up (a proposal or an invoice): the title in the display
   style, a quiet line of what happened to it, Email and the rest as text
   links with Download PDF the button, the parties under labels, and the total
   in the display style at the foot of the sum. */
.doc-lede{margin:-12px 0 0;font-size:14.4px;color:var(--ink-soft);}
.doc-void{color:var(--brick);}
.doc-acts{display:flex;align-items:center;flex-wrap:wrap;gap:10px 22px;margin:18px 0 24px;}
.doc-acts .btn:last-child{margin-left:auto;}
.doc-parties{display:flex;justify-content:space-between;gap:20px 32px;flex-wrap:wrap;margin-bottom:22px;}
.doc-parties .lb{margin-bottom:4px;}
.doc-sums{display:flex;flex-direction:column;align-items:flex-end;gap:4px;margin-top:16px;}
.doc-total{margin-top:6px;font-family:var(--font-display);font-size:24px;font-weight:300;letter-spacing:-0.015em;line-height:1.15;}
.doc-balance{font-size:15.2px;}
.doc-terms{margin-top:18px;white-space:pre-wrap;}
.row.invoices .badge, .row.quotes .badge{white-space:nowrap;}

/* In the two Physare themes: no tinted strip, no boxed sum, no dashed panel,
   no dot beside a number whose status is written in its own column. */
html:is([data-theme="plasmodium"],[data-theme="oat"]) .row :is(.name-with-dot) > .dot{display:none;}
html:is([data-theme="plasmodium"],[data-theme="oat"]) .row.invoices .primary-text, html:is([data-theme="plasmodium"],[data-theme="oat"]) .row.quotes .primary-text{font-size:15.2px;}
html:is([data-theme="plasmodium"],[data-theme="oat"]) .sig-strip{padding:10px 0;border:0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);border-radius:0;background:none;font-size:14.4px;}
html:is([data-theme="plasmodium"],[data-theme="oat"]) .sig-dot{border-radius:0;width:6px;height:6px;}
html:is([data-theme="plasmodium"],[data-theme="oat"]) .quote-sums{padding:12px 0 0;border:0;border-top:1px solid var(--line-strong);border-radius:0;}
html:is([data-theme="plasmodium"],[data-theme="oat"]) .quote-sum.total{font-family:var(--font-display);font-size:24px;font-weight:300;letter-spacing:-0.015em;}
html:is([data-theme="plasmodium"],[data-theme="oat"]) .line-item-row.quote-line .qli-more{padding:12px 0;border:0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);border-radius:0;}
html:is([data-theme="plasmodium"],[data-theme="oat"]) .qli-links button{font-size:14.4px;text-decoration-color:var(--line-strong);text-underline-offset:3px;}
html:is([data-theme="plasmodium"],[data-theme="oat"]) table.data tr.quote-phase-row td{font-weight:400;border-bottom-color:var(--line-strong);}
html:is([data-theme="plasmodium"],[data-theme="oat"]) table.data tr.quote-accept-row td{font-style:normal;font-size:14.4px;}
html:is([data-theme="plasmodium"],[data-theme="oat"]) .quote-headline{font-family:var(--font-display);font-size:24px;font-weight:300;letter-spacing:-0.015em;line-height:1.2;}
html:is([data-theme="plasmodium"],[data-theme="oat"]) .hint{font-family:var(--font-ui);font-size:14.4px;color:var(--ink-soft);}
@media (max-width:640px){
  .doc-acts .btn:last-child{margin-left:0;}
  .doc-lede{margin-top:-10px;}
}

/* Phone pass (2026-10-08). A list row is a card: number and amount on the
   first line, the client and the state under them, then the dates with their
   names (the column heads are hidden on a phone, so a bare "Sep 22, 2026"
   said nothing about which date it was). Up to 960px since Area 5a: at a
   tablet's width the seven columns cut every number and date short. */
@media (max-width:960px){
  .row.head.invoices, .row.head.quotes{display:none;}
  .row.invoices:not(.head), .row.quotes:not(.head){grid-template-columns:minmax(0,1fr) auto !important;column-gap:12px;row-gap:4px;}
  .row.invoices .primary-text, .row.invoices .sub-text, .row.quotes .primary-text, .row.quotes .sub-text{white-space:normal;}
  .row.invoices > :nth-child(1), .row.quotes > :nth-child(1){grid-column:1;grid-row:1;}
  .row.invoices > :nth-child(6), .row.quotes > :nth-child(5){grid-column:2;grid-row:1;text-align:right;color:var(--ink);font-weight:500;font-variant-numeric:tabular-nums;}
  .row.invoices.is-settled > :nth-child(6){color:var(--ink-soft);font-weight:400;}
  .row.invoices > :nth-child(2), .row.quotes > :nth-child(2){grid-column:1;grid-row:2;}
  .row.invoices > :nth-child(5), .row.quotes > :nth-child(4){grid-column:2;grid-row:2;text-align:right;}
  .row.invoices > :nth-child(3), .row.quotes > :nth-child(3){grid-column:1;grid-row:3;}
  .row.invoices > :nth-child(4){grid-column:2;grid-row:3;text-align:right;}
  .row.invoices > :nth-child(3)::before{content:'Issued ';color:var(--text-muted);}
  .row.invoices > :nth-child(4)::before{content:'Due ';color:var(--text-muted);}
  .row.quotes > :nth-child(3)::before{content:'Dated ';color:var(--text-muted);}
  .row.invoices > .order-actions, .row.quotes > .order-actions{grid-column:1 / -1;grid-row:4;margin-top:4px;}  .row.quotes > .order-actions:empty{display:none;}
  .line-item-remove{min-height:44px;}
}
.doc-preview textarea{width:100%;}
.doc-preview table.data td:nth-child(2){white-space:nowrap;}
