/* Shared circle and outlined-square actions. */
.home-action-row.home-action-pair {margin: 0;flex-wrap: nowrap;gap: var(--pair-gap);}
.home-action-row.home-action-pair .home-tile {--tile-size: var(--pair-tile);font-size: var(--pair-label);}
@media (max-width: 600px) {
  .home-action-pair .home-tile__label {inset-inline: 10px;}
}
@media (max-width: 400px) {
  .home-action-pair .home-tile__label {inset-inline: 9px;}
}
body:has(.first-visit-welcome[data-first-invoice]) .app-footer {background: var(--blue);}
body:has(.first-visit-welcome[data-office-ready]) {--centered-entry-actions-width:calc(3 * var(--pair-tile) + 2 * var(--pair-gap));}

body:has(.first-visit-welcome) {
  --sidebar-rail: var(--entry-frame-rail);
  --entry-welcome-top: clamp(64px, calc(7.6svh + 30px), 106px);
  --entry-welcome-label: 24px;
  --entry-welcome-gap: 0px;
  --entry-welcome-title-row: clamp(84px, 16.5svh, 183px);
  --entry-welcome-action-row: clamp(108px, 14svh, 138px);
  --first-visit-inset: clamp(12px, 1.4vw, 24px);
}

/* Fit the office-ready composition between the fixed desktop bars. Use the
   available top whitespace before changing the title rows or action tiles. */
@media (min-width: 761px) {
  body:has([data-office-ready]) .page-header {
    --ready-content-height: calc(1.35 * var(--entry-welcome-label) + 6px
      + 3 * var(--entry-welcome-title-row) + max(var(--entry-welcome-action-row), var(--pair-tile) + 24px));
    --entry-welcome-top: clamp(0px,
      100svh - var(--top) - var(--shell-footer-height) - var(--ready-content-height) - var(--work-inset-bottom),
      min(106px, calc(7.6svh + 30px)));
  }
}

body:has(.first-visit-welcome) .app-header {
  gap: calc(var(--entry-frame-wordmark-start) - (var(--sidebar-rail) + var(--sidebar-toggle-size)) / 2);
}
body:has(.first-visit-welcome) .sidebar {--sidebar-inset: 4px;}

body:has(.first-visit-welcome) .page-header {
  margin: 0;
  padding-block: var(--entry-welcome-top) calc(6px + var(--entry-welcome-gap));
  padding-inline: calc(var(--entry-grid-start) + var(--first-visit-inset)) calc(var(--entry-grid-end) + var(--first-visit-inset));
}
body:has(.first-visit-welcome) .page-header h1 {
  margin: 0;
  font-size: var(--entry-welcome-label);
  line-height: 1.35;
}
body:has(.first-visit-welcome) #app {
  max-width: none;
  padding: 0 var(--entry-grid-end) 24px var(--entry-grid-start);
}

.first-visit-welcome__title {
  container-type: inline-size;
}
.first-visit-welcome h2 {
  margin: 0;
  color: #171714;
  font: 400 min(13.5cqw, calc(var(--entry-welcome-title-row) * 1.065)) / .92 var(--first-visit-display-font);
  letter-spacing: -.047em;
}
.first-visit-welcome__line {
  position: relative;
  display: flex;
  align-items: center;
  min-height: min(var(--entry-welcome-title-row), 19cqw);
  padding-inline: var(--first-visit-inset);
  white-space: nowrap;
}
/* Screen 17 keeps the original two-line sticker title within the shared three-row grid. */
.first-visit-welcome h2:has(.landing-title-stickers) {position: relative;}
.landing-title-stickers {
  position: absolute;
  inset-inline-start: var(--first-visit-inset);
  inset-block-start: 50%;
  transform: translateY(-50%);
  font: 400 min(8.3vw, 108px) / 1.05 var(--ui-font);
  letter-spacing: -.05em;
}
.first-visit-welcome__actions {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: var(--entry-welcome-action-row);
}
.first-visit-welcome__line::before,
.first-visit-welcome__actions::before,
.first-visit-welcome__actions::after {
  content: "";
  position: absolute;
  inset: 0 calc(-1 * var(--entry-grid-end)) auto calc(-1 * var(--entry-grid-start));
  height: 5px;
  background: var(--entry-grid-row);
  pointer-events: none;
}
.first-visit-welcome__actions::after {inset-block: auto -4px;}
.first-visit-welcome__actions p {
  grid-column: 1 / 4;
  margin: 0;
  padding: calc(28px + var(--entry-welcome-gap)) var(--first-visit-inset) 22px;
  color: #56564f;
  font: 400 16px/1.5 var(--work-body-font);
  text-wrap: pretty;
}
.first-visit-welcome__setup {
  grid-column: 4;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 17px var(--first-visit-inset);
  background: var(--blue);
  color: var(--ink);
  font: var(--entry-action-font);
  letter-spacing: -.026em;
}
.first-visit-welcome__setup:hover {background: #a1adc9;}
.first-visit-welcome__setup:focus-visible {outline-offset: -5px;}
.first-visit-welcome__setup svg {
  width: 30px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
}

@media (min-width: 761px) {
  body:has([data-first-invoice]) .page-header .header-actions {
    height: calc(var(--entry-welcome-label) * 1.35);
    align-items: center;
  }
  body:has(.first-visit-welcome) {
    --sidebar-surface: #eeede8;
    --entry-welcome-gap: clamp(16px, 2.4svh, 24px);
  }
  .first-visit-welcome__line:is(:first-child, :nth-child(3))::before,
  .first-visit-welcome__actions::after {
    background: var(--entry-grid-dashed-row);
    mask-image: repeating-linear-gradient(to right, var(--entry-grid-dash));
  }
}
@media (max-width: 1050px) {
  .first-visit-welcome__actions {grid-template-columns: repeat(2, minmax(0, 1fr));}
  .first-visit-welcome__actions p {grid-column: 1;}
  .first-visit-welcome__setup {grid-column: 2;}
}
@media (max-width: 760px) {
  .first-visit-welcome h2 {font-size: 16cqw;}
  .first-visit-welcome__line {min-height: clamp(48px, 18cqw, 100px);}
}
@media (max-width: 600px) {
  .first-visit-welcome__actions {grid-template-columns: minmax(0, 1fr);}
  .first-visit-welcome__setup {grid-column: 1;min-height: 78px;}
}

/* Keep the original action tiles together on the right edge of the welcome grid. */
.first-visit-welcome__actions:has(.home-action-pair) {
  grid-template-columns: minmax(0, 1fr) max(25%, calc(var(--centered-entry-actions-width) + 2 * var(--first-visit-inset)));
}
.first-visit-welcome__actions:has(.home-action-pair) > p {grid-column: 1;}
.first-visit-welcome__actions > .home-action-pair {
  grid-column: 2;
  align-self: center;
  padding: 12px var(--first-visit-inset);
}
@media (max-width: 600px) {
  .first-visit-welcome__actions:has(.home-action-pair) {grid-template-columns: minmax(0, 1fr);}
  .first-visit-welcome__actions > .home-action-pair {grid-column: 1;}
}

/* Workspace landings use two fields: the title and its actions. The public
   invoice introduction keeps the welcome layout used for screens 04–07. */
@media (min-width: 1051px) {
  body:has([data-workspace-landing]) {
    --workspace-action-track: max(25%, calc(var(--centered-entry-actions-width) + 2 * var(--first-visit-inset)));
    --workspace-action-shift: 160px;
  }
  .main-shell:has(.landing-title-stickers) {
    /* Preserve a gap beside the sticker when the sidebar uses more of the canvas. */
    --workspace-width: calc(100vw - var(--sidebar) - var(--entry-grid-start) - var(--entry-grid-end));
    --sticker-line-width: min(42vw, 544px);
    --workspace-action-shift: clamp(0px, var(--workspace-width) - var(--centered-entry-actions-width) - 2 * var(--first-visit-inset) - var(--sticker-line-width) - 24px, 160px);
  }
  .main-shell:has([data-workspace-landing])::before {
    /* Split the title field in half and mark both edges of the action column. */
    --title-half: calc((100% - var(--workspace-action-track) - var(--workspace-action-shift)) / 2);
    background-image: var(--entry-grid-column), var(--entry-grid-column), var(--entry-grid-column), var(--entry-grid-column);
    background-size: 100% 100%, calc(100% - var(--title-half)) 100%, var(--workspace-action-track) 100%, var(--workspace-action-shift) 100%;
    background-position: left top, right top, right var(--workspace-action-shift) top, right top;
    background-repeat: no-repeat;
    mask-image: repeating-linear-gradient(to bottom, var(--entry-grid-dash));
  }
  [data-workspace-landing] .first-visit-welcome__actions {
    position: static;
    grid-template-columns: minmax(0, 1fr) var(--workspace-action-track) var(--workspace-action-shift);
  }
  [data-workspace-landing] .first-visit-welcome__actions > p {grid-row: 1;}
  [data-workspace-landing] .first-visit-welcome__actions::before,
  [data-workspace-landing] .first-visit-welcome__actions::after {
    position: relative;
    grid-area: 1 / 1 / 2 / -1;
    inset: auto;
    margin-inline: calc(-1 * var(--entry-grid-start)) calc(-1 * var(--entry-grid-end));
    align-self: start;
  }
  [data-workspace-landing] .first-visit-welcome__actions::after {align-self: end;translate: 0 4px;}
  /* Both slots follow screen 18, including when only the first action is available. */
  .main-shell:has([data-workspace-landing]) {
    --office-entry-action-x: calc((100vw + var(--office-entry-title-width) + var(--office-entry-column-gap) - var(--centered-entry-actions-width)) / 2);
  }
  [data-workspace-landing] .first-visit-welcome__actions > .home-action-pair {
    position: absolute;
    inset-inline-start: calc(var(--office-entry-action-x) - var(--sidebar));
    inset-block-start: calc((100svh - var(--office-entry-caption-space) - var(--office-entry-caption-height) - var(--pair-tile)) / 2 - var(--office-entry-action-lift));
    padding: 0;
  }
  [data-workspace-landing] .landing-title-stickers {
    /* Fit the two-line label beside the fixed action slots when the rail expands. */
    font-size: min(8.3vw, 108px, calc((var(--office-entry-action-x) - var(--sidebar) - var(--entry-grid-start) - var(--first-visit-inset) - 20px) / 5));
  }
}
