/* The team's app: layout only (from design/invoice-editor.html and dashboard.html); blocks come from ui.css. */

/* Invoice editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-row h1 .mono { font-weight: 500; }
.summary-input { font: 600 18px/1.3 var(--display); border: 0; border-bottom: 1px dashed var(--line); border-radius: 0; padding: 4px 0; margin-top: 28px; }
.summary-input:focus { box-shadow: none; border-bottom: 1.5px solid var(--gold); }
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.to-block { margin-top: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; font-size: 14px; }
.to-block address { font-style: normal; color: var(--muted); margin-top: 6px; }
.lines-head { display: flex; justify-content: space-between; margin-top: 28px; padding: 0 38px 8px 24px; border-bottom: 1.5px solid var(--graphite); font: 500 12px/1 var(--body); color: var(--muted); }
.line { display: grid; grid-template-columns: 18px 64px 76px 96px minmax(0, 1fr) 84px 30px; grid-template-areas: "grip desc desc desc desc amt del" "grip qty unit rate tax amt del"; gap: 8px 10px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); align-items: start; }
.grip { grid-area: grip; color: #B7BABF; cursor: grab; user-select: none; padding-top: 8px; }
.l-desc { grid-area: desc; } .l-qty { grid-area: qty; } .l-unit { grid-area: unit; } .l-rate { grid-area: rate; } .l-tax { grid-area: tax; }
.l-amt { grid-area: amt; text-align: right; padding-top: 8px; font-size: 14px; }
.l-del { grid-area: del; margin-top: 4px; }
.l-desc small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.line .field { padding: 6px 8px; }
.line .num { text-align: right; font-family: var(--mono); }
.mini { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.line-tax { display: block; font: 12px var(--mono); color: var(--muted); margin-top: 4px; }
.add-line { margin-top: 10px; border-style: dashed; }
.notes { margin-top: 28px; }
.notes textarea { min-height: 70px; resize: vertical; }
.side-panels .panel h2 { font-size: 14.5px; }
.method .tag { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; padding-top: 2px; }
.method.off { opacity: .55; }
.link-box { display: flex; gap: 6px; }
.link-box .field { font: 12.5px var(--mono); min-width: 0; }
.meta-grid > div > .mono { padding-top: 8px; }
.from-addr { margin-top: 0; }
@media (max-width: 1180px) { .editor { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .meta-grid, .to-block { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .to-block address { overflow-wrap: anywhere; }
  .line { grid-template-columns: 18px minmax(0, 1fr) minmax(0, 1fr) 30px; grid-template-areas: "grip desc desc del" "grip qty unit del" "grip rate tax del" "grip amt amt del"; }
  .lines-head span:last-child { display: none; }
}
/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.stat { padding: 18px 20px; border-left: 1px solid var(--line-soft); }
.stat:first-child { border-left: 0; }
.stat .k { font-size: 13px; color: var(--muted); }
.stat .v { font: 500 24px/1.2 var(--mono); margin: 6px 0 2px; }
.stat .s { font-size: 12.5px; color: var(--muted); }
.stat.alert .v { color: var(--red); }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-top: 16px; align-items: start; }
.aging-bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; gap: 2px; margin: 4px 0 14px; }
.aging-bar span { display: block; flex: var(--share, 1); } /* --share: the bucket's part of the total (app.js) */
.b-current { background: var(--graphite); }
.b-30 { background: var(--gold); }
.b-60 { background: #C76A2A; }
.b-90 { background: var(--red); }
.aging-keys { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; font-size: 12.5px; }
.aging-keys .k { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.aging-keys .k i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.aging-keys .v { font: 500 14px var(--mono); margin-top: 2px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.panel-head a { font-size: 13px; display: inline-flex; align-items: center; min-height: 24px; } /* 24px to touch (WCAG 2.5.8, v022) */
.table .client small { display: block; color: var(--muted); font-size: 12.5px; }
.due-late { color: var(--red); }
.pay-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.pay-row:last-child { border-bottom: 0; }
.pay-row small { display: block; color: var(--muted); font-size: 12.5px; }
.proc { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; font-size: 14px; border-bottom: 1px solid var(--line-soft); }
.proc:last-child { border-bottom: 0; }
.proc small { display: block; color: var(--muted); font-size: 12.5px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; }
.proc .btn { padding: 7px 12px; font-size: 13px; }
@media (max-width: 1180px) { .grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .aging-keys { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* 320px wide (WCAG reflow): one figure per row, so a long amount never pushes the page sideways */
@media (max-width: 480px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat { border-left: 0; }
  .stat + .stat { border-top: 1px solid var(--line-soft); }
}
/* Sign-in */
.auth-page { min-height: 100vh; display: grid; place-content: center; padding: 24px 16px; }
.auth-card { width: min(380px, calc(100vw - 32px)); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.auth-logo { height: 44px; margin-bottom: 18px; }
.auth-sub { font-size: 13px; margin: 4px 0 16px; }
.auth-form { display: grid; gap: 6px; }
.auth-form .btn { margin-top: 10px; }
.auth-form .label { margin-top: 6px; margin-bottom: 0; }
.auth-foot { text-align: center; font-size: 12px; color: var(--muted); }

/* Help pages (public/help/, served at /app/help): one readable column on the canvas */
.help-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 760px; margin: 0 auto; padding: 20px 16px 0; }
.help-logo { height: 36px; display: block; }
.help-main { max-width: 728px; margin: 16px auto 48px; padding: 24px 28px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.help-main > * + * { margin-top: 12px; }
.help-main > h1 + * { margin-top: 10px; }
.help-main h2 { margin-top: 26px; }
.help-main ol, .help-main ul { margin-bottom: 0; padding-left: 22px; }
.help-main li + li { margin-top: 6px; }
.help-main .crumbs a { color: var(--muted); }
.help-main .help-topics { list-style: none; padding-left: 0; }
.help-topics li + li { margin-top: 10px; }
.help-topics a { font-weight: 600; }
.help-topics small { display: block; color: var(--muted); font-size: 13.5px; }
.help-link { font-size: 13px; }
@media (max-width: 760px) { .help-main { margin: 12px 16px 32px; padding: 18px 16px; } }

/* App shell bits */
.side-logo-link { display: block; }
@media (max-width: 860px) { .side-logo-link { display: inline-block; } }
.side-out { margin-top: 10px; color: var(--on-dark-muted); background: none; border: 0; padding: 0; font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
.page-loading { padding: 40px; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .field { width: auto; min-width: 200px; }
.row-link { cursor: pointer; }
.row-link a { display: inline-flex; align-items: center; min-height: 24px; }
@media (max-width: 599px) { .row-link a, .panel-head a { min-height: 44px; } } /* 44 by 44 on a phone (Russell, 12 November 2026) */
.row-link:hover td { background: #FAFAFB; }
.table td.wrap { white-space: normal; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (max-width: 1180px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.recovery { columns: 2; font-family: var(--mono); font-size: 14px; padding-left: 18px; }
.qr-secret { font-family: var(--mono); font-size: 13px; word-break: break-all; background: var(--canvas); padding: 8px 10px; border-radius: 6px; }
.report-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.report-summary .stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
@media (max-width: 760px) { .report-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.import-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.import-result { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; }
@media (max-width: 760px) { .import-summary { grid-template-columns: minmax(0, 1fr); } }
.report-period { margin: -6px 0 14px; font-size: 13px; }
.report-note { margin-top: 10px; max-width: 760px; }
.report-table tfoot td { font-weight: 600; border-top: 1.5px solid var(--graphite); border-bottom: 0; }
/* Print (Reports and any page): the page itself, without the sidebar, buttons, tabs and filters. */
@media print {
  .side, .actions, .tabs-row, .toolbar, .visit-banner, .toast { display: none !important; }
  .shell { display: block; min-height: 0; }
  .main { padding: 0; }
  body { background: #fff; }
  .panel { border: 0; padding: 0; }
  .scroll { overflow: visible; }
  .row-link:hover td { background: none; }
}
.settings-section + .settings-section { margin-top: 16px; }
h2.settings-section { margin-top: 28px; }
.processor-box p { margin-bottom: 10px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 10px; }
.inline-form .field { width: auto; }

/* Sign-in links, the application form */
.visit-banner { margin: 0 0 16px; }

/* Invoice tables as stacked cards on phones (app.js invoiceTable): no sideways scrolling. */
@media (max-width: 760px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody { display: block; }
  .table-cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "num status" "client client" "due bal"; gap: 4px 12px;
    padding: 12px 2px; border-bottom: 1px solid var(--line-soft); }
  .table-cards tr:last-child { border-bottom: 0; }
  .table-cards td { display: block; padding: 0; border: 0; white-space: normal; }
  .table-cards .c-num { grid-area: num; font-size: 15px; }
  .table-cards .c-status { grid-area: status; text-align: right; }
  .table-cards .c-client { grid-area: client; }
  .table-cards .c-due { grid-area: due; font-size: 13px; }
  .table-cards .c-bal { grid-area: bal; text-align: right; font-size: 15px; }
  .table-cards .c-issued, .table-cards .c-total { display: none; }
  .table-cards .c-due::before, .table-cards .c-bal::before { content: attr(data-label) " "; color: var(--muted); font: 12px var(--body); }
  .table-cards .c-bal:empty::before { content: ""; }
}
.auth-link { display: inline-block; margin-top: 8px; font-size: 13px; }
.apply-card { width: min(560px, calc(100vw - 32px)); }
.subdomain-row { display: flex; align-items: center; gap: 6px; }
.help-error { color: var(--red); }
/* Settings > Brands: the style cards with their live previews (invoice-styles/; the colours are CSS variables set on
   .style-picks), the colour picker beside its hex digits, and each brand's colour in the list. */
.dialog.dialog-wide { width: min(880px, calc(100vw - 32px)); }
.style-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; margin-top: 4px; }
.style-pick { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--field-line); border-radius: 10px; padding: 10px; cursor: pointer; min-width: 0; }
.style-pick:has(input:checked) { border-color: var(--graphite); box-shadow: inset 0 0 0 1px var(--graphite); }
.style-pick-head { display: flex; gap: 8px; align-items: center; }
.style-pick-head input { accent-color: var(--graphite); }
.style-preview { display: block; height: 300px; overflow: hidden; border-radius: 6px; background: #F2F3F5; }
.style-preview-inner { width: calc(100% / .34); transform: scale(.34); transform-origin: top left; } /* a 34% copy of the page width, filling the card */
.colour-row { display: flex; gap: 8px; align-items: center; }
.colour-pick { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--field-line); border-radius: 6px; background: var(--paper); }
.colour-hex { width: 120px; text-transform: uppercase; }
.colour-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--dot); margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }

/* The invoice, estimate and schedule editors: finding any client by name (roles; app.js clientFinder). */
.client-find { display: grid; gap: 4px; margin-top: 8px; }
/* Settings > Team and roles: each row's role and team choices keep their width; on a phone the table scrolls sideways. */
.team-table select.field { min-width: 150px; }
