/*
 * NineBrief Invoice Generator UI
 * Current release: v18.11
 *
 * The rules below preserve the existing production design while moving styling
 * out of index.html. New changes should be added to the relevant component
 * section rather than as new vXX override blocks. See docs/ARCHITECTURE.md.
 */
    :root{
      /* Invoice compatibility aliases; canonical brand values come from ninebrief-tokens.css. */
      --ink:var(--nb-text); --muted:var(--nb-muted); --bg:#f3f4f6; --card:var(--nb-white);
      --line:#d1d5db; --line-soft:#e5e7eb; --brand:var(--nb-ink); --accent:var(--nb-green);
      --danger:#b42318; --ok:#067647; --desk:var(--nb-dark); --radius:16px;
      --shadow-sm:0 1px 2px rgba(16,24,40,.04),0 1px 3px rgba(16,24,40,.06);
      --shadow-md:0 10px 30px rgba(16,24,40,.08); --ring:0 0 0 4px var(--nb-green-focus);
      --ninebrief-green:var(--nb-green); --ninebrief-green-dark:var(--nb-green);

      /* Consolidated Invoice application/UI variables. */
      --ui-bg:#f5f5f7; --ui-canvas:#f5f5f7; --ui-surface:var(--nb-white); --ui-surface-muted:#f8f8fa;
      --ui-fill:#f2f2f7; --ui-fill-2:#f7f7f9;
      --ui-border:rgba(60,60,67,.16); --ui-border-strong:rgba(60,60,67,.24);
      --ui-separator:rgba(60,60,67,.14); --ui-separator-strong:rgba(60,60,67,.22);
      --ui-label:var(--nb-text); --ui-secondary:var(--nb-muted); --ui-tertiary:var(--nb-document-muted); --ui-blue:#0a66c2;
      --ui-green:var(--nb-green); --ui-radius:16px;
      --ui-shadow:0 1px 2px rgba(0,0,0,.04),0 8px 24px rgba(0,0,0,.05);
      --glass-surface:rgba(255,255,255,.70); --glass-surface-strong:rgba(255,255,255,.82);
      --glass-border:rgba(255,255,255,.72);
      --glass-shadow:0 1px 0 rgba(255,255,255,.72) inset,0 10px 34px rgba(30,41,59,.09);

      /* Shared document-control variants for the Invoice editor. */
      --nb-doc-card-margin:0 0 10px;
      --nb-doc-card-border:1px solid color-mix(in srgb,var(--section-accent,#64748b) 16%,var(--ui-separator));
      --nb-doc-card-radius:18px; --nb-doc-card-bg:var(--ui-surface); --nb-doc-card-shadow:none;
      --nb-doc-card-body-padding:14px 15px 17px; --nb-doc-card-body-border:1px solid var(--ui-border);
      --nb-doc-control-min-width:0; --nb-doc-control-min-height:44px;
      --nb-doc-control-border:1px solid var(--ui-separator-strong); --nb-doc-control-radius:11px;
      --nb-doc-control-bg:var(--nb-white); --nb-doc-control-color:var(--ui-label);
      --nb-doc-control-padding:10px 12px; --nb-doc-control-shadow:0 1px 0 rgba(0,0,0,.015);
      --nb-doc-control-size:13.5px; --nb-doc-control-line-height:1.35;
      --nb-doc-control-transition:border-color 120ms ease,box-shadow 120ms ease,background 120ms ease;
      --nb-doc-control-focus-border:#7baed9; --nb-doc-control-focus-shadow:0 0 0 3px rgba(10,102,194,.10);
      --nb-doc-segment-display:flex; --nb-doc-segment-gap:2px; --nb-doc-segment-margin-top:0;
      --nb-doc-segment-padding:3px; --nb-doc-segment-border:0; --nb-doc-segment-radius:11px;
      --nb-doc-segment-bg:#efeff1; --nb-doc-segment-button-height:44px; --nb-doc-segment-button-flex:1;
      --nb-doc-segment-button-radius:8px; --nb-doc-segment-button-color:#5f6067;
      --nb-doc-segment-button-size:12px; --nb-doc-segment-button-weight:650;
      --nb-doc-segment-active-bg:var(--nb-white); --nb-doc-segment-active-color:#1d1d1f;
      --nb-doc-segment-active-shadow:0 1px 3px rgba(0,0,0,.12);
      --nb-doc-field-gap:6px;
      --nb-doc-logo-columns:1fr auto auto; --nb-doc-logo-gap:8px; --nb-doc-logo-margin-bottom:13px;
      --nb-doc-logo-target-height:64px; --nb-doc-logo-target-padding:9px 11px;
      --nb-doc-logo-target-border:1px dashed rgba(0,122,255,.36); --nb-doc-logo-target-radius:13px;
      --nb-doc-logo-target-bg:rgba(0,122,255,.035); --nb-doc-logo-title-color:#262629; --nb-doc-logo-title-size:12.5px;
      --nb-doc-logo-help-color:var(--ui-secondary); --nb-doc-logo-help-size:10.5px;
      --nb-doc-logo-icon-size:34px; --nb-doc-logo-icon-border:1px solid rgba(0,122,255,.18);
      --nb-doc-logo-icon-radius:10px; --nb-doc-logo-icon-bg:var(--nb-white); --nb-doc-logo-icon-color:var(--ui-blue);
      --nb-doc-logo-icon-font-size:20px;
      --nb-doc-privacy-margin:12px 0 0; --nb-doc-privacy-padding:8px 4px; --nb-doc-privacy-radius:12px;
      --nb-doc-privacy-color:var(--ui-secondary); --nb-doc-privacy-size:11.5px; --nb-doc-privacy-line-height:normal;
      --nb-doc-privacy-align:center;
      --nb-doc-toast-z:200; --nb-doc-toast-offset:16px; --nb-doc-toast-max-width:min(92vw,560px);
      --nb-doc-toast-padding:11px 16px; --nb-doc-toast-radius:12px; --nb-doc-toast-bg:#111827;
      --nb-doc-toast-shadow:0 16px 40px rgba(0,0,0,.3); --nb-doc-toast-size:13.5px;
      --nb-doc-toast-weight:700; --nb-doc-toast-duration:220ms;
      --nb-doc-toolbar-z:15; --nb-doc-toolbar-min-height:54px; --nb-doc-toolbar-gap:8px;
      --nb-doc-toolbar-wrap:wrap; --nb-doc-toolbar-padding:8px 12px;
      --nb-doc-toolbar-border-bottom:1px solid rgba(255,255,255,.10);
      --nb-doc-toolbar-bg:linear-gradient(180deg,rgba(25,26,29,.86),rgba(25,26,29,.76));
      --nb-doc-toolbar-color:#e5e7eb;
      --nb-doc-toolbar-shadow:0 1px 0 rgba(255,255,255,.05) inset,0 8px 24px rgba(0,0,0,.12);
      --nb-doc-toolbar-backdrop:saturate(135%) blur(24px);
      --nb-doc-toolbar-button-height:44px; --nb-doc-toolbar-button-padding:6px 12px;
      --nb-doc-toolbar-button-border:1px solid rgba(255,255,255,.10);
      --nb-doc-toolbar-button-radius:9px; --nb-doc-toolbar-button-bg:rgba(255,255,255,.08);
      --nb-doc-toolbar-button-color:#e5e7eb; --nb-doc-toolbar-button-shadow:none;
      --nb-doc-toolbar-button-size:12.5px; --nb-doc-toolbar-button-weight:650;
      --nb-doc-toolbar-button-hover-border:rgba(255,255,255,.10);
      --nb-doc-toolbar-button-hover-bg:rgba(255,255,255,.14);
      --nb-doc-toolbar-button-hover-color:#e5e7eb; --nb-doc-toolbar-button-hover-shadow:none;
      --nb-doc-zoom-label-width:48px; --nb-doc-zoom-label-color:#e5e7eb;
      --nb-doc-zoom-label-size:13px; --nb-doc-zoom-label-weight:700;

      /* Action/site compatibility aliases; values derive from global tokens where branded. */
      --ninebrief-action:var(--nb-green); --ninebrief-action-hover:var(--nb-green-strong); --ninebrief-action-ink:var(--nb-green-ink);
      --download-red:#e53935; --download-red-hover:#c62828;
      --ninebrief-site-bg:var(--nb-ink); --ninebrief-site-surface:var(--nb-dark);
      --ninebrief-site-border:#27272a; --ninebrief-site-green:var(--nb-green); --ninebrief-site-muted:#a1a1aa;
    }
    *{ box-sizing:border-box; }
    [hidden]{ display:none !important; }
    body{
      margin:0;
      font-family:var(--nb-font-ui);
      font-optical-sizing:auto;
      color:var(--ui-label);
      background:var(--ui-canvas);
      -webkit-font-smoothing:antialiased;
      text-rendering:optimizeLegibility;
    }
    button,input,select,textarea{ font:inherit; color:inherit; }

    .topbar{
      position:sticky;
      top:0;
      z-index:50;
      min-height:64px;
      display:flex;
      align-items:center;
      gap:14px;
      flex-wrap:wrap;
      padding:10px 18px;
      background:rgba(248,250,249,.76);
      border-bottom:1px solid rgba(255,255,255,.72);
      box-shadow:0 1px 0 rgba(17,24,39,.06),0 8px 26px rgba(17,24,39,.05);
      backdrop-filter:saturate(165%) blur(24px);
      -webkit-backdrop-filter:saturate(165%) blur(24px);
    }
    .topbar-actions{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-left:auto; }
    .save-chip{ font-size:12px; color:var(--ui-secondary); border:0; border-radius:999px; padding:6px; background:transparent; white-space:nowrap; }

    .btn{
      display:inline-flex; align-items:center; justify-content:center; gap:6px; line-height:1.25; text-align:center;
      min-width:44px; min-height:44px; border:1px solid var(--ui-border); background:#fff; color:var(--ink); border-radius:11px;
      padding:8px 11px; cursor:pointer; font-weight:650; font-size:12.5px;
      transition:transform 110ms ease-out,background 120ms ease-out,border-color 120ms ease-out,box-shadow 120ms ease-out;
    }
    .btn:active{ transform:scale(.98); }
    .btn.primary{ background:#111827; border-color:#111827; color:#fff; box-shadow:0 4px 12px rgba(17,24,39,.18); }
    .btn.accent{ background:#4ade80; border-color:#4ade80; color:#121212; box-shadow:0 6px 16px rgba(74,222,128,.18); }
    .btn.danger{ color:var(--danger); border-color:rgba(185,28,28,.25); }
    .btn.small{ padding:5px 9px; font-size:12px; border-radius:8px; }

    .workspace{
      position:relative;
      z-index:2;
      display:grid;
      grid-template-columns:minmax(420px,500px) minmax(0,1fr);
      grid-template-rows:auto minmax(0,1fr);
      overflow:hidden;
      background:var(--ui-canvas);
      scroll-margin-top:64px;
      border-top:0;
    }
    .workspace > .toolbar{
      grid-column:1 / -1;
      grid-row:1;
      z-index:30;
    }
    .editor{
      grid-column:1;
      grid-row:2;
      min-height:0;
      overflow:auto;
      padding:14px;
      background:var(--ui-canvas);
      font-size:13px;
      scrollbar-gutter:stable;
    }
    .editor form{
      max-width:480px;
      margin:0 auto;
    }
    .preview{
      grid-column:2;
      grid-row:2;
      display:flex;
      flex-direction:column;
      min-width:0;
      min-height:0;
      background:#dde0e5;
      background-image:none;
    }
    .preview-scroll{ flex:1; overflow:auto; padding:34px 28px 46px; min-height:0; }
    .sheet-zoom{ width:794px; margin:0 auto; }

    /* ══════════ INVOICE SHEET ══════════ */
    .sheet{
      width:794px; min-height:1123px; background:#fff; padding:54px 58px;
      box-shadow:0 18px 50px rgba(17,24,39,.20),0 2px 8px rgba(17,24,39,.10); overflow:hidden; border-radius:4px;
      color:var(--body-color,#27272a);
      font-size:var(--inv-size,13px);
      font-family:var(--inv-font,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif);
      --line-color:color-mix(in srgb,var(--iacc) calc(var(--line-alpha,.65)*100%),white);
      --line-weight:1px;
      --line-weight-strong:2px;
    }
    .sheet.exporting{ min-height:0 !important; box-shadow:none !important; }

    .inv-head{ display:flex; justify-content:space-between; gap:24px; padding-bottom:18px; margin-bottom:22px;
      border-bottom:var(--line-weight-strong) var(--line-style,solid) var(--line-color); }
    .inv-logo{ max-height:64px; max-width:180px; object-fit:contain; display:block; margin-bottom:10px; }
    .inv-bizname{ font-size:1.4em; font-weight:800; color:var(--biz-color,#111827); }
    .inv-line{ font-size:.92em; line-height:1.55; color:inherit; overflow-wrap:anywhere; }
    .inv-titleblock{ text-align:right; min-width:220px; }
    .inv-title{ margin:0; font-size:2.1em; line-height:1.05; color:var(--title-color,#111827); }
    .pill{ display:inline-block; margin-top:8px; padding:.3em .8em; border-radius:999px; font-size:.78em; font-weight:800; letter-spacing:.08em; text-transform:uppercase; background:#f3f4f6; color:#374151; }
    .st-draft{ background:#f3f4f6; color:#4b5563; }
    .st-sent{ background:#eff6ff; color:#1d4ed8; }
    .st-due{ background:#fffbeb; color:#b45309; }
    .st-overdue{ background:#fef2f2; color:#b91c1c; }
    .st-paid{ background:#f0fdf4; color:#166534; }
    .inv-meta{ display:flex; flex-wrap:wrap; justify-content:flex-end; gap:5px 18px; margin:12px 0 0; }
    .inv-meta div{ min-width:105px; }
    .inv-meta dt{ font-size:.7em; font-weight:800; letter-spacing:.1em; text-transform:uppercase; opacity:.85; }
    .inv-meta dd{ margin:2px 0 0; font-size:.92em; font-weight:700; }

    .inv-parties{ display:flex; justify-content:space-between; gap:24px; margin-bottom:20px; }
    .inv-label{ font-size:.78em; font-weight:800; letter-spacing:.12em; text-transform:uppercase; opacity:.85; margin-bottom:6px; }
    .bill-name{ font-weight:800; font-size:1.08em; margin-bottom:2px; }
    .party-extra{ max-width:45%; text-align:right; }
    .party-extra .inv-label{ margin-top:10px; }
    .party-extra .inv-label:first-child{ margin-top:0; }

    .inv-table{ width:100%; border-collapse:collapse; font-size:.95em; background:var(--table-bg,#ffffff); }
    .inv-table th{ text-align:left; padding:9px 8px; font-size:.72em; letter-spacing:.1em; text-transform:uppercase; opacity:.72;
      border-bottom:calc(var(--line-weight) + .5px) var(--line-style,solid) var(--line-color); }
    .inv-table td{ padding:10px 8px; vertical-align:top; border-bottom:var(--line-weight) var(--line-style,solid) var(--line-color); overflow-wrap:anywhere; }
    .num,.th-r{ text-align:right; font-variant-numeric:tabular-nums; }
    .inv-desc strong{ display:block; font-weight:700; }
    .inv-desc small{ display:block; margin-top:3px; color:inherit; opacity:.85; font-size:.85em; }
    .desc-wrap{ display:flex; gap:9px; align-items:flex-start; }
    .item-thumb{ width:40px; height:40px; object-fit:contain; border-radius:6px; border:1px solid var(--line-color); flex:none; }
    .inv-empty td{ text-align:center; color:var(--muted); padding:24px 8px; font-style:italic; }

    /* Table header styles */
    .sheet.th-filled .inv-table th{ background:var(--th-bg,#1f2937); color:var(--th-color,#ffffff); opacity:1; border-bottom:none; }
    .sheet.th-minimal .inv-table th{ background:transparent; border-bottom:none; opacity:.85; }
    .sheet.th-boxed .inv-table th{ background:transparent; border:1px solid var(--line-color); opacity:.85; }

    /* Row styles */
    .sheet.row-plain .inv-table td{ border-bottom:none; }
    .sheet.row-zebra .inv-table td{ border-bottom:none; }
    .sheet.row-zebra .inv-table tbody tr:nth-child(even) td{ background:var(--row-alt,#f4f5f6); }
    .sheet.row-boxed .inv-table td{ border:1px solid var(--line-color); }

    /* Optional highlighted amount column */
    .sheet.hl-amount .inv-table th:last-child,
    .sheet.hl-amount .inv-table td:last-child{ background:var(--amt-bg,#f3f6f4); }

    .totals-wrap{ display:flex; justify-content:flex-end; margin-top:16px; }
    .inv-totals{ min-width:300px; font-size:.96em; }
    .inv-totals > div{ display:flex; justify-content:space-between; gap:18px; padding:4.5px 8px; }
    .inv-totals dt{ opacity:1; }
    .inv-totals dd{ margin:0; font-weight:700; font-variant-numeric:tabular-nums; }
    .t-total{ border-top:var(--line-weight-strong) var(--line-style,solid) var(--line-color); margin-top:7px; padding-top:8px; }
    .t-total dd{ font-size:1.15em; color:var(--total-color,#111827); }
    .t-paid dd{ color:var(--ok); }
    .t-balance dd{ color:var(--total-color,#111827); font-size:1.2em; }

    .payment,.notes{ margin-top:26px; }
    .payment h3,.notes h3{ margin:0 0 9px; font-size:.78em; letter-spacing:.12em; text-transform:uppercase; opacity:.85; }
    .pay-grid{ display:flex; flex-wrap:wrap; gap:12px 34px; }
    .pay-block .pk{ font-size:.7em; font-weight:800; letter-spacing:.1em; text-transform:uppercase; opacity:.85; margin-top:7px; }
    .pay-block .pk:first-child{ margin-top:0; }
    .pay-block div:not(.pk){ font-size:.92em; line-height:1.55; overflow-wrap:anywhere; }
    .pay-instr{ margin-top:10px; font-size:.92em; white-space:pre-wrap; opacity:.85; }
    .notes p{ margin:0 0 12px; font-size:.92em; line-height:1.6; white-space:pre-wrap; max-width:650px; }
    .inv-thanks{ margin-top:22px; font-style:italic; font-size:1.05em; }
    .sig{ margin-top:44px; margin-left:auto; max-width:260px; }
    .sig-line{ height:38px; border-top:1.5px solid currentColor; margin-bottom:6px; }
    .sig .sn{ font-weight:800; font-size:1em; }
    .sig .sr{ font-size:.9em; opacity:.85; }
    .inv-footer{ margin-top:42px; padding-top:12px; border-top:1px var(--line-style,solid) var(--line-color); text-align:center; font-size:.78em; opacity:.85; white-space:pre-wrap; }
    .avoid-break{ break-inside:avoid; }

    /* Premium font collection. Web fonts load on Cloudflare; system fonts remain useful offline. */
    .sheet.font-inter{ --inv-font:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif; }
    .sheet.font-manrope{ --inv-font:Manrope,Inter,Arial,sans-serif; }
    .sheet.font-ibmplex{ --inv-font:"IBM Plex Sans",Inter,Arial,sans-serif; }
    .sheet.font-sourcesans{ --inv-font:"Source Sans 3",Inter,Arial,sans-serif; }
    .sheet.font-dmsans{ --inv-font:"DM Sans",Inter,Arial,sans-serif; }
    .sheet.font-lato{ --inv-font:Lato,Inter,Arial,sans-serif; }
    .sheet.font-montserrat{ --inv-font:Montserrat,Inter,Arial,sans-serif; }
    .sheet.font-poppins{ --inv-font:Poppins,Inter,Arial,sans-serif; }
    .sheet.font-merriweather{ --inv-font:Merriweather,Georgia,serif; }
    .sheet.font-sourceserif{ --inv-font:"Source Serif 4",Georgia,serif; }
    .sheet.font-librebaskerville{ --inv-font:"Libre Baskerville",Georgia,serif; }
    .sheet.font-aptos{ --inv-font:Aptos,"Segoe UI",Arial,sans-serif; }
    .sheet.font-helvetica{ --inv-font:"Helvetica Neue",Helvetica,Arial,sans-serif; }
    .sheet.font-georgia{ --inv-font:Georgia,"Times New Roman",serif; }
    .sheet.font-times{ --inv-font:"Times New Roman",Times,serif; }
    .sheet.font-sans{ --inv-font:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif; }

    /* Premium template variations */
    .tpl-classic .inv-title{ font-size:1.9em; text-transform:uppercase; letter-spacing:.06em; }
    .tpl-classic .inv-meta{ flex-direction:column; align-items:flex-end; gap:4px; }
    .tpl-classic .inv-meta div{ display:flex; align-items:baseline; gap:10px; min-width:0; }
    .tpl-classic .inv-head{ border-bottom-width:3px; }
    .tpl-modern .inv-head{ border-bottom-width:3px; }
    .tpl-modern .inv-title{ font-weight:900; }
    .tpl-minimal .inv-head{ border-bottom-width:1px; }
    .tpl-minimal .inv-title{ font-size:1.25em; text-transform:uppercase; letter-spacing:.24em; font-weight:700; }
    .tpl-minimal .inv-table th{ opacity:.85; }

    .tpl-executive .inv-head{ border-bottom:0; padding-bottom:8px; margin-bottom:30px; }
    .tpl-executive .inv-title{ font-size:2.6em; font-weight:800; letter-spacing:-.045em; color:var(--iacc); }
    .tpl-executive .inv-bizname{ font-size:1.55em; letter-spacing:-.025em; }
    .tpl-executive .inv-label,.tpl-executive .inv-meta dt{ letter-spacing:.15em; }
    .tpl-executive .inv-table th{ border:0; background:#f8fafc; padding-top:11px; padding-bottom:11px; }
    .tpl-executive .inv-table td{ padding-top:13px; padding-bottom:13px; }
    .tpl-executive .t-total{ border-top:3px solid var(--iacc); }

    .tpl-editorial .inv-head{ align-items:flex-end; border-bottom:1px solid var(--line-color); }
    .tpl-editorial .inv-title{ font-family:"Source Serif 4",Georgia,serif; font-size:2.8em; font-weight:500; letter-spacing:-.035em; text-transform:none; }
    .tpl-editorial .inv-bizname{ font-family:"Source Serif 4",Georgia,serif; font-size:1.45em; font-weight:600; }
    .tpl-editorial .inv-table th{ font-family:Inter,Arial,sans-serif; letter-spacing:.14em; }
    .tpl-editorial .t-total dd,.tpl-editorial .t-balance dd{ font-family:"Source Serif 4",Georgia,serif; }

    .tpl-studio .inv-head{ border:0; padding:0 0 28px; }
    .tpl-studio .inv-titleblock{ background:var(--iacc); color:#fff; padding:18px 20px; border-radius:14px; }
    .tpl-studio .inv-title,.tpl-studio .inv-titleblock .inv-meta dt,.tpl-studio .inv-titleblock .inv-meta dd{ color:#fff; }
    .tpl-studio .pill{ background:rgba(255,255,255,.16); color:#fff; }
    .tpl-studio .inv-table{ border-radius:10px; overflow:hidden; }
    .tpl-studio .inv-table th{ background:#111827; color:#fff; opacity:1; border:0; }
    .tpl-studio .t-total{ background:#f8fafc; border:0; border-radius:8px; padding:9px 10px; }

    .tpl-ledger .inv-head{ border-bottom:4px double var(--line-color); }
    .tpl-ledger .inv-title{ font-family:"IBM Plex Sans",Arial,sans-serif; font-size:1.8em; letter-spacing:.08em; text-transform:uppercase; }
    .tpl-ledger .inv-table th,.tpl-ledger .inv-table td{ border-bottom:1px solid var(--line-color); }
    .tpl-ledger .inv-table th{ background:#f3f4f6; opacity:1; }
    .tpl-ledger .inv-totals{ border:1px solid var(--line-color); padding:10px; min-width:330px; }
    .tpl-ledger .t-total{ border-top:2px solid var(--line-color); }


    /* ══════════ EDITOR UI ══════════ */
    details.card summary{ list-style:none; cursor:pointer; }
    details.card summary::-webkit-details-marker{ display:none; }
    details.card > summary{
      min-height:58px; display:flex; align-items:center; gap:8px; padding:13px 15px;
      color:var(--ui-label); font-size:14px; font-weight:720; letter-spacing:-.01em;
      background:color-mix(in srgb,var(--section-soft,#f8fafc) 84%,white);
      border-bottom:1px solid color-mix(in srgb,var(--section-accent,#64748b) 13%,transparent);
    }
    details.card:not([open]) > summary{ border-bottom-color:transparent; }
    details.card > summary:hover{ background:color-mix(in srgb,var(--section-soft,#f8fafc) 94%,white); }
    details.card > summary::after{
      content:""; margin-left:auto; width:28px; height:28px; border-radius:50%; display:block;
      border:1px solid color-mix(in srgb,var(--section-accent,#64748b) 12%,transparent);
      background-color:color-mix(in srgb,var(--section-soft,#f2f2f4) 82%,white);
      background-image:
        linear-gradient(45deg,transparent 48%,var(--section-accent,#64748b) 49% 58%,transparent 59%),
        linear-gradient(-45deg,transparent 48%,var(--section-accent,#64748b) 49% 58%,transparent 59%);
      background-repeat:no-repeat; background-size:7px 7px,7px 7px; background-position:9px 11px,13px 11px;
      transform:none; transition:background-color 120ms ease-out,transform 180ms ease-out;
    }
    details.card[open] > summary::after{ transform:rotate(180deg); }
    details.card > summary:hover::after{ background-color:color-mix(in srgb,var(--section-accent,#64748b) 10%,white); }
    .summary-tag{
      display:inline-flex; align-items:center; margin-left:3px; margin-right:auto; padding:4px 8px;
      border:1px solid color-mix(in srgb,var(--section-accent,#64748b) 24%,transparent); border-radius:999px;
      background:color-mix(in srgb,var(--section-accent,#64748b) 13%,white);
      color:color-mix(in srgb,var(--section-accent,#475569) 86%,#111827);
      font-size:9.5px; line-height:1; font-weight:800; letter-spacing:.025em;
      box-shadow:0 1px 0 rgba(255,255,255,.72) inset;
    }
    .fields{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
    .field > span,.cap{ color:#5f6067; font-size:11px; font-weight:680; letter-spacing:-.004em; text-transform:none; }
    .span2{ grid-column:1/-1; }
    input[type="text"],input[type="email"],input[type="date"],select,textarea{
      width:100%; min-width:0; min-height:44px; padding:10px 12px; outline:none;
      border:1px solid var(--ui-separator-strong); border-radius:11px; background:#fff;
      box-shadow:0 1px 0 rgba(0,0,0,.015); font-size:13.5px; line-height:1.35;
      -webkit-font-smoothing:antialiased;
      transition:border-color 120ms ease,box-shadow 120ms ease,background 120ms ease;
    }
    input:focus,select:focus,textarea:focus{ border-color:var(--accent); box-shadow:var(--ring); }
    input[type="color"]{ width:100%; height:44px; padding:3px; border:1px solid var(--line); border-radius:10px; background:#fff; cursor:pointer; }
    input[type="range"]{ width:100%; padding:0; border:none; background:transparent; height:44px; }
    textarea{ resize:vertical; }
    .checks{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:6px; }
    .check{ display:flex; gap:10px; align-items:flex-start; padding:9px 10px; border:1px solid #e5e7eb; border-radius:12px; background:#fff; font-size:12.5px; cursor:pointer; }
    .check input{ margin-top:3px; accent-color:var(--accent); }
    .help{ color:var(--muted); font-size:11.5px; line-height:1.4; }
    .input-btn{ display:flex; gap:8px; }
    .input-btn input{ flex:1; }
    .logo-row{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
    .logo-thumb{ display:inline-flex; background:#fff; border:1px solid var(--line); border-radius:10px; padding:4px; }
    .logo-thumb img{ max-height:38px; max-width:120px; object-fit:contain; display:block; }
    .palette-row{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:4px; }
    .subtle-note{ font-size:12.5px; color:var(--muted); margin-top:2px; line-height:1.45; }
    .design-quick{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
    .inline-field{ display:flex; flex-direction:column; gap:7px; min-width:0; }
    .toggle-group{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
    .mini-card{ border:1px solid #e7ebf1; border-radius:16px; padding:14px; background:#fbfcfd; }
    .inner-card{ margin-top:14px; border:1px solid #e9edf3; border-radius:16px; background:#ffffff; overflow:hidden; }
    .inner-card summary{ padding:14px 16px; font-size:14px; font-weight:700; background:#fcfcfd; }
    .inner-card .card-body{ padding:14px 16px 16px; }
    .inner-grid{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
    .small-range-note{ margin-top:4px; }

    .pal{ width:34px; height:34px; border-radius:10px; border:1px solid var(--line); cursor:pointer; background:linear-gradient(135deg,var(--p1) 50%,var(--p2) 50%); }
    .pal:hover{ transform:scale(1.08); }

    .item-row{
      margin-bottom:8px; padding:11px; border:1px solid rgba(74,222,128,.34); border-radius:14px; background:#fff;
      box-shadow:0 1px 0 rgba(255,255,255,.86) inset,0 2px 8px rgba(15,23,42,.035);
      transition:border-color 150ms ease,box-shadow 150ms ease,background 150ms ease;
    }
    .item-head{
      display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px;
      border-bottom:1px solid rgba(74,222,128,.24); background:linear-gradient(180deg,#fcfffd 0%,#f8fcfa 100%);
    }
    .item-index{
      display:inline-flex; align-items:center; min-height:24px; padding:4px 8px;
      border:1px solid rgba(14,116,72,.16); border-radius:999px; background:#eafbf2; color:var(--nb-green-ink);
      font-size:9.5px; font-weight:820; letter-spacing:.07em; line-height:1;
      box-shadow:0 1px 0 rgba(255,255,255,.75) inset;
    }
    .item-actions{ display:flex; gap:5px; }
    .ibtn{ width:44px; height:44px; min-width:44px; min-height:44px; border-radius:9px; cursor:pointer; }
    .item-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:9px; }
    .item-grid .item-unit{ grid-column:span 2; }
    .g3{ grid-column:1/-1; }
    .line-total{ font-weight:800; text-align:right; padding-top:29px; font-variant-numeric:tabular-nums; }
    .item-image-ctl{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
    .item-image-ctl img{ width:34px; height:34px; object-fit:contain; border-radius:6px; border:1px solid var(--line); }
    #items-list.tax-off .field-tax{ display:none; }
    #items-list.disc-off .field-disc{ display:none; }

    .totals{ margin-top:12px; border-top:2px solid var(--line); padding-top:10px; }
    .totals-row{ display:flex; justify-content:space-between; gap:10px; padding:3px 0; font-size:13px; }
    .totals-row dt{ color:var(--muted); }
    .totals-row dd{ margin:0; font-weight:700; font-variant-numeric:tabular-nums; }
    .totals-row.grand{ border-top:1px solid var(--line); margin-top:6px; padding-top:8px; }
    .totals-row.grand dd{ color:var(--accent); font-size:16px; }
    .subhead{ grid-column:1/-1; margin:10px 0 0; color:#667085; font-size:10.5px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
    .extra-block:first-child{ border-top:0; padding-top:0; }
    .extra-fields{ margin-top:8px; }


    @media screen and (max-width:1020px){
      .workspace{ display:block; height:auto; }
      .workspace > .toolbar{ position:relative; }
      .editor,.preview{ overflow:visible; }
      .preview-scroll{ overflow-x:auto; padding:18px 10px; }
    }
    @media screen and (max-width:640px){
      .fields,.checks,.item-grid,.design-quick,.toggle-group,.inner-grid{ grid-template-columns:1fr; }
      .g3{ grid-column:auto; }
      .item-grid .item-unit{ grid-column:auto; }
    }


    /* v3 premium editor controls */
    .topbar-actions .secondary-action{ display:none; }
    .more-menu{ position:relative; }
    .more-menu > summary{ list-style:none; cursor:pointer; border:1px solid #dfe3ea; background:#fff; border-radius:12px; padding:9px 13px; font-weight:700; font-size:13px; }
    .more-menu > summary::-webkit-details-marker{ display:none; }
    .more-menu > summary::after{ content:"⌄"; margin-left:7px; color:var(--muted); }
    .more-menu[open] > summary{ border-color:#c7ced8; box-shadow:0 8px 22px rgba(16,24,40,.08); }
    .more-popover{ position:absolute; right:0; top:calc(100% + 8px); width:190px; padding:8px; background:#fff; border:1px solid #e2e7ee; border-radius:14px; box-shadow:0 18px 45px rgba(16,24,40,.14); display:grid; gap:5px; z-index:90; }
    .more-popover .btn{ width:100%; text-align:left; justify-content:flex-start; border:0; box-shadow:none; background:transparent; }
    .more-popover .btn:hover{ background:#f6f8fa; transform:none; }

    .design-stack{ display:grid; gap:18px; }
    .section-kicker{ display:flex; align-items:flex-end; justify-content:space-between; gap:14px; margin-bottom:9px; }
    .section-kicker strong{ color:#3a3a3c; font-size:12.5px; font-weight:700; letter-spacing:-.004em; }
    .section-kicker > span{ display:none; }

    .template-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
    .template-card{
      appearance:none;
      min-height:62px;
      min-width:0;
      display:flex;
      align-items:center;
      gap:9px;
      padding:8px 10px;
      border:1px solid var(--ui-border);
      border-radius:14px;
      background:#fff;
      text-align:left;
      cursor:pointer;
      transition:.16s ease;
    }
    .template-card:hover{ border-color:var(--ui-border-strong); background:#fbfbfc; transform:none; box-shadow:none; }
    .template-card.active{ border-color:var(--accent); background:#fff; box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 12%,transparent); }
    .template-thumb{ width:52px; height:44px; flex:0 0 52px; margin:0; border:1px solid #e7ebf0; border-radius:8px; background:#fff; overflow:hidden; position:relative; }
    .template-thumb .t-head{ display:block; width:26px; height:4px; margin:7px 7px 4px; border-radius:999px; background:var(--thumb-accent,#111827); opacity:.92; }
    .template-thumb .t-line{ display:block; height:2px; margin:3px 7px; border-radius:999px; background:#d9dce2; }
    .template-thumb .t-line.short{ width:45%; }
    .template-thumb .t-table{ display:block; height:13px; margin:5px 7px 0; border:1px solid #e4e9f0; border-radius:3px; background:repeating-linear-gradient(to bottom,#f1f2f5 0 3px,#fff 3px 6px); }
    .template-card[data-template="editorial"] .template-thumb{ font-family:Georgia,serif; }
    .template-card[data-template="studio"] .template-thumb{ --thumb-accent:#6d28d9; }
    .template-card[data-template="ledger"] .template-thumb{ --thumb-accent:#4ade80; }
    .template-card[data-template="modern"] .template-thumb{ --thumb-accent:#2563eb; }
    .template-card[data-template="classic"] .template-thumb{ --thumb-accent:#7c2d12; }
    .template-card[data-template="minimal"] .template-thumb{ --thumb-accent:#64748b; }
    .template-name{ display:flex; align-items:center; gap:4px; flex-wrap:wrap; font-size:12.5px; font-weight:800; line-height:1.2; }
    .template-desc{ display:block; margin-top:3px; font-size:11.5px; color:var(--muted); line-height:1.35; }
    .premium-badge{ display:inline-block; font-size:9px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; padding:3px 6px; background:#f4f0ff; color:#6d28d9; border-radius:999px; margin-left:5px; vertical-align:1px; }

    .font-featured{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
    .font-card{
      appearance:none;
      min-height:58px;
      display:flex;
      flex-direction:column;
      justify-content:center;
      gap:6px;
      padding:9px 11px;
      border:1px solid var(--ui-border);
      border-radius:13px;
      background:#fff;
      text-align:left;
      cursor:pointer;
      transition:.15s ease;
    }
    .font-card:hover{ border-color:var(--ui-border-strong); background:#fbfbfc; }
    .font-card.active{ border-color:var(--accent); box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 12%,transparent); }
    .font-sample{ display:block; margin:0; color:#111827; font-size:18px; line-height:1.15; }
    .font-meta{ display:block; font-size:11.5px; color:var(--muted); }
    .font-card[data-font="manrope"] .font-sample{ font-family:Manrope,sans-serif; }
    .font-card[data-font="inter"] .font-sample{ font-family:Inter,sans-serif; }
    .font-card[data-font="ibmplex"] .font-sample{ font-family:"IBM Plex Sans",sans-serif; }
    .font-card[data-font="sourceserif"] .font-sample{ font-family:"Source Serif 4",serif; }

    .theme-grid{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; }
    .theme-card{
      appearance:none;
      height:44px;
      display:flex;
      align-items:center;
      gap:6px;
      padding:5px 6px;
      border:1px solid var(--ui-border);
      border-radius:10px;
      background:#fff;
      text-align:left;
      cursor:pointer;
    }
    .theme-card:hover{ border-color:var(--ui-border-strong); background:#fbfbfc; }
    .theme-card.active{ border-color:var(--accent); box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 10%,transparent); }
    .theme-swatch{ width:18px; height:18px; flex:0 0 18px; margin:0; border-radius:50%; background:linear-gradient(135deg,var(--p1) 0 58%,var(--p2) 58%); box-shadow:inset 0 0 0 .5px rgba(0,0,0,.08); }
    .theme-card span{ display:block; font-size:9.5px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

    .switch-grid{ display:grid; grid-template-columns:1fr 1fr; gap:9px; }

    .advanced-card{ border-top:1px solid #edf0f4; padding-top:16px; }
    .advanced-card details{ border:0; background:transparent; }
    .advanced-card summary{ padding:0; font-size:13px; font-weight:750; background:transparent; border:0 !important; }
    .advanced-card details[open] summary{ margin-bottom:14px; }
    .advanced-grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }

    .design-essentials{
      padding:13px;
      border:1px solid #e7eaf0;
      border-radius:14px;
      background:#fbfbfc;
    }
    .design-essentials .section-kicker{ margin-bottom:10px; }
    .design-essential-grid{ grid-template-columns:1fr 1fr; gap:10px; }
    .settings-card > summary{
      background:linear-gradient(145deg,rgba(255,255,255,.93),rgba(248,250,252,.86));
    }
    .settings-intro{
      display:grid;
      gap:3px;
      margin-bottom:12px;
      padding:11px 12px;
      border:1px solid #e4e7ec;
      border-radius:12px;
      background:#f8fafc;
    }
    .settings-intro strong{
      color:#344054;
      font-size:12px;
      font-weight:780;
    }
    .settings-intro span{
      color:#667085;
      font-size:10.5px;
      line-height:1.4;
    }
    .settings-help{
      margin:0;
      padding:9px 10px;
      border-radius:10px;
      background:#f5f5f7;
      color:#71717a;
      font-size:10.5px;
      line-height:1.45;
    }

    .visually-hidden{ position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }

    @media screen and (max-width:700px){
      .topbar-actions{ width:100%; margin-left:0; }
      .topbar-actions .btn.primary,.topbar-actions .btn.accent{ flex:1; }
      .switch-grid,.design-essential-grid{ grid-template-columns:1fr; }
      .section-kicker{ align-items:flex-start; flex-direction:column; gap:2px; }
    }

    /* v4 sidebar polish */
    select{
      appearance:none; -webkit-appearance:none; padding-right:38px; cursor:pointer;
      background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3.5 5.25 7 8.75l3.5-3.5' stroke='%23636B75' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")!important;
      background-repeat:no-repeat!important;
      background-position:right 14px center!important;
      background-size:14px 14px!important;
    }
    select:hover,input:hover,textarea:hover{ border-color:#c9d0da; }
    select:focus,input:focus,textarea:focus{ background-color:#fff; }
    option,optgroup{ font-family:Manrope,Inter,Arial,sans-serif; }
    optgroup{ font-weight:700; color:#475467; }
    .template-thumb{ height:76px; margin-bottom:8px; border-radius:8px; }
    .template-thumb .t-head{ margin:8px 8px 4px; height:15px; }
    .template-thumb .t-line{ margin:4px 8px; }
    .template-thumb .t-table{ margin:7px 8px 0; height:24px; }
    .template-desc{ display:none!important; }
    .premium-badge,.choice-tag{ display:inline-flex; align-items:center; padding:3px 6px; border-radius:999px; font-size:9px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
    .premium-badge{ margin-left:0; background:#f4f0ff; color:#6d28d9; }
    .choice-tag{ background:#f2f4f7; color:#667085; }
    .font-meta{ margin-top:0; display:flex; gap:5px; align-items:center; font-size:0; }
    .font-meta .choice-tag{ font-size:9px; }
    .switch-grid{ gap:7px; }
    .advanced-card{ padding-top:14px; }
    .advanced-card summary{ font-size:12.5px!important; color:#475467; }
    .advanced-grid{ gap:10px; }
    .logo-row{ padding:10px; border:1px dashed #d7dde6; border-radius:12px; margin-bottom:14px; background:#fbfcfd; }
    .logo-row .help{ display:none; }
    .input-btn .btn{ width:42px; padding:0; display:grid; place-items:center; }
    /* ══════════ v5 — Apple-inspired clarity & workflow polish ══════════ */
    .template-card:active,.font-card:active,.theme-card:active,.segment-control button:active{ transform:scale(.98); }

    .summary-action{ color:var(--ui-tertiary); font-size:11px; font-weight:650; min-width:28px; text-align:right; }
    .summary-action::before{ content:"Show"; }
    details.card[open] > summary .summary-action::before{ content:"Hide"; }

    .premium-badge{ font-size:8.5px; padding:2px 5px; }

    .font-card .choice-tag{ align-self:flex-start; }
    .select-row{ margin-top:9px; }


    select{ background-repeat:no-repeat!important; background-position:right 14px center!important; background-size:14px 14px!important; }
    .section-tabs{ margin-bottom:16px; }
    .tab-panel[hidden]{ display:none!important; }

    .sub-disclosure{ margin-top:14px; border:1px solid var(--ui-border); border-radius:13px; background:#fbfbfc; overflow:hidden; }
    .sub-disclosure > summary{ min-height:46px; list-style:none; cursor:pointer; padding:11px 12px; display:flex; align-items:center; font-size:12.5px; font-weight:700; color:#3a3a3c; }
    .sub-disclosure > summary::-webkit-details-marker{ display:none; }
    .sub-summary-action{ margin-left:auto; color:var(--ui-tertiary); font-size:11px; }
    .sub-summary-action::before{ content:"Show"; }
    .sub-disclosure[open] .sub-summary-action::before{ content:"Hide"; }
    .sub-disclosure > summary::after{ content:"⌄"; width:24px; height:24px; margin-left:8px; border-radius:50%; display:grid; place-items:center; background:#ededf2; color:#636366; transition:transform 160ms ease-out; }
    .sub-disclosure[open] > summary::after{ transform:rotate(180deg); }
    .sub-body{ border-top:1px solid var(--ui-border); padding:14px; }

    .line-control{ grid-template-columns:repeat(5,1fr); }
    .line-control button{ min-width:0; padding:0 4px; font-size:11px; }

    .logo-upload-target:hover{ background:rgba(0,122,255,.06); border-color:rgba(0,122,255,.55); }
    .logo-preview{ min-width:68px; display:grid; place-items:center; padding:7px; border-color:var(--ui-border); border-radius:12px; }
    .logo-preview img{ max-height:46px; max-width:76px; }
    .icon-text-btn{ border:1px solid var(--ui-border); border-radius:11px; background:#fff; padding:0 10px; font:inherit; font-size:11px; font-weight:650; cursor:pointer; }
    .icon-text-btn.danger{ color:#d70015; }
    .compact-switch{ margin-bottom:13px; }
    .section-fields{ margin-top:0; }


    .action-row{ display:flex; justify-content:flex-end; }
    .quiet-btn{ background:var(--ui-fill); border:0; color:#3a3a3c; }
    .icon-only{ width:44px; min-width:44px; padding:0; }

    .item-options{ display:flex; align-items:center; gap:7px; flex-wrap:wrap; margin-bottom:12px; }
    .item-options-label{ font-size:11.5px; font-weight:700; color:#515154; margin-right:2px; }
    .mini-toggle{ position:relative; cursor:pointer; }
    .mini-toggle input{ position:absolute; opacity:0; pointer-events:none; }
    .mini-toggle span{ display:inline-flex; min-height:32px; align-items:center; padding:0 10px; border-radius:999px; border:1px solid var(--ui-border); background:#fff; color:var(--ui-secondary); font-size:11.5px; font-weight:650; }
    .mini-toggle input:checked + span{ border-color:color-mix(in srgb,var(--accent) 45%,transparent); color:var(--accent); background:color-mix(in srgb,var(--accent) 7%,white); }
    .mini-toggle input:disabled + span{ opacity:.45; }

    .extras-grid{ display:grid; gap:9px; }
    .extra-block{ border:0; padding:0; }
    .extra-block .switch-row{ margin:0; }
    .extra-fields{ padding:10px 2px 2px; }
    .legal-note{ margin:10px 0 0; color:var(--ui-secondary); font-size:10.5px; line-height:1.4; }

    /* Invoice table column alignment and working divider styles. */
    .inv-table{ table-layout:fixed; }
    .inv-table th,.inv-table td{ box-sizing:border-box; }
    .inv-table .c-index{ text-align:center; padding-left:3px; padding-right:3px; }
    .inv-table .c-unit{ text-align:left; }
    .inv-table .c-qty,.inv-table .c-price,.inv-table .c-discount,.inv-table .c-tax,.inv-table .c-amount{ text-align:right; font-variant-numeric:tabular-nums; }
    .inv-table th.c-qty,.inv-table th.c-price,.inv-table th.c-discount,.inv-table th.c-tax,.inv-table th.c-amount{ white-space:normal; line-height:1.18; }
    .inv-table td.c-price,.inv-table td.c-discount,.inv-table td.c-tax,.inv-table td.c-amount{ white-space:nowrap; font-size:.92em; }
    .inv-table td.c-price{ white-space:normal; overflow-wrap:anywhere; }
    .sheet.line-solid .inv-head,.sheet.line-solid .inv-table th,.sheet.line-solid .inv-table td{ border-bottom-style:solid!important; }
    .sheet.line-dashed .inv-head,.sheet.line-dashed .inv-table th,.sheet.line-dashed .inv-table td{ border-bottom-style:dashed!important; }
    .sheet.line-dotted .inv-head,.sheet.line-dotted .inv-table th,.sheet.line-dotted .inv-table td{ border-bottom-style:dotted!important; }
    .sheet.line-double .inv-head,.sheet.line-double .inv-table th,.sheet.line-double .inv-table td{ border-bottom-style:double!important; border-bottom-width:3px!important; }
    .sheet.line-none .inv-head,.sheet.line-none .inv-table th,.sheet.line-none .inv-table td{ border-bottom-color:transparent!important; }
    .sheet.line-dashed.row-boxed .inv-table td,.sheet.line-dashed.th-boxed .inv-table th{ border-style:dashed!important; }
    .sheet.line-dotted.row-boxed .inv-table td,.sheet.line-dotted.th-boxed .inv-table th{ border-style:dotted!important; }
    .sheet.line-double.row-boxed .inv-table td,.sheet.line-double.th-boxed .inv-table th{ border-style:double!important; border-width:3px!important; }
    .sheet.line-none.row-boxed .inv-table td,.sheet.line-none.th-boxed .inv-table th{ border-color:transparent!important; }

    button:focus-visible,summary:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,label.logo-upload-target:focus-within{
      outline:2px solid color-mix(in srgb,var(--ui-blue) 78%,white); outline-offset:2px; box-shadow:none;
    }
    @media (prefers-reduced-motion:reduce){ *,*::before,*::after{ scroll-behavior:auto!important; transition-duration:.01ms!important; animation-duration:.01ms!important; animation-iteration-count:1!important; } }
    @media screen and (max-width:700px){
      .logo-uploader{ --nb-doc-logo-columns:1fr auto; }
      .logo-upload-target{ grid-column:1/-1; }
      .line-control{ flex-wrap:wrap; }
      .line-control button{ flex:1 1 30%; }
    }
    @media screen and (max-width:390px){
      .summary-tag{ display:none; }
      .template-name{ font-size:11.5px; }
    }


    /* v6 — colorful section identity + safer direct manipulation */
    details.card{ --section-accent:#5856d6; --section-soft:#f1f0ff; }
    details.card[data-tone="violet"]{ --section-accent:#6e5ae6; --section-soft:#f1efff; }
    details.card[data-tone="blue"]{ --section-accent:#0878d1; --section-soft:#eaf5ff; }
    details.card[data-tone="orange"]{ --section-accent:#c65d08; --section-soft:#fff1e6; }
    details.card[data-tone="green"]{ --section-accent:#0a7d55; --section-soft:#e9f8f1; }
    details.card[data-tone="pink"]{ --section-accent:#b63c72; --section-soft:#fff0f6; }
    details.card[data-tone="slate"]{ --section-accent:#475569; --section-soft:#f1f5f9; }
    .summary-action{ min-width:auto; padding:5px 8px; border-radius:999px; color:var(--section-accent); background:var(--section-soft); border:1px solid color-mix(in srgb,var(--section-accent) 10%,transparent); }
    details.card > summary:hover .summary-action{ background:color-mix(in srgb,var(--section-accent) 12%,white); }

    .column-toggle{ min-width:44px; min-height:44px; padding:0 11px; border-radius:999px; font:inherit; font-size:11.5px; font-weight:700; cursor:pointer; transition:background 120ms ease-out,color 120ms ease-out,border-color 120ms ease-out,transform 90ms ease-out; }
    .column-toggle:active{ transform:scale(.97); }
    .column-toggle:disabled{ opacity:.42; cursor:not-allowed; }

    .sheet.edit-mode [data-edit-target], .sheet.edit-mode [data-edit-group], .sheet.edit-mode [data-edit-item]{ cursor:pointer; border-radius:5px; outline:1px dashed transparent; outline-offset:3px; transition:outline-color 100ms ease-out,background 100ms ease-out; }
    .sheet.edit-mode [data-edit-target]:hover, .sheet.edit-mode [data-edit-group]:hover, .sheet.edit-mode [data-edit-item]:hover{ outline:2px solid color-mix(in srgb,var(--accent) 70%,white); outline-offset:3px; background:color-mix(in srgb,var(--accent) 5%,white); }
    .sheet.edit-mode [data-edit-target]::selection{ background:color-mix(in srgb,var(--accent) 22%,white); }
    .preview-add-item{ display:none; width:100%; min-height:max(44px,var(--invoice-canvas-target-size,44px)); margin:10px 0 2px; border-radius:10px; font:inherit; font-size:.84em; font-weight:750; cursor:pointer; }
    .sheet.edit-mode .preview-add-item{ display:block; }
    .focus-flash{ animation:focusFlash .75s ease-out; }
    @keyframes focusFlash{ 0%{ box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 20%,transparent); } 100%{ box-shadow:0 0 0 0 transparent; } }
    @media (prefers-reduced-motion:reduce){ .focus-flash{ animation:none; } }

    /* Quantities and monetary values must remain readable for large values. */
    .inv-table td.c-qty{ white-space:nowrap; font-size:.92em; }
    .inv-table th.c-qty{ white-space:nowrap; }
    .inv-table td.c-unit{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .inv-totals dd{ font-variant-numeric:tabular-nums; white-space:nowrap; }

    .item-options-label{ letter-spacing:-.004em; }

    .template-grid-v8{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
    .template-card-v8{ min-height:92px; padding:9px 10px; }
    .template-card-v8 .template-thumb{
      position:relative; display:block; width:100%; height:56px; margin:0 0 7px; border:1px solid #e3e7ee;
      border-radius:9px; background:#fff; overflow:hidden;
    }
    .template-card-v8 .template-thumb i{ position:absolute; display:block; border-radius:2px; }
    .template-card-v8 .mini-logo{ left:8px; top:8px; width:22px; height:6px; background:#cbd5e1; }
    .template-card-v8 .mini-title{ right:8px; top:7px; width:29px; height:8px; background:var(--accent); }
    .template-card-v8 .mini-meta{ right:8px; top:19px; width:36px; height:3px; background:#d9dee7; }
    .template-card-v8 .mini-table{ left:8px; right:8px; top:30px; height:12px; border-top:4px solid #dfe5ec; border-bottom:1px solid #e9edf2; }
    .template-card-v8 .mini-total{ right:8px; bottom:6px; width:29px; height:4px; background:#cbd5e1; }
    .thumb-minimal .mini-title{ background:#111827; width:22px; height:4px; top:10px; }
    .thumb-minimal .mini-table{ border-top-width:1px; background:transparent; }
    .thumb-minimal .mini-logo{ background:#e5e7eb; }
    .thumb-executive .mini-title{ background:#1f2937; height:6px; }
    .thumb-executive::before{ content:""; position:absolute; inset:0 auto 0 0; width:4px; background:var(--accent); }
    .thumb-executive .mini-table{ border-top-color:#cfd5df; }
    .thumb-studio{ background:linear-gradient(90deg,color-mix(in srgb,var(--accent) 8%,white),#fff 58%); }
    .thumb-studio .mini-title{ width:37px; height:13px; border-radius:5px; }
    .template-card.active .template-thumb{ box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 22%,transparent); border-color:color-mix(in srgb,var(--accent) 42%,#dfe3ea); }

    .theme-grid-v8{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
    .theme-chip{ min-height:44px; display:flex; align-items:center; gap:7px; padding:6px 8px; border-radius:10px; }
    .theme-chip .theme-dot{ width:14px; height:14px; border-radius:50%; background:var(--dot); margin:0; flex:0 0 auto; box-shadow:inset 0 0 0 1px rgba(0,0,0,.06); }
    .theme-chip span:last-child{ font-size:10.5px; font-weight:700; }
    .theme-chip.active{ border-color:color-mix(in srgb,var(--accent) 38%,#dfe3ea); background:color-mix(in srgb,var(--accent) 4%,white); }

    .color-settings{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
    .color-setting{ min-height:52px; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; padding:8px 9px; border:1px solid var(--ui-border); border-radius:11px; background:#fff; }
    .color-setting > span{ font-size:10.5px; line-height:1.2; font-weight:680; color:#515154; }
    .color-setting input[type="color"]{ width:44px; height:44px; padding:2px; border-radius:8px; flex:0 0 44px; }

    .compact-choice-grid{ margin-bottom:8px; }
    .micro-disclosure{ margin-top:8px; border-top:1px solid var(--ui-border); }
    .micro-disclosure > summary{ list-style:none; min-height:42px; display:flex; align-items:center; cursor:pointer; font-size:12px; font-weight:700; color:#515154; }
    .micro-disclosure > summary::-webkit-details-marker{ display:none; }
    .micro-disclosure > summary::after{ content:"＋"; margin-left:auto; color:var(--nb-document-muted); font-size:14px; }
    .micro-disclosure[open] > summary::after{ content:"−"; }
    .auto-column-note{ margin-left:auto; color:var(--nb-document-muted); font-size:10.5px; line-height:1.25; text-align:right; max-width:210px; }

    /* Cleaner invoice typography and table */
    .sheet{
      font-size:var(--inv-size,12.5px); letter-spacing:-.003em;
      font-variant-numeric:tabular-nums lining-nums;
    }
    .inv-head{ margin-bottom:26px; }
    .inv-title{ letter-spacing:-.045em; }
    .inv-label,.inv-meta dt{ font-size:.69em; letter-spacing:.10em; }
    .inv-table{ font-size:.92em; }
    .inv-table th{ padding:9px 7px; font-size:.69em; letter-spacing:.085em; font-weight:780; }
    .inv-table td{ padding:11px 7px; line-height:1.38; }
    .inv-table th.c-desc,.inv-table td.c-desc{ padding-left:4px; }
    .inv-table th.c-qty,.inv-table th.c-price,.inv-table th.c-discount,.inv-table th.c-tax,.inv-table th.c-amount{ text-align:right; }
    .inv-table td.c-discount,.inv-table td.c-tax{ color:var(--nb-document-muted); }
    .inv-table td.c-amount{ font-weight:720; }
    .inv-totals{ min-width:310px; }
    .inv-totals > div{ padding:5px 0; }
    .inv-totals dt{ color:var(--nb-document-muted); }
    .t-total{ margin-top:8px; padding-top:10px!important; }
    .t-total dt,.t-total dd{ font-weight:800; color:#111827; }

    /* Four intentionally distinct, restrained templates */
    .tpl-professional .inv-head{ border-bottom:2px solid var(--iacc); padding-bottom:18px; }
    .tpl-professional .inv-title{ font-size:2.35em; font-weight:820; color:#111827; }
    .tpl-professional .inv-bizname{ font-size:1.42em; }
    .tpl-professional .inv-table th{ background:color-mix(in srgb,var(--iacc) 7%,white); color:#30343b; border-bottom:1px solid color-mix(in srgb,var(--iacc) 28%,#d9dee7); opacity:1; }
    .tpl-professional .inv-table td{ border-bottom:1px solid #e7e9ed; }
    .tpl-professional .t-total{ border-top:2px solid var(--iacc); }
    .tpl-professional .t-total dd{ color:var(--iacc); }

    .tpl-minimal .inv-head{ border-bottom:0; padding-bottom:6px; margin-bottom:34px; }
    .tpl-minimal .inv-title{ font-size:1.9em; font-weight:680; letter-spacing:-.035em; text-transform:none; color:#111827; }
    .tpl-minimal .inv-bizname{ font-size:1.3em; font-weight:720; }
    .tpl-minimal .inv-table th{ background:transparent!important; border-bottom:1px solid #cfd3d8; color:#555b65; opacity:1; }
    .tpl-minimal .inv-table td{ border-bottom:1px solid #eceef1; }
    .tpl-minimal .t-total{ border-top:1px solid #111827; }
    .tpl-minimal .pill{ background:#f5f5f5; color:#555; }

    .tpl-executive .inv-head{ border-bottom:1px solid #b9bec6; padding-bottom:20px; }
    .tpl-executive .inv-title,.tpl-executive .inv-bizname{ font-family:"Source Serif 4",Georgia,serif; }
    .tpl-executive .inv-title{ font-size:2.55em; font-weight:560; color:#171717; letter-spacing:-.03em; }
    .tpl-executive .inv-bizname{ font-size:1.5em; font-weight:600; }
    .tpl-executive .inv-table th{ background:#232830!important; color:#fff!important; opacity:1!important; border:0!important; }
    .tpl-executive .inv-table td{ border-bottom:1px solid #dfe2e6; }
    .tpl-executive .t-total{ border-top:3px double #3f454e; }
    .tpl-executive .t-total dd{ font-family:"Source Serif 4",Georgia,serif; font-size:1.24em; }

    .tpl-studio .inv-head{ border:0; margin:-12px -14px 28px; padding:20px 20px 22px; border-radius:12px; background:color-mix(in srgb,var(--iacc) 9%,white); }
    .tpl-studio .inv-title{ color:var(--iacc); font-size:2.45em; font-weight:850; }
    .tpl-studio .inv-bizname{ font-size:1.46em; }
    .tpl-studio .inv-table{ border-collapse:separate; border-spacing:0; border:1px solid #e3e6ea; border-radius:9px; overflow:hidden; }
    .tpl-studio .inv-table th{ background:var(--iacc)!important; color:#fff!important; opacity:1!important; border:0!important; }
    .tpl-studio .inv-table td{ border-bottom:1px solid #eceef1; }
    .tpl-studio .inv-table tbody tr:last-child td{ border-bottom:0; }
    .tpl-studio .t-total{ border-top:0; background:color-mix(in srgb,var(--iacc) 7%,white); border-radius:8px; padding:9px 10px!important; }
    .tpl-studio .t-total dd{ color:var(--iacc); }

    @media screen and (max-width:700px){
      .template-grid-v8{ grid-template-columns:repeat(2,minmax(0,1fr)); }
      .theme-grid-v8{ grid-template-columns:repeat(3,minmax(0,1fr)); }
      .color-settings{ grid-template-columns:1fr; }
      .auto-column-note{ display:none; }
    }


    /* ══════════ v9 — distinct invoice headers + linked editing ══════════ */
.color-inline{ display:flex; align-items:center; gap:9px; min-height:46px; padding:7px 9px; border:1px solid var(--ui-border); border-radius:12px; background:#fff; }
    .color-inline input[type="color"]{ width:44px; height:44px; flex:0 0 44px; padding:2px; border-radius:8px; }
    .color-inline em{ font-style:normal; font-size:10.5px; line-height:1.25; color:var(--nb-document-muted); }
    details.card.edit-linked-card{ border-color:color-mix(in srgb,var(--section-accent) 48%,#dfe3e8); box-shadow:0 0 0 3px color-mix(in srgb,var(--section-accent) 10%,transparent),0 10px 26px rgba(16,24,40,.07); }
    details.card.edit-linked-card > summary{ background:color-mix(in srgb,var(--section-soft) 74%,white); }
    details.card.edit-linked-card .summary-tag{ box-shadow:0 0 0 3px color-mix(in srgb,var(--section-accent) 10%,transparent); }
    .inv-meta{ margin-top:14px; gap:10px 16px; }
    .inv-meta .meta-item{ min-width:0; }
    .inv-meta .meta-item dt{ margin-bottom:3px; }
    .inv-meta .meta-item dd{ line-height:1.3; overflow-wrap:anywhere; }
    .inv-brand,.inv-titleblock{ min-width:0; }

    /* Professional: split business + invoice details. */
    .tpl-professional .inv-head{ display:grid!important; grid-template-columns:minmax(0,1fr) minmax(285px,.9fr)!important; gap:34px!important; align-items:start!important; padding-bottom:20px!important; border-bottom:2px solid var(--iacc)!important; }
    .tpl-professional .inv-titleblock{ text-align:right!important; min-width:0!important; }
    .tpl-professional .inv-meta{ display:grid!important; grid-template-columns:repeat(2,minmax(0,1fr))!important; justify-content:stretch!important; }
    .tpl-professional .inv-meta > div{ min-width:0!important; }
    .tpl-professional .inv-meta{ text-align:left; }
    .tpl-professional .meta-wide-last{ grid-column:auto; }
    .tpl-professional .meta-number,
    .tpl-professional .meta-period{ grid-column:1/-1; }
    .tpl-professional .inv-table th{ background:color-mix(in srgb,var(--th-bg) 55%,white)!important; color:#30343b!important; border-bottom:1px solid color-mix(in srgb,var(--th-bg) 52%,#d9dee7)!important; }
    .tpl-professional.th-filled .inv-table th{ background:var(--th-bg)!important; color:var(--th-color)!important; border-bottom:0!important; }
    .tpl-professional.th-minimal .inv-table th{ background:transparent!important; color:#555b65!important; border-bottom:1px solid #d7dbe0!important; }

    /* Minimal: business first, then horizontal invoice strip. */
    .tpl-minimal .inv-head{ display:grid!important; grid-template-columns:1fr!important; gap:24px!important; border-bottom:0!important; padding-bottom:10px!important; margin-bottom:30px!important; }
    .tpl-minimal .inv-brand{ display:flex!important; align-items:flex-start!important; justify-content:space-between!important; gap:24px!important; }
    .tpl-minimal .inv-titleblock{ display:grid!important; grid-template-columns:minmax(160px,.55fr) minmax(0,1.45fr)!important; column-gap:34px!important; align-items:start!important; text-align:left!important; min-width:0!important; padding-top:18px!important; border-top:1px solid #d9dde2!important; }
    .tpl-minimal .inv-title{ margin:0!important; }
    .tpl-minimal .pill{ justify-self:start!important; margin-top:8px!important; grid-column:1!important; }
    .tpl-minimal .inv-meta{ grid-column:2!important; grid-row:1 / span 3!important; display:grid!important; grid-template-columns:repeat(3,minmax(0,1fr))!important; gap:12px 18px!important; margin:0!important; text-align:left!important; }
    .tpl-minimal .meta-period{ grid-column:span 2; }
    .tpl-minimal .inv-table th{ background:transparent!important; color:#555b65!important; border-bottom:1px solid #cfd3d8!important; }
    .tpl-minimal.th-filled .inv-table th{ background:var(--th-bg)!important; color:var(--th-color)!important; border-bottom:0!important; }
    .tpl-minimal.th-underline .inv-table th{ background:color-mix(in srgb,var(--th-bg) 42%,white)!important; color:#3f4650!important; border-bottom:1px solid #d6dbe1!important; }

    /* Executive: centered title, compact metadata matrix, sender below. */
    .tpl-executive .inv-head{ display:grid!important; grid-template-columns:1fr!important; gap:0!important; padding-bottom:22px!important; border-bottom:1px solid #b9bec6!important; }
    .tpl-executive .inv-titleblock{ order:-1!important; text-align:center!important; width:100%!important; min-width:0!important; }
    .tpl-executive .inv-title{ margin-bottom:6px!important; }
    .tpl-executive .pill{ margin-top:0!important; }
    .tpl-executive .inv-meta{ display:grid!important; grid-template-columns:repeat(3,minmax(0,1fr))!important; gap:13px 18px!important; max-width:610px!important; margin:20px auto 0!important; text-align:center!important; }
    .tpl-executive .inv-meta > div{ min-width:0!important; }
    .tpl-executive .meta-period{ grid-column:auto!important; }
    .tpl-executive .inv-brand{ margin-top:24px!important; padding-top:18px!important; border-top:1px solid #e0e3e7!important; display:flex!important; align-items:flex-end!important; justify-content:space-between!important; gap:24px!important; }
    .tpl-executive .inv-biz{ max-width:62%; }
    .tpl-executive .inv-table th{ background:var(--th-bg)!important; color:var(--th-color)!important; }
    .tpl-executive.th-underline .inv-table th{ background:color-mix(in srgb,var(--th-bg) 20%,white)!important; color:#34383f!important; border-bottom:1px solid color-mix(in srgb,var(--th-bg) 36%,#d8dde3)!important; }
    .tpl-executive.th-minimal .inv-table th{ background:transparent!important; color:#555b65!important; border-bottom:1px solid #d7dbe0!important; }

    /* Studio: branded two-panel masthead. */
    .tpl-studio .inv-head{ display:grid!important; grid-template-columns:minmax(0,1fr) minmax(300px,.95fr)!important; gap:0!important; margin:-12px -14px 28px!important; padding:0!important; border:1px solid color-mix(in srgb,var(--iacc) 17%,#e3e6ea)!important; border-radius:14px!important; overflow:hidden!important; background:#fff!important; }
    .tpl-studio .inv-brand{ padding:24px 22px!important; background:color-mix(in srgb,var(--iacc) 8%,white)!important; }
    .tpl-studio .inv-titleblock{ padding:22px!important; text-align:left!important; color:#fff!important; background:var(--iacc)!important; min-width:0!important; }
    .tpl-studio .inv-title{ color:#fff!important; }
    .tpl-studio .pill{ background:rgba(255,255,255,.16)!important; color:#fff!important; }
    .tpl-studio .inv-meta{ display:grid!important; grid-template-columns:repeat(2,minmax(0,1fr))!important; gap:10px 14px!important; color:#fff!important; }
    .tpl-studio .inv-meta dt{ color:rgba(255,255,255,.72)!important; opacity:1!important; }
    .tpl-studio .inv-meta dd{ color:#fff!important; }
    .tpl-studio .meta-period,
    .tpl-studio .meta-wide-last{ grid-column:1/-1; }
    .tpl-studio .inv-table th{ background:var(--th-bg)!important; color:var(--th-color)!important; }
    .tpl-studio.th-underline .inv-table th{ background:color-mix(in srgb,var(--th-bg) 44%,white)!important; color:#31363c!important; border-bottom:1px solid color-mix(in srgb,var(--th-bg) 40%,#d6dbe0)!important; }
    .tpl-studio.th-minimal .inv-table th{ background:transparent!important; color:#555b65!important; border-bottom:1px solid #d7dbe0!important; }

    /* Template cards mirror the actual header compositions. */
    .template-card-v8[data-template="professional"] .template-thumb .mini-logo{ left:8px; top:8px; width:21px; }
    .template-card-v8[data-template="professional"] .template-thumb .mini-title{ right:8px; top:8px; width:25px; height:7px; }
    .template-card-v8[data-template="professional"] .template-thumb .mini-meta{ right:8px; top:19px; width:29px; }
    .template-card-v8[data-template="minimal"] .template-thumb .mini-logo{ left:8px; top:7px; width:18px; height:4px; }
    .template-card-v8[data-template="minimal"] .template-thumb .mini-title{ left:8px; right:auto; top:22px; width:18px; height:4px; background:#111827; }
    .template-card-v8[data-template="minimal"] .template-thumb .mini-meta{ left:32px; right:8px; top:22px; width:auto; height:3px; }
    .template-card-v8[data-template="minimal"] .template-thumb .mini-table{ top:35px; border-top-width:1px; }
    .template-card-v8[data-template="executive"] .template-thumb .mini-title{ left:50%; right:auto; transform:translateX(-50%); top:6px; width:30px; height:6px; background:#232830; }
    .template-card-v8[data-template="executive"] .template-thumb .mini-meta{ left:9px; right:9px; top:18px; width:auto; height:7px; background:repeating-linear-gradient(90deg,#cfd5df 0 15px,transparent 15px 18px); }
    .template-card-v8[data-template="executive"] .template-thumb .mini-logo{ left:8px; top:29px; width:18px; height:4px; }
    .template-card-v8[data-template="executive"] .template-thumb .mini-table{ top:38px; }
    .template-card-v8[data-template="studio"] .template-thumb::before{ content:""; position:absolute; inset:0 0 0 50%; background:var(--accent); opacity:.92; }
    .template-card-v8[data-template="studio"] .template-thumb .mini-logo{ z-index:1; left:8px; top:9px; background:#bfc7d1; }
    .template-card-v8[data-template="studio"] .template-thumb .mini-title{ z-index:1; right:8px; top:8px; width:26px; background:#fff; }
    .template-card-v8[data-template="studio"] .template-thumb .mini-meta{ z-index:1; right:8px; top:20px; width:25px; background:rgba(255,255,255,.65); }
    .template-card-v8[data-template="studio"] .template-thumb .mini-table{ z-index:1; top:34px; }

    @media screen and (max-width:760px){
      .tpl-professional .inv-head,.tpl-studio .inv-head{ grid-template-columns:1fr!important; }
      .tpl-professional .inv-titleblock,.tpl-studio .inv-titleblock{ text-align:left!important; }
      .tpl-professional .inv-meta,.tpl-studio .inv-meta{ grid-template-columns:repeat(2,minmax(0,1fr))!important; }
      .tpl-minimal .inv-titleblock{ grid-template-columns:1fr!important; gap:14px!important; }
      .tpl-minimal .inv-meta{ grid-column:1!important; grid-row:auto!important; grid-template-columns:repeat(2,minmax(0,1fr))!important; }
      .tpl-executive .inv-meta{ grid-template-columns:repeat(2,minmax(0,1fr))!important; }
    }

    @media screen and (max-width:390px){ .summary-tag{ display:inline-flex!important; } }


    /* ══════════ v10 — classic-left / Google-inspired reference template ══════════ */
    .template-grid-v10{ grid-template-columns:repeat(2,minmax(0,1fr)); }
    .thumb-classicleft{ background:#fff; position:relative; }
    .thumb-classicleft .mini-side{ position:absolute; left:0; top:0; bottom:0; width:38%; background:#fafafa; border-right:1px solid #e5e7eb; }
    .thumb-classicleft .mini-band{ position:absolute; right:8px; top:8px; width:34px; height:5px; background:#3b82f6; border-radius:3px; }
    .thumb-classicleft .mini-lines{ position:absolute; left:8px; top:10px; width:24px; height:30px; background:
      linear-gradient(#d1d5db,#d1d5db) 0 0/24px 1px no-repeat,
      radial-gradient(circle,#c5c9d1 45%,transparent 46%) 0 8px/5px 4px repeat-x,
      radial-gradient(circle,#c5c9d1 45%,transparent 46%) 0 18px/5px 4px repeat-x,
      radial-gradient(circle,#c5c9d1 45%,transparent 46%) 0 28px/5px 4px repeat-x; }
    .thumb-classicleft .mini-total{ position:absolute; right:8px; bottom:8px; width:46px; height:16px; border-top:1px solid #d1d5db; background:linear-gradient(180deg,transparent 0 50%, #e5e7eb 50% 56%, transparent 56%); }

    .tpl-classicleft{ --side-width:248px; --panel-line:#e3e5e8; }
    .tpl-classicleft .inv-head{
      display:grid!important; grid-template-columns:minmax(0,var(--side-width)) minmax(0,1fr)!important; gap:26px!important;
      align-items:start!important; border-bottom:0!important; padding-bottom:10px!important; margin-bottom:16px!important;
    }
    .tpl-classicleft .inv-brand{ display:block!important; padding-right:22px!important; border-right:1px solid var(--panel-line)!important; }
    .tpl-classicleft .inv-bizname{ font-size:1.35em; font-weight:750; margin-bottom:10px; color:#111827; }
    .tpl-classicleft .inv-line{ color:#3f3f46; line-height:1.45; }
    .tpl-classicleft .inv-titleblock{ text-align:left!important; min-width:0!important; padding-top:2px!important; }
    .tpl-classicleft .inv-title{ margin:0 0 12px!important; font-size:2.35em!important; font-weight:770!important; letter-spacing:-.04em!important; color:#151515!important; }
    .tpl-classicleft .pill{ margin:0 0 10px auto!important; display:inline-flex!important; background:#f8ead6!important; color:#a15c00!important; }
    .tpl-classicleft .inv-meta{ display:grid!important; grid-template-columns:repeat(3,minmax(0,1fr))!important; gap:14px 24px!important; margin-top:8px!important; }
    .tpl-classicleft .inv-meta .meta-item{ padding-bottom:6px; border-bottom:1px solid #f0f1f3; }
    .tpl-classicleft .inv-meta .meta-item dt{ font-size:.68em!important; letter-spacing:.12em!important; color:var(--nb-document-muted)!important; opacity:1; }
    .tpl-classicleft .inv-meta .meta-item dd{ font-size:1.03em!important; font-weight:700!important; color:#111827!important; }
    .tpl-classicleft .meta-period{ grid-column:span 2; }
    .tpl-classicleft .inv-parties{
      display:grid!important; grid-template-columns:minmax(0,var(--side-width)) minmax(0,1fr)!important; gap:26px!important; margin-bottom:18px!important; align-items:start!important;
    }
    .tpl-classicleft .bill-card{ padding-right:22px!important; border-right:1px solid var(--panel-line)!important; }
    .tpl-classicleft .bill-card .inv-label:first-child{ margin-top:0!important; font-size:.76em!important; letter-spacing:.14em!important; color:var(--nb-document-muted)!important; opacity:1; }
    .tpl-classicleft .bill-name{ font-size:1.18em!important; font-weight:720!important; color:#111827!important; margin-bottom:8px!important; }
    .tpl-classicleft .extra-card{
      display:grid!important; grid-template-columns:repeat(2,minmax(0,1fr))!important; gap:18px 24px!important; align-content:start!important; padding-top:2px!important;
    }
    .tpl-classicleft .extra-card .inv-label{ margin:0 0 5px!important; font-size:.74em!important; letter-spacing:.14em!important; color:var(--nb-document-muted)!important; opacity:1; }
    .tpl-classicleft .inv-table{ margin-top:6px!important; border-top:1px solid #d7dbe0!important; }
    .tpl-classicleft .inv-table th{ background:transparent!important; color:#5b6470!important; border-bottom:1px solid #d7dbe0!important; font-size:.72em!important; letter-spacing:.12em!important; }
    .tpl-classicleft .inv-table td{ border-bottom:1px solid #eceef1!important; padding-top:12px!important; padding-bottom:12px!important; }
    .tpl-classicleft .inv-totals{ margin-top:18px!important; min-width:320px!important; margin-left:auto!important; border-top:1px solid #d7dbe0!important; padding-top:10px!important; }
    .tpl-classicleft .t-total{ margin-top:8px!important; border-top:1px solid #d7dbe0!important; padding-top:11px!important; }
    .tpl-classicleft .t-total dd{ color:#111827!important; font-size:1.22em!important; font-weight:820!important; }
    .tpl-classicleft .inv-notes,.tpl-classicleft .inv-payment{ margin-top:20px!important; padding-top:16px!important; border-top:1px solid #eceef1!important; }
    @media screen and (max-width:760px){
      .template-grid-v10{ grid-template-columns:repeat(2,minmax(0,1fr)); }
      .tpl-classicleft .inv-head,.tpl-classicleft .inv-parties{ grid-template-columns:1fr!important; }
      .tpl-classicleft .inv-brand,.tpl-classicleft .bill-card{
        border-right:0!important; padding-right:0!important; border-bottom:1px solid var(--panel-line)!important;
        padding-bottom:14px!important; margin-bottom:4px!important;
      }
      .tpl-classicleft .inv-meta{ grid-template-columns:repeat(2,minmax(0,1fr))!important; }
      .tpl-classicleft .extra-card{ grid-template-columns:1fr!important; }
    }


    /* v12 — one quiet chevron per select */
    select:hover{ border-color:#b9c0c9; }
    select:focus-visible{ border-color:color-mix(in srgb,var(--accent) 58%,#b9c0c9); }


    /* ══════════ v12 — simplified affordances + NineBrief site chrome ══════════ */

    /* One centered disclosure control. No redundant Show/Hide text. */
    .sub-disclosure > summary{
      min-height:48px;
      display:grid;
      grid-template-columns:1fr 28px;
      align-items:center;
      column-gap:10px;
    }
    .sub-disclosure > summary::after{
      content:"";
      width:28px; height:28px;
      justify-self:end;
      border-radius:50%;
      background-color:#f1f2f5;
      background-image:
        linear-gradient(45deg, transparent 48%, #69707a 49% 58%, transparent 59%),
        linear-gradient(-45deg, transparent 48%, #69707a 49% 58%, transparent 59%);
      background-repeat:no-repeat;
      background-size:7px 7px,7px 7px;
      background-position:8px 10px,12px 10px;
      transition:transform 180ms ease-out,background-color 120ms ease-out;
    }
    .sub-disclosure[open] > summary::after{ transform:rotate(180deg); }
    .sub-disclosure > summary:hover::after{ background-color:#e9ebef; }

    /* Remove legacy Show/Hide pills if old cached markup is ever present. */
    .summary-action,.sub-summary-action{ display:none!important; }

    @media print{
      @page{ size:A4; margin:0; }

      html,body{
        width:210mm !important;
        min-width:210mm !important;
        margin:0 !important;
        padding:0 !important;
        background:#fff !important;
      }

      body,
      .sheet,
      .sheet *{
        -webkit-print-color-adjust:exact !important;
        print-color-adjust:exact !important;
      }

      .topbar,
      .editor,
      .toolbar,
      .toast,
      .preview-add-item,
      .invoice-editor-popover,
      .site-footer{
        display:none !important;
      }

      .workspace{
        display:block !important;
        width:210mm !important;
        height:auto !important;
        min-height:0 !important;
        margin:0 !important;
        padding:0 !important;
      }

      .preview{
        display:block !important;
        width:210mm !important;
        min-width:210mm !important;
        height:auto !important;
        min-height:0 !important;
        margin:0 !important;
        padding:0 !important;
        background:#fff !important;
      }

      .preview-scroll{
        display:block !important;
        width:210mm !important;
        overflow:visible !important;
        margin:0 !important;
        padding:0 !important;
      }

      .sheet-zoom{
        width:794px !important;
        margin:0 !important;
        zoom:1 !important;
        transform:none !important;
      }

      /* Keep the exact preview geometry. Do not restyle the invoice for print. */
      .sheet{
        box-sizing:border-box !important;
        width:794px !important;
        min-width:794px !important;
        max-width:794px !important;
        min-height:1123px !important;
        padding:54px 58px !important;
        margin:0 !important;
        border-radius:0 !important;
        box-shadow:none !important;
        overflow:visible !important;
      }

      .sheet.preview-edit-mode [data-edit-target],
      .sheet.preview-edit-mode [data-edit-item]{
        outline:none !important;
        cursor:default !important;
      }

      thead{ display:table-header-group !important; }
      tr,.avoid-break{ break-inside:avoid !important; page-break-inside:avoid !important; }
    }

    @media print{
      .pdf-exporting *,
      .pdf-exporting *::before,
      .pdf-exporting *::after{
        animation:none !important;
        transition:none !important;
      }
    }


/* Brand asset fallback: shown only when the PNG cannot be loaded. */
.brand-logo-fallback{
  display:grid;
  place-items:center;
  flex:0 0 auto;
  background:#4ade80;
  color:#fff;
  font-weight:850;
  line-height:1;
}
.brand-logo-fallback-main{
  width:38px;
  height:38px;
  border-radius:10px;
  font-size:22px;
}
.brand-logo-fallback-footer{
  width:24px;
  height:24px;
  border-radius:7px;
  font-size:14px;
}
@media screen and (max-width:760px){
  .brand-logo-fallback-main{ width:35px; height:35px; font-size:20px; }
}
@media screen and (max-width:520px){
  .brand-logo-fallback-main{ width:32px; height:32px; font-size:19px; }
}


/* ══════════ SEO / discovery content ══════════
 * Static, useful page copy gives crawlers and first-time visitors a clear
 * explanation of the tool without interfering with the invoice workflow.
 */
/* Native fragment navigation changes region visibility; finish its scroll
   immediately. Explicit editor jumps select their motion in JavaScript. */
html{ scroll-behavior:auto; }
.tool-intro{
  position:relative;
  overflow:hidden;
  background:radial-gradient(760px 300px at 72% 0%,rgba(74,222,128,.055),transparent 66%),var(--ninebrief-site-bg);
  color:#fff;
  border-bottom:0;
  padding-bottom:54px;
}
.tool-intro-inner{
  position:relative;
  z-index:1;
  max-width:1120px;
  margin:0 auto;
  padding:26px 24px 42px;
}
.tool-intro-copy{
  max-width:900px;
  margin:0 auto;
  text-align:center;
}
.tool-breadcrumb{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:7px;
  margin:0 0 20px;
  color:#71717a;
  font-size:10.5px;
  font-weight:650;
}

.tool-eyebrow{
  margin:0 0 10px;
  color:var(--ninebrief-site-green);
  font-size:11px;
  font-weight:820;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.tool-intro h1{
  margin:0;
  color:#fff;
  font-size:clamp(38px,5vw,62px);
  line-height:1.02;
  letter-spacing:-.048em;
  font-weight:820;
  text-transform:none;
  text-wrap:balance;
}
.tool-intro-lede{
  max-width:850px;
  margin:18px auto 0;
  color:#c4c4cc;
  font-size:clamp(15px,1.45vw,18px);
  line-height:1.58;
  text-wrap:balance;
}
.tool-proof{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px 24px;
  flex-wrap:wrap;
  margin:20px auto 0;
  color:#d4d4d8;
  font-size:12.5px;
  font-weight:650;
}
.tool-proof span{ white-space:nowrap; }
.tool-intro-actions{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:24px;
}
.intro-cta{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:46px;
  padding:0 17px;
  border-radius:10px;
  text-decoration:none;
  font-size:13px;
  font-weight:760;
  transition:transform 120ms ease-out,background 120ms ease-out,border-color 120ms ease-out;
}
.intro-cta:hover{ transform:translateY(-1px); }
.intro-cta-primary{ border:1px solid transparent; background:var(--ninebrief-site-green); color:#0a1b10; }
.intro-cta-primary:hover{ background:#5be28d; }
.intro-cta-secondary{ border:1px solid #303034; background:#1a1a1a; color:#e4e4e7; }
.intro-cta-secondary:hover{ background:#202024; border-color:#3f3f46; }
.intro-cta:focus-visible{ outline:2px solid #fff; outline-offset:3px; }
.tool-product-note{
  max-width:800px;
  margin:18px auto 0;
  color:var(--nb-muted-light);
  font-size:11.5px;
  line-height:1.5;
}
.tool-product-note strong{ color:#d4d4d8; font-weight:720; }

.seo-content{
  background:#f8fafb;
  border-top:1px solid #e6e8ec;
}
.seo-content-inner{
  max-width:1120px;
  margin:0 auto;
  padding:64px 24px;
}
.seo-content-lead{
  max-width:820px;
  margin-bottom:30px;
}
.seo-content h2:not(.sheet *),
.seo-content h3:not(.sheet *){
  color:#111827;
  letter-spacing:-.025em;
}
.seo-content h2:not(.sheet *){
  margin:0 0 12px;
  font-size:clamp(23px,3vw,32px);
  line-height:1.2;
}
.seo-content h3:not(.sheet *){
  margin:0 0 9px;
  font-size:16px;
}
.seo-content p:not(.sheet *),
.seo-content li:not(.sheet *){
  color:#667085;
  font-size:14px;
  line-height:1.65;
}
.seo-content p:not(.sheet *){ margin:0; }
.seo-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  margin:24px 0 34px;
}
.seo-grid article{
  padding:20px;
  border:1px solid #e4e7ec;
  border-radius:16px;
  background:#fff;
}
.seo-grid ol{
  margin:0;
  padding-left:20px;
}
.seo-faq{
  max-width:820px;
  margin-top:34px;
}
.seo-faq > h2{ font-size:24px; }
.seo-faq details{
  border-top:1px solid #e1e5ea;
}
.seo-faq details:last-child{
  border-bottom:1px solid #e1e5ea;
}
.seo-faq summary{
  cursor:pointer;
  padding:16px 2px;
  color:#20242c;
  font-size:14px;
  font-weight:750;
}
.seo-faq details p{
  padding:0 2px 17px;
}
.ninebrief-discovery{
  margin-top:42px;
  padding:22px 24px;
  border:1px solid rgba(74,222,128,.22);
  border-radius:17px;
  background:color-mix(in srgb,#4ade80 5%,white);
}
.ninebrief-discovery strong{
  display:block;
  margin-bottom:6px;
  color:#111827;
  font-size:15px;
}
.ninebrief-discovery p{
  max-width:780px;
}
.ninebrief-discovery a{
  display:inline-block;
  margin-top:12px;
  font-size:13px;
  font-weight:750;
}

@media screen and (max-width:900px){
  .tool-proof{ gap:9px 16px; }
  .seo-grid{ grid-template-columns:1fr; }
}
@media screen and (max-width:520px){
  .tool-proof{
    align-items:flex-start;
    flex-direction:column;
    width:max-content;
    max-width:100%;
    text-align:left;
  }
  .tool-intro-actions{
    align-items:stretch;
    flex-direction:column;
    width:100%;
  }
  .intro-cta{ width:100%; }
  .tool-product-note{ font-size:11px; }
  .seo-content-inner{ padding:46px 16px; }
}

/* Discovery content must never become part of the exported invoice. */
@media print{
  .tool-intro,
  .seo-content{
    display:none !important;
  }
}


/* ══════════ Product UI refinement — clarity, hierarchy, direct manipulation ══════════
 * Principles: calm surfaces, obvious primary actions, progressive disclosure,
 * 44px touch targets, direct editing on the invoice, and reduced visual noise.
 */
button,input,select,textarea{ -webkit-tap-highlight-color:transparent; }

.topbar .btn{
  min-height:40px;
  border-radius:10px;
  box-shadow:none;
  font-weight:650;
}
.topbar .btn:hover{ transform:none; box-shadow:none; background:#f5f5f7; }
.topbar .btn.accent{
  min-height:42px;
  padding-inline:16px;
  background:#111827;
  border-color:#111827;
  box-shadow:0 1px 2px rgba(0,0,0,.16);
}
.topbar .btn.accent:hover{ background:#202938; border-color:#202938; }
.editor-overview{
  position:sticky;
  top:0;
  z-index:20;
  margin:0 0 12px;
  padding:14px;
  border:1px solid rgba(255,255,255,.65);
  border-radius:20px;
  background:rgba(247,248,250,.88);
  box-shadow:0 1px 2px rgba(15,23,42,.04);
  backdrop-filter:saturate(140%) blur(18px);
  -webkit-backdrop-filter:saturate(140%) blur(18px);
}
.editor-overview-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:9px;
}
.editor-overview-head strong{
  color:var(--ui-label);
  font-size:13px;
  letter-spacing:-.01em;
}
.editor-jumps{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  overflow:visible;
  padding:7px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.55);
  background:rgba(240,243,246,.72);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.75);
  backdrop-filter:blur(14px) saturate(135%);
  -webkit-backdrop-filter:blur(14px) saturate(135%);
}
.editor-jumps button{
  min-width:44px;
  width:100%;
  min-height:44px;
  flex:0 0 auto;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.72);
  padding:0 13px;
  background:rgba(255,255,255,.42);
  color:#3f454d;
  cursor:pointer;
  font-size:11px;
  font-weight:760;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.82),
    0 3px 10px rgba(15,23,42,.08);
  backdrop-filter:blur(16px) saturate(160%);
  -webkit-backdrop-filter:blur(16px) saturate(160%);
  transition:background 140ms ease,border-color 140ms ease,box-shadow 140ms ease,color 140ms ease,transform 140ms ease;
}
.editor-jumps button:hover{
  transform:translateY(-1px);
  background:rgba(255,255,255,.56);
  border-color:rgba(255,255,255,.88);
  color:#1f2937;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.90),
    0 4px 12px rgba(15,23,42,.10);
}
.editor-jumps button.active,
.editor-jumps button[aria-current="step"]{
  background:rgba(232,255,241,.58);
  border-color:rgba(74,222,128,.55);
  color:#0b6b43;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.88),
    0 4px 12px rgba(74,222,128,.14);
}
.editor-jumps button:focus-visible{
  outline:3px solid rgba(74,222,128,.22);
  outline-offset:2px;
}

details.card[open]{
  border-color:color-mix(in srgb,var(--section-accent,#64748b) 26%,rgba(60,60,67,.18));
  box-shadow:0 1px 2px rgba(0,0,0,.025);
}
details.card.edit-linked-card{
  border-color:rgba(10,102,194,.42);
  box-shadow:0 0 0 3px rgba(10,102,194,.08);
}

input:hover,select:hover,textarea:hover{ border-color:rgba(60,60,67,.32); }
.editor [aria-invalid="true"],
.invoice-editor-popover [aria-invalid="true"]{
  border-color:#d92d20!important;
  box-shadow:0 0 0 3px rgba(217,45,32,.10)!important;
}
.currency-field{
  align-content:start;
}
.custom-currency-wrap{
  display:grid;
  gap:5px;
  margin-top:7px;
}
.custom-currency-wrap input{
  text-transform:uppercase;
  letter-spacing:.08em;
  font-weight:720;
}
.custom-currency-wrap small{
  color:var(--nb-document-muted);
  font-size:9.5px;
  line-height:1.35;
}
.item-row:hover{
  border-color:rgba(74,222,128,.52);
  box-shadow:
    0 1px 0 rgba(255,255,255,.90) inset,
    0 5px 14px rgba(74,222,128,.075);
}
.item-row:focus-within{
  border-color:rgba(74,222,128,.72);
  box-shadow:
    0 0 0 3px rgba(74,222,128,.11),
    0 1px 0 rgba(255,255,255,.90) inset,
    0 6px 16px rgba(74,222,128,.08);
}
.item-row:nth-child(4n+2) .item-index{ background:#edf5ff; border-color:#bfdbfe; color:#1d4ed8; }
.item-row:nth-child(4n+3) .item-index{ background:#f4efff; border-color:#ddd0ff; color:#6d28d9; }
.item-row:nth-child(4n+4) .item-index{ background:#fff4e8; border-color:#fed7aa; color:#b45309; }
/* Default Professional invoice — finance-grade typography and restrained hierarchy. */
.tpl-professional{
  letter-spacing:-.004em;
  font-weight:400;
}
.tpl-professional .inv-line,
.tpl-professional .inv-table td,
.tpl-professional .pay-block div:not(.pk),
.tpl-professional .pay-instr,
.tpl-professional .notes p{
  font-weight:400;
}
.tpl-professional .inv-head{
  grid-template-columns:minmax(0,1fr) minmax(290px,.9fr)!important;
  gap:38px!important;
  padding-bottom:20px!important;
  margin-bottom:24px!important;
  border-bottom:2px solid var(--iacc)!important;
}
.tpl-professional .inv-bizname{
  color:var(--biz-color)!important;
  font-size:1.34em!important;
  font-weight:720!important;
  letter-spacing:-.018em;
}
.tpl-professional .inv-title{
  color:var(--title-color)!important;
  font-size:2.45em!important;
  font-weight:720!important;
  letter-spacing:-.04em!important;
}
.tpl-professional .inv-meta{
  gap:9px 22px!important;
  margin-top:15px!important;
}
.tpl-professional .inv-meta dt{
  color:var(--nb-document-muted);
  opacity:1;
  font-size:.66em;
  font-weight:680;
  letter-spacing:.09em;
}
.tpl-professional .inv-meta dd{
  color:#0f172a;
  font-weight:650;
}
.tpl-professional .inv-parties{
  margin-bottom:24px;
  padding:2px 0 4px;
}
.tpl-professional .inv-label{
  color:var(--nb-document-muted);
  opacity:1;
  font-size:.7em;
  font-weight:680;
}
.tpl-professional .bill-name{ color:#0f172a; font-weight:700; }
.tpl-professional .inv-table{
  margin-top:4px;
  border-top:1px solid #d9e2ec;
}
.tpl-professional .inv-table th{
  padding:10px 8px!important;
  background:color-mix(in srgb,var(--th-bg) 58%,white)!important;
  color:#334155!important;
  border-bottom:1px solid #cbd5e1!important;
  font-size:.68em!important;
  font-weight:700!important;
  letter-spacing:.09em!important;
  opacity:1!important;
}
.tpl-professional .inv-table td{
  padding:11px 8px!important;
  border-bottom:1px solid #e6ebf0!important;
}
.tpl-professional .inv-desc strong{ color:#0f172a; font-weight:650; }
.tpl-professional .num{ font-variant-numeric:tabular-nums; }
.tpl-professional .inv-totals{
  min-width:310px;
  border-top:1px solid #dbe2ea;
  padding-top:7px;
}
.tpl-professional .inv-totals > div{ padding:5px 7px; }
.tpl-professional .t-total{
  margin-top:7px!important;
  padding-top:10px!important;
  border-top:2px solid var(--iacc)!important;
}
.tpl-professional .t-total dt{
  color:#0f172a;
  opacity:1;
  font-weight:700;
}
.tpl-professional .t-total dd{
  color:var(--total-color)!important;
  font-size:1.24em!important;
  font-weight:750!important;
}

/* Direct manipulation controls live on the canvas only while editing. */
.preview-quick-adjustments{
  display:none;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  margin:12px 0 0 auto;
  padding:8px;
  width:max-content;
  max-width:100%;
  border:1px solid rgba(59,130,246,.14);
  border-radius:12px;
  background:#f8fbff;
}
.sheet.edit-mode .preview-quick-adjustments{ display:flex; }
.preview-quick-label{
  margin:0 5px 0 2px;
  color:var(--nb-document-muted);
  font-size:.72em;
  font-weight:680;
}
.preview-adjust-btn{
  display:inline-flex;
  align-items:center;
  gap:7px;
  min-width:max(44px,var(--invoice-canvas-target-size,44px));
  min-height:max(44px,var(--invoice-canvas-target-size,44px));
  padding:0 9px;
  border-radius:9px;
  cursor:pointer;
  font:inherit;
  font-size:.76em;
}
.preview-adjust-name{ font-weight:700; }
.preview-adjust-state{
  color:var(--nb-document-muted);
  font-size:.9em;
}
@media screen and (max-width:1020px){
  .editor-overview{ top:0; }
}
@media screen and (max-width:760px){
  .editor{ overflow:visible; padding:12px; }
  .editor form{ max-width:none; }
  .editor-overview{
    position:relative;
    top:auto;
    border-radius:15px;
  }
  .preview{ min-height:720px; }
  .preview-scroll{ padding:22px 14px 36px; }
  .preview-quick-adjustments{
    flex-wrap:wrap;
    width:100%;
    justify-content:flex-start;
  }
  .preview-quick-label{ width:100%; }
}
@media print{
  .preview-quick-adjustments,
  .editor-overview{
    display:none!important;
  }
}


/* ══════════ v18.2 — download action, canvas logo and faster invoice options ══════════ */
.topbar .btn.accent{
  background:var(--ninebrief-action);
  border-color:var(--ninebrief-action);
  color:var(--ninebrief-action-ink);
  font-weight:780;
  box-shadow:0 2px 8px rgba(74,222,128,.20);
}
.topbar .btn.accent:hover{
  background:var(--ninebrief-action-hover);
  border-color:var(--ninebrief-action-hover);
  color:#04271b;
  box-shadow:0 3px 10px rgba(74,222,128,.24);
}
.topbar .btn.accent:focus-visible{
  outline:3px solid rgba(74,222,128,.26);
  outline-offset:2px;
}

/* Canvas logo placeholder: visible only while direct invoice editing is on. */
.canvas-logo-upload{
  display:none;
  width:190px;
  min-height:max(92px,var(--invoice-canvas-target-size,44px));
  margin:0 0 14px;
  padding:15px 16px;
  place-items:center;
  align-content:center;
  gap:7px;
  border:1px solid #aeb8c5;
  border-radius:6px;
  background:#fff;
  color:#1f2937;
  cursor:pointer;
  font:inherit;
  text-align:center;
  box-shadow:none;
  transition:border-color 120ms ease,box-shadow 120ms ease,background 120ms ease;
}
.sheet.edit-mode .canvas-logo-upload{ display:grid; }
.canvas-logo-upload:hover{
  border-color:#667085;
  background:#fbfcfd;
  box-shadow:0 0 0 3px rgba(74,222,128,.08);
}
.canvas-logo-upload:focus-visible{
  outline:3px solid rgba(74,222,128,.20);
  outline-offset:3px;
}
.canvas-logo-topline{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.canvas-logo-plus{
  font-size:.84em;
  font-weight:560;
  color:#344054;
}
.canvas-logo-title{
  display:block;
  font-size:.92em;
  font-weight:720;
  color:#111827;
}
.canvas-logo-icon{
  position:relative;
  width:28px;
  height:28px;
  display:block;
  flex:0 0 28px;
  border-radius:4px;
  background:#050505;
}
.canvas-logo-icon::before{
  content:"";
  position:absolute;
  left:5px;
  right:5px;
  bottom:5px;
  height:14px;
  background:#fff;
  clip-path:polygon(0 100%,34% 36%,54% 69%,72% 24%,100% 100%);
}
.canvas-logo-icon::after{
  content:"";
  position:absolute;
  top:5px;
  right:6px;
  width:4px;
  height:4px;
  border-radius:50%;
  background:#fff;
}
.tpl-professional .canvas-logo-upload{
  width:192px;
  min-height:max(94px,var(--invoice-canvas-target-size,44px));
}

/* Make common tax/discount/charge controls feel intentionally discoverable. */
#tax-settings{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid rgba(60,60,67,.10);
}
#invoice-tax-rate-setting[hidden],
#per-item-tax-note[hidden]{ display:none!important; }
#per-item-tax-note{
  margin:0;
  padding:8px 10px;
  border-radius:10px;
  background:#f8fafc;
  color:#667085;
}
.preview-quick-adjustments{
  border-color:rgba(74,222,128,.20);
  background:#f7fffb;
}
.preview-adjust-btn{
  border-color:#d8e5de;
}
.preview-adjust-btn:hover{
  border-color:#8dc7aa;
  background:#f2fff8;
}

@media print{
  .canvas-logo-upload{
    display:none!important;
  }
}


/* ══════════ v18.2.1 — clearer brand, PDF action and edit/preview guidance ══════════ */
/* Primary export action: intentionally distinct from editing controls. */
.topbar .btn.accent{
  background:var(--download-red)!important;
  border-color:var(--download-red)!important;
  color:#fff!important;
  font-weight:800!important;
  box-shadow:0 3px 10px rgba(229,57,53,.24)!important;
}
.topbar .btn.accent:hover{
  background:var(--download-red-hover)!important;
  border-color:var(--download-red-hover)!important;
  color:#fff!important;
  box-shadow:0 4px 14px rgba(198,40,40,.28)!important;
}
#btn-pdf:focus-visible{
  outline:3px solid rgba(229,57,53,.22);
  outline-offset:2px;
}


/* Edit mode is a mode, not just a button. Explain both states in plain language. */
.preview-mode-guide{
  display:flex;
  align-items:flex-start;
  gap:8px;
  min-width:min(250px,100%);
  max-width:min(430px,100%);
  padding:7px 10px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:11px;
  background:rgba(255,255,255,.07);
}
.preview-mode-dot{
  width:9px;
  height:9px;
  margin-top:4px;
  flex:0 0 9px;
  border-radius:50%;
  background:#94a3b8;
  box-shadow:0 0 0 3px rgba(148,163,184,.12);
}
.preview-mode-copy{
  display:grid;
  gap:1px;
  min-width:0;
  overflow-wrap:anywhere;
}
.preview-mode-copy strong{
  color:#fff;
  font-size:11px;
  font-weight:760;
  line-height:1.2;
}
.preview-mode-copy small{
  color:rgba(255,255,255,.68);
  font-size:10px;
  line-height:1.35;
}
.preview-mode-guide.is-editing{
  border-color:rgba(74,222,128,.34);
  background:rgba(74,222,128,.10);
}
.preview-mode-guide.is-editing .preview-mode-dot{
  background:#4ade80;
  box-shadow:0 0 0 3px rgba(74,222,128,.16);
}
.preview-mode-guide.is-preview{
  border-color:rgba(96,165,250,.28);
  background:rgba(96,165,250,.09);
}
.preview-mode-guide.is-preview .preview-mode-dot{
  background:#60a5fa;
  box-shadow:0 0 0 3px rgba(96,165,250,.14);
}

.preview-edit-toggle{
  flex:0 0 auto;
  min-height:44px;
  margin-left:4px;
  padding:8px 13px;
  border-radius:10px;
  font-weight:780;
  white-space:nowrap;
}
.preview-edit-toggle[aria-pressed="true"]{
  background:rgba(74,222,128,.78);
  border-color:rgba(74,222,128,.90);
  color:#052e1d;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.38),
    0 4px 14px rgba(74,222,128,.22);
  backdrop-filter:blur(12px) saturate(150%);
  -webkit-backdrop-filter:blur(12px) saturate(150%);
}
.preview-edit-toggle[aria-pressed="true"]:hover{
  background:var(--nb-green-strong);
  border-color:var(--nb-green-strong);
}
.preview-edit-toggle[aria-pressed="false"]{
  background:rgba(74,222,128,.12);
  border-color:rgba(255,255,255,.24);
  color:#dffbea;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.10);
  backdrop-filter:blur(12px) saturate(145%);
  -webkit-backdrop-filter:blur(12px) saturate(145%);
}
.preview-edit-toggle[aria-pressed="false"]:hover{
  background:#f5f5f7;
}
.preview-edit-toggle .edit-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:16px;height:16px;flex:0 0 16px;
  margin:0;line-height:1;
  font-size:13px;
  font-weight:900;
}
.invoice-workspace-modes{
  display:inline-flex;
  align-items:stretch;
  gap:4px;
  min-width:0;
  padding:1px;
  border:0;
  border-radius:8px;
  background:rgba(255,255,255,.06);
}
.invoice-workspace-modes .workspace-mode-button{
  flex:0 1 auto;
  min-width:0;
  margin:0;
  padding:6px 12px;
  border-color:transparent;
  border-radius:8px;
  background:transparent;
  color:#d8dee9;
  box-shadow:none;
  font-weight:740;
  white-space:normal;
}
/* Mode hit targets own this height above the shared compact toolbar rule. */
.workspace > .toolbar .invoice-workspace-modes .workspace-mode-button{
  min-height:44px;
}
.invoice-workspace-modes .workspace-mode-button[aria-pressed="false"]:hover{
  border-color:rgba(255,255,255,.16);
  background:rgba(255,255,255,.10);
  color:#fff;
}
.invoice-workspace-modes .workspace-mode-button:focus-visible{
  outline:3px solid rgba(74,222,128,.22);
  outline-offset:2px;
}
#preview-edit-hint{
  display:block;
  padding:0;
  border-radius:0;
  background:transparent;
  color:rgba(255,255,255,.68);
  font-size:10.5px;
  white-space:normal;
  overflow-wrap:anywhere;
}

@media screen and (max-width:1100px){

  .topbar{ gap:10px; }
}
@media screen and (max-width:900px){

  .preview-mode-guide{ max-width:340px; }
}
@media screen and (max-width:760px){
  .topbar{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
  }

  .topbar-actions{
    grid-column:1 / -1;
    width:100%;
    margin-left:0;
    justify-content:flex-end;
  }
  .save-chip{ margin-right:auto; }
  .toolbar{
    align-items:stretch;
  }
  .preview-mode-guide{
    order:2;
    flex:1 1 100%;
    max-width:none;
  }
  .invoice-workspace-modes{
    order:3;
    width:100%;
  }
  .invoice-workspace-modes .workspace-mode-button{
    flex:1 1 0;
  }
}
@media screen and (max-width:520px){
  .topbar{ padding:9px 10px; }

  .topbar-actions{
    gap:6px;
  }
  .topbar-actions .btn{
    min-height:38px;
    padding:8px 10px;
    font-size:12px;
  }
  #btn-pdf{
    flex:1 1 auto;
  }
  .preview-mode-copy small{ font-size:9.5px; }
}

@media print{
  .preview-mode-guide{
    display:none!important;
  }
}


/* ══════════ v18.3 — shared NineBrief shell + edit section guides ══════════
 * Site brand/header/footer structure and sizing live in ninebrief-shell.css.
 */
.sheet.edit-mode [data-edit-section]{
  position:relative;
  cursor:pointer;
  outline:1.5px dashed rgba(74,222,128,.68);
  outline-offset:5px;
  border-radius:7px;
  transition:outline-color 120ms ease-out,background-color 120ms ease-out,box-shadow 120ms ease-out;
}
.sheet.edit-mode [data-edit-section]::before{
  content:attr(data-edit-section-label);
  position:absolute;
  z-index:8;
  top:-14px;
  left:7px;
  display:block;
  max-width:calc(100% - 14px);
  padding:2px 6px;
  overflow:hidden;
  border:1px solid rgba(74,222,128,.18);
  border-radius:999px;
  background:#effcf6;
  color:var(--nb-green-ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size:8.5px;
  font-weight:760;
  line-height:1.35;
  letter-spacing:.02em;
  text-overflow:ellipsis;
  white-space:nowrap;
  pointer-events:none;
}
.sheet.edit-mode [data-edit-section]:hover{
  outline-color:var(--nb-green-strong);
  background:rgba(74,222,128,.035);
  box-shadow:0 0 0 4px rgba(74,222,128,.045);
}
.sheet.edit-mode [data-edit-section]:hover::before{
  border-color:rgba(74,222,128,.28);
  background:#e4faef;
}
.sheet.edit-mode .invoice-items-section{
  margin-top:2px;
}
.sheet.edit-mode .invoice-items-section::before{
  top:-12px;
}
.sheet.edit-mode .totals-wrap[data-edit-section]{
  padding:2px 0;
}
.sheet.edit-mode .payment[data-edit-section],
.sheet.edit-mode .notes[data-edit-section],
.sheet.edit-mode .sig[data-edit-section]{
  padding:3px 2px;
}

/* Individual fields remain clickable within an outlined section, but section
 * guides carry the persistent visual hierarchy instead of outlining every
 * field at rest.
 */
.sheet.edit-mode [data-edit-target],
.sheet.edit-mode [data-edit-item]{
  outline:1px dashed transparent;
  outline-offset:3px;
}
.sheet.edit-mode [data-edit-target]:hover,
.sheet.edit-mode [data-edit-item]:hover{
  outline:2px solid rgba(10,102,194,.55);
  outline-offset:3px;
  background:rgba(96,165,250,.055);
}

/* Clean preview and PDF/export are document-only views. */
.pdf-exporting .sheet [data-edit-section],
.pdf-exporting .sheet [data-edit-target],
.pdf-exporting .sheet [data-edit-item]{
  outline:none!important;
  box-shadow:none!important;
  background:transparent!important;
}
.pdf-exporting .sheet [data-edit-section]::before{
  display:none!important;
}

@media screen and (max-width:520px){
  .editor-jumps{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .sheet.edit-mode [data-edit-section]::before{
    font-size:8px;
    padding:2px 5px;
  }
}
@media (prefers-reduced-transparency: reduce){
  .topbar,
  .editor-overview,
  .editor-jumps,
  .editor-jumps button,
  .toolbar,
  .switch-control .switch-ui{
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
  .topbar,.editor-overview,.editor-jumps button{ background:#fff!important; }
  .editor-jumps{ background:#eef1f4!important; }
  .toolbar{ background:var(--nb-white)!important; }
}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  .topbar,.editor-overview,.editor-jumps button{ background:#fff; }
  .editor-jumps{ background:#eef1f4; }
  .toolbar{ background:var(--nb-white); }
  .switch-control .switch-ui{ background:#e8ebef; }
  .switch-control input:checked + .switch-ui{ background:var(--ninebrief-site-green); }
}

@media print{
  .sheet [data-edit-section],
  .sheet [data-edit-target],
  .sheet [data-edit-item]{
    outline:none!important;
    box-shadow:none!important;
    background:transparent!important;
  }
  .sheet [data-edit-section]::before{
    display:none!important;
  }
}


/* Invoice-only physical checkbox switch. Quote/Estimate has no equivalent control. */
.switch-row{
  min-height:46px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:9px 10px;
  border:1px solid var(--ui-separator);
  border-radius:12px;
  background:#fafafa;
  cursor:default;
  user-select:text;
}
.switch-row span{
  font-size:12.5px;
  line-height:1.25;
}
.switch-control{
  position:relative;
  display:inline-grid;
  place-items:center;
  width:46px;
  height:42px;
  flex:0 0 46px;
  cursor:pointer;
  border-radius:999px;
}
.switch-control input{
  position:absolute!important;
  inset:0!important;
  width:100%!important;
  height:100%!important;
  margin:0!important;
  opacity:0!important;
  pointer-events:auto!important;
  cursor:pointer!important;
  z-index:2;
}
.switch-control .switch-ui{
  position:relative;
  width:38px;
  height:22px;
  padding:2px;
  border:1px solid rgba(255,255,255,.78);
  border-radius:999px;
  background:linear-gradient(145deg,rgba(255,255,255,.72),rgba(226,232,240,.56));
  box-shadow:
    0 1px 0 rgba(255,255,255,.86) inset,
    0 5px 14px rgba(15,23,42,.10),
    0 0 0 1px rgba(100,116,139,.08);
  backdrop-filter:blur(12px) saturate(150%);
  -webkit-backdrop-filter:blur(12px) saturate(150%);
  transition:background 160ms ease,border-color 160ms ease,box-shadow 160ms ease,transform 120ms ease;
  pointer-events:none;
}
.switch-control .switch-ui::after{
  content:"";
  display:block;
  width:16px;
  height:16px;
  border:1px solid rgba(255,255,255,.90);
  border-radius:50%;
  background:linear-gradient(145deg,rgba(255,255,255,.98),rgba(248,250,252,.88));
  box-shadow:0 1px 3px rgba(15,23,42,.18),0 1px 0 rgba(255,255,255,.92) inset;
  transition:transform 160ms ease;
}
.switch-control input:disabled + .switch-ui{ opacity:.45; }
.switch-row:has(input:disabled){ opacity:.58; cursor:not-allowed; }
.switch-control input:checked + .switch-ui{
  border-color:rgba(74,222,128,.72);
  background:linear-gradient(135deg,var(--nb-green),var(--nb-green-strong));
  box-shadow:
    0 1px 0 rgba(255,255,255,.34) inset,
    0 5px 16px rgba(74,222,128,.24),
    0 0 0 1px rgba(74,222,128,.16);
}
.switch-control input:checked + .switch-ui::after{
  transform:translateX(16px);
}
.switch-control:focus-within .switch-ui{
  outline:3px solid rgba(74,222,128,.26);
  outline-offset:3px;
}
.switch-control:hover .switch-ui{
  transform:translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255,255,255,.90) inset,
    0 7px 18px rgba(15,23,42,.13),
    0 0 0 1px rgba(100,116,139,.08);
}
.switch-control:hover input:checked + .switch-ui{
  box-shadow:
    0 1px 0 rgba(255,255,255,.36) inset,
    0 7px 20px rgba(74,222,128,.30),
    0 0 0 1px rgba(74,222,128,.18);
}

/* Keep wheel/touch scrolling inside the studio once the user is working. */
@media screen and (min-width:761px){
  .workspace{
    height:calc(100dvh - 64px);
    min-height:620px;
    overflow:hidden;
  }
  .editor{
    overflow-y:auto;
    overflow-x:hidden;
    overscroll-behavior-y:contain;
    overflow-anchor:none;
    scrollbar-gutter:stable;
  }
  .preview{
    overflow:hidden;
    overscroll-behavior:contain;
  }
  .preview-scroll{
    overflow:auto;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
  }
}

/* Desktop sidebar uses native page scrolling. The later viewport rule keeps
   the preview beside it; short viewports retain full-page document scrolling. */
@media screen and (min-width:1101px){
  .workspace{
    height:auto;
    min-height:620px;
    overflow:clip;
    /* Runtime measurement replaces this bootstrap fallback after the public
       header renders or reflows under locale/text-zoom/font changes. */
    --nb-doc-toolbar-top:var(--invoice-header-clearance,76px);
  }
  .editor{
    overflow:visible;
    overscroll-behavior-y:auto;
    scrollbar-gutter:auto;
  }
  /* Native positioning may run again after application entry. Use the same
     measured clearance as imperative reveals, including wrapped toolbars. */
  .editor [id]{ scroll-margin-top:var(--invoice-fragment-clearance,300px); }
  .sheet [data-edit-target],
  .sheet [data-edit-group],
  .sheet [data-edit-item]{ scroll-margin-top:var(--invoice-fragment-clearance,300px); }
  .editor-overview{ position:relative; top:auto; }
  .preview{ overflow:visible; overscroll-behavior:auto; }
  .preview-scroll{
    /* Keep wide sheets reachable at manual zoom while their full height
       participates in document scrolling. */
    flex:none;
    min-height:auto;
    overflow-x:auto;
    overflow-y:hidden;
    overscroll-behavior:auto;
    scrollbar-gutter:auto;
  }
}

/* On phones/tablets the document remains a normal page. */
@media screen and (max-width:760px){
  .tool-intro{
    padding-bottom:38px;
  }
  .tool-intro-inner{
    padding:22px 16px 34px;
  }
  .tool-intro h1{
    font-size:clamp(34px,10vw,48px);
  }
}


/* ══════════ v18.8.1 — form guidance placeholders ══════════ */
.editor input::placeholder,
.editor textarea::placeholder,
.invoice-editor-popover input::placeholder,
.invoice-editor-popover textarea::placeholder{
  color:var(--nb-placeholder);
  opacity:1;
  font-weight:400;
}
.editor input:focus::placeholder,
.editor textarea:focus::placeholder,
.invoice-editor-popover input:focus::placeholder,
.invoice-editor-popover textarea:focus::placeholder{
  color:var(--nb-document-muted);
}


/* ══════════ v18.9 — uniform section tones, clearer danger/upload actions ══════════ */
.more-menu-label{
  padding:4px 8px 2px;
  color:#667085;
  font-size:10px;
  font-weight:800;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.more-danger-zone{
  margin-top:5px;
  padding-top:8px;
  border-top:1px solid #f0d4d4;
}
.more-danger-zone > span{
  display:block;
  padding:0 8px 5px;
  color:#b42318;
  font-size:10px;
  font-weight:780;
}
.more-popover .clear-invoice-btn{
  border:1px solid #fecaca;
  background:#fff1f2;
  color:#b42318;
  font-weight:800;
}
.more-popover .clear-invoice-btn:hover{
  border-color:#fca5a5;
  background:#ffe4e6;
  color:#991b1b;
}

.item-upload-btn{
  min-width:44px;
  min-height:44px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0 13px;
  border-radius:11px;
  font-size:11.5px;
  font-weight:800;
  cursor:pointer;
  transition:border-color 120ms ease,background 120ms ease,box-shadow 120ms ease,transform 120ms ease;
}
.item-upload-btn:hover{ transform:translateY(-1px); }
.item-upload-btn:focus-within{
  outline:3px solid rgba(74,222,128,.18);
  outline-offset:2px;
}

/* Editor action language: NineBrief green frosted glass.
 * Destructive controls intentionally keep their danger treatment.
 */
.editor .btn:not(.danger),
.editor .ibtn:not(.del),
.editor .column-toggle,
.editor .segment-control button,
.editor .item-upload-btn{
  border:1px solid rgba(60,60,67,.18);
  background:rgba(255,255,255,.58);
  color:#11623c;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.88),
    0 3px 10px rgba(15,23,42,.065);
  backdrop-filter:blur(12px) saturate(150%);
  -webkit-backdrop-filter:blur(12px) saturate(150%);
}
.editor .btn:not(.danger):hover,
.editor .ibtn:not(.del):hover,
.editor .column-toggle:hover,
.editor .segment-control button:hover,
.editor .item-upload-btn:hover{
  border-color:rgba(60,60,67,.30);
  background:rgba(239,255,246,.76);
  color:#0b6b43;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.94),
    0 4px 12px rgba(74,222,128,.12);
}
.editor .segment-control{
  border:1px solid rgba(60,60,67,.10);
  background:rgba(239,243,241,.76);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.78);
  backdrop-filter:blur(10px) saturate(135%);
  -webkit-backdrop-filter:blur(10px) saturate(135%);
}
.editor .segment-control button.active,
.editor .column-toggle[aria-pressed="true"]{
  border-color:rgba(74,222,128,.66);
  background:rgba(226,252,237,.74);
  color:var(--nb-green-ink);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.90),
    0 3px 10px rgba(74,222,128,.15);
}
.editor .ibtn.del{
  background:rgba(255,255,255,.62);
  border-color:rgba(239,68,68,.18);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.88),0 3px 9px rgba(15,23,42,.05);
  backdrop-filter:blur(12px) saturate(145%);
  -webkit-backdrop-filter:blur(12px) saturate(145%);
}
.editor .ibtn.del:hover{
  border-color:rgba(220,38,38,.52);
  background:rgba(255,241,242,.82);
  color:#b42318;
}

/* Keep Add line item compact but easy to find. */
#btn-add-item{
  width:max-content;
  min-height:44px;
  margin-top:4px;
  padding:0 13px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(60,60,67,.18);
  border-radius:10px;
  background:rgba(232,255,241,.68);
  color:var(--nb-green-ink);
  font-size:11.5px;
  font-weight:800;
  cursor:pointer;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.90),
    0 3px 10px rgba(74,222,128,.13);
  backdrop-filter:blur(12px) saturate(155%);
  -webkit-backdrop-filter:blur(12px) saturate(155%);
}
#btn-add-item:hover{
  background:rgba(220,252,231,.86);
  border-color:rgba(60,60,67,.30);
  color:#065f46;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.94),
    0 4px 13px rgba(74,222,128,.19);
}

/* Real-renderer gallery: inert sample sheets reuse the customer template CSS. */
.template-grid.template-grid-rendered .template-card-v8{ min-height:208px; flex-direction:column; align-items:stretch; transition:border-color 160ms ease,background-color 160ms ease,box-shadow 160ms ease; }
.template-grid-rendered .template-thumb-real{ width:100%; height:160px; flex:none; margin:0; background:var(--ui-surface-muted); }
.template-thumb-real .sheet{ position:absolute; top:4px; margin:0; width:794px; min-height:1123px; transform-origin:top left; box-shadow:none; border-radius:0; pointer-events:none; }

/* Contextual Design controls: existing form nodes, bounded native dialog. */
.invoice-design-panel{ position:fixed; z-index:290; margin:0; padding:0; max-width:none; box-sizing:border-box; overflow:hidden; border:1px solid var(--ui-border); border-radius:var(--radius); background:var(--ui-surface); color:var(--ui-label); box-shadow:var(--shadow-md); font:inherit; }
.invoice-design-panel:not([open]){ display:none; }
.invoice-design-panel[open]{ display:flex; flex-direction:column; }
.invoice-design-panel::backdrop{ background:color-mix(in srgb,var(--nb-dark) 30%,transparent); }
.invoice-design-head,.invoice-design-foot{ display:flex; align-items:center; gap:12px; flex-shrink:0; padding:12px 16px; }
.invoice-design-head{ border-bottom:1px solid var(--ui-border); }
.invoice-design-head strong{ flex:1; }
.invoice-design-head button,.invoice-design-foot button,.invoice-design-logo button{ min-height:44px; }
.invoice-design-head button{ min-width:44px; }
.invoice-design-foot{ justify-content:flex-end; border-top:1px solid var(--ui-border); }
.invoice-design-scroll{ min-height:0; overflow-y:auto; overscroll-behavior:contain; }
.invoice-design-help{ margin:16px 16px 12px; color:var(--ui-secondary); font-size:12px; line-height:1.5; }
.invoice-design-logo{ display:flex; flex-wrap:wrap; gap:8px; margin:0 16px 12px; }
.invoice-design-panel #card-settings{ margin:0 16px 16px; }
@media print{
  .invoice-design-panel,.invoice-design-panel::backdrop{ display:none!important; }
}

/* Step 8G sample presets: one bounded native review dialog, not a second editor. */
.invoice-preset-dialog{width:min(1100px,calc(100vw - 22px));max-width:none;max-height:calc(100dvh - 22px);padding:0;border:1px solid var(--ui-border);border-radius:18px;background:var(--ui-surface);color:var(--ui-label);box-shadow:var(--shadow-md);font:inherit;overflow:hidden;}
.invoice-preset-dialog:not([open]){display:none;}
.invoice-preset-dialog::backdrop{background:rgba(12,17,21,.55);}
.invoice-preset-panel{display:flex;flex-direction:column;max-height:calc(100dvh - 22px);min-height:0;}
.invoice-preset-head,.invoice-preset-foot{flex-shrink:0;padding:15px 18px;background:var(--ui-surface);}
.invoice-preset-head{display:flex;align-items:start;justify-content:space-between;gap:20px;border-bottom:1px solid var(--ui-border);}
.invoice-preset-head h2{margin:0;font-size:19px;line-height:1.25;}
.invoice-preset-head p{max-width:67ch;margin:6px 0 0;font-size:13px;line-height:1.5;color:var(--ui-secondary);}
.invoice-preset-head > .btn{min-width:44px;min-height:44px;font-size:22px;}
.invoice-preset-content{display:grid;grid-template-columns:minmax(175px,220px) minmax(0,1fr);gap:18px;flex:1;min-height:0;overflow:hidden;padding:15px 18px 22px;}
.invoice-preset-options{border:0;padding:3px 7px 6px 3px;margin:0;min-width:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;}
.invoice-preset-options legend{font-weight:750;font-size:13px;margin-bottom:12px;}
.invoice-preset-choices{display:grid;gap:8px;}
.invoice-preset-choices label{display:flex;align-items:center;gap:9px;padding:11px 10px;min-height:44px;border:1px solid var(--ui-border);border-radius:11px;cursor:pointer;font-size:13px;font-weight:650;background:var(--ui-surface);}
.invoice-preset-choices label:has(input:checked){border-color:var(--nb-green);background:color-mix(in srgb,var(--nb-green) 9%,white);}
.invoice-preset-choices input{accent-color:var(--nb-green);width:18px;height:18px;}
.invoice-preset-review{min-width:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:3px 7px 6px 3px;}
.invoice-preset-review h3{font-size:16px;margin:0 0 7px;}
.invoice-preset-review h4{font-size:13px;margin:14px 0 8px;}
.invoice-preset-explain,.invoice-preset-replace-note{font-size:12.5px;line-height:1.5;color:var(--ui-secondary);margin:0 0 12px;}
.invoice-preset-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0 0 12px;}
.invoice-preset-summary>div{padding:9px 10px;background:var(--ui-surface-muted);border:1px solid var(--ui-border);border-radius:9px;min-width:0;}
.invoice-preset-summary dt{font-size:11px;font-weight:700;color:var(--ui-secondary);}
.invoice-preset-summary dd{margin:5px 0 0;font-size:12.5px;overflow-wrap:anywhere;font-weight:680;}
.invoice-preset-seeded-list{margin:0 0 13px;padding-left:20px;font-size:12px;color:var(--ui-secondary);line-height:1.5;}
.invoice-preset-paper-frame{position:relative;width:100%;margin:10px 0 0;overflow:hidden;background:#e5e7eb;border:1px solid var(--ui-border);border-radius:12px;}
.invoice-preset-paper-frame .sheet{position:absolute;top:8px;left:8px;transform-origin:top left;width:794px;min-height:1123px;pointer-events:none;box-shadow:0 5px 24px rgba(17,24,39,.13);}
.invoice-preset-foot{border-top:1px solid var(--ui-border);}
.invoice-preset-replace-note{margin:0 0 10px;}
.invoice-preset-consent{display:flex;align-items:start;gap:9px;margin:0 0 10px;font-size:12.5px;font-weight:680;line-height:1.45;}
.invoice-preset-consent input{flex:none;accent-color:var(--nb-green);width:18px;height:18px;margin-top:1px;}
.invoice-preset-actions{display:flex;justify-content:flex-end;gap:9px;}
.invoice-preset-actions .btn{min-height:44px;}
.invoice-preset-actions .btn:disabled{opacity:.48;cursor:not-allowed;}
.invoice-preset-dialog .conversion-review-error{margin:0 0 9px;}
.invoice-preset-dialog :is(input,button):focus-visible{outline:3px solid var(--nb-green);outline-offset:2px;}
@media(max-width:700px){
  .invoice-preset-content{grid-template-columns:1fr;grid-auto-rows:max-content;gap:12px;padding:12px;overflow-y:auto;}
  .invoice-preset-options,.invoice-preset-review{overflow:visible;scrollbar-gutter:auto;min-height:auto;}
  .invoice-preset-choices{grid-template-columns:repeat(2,minmax(0,1fr));}
  .invoice-preset-summary{grid-template-columns:repeat(2,minmax(0,1fr));}
  .invoice-preset-head,.invoice-preset-foot{padding:12px;}
  .invoice-preset-head h2{font-size:16px;}
  .invoice-preset-actions .btn{flex:1;}
}
@media(max-width:400px){.invoice-preset-choices{grid-template-columns:1fr;}}
@media print{.invoice-preset-dialog,.invoice-preset-dialog::backdrop{display:none!important;}}

/* Direct-edit popover: one current component generation. */
.invoice-editor-popover{ position:fixed; z-index:300; display:flex; flex-direction:column; max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px); width:min(340px,calc(100vw - 24px)); overflow:hidden; border:1px solid rgba(60,60,67,.18); border-radius:18px; background:rgba(255,255,255,.98); color:#1d1d1f; box-shadow:0 18px 60px rgba(0,0,0,.18),0 2px 8px rgba(0,0,0,.08); backdrop-filter:blur(22px); -webkit-backdrop-filter:blur(22px); }
.invoice-editor-head,.invoice-editor-foot{ flex-shrink:0; }
.invoice-editor-popover[hidden]{ display:none!important; }
.invoice-editor-head{ display:flex; align-items:center; gap:10px; min-height:46px; padding:13px 14px 10px; border-bottom:1px solid rgba(60,60,67,.10); }
.invoice-editor-head strong{ flex:1; font-size:13px; font-weight:760; letter-spacing:-.012em; }
.invoice-editor-close{ width:44px; height:44px; min-width:44px; min-height:44px; border-radius:50%; cursor:pointer; font-size:18px; line-height:1; }
.invoice-editor-body{ display:grid; gap:10px; padding:13px 14px; min-height:0; overflow-y:auto; overscroll-behavior:contain; }
.invoice-editor-body .field{ gap:5px; }
.invoice-editor-body .field > span{ color:#6e6e73; font-size:11px; font-weight:680; }
.invoice-editor-body input,.invoice-editor-body select,.invoice-editor-body textarea{ min-height:44px; border-radius:11px; background:#fff; }
.invoice-editor-grid{ display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.invoice-editor-grid .wide{ grid-column:1/-1; }
.invoice-editor-media{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:10px; padding-top:10px; border-top:1px solid rgba(60,60,67,.08); }
.invoice-editor-media > span{ color:#6e6e73; font-size:11px; font-weight:680; }
.invoice-editor-media-actions{ display:flex; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.invoice-editor-media-button{ min-width:44px; min-height:44px; padding:6px 10px; border:1px solid var(--ui-border); border-radius:9px; background:#fff; color:#2f3136; font:inherit; font-size:11px; font-weight:700; cursor:pointer; }
.invoice-editor-media-button.danger{ color:#b42318; }
.invoice-editor-foot{ display:flex; justify-content:flex-end; gap:8px; padding:10px 14px 13px; border-top:1px solid rgba(60,60,67,.08); }
.invoice-editor-done{ min-width:44px; min-height:44px; padding:7px 13px; border-radius:10px; font:inherit; cursor:pointer; }
.invoice-editor-hint{ margin:2px 0 0; color:#77777d; font-size:11px; line-height:1.45; }
@media screen and (max-width:760px){
  .invoice-editor-grid{ grid-template-columns:1fr 1fr; }
}
@media screen and (max-width:430px){
  .invoice-editor-grid{ grid-template-columns:1fr; }
  .invoice-editor-grid .wide{ grid-column:auto; }
}

/* Canvas editing controls use the same green glass family. */
.preview-adjust-btn,
.preview-add-item,
.invoice-editor-close,
.invoice-editor-done{
  border:1px solid rgba(60,60,67,.18);
  background:rgba(247,255,250,.72);
  color:#0b6b43;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.88),
    0 3px 10px rgba(15,23,42,.07);
  backdrop-filter:blur(12px) saturate(150%);
  -webkit-backdrop-filter:blur(12px) saturate(150%);
}
.preview-adjust-btn:hover,
.preview-add-item:hover,
.invoice-editor-close:hover,
.invoice-editor-done:hover{
  border-color:rgba(60,60,67,.30);
  background:rgba(226,252,237,.84);
  color:#065f46;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.94),
    0 4px 12px rgba(74,222,128,.14);
}
.invoice-editor-done{
  background:rgba(74,222,128,.72);
  color:#063d25;
  font-weight:800;
}

/* Direct canvas entry uses the same party fields as the original form. */
.canvas-inline-input{
  display:none;
  width:100%;
  min-width:0;
  min-height:38px;
  margin:0 0 4px;
  padding:7px 10px;
  border:1.5px solid rgba(74,222,128,.72);
  border-radius:9px;
  outline:0;
  background:rgba(247,255,250,.84);
  color:#0f172a!important;
  font-family:inherit;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.92),
    0 3px 10px rgba(74,222,128,.10);
  backdrop-filter:blur(10px) saturate(145%);
  -webkit-backdrop-filter:blur(10px) saturate(145%);
  transition:border-color 120ms ease,box-shadow 120ms ease,background 120ms ease;
}
.canvas-inline-input::placeholder{
  color:var(--nb-placeholder);
  opacity:1;
  font-weight:400;
}
.canvas-inline-input:focus{
  border-color:var(--ninebrief-site-green);
  background:rgba(244,255,249,.96);
  box-shadow:
    0 0 0 3px rgba(74,222,128,.16),
    inset 0 1px 0 rgba(255,255,255,.96),
    0 4px 12px rgba(74,222,128,.12);
}
.sheet.edit-mode .canvas-inline-display{ display:none!important; }
.sheet.edit-mode .canvas-inline-input{ display:block; }
.sheet:not(.edit-mode) .canvas-inline-input{ display:none!important; }
.pdf-exporting .sheet.edit-mode .canvas-inline-input,
.pdf-exporting .canvas-inline-input{ display:none!important; }
.pdf-exporting .sheet.edit-mode .canvas-inline-display,
.pdf-exporting .canvas-inline-display{ display:block!important; }

@media print{
  .sheet.edit-mode .canvas-inline-input,
  .canvas-inline-input{ display:none!important; }
  .sheet.edit-mode .canvas-inline-display,
  .canvas-inline-display{ display:block!important; }
}

@media (prefers-reduced-transparency: reduce){
  .editor .btn:not(.danger),
  .editor .ibtn,
  .editor .column-toggle,
  .editor .segment-control button,
  .editor .item-upload-btn,
  .preview-adjust-btn,
  .preview-add-item,
  .invoice-editor-close,
  .invoice-editor-done,
  .canvas-inline-input{
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
}


/* Step 5 uses the existing contextual editor; commands are ordinary native buttons. */
#preview-sections-open{ min-height:44px; min-width:44px; }
.invoice-item-commands{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-top:16px; }
.invoice-section-command{ display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; margin-top:8px; }
.invoice-item-commands button,.invoice-section-command button{ min-height:44px; min-width:0; white-space:normal; overflow-wrap:anywhere; }
.invoice-section-visibility{
  display:flex;align-items:center;gap:9px;text-align:left;font-weight:750;
  border:1px solid var(--ui-border);background:var(--ui-surface);color:var(--ui-label);
}
.invoice-section-visibility-icon{
  width:18px;height:18px;flex:0 0 18px;background:currentColor;
  -webkit-mask:center/18px 18px no-repeat;
  mask:center/18px 18px no-repeat;
}
.invoice-section-visibility.is-section-visible{
  border-color:color-mix(in srgb,var(--nb-green) 72%,#15803d);
  background:color-mix(in srgb,var(--nb-green) 12%,white);
  color:#166534;
}
.invoice-section-visibility.is-section-visible .invoice-section-visibility-icon{
  -webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5c5.5 0 9.5 5.4 9.5 7s-4 7-9.5 7S2.5 13.6 2.5 12 6.5 5 12 5Zm0 2C8.1 7 5 10.5 4.6 12c.4 1.5 3.5 5 7.4 5s7-3.5 7.4-5C19 10.5 15.9 7 12 7Zm0 2.2A2.8 2.8 0 1 1 12 14.8 2.8 2.8 0 0 1 12 9.2Z'/%3E%3C/svg%3E");
  mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5c5.5 0 9.5 5.4 9.5 7s-4 7-9.5 7S2.5 13.6 2.5 12 6.5 5 12 5Zm0 2C8.1 7 5 10.5 4.6 12c.4 1.5 3.5 5 7.4 5s7-3.5 7.4-5C19 10.5 15.9 7 12 7Zm0 2.2A2.8 2.8 0 1 1 12 14.8 2.8 2.8 0 0 1 12 9.2Z'/%3E%3C/svg%3E");
}
.invoice-section-visibility.is-section-hidden{
  border-color:#cbd5e1;background:#f8fafc;color:#475569;
}
.invoice-section-visibility.is-section-hidden .invoice-section-visibility-icon{
  -webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m3.3 2 18.7 18.7-1.3 1.3-3.1-3.1A11.7 11.7 0 0 1 12 20C6.5 20 2.5 14.6 2.5 13c0-1 .9-2.6 2.4-4.1L2 3.3 3.3 2Zm3 8.3C5.3 11.5 4.7 12.5 4.6 13c.4 1.5 3.5 5 7.4 5 1.4 0 2.7-.4 3.8-1l-1.9-1.9A3.8 3.8 0 0 1 9.9 11l-1.7-1.7c-.7.3-1.3.6-1.9 1Zm3.1-3A10.7 10.7 0 0 1 12 7c5.5 0 9.5 5.4 9.5 6 0 .8-.8 2.2-2 3.5L18.1 15c.8-.8 1.2-1.6 1.3-2-.4-1.5-3.5-5-7.4-5-.3 0-.7 0-1 .1L9.4 7.3Z'/%3E%3C/svg%3E");
  mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m3.3 2 18.7 18.7-1.3 1.3-3.1-3.1A11.7 11.7 0 0 1 12 20C6.5 20 2.5 14.6 2.5 13c0-1 .9-2.6 2.4-4.1L2 3.3 3.3 2Zm3 8.3C5.3 11.5 4.7 12.5 4.6 13c.4 1.5 3.5 5 7.4 5 1.4 0 2.7-.4 3.8-1l-1.9-1.9A3.8 3.8 0 0 1 9.9 11l-1.7-1.7c-.7.3-1.3.6-1.9 1Zm3.1-3A10.7 10.7 0 0 1 12 7c5.5 0 9.5 5.4 9.5 6 0 .8-.8 2.2-2 3.5L18.1 15c.8-.8 1.2-1.6 1.3-2-.4-1.5-3.5-5-7.4-5-.3 0-.7 0-1 .1L9.4 7.3Z'/%3E%3C/svg%3E");
}
.invoice-section-command [data-section-edit]{
  border-color:#bfdbfe;background:#eff6ff;color:#1d4ed8;font-weight:750;
}
.invoice-section-command [data-section-edit]:hover{background:#dbeafe;border-color:#93c5fd;color:#1e40af;}
.invoice-preset-actions .btn.primary,.conversion-dialog-actions .btn.primary,.invoice-design-foot .btn.primary{
  background:var(--nb-green);border-color:var(--nb-green);color:var(--nb-ink);
  box-shadow:0 6px 16px rgba(74,222,128,.20);
}
.invoice-preset-actions .btn.danger,.conversion-dialog-actions .btn.danger{
  background:#fff1f2;border-color:#fda4af;color:#b42318;font-weight:750;
}
.invoice-preset-actions .btn.danger:hover,.conversion-dialog-actions .btn.danger:hover{
  background:#ffe4e6;border-color:#fb7185;color:#991b1b;
}


/* Step 8: one workspace command bar owns modes and document actions across editor + preview. */
.invoice-editor-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
  min-width:0;
}
.workspace > .toolbar .invoice-editor-actions .save-chip{
  color:#cbd5e1;
  padding-inline:4px;
}
/* The rendered editor actions, including Download PDF and native menu summaries,
   retain a 44px pointer target at desktop, tablet and phone widths. */
.workspace > .toolbar .invoice-editor-actions .btn,
.workspace > .toolbar .invoice-editor-actions .more-menu>summary,
.workspace > .toolbar .invoice-editor-actions .send-menu>summary{
  min-height:44px;
}
.workspace > .toolbar .invoice-editor-actions .more-menu>summary,
.workspace > .toolbar .invoice-editor-actions .send-menu>summary{
  display:flex;
  align-items:center;
  color:#f8fafc;
  background:#2a2c31;
  border-color:rgba(255,255,255,.14);
  padding:7px 10px;
  border-radius:9px;
  font-size:12px;
}
.workspace > .toolbar .invoice-editor-actions .more-menu>summary::after,
.workspace > .toolbar .invoice-editor-actions .send-menu>summary::after{ color:#cbd5e1; }
.workspace > .toolbar .invoice-editor-actions .more-menu[open]>summary,
.workspace > .toolbar .invoice-editor-actions .send-menu[open]>summary{
  border-color:rgba(255,255,255,.24);
  box-shadow:none;
}
.workspace > .toolbar .invoice-editor-actions .more-popover,
.workspace > .toolbar .invoice-editor-actions .send-popover{ top:calc(100% + 6px); }
.workspace > .toolbar .invoice-editor-actions .more-popover .btn,
.workspace > .toolbar .invoice-editor-actions .send-popover .btn{
  color:#1f2937;
  background:transparent;
  border:0;
  box-shadow:none;
}
.workspace > .toolbar .invoice-editor-actions .more-popover .btn:hover,
.workspace > .toolbar .invoice-editor-actions .send-popover .btn:hover{
  color:#111827;
  background:#f6f8fa;
  border:0;
  transform:none;
}
.workspace > .toolbar .invoice-editor-actions .more-popover .clear-invoice-btn{
  border:1px solid #fecaca;
  background:#fff1f2;
  color:#b42318;
}
.workspace > .toolbar .invoice-editor-actions .more-popover .clear-invoice-btn:hover{
  border:1px solid #fca5a5;
  background:#ffe4e6;
  color:#991b1b;
}

/* Step 8E: compact desktop hierarchy with local-only send handoffs. */
.send-menu{ position:relative; }
.send-menu>summary{
  list-style:none;
  cursor:pointer;
  border:1px solid #dfe3ea;
  background:#fff;
  border-radius:12px;
  padding:9px 13px;
  font-weight:700;
  font-size:13px;
}
.send-menu>summary::-webkit-details-marker{ display:none; }
.send-menu>summary::after{ content:"⌄"; margin-left:7px; color:var(--muted); }
.send-popover{
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  width:min(310px,calc(100vw - 24px));
  padding:8px;
  background:#fff;
  border:1px solid #e2e7ee;
  border-radius:14px;
  box-shadow:0 18px 45px rgba(16,24,40,.14);
  display:grid;
  gap:5px;
  z-index:90;
}
.send-popover .btn{ width:100%; text-align:left; justify-content:flex-start; }
.send-menu-note{
  margin:3px 4px 2px;
  padding-top:8px;
  border-top:1px solid #e5e7eb;
  color:#667085;
  font-size:10.5px;
  line-height:1.45;
}
.workspace > .toolbar .invoice-editor-actions .more-popover{
  max-height:min(420px,calc(100vh - 170px));
  max-height:min(420px,calc(100dvh - var(--invoice-fragment-clearance,142px) - 16px));
  overflow-y:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
}
.preview-tools{
  z-index:13;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:6px;
  min-height:50px;
  padding:8px 14px;
  border-bottom:1px solid rgba(100,116,139,.20);
  background:rgba(238,240,244,.94);
  backdrop-filter:saturate(135%) blur(16px);
  -webkit-backdrop-filter:saturate(135%) blur(16px);
}
.preview-tools .btn{
  min-width:44px;
  min-height:44px;
  padding:6px 10px;
  border-radius:9px;
  background:rgba(255,255,255,.86);
  font-size:12px;
}
.preview-tools .zoom-label{
  min-width:var(--nb-doc-zoom-label-width);
  color:#475467;
  font-size:var(--nb-doc-zoom-label-size);
  font-weight:var(--nb-doc-zoom-label-weight);
  text-align:center;
}
@media screen and (min-width:761px){
  .preview-mode-guide{
    align-items:center;
    min-width:0;
    max-width:170px;
    padding:7px 9px;
  }
  .preview-mode-dot{ margin-top:0; }
  #preview-edit-hint{
    position:absolute;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0,0,0,0);
    white-space:nowrap;
    border:0;
  }
}
@media screen and (min-width:1101px) and (max-height:599px){
  .preview-tools{
    position:sticky;
    top:calc(var(--invoice-fragment-clearance,300px) - 12px);
  }
}
/* Keep the document in view while the original sidebar scrolls with the page.
   Short viewports retain full-page output so wrapped chrome cannot trap it. */
@media screen and (min-width:1101px) and (min-height:600px){
  #invoice-editor > .preview{
    position:sticky;
    top:var(--invoice-fragment-clearance,300px);
    align-self:start;
    height:calc(100dvh - var(--invoice-fragment-clearance,300px) - 12px);
    min-height:0;
    overflow:hidden;
  }
  #invoice-editor .preview-scroll{
    flex:1;
    min-height:0;
    overflow:auto;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
  }
  #invoice-editor .preview-tools{ position:relative; top:auto; flex:none; }
}
@media screen and (max-width:520px){
  .editor-overview-head{ align-items:stretch; }
  .editor-overview-head strong{ align-self:center; }
  .workspace > .toolbar .invoice-editor-actions{ position:relative; }
  .send-menu{ position:static; }
  .send-popover{ left:0; right:0; width:auto; }
}
@media print{
  .preview-tools{ display:none!important; }
}

@media screen and (max-width:1020px){
  .workspace > .toolbar .invoice-editor-actions{
    width:100%;
    justify-content:flex-end;
    padding-top:6px;
    border-top:1px solid rgba(255,255,255,.08);
  }
}
@media screen and (max-width:700px){
  .workspace > .toolbar .invoice-editor-actions{
    justify-content:flex-start;
  }
  .workspace > .toolbar .invoice-editor-actions .save-chip{
    width:100%;
    order:-1;
  }
  .workspace > .toolbar .invoice-editor-actions #btn-pdf{ flex:1 1 auto; }
}

/* Entry is progressively enhanced only after the existing app initializes. */
@media screen{
  #invoice-editor[hidden], .tool-intro[hidden], .seo-content[hidden],
  #invoice-workspace-back[hidden]{ display:none!important; }
}
#invoice-editor{ scroll-margin-top:90px; }
@media print{
  #invoice-editor[hidden]{ display:block!important; }
  #invoice-workspace-back{ display:none!important; }
}

/* Step 8F tablet form/Preview surfaces. Keep the real Design dialog mounted
   inside its original form owner; collapse only other form children in Preview.
   Phone direct-canvas/Fields ownership is defined by the following rule. */
@media screen and (min-width:761px) and (max-width:1100px){
  #invoice-editor[data-nb-primary-surface]{
    display:block;
    height:auto;
    min-height:0;
    overflow:visible;
  }
  #invoice-editor[data-nb-primary-surface] > .toolbar{
    position:sticky;
    top:var(--invoice-header-clearance,76px);
  }
  #invoice-editor[data-nb-primary-surface] > .editor{
    width:100%;
    min-height:0;
    overflow:visible;
    overscroll-behavior:auto;
    scrollbar-gutter:auto;
  }
  #invoice-editor[data-nb-primary-surface="edit"] > .preview{ display:none; }
  #invoice-editor[data-nb-primary-surface="preview"] > .editor{
    height:0;
    padding:0;
    background:transparent;
  }
  #invoice-editor[data-nb-primary-surface="preview"] #editor-form > :not(#invoice-design-panel){
    display:none!important;
  }
  #invoice-editor[data-nb-primary-surface="preview"] > .preview{
    width:100%;
    min-height:0;
    overflow:visible;
    overscroll-behavior:auto;
  }
  #invoice-editor[data-nb-primary-surface="preview"] .preview-scroll{
    flex:none;
    min-width:0;
    min-height:0;
    overflow-x:auto;
    overflow-y:hidden;
    overscroll-behavior-x:contain;
    scrollbar-gutter:auto;
  }
}

/* Step 8F phone Edit owns one visible primary surface: the real document
   canvas by default, with the original full form reachable through Fields.
   The original Design modal stays under the same form owner, even when its
   other children are hidden. No secondary document or stored state is added. */
.phone-edit-surfaces{ display:none; }
@media screen and (max-width:760px){
  #invoice-editor[data-nb-primary-surface="edit"] .phone-edit-surfaces{
    display:inline-flex;
    order:4;
    align-items:stretch;
    align-self:stretch;
    gap:4px;
    width:100%;
    min-width:0;
    padding:3px;
    border:1px solid var(--nb-border);
    border-radius:12px;
    background:var(--nb-surface);
  }
  .workspace > .toolbar .phone-edit-surfaces .btn{
    flex:1 1 0;
    min-width:0;
    min-height:44px;
    padding:9px 12px;
    border:1px solid transparent;
    border-radius:9px;
    background:var(--nb-surface);
    color:var(--nb-ink);
    font-size:12px;
    font-weight:740;
    white-space:normal;
  }
  .workspace > .toolbar .phone-edit-surfaces .btn[aria-pressed="true"]{
    border-color:var(--nb-green-ink);
    background:var(--nb-green);
    color:var(--nb-ink);
  }
  .workspace > .toolbar .phone-edit-surfaces .btn:focus-visible{
    outline:3px solid var(--nb-green-ink);
    outline-offset:2px;
  }
  .workspace > .toolbar .invoice-editor-actions{
    order:5;
  }
  #invoice-editor[data-nb-primary-surface="edit"][data-nb-phone-edit-surface="fields"] > .preview{
    display:none;
  }
  #invoice-editor[data-nb-primary-surface="preview"] > .editor,
  #invoice-editor[data-nb-primary-surface="edit"][data-nb-phone-edit-surface="canvas"] > .editor{
    height:0;
    min-height:0;
    padding:0;
    background:transparent;
    overflow:visible;
  }
  #invoice-editor[data-nb-primary-surface="preview"] #editor-form > :not(#invoice-design-panel),
  #invoice-editor[data-nb-primary-surface="edit"][data-nb-phone-edit-surface="canvas"] #editor-form > :not(#invoice-design-panel){
    display:none!important;
  }
  #invoice-editor[data-nb-primary-surface="preview"] > .preview,
  #invoice-editor[data-nb-primary-surface="edit"][data-nb-phone-edit-surface="canvas"] > .preview{
    min-height:0;
    overflow:visible;
  }
  #invoice-editor[data-nb-primary-surface="preview"] .preview-scroll,
  #invoice-editor[data-nb-primary-surface="edit"][data-nb-phone-edit-surface="canvas"] .preview-scroll{
    flex:none;
    min-height:0;
    overflow-x:auto;
    overflow-y:hidden;
    overscroll-behavior-x:contain;
    scrollbar-gutter:auto;
  }
}

/* Dismiss and cancel controls must not inherit the green glass/white default.
   The Design ×, sample × and inline canvas × share a high-contrast red
   treatment with the existing text Cancel/Keep my invoice actions. Keep
   affirmative Done/Apply buttons NineBrief green and touch targets >=44px. */
#invoice-design-close,
#invoice-preset-close,
.invoice-editor-popover .invoice-editor-close,
#invoice-preset-cancel,
#delivery-review-cancel{
  min-width:44px;
  min-height:44px;
  border:1px solid #b42318;
  background:#b42318;
  color:#fff;
  box-shadow:0 3px 12px rgba(180,35,24,.18);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
#invoice-design-close,
#invoice-preset-close,
.invoice-editor-popover .invoice-editor-close{
  display:grid;
  place-items:center;
  padding:0;
  font-size:24px;
  font-weight:800;
  line-height:1;
}
#invoice-design-close:hover,
#invoice-preset-close:hover,
.invoice-editor-popover .invoice-editor-close:hover,
#invoice-preset-cancel:hover,
#delivery-review-cancel:hover{
  border-color:#912018;
  background:#912018;
  color:#fff;
}
#invoice-design-close:focus-visible,
#invoice-preset-close:focus-visible,
.invoice-editor-popover .invoice-editor-close:focus-visible,
#invoice-preset-cancel:focus-visible,
#delivery-review-cancel:focus-visible{
  outline:3px solid #fecaca;
  outline-offset:2px;
}

/* Business designs reuse the Invoice renderer and its existing presentation settings. */
.sheet:is(.tpl-agency,.tpl-software,.tpl-retail,.tpl-construction,.tpl-professional-services,.tpl-minimal-corporate,.tpl-executive) :is(.inv-head>div,.inv-meta,.inv-meta div,.inv-titleblock){min-width:0;overflow-wrap:anywhere}
.tpl-agency .inv-head{flex-direction:column-reverse;gap:32px;border:0;padding-bottom:28px}
.tpl-agency .inv-titleblock{text-align:left;border-left:8px solid var(--iacc);padding-left:20px}
.tpl-agency .inv-title{font-size:3.5em;letter-spacing:-.045em;font-weight:800}
.tpl-agency .inv-meta{justify-content:flex-start;gap:16px 28px}
.tpl-agency .inv-bizname{font-size:1.6em;font-weight:600}
.tpl-agency .inv-parties{padding:20px 0;border-top:1px solid var(--line-color)}
.tpl-agency .inv-table th{border-bottom:2px solid var(--iacc)}
.tpl-agency .inv-table td{padding-top:18px;padding-bottom:18px}
.tpl-agency .t-total{border-top:0;border-left:5px solid var(--iacc);padding:12px 16px}
.tpl-agency .t-total dd{font-size:1.6em;letter-spacing:-.025em}
.tpl-agency .notes{border-top:1px solid var(--line-color);padding-top:20px}
.tpl-software .inv-head{display:grid;grid-template-columns:1fr 1fr;gap:24px;border:1px solid var(--line-color);border-top:3px solid var(--iacc);padding:20px}
.tpl-software .inv-titleblock{border-left:1px solid var(--line-color);padding-left:20px}
.tpl-software .inv-title{font-size:2em;letter-spacing:-.025em}
.tpl-software .inv-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;text-align:left}
.tpl-software .inv-meta div{border-top:1px solid var(--line-color);padding-top:8px}
.tpl-software .inv-table th{text-transform:none;letter-spacing:0}
.tpl-software .inv-table td{padding-top:12px;padding-bottom:12px}
.tpl-software .inv-totals{border:1px solid var(--line-color);padding:16px}
.tpl-software .notes{border-left:1px solid var(--iacc);padding-left:16px}
.tpl-retail .inv-head{flex-direction:row-reverse;gap:28px;border-bottom:4px double var(--iacc);padding-bottom:20px}
.tpl-retail .inv-head>div{flex:1;text-align:right}
.tpl-retail .inv-head>.inv-titleblock{text-align:left}
.tpl-retail .inv-logo{margin-left:auto;object-position:right center}
.tpl-retail .inv-title{font-size:2.1em;letter-spacing:0}
.tpl-retail .inv-meta{justify-content:flex-start;text-align:left}
.tpl-retail .inv-table th{border-top:2px solid var(--iacc);border-bottom:2px solid var(--iacc)}
.tpl-retail .inv-table td{padding:8px 7px;border-right:1px solid var(--line-color)}
.tpl-retail .inv-table td:last-child{border-right:0;font-weight:700}
.tpl-retail .t-total{border-top:4px double var(--iacc);border-bottom:1px solid var(--iacc);padding:12px 0}
.tpl-retail .notes{border-top:1px solid var(--line-color);padding-top:12px}

.invoice-preset-choices label{display:grid;grid-template-columns:18px minmax(0,1fr);border-radius:var(--nb-radius-sm)}
.invoice-preset-thumb{grid-column:1/-1;display:block;overflow:hidden;aspect-ratio:794 / 1123;max-height:220px;border:1px solid var(--nb-border);background:var(--nb-white);pointer-events:none}
.invoice-preset-thumb>.sheet{width:794px;min-width:794px;max-width:none;min-height:1123px;margin:0 auto;box-shadow:none;transform:none;text-align:left}
.invoice-preset-choices label:hover{box-shadow:0 0 0 1px var(--nb-ink)}
.invoice-preset-choices label:has(input:focus-visible){outline:3px solid var(--nb-green-ink);outline-offset:3px}

.tpl-agency .inv-totals{min-width:420px;max-width:100%}
.tpl-agency .t-total dt{flex-shrink:0;max-width:40%}
@media print{.sheet:is(.tpl-agency,.tpl-software,.tpl-retail,.tpl-construction,.tpl-professional-services,.tpl-minimal-corporate,.tpl-executive) .inv-table tr{break-inside:avoid;page-break-inside:avoid}}

.sheet:is(.tpl-agency,.tpl-software,.tpl-retail,.tpl-construction,.tpl-professional-services,.tpl-minimal-corporate,.tpl-executive) .inv-table td.c-unit{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere}
.invoice-preset-thumb{justify-self:center}
@media(max-width:700px){.invoice-preset-choices{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Construction, Professional Services and Minimal Corporate reuse Invoice markup.
   Executive remains the existing centered composition above. */
.tpl-construction .inv-head{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.85fr);align-items:end;gap:28px;border:0;border-left:6px solid var(--iacc);padding:0 0 0 20px}
.tpl-construction .inv-titleblock{text-align:left}
.tpl-construction .inv-title{font-size:2.3em;letter-spacing:-.025em}
.tpl-construction .inv-meta{display:grid;grid-template-columns:1fr;gap:10px;text-align:left}
.tpl-construction .inv-parties{border-top:2px solid var(--iacc);border-bottom:2px solid var(--iacc);padding:24px 0;margin:24px 0}
.tpl-construction .inv-table th{border-top:2px solid #121212;border-bottom:2px solid #121212;letter-spacing:0}
.tpl-construction .inv-table td{padding:11px 8px;border-bottom:1px solid var(--line-color)}
.tpl-construction .t-total{border:2px solid #121212;padding:12px}
.tpl-construction .notes{border-left:3px solid var(--iacc);padding-left:16px}
.tpl-professional-services .inv-head{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);align-items:start;gap:36px;border-top:1px solid var(--iacc);border-bottom:1px solid #121212;padding:24px 0 32px}
.tpl-professional-services .inv-bizname{font-size:2em;font-weight:500;line-height:1.2;letter-spacing:-.015em}
.tpl-professional-services .inv-titleblock{text-align:left;border-left:1px solid var(--line-color);padding-left:20px}
.tpl-professional-services .inv-title{font-size:1.7em;font-weight:500;letter-spacing:.02em;text-transform:none}
.tpl-professional-services .inv-meta{display:grid;grid-template-columns:1fr;gap:12px;text-align:left}
.tpl-professional-services .inv-parties{padding:28px 0}
.tpl-professional-services .inv-table th{border-top:1px solid #121212;border-bottom:1px solid #121212;text-transform:none;letter-spacing:0}
.tpl-professional-services .inv-table td{padding:14px 8px}
.tpl-professional-services .t-total{border-top:1px solid #121212;border-bottom:3px double #121212;padding:14px 0}
.tpl-professional-services .notes{border-top:1px solid var(--line-color);padding-top:20px}
.tpl-minimal-corporate{--iacc:#121212}
.tpl-minimal-corporate .inv-head{flex-direction:column;gap:36px;border:0;padding-bottom:24px}
.tpl-minimal-corporate .inv-bizname{font-size:1.4em;font-weight:500}
.tpl-minimal-corporate .inv-titleblock{width:100%;text-align:left}
.tpl-minimal-corporate .inv-title{font-size:3em;font-weight:400;letter-spacing:-.035em}
.tpl-minimal-corporate .inv-meta{justify-content:flex-start;text-align:left;gap:16px 28px}
.tpl-minimal-corporate .inv-parties{padding:8px 0 36px}
.tpl-minimal-corporate .inv-table th{border:0;border-bottom:1px solid #121212;text-transform:none;letter-spacing:0}
.tpl-minimal-corporate .inv-table td{border:0;padding:18px 8px}
.tpl-minimal-corporate .inv-totals{width:100%;max-width:none;margin-top:28px}
.tpl-minimal-corporate .t-total{border-top:1px solid #121212;padding:18px 0}
.tpl-minimal-corporate .t-total dd{font-size:2em;font-weight:500;letter-spacing:-.035em}
.tpl-minimal-corporate .notes{border:0;padding-top:24px}
@media print{.sheet:is(.tpl-construction,.tpl-professional-services,.tpl-minimal-corporate,.tpl-executive) .notes h3{break-after:avoid;page-break-after:avoid}}

/* The chooser owns scrolling; the existing renderer owns document colors. */
.invoice-preset-color-tools{margin:12px 0;font-size:13px;font-weight:650}
.invoice-preset-color-row,.invoice-preset-colors{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.invoice-preset-color-row{margin-top:8px}
.invoice-preset-swatch{width:44px;height:44px;padding:8px;border:1px solid var(--nb-border);border-radius:10px;background:var(--nb-white);cursor:pointer}
.invoice-preset-swatch::before{content:'';display:block;width:100%;height:100%;border-radius:5px;background:var(--swatch)}
.invoice-preset-swatch:hover{border-color:var(--nb-ink);box-shadow:0 0 0 1px var(--nb-ink)}
.invoice-preset-swatch[aria-pressed=true]{border:2px solid var(--nb-ink);box-shadow:inset 0 0 0 2px var(--nb-white)}
.invoice-preset-color-row input[type=color]{width:96px;height:44px;padding:5px;border:1px solid var(--nb-border);border-radius:10px;background:var(--nb-white);cursor:pointer}
.invoice-preset-details{margin-top:14px}
.invoice-preset-details>summary{min-height:44px;display:list-item;align-content:center;cursor:pointer;font-weight:650;font-size:13px}
.invoice-preset-dialog :is(input,button,summary):focus-visible{outline:3px solid var(--nb-green-ink);outline-offset:2px}
@media(forced-colors:active){.invoice-preset-dialog :is(input,button,summary):focus-visible{outline-color:Highlight}.invoice-preset-swatch[aria-pressed=true]{border-color:Highlight}}

/* Original business-design bands follow the selected table-header palette. */
.tpl-agency.th-filled .inv-titleblock{background:var(--th-bg)!important;color:var(--th-color);border:0;padding:24px;width:100%}
.tpl-agency.th-filled .inv-titleblock .inv-title{color:var(--th-color)}
.tpl-software.th-filled .inv-head{background:var(--th-bg);color:var(--th-color);border:0;padding:24px}
.tpl-software.th-filled .inv-head :is(.inv-title,.inv-bizname,.muted){color:var(--th-color)}
.tpl-software.th-filled .inv-titleblock{border-left-color:currentColor}
.tpl-retail.th-filled .inv-head{border-top:10px solid var(--th-bg);padding-top:22px}
.tpl-construction.th-filled .inv-head{border-left-color:var(--th-bg)}
.tpl-professional-services.th-filled .inv-head{border-top:8px solid var(--th-bg)}

.tpl-studio.th-filled .inv-titleblock{background:var(--th-bg)!important;color:var(--th-color)!important}
.tpl-studio.th-filled .inv-titleblock :is(.inv-title,.inv-meta dt,.inv-meta dd){color:var(--th-color)!important}

.tpl-classicleft.th-filled .inv-table th{background:var(--th-bg)!important;color:var(--th-color)!important;border-bottom:0!important;opacity:1}

/* Keep status readable when print cleanup removes editable backgrounds. */
:is(.tpl-agency,.tpl-software,.tpl-studio).th-filled .inv-titleblock .pill{background:#fff!important;color:#374151!important}

/* Live-only contact forms; printed documents retain their original text layout. */
.canvas-party-fields{display:none;}
@media screen{
  .sheet.edit-mode .canvas-party-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:8px;text-align:left;}
  .sheet.edit-mode .inv-biz>.inv-line,.sheet.edit-mode .bill-to>.inv-line{display:none;}
  .canvas-party-field{display:flex;flex-direction:column;gap:3px;min-width:0;font-size:max(11px,calc(var(--invoice-canvas-target-size,44px)*.25));font-weight:500;}
  .canvas-party-wide{grid-column:1/-1;}
  .sheet.edit-mode .canvas-inline-input{min-height:var(--invoice-canvas-target-size,44px);font-size:max(13px,calc(var(--invoice-canvas-target-size,44px)*.32));}
  .sheet.edit-mode .inv-bizname.canvas-inline-input,.sheet.edit-mode .bill-name.canvas-inline-input{font-size:max(1.4em,calc(var(--invoice-canvas-target-size,44px)*.32));}
  .canvas-party-field .canvas-inline-input{font-weight:400;margin:0;}
  .pdf-exporting .canvas-party-fields{display:none!important;}
  .pdf-exporting .sheet.edit-mode .inv-biz>.inv-line,.pdf-exporting .sheet.edit-mode .bill-to>.inv-line{display:block;}
}

/* Live editing is a form on paper. Flatten only layout wrappers, keeping the
   original controls, bindings and document DOM for clean preview and export. */
@media screen and (min-width:1101px){
  #invoice-editor{grid-template-columns:minmax(320px,360px) minmax(0,1fr);}
}
@media screen{
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting){
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:24px 28px;
    align-content:start;
    background:var(--nb-white);
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting)>*{grid-column:1/-1;min-width:0;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) :is(.inv-head,.inv-brand,.inv-parties){display:contents!important;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) :is(.inv-head,.inv-brand)::before,
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) :is(.inv-head,.inv-brand)::after{display:none;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) :is(.canvas-logo-upload,.inv-logo){
    grid-column:1;grid-row:1;align-self:start;justify-self:start;margin:0;
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-logo-upload{
    width:max(190px,calc(var(--invoice-canvas-target-size,44px)*3));max-width:100%;
    min-height:max(92px,calc(var(--invoice-canvas-target-size,44px)*1.7));
    font-size:max(14px,calc(var(--invoice-canvas-target-size,44px)*.35));
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-titleblock{
    display:block!important;grid-column:2;grid-row:1;width:auto!important;min-width:0;margin:0;padding:0!important;
    border:0!important;text-align:right!important;background:transparent;color:var(--nb-ink);
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-title{font-size:max(26px,calc(var(--invoice-canvas-target-size,44px)*.6))!important;color:var(--nb-ink);}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-meta{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important;
    text-align:right!important;margin:12px 0 0!important;
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-meta>div{min-width:0;border:0;padding:0;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-meta dt{font-size:max(10px,calc(var(--invoice-canvas-target-size,44px)*.23))!important;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-meta dd{font-size:max(12px,calc(var(--invoice-canvas-target-size,44px)*.28))!important;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) :is(.inv-biz,.bill-to){
    grid-row:2;align-self:start;min-width:0;max-width:none;width:auto;
    padding:20px 0 0!important;margin:0;border:0!important;border-top:1px solid var(--nb-border)!important;
    background:transparent;color:var(--nb-ink);text-align:left;box-shadow:none;
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-biz{grid-column:1;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .bill-to{grid-column:2;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .bill-to>.inv-label{display:none;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) :is(.inv-biz,.bill-to)::before{
    content:attr(data-canvas-party-label);position:static;display:block;
    max-width:none;padding:0;margin:0 0 12px;border:0;border-radius:0;
    background:transparent;color:var(--nb-ink);font:700 max(14px,calc(var(--invoice-canvas-target-size,44px)*.32)) var(--nb-font-ui);
    letter-spacing:0;white-space:normal;
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .party-extra{
    grid-column:1/-1;max-width:none;text-align:left;margin:0;
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) [data-edit-section]{
    outline:none;border-radius:0;box-shadow:none;
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) [data-edit-section]:hover{background:transparent;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) [data-edit-section]:not(.bill-to)::before{display:none;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-party-fields{gap:12px 8px;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-party-field{color:var(--nb-muted);}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-inline-input{
    border:1px solid var(--nb-muted-light);border-radius:6px;background:var(--nb-white);
    box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none;font-weight:400;
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-inline-input:hover{border-color:var(--nb-muted);}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-inline-input:focus{
    border-color:var(--nb-green-ink);outline:2px solid var(--nb-green-ink);outline-offset:2px;
    background:var(--nb-white);
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) :is(.inv-bizname,.bill-name).canvas-inline-input{
    font-size:max(14px,calc(var(--invoice-canvas-target-size,44px)*.32))!important;
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .invoice-items-section{
    margin:0;padding-top:20px;border-top:1px solid var(--nb-border);
  }
}
@media screen and (max-width:900px){
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting){grid-template-columns:minmax(0,1fr);}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-titleblock{grid-column:1;grid-row:2;text-align:left!important;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-meta{text-align:left!important;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-biz{grid-column:1;grid-row:3;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .bill-to{grid-column:1;grid-row:4;}
}
@media screen and (forced-colors:active){
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-inline-input:focus{outline-color:Highlight;}
}
/* Canvas controls are presentation only; clean preview and export retain the document. */
.canvas-bottom-fields,.canvas-edit-only,.canvas-item-detail,.canvas-item-commands{display:none;}
@media screen{
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-display{display:none;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-row{cursor:default;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-row:hover{outline:none;background:transparent;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-row td{vertical-align:top;padding:12px 6px!important;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-row .canvas-inline-input{width:100%;min-width:0;box-sizing:border-box;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-detail{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;margin-top:10px;}
  .canvas-item-media{display:flex;flex-direction:column;gap:6px;max-width:160px;}
  .canvas-item-media img{width:64px;height:64px;object-fit:contain;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-commands{display:flex;gap:6px;margin-top:8px;}
  .canvas-item-commands button{min-width:var(--invoice-canvas-target-size,44px);min-height:var(--invoice-canvas-target-size,44px);font-size:max(18px,calc(var(--invoice-canvas-target-size,44px)*.4));padding:4px;}
  .canvas-item-detail textarea{align-self:start;}
  .canvas-item-media button{min-height:var(--invoice-canvas-target-size,44px);font-size:max(12px,calc(var(--invoice-canvas-target-size,44px)*.28));white-space:normal;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .preview-add-item{min-height:var(--invoice-canvas-target-size,44px);font-size:max(14px,calc(var(--invoice-canvas-target-size,44px)*.32));}
}
@media screen and (max-width:760px){
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-table{display:block;width:100%;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-table :is(colgroup,thead){display:none;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-table tbody{display:grid;gap:28px;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;padding:20px 0;border-top:2px solid var(--line-color);}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-row td{display:block;width:auto!important;min-width:0;padding:0;border:0;text-align:left;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-row .c-desc{grid-column:1/-1;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) [data-canvas-column-label]::before{content:attr(data-canvas-column-label);display:block;margin-bottom:8px;font-size:max(12px,calc(var(--invoice-canvas-target-size,44px)*.28));font-weight:600;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-row .c-amount{font-size:max(14px,calc(var(--invoice-canvas-target-size,44px)*.32));font-weight:700;}
}
@media screen and (min-width:1101px){
  #invoice-editor[data-nb-primary-surface="edit"] :is(#card-parties,.canvas-duplicate-field,#items-list,#btn-add-item,#card-items .totals,.extra-block[data-sec="notes"],.extra-block[data-sec="terms"],.extra-block[data-sec="signature"]){display:none;}
  #invoice-editor[data-nb-primary-surface="edit"] [data-editor-jump="card-parties"]{display:none;}
}
@media screen{
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) :is(.canvas-direct-display,.canvas-bottom-display){display:none!important;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-edit-only{display:block;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-bottom-fields{display:grid;grid-column:1/-1;gap:24px;margin-top:12px;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-bottom-section{display:grid;gap:12px;border-top:1px solid var(--nb-border);padding-top:20px;min-width:0;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-bottom-section>button{
    justify-self:start;max-width:100%;white-space:normal;
    font-size:max(12px,calc(var(--invoice-canvas-target-size,44px)*.28));
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-bottom-section h3{margin:0;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) textarea.canvas-inline-input{min-height:120px;resize:vertical;white-space:pre-wrap;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-direct-control{width:100%;min-width:0;text-align:left;}
}

/* Solid action surfaces keep the workspace readable without translucent layers. */
.workspace > .toolbar{
  --nb-doc-toolbar-bg:var(--nb-white);
  --nb-doc-toolbar-color:var(--nb-ink);
  --nb-doc-toolbar-button-bg:var(--nb-border);
  --nb-doc-toolbar-button-color:var(--nb-ink);
  --nb-doc-toolbar-button-border:1px solid var(--nb-muted-light);
  --nb-doc-toolbar-button-size:14px;
  --nb-doc-toolbar-button-hover-bg:var(--nb-surface);
  --nb-doc-toolbar-button-hover-color:var(--nb-ink);
  --nb-doc-toolbar-button-hover-border:1px solid var(--nb-green);
  background:var(--nb-white);color:var(--nb-ink);border-bottom:1px solid var(--nb-border);
}
.workspace > .toolbar #preview-mode-guide.visually-hidden{
  position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;
  overflow:hidden;clip-path:inset(50%);white-space:nowrap;
}
.workspace > .toolbar .invoice-workspace-modes{
  background:var(--nb-white);border-color:var(--nb-border);
}
.workspace > .toolbar .invoice-workspace-modes .workspace-mode-button{
  background:var(--nb-border);color:var(--nb-ink);border-color:transparent;
  font-size:14px;box-shadow:none;backdrop-filter:none;
}
.workspace > .toolbar .invoice-workspace-modes .workspace-mode-button[aria-pressed="true"]{
  background:var(--nb-green);color:var(--nb-ink);border:var(--invoice-selected-border-width,1px) solid var(--invoice-selected-border-color,var(--nb-green-ink));
}
.workspace > .toolbar .invoice-workspace-modes .workspace-mode-button:hover{
  background:var(--nb-surface);color:var(--nb-ink);border-color:var(--nb-green-ink);
}
.workspace > .toolbar .invoice-workspace-modes .workspace-mode-button[aria-pressed="true"]:hover{
  background:var(--nb-green-strong);
}
.workspace > .toolbar :is(.btn,summary):focus-visible{
  outline:3px solid var(--nb-green-ink);outline-offset:3px;
}
.workspace > .toolbar #btn-pdf{
  background:var(--nb-green);color:var(--nb-ink);border:1px solid var(--nb-green);
}
.workspace > .toolbar #btn-pdf:hover{
  background:var(--nb-green-strong);border-color:var(--nb-green-strong);
}
.workspace > .toolbar .invoice-editor-actions .save-chip{color:var(--nb-muted);}
.workspace > .toolbar #invoice-workspace-back{text-decoration:none;}
@media (forced-colors:active){
  .invoice-workspace-modes{
    --invoice-selected-border-width:2px;
    --invoice-selected-border-color:Highlight;
  }
}

.workspace > .toolbar #preview-mode-guide.visually-hidden #preview-edit-hint{
  position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);
}
.workspace > .toolbar .invoice-editor-actions :is(.send-menu,.more-menu)>summary{
  color:var(--nb-ink);background:var(--nb-border);border:1px solid var(--nb-muted-light);font-size:14px;
}
.workspace > .toolbar .invoice-editor-actions :is(.send-menu,.more-menu)>summary::after{color:currentColor;}
.workspace > .toolbar .invoice-editor-actions :is(.send-menu,.more-menu)>summary:hover,
.workspace > .toolbar .invoice-editor-actions :is(.send-menu,.more-menu)[open]>summary{
  color:var(--nb-ink);background:var(--nb-green);border-color:var(--nb-green);
}

/* Compact, visible original controls; preserve 44 CSS-pixel pointer targets. */
.workspace > .toolbar .invoice-editor-actions :is(.send-menu,.more-menu)>summary{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;line-height:1.25;padding:6px 12px;
}
.workspace > .toolbar .invoice-editor-actions :is(.send-menu,.more-menu)>summary::after{
  content:"";display:block;width:6px;height:6px;flex:0 0 6px;margin:0 0 3px;
  border:solid currentColor;border-width:0 1.5px 1.5px 0;transform:rotate(45deg);
}
@media screen and (min-width:1101px){
  .workspace > .toolbar{display:grid;grid-template-columns:minmax(296px,336px) auto minmax(0,1fr);column-gap:12px;align-items:center;}
  .workspace > .toolbar #invoice-workspace-back{grid-column:1;grid-row:1;justify-self:start;}
  .workspace > .toolbar .invoice-workspace-modes{grid-column:2;grid-row:1;justify-self:start;}
  .workspace > .toolbar .invoice-editor-actions{grid-column:3;grid-row:1;justify-content:flex-end;}
  .workspace > .toolbar > .spacer{display:none;}
}
.canvas-logo-block{display:contents;}
.canvas-logo-actions{display:none;}
@media screen{
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-logo-block{
    display:flex;flex-direction:column;align-items:flex-start;gap:8px;grid-column:1;grid-row:1;min-width:0;
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-logo-actions{display:flex;flex-wrap:wrap;gap:6px;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .preview-adjust-btn{
    box-sizing:border-box;min-height:var(--invoice-canvas-target-size,44px);padding:0 8px;
    border-radius:6px;box-shadow:none;background:var(--nb-border);border-color:var(--nb-muted-light);color:var(--nb-ink);
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-commands button{
    display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--invoice-canvas-target-size,44px);
    width:var(--invoice-canvas-target-size,44px);height:var(--invoice-canvas-target-size,44px);padding:0;line-height:1;
  }
  .canvas-item-commands button svg{display:block;width:calc(var(--invoice-canvas-target-size,44px)*.4091);height:calc(var(--invoice-canvas-target-size,44px)*.4091);pointer-events:none;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) input.canvas-inline-input,
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) select.canvas-inline-input{
    height:var(--invoice-canvas-target-size,44px);padding-top:0;padding-bottom:0;box-sizing:border-box;
  }
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-item-row .c-amount{vertical-align:top;line-height:var(--invoice-canvas-target-size,44px);font-size:max(13px,calc(var(--invoice-canvas-target-size,44px)*.32));}
}

/* Readable units use the item editing area, never the narrow printed column. */
@media screen{
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .inv-table .c-unit{display:none;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-unit-field{display:grid;gap:6px;max-width:100%;margin-top:12px;font-size:max(12px,calc(var(--invoice-canvas-target-size,44px)*.28));text-align:left;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-unit-field .canvas-inline-input{width:100%;}
}

.invoice-example,.invoice-help-strip{margin:36px 0;padding:28px;border:1px solid var(--nb-border);border-radius:12px;background:var(--nb-white);}
.invoice-example h2,.invoice-help-strip h2{margin-top:0;}
.invoice-example table{width:100%;border-collapse:collapse;font-size:14px;}
.invoice-example caption{text-align:left;font-weight:700;margin:16px 0;}
.invoice-example th,.invoice-example td{padding:12px 8px;text-align:right;border-bottom:1px solid var(--nb-border);}
.invoice-example th:first-child{text-align:left;}
.invoice-example tfoot{font-weight:700;}
.invoice-help-strip a{display:inline-flex;align-items:center;min-height:44px;}
@media (max-width:600px){.invoice-example,.invoice-help-strip{padding:16px;}.invoice-example table{font-size:12px;}.invoice-example th,.invoice-example td{padding:10px 4px;}}

@media screen{
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-party-more{grid-column:1/-1;min-width:0;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-party-more>summary{min-height:var(--invoice-canvas-target-size,44px);align-content:center;cursor:pointer;font-size:max(12px,calc(var(--invoice-canvas-target-size,44px)*.28));color:var(--nb-green-ink);}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-party-extra-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 8px;}
  :root:not(.pdf-exporting) #sheet.edit-mode:not(.exporting) .canvas-party-more>summary:focus-visible{outline:2px solid var(--nb-green-ink);outline-offset:2px;}
}
@media screen and (min-width:1101px){
  #invoice-editor[data-nb-primary-surface="edit"] .editor #invoice-adjustments-settings{display:none;}
}

/* Landing examples are static renderer output; customer sheets retain their styles. */
.invoice-landing-links{display:flex;flex-wrap:wrap;gap:8px 24px;margin:24px 0 40px}
.invoice-landing-links a{display:inline-flex;align-items:center;min-height:44px;font-size:15px;font-weight:700}
.invoice-landing-section,.invoice-examples{margin:64px 0;scroll-margin-top:100px}
.invoice-section-intro{max-width:780px;margin-bottom:28px}
.invoice-example-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;align-items:start}
.invoice-design-example{min-width:0;padding:18px;border:1px solid var(--nb-border);border-radius:16px;background:var(--nb-white)}
.invoice-design-example>p{min-height:70px;margin-bottom:16px!important}
.invoice-example-expand>summary{min-height:44px;padding:8px 0;cursor:pointer;font-size:14px;font-weight:700;line-height:1.5}
.invoice-example-frame{width:100%;overflow:auto;background:var(--nb-white);position:relative;margin-top:12px}
.invoice-example-frame>.sheet{margin:0;transform-origin:top left;box-shadow:none;border-radius:0}
.invoice-example-frame[data-fitted="true"]{overflow:hidden}
.invoice-example-note{margin-top:22px!important}
.invoice-example-frame:focus-visible,.invoice-example-expand>summary:focus-visible{outline:3px solid var(--nb-link-light);outline-offset:3px}
.invoice-landing-section>p+p,.seo-grid article p+p{margin-top:14px}
@media(max-width:900px){.invoice-example-grid{grid-template-columns:1fr}.invoice-design-example>p{min-height:0}.invoice-example-frame{max-width:794px;margin-inline:auto}}
@media print{.invoice-examples,.invoice-landing-links{display:none!important}}

.invoice-design-example.is-expanded{grid-column:1/-1}
.invoice-example-size{min-height:44px;padding:8px 12px;border:1px solid var(--nb-border);border-radius:8px;color:var(--nb-link-light);background:var(--nb-white);font:inherit;font-size:14px;font-weight:700;cursor:pointer}
.invoice-example-size:hover{background:var(--nb-surface);border-color:var(--nb-link-light)}
.invoice-example-size:focus-visible{outline:3px solid var(--nb-link-light);outline-offset:3px}

/* Invoice landing composition. Shared V5 marketing tokens and shell own the
   brand; every selector stays outside the editable/printed customer document.
   :where() excludes example-paper descendants without outranking chapter styles. */
@media screen {
  .invoice-v5 .tool-intro.invoice-visual-hero {
    background:var(--nb-dark);
    color:var(--nb-white);
    padding:28px 0 80px;
    border-bottom:1px solid var(--nb-marketing-line);
  }
  .invoice-v5 .tool-intro-inner {
    width:min(1204px,calc(100% - 64px));max-width:none;padding:0;margin-inline:auto;
    display:grid;grid-template-columns:1.05fr 1fr;align-items:center;gap:40px 64px;
  }
  .invoice-v5 .tool-breadcrumb {grid-column:1/-1;justify-content:flex-start;margin:0;color:var(--nb-muted-light);font-size:11px;flex-wrap:wrap;}
  .invoice-v5 .tool-breadcrumb a {color:var(--nb-muted-light);}
  .invoice-v5 .tool-breadcrumb a:is(:hover,:focus-visible) {color:var(--nb-green);}
  .invoice-v5 .tool-intro-copy {max-width:none;margin:0;text-align:left;display:flex;flex-direction:column;align-items:flex-start;}
  .invoice-v5 .tool-eyebrow {color:var(--nb-link-light);font-size:11px;font-weight:800;letter-spacing:.14em;line-height:1.6;text-transform:uppercase;}
  .invoice-v5 .tool-intro h1 {font-size:clamp(44px,5vw,68px);font-weight:800;line-height:1.04;letter-spacing:-.065em;color:var(--nb-white);text-wrap:balance;}
  .invoice-v5 .tool-intro .tool-eyebrow {color:var(--nb-green);}
  .invoice-hero-promise {margin:16px 0 0;font-size:clamp(24px,2.5vw,34px);font-weight:750;line-height:1.16;letter-spacing:-.045em;color:var(--nb-green);text-wrap:balance;}
  .invoice-v5 .tool-intro-lede {margin:24px 0 0;max-width:47ch;font-size:17px;line-height:1.85;color:var(--nb-muted-light);text-wrap:pretty;}
  .invoice-v5 .tool-intro-actions {order:3;justify-content:flex-start;align-items:stretch;gap:12px;margin-top:28px;width:100%;}
  .invoice-v5 .intro-cta-primary,.invoice-hero-guide {
    display:inline-flex;align-items:center;justify-content:center;gap:12px;min-height:52px;padding:14px 22px;
    border:1px solid var(--nb-green);border-radius:var(--nb-radius-sm);font-size:14px;font-weight:750;line-height:1.45;text-decoration:none;
    transition:background .18s,color .18s,transform .18s,box-shadow .18s;
  }
  .invoice-v5 .intro-cta-primary {background:var(--nb-green);color:var(--nb-ink);}
  .invoice-hero-guide {background:transparent;color:var(--nb-green);}
  .invoice-v5 .intro-cta-primary:is(:hover,:focus-visible) {background:var(--nb-green-strong);border-color:var(--nb-green-strong);color:var(--nb-ink);transform:translateY(-2px);box-shadow:var(--nb-shadow);}
  .invoice-v5 .invoice-hero-guide:is(:hover,:focus-visible) {background:var(--nb-green);color:var(--nb-ink);text-decoration:none;}
  .invoice-v5 .tool-intro.invoice-visual-hero :is(a,button):focus-visible {outline-color:var(--nb-green);}
  .invoice-v5 .tool-proof {order:4;justify-content:flex-start;gap:8px 18px;width:auto;margin:20px 0 0;color:var(--nb-muted-light);font-size:11px;line-height:1.7;}
  .invoice-v5 .tool-proof span {white-space:normal;}
  .invoice-hero-photo {position:relative;min-width:0;margin:0;padding:0;background:transparent;border:0;}
  .invoice-hero-photo img {display:block;width:auto;height:auto;max-width:100%;max-height:520px;margin-inline:auto;object-fit:contain;border-radius:4px;box-shadow:0 0 28px color-mix(in srgb,var(--nb-white) 16%,transparent),0 24px 64px color-mix(in srgb,var(--nb-muted-light) 25%,transparent);}
  .invoice-hero-photo figcaption {margin-top:16px;font-size:12px;line-height:1.6;color:var(--nb-muted-light);text-align:center;}
  .invoice-v5 :is(.tool-intro,.seo-content) :is(a,button,summary):focus-visible {outline:3px solid var(--nb-link-light);outline-offset:5px;scroll-margin-block:120px;}

  .invoice-v5 .seo-content {background:var(--nb-white);border-top:0;}
  .invoice-v5 .seo-content-inner {display:flow-root;width:100%;max-width:none;margin:0;padding:0;}
  .invoice-content-width {width:min(1204px,calc(100% - 64px));margin-inline:auto;}
  .invoice-v5 .seo-content h2:not(:where(.sheet *)) {color:var(--nb-marketing-ink);font-size:clamp(32px,3.5vw,48px);font-weight:800;line-height:1.12;letter-spacing:-.055em;margin:12px 0 24px;text-wrap:balance;}
  .invoice-v5 .seo-content h3:not(:where(.sheet *)) {color:var(--nb-marketing-ink);font-weight:750;font-size:23px;line-height:1.25;letter-spacing:-.035em;margin:0 0 16px;text-wrap:balance;}
  .invoice-v5 .seo-content p:not(:where(.sheet *)),.invoice-v5 .seo-content li:not(:where(.sheet *)) {color:var(--nb-marketing-copy);font-size:15px;line-height:1.85;}
  .invoice-v5 .seo-content .tool-eyebrow {color:var(--nb-link-light);font-size:11px;font-weight:800;line-height:1.6;letter-spacing:.14em;}
  .invoice-v5 .seo-content :is(p,li):not(:where(.sheet *)) a {color:var(--nb-link-light);font-weight:700;text-decoration:underline;text-underline-offset:4px;}
  .invoice-v5 .seo-content :is(p,li):not(:where(.sheet *)) a:is(:hover,:focus-visible) {color:var(--nb-ink);text-decoration-thickness:2px;}
  .invoice-v5-introduction {padding:88px 0 80px;}
  .invoice-v5 .seo-content-lead {max-width:790px;margin:0 auto 44px;text-align:center;}
  .invoice-v5 .seo-content-lead p:not(.tool-eyebrow) {font-size:17px;}
  .invoice-v5 .seo-grid {gap:40px;margin:0;grid-template-columns:repeat(3,minmax(0,1fr));}
  .invoice-v5 .seo-grid article {padding:24px 0 0;background:transparent;border:0;border-top:1px solid var(--nb-marketing-line);border-radius:0;}
  .invoice-v5 .seo-grid h3 {font-size:19px;}
  .invoice-v5 .seo-grid :is(p,li) {font-size:14px;}

  .invoice-product-stage {padding:80px 0;background:var(--nb-marketing-deep);}
  .invoice-product-intro {display:grid;grid-template-columns:.7fr 1.3fr;gap:56px;align-items:center;}
  .invoice-v5 .invoice-product-stage h2 {color:var(--nb-white);max-width:12ch;}
  .invoice-v5 .invoice-product-stage p:not(.tool-eyebrow) {color:var(--nb-marketing-mint);font-size:17px;}
  .invoice-v5 .invoice-product-stage .tool-eyebrow {color:var(--nb-green);}
  .invoice-feature-media {min-width:0;margin:0;padding:28px;background:var(--nb-white);border:1px solid var(--nb-marketing-line);border-radius:var(--nb-radius-lg);}
  .invoice-feature-media img {display:block;width:100%;height:auto;border:1px solid var(--nb-border);border-radius:8px;}
  .invoice-feature-media figcaption {font-size:12px;line-height:1.7;color:var(--nb-muted);margin-top:16px;}
  .invoice-feature-media figcaption a {display:inline-flex;align-items:center;min-height:44px;color:var(--nb-link-light);font-weight:700;text-decoration:underline;text-underline-offset:4px;}
  .invoice-product-stage .invoice-feature-media {padding:20px;background:var(--nb-white);border:0;border-radius:24px 24px 6px 24px;box-shadow:var(--nb-shadow-dark);}

  .invoice-v5 .invoice-landing-links {gap:10px 32px;justify-content:center;margin:0;padding:28px 0;border-bottom:1px solid var(--nb-marketing-line);}
  .invoice-v5 .invoice-landing-links a {color:var(--nb-link-light);font-size:13px;min-height:44px;text-underline-offset:5px;}
  .invoice-v5 .invoice-examples {margin:0;padding:88px 0 96px;}
  .invoice-v5 .invoice-section-intro {max-width:780px;margin:0 auto 44px;text-align:center;}
  .invoice-v5 .invoice-example-grid {gap:22px;align-items:stretch;}
  .invoice-v5 .invoice-design-example {display:grid;grid-template-rows:subgrid;grid-row:span 4;row-gap:12px;padding:24px 18px 18px;background:var(--nb-white);border-color:var(--nb-border);border-radius:20px;}
  .invoice-v5 .invoice-design-example>h3 {grid-row:1;margin:0;}
  .invoice-v5 .invoice-design-example>p {grid-row:2;margin:0!important;}
  .invoice-v5 .invoice-design-example>.invoice-example-size {grid-row:3;justify-self:start;}
  .invoice-v5 .invoice-design-example>details {grid-row:4;min-width:0;}
  .invoice-v5 .invoice-design-example:nth-child(2) {background:var(--nb-ink);border-color:var(--nb-ink);}
  .invoice-v5 .invoice-design-example:nth-child(2)>h3 {color:var(--nb-white);}
  .invoice-v5 .invoice-design-example:nth-child(2)>p,.invoice-v5 .invoice-design-example:nth-child(2)>details>summary {color:var(--nb-muted-light);}
  .invoice-v5 .invoice-design-example:nth-child(2) .invoice-example-size {color:var(--nb-white);border-color:var(--nb-muted-light);}
  .invoice-v5 .invoice-design-example:nth-child(2) .invoice-example-size:is(:hover,:focus-visible) {color:var(--nb-ink);background:var(--nb-white);}
  .invoice-v5 .invoice-design-example>h3 {font-size:20px;}
  .invoice-v5 .invoice-design-example>p {font-size:13px;min-height:52px;}
  .invoice-v5 .invoice-example-size {background:transparent;border-color:var(--nb-link-light);color:var(--nb-link-light);border-radius:var(--nb-radius-sm);}
  .invoice-v5 .invoice-example-size:hover {background:var(--nb-white);}
  .invoice-v5 .invoice-example-frame {margin-top:20px;border:1px solid var(--nb-border);border-radius:4px;}
  .invoice-v5 .invoice-example-note {max-width:76ch;margin-inline:auto!important;text-align:center;font-size:13px!important;}

  .invoice-customize-stage {background:var(--nb-marketing-cream);padding:88px 0;}
  .invoice-v5 .invoice-customize {margin:0;}
  .invoice-feature-row {display:grid;grid-template-columns:1.1fr 1fr;gap:64px;align-items:center;margin:52px 0 0;}
  .invoice-feature-copy {min-width:0;}
  .invoice-feature-copy h3:not(:first-child) {margin-top:28px!important;font-size:20px!important;}
  .invoice-feature-copy p+p {margin-top:16px!important;}
  .invoice-customize>.invoice-feature-row>.invoice-feature-media {background:var(--nb-ink);border-color:var(--nb-ink);padding:32px;}
  .invoice-detail-grid {display:grid;grid-template-columns:1fr 1fr;gap:40px;margin-top:64px;}
  .invoice-detail-grid .invoice-feature-row {display:flex;flex-direction:column;align-items:stretch;gap:28px;margin:0;}
  .invoice-detail-grid .invoice-feature-media {order:0;display:flex;flex-direction:column;align-items:center;background:var(--nb-white);border-color:var(--nb-border);padding:32px;}
  .invoice-detail-grid .invoice-feature-row:last-child .invoice-feature-media {background:var(--nb-ink);border-color:var(--nb-ink);}
  .invoice-detail-grid .invoice-feature-media img {width:100%;height:320px;object-fit:contain;border:0;border-radius:0;}
  .invoice-detail-grid .invoice-feature-media figcaption {align-self:stretch;}
  .invoice-detail-grid .invoice-feature-copy {padding:0 8px;}

  .invoice-workflow-stage {padding:88px 0;background:var(--nb-marketing-deep);}
  .invoice-v5 .invoice-workflow {margin:0;}
  .invoice-v5 .invoice-workflow :is(h2,h3) {color:var(--nb-white);}
  .invoice-v5 .invoice-workflow p:not(.tool-eyebrow) {color:var(--nb-marketing-mint);}
  .invoice-v5 .invoice-workflow .tool-eyebrow {color:var(--nb-green);}
  .invoice-workflow-grid {display:grid;grid-template-columns:1fr 1fr;gap:64px;}
  .invoice-workflow-grid .invoice-feature-row {display:flex;flex-direction:column;align-items:stretch;gap:32px;margin:0;}
  .invoice-workflow-grid .invoice-feature-media {order:0;background:var(--nb-white);border-color:var(--nb-border);}
  .invoice-workflow-grid .invoice-feature-row:last-child .invoice-feature-media {background:var(--nb-ink);border-color:var(--nb-muted);}
  .invoice-customize>.invoice-feature-row>.invoice-feature-media figcaption,
  .invoice-detail-grid .invoice-feature-row:last-child .invoice-feature-media figcaption,
  .invoice-workflow-grid .invoice-feature-row:last-child .invoice-feature-media figcaption {color:var(--nb-muted-light);}
  .invoice-customize>.invoice-feature-row>.invoice-feature-media figcaption a,
  .invoice-detail-grid .invoice-feature-row:last-child .invoice-feature-media figcaption a,
  .invoice-workflow-grid .invoice-feature-row:last-child .invoice-feature-media figcaption a {color:var(--nb-green);}
  .invoice-customize>.invoice-feature-row>.invoice-feature-media figcaption a:is(:hover,:focus-visible),
  .invoice-detail-grid .invoice-feature-row:last-child .invoice-feature-media figcaption a:is(:hover,:focus-visible),
  .invoice-workflow-grid .invoice-feature-row:last-child .invoice-feature-media figcaption a:is(:hover,:focus-visible) {color:var(--nb-white);outline-color:var(--nb-green);}
  .invoice-workflow-grid .invoice-feature-media img {height:340px;object-fit:contain;border:0;border-radius:0;}
  .invoice-v5 .invoice-workflow p a {color:var(--nb-green);}
  .invoice-v5 .invoice-workflow p a:is(:hover,:focus-visible) {color:var(--nb-white);}
  .invoice-v5 .invoice-workflow .invoice-feature-copy a:focus-visible {outline-color:var(--nb-green);}

  .invoice-work-context {display:grid;grid-template-columns:1.05fr 1fr;align-items:center;margin:96px 0;background:var(--nb-white);border:1px solid var(--nb-border);border-radius:24px;overflow:hidden;}
  .invoice-work-context figure {margin:0;align-self:stretch;display:flex;flex-direction:column;min-width:0;}
  .invoice-work-context img {display:block;width:100%;height:100%;min-height:420px;object-fit:cover;object-position:52% center;}
  .invoice-work-context figcaption {padding:12px 24px;font-size:11px;line-height:1.6;color:var(--nb-muted);}
  .invoice-work-context>div {padding:48px;max-width:850px;}
  .invoice-work-context p+p {margin-top:16px!important;}
  .invoice-landing-cta {display:inline-flex;align-items:center;justify-content:center;min-height:52px;padding:14px 24px;margin:24px 0 12px;background:var(--nb-green);border:1px solid var(--nb-green);color:var(--nb-ink)!important;border-radius:var(--nb-radius-sm);font-size:14px;font-weight:800;text-decoration:none;transition:background .18s,transform .18s,box-shadow .18s;}
  .invoice-landing-cta:is(:hover,:focus-visible) {background:var(--nb-green-strong);border-color:var(--nb-green-strong);transform:translateY(-2px);box-shadow:var(--nb-shadow);text-decoration:none;}

  .invoice-v5 .invoice-how {margin:96px 0;}
  .invoice-how-steps {list-style:none;margin:48px 0 0;padding:0;display:grid;grid-template-columns:1fr;gap:28px;}
  .invoice-how-steps>li {display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);grid-template-rows:1fr 1fr;gap:20px 48px;padding:40px;border:1px solid var(--nb-border);border-radius:24px;background:var(--nb-white);min-width:0;}
  .invoice-step-heading {grid-column:1;grid-row:1;display:block;align-self:end;}
  .invoice-step-heading>span {display:block;color:var(--nb-link-light);font-size:56px;font-weight:800;line-height:1;letter-spacing:-.06em;margin-bottom:20px;}
  .invoice-v5 .invoice-step-heading h3 {font-size:32px;line-height:1.2;margin:0;max-width:18ch;}
  .invoice-step-image {grid-column:2;grid-row:1/3;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;min-width:0;border-radius:16px;background:var(--nb-surface);border:1px solid var(--nb-border);padding:28px;text-decoration:none;transition:box-shadow .18s;}
  .invoice-step-image:is(:hover,:focus-visible) {box-shadow:var(--nb-shadow);text-decoration:none;}
  .invoice-how-steps img {display:block;width:auto;max-width:100%;height:auto;max-height:560px;object-fit:contain;border:0;}
  .invoice-how-steps .invoice-step-link-label {display:inline-flex;align-items:center;min-height:44px;font-size:13px;font-weight:700;color:var(--nb-link-light);text-decoration:underline;text-underline-offset:4px;}
  .invoice-step-image:is(:hover,:focus-visible) .invoice-step-link-label {color:var(--nb-ink);text-decoration-thickness:2px;}
  .invoice-how-steps p {grid-column:1;grid-row:2;max-width:40ch;align-self:start;}
  .invoice-how-steps>li:nth-child(even) {background:var(--nb-ink);border-color:var(--nb-ink);grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr);}
  .invoice-how-steps>li:nth-child(even) .invoice-step-heading,.invoice-how-steps>li:nth-child(even)>p {grid-column:2;}
  .invoice-how-steps>li:nth-child(even) .invoice-step-image {grid-column:1;}
  .invoice-v5 .invoice-how-steps>li:nth-child(even) h3 {color:var(--nb-white);}
  .invoice-v5 .invoice-how-steps>li:nth-child(even)>p {color:var(--nb-muted-light);}
  .invoice-how-steps>li:nth-child(even) .invoice-step-heading>span {color:var(--nb-green);}

  .invoice-support-grid {display:grid;grid-template-columns:1.5fr 1fr;gap:64px;margin:88px 0;padding-top:56px;border-top:1px solid var(--nb-marketing-line);}
  .invoice-v5 .invoice-checklist {margin:0;}
  .invoice-v5 .invoice-checklist h2 {font-size:32px;margin-top:0;}
  .invoice-v5 .invoice-checklist p+p {margin-top:16px;}
  .invoice-v5 .invoice-help-strip {margin:0;padding:32px;background:var(--nb-ink);border:0;border-radius:20px;}
  .invoice-v5 .invoice-help-strip h2 {color:var(--nb-white);}
  .invoice-v5 .invoice-help-strip p {color:var(--nb-muted-light);}
  .invoice-v5 .invoice-help-strip>a {color:var(--nb-green);}
  .invoice-v5 .invoice-help-strip>a:is(:hover,:focus-visible) {color:var(--nb-white);outline-color:var(--nb-green);}
  .invoice-v5 .invoice-help-strip h2 {font-size:28px;}
  .invoice-help-strip>a {color:var(--nb-link-light);font-size:14px;font-weight:750;margin-top:20px;text-underline-offset:4px;}
  .invoice-v5 .seo-faq {display:grid;grid-template-columns:.8fr 1.2fr;gap:80px;max-width:none;margin:96px 0;}
  .invoice-faq-intro {align-self:start;}
  .invoice-v5 .seo-faq summary {min-height:64px;padding:22px 4px;color:var(--nb-marketing-ink);font-size:16px;font-weight:700;line-height:1.5;}
  .invoice-v5 .seo-faq details {border-color:var(--nb-marketing-line);}
  .invoice-v5 .seo-faq details p {padding:0 4px 24px;}
  .invoice-v5 .seo-faq details[open] summary {color:var(--nb-link-light);}
  .invoice-v5 .invoice-final-cta {display:grid;grid-template-columns:1fr .65fr;align-items:center;gap:64px;margin:0 0 88px;padding:64px;background:var(--nb-marketing-deep);border:0;border-radius:24px;}
  .invoice-v5 .invoice-final-cta h2 {color:var(--nb-white);font-size:clamp(36px,4vw,56px);margin:12px 0 20px;}
  .invoice-v5 .invoice-final-cta p {color:var(--nb-marketing-mint);}
  .invoice-v5 .invoice-final-cta .tool-eyebrow {color:var(--nb-green);}
  .invoice-final-actions {display:flex;flex-direction:column;align-items:stretch;gap:12px;}
  .invoice-v5 .invoice-final-cta .invoice-landing-cta {display:flex;margin:0;padding:16px 24px;}
  .invoice-v5 .invoice-final-guide {display:flex;justify-content:center;align-items:center;min-height:52px;margin:0;padding:12px 20px;border:1px solid var(--nb-marketing-mint);border-radius:var(--nb-radius-sm);color:var(--nb-white);font-size:14px;font-weight:700;text-decoration:none;transition:background .18s,color .18s;}
  .invoice-v5 .invoice-final-guide:is(:hover,:focus-visible) {color:var(--nb-marketing-deep);background:var(--nb-marketing-mint);text-decoration:none;}
  .invoice-v5 .invoice-final-cta a:focus-visible {outline-color:var(--nb-green);}
  .invoice-v5 .invoice-final-actions p {font-size:12px;text-align:center;}
}

@media screen and (max-width:1024px) {
  .invoice-v5 .tool-intro-inner {gap:32px;grid-template-columns:1fr 1fr;}
  .invoice-v5 .tool-intro-actions {flex-direction:column;}
  .invoice-product-intro {grid-template-columns:1fr;gap:32px;}
  .invoice-v5 .invoice-product-stage h2 {max-width:none;}
  .invoice-feature-row {gap:32px;}
  .invoice-detail-grid,.invoice-workflow-grid {gap:32px;}
  .invoice-work-context {gap:0;}
  .invoice-work-context>div {padding:32px;}
  .invoice-v5 .seo-faq,.invoice-support-grid {gap:40px;}
  .invoice-v5 .invoice-final-cta {padding:40px;gap:32px;}
}
@media screen and (max-width:900px) {
  .invoice-v5 .invoice-design-example>p {min-height:0;}
  .invoice-v5 .invoice-example-grid {grid-template-columns:1fr;gap:32px;}
  .invoice-v5 .invoice-design-example {max-width:794px;width:100%;margin-inline:auto;}
  .invoice-v5 .seo-grid {gap:24px;}
  .invoice-how-steps>li,.invoice-how-steps>li:nth-child(even) {gap:20px 28px;padding:28px;}
}
@media screen and (max-width:700px) {
  .invoice-v5 .tool-intro.invoice-visual-hero {padding:22px 0 48px;}
  .invoice-v5 .tool-intro-inner,.invoice-content-width {width:calc(100% - 40px);}
  .invoice-v5 .tool-intro-inner {grid-template-columns:1fr;gap:28px;}
  .invoice-v5 .tool-breadcrumb {font-size:10px;}
  .invoice-v5 .tool-intro h1 {font-size:42px;letter-spacing:-.055em;}
  .invoice-hero-promise {font-size:26px;margin-top:12px;}
  .invoice-v5 .tool-intro-lede {font-size:16px;line-height:1.75;margin-top:20px;}
  .invoice-v5 .tool-intro-actions {width:100%;margin-top:24px;}
  .invoice-v5 .tool-proof {display:grid;grid-template-columns:1fr 1fr;gap:8px 12px;margin-top:18px;font-size:11px;}
  .invoice-hero-photo img {max-height:380px;}
  .invoice-v5-introduction,.invoice-product-stage,.invoice-customize-stage,.invoice-workflow-stage {padding:56px 0;}
  .invoice-v5 .seo-content h2:not(:where(.sheet *)) {font-size:34px;letter-spacing:-.045em;}
  .invoice-v5 .seo-content-lead {text-align:left;margin-bottom:32px;}
  .invoice-v5 .seo-grid {grid-template-columns:1fr;gap:24px;}
  .invoice-v5 .seo-grid article {padding-top:20px;}
  .invoice-product-stage .invoice-feature-media {padding:12px;}
  .invoice-v5 .invoice-landing-links {display:grid;grid-template-columns:1fr 1fr;gap:4px 20px;padding:20px 0;}
  .invoice-v5 .invoice-landing-links a {font-size:12px;}
  .invoice-v5 .invoice-examples {padding:56px 0;}
  .invoice-v5 .invoice-section-intro {text-align:left;margin-bottom:28px;}
  .invoice-v5 .invoice-design-example {padding:20px 14px 14px;}
  .invoice-feature-row,.invoice-detail-grid,.invoice-workflow-grid {grid-template-columns:1fr;gap:28px;}
  .invoice-feature-row {margin-top:32px;}
  .invoice-customize>.invoice-feature-row>.invoice-feature-copy {order:-1;}
  .invoice-feature-media,.invoice-customize>.invoice-feature-row>.invoice-feature-media,.invoice-detail-grid .invoice-feature-media {padding:20px;}
  .invoice-detail-grid {gap:48px;margin-top:48px;}
  .invoice-detail-grid .invoice-feature-copy {padding:0;}
  .invoice-detail-grid .invoice-feature-media img {height:260px;}
  .invoice-workflow-grid {gap:48px;}
  .invoice-workflow-grid .invoice-feature-media img {height:300px;}
  .invoice-work-context {grid-template-columns:1fr;gap:0;margin:56px 0;}
  .invoice-work-context img {min-height:0;aspect-ratio:1.2;height:auto;}
  .invoice-work-context>div {padding:28px 24px 32px;}
  .invoice-v5 .invoice-how {margin:56px 0;}
  .invoice-how-steps {margin-top:32px;}
  .invoice-how-steps>li,.invoice-how-steps>li:nth-child(even) {grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto;gap:20px;padding:24px;}
  .invoice-step-heading,.invoice-how-steps>li:nth-child(even) .invoice-step-heading {grid-column:1;grid-row:1;}
  .invoice-step-heading>span {font-size:42px;margin-bottom:16px;}
  .invoice-v5 .invoice-step-heading h3 {font-size:27px;}
  .invoice-how-steps p,.invoice-how-steps>li:nth-child(even)>p {grid-column:1;grid-row:2;}
  .invoice-step-image,.invoice-how-steps>li:nth-child(even) .invoice-step-image {grid-column:1;grid-row:3;padding:16px;}
  .invoice-how-steps img {max-height:600px;}
  .invoice-support-grid {grid-template-columns:1fr;gap:32px;margin:56px 0;padding-top:40px;}
  .invoice-v5 .invoice-checklist h2 {font-size:30px;}
  .invoice-v5 .invoice-help-strip {padding:28px;}
  .invoice-v5 .seo-faq {grid-template-columns:1fr;gap:24px;margin:56px 0;}
  .invoice-v5 .seo-faq summary {font-size:15px;}
  .invoice-v5 .invoice-final-cta {grid-template-columns:1fr;gap:28px;padding:36px 24px;margin-bottom:56px;}
  .invoice-v5 .invoice-final-cta h2 {font-size:40px;}
}
@media screen and (prefers-reduced-motion:reduce) {
  /* Override the earlier page-wide !important near-zero duration as well. */
  .invoice-v5 :is(.tool-intro,.seo-content) :is(a,button) {transition:none!important;}
  .invoice-v5 :is(.tool-intro,.seo-content) a:hover {transform:none;}
}
@media screen and (forced-colors:active) {
  .invoice-v5 :is(.intro-cta-primary,.invoice-hero-guide,.invoice-landing-cta,.invoice-final-guide,.invoice-example-size) {border:1px solid ButtonText;}
  .invoice-v5 :is(.tool-intro,.seo-content) :is(a,button,summary):focus-visible {outline-color:Highlight;}
}
@media print { .invoice-product-intro,.invoice-feature-row,.invoice-work-context,.invoice-how {display:none!important;} }

/* Catalog-generated reading cards reuse the V5 resource markup. */
@media screen {
  .invoice-resources {margin:88px 0;}
  .invoice-resources .resource-cards {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:24px;}
  .invoice-resources .resource-card {display:flex;flex-direction:column;min-width:0;overflow:hidden;border:1px solid var(--nb-border);border-radius:22px;background:var(--nb-white);color:var(--nb-ink);text-decoration:none;box-shadow:0 5px 18px color-mix(in srgb,var(--nb-ink) 6%,transparent);transition:transform .2s,box-shadow .2s;}
  .invoice-resources .resource-image {position:relative;aspect-ratio:16/10;overflow:hidden;}
  .invoice-resources .resource-image img {display:block;width:100%;height:100%;object-fit:cover;}
  .invoice-resources .resource-body {display:flex;flex-direction:column;align-items:flex-start;gap:16px;padding:24px;flex:1;}
  .invoice-resources .resource-type {display:inline-flex;align-items:center;max-width:100%;padding:6px 11px;border-radius:999px;font-size:10px;font-weight:800;line-height:1.4;letter-spacing:.06em;color:var(--nb-marketing-ink);background:var(--nb-marketing-sage);}
  .invoice-resources .resource-type[data-resource-kind="industry"] {background:var(--nb-marketing-peach);}
  .invoice-resources .resource-type[data-resource-industry="landscaping"],.invoice-resources .resource-type[data-resource-industry="cleaning"],.invoice-resources .resource-type[data-resource-industry="catering"],.invoice-resources .resource-type[data-resource-industry="floristry"] {background:var(--nb-marketing-mint);}
  .invoice-resources .resource-type[data-resource-industry="freelancers"],.invoice-resources .resource-type[data-resource-industry="consultants"],.invoice-resources .resource-type[data-resource-industry="tutoring"],.invoice-resources .resource-type[data-resource-industry="personal-training"] {background:var(--nb-marketing-lavender);}
  .invoice-resources .resource-type[data-resource-industry="pet-grooming"] {background:var(--nb-marketing-sage);}
  .invoice-resources .resource-type[data-resource-kind="guide"] {background:var(--nb-marketing-lavender);}
  .invoice-resources .resource-type[data-resource-kind="update"] {background:var(--nb-marketing-sage);}
  .invoice-v5 .invoice-resources .resource-body h3 {width:100%;min-height:3.9em;margin:0;font-size:20px;line-height:1.3;text-wrap:pretty;}
  .invoice-v5 .invoice-resources .resource-body p {display:-webkit-box;width:100%;min-height:7em;margin:0;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:4;line-clamp:4;font-size:14px;line-height:1.75;}
  .invoice-resources .resource-action {display:flex;justify-content:space-between;width:100%;gap:16px;margin-top:auto;padding-top:20px;border-top:1px solid var(--nb-border);font-size:13px;font-weight:800;color:var(--nb-link-light);}
  .invoice-resources .resource-card:is(:hover,:focus-visible) {transform:translateY(-4px);box-shadow:0 10px 26px color-mix(in srgb,var(--nb-ink) 10%,transparent);}
  .invoice-resources .resource-card:is(:hover,:focus-visible) h3 {text-decoration:underline;text-underline-offset:5px;}
}
@media screen and (max-width:1024px) {
  .invoice-resources .resource-cards {grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;}
  .invoice-resources .resource-body {padding:22px;}
}
@media screen and (max-width:700px) {
  .invoice-resources {margin:56px 0;}
  .invoice-resources .resource-cards {grid-template-columns:1fr;gap:24px;}
}
@media (prefers-reduced-motion:reduce) {
  .invoice-resources .resource-card {transition:none;}
  .invoice-resources .resource-card:is(:hover,:focus-visible) {transform:none;}
}
@media print {.invoice-resources {display:none!important;}}
