/* 7HubSales shell and screens. Only tokens of the design system (tokens.css); components use sh.css. */

html, body { height: 100%; }
#app { height: 100%; }

/* Boot bar (loading approach B): hidden for the first 300 ms. */
.app-boot { position: fixed; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; background: var(--accent-soft); opacity: 0; animation: app-boot-show 1ms linear var(--loading-delay) forwards; }
.app-boot > i { position: absolute; top: 0; bottom: 0; width: 34%; background: var(--accent); animation: sh-ind var(--loading-bar-cycle) var(--easing-standard) infinite; }
@keyframes app-boot-show { to { opacity: 1; } }

#blazor-error-ui { display: none; position: fixed; left: 50%; bottom: 16px; z-index: 70; transform: translateX(-50%); align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-2); color: var(--danger); }
#blazor-error-ui .reload { color: var(--ink); font-weight: 500; }
#blazor-error-ui .dismiss { border: 0; background: transparent; color: var(--ink-tertiary); cursor: pointer; }

/* Shell: menu, then the main panel */
.app { display: flex; gap: 8px; height: 100vh; min-height: 560px; padding: 8px; background: var(--canvas); overflow: hidden; }
.app-nav { flex: 0 0 224px; display: flex; flex-direction: column; padding: 4px 4px 4px 2px; min-height: 0; overflow-y: auto; }
.app-brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 6px; font-weight: 600; color: var(--ink); }
.app-mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--radius-chip); background: linear-gradient(145deg, var(--brand-ink-top) 0%, var(--brand-ink) 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 1px 2px rgba(15,15,15,.2); color: var(--on-accent); font-size: 13px; font-weight: 700; letter-spacing: -.02em; flex: none; }
.app-brand__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-company { margin: 4px 0 0; }
.app-group { font-size: 12px; font-weight: 500; color: var(--ink-tertiary); padding: 16px 8px 4px; }
.app-link { display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 8px; border-radius: var(--radius-chip); color: var(--ink-secondary); text-decoration: none; font-weight: 500; transition: background var(--duration-fast), color var(--duration-fast); }
.app-link:hover { background: rgba(15,15,15,.04); color: var(--ink); }
.app-link .sh-ic { color: var(--icon); }
.app-link.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.app-link.active .sh-ic { color: var(--ink); }
.app-link:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.app-nav__foot { margin-top: auto; padding-top: 12px; }
.app-user { display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 6px; border: 0; border-radius: var(--radius-chip); background: transparent; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.app-user:hover { background: rgba(15,15,15,.04); }
.app-user:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.app-user__text { flex: 1; min-width: 0; line-height: 16px; }
.app-user__name { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user__meta { display: block; font-size: 12px; color: var(--ink-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-nav__foot .sh-layer--float { top: auto; bottom: calc(100% + 6px); }

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-panel); box-shadow: var(--shadow-1); overflow: hidden; }
.app-top { flex: none; display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line-subtle); }
.app-crumbs { display: flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ink-tertiary); white-space: nowrap; min-width: 0; }
.app-crumbs .sh-ic { width: 14px; height: 14px; color: var(--icon); }
.app-crumbs [aria-current] { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.app-top__progress { position: absolute; left: 0; right: 0; bottom: -1px; }
.app-top { position: relative; }
.app-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 20px 32px; }

/* Screen header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.page-head h1 { margin: 0; }
.page-head__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head__sub { color: var(--ink-tertiary); margin-top: 2px; }
.page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Sections and panels */
.panel { margin-top: 16px; padding: 14px 16px 16px; border-radius: var(--radius-card); box-shadow: inset 0 0 0 1px var(--line); }
.panel__title { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 600; color: var(--ink-secondary); }
.panel__title .sh-muted { font-weight: 400; }
.section { margin-top: 24px; }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section__title { display: flex; align-items: center; gap: 6px; margin: 0; }
.row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.row--end { align-items: flex-end; }
.grow { flex: 1 1 200px; min-width: 160px; }
.muted { color: var(--ink-tertiary); }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: -.02em; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.link:hover { text-decoration-color: var(--ink-tertiary); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

/* 360 summary: one cell per fact */
.facts { display: grid; grid-template-columns: repeat(var(--facts, 5), minmax(0, 1fr)); margin-top: 16px; border-radius: var(--radius-card); box-shadow: inset 0 0 0 1px var(--line); }
.fact { padding: 14px 16px; min-width: 0; }
.fact + .fact { box-shadow: inset 1px 0 0 var(--line); }
.fact__label { display: flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; color: var(--ink-tertiary); }
.fact__value { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-height: 28px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact__value--big { font-size: 22px; line-height: 28px; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.fact__note { margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--ink-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact__links { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }

/* Two-column layout of the document screens */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.totals { border-radius: var(--radius-card); box-shadow: inset 0 0 0 1px var(--line); padding: 4px 14px; }
.totals__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-subtle); }
.totals__row:last-child { border-bottom: 0; }
.totals__row--grand > :last-child { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.025em; }
.mentions { margin-top: 8px; font-size: 12px; line-height: 16px; color: var(--ink-tertiary); }
.mentions b { font-weight: 500; color: var(--ink-secondary); margin-right: 6px; }

/* Line editor of the issue screen */
.lines-wrap { overflow-x: auto; }
/* Wide enough for the 820 px editor: no scroll box, so the suggestion lists open over the page. */
@media (min-width: 1180px) { .lines-wrap { overflow: visible; } }
/* Narrower: the scroll box grows while a suggestion list is open, so the list is not cut. */
@media (max-width: 1179px) { .lines-wrap:has(.sh-combobox__list) { padding-bottom: 330px; } }
.lines { width: 100%; min-width: 820px; border-collapse: collapse; table-layout: fixed; }
.lines th:nth-child(2) { width: 152px; }
.lines th:nth-child(3) { width: 118px; }
.lines th:nth-child(4) { width: 76px; }
.lines th:nth-child(5) { width: 178px; }
.lines th:nth-child(6) { width: 92px; }
.lines th:nth-child(7) { width: 40px; }
.lines .sh-field { min-width: 0; }
.lines th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-tertiary); padding: 0 6px 6px; white-space: nowrap; }
.lines td { padding: 4px 6px; vertical-align: top; }
.lines th.right, .lines td.right { text-align: right; }
.lines .sh-input { height: 32px; }
.lines tr + tr td { border-top: 1px solid var(--line-subtle); }
.lines__value { display: inline-block; padding-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; gap: 2px; }
.stepper .sh-field { width: 80px; }
.stepper .sh-input input { text-align: right; }
.choice { display: inline-flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }

/* Credit lines in the credit note dialog */
.credit-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-subtle); }
.credit-line:last-child { border-bottom: 0; }
.credit-line__meta { font-size: 12px; color: var(--ink-tertiary); }

/* Tabs of the audit trail */
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 2px; border: 0; background: transparent; font: inherit; font-weight: 500; color: var(--ink-tertiary); cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--ink); }
.tab:focus-visible { outline: 0; box-shadow: var(--focus-ring); border-radius: var(--radius-item); }
.tab__count { font-size: 12px; color: var(--ink-tertiary); font-variant-numeric: tabular-nums; }

/* Toolbar above tables */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.toolbar .sh-field { min-width: 160px; }
.toolbar__count { margin-left: auto; color: var(--ink-tertiary); font-size: 12px; }

/* Who cell */
.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.who__text { line-height: 16px; min-width: 0; }
.who__meta { display: block; font-size: 12px; color: var(--ink-tertiary); }

.pill-row { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.table-actions { display: inline-flex; gap: 6px; justify-content: flex-end; align-items: center; }
.validation-cell { display: inline-flex; gap: 6px; align-items: flex-start; }
.validation-cell .sh-field { width: 170px; }

@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact + .fact { box-shadow: inset 0 1px 0 var(--line); }
}
@media (max-width: 760px) {
  .app { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .app-nav { flex: none; }
  .facts { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .app-boot > i { animation: none; left: 0; width: 100%; opacity: .45; }
}
.field-action { padding-top: 26px; }

/* Sign-in and sign-out pages */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--canvas); }
.auth .sh-empty { min-width: 320px; box-shadow: var(--shadow-1); }
.lines tr.lines__info td { background: var(--surface-subtle); }

/* Overview: attention list */
.attention { border-radius: var(--radius-card); box-shadow: inset 0 0 0 1px var(--line); }
.attention__item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.attention__item + .attention__item { border-top: 1px solid var(--line-subtle); }
.attention__text { flex: 1; min-width: 0; line-height: 16px; }
.attention__text > span { display: block; }
.attention__text .muted { font-size: 12px; }

/* Documents: detail panel beside the list */
.detail { position: sticky; top: 0; padding: 16px; border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-1); }
.detail__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.detail__head h2 { margin: 0; }
.detail__block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-subtle); }

/* Information lines (D16) and observations in the review and the document */
.sh-table .info-text { color: var(--ink-secondary); font-style: italic; white-space: normal; }
.observations { margin: 0; padding: 12px 14px; border-radius: var(--radius-card); background: var(--surface-subtle); white-space: pre-line; overflow-wrap: anywhere; }

/* Document: activity list and voided related numbers */
.fact__links .is-void, .activity .is-void { color: var(--ink-tertiary); text-decoration: line-through; }
.activity { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.activity__item { display: flex; gap: 10px; padding-bottom: 12px; }
.activity__item > .sh-dot { margin-top: 6px; flex: none; }
.activity__meta { font-size: 12px; line-height: 16px; color: var(--ink-tertiary); }

/* Overview: recent documents */
a.recent { color: inherit; text-decoration: none; }
a.recent:hover { background: var(--surface-subtle); }
.recent .is-void { color: var(--ink-tertiary); text-decoration: line-through; }
/* The product list is wider than the code cell it opens from. */
.lines .sh-combobox__list { right: auto; min-width: 400px; }
.activity__label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 5px; }

/* Users and profiles (D12): the users on the left, the profiles or the permission editor on the right */
.users-layout { display: flex; align-items: flex-start; gap: 16px; }
.users-main { flex: 1 1 auto; min-width: 0; }
/* The profile menu of a row floats over the table: the table must not clip it near the last rows. */
.users-main .sh-tablewrap { overflow: visible; }
/* Row actions (reset access): shown on hover, on keyboard focus and while their menu is open. */
.row-actions { display: flex; justify-content: flex-end; }
.users-main .row-actions__open { opacity: 0; transition: opacity var(--duration-fast) var(--easing-standard); }
.users-main tr:hover .row-actions__open, .users-main .row-actions__open:focus-visible, .users-main .row-actions__open.is-open { opacity: 1; }
.users-aside { flex: 0 0 404px; min-width: 0; padding: 16px; border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-1); }
.table-footer { margin-top: 8px; font-size: 12px; color: var(--ink-tertiary); }
.profile-list { display: flex; flex-direction: column; }
.profile-row { display: flex; align-items: flex-start; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line-subtle); }
.profile-row:first-child { border-top: 0; }
.profile-row__main { flex: 1; min-width: 0; }
.profile-row__name { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.profile-row__meta { font-size: 12px; line-height: 16px; color: var(--ink-tertiary); }
.profile-row__actions { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.profile-pill { display: inline-flex; align-items: center; gap: 2px; padding-right: 2px; }
.profile-pill--own { background: var(--accent-wash); color: var(--accent-strong); }
.profile-pill__remove { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--ink-tertiary); cursor: pointer; }
.profile-pill__remove:hover { background: var(--surface-subtle); color: var(--ink); }
.profile-pill__remove:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.profile-pill__remove .sh-ic, .profile-pill__lock { width: 12px; height: 12px; }
.profile-editor__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.profile-editor__title { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; }
.perm-areas { display: flex; flex-direction: column; gap: 8px; }
.perm-area { margin: 0; padding: 10px 12px; border: 0; border-radius: var(--radius-card); box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 6px; }
/* Floated, the legend is laid out inside the frame instead of on its top line. */
.perm-area__head { float: left; display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; font-weight: 500; }
.perm-area__name { flex: 1; }
.perm-area__all { margin-left: 8px; font-weight: 400; }
.profile-editor__foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.profile-editor__foot > .muted { flex: 1; font-size: 12px; }
/* D21: a function the user does not hold is shown locked, with the reason in a tip. */
.perm-area > .sh-tipwrap { display: flex; }
.perm-locked { color: var(--ink-tertiary); }
.perm-lock { width: 12px; height: 12px; margin-left: 6px; color: var(--ink-tertiary); }
/* D19: the account of a person who has none yet, under the grant form, and its temporary password shown once. */
.grant-create { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-subtle); }
.grant-create__head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--ink-secondary); }
.grant-create__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--ink); }
.pw-once { margin-left: auto; }
.pw-box { display: flex; align-items: center; gap: 8px; height: 48px; margin-top: 6px; padding: 0 6px 0 14px; border-radius: var(--radius-card); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--line); }
/* One click selects the whole password, for when the browser refuses the clipboard. */
.pw-box__value { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 17px; font-weight: 500; letter-spacing: .04em; color: var(--ink); user-select: all; }
@media (max-width: 1100px) {
  .users-layout { flex-direction: column; }
  .users-aside { flex-basis: auto; width: 100%; }
}

/* Communication to the tax authority (phase 7) */
.at-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-card); background: var(--surface-subtle); color: var(--ink-secondary); }
.at-strip > .sh-ic { color: var(--ink-tertiary); }
.at-strip > .at-strip__ok { color: var(--success-dot); }
.at-answer { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.at-answer > .sh-ic { width: 14px; height: 14px; color: var(--ink-tertiary); }
.at-answer__code { color: var(--danger); }
.at-answer__text { color: var(--ink-secondary); white-space: normal; }
.at-cards { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.at-card { flex: 1 1 420px; min-width: 0; padding: 16px; border-radius: var(--radius-panel); box-shadow: inset 0 0 0 1px var(--line); }
.at-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.at-card__title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 600; }
.at-card__keep { display: flex; flex-wrap: wrap; gap: 16px; margin: 14px 0 0; padding: 0; border: 0; }
.at-card__keep legend { float: left; width: 100%; margin-bottom: 6px; font-size: 12px; font-weight: 500; color: var(--ink-secondary); }
.at-card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; }
.at-card__foot > .muted { font-size: 12px; }
.at-lock { display: flex; gap: 10px; margin-top: 16px; padding: 10px 12px; border-radius: var(--radius-card); background: var(--surface-subtle); color: var(--ink-secondary); }
.at-lock > .sh-ic { margin-top: 2px; color: var(--ink-tertiary); }
.app-link__count { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--warning-soft); color: var(--warning); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-card { margin: 12px 4px 0; padding: 10px 12px; border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-1); }
.nav-card__title { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink); }
.nav-card__text { margin-top: 4px; font-size: 12px; line-height: 16px; color: var(--ink-tertiary); }
.nav-card .sh-kpi__meter { margin-top: 8px; }
.nav-card__action { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 500; }
.manual-doc { margin-top: 12px; padding: 14px 16px 16px; border-radius: var(--radius-card); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--line); }
.manual-doc__out { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--ink-tertiary); }
.manual-doc__out b { font-weight: 500; color: var(--ink); }

.at-card .sh-dialog__summary { margin: 12px 0 0; }
.at-selection { align-items: center; justify-content: space-between; padding: 6px 8px 6px 12px; border-radius: var(--radius-card); background: var(--surface-subtle); }
.at-selection .at-delete { color: var(--danger); }
