@font-face {
  font-family: 'Figtree';
  src: url('/fonts/Figtree-VariableFont_wght.ttf') format('truetype');
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
}

@font-face {
  font-family: 'Unlock';
  src: url('/fonts/Unlock-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@layer skirbi-app {
  [skirbi-theme] {
    --skirbi-font-sans: 'Figtree', ui-sans-serif, system-ui, sans-serif;
    --skirbi-font-headers: 'Unlock', var(--skirbi-font-sans);
    --skirbi-font-mono: var(--skirbi-font-sans);
    --skirbi-primary-main: #2d5a2c;
    --skirbi-primary-contrast: #f8f8ff;
    --skirbi-page-bg: var(--skirbi-primary-soft);
    --skirbi-page-fg: var(--skirbi-on-light);
    --skirbi-secondary-main: #6b5f96;
    --skirbi-tertiary-main: #f5f3ee;
    --skirbi-quaternary-main: #1c2841;
    --skirbi-control-bg: var(--skirbi-tertiary-main);
    --skirbi-control-border: #cfcdc5;
    font-variant-numeric: tabular-nums;

    :where(h1, h2, h3, h4, h5, h6) {
      font-weight: 400;
    }

    [invoice-debtor-control] {
      align-items: flex-end;
      margin: 0 0 1rem 0;
    }

    [invoice-debtor-control] button {
      padding: 0.3rem 0.75rem;
      font-size: 0.7rem;
    }

    /* Every semtic-table in the app runs smaller and denser -- rows
     * with several action buttons side by side (Invoices, Bills,
     * Entities, Accounts) need the room, and a consistently compact
     * table reads better across the app than one table being the odd
     * one out. */
    semtic-table {
      font-size: 0.85rem;
    }

    semtic-table th,
    semtic-table td {
      padding: 0.5rem 0.75rem;
    }

    semtic-table button,
    semtic-table a[extra],
    semtic-table a[lead],
    semtic-table a[support],
    semtic-table a[antagonist],
    semtic-table a[herald] {
      padding: 0.25rem 0.6rem;
      font-size: 0.6rem;
      gap: 0.25rem;
    }

    [invoice-status-display] label {
      display: block;
      font-size: 0.8rem;
      font-weight: 600;
      margin-bottom: 0.25rem;
    }

    [invoice-save-actions] {
      display: flex;
      justify-content: flex-end;
    }

    /* App-wide override of Pinta's default semtic-input-number recipe
     * (buttons flanking either side of the control) -- deliberately
     * kept here, not in Pinta itself, since this is how eekboek-www
     * wants its own number fields to look, not a change to the shared
     * component's own default. Stacks +/- as a spinner against the
     * control's trailing end, increment on top, decrement below, each
     * half the control's height. */
    semtic-input-number [semtic-input-container] {
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-rows: 1fr 1fr;
      grid-template-areas: "input inc" "input dec";
    }

    semtic-input-number [semtic-input-container] input[wc-control] {
      grid-area: input;
      /* Square on the end that meets the +/- stack -- the base input
       * recipe rounds all four corners, which left the input's own
       * trailing corners rounded right where they touch the stack's
       * square inner edge. Leading corners stay rounded, same as
       * every other field. */
      border-radius: 0.5rem 0 0 0.5rem;
    }

    semtic-input-number :is([semtic-decrement], [semtic-increment]) {
      inline-size: var(--skirbi-number-step-size, 1.5rem);
      font-size: 0.7em;
    }

    semtic-input-number [semtic-increment] {
      grid-area: inc;
      border-inline-start: 1px solid var(--skirbi-secondary-main);
      border-block-end: 0;
      border-radius: 0 0.375rem 0 0;
    }

    semtic-input-number [semtic-decrement] {
      grid-area: dec;
      border-inline-start: 1px solid var(--skirbi-secondary-main);
      /* Pinta's base recipe zeroes this out for its own default
       * flanking layout, where the decrement button's right edge
       * butts against the input -- this stacked layout puts it on
       * the outer edge instead, so it needs its border back. */
      border-inline-end: 1px solid var(--skirbi-secondary-main);
      border-block-start: 0;
      border-radius: 0 0 0.375rem 0;
    }

    /* Identity/dates on the left, the document's own bookkeeping
     * fields (number, id, payment method, status) on the right -- both
     * <semtic-grid> and <semtic-stack> here for their default recipes
     * (grid columns via --skirbi-columns, a vertical flex stack), with
     * these attribute markers only for the parts that recipe doesn't
     * cover: 2 columns instead of 1, a tighter gap than
     * --skirbi-stack-gap's 1rem default, and the mobile collapse. See
     * invoice_form.html.ep's [invoice-header-grid]/[invoice-header-col]. */
    semtic-grid[invoice-header-grid] {
      --skirbi-columns: 2;
      gap: 0 1.5rem;
      align-items: start;
    }

    fieldset {
      position: relative;
      margin-block-end: 1.25rem;
      border: 1px solid var(--skirbi-control-border);
      border-radius: 0.7rem;
      padding: 3.25rem 1.25rem 1.25rem;
      background: var(--skirbi-control-bg);
      color: var(--skirbi-tertiary-strong);
    }

    fieldset::before {
      position: absolute;
      inset: 0;
      border: 0;
      border-radius: inherit;
      content: '';
      pointer-events: none;
    }

    fieldset > legend {
      position: absolute;
      inset-block-start: 1.25rem;
      inset-inline: 1.25rem;
      inline-size: auto;
      margin: 0;
      padding-inline: 0.5rem;
      background: var(--skirbi-control-bg);
      color: var(--skirbi-tertiary-strong);
      font-size: 0.8rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    fieldset > :not(legend) {
      position: relative;
    }

    fieldset > :nth-child(2):not(p) {
      margin-block-start: 0.75rem;
    }

    fieldset :is(label, p, h4, input[wc-control], select[wc-control], textarea[wc-control]) {
      color: var(--skirbi-tertiary-strong);
    }

    semtic-stack[invoice-header-col] {
      --skirbi-stack-gap: 0.75rem;
    }

    /* Customer-facing Message and internal-only Notes side by side --
     * they're never both long at once, so a full-width column each is
     * wasted space. */
    semtic-grid[invoice-message-notes] {
      --skirbi-columns: 2;
      gap: 0 1.5rem;
    }

    semtic-grid[page-shell] {
      --skirbi-page-shell-aside: 14rem;
    }

    eek-invoice-container {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      margin: 1rem 0;
    }

    /* Two stacked top-level children per row -- a <semtic-grid> of
     * field groups, then a <semtic-flex> of computed readouts (see the
     * nested rules below) -- with a full field set (item, description,
     * unit, quantity, price, discount, tax, total, remove) one flex row
     * of everything just overlapped/overflowed.
     *
     * "Pop" more than a plain thin border: a raised card (background a
     * shade lighter than the page, a real shadow, a heavier radius) so
     * each line item reads as a distinct unit instead of blending into
     * the page background -- more noticeable on hover/focus-within,
     * since that's the row currently being worked on. */
    eek-invoice-row {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      padding: 0.75rem;
      background: var(--skirbi-surface-raised-final, #fff);
      border: 1px solid var(--skirbi-primary-strong);
      border-radius: 0.2rem;
      box-shadow: none;
      cursor: grab;
      transition: box-shadow 0.15s ease, border-color 0.15s ease;
    }

    eek-invoice-row {
      &:hover,
      &:focus-within {
        border-color: var(--skirbi-secondary-main);
        box-shadow: 0 1px 4px rgba(23, 32, 51, 0.08);
      }

      /* Four groups side by side: the item+description (widest -- the
       * two free-text fields), unit/quantity/price, discount/tax, and
       * the row's own action (Add Line/Remove) -- eek-invoice-row's own
       * markup nests them in exactly that order, so :nth-child keys off
       * that authored order rather than a class per group. Each group
       * is a <semtic-stack> so its own fields stack vertically -- see
       * the per-group width rules below for why a plain flex-wrap row
       * of every field individually (the previous layout) didn't read
       * as well: nothing grouped the fields that belong together, so
       * the row just looked like a loose bag of inputs. */
      semtic-grid {
        display: grid;
        grid-template-columns: minmax(12rem, 1fr) repeat(4, 7.5rem) auto;
        align-items: start;
        gap: 0.65rem;
        min-inline-size: 0;

        > :is(semtic-input, semtic-select, semtic-input-number)[data-field="item"] {
          grid-column: 1;
          grid-row: 1;
        }

        > [data-field="product_unit"] {
          grid-column: 2;
          grid-row: 1;
        }


        > [data-field="quantity"] {
          grid-column: 4;
          grid-row: 1;
        }

        > [data-field="price"] {
          grid-column: 5;
          grid-row: 1;
        }

        > [invoice-description] {
          grid-column: 1;
          grid-row: 2;
          min-inline-size: 0;
        }

        > [data-field="tax_rate"] {
          grid-column: 2;
          grid-row: 2;
        }

        > :is([data-field="product_unit"],
          [data-field="quantity"], [data-field="tax_rate"], [data-field="price"]) {
          inline-size: min(100%, 7.5rem);
          max-inline-size: 7.5rem;
        }

        > [data-row-action] {
          grid-column: 6;
          grid-row: 1;
          justify-self: end;

          button[type="submit"] {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            inline-size: 1.75rem;
            block-size: 1.75rem;
            padding: 0;
            line-height: 1;
          }

          button[type="submit"] svg {
            inline-size: 0.8rem;
            block-size: 0.8rem;
            fill: none;
            stroke: currentColor;
            stroke-linecap: round;
            stroke-linejoin: round;
            stroke-width: 2;
          }
        }

      > [data-row-totals] {
        grid-column: 3 / -1;
        grid-row: 2;
          display: grid;
          grid-template-columns: repeat(3, 7.5rem) minmax(0, 1fr);
          justify-content: stretch;
          align-self: start;
        }
      }

      semtic-input [wc-control],
      semtic-select [wc-control],
      semtic-input-number input[wc-control] {
        block-size: 1.8rem;
        min-block-size: 1.8rem;
        padding-block: 0.4rem;
      }

      semtic-input-number [semtic-input-container] {
        block-size: 1.8rem;
        min-block-size: 1.8rem;
      }

      > semtic-grid > [invoice-description] {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
        gap: 0;
      }

      > semtic-grid > [invoice-description] > [data-description-toggle] {
        grid-column: 2;
        align-self: end;
        margin-block-end: 0.45rem;
        padding: 0.45rem 0.6rem;
        border: 1px solid var(--skirbi-primary-strong);
        border-inline-start: 0;
        border-radius: 0 0.2rem 0.2rem 0;
        background: var(--skirbi-primary-soft);
        color: var(--skirbi-secondary-main);
        font-size: 0.7rem;
        white-space: nowrap;
      }

      > semtic-grid > [invoice-description] textarea[wc-control] {
        grid-column: 1;
        block-size: 1.8rem;
        min-block-size: 1.8rem;
        padding-block: 0.4rem;
        overflow: hidden;
        resize: none;
        border-radius: 0.2rem 0 0 0.2rem;
      }

      &[data-description-expanded] > semtic-grid > [invoice-description] textarea[wc-control] {
        block-size: 8rem;
        min-block-size: 8rem;
        overflow: auto;
        resize: vertical;
      }

      > semtic-grid > [data-row-totals] {
        justify-content: flex-end;
        gap: 0.75rem;
        flex-wrap: wrap;
        font-size: 0.85rem;
        color: var(--skirbi-text-muted-final, #666);
        margin: 0;
        padding: 0;
        background: transparent;
        border-block-start: 0;

        /* Scoped to plain <span data-field> (the four computed-value
         * readouts authored in the template), not [data-field]
         * generally -- <semtic-select data-field="product_unit"> and
         * its own internal <select data-field="..."> ALSO carry
         * data-field (for their own JS wiring), and neither has a
         * data-label, so this would otherwise print a bare ": " next
         * to the unit picker too. */
        span[data-field]::before {
          content: attr(data-label) ": ";
          display: block;
          min-block-size: 1.7rem;
          font-weight: 600;
        }

        span[data-field] {
          display: flex;
          flex-direction: column;
          align-items: flex-start;
          gap: 0.5rem;
          line-height: 1;
          min-inline-size: 0;
          text-align: start;
        }

        span[data-field="total"] {
          font-weight: 700;
          color: var(--skirbi-primary-main);
        }
      }
    }

    eek-invoice-row.eek-dragging {
      opacity: 0.5;
    }

    /* The always-present "add a line" row -- not a committed line, not
     * draggable, so it reads visually as an action rather than data. */
    eek-invoice-row[data-pending] {
      cursor: default;
      border-style: dashed;
    }

    /* Subtotal/Tax stacked above the bold Total -- see
     * invoice_form.html.ep's [invoice-totals-summary]. */
    [invoice-totals-summary] {
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
      align-items: flex-end;
      margin: 0.5rem 0 1rem 0;
    }



    fieldset[invoice-details] > semtic-grid[invoice-header-grid] > [invoice-summary-totals] {
      grid-column: 3;
      grid-row: 2;
    }

    fieldset[invoice-details] > semtic-grid[invoice-header-grid] > [invoice-summary-bbo] {
      grid-column: 4;
      grid-row: 2;
    }

    [invoice-totals-summary] > semtic-flex {
      gap: 1.5rem;
      min-width: 14rem;
      justify-content: space-between;
    }

    [invoice-totals-summary] [invoice-total] {
      font-weight: bold;
      font-size: 1.1rem;
      border-top: 1px solid var(--skirbi-surface-border-final, #ccc);
      padding-top: 0.25rem;
      margin: 0;
    }

    /* Set by <eek-invoice-row>'s own _validate() when the item field is
     * empty -- the row won't let "Add Line" submit either way, this is
     * just what makes that visible before the user even tries.
     * [data-invalid] lands on <semtic-input> itself, whose own border
     * lives on its inner [wc-control], not the host element. */
    eek-invoice-row [data-invalid] input[wc-control] {
      border-color: #a4453a;
      outline: 1px solid #a4453a;
    }

    eek-invoice-row button[type="submit"]:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    /* Login (login.html.ep): a narrow panel in the middle of the page,
     * not a form stretched across all of it. */
    semtic-panel[login] {
      display: block;
      inline-size: min(100% - 2rem, 24rem);
      margin: 12vh auto 2rem;

      form {
        margin-top: 1rem;
      }

      fieldset {
        margin: 0 0 1rem;
        padding: 0;
        border: 0;
        background: transparent;
      }

      button[type="submit"] {
        inline-size: 100%;
      }
    }

    p[login-error],
    p[login-notice] {
      margin: 1rem 0 0;
      padding: 0.5rem 0.75rem;
      border: 1px solid;
      border-radius: 0.5rem;
    }

    p[login-error] {
      color: var(--skirbi-error-base, #b91c1c);
      border-color: color-mix(in srgb, var(--skirbi-error-base, #b91c1c) 40%, transparent);
      background: color-mix(in srgb, var(--skirbi-error-base, #b91c1c) 8%, transparent);
    }

    p[login-notice] {
      color: var(--skirbi-quaternary-main);
      border-color: color-mix(in srgb, var(--skirbi-secondary-main) 45%, transparent);
      background: color-mix(in srgb, var(--skirbi-secondary-main) 10%, transparent);
    }

    /* What a company has to say on every one of its pages, e.g. that it is
     * read-only (partials/company_notices.html.ep). */
    p[company-notice] {
      margin: 0;
      padding: 0.6rem 1rem;
      text-align: center;
      font-size: 0.9rem;
      color: var(--skirbi-quaternary-main);
      background: color-mix(in srgb, var(--skirbi-secondary-main) 10%, transparent);
      border-block-end: 1px solid color-mix(in srgb, var(--skirbi-secondary-main) 45%, transparent);
    }

    /* RBAC admin (rbac_manage.html.ep): a shared "picker panel" (new-item
     * input + a tile-list of existing items) reused for Roles, Permission
     * Groups, and permission-group-permissions alike (see partials/
     * rbac_picker.html.ep), plus the detail/members panels beside it.
     * Each panel is just the theme's own card, a single layer. */
    semtic-grid[rbac-columns] {
      grid-template-columns: 1fr 2fr;
      gap: 1.5rem;
      align-items: start;
    }

    semtic-stack[rbac-detail-column] {
      --skirbi-stack-gap: 1.5rem;
    }

    semtic-panel[rbac] section {
      h4 {
        font-size: 0.85rem;
        margin: 1rem 0 0.5rem;
      }
    }

    [rbac-picker-list] {
      display: grid;
      gap: 0.5rem;
      list-style: none;
      padding: 0;
      margin: 1rem 0 0;
    }

    [rbac-picker-list] li form {
      display: block;
    }

    /* Tile, not a pill button: rectangular, left-aligned, full-width --
     * same box language as the input/panel radius (0.5rem), not the
     * pill-shaped [lead]/[extra] button recipe. */
    button[rbac-tile] {
      display: block;
      width: 100%;
      text-align: left;
      padding: 0.65rem 0.9rem;
      border-radius: 0.5rem;
      border: 1px solid var(--skirbi-surface-border-final);
      background: var(--skirbi-surface-base, #fff);
      color: var(--skirbi-secondary-dark);
      font-weight: 600;
      text-transform: none;
      letter-spacing: normal;
      cursor: pointer;
      transition:
        background var(--skirbi-transition-duration, 180ms) var(--skirbi-transition-ease, ease),
        border-color var(--skirbi-transition-duration, 180ms) var(--skirbi-transition-ease, ease);
    }

    button[rbac-tile]:hover {
      border-color: var(--skirbi-tertiary-main);
    }

    button[rbac-tile][aria-current="true"] {
      background: color-mix(in srgb, var(--skirbi-tertiary-main) 16%, var(--skirbi-surface-base, #fff));
      border-color: var(--skirbi-tertiary-main);
      color: var(--skirbi-tertiary-strong);
    }

    semtic-flex[rbac-heading-row] {
      align-items: center;
      margin-bottom: 1rem;

      h3 {
        margin: 0;
      }
    }

    /* Compact box (not the shared form-controls block-size recipe, which
     * is noticeably taller) -- shared by every inline rename input,
     * whether it replaces a heading or a plain list row. */
    semtic-input[rbac-rename-input] input[wc-control] {
      block-size: auto;
      padding: 0.15rem 0.5rem;
    }

    /* Only the ones actually replacing an h3 (role/permission-group
     * rename) also take on that heading's own font-size/weight -- the
     * permission rename input replaces a plain <code> list row, not a
     * heading, so it stays at the row list's normal text weight/size. */
    semtic-input[rbac-rename-input][rbac-heading-input] input[wc-control] {
      font-size: 1.17em;
      font-weight: 700;
    }

    semtic-flex[rbac-actions] {
      --skirbi-flex-gap: 0.5rem;
    }

    button[rbac-small] {
      padding: 0.3rem 0.75rem;
      font-size: 0.7rem;
    }

    [rbac-row-list] {
      list-style: none;
      padding: 0;
      margin: 0 0 1rem;
      display: grid;
      gap: 0.15rem;
    }

    [rbac-row-list] li {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.15rem 0.6rem;
      border-radius: 0.375rem;
    }

    /* flex: 0 auto (content-sized), not flex: 1 -- semtic-checkbox's own
     * label-position="right" grid gives its control column minmax(0, 1fr),
     * so a host stretched to fill the row just stretches that column too,
     * shoving the label away from its own checkbox. The pill (if any) is
     * what gets pushed to the row's end instead, via margin-inline-start:
     * auto below. */
    [rbac-row-list] semtic-checkbox {
      flex: 0 auto;
      /* Pinta's default choice-size formula (1.325rem + 1em) assumes the
       * shared form-controls block-size recipe's own padding/line-height
       * chrome -- [rbac-rename-input] overrides that to block-size: auto
       * with its own smaller padding, so reusing 1.325rem here made the
       * checkbox bigger than the actual input box it's meant to match.
       * Built from the rename input's own numbers instead: its
       * padding-block (2 * 0.15rem) plus a 1.2 line-height on its 1.17em
       * font, times the same 6/7 ratio. */
      --skirbi-choice-size: calc((0.3rem + 1.17em * 1.2) * 6 / 7);
    }

    semtic-pill-box[rbac-pending-marker] {
      margin-inline-start: auto;
      font-size: 0.75rem;
      font-weight: 600;
      background: var(--skirbi-secondary-main);
      color: var(--skirbi-primary-strong);
    }

    [rbac-hint] {
      color: var(--skirbi-secondary-strong, #666);
      font-size: 0.9rem;
    }

    /* Pushes Edit/Delete to the row's end regardless of how long the
     * permission key text before it is -- otherwise they trail right
     * after the <code>, landing at a different x per row. */
    /* A reserved-width column for the key, not push-to-the-far-edge --
     * Edit/Delete land right after it, at the same x on every row
     * regardless of key length, without sitting all the way over at
     * the row's right edge. */
    [rbac-row-list] li code {
      display: inline-block;
      min-inline-size: 14rem;
    }

    /* align-items: center centers each flex item's whole box, including
     * semtic-input's own trailing (empty but still grid-row-occupying)
     * [semtic-error] slot -- that extra invisible height below the input
     * skews a box-based center down past the button's own line. Baseline
     * lines up on the actual text, which is what "same line" means here. */
    semtic-flex[rbac-new-permission-row] {
      align-items: baseline;
      --skirbi-flex-gap: 0.75rem;

      button {
        position: relative;
        top: -0.25rem;
      }
    }
    body {
      background: var(--skirbi-page-bg-final);
      color: var(--skirbi-text-final);
    }

    semtic-nav {
      display: block;
    }

    semtic-nav > nav {
      padding-inline: clamp(1rem, 4vw, 3rem);
      background: var(--skirbi-primary-main);
      color: var(--skirbi-primary-contrast);
      border-block-end-color: var(--skirbi-primary-main);
    }

    semtic-nav [contacash-app-wordmark] {
      display: block;
      width: auto;
      height: 1.35rem;
    }

    semtic-nav [semtic-nav-brand],
    semtic-nav [semtic-nav-link] {
      color: var(--skirbi-primary-contrast);
    }

    semtic-nav > ul {
      gap: 0.25rem;
    }

    semtic-nav > nav {
      padding-block: 0.8rem;
    }

    semtic-nav semtic-nav-item + semtic-nav-item::before {
      content: none;
    }

    semtic-nav [semtic-nav-link] {
      font-size: 0.78rem;
      font-weight: 600;
    }

    semtic-nav semtic-nav-item a {
      border-radius: 0.5rem;
      padding: 0.55rem 0.7rem;
      transition: background-color 0.15s ease, color 0.15s ease;
    }

    semtic-nav semtic-nav-item a:hover,
    semtic-nav semtic-nav-item a:focus-visible {
      background: var(--skirbi-secondary-main);
      color: var(--skirbi-secondary-contrast);
    }

    button,
    a[extra],
    a[lead],
    a[support],
    a[antagonist],
    a[herald] {
      border-radius: 0.2rem;
    }

    input[wc-control],
    select[wc-control],
    textarea[wc-control] {
      background: var(--skirbi-control-bg);
      border-color: var(--skirbi-control-border);
      color: var(--skirbi-tertiary-strong);
    }

    semtic-input-number :is([semtic-increment], [semtic-decrement]) {
      background: var(--skirbi-control-bg);
      border-color: var(--skirbi-control-border);
      color: var(--skirbi-tertiary-strong);
    }

    semtic-grid[page-shell] {
      --skirbi-page-shell-aside: 14rem;
      gap: 2.5rem;
      padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1rem, 4vw, 3rem);
      padding-inline-start: 0;
      padding-block-start: 0;
      grid-template-columns: var(--skirbi-page-shell-aside) minmax(0, 1fr);
      align-items: stretch;
    }

    semtic-grid[page-shell] > semtic-sidenav {
      grid-column: 1;
      grid-row: 1;
      align-self: stretch;
    }

    semtic-grid[page-shell] > semtic-stack {
      grid-column: 2;
      grid-row: 1;
    }

    semtic-grid[page-shell] > semtic-stack:has(waya-root[invoice-form]) {
      max-inline-size: none;
      inline-size: 100%;
    }

    semtic-grid[page-shell] > semtic-stack {
      min-inline-size: 0;
      max-inline-size: 68rem;
      padding-block-start: 2rem;
    }

    semtic-grid[page-shell] > semtic-stack > waya-root > semtic-header {
      margin-block-end: 1.75rem;
    }

    semtic-grid[page-shell] > semtic-stack > waya-root > semtic-header h2 {
      font-size: clamp(1.875rem, 3vw, 2.4rem);
      letter-spacing: -0.035em;
      line-height: 1.05;
    }

    semtic-grid[page-shell] > semtic-stack > waya-root > semtic-header h3 {
      color: var(--skirbi-text-muted-final, #687080);
      font-size: 1rem;
      font-weight: 500;
      margin-block-start: 0.5rem;
    }


    fieldset[invoice-details] > semtic-grid[invoice-header-grid] {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    fieldset[quote-details] > semtic-grid[quote-header-grid] {
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 0 1.5rem;
      align-items: start;
    }

    fieldset[quote-details] > semtic-grid[quote-header-grid] > semtic-form-row {
      display: contents;
    }

    fieldset[quote-details] > semtic-grid[quote-header-grid] > [quote-date-row] > semtic-stack[quote-date-group] {
      display: grid;
      grid-column: 2 / span 2;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0 1.5rem;
    }

    fieldset[quote-details] > semtic-grid[quote-header-grid] > [quote-summary-row] > [invoice-totals-summary] {
      grid-column: 3;
      grid-row: 2;
    }

    fieldset[quote-details] > semtic-grid[quote-header-grid] > [quote-summary-row] > [quote-summary-bbo] {
      grid-column: 4;
      grid-row: 2;
    }

    fieldset[quote-details] > semtic-grid[quote-header-grid] > [quote-summary-row] > semtic-textarea {
      grid-column: 1 / span 2;
      grid-row: 2;
    }

    fieldset[invoice-details] > semtic-grid[invoice-header-grid] > semtic-form-row {
      display: contents;
    }

    fieldset[invoice-details] > semtic-grid[invoice-header-grid] > semtic-form-row:nth-child(3) {
      display: grid;
      grid-column: 1 / span 2;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0 1.5rem;
    }

    fieldset[invoice-details] > semtic-grid[invoice-header-grid] > semtic-form-row:nth-child(4) > semtic-select {
      grid-row: 1;
      grid-column: 4;
    }

    fieldset[invoice-details] > semtic-grid[invoice-header-grid] > semtic-textarea {
      grid-column: 3 / span 2;
      grid-row: 2;
    }



    semtic-header > header h2 {
      font-size: clamp(1.875rem, 3vw, 2.4rem);
      letter-spacing: -0.035em;
      line-height: 1.05;
    }

    semtic-grid[page-shell] > semtic-stack > waya-root > a:first-of-type {
      display: inline-flex;
      margin-block-end: 2.25rem;
      padding: 0.75rem 1.1rem;
      background: var(--skirbi-primary-main);
      border-color: var(--skirbi-primary-main);
      color: var(--skirbi-primary-contrast);
      border-radius: 0.6rem;
      font-size: 0.8rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    semtic-grid[page-shell] > semtic-stack > waya-root semtic-table {
      display: block;
      margin-block-end: 1.25rem;
      padding: 1.1rem 1.25rem 0.75rem;
      background: var(--skirbi-surface-raised-final, #fff);
      border: 1px solid var(--skirbi-surface-border-final, #d8d9df);
      border-radius: 0.75rem;
      box-shadow: 0 2px 6px rgba(23, 32, 51, 0.04);
    }

    waya-root[dashboard] > semtic-table {
      margin-block-end: 0.5rem;
    }

    waya-root[dashboard] > a[support] {
      display: inline-flex;
      margin-block-end: 1.5rem;
      color: var(--skirbi-secondary-main);
      font-size: 0.78rem;
      font-weight: 600;
    }

    semtic-grid[page-shell] > semtic-stack > waya-root semtic-table caption {
      padding-block-end: 0.8rem;
      color: var(--skirbi-text-final, #172033);
      font-size: 1rem;
      font-weight: 700;
      text-align: start;
    }

    semtic-grid[page-shell] > semtic-stack > waya-root semtic-table th {
      color: var(--skirbi-text-muted-final, #687080);
      font-size: 0.72rem;
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }

    /* The workspace: semtic-grid[triptych="workspace"] (see dibuho
     * IDEAS.md, "Named triptych variants"). Content first in the DOM, then
     * the side menu as a full-height navigation panel flush to the left
     * edge, then an aside (on the document forms, the summary). Pinta
     * places the three and handles the narrower screens; this is what the
     * variant adds. */
    semtic-grid[triptych="workspace"] {
      --skirbi-triptych-content: 158ch;
      --skirbi-triptych-aside: 14rem;
      --skirbi-triptych-gap: clamp(1rem, 2vw, 2rem);
      --skirbi-triptych-edge: clamp(1rem, 3vw, 2rem);
      margin-block-start: 2rem;
    }

    semtic-grid[triptych="workspace"] > :nth-child(2):is(semtic-sidenav) {
      align-self: stretch;
      min-inline-size: 0;
      margin-block-start: -2rem;
      margin-inline-start: calc(-1 * var(--skirbi-triptych-edge));
      inline-size: calc(100% + var(--skirbi-triptych-edge));
      background: var(--skirbi-quaternary-main);
    }

    semtic-grid[triptych="workspace"] > :nth-child(2):is(semtic-sidenav) > nav {
      position: static;
      block-size: 100%;
      inline-size: 100%;
      box-sizing: border-box;
      padding-inline-start: var(--skirbi-triptych-edge);
      transform: none;
    }

    semtic-sidenav {
      align-self: start;
    }

    semtic-sidenav > nav {
      block-size: 100%;
      background: var(--skirbi-quaternary-main);
      color: var(--skirbi-quaternary-contrast);
    }

    semtic-sidenav > nav > div {
      margin-block-end: 0.75rem;
      color: var(--skirbi-quaternary-contrast);
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    semtic-grid[triptych="workspace"] > :nth-child(2):is(semtic-sidenav) > nav > [semtic-sidenav-label] {
      box-sizing: border-box;
      inline-size: calc(100% + var(--skirbi-triptych-edge));
      margin-inline-start: calc(-1 * var(--skirbi-triptych-edge));
      padding-inline-start: calc(0.75rem + var(--skirbi-triptych-edge));
    }

    semtic-sidenav semtic-nav-item a {
      display: block;
      padding: 0.45rem 0;
      border-radius: 0.45rem;
      color: var(--skirbi-quaternary-contrast);
      transition: background-color 0.15s ease, color 0.15s ease;
    }

    semtic-sidenav semtic-nav-item a:hover,
    semtic-sidenav semtic-nav-item a:focus-visible {
      background: var(--skirbi-quaternary-strong);
      color: var(--skirbi-quaternary-contrast);
    }

    semtic-sidenav [semtic-nav-link]::before {
      margin-inline-start: -0.75rem;
      margin-inline-end: 1.125rem;
    }



  }
}

@layer skirbi-app {
  [skirbi-theme] {
    font-size: 0.9rem;

    [invoice-details],
    [invoice-lines] {
      --invoice-summary: var(--skirbi-control-bg);
      --invoice-canvas: var(--invoice-summary);
      --invoice-surface: var(--invoice-summary);
      --invoice-field: var(--invoice-summary);
    }

    semtic-select [skirbi-select] {
      position: relative;
    }

    semtic-select select[wc-control] {
      appearance: none;
      -webkit-appearance: none;
      padding-inline-end: 2rem;
    }

    semtic-select [skirbi-select]::after {
      position: absolute;
      inset-inline-end: 0.8rem;
      inset-block-start: 50%;
      width: 0.45rem;
      height: 0.45rem;
      border-inline-end: 1.5px solid currentColor;
      border-block-end: 1.5px solid currentColor;
      content: '';
      pointer-events: none;
      transform: translateY(-50%) rotate(45deg);
    }

    :is(semtic-input, semtic-select, semtic-input-number) [wc-control],
    semtic-input-number [semtic-input-container] {
      block-size: 1.8rem;
      min-block-size: 1.8rem;
      padding-block: 0.4rem;
    }

    semtic-input-number [semtic-input-container] {
      padding-block: 0;
    }

    :is(input[wc-control], select[wc-control], textarea[wc-control]) {
      font-size: 0.85rem;
    }

    fieldset[invoice-details] :is(input[wc-control], select[wc-control], textarea[wc-control]):focus-within {
      border-color: var(--skirbi-secondary-main);
      outline: 2px solid color-mix(in srgb, var(--skirbi-secondary-main) 20%, transparent);
    }

    [invoice-details] [invoice-debtor-control] button,
    [invoice-details] button[extra] {
      border: 0;
      background: transparent;
      color: var(--skirbi-secondary-main);
      font-size: 0.75rem;
      font-weight: 600;
      text-transform: none;
    }

    [invoice-details] semtic-form-row:first-child > semtic-stack {
      position: relative;
    }

    [invoice-details] [invoice-field-actions],
    eek-invoice-row [invoice-item-control] [invoice-field-actions] {
      position: absolute;
      inset-block-start: -0.2rem;
      inset-inline-end: 0;
      align-items: center;
      margin: 0;
    }

    [invoice-details] [invoice-field-actions] button,
    eek-invoice-row [invoice-item-control] [invoice-field-actions] button {
      padding-inline: 0.25rem;
    }

    [invoice-details] [invoice-field-actions] button svg {
      display: block;
      inline-size: 0.9rem;
      block-size: 0.9rem;
      fill: none;
      stroke: currentColor;
      stroke-linecap: round;
      stroke-linejoin: round;
      stroke-width: 1.8;
    }

    semtic-header[invoice-page-header] > header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
    }

    semtic-header[invoice-page-header] > header > form {
      margin: 0;
    }

    semtic-header[invoice-page-header] [invoice-header-actions] {
      align-items: center;
      justify-content: flex-end;
      gap: 0.5rem;
    }

    fieldset[invoice-details] > semtic-grid[invoice-header-grid] > :is([invoice-summary-totals], [invoice-summary-bbo]) {
      align-self: stretch;
      box-sizing: border-box;
      min-inline-size: 0;
      margin: 0;
      padding: 1rem;
      border: 1px solid var(--skirbi-surface-border-final, #d8d9df);
      border-radius: 0.6rem;
      background: var(--invoice-summary, #e5ebe4);
      position: sticky;
      top: 1rem;
      z-index: 1;
    }

    [invoice-summary-totals] {
      align-items: stretch;
    }

    [invoice-summary-totals] > semtic-flex {
      min-inline-size: 0;
      gap: 1rem;
      color: var(--skirbi-text-muted-final, #687080);
    }

    [invoice-summary-totals] [invoice-total] {
      color: var(--skirbi-text-final, #172033);
      border-color: var(--skirbi-surface-border-final, #d8d9df);
    }

    [invoice-summary-bbo] h4 {
      margin-block-start: 0;
      color: var(--skirbi-text-final, #172033);
      font-size: 0.8rem;
      text-transform: none;
    }

    [invoice-lines] {
      margin-block: 1.5rem;
      padding: 1.25rem;
      border: 1px solid var(--skirbi-surface-border-final, #d8d9df);
      border-radius: 0.6rem;
      background: var(--invoice-canvas);
    }

    [invoice-workspace] {
      min-inline-size: 0;
    }

    [invoice-form] fieldset[invoice-details] > semtic-grid[invoice-header-grid] {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    [invoice-form] fieldset[invoice-details] > semtic-grid[invoice-header-grid] > semtic-form-row:nth-child(4) > semtic-select {
      grid-column: auto;
      grid-row: auto;
    }

    [invoice-summary-panel] {
      position: sticky;
      top: 1rem;
      min-inline-size: 0;
      padding: 0;
    }

    aside > panel[panelbox] {
      display: block;
      box-sizing: border-box;
      inline-size: 100%;
      padding: 1.25rem;
      border: 1px solid var(--skirbi-control-border);
      border-radius: 0.7rem;
      background: var(--invoice-summary, #e5ebe4);
    }

    [invoice-summary-panel] h3 {
      margin: 0 0 1rem;
      color: var(--skirbi-text-final, #172033);
      font-size: 1rem;
    }

    [invoice-summary-panel] [invoice-totals-summary] {
      align-items: stretch;
      margin: 0 0 1rem;
    }

    [invoice-summary-panel] [invoice-totals-summary] > semtic-flex {
      min-inline-size: 0;
      gap: 1rem;
    }

    [invoice-attachments] {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 1.5rem;
      margin-block-start: 1.5rem;
    }

    [invoice-attachments] > h3 {
      grid-column: 1 / -1;
    }

    [invoice-summary-panel] [invoice-attachment-actions] form,
    [invoice-summary-panel] [invoice-attach-existing] {
      display: flex;
      flex-direction: column;
      align-items: stretch;
    }

    [invoice-summary-panel] [invoice-attach-existing] button {
      align-self: flex-start;
      margin-block-start: 0;
    }

    [invoice-summary-panel] [invoice-attachment-overview] li {
      align-items: stretch;
      flex-direction: column;
      gap: 0.5rem;
    }

    [invoice-summary-panel] [invoice-attachment-file-actions] {
      align-self: flex-start;
    }

    [settings-workspace] {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 1.5rem;
      margin-block-start: 2rem;
      padding-inline: 2rem;
    }

    [settings-workspace] > :is(semtic-header, semtic-toast, script),
    [settings-workspace] > fieldset[settings-panel] {
      grid-column: 1 / -1;
    }

    [settings-workspace] fieldset {
      box-sizing: border-box;
      min-inline-size: 0;
      margin: 0;
    }

    [settings-workspace] > form {
      min-inline-size: 0;
      margin: 0;
    }

    [settings-workspace] fieldset p {
      color: var(--skirbi-text-muted-final, #687080);
      font-size: 0.8rem;
      line-height: 1.4;
    }

    [invoice-attachment-actions],
    [invoice-attachment-overview] {
      min-inline-size: 0;
    }

    [invoice-attachments] h4 {
      margin: 0 0 0.75rem;
      color: var(--skirbi-text-final, #172033);
      font-size: 0.85rem;
    }

    [invoice-attachment-actions] form {
      display: flex;
      align-items: end;
      gap: 0.75rem;
      margin-block-end: 1rem;
    }

    [invoice-attachment-actions] semtic-input,
    [invoice-attachment-actions] semtic-select {
      flex: 1 1 auto;
      min-inline-size: 0;
    }

    [invoice-attachment-actions] button {
      block-size: 1.8rem;
      min-block-size: 1.8rem;
      padding-block: 0.4rem;
    }

    [invoice-attach-existing] {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: start;
    }

    [attach-existing-label] {
      grid-column: 1;
      grid-row: 1;
      margin-block-end: 0.35rem;
      color: var(--skirbi-text-muted-final, #687080);
      font-size: 0.72rem;
    }

    [invoice-attach-existing] semtic-select {
      grid-column: 1;
      grid-row: 2;
    }

    [invoice-attach-existing] button {
      grid-column: 2;
      grid-row: 2;
      margin-block-start: 0;
    }

    [invoice-attachment-overview] ul {
      display: grid;
      gap: 0.6rem;
      margin: 0;
      padding: 0;
      list-style: none;
    }

    [invoice-attachment-overview] li {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      min-inline-size: 0;
      padding-block: 0.35rem;
      border-block-end: 1px solid var(--skirbi-control-border);
    }

    [invoice-attachment-overview] li > div {
      min-inline-size: 0;
    }

    [invoice-attachment-file-actions] {
      display: flex;
      align-items: center;
      gap: 0.25rem;
      flex: 0 0 auto;
    }

    [invoice-attachment-file-actions] form {
      margin: 0;
    }

    [invoice-attachment-overview] li span {
      display: block;
      overflow: hidden;
      color: var(--skirbi-text-muted-final, #687080);
      font-size: 0.8rem;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    [invoice-attachment-overview] p {
      margin: 0;
      color: var(--skirbi-text-muted-final, #687080);
    }

    [invoice-attachment-actions] button svg,
    [invoice-attachment-overview] button svg {
      display: block;
      inline-size: 0.9rem;
      block-size: 0.9rem;
      fill: none;
      stroke: currentColor;
      stroke-linecap: round;
      stroke-linejoin: round;
      stroke-width: 2;
    }

    [invoice-summary-notes] {
      margin-block-start: 1.25rem;
      padding: 0;
      border: 0;
      background: transparent;
    }

    [invoice-summary-notes]::before {
      border: 0;
    }

    [invoice-summary-notes] > legend {
      position: absolute;
      inset-block-start: 0.75rem;
      inset-inline: 0.75rem;
      z-index: 1;
      background: transparent;
    }

    [invoice-summary-notes] > semtic-textarea {
      margin-block-start: 1.75rem;
    }

    [invoice-summary-currency-note] {
      margin: 0 0 1rem;
      color: var(--skirbi-text-muted-final, #687080);
      font-size: 0.8rem;
      line-height: 1.35;
    }

    [invoice-summary-status] {
      margin-block-end: 1rem;
    }

    [invoice-lines-heading] {
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 1rem;
      margin-block-end: 1rem;
    }

    [invoice-lines-heading] h3 {
      margin: 0;
      color: var(--skirbi-text-final, #172033);
      font-size: 1.05rem;
    }

    eek-invoice-row {
      border-color: var(--skirbi-primary-soft);
      background: var(--invoice-surface, #f5f3ee);
    }

    eek-invoice-row:hover,
    eek-invoice-row:focus-within {
      border-color: var(--skirbi-secondary-main);
      box-shadow: 0 1px 4px rgba(23, 32, 51, 0.06);
    }

    eek-invoice-row[data-pending] {
      border-style: solid;
      background: var(--invoice-field, #ebe9e2);
    }


    eek-invoice-row [data-description-toggle] {
      border: 0;
      background: transparent;
      color: var(--skirbi-secondary-main);
      text-transform: none;
    }

    eek-invoice-row:not([data-description-expanded]) [invoice-description] {
      display: flex;
      align-items: end;
    }

    eek-invoice-row [data-description-preview] {
      min-inline-size: 0;
      align-self: start;
      justify-self: start;
      inline-size: 100%;
      block-size: 2.1rem;
      min-block-size: 2.1rem;
      color: var(--skirbi-text-muted-final, #687080);
      font-size: 0.8rem;
      line-height: 1.3;
      text-align: start;
      overflow-wrap: anywhere;
      overflow: hidden;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
    }

    eek-invoice-row [data-description-preview][hidden] {
      visibility: hidden;
    }

    eek-invoice-row > semtic-grid > [data-description-toggle] {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      inline-size: 1.75rem;
      block-size: 1.75rem;
      padding: 0;
    }

    eek-invoice-row [data-description-toggle] svg {
      inline-size: 0.9rem;
      block-size: 0.9rem;
      fill: none;
      stroke: currentColor;
      stroke-linecap: round;
      stroke-linejoin: round;
      stroke-width: 1.8;
    }

    eek-invoice-row > semtic-grid > [invoice-item-control] {
      position: relative;
      grid-column: 1 / span 2;
      grid-row: 1;
      min-inline-size: 0;
    }

    eek-invoice-row > semtic-grid > [invoice-item-control] > semtic-input {
      inline-size: 100%;
    }

    eek-invoice-row > semtic-grid > [invoice-item-control] > [data-description-toggle] {
      position: absolute;
      inset-block-start: -0.2rem;
      inset-inline-end: 0;
      inline-size: auto;
      block-size: auto;
      padding-inline: 0.25rem;
      border: 0;
      background: transparent;
      color: var(--skirbi-secondary-main);
    }

    eek-invoice-row > semtic-grid {
      position: relative;
    }

    eek-invoice-row > semtic-grid > semtic-input[data-field="item"] {
      inline-size: calc(100% - 2rem);
    }

    eek-invoice-row > semtic-grid > [data-description-toggle] {
      position: static;
      grid-column: 1;
      grid-row: 1;
      justify-self: end;
      align-self: end;
    }

    eek-invoice-row [data-description-modal] {
      display: block;
    }

    eek-invoice-row > semtic-grid {
      grid-template-columns: minmax(14rem, 2fr) 1.75rem minmax(6rem, 0.8fr) minmax(6rem, 0.8fr) minmax(6rem, 0.8fr) minmax(7.5rem, 1.1fr) minmax(6rem, 0.8fr) repeat(4, minmax(6rem, 1fr)) 1.75rem;
    }

    eek-invoice-row > semtic-grid > [data-description-toggle] {
      grid-column: 2;
      grid-row: 1;
      justify-self: center;
    }

    eek-invoice-row > semtic-grid > [data-field="product_unit"] {
      grid-column: 3;
      grid-row: 1;
    }


    eek-invoice-row > semtic-grid > [data-field="quantity"] {
      grid-column: 5;
      grid-row: 1;
    }

    eek-invoice-row > semtic-grid > [data-field="tax_rate"] {
      grid-column: 6;
      grid-row: 1;
    }

    eek-invoice-row > semtic-grid > [data-field="price"] {
      grid-column: 7;
      grid-row: 1;
    }

    eek-invoice-row > semtic-grid > [data-row-action] {
      grid-column: 8;
      grid-row: 1;
    }

    eek-invoice-row > semtic-grid > [invoice-description] {
      grid-column: 1 / span 2;
      grid-row: 2;
    }

    eek-invoice-row > semtic-grid > [data-row-totals] {
      grid-column: 9 / -1;
      grid-row: 1;
    }

    eek-invoice-row > semtic-grid > [data-row-totals] {
      display: grid;
      grid-template-columns: repeat(4, minmax(3.5rem, 1fr));
      align-self: start;
    }

    eek-invoice-row > semtic-grid > [data-row-totals] {
      grid-template-columns: minmax(0, 1fr);
      justify-items: center;
      text-align: center;
      color: var(--skirbi-text-final, #172033);
    }

    eek-invoice-row > semtic-grid > [data-row-totals] > :is([data-field="subtotal_price"], [data-field="subtotal_discount"], [data-field="subtotal_tax"]) {
      display: none;
    }

    eek-invoice-row > semtic-grid > [data-row-totals] > [data-field="total"] {
      align-items: center;
      text-align: center;
      color: var(--skirbi-text-final, #172033);
    }

    eek-invoice-row > semtic-grid > [data-row-breakdown] {
      grid-column: 4 / span 3;
      grid-row: 2;
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      align-items: start;
      gap: 0.5rem;
      margin-block-start: -0.45rem;
      margin-block-end: 0;
      margin-inline: 0;
      padding: 0;
      background: transparent;
      color: var(--skirbi-text-muted-final, #687080);
      font-size: 0.75rem;
      line-height: 1.2;
    }

    eek-invoice-row > semtic-grid > [data-row-breakdown] span {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 0.15rem;
      min-inline-size: 0;
      text-align: start;
      white-space: nowrap;
    }

    eek-invoice-row > semtic-grid > [data-row-breakdown] span::before {
      content: attr(data-label);
      font-weight: 600;
    }
    eek-invoice-row > semtic-grid {
      grid-template-columns: minmax(14rem, 2fr) 1.75rem minmax(6rem, 0.8fr) minmax(6rem, 0.8fr) minmax(7.5rem, 1.1fr) minmax(6rem, 0.8fr) minmax(6rem, 1fr) auto;
      grid-template-areas:
        "item item unit quantity price tax total action"
        "description description breakdown breakdown breakdown breakdown total .";
    }

    eek-invoice-row > semtic-grid > [data-field="price"],
    eek-invoice-row > semtic-grid > [data-row-totals] {
      grid-row: 1 / span 2;
      align-self: center;
    }

    eek-invoice-row > semtic-grid > [data-row-totals] {
      grid-column: 8 / -2;
    }

    eek-invoice-row > semtic-grid > [data-row-action] {
      grid-column: -2 / -1;
    }

    eek-invoice-row > semtic-grid > [data-field="quantity"] {
      grid-column: 4;
    }

    eek-invoice-row > semtic-grid > [data-field="price"] {
      grid-column: 6;
      justify-self: center;
      place-self: center;
      inline-size: min(100%, 8rem);
      max-inline-size: 8rem;
    }

    eek-invoice-row > semtic-grid > [data-field="price"] {
      grid-row: 1;
      align-self: start;
      justify-self: stretch;
      place-self: start stretch;
      inline-size: min(100%, 7.5rem);
      max-inline-size: 7.5rem;
    }


    eek-invoice-row > semtic-grid > [data-field="tax_rate"] {
      grid-column: 7;
    }

    eek-invoice-row > semtic-grid > [invoice-description] {
      margin-block-start: -0.45rem;
    }

    eek-invoice-row > semtic-grid > [data-row-slot="account"] {
      grid-column: span 2;
      min-inline-size: 0;
    }

    eek-invoice-row > semtic-grid > [data-row-slot="account"] [data-field="account"] {
      inline-size: 100%;
    }

    eek-invoice-row > semtic-grid > [invoice-item-control] {
      grid-area: item;
    }

    eek-invoice-row > semtic-grid > [data-field="product_unit"] {
      grid-area: unit;
    }

    eek-invoice-row > semtic-grid > [data-field="quantity"] {
      grid-area: quantity;
    }


    eek-invoice-row > semtic-grid > [data-field="price"] {
      grid-area: price;
    }

    eek-invoice-row > semtic-grid > [data-field="tax_rate"] {
      grid-area: tax;
    }

    eek-invoice-row > semtic-grid > [invoice-description] {
      grid-area: description;
    }

    eek-invoice-row > semtic-grid > [data-row-breakdown] {
      grid-area: breakdown;
    }

    eek-invoice-row > semtic-grid > [data-row-totals] {
      grid-area: total;
    }

    eek-invoice-row > semtic-grid > [data-row-action] {
      grid-area: action;
    }

    @media (min-width: 48rem) and (max-width: 69rem) {
      eek-invoice-row {
        position: relative;
      }

      eek-invoice-row > semtic-grid {
        position: static;
      }

      eek-invoice-row > semtic-grid > [data-row-totals] {
        grid-column: 6;
        grid-row: 2;
        align-self: center;
      }

      eek-invoice-row > semtic-grid > [data-row-breakdown] {
        grid-column: 3 / span 3;
        grid-row: 2;
      }

      eek-invoice-row > semtic-grid > [data-row-action] {
        position: absolute;
        inset-block-start: 0.25rem;
        inset-inline-end: 0.25rem;
        grid-column: auto;
        grid-row: auto;
        align-self: auto;
        justify-self: auto;
      }
    }

    @media (max-width: 48rem) {
      [invoice-form] fieldset[invoice-details] > form > semtic-grid[invoice-header-grid] {
        grid-template-columns: minmax(0, 1fr);
        gap: 0 0.75rem;
      }

      [invoice-form] fieldset[invoice-details] > form > semtic-grid[invoice-header-grid] > semtic-form-row {
        display: grid;
        grid-column: 1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 0.75rem;
      }

      fieldset[invoice-details] > form > semtic-grid[invoice-header-grid] > semtic-form-row:nth-child(n) {
        display: grid;
        grid-column: 1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      [invoice-form] fieldset[invoice-details] > form > semtic-grid[invoice-header-grid] > semtic-textarea {
        grid-column: 1 / -1;
      }

      eek-invoice-row {
        position: relative;
        padding: 0.6rem;
      }

      eek-invoice-row > semtic-grid {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
          "item total"
          "description description"
          "unit quantity"
          "price price"
          "tax tax"
          "breakdown breakdown";
        row-gap: 0.5rem;
        column-gap: 0;
      }

      eek-invoice-container {
        gap: 0.75rem;
      }

      eek-invoice-row > semtic-grid > :is(semtic-input, semtic-select, semtic-input-number, [invoice-description], [data-row-breakdown], [data-row-totals]) {
        grid-column: auto;
        grid-row: auto;
        inline-size: 100%;
        min-inline-size: 0;
        max-inline-size: none;
      }

      eek-invoice-row > semtic-grid > [invoice-item-control] {
        grid-area: item;
        grid-column: 1;
        grid-row: 1;
        inline-size: 100%;
        padding-inline-end: 2.25rem;
      }

      eek-invoice-row > semtic-grid > [data-field="product_unit"] {
        grid-area: unit;
        grid-column: 1;
        grid-row: 3;
      }

      eek-invoice-row > semtic-grid > [data-field="quantity"] {
        grid-area: quantity;
        grid-column: 2;
        grid-row: 3;
      }


      eek-invoice-row > semtic-grid > [data-field="price"] {
        grid-area: price;
        grid-column: 2;
        grid-row: 4;
        min-inline-size: 0;
        inline-size: 100%;
        max-inline-size: 100%;
      }

      eek-invoice-row > semtic-grid > [data-field="tax_rate"] {
        grid-area: tax;
        grid-column: 1 / -1;
        grid-row: 5;
      }

      eek-invoice-row > semtic-grid > [invoice-description] {
        grid-area: description;
        grid-column: 1 / -1;
        grid-row: 2;
        margin-block-start: 0;
      }

      eek-invoice-row > semtic-grid > [data-row-breakdown] {
        grid-area: breakdown;
        grid-column: 1 / -1;
        grid-row: 6;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
        align-items: start;
      }

      eek-invoice-row > semtic-grid > [data-row-totals] {
        grid-area: total;
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        align-self: start;
        padding-inline-end: 2rem;
      }

      eek-invoice-row > semtic-grid > [data-row-action] {
        position: absolute;
        inset-block-start: 0.25rem;
        inset-inline-end: 0.25rem;
      }

      eek-invoice-row > semtic-grid > [invoice-item-control] > [invoice-field-actions] {
        inset-inline-end: 2.25rem;
      }
    }


    /* The chart of accounts as a drill-down (account_chart.html.ep): a
     * column of rows, each one a link a level deeper. A group gets a
     * chevron to say there is more behind it; a ledger account does not,
     * it opens its transactions. */
    [chart-section] > h2 {
      margin: 1.5rem 0 0.5rem;
      font-size: 0.8rem;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      opacity: 0.65;
    }

    [chart-list] {
      list-style: none;
      margin: 0 0 1.5rem;
      padding: 0;
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 0.6rem;
    }

    @media (max-width: 60rem) {
      [chart-list] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (max-width: 36rem) {
      [chart-list] {
        grid-template-columns: minmax(0, 1fr);
      }
    }

    /* A card that is a link: the number small on top, the name, and what is
     * in it at the bottom. A group has a chevron in the corner. */
    [chart-list] a {
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 0.15rem;
      min-height: 4.6rem;
      height: 100%;
      box-sizing: border-box;
      padding: 0.65rem 0.85rem;
      border: 1px solid var(--skirbi-control-border);
      border-radius: 0.75rem;
      background: var(--skirbi-control-bg);
      color: inherit;
      text-decoration: none;
      transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
    }

    [chart-list] a:hover,
    [chart-list] a:focus-visible {
      border-color: var(--skirbi-primary-main);
      box-shadow: 0 2px 8px rgb(0 0 0 / 0.08);
      transform: translateY(-1px);
    }

    [chart-list] a[chart-item="group"]::after {
      content: "\203A";
      position: absolute;
      inset-block-start: 0.4rem;
      inset-inline-end: 0.75rem;
      font-size: 1.3rem;
      line-height: 1;
      opacity: 0.45;
    }

    [chart-list] [chart-desc] {
      font-size: 0.9rem;
      line-height: 1.25;
    }

    [chart-list] a[chart-item="group"] [chart-desc] {
      font-weight: 600;
    }

    [chart-number] {
      font-size: 0.7rem;
      font-variant-numeric: tabular-nums;
      opacity: 0.6;
    }

    [chart-meta] {
      margin-block-start: auto;
      padding-block-start: 0.35rem;
      font-size: 0.72rem;
      opacity: 0.7;
    }

    /* The entities table: an archived row shows Restore, an active one the
     * rest. !important because the forms carry an inline display: inline. */
    form[data-when="active"][data-row-status="Archived" i],
    form[data-when="archived"][data-row-status="Active" i] {
      display: none !important;
    }

    [chart-actions] {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin: 0 0 1.25rem;
    }

    semtic-breadcrumb {
      display: block;
      margin: 0.25rem 0 1.25rem;
      font-size: 0.85rem;
    }

    semtic-breadcrumb ol {
      list-style: none;
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
      margin: 0;
      padding: 0;
    }

    semtic-breadcrumb [aria-current="page"] {
      font-weight: 600;
    }
  }
}

[data-row-action] > [data-discount-toggle] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 1.75rem;
  block-size: 1.75rem;
  padding: 0;
}

[data-row-action] > [data-discount-toggle] svg {
  display: block;
  inline-size: 0.9rem;
  block-size: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-discount-toggle][data-discounted] {
  color: var(--pinta-accent, currentColor);
  box-shadow: inset 0 0 0 1px currentColor;
}

[data-discount-label] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

[data-discount-modal] > button[data-discount-clear] {
  margin-block-start: 1rem;
}
