/* Styles for the two base templates and the macros in templates/_components.html.
   Every value comes from tokens.css. */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: var(--fs-base);
    line-height: 1.5;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: var(--space-lg);
    top: -3rem;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border-radius: var(--r-sm);
}

.skip-link:focus {
    top: var(--space-sm);
}

/* Header and page. One content column, 976 px wide, centred. The bar is 56 px high and its
   contents line up with the column. */

.site-header {
    border-bottom: 1px solid var(--border);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    height: 3.5rem;
    max-width: calc(61rem + 2 * var(--space-xl));
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
}

.brand-mark {
    width: 1.5rem;
    height: 1.3rem;
}

.wordmark {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.site-name {
    color: var(--text-secondary);
}

.page {
    max-width: calc(61rem + 2 * var(--space-xl));
    margin: 0 auto;
    padding: calc(2 * var(--space-xl)) var(--space-xl) calc(3 * var(--space-xl));
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.page-title {
    margin: 0;
    font-size: var(--fs-xl);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.page-intro {
    margin: var(--space-sm) 0 0;
    color: var(--text-secondary);
}

/* Cards, stats and badges */

.card {
    padding: var(--space-xl);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}

.card > :first-child {
    margin-top: 0;
}

.card > :last-child {
    margin-bottom: 0;
}

.stat-card {
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}

.stat-label {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.stat-value {
    font-size: var(--fs-lg);
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 0.1rem var(--space-sm);
    border: 1px solid var(--border-light);
    border-radius: var(--r-full);
    font-size: var(--fs-min);
}

.badge-ok {
    background: var(--ok-bg);
}

.badge-live {
    background: var(--live-bg);
    border-color: var(--live-border);
}

.badge-warn {
    background: var(--warn-bg);
}

.badge-danger {
    background: var(--danger-bg);
}

/* Notices */

.alert {
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-card);
}

.alert-error {
    background: var(--danger-bg);
    border-color: var(--red);
}

.alert-success {
    background: var(--ok-bg);
}

.alert-info {
    background: var(--live-bg);
}

/* Forms */

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
}

.form-label {
    font-size: var(--fs-sm);
    font-weight: 500;
}

.form-input,
.form-select {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--field-border);
    border-radius: var(--r-sm);
    font: inherit;
}

.form-input[aria-invalid="true"],
.form-select[aria-invalid="true"] {
    border-color: var(--red);
}

.field-error {
    margin: 0;
    color: var(--red);
    font-size: var(--fs-sm);
}

.hint {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

/* Buttons */

.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--r-sm);
    font: inherit;
    font-size: var(--fs-md);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: 1px solid var(--btn-primary-bg);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-primary:hover {
    background: color-mix(in srgb, var(--btn-primary-bg) 86%, var(--bg));
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-primary:active,
.btn-secondary:active {
    transform: translateY(1px);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-small {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--fs-sm);
}

/* A button or link that reads as text. Its padding keeps the hit target 32 px high. */
.link-button {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-size: var(--fs-sm);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.link-button:hover {
    color: var(--text-secondary);
}

/* Small labels, chips and facts */

.kicker {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--fs-min);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* A state chip. Colour means state only: done, waiting, needs you, refused. */
.chip {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0.125rem var(--space-sm);
    border: 1px solid var(--border-light);
    border-radius: var(--r-full);
    color: var(--text-secondary);
    font-size: var(--fs-min);
    font-weight: 500;
    white-space: nowrap;
}

.chip-done {
    background: var(--ok-bg);
    border-color: transparent;
    color: var(--status-green);
}

.chip-waiting {
    background: var(--live-bg);
    border-color: var(--live-border);
    color: var(--text-primary);
}

/* The amber and the red of the tokens, a fifth darker, keep 4.5:1 on their own tint. */
.chip-needs_you {
    background: var(--warn-bg);
    border-color: transparent;
    color: color-mix(in srgb, var(--amber) 80%, var(--text-primary));
}

.chip-refused {
    background: var(--danger-bg);
    border-color: transparent;
    color: color-mix(in srgb, var(--red) 80%, var(--text-primary));
}

.tag {
    display: inline-block;
    padding: 0 var(--space-xs);
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    font-size: var(--fs-min);
    vertical-align: 1px;
}

/* Facts stacked as a label over its value, each fact its own grid cell: the console's seller
   facts and the dashboard's cards. ``.facts`` below is the other layout, one label column. */
.facts-stacked {
    display: grid;
    gap: var(--space-md);
    margin: 0;
}

.facts-stacked .fact {
    display: grid;
    gap: 0.125rem;
    min-width: 0;
}

.facts-stacked .fact dt {
    color: var(--text-muted);
    font-size: var(--fs-min);
}

.facts-stacked .fact dd {
    margin: 0;
    font-size: var(--fs-md);
    overflow-wrap: anywhere;
}

.note {
    margin: var(--space-md) 0 0;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
}

.note:empty {
    display: none;
}

.quiet {
    color: var(--text-muted);
}

.num {
    font-variant-numeric: tabular-nums;
}

.nowrap {
    white-space: nowrap;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Tables */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
}

.data-table th {
    background: var(--bg-th);
    text-align: left;
    font-weight: 500;
}

.data-table th,
.data-table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--divider);
}

.data-table .empty {
    color: var(--text-muted);
    text-align: center;
}

/* Error page */

.error-page {
    padding: var(--space-xl) 0;
    text-align: center;
}

.error-message {
    margin: var(--space-sm) 0 var(--space-xl);
    color: var(--text-secondary);
}

/* Form steps: two columns, the step's words on the left and its cards on the right. The
   delivery page uses it. A page with the page-wide body class gets a 976 px content column. */

.page-wide .page {
    max-width: 64rem;
}

.step {
    display: grid;
    grid-template-columns: 23.75rem minmax(0, 1fr);
    gap: 5.25rem;
    align-items: start;
}

.step-label {
    margin: 0 0 var(--space-sm);
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.step-title {
    margin: 0;
    font-size: var(--fs-xl);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.step-help {
    margin: var(--space-md) 0 0;
    color: var(--text-secondary);
}

.step-main {
    display: grid;
    gap: var(--space-lg);
    min-width: 0;
}

/* Label and value pairs. One grid for the whole list, so every value starts at the same line
   just past the longest label. */
.facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: var(--space-sm) var(--space-xl);
    margin: var(--space-xl) 0 0;
    font-size: var(--fs-sm);
}

.facts-flush {
    margin: 0;
}

.fact {
    display: contents;
}

.fact dt {
    color: var(--text-muted);
}

.fact dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.fact-note {
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* The drop zone. The native file input stays in the tab order, and its label is the button. */

.drop-zone {
    display: grid;
    justify-items: center;
    gap: var(--space-sm);
    padding: 2.5rem var(--space-xl);
    background: var(--bg-card);
    border: 1px dashed var(--field-border);
    border-radius: var(--r-lg);
    text-align: center;
}

.drop-zone.is-over {
    background: var(--bg-card-hover);
    border-color: var(--text-primary);
}

.drop-title {
    margin: 0;
    font-weight: 500;
}

.drop-button {
    margin: var(--space-xs) 0;
}

.visually-hidden:focus-visible + .drop-button {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.drop-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.quiet-note {
    margin: 0;
    color: var(--text-secondary);
}

/* The file list and the hand-over. */

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.card-title {
    margin: 0;
    font-size: var(--fs-md);
    font-weight: 600;
}

.card-count {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
}

.file-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.file-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-xs) var(--space-lg);
    padding: var(--space-md) 0;
    border-top: 1px solid var(--divider);
}

.file-row:first-child {
    padding-top: 0;
    border-top: 0;
}

.file-row:last-child {
    padding-bottom: 0;
}

.file-name {
    overflow: hidden;
    font-size: var(--fs-md);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    grid-column: 1;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
}

.file-state {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    max-width: 15rem;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    text-align: right;
}

.file-state[data-state="refused"] {
    color: var(--red);
}

.file-reason {
    grid-column: 1 / -1;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
}

.file-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.handover {
    display: grid;
    gap: var(--space-lg);
}

.handover .form-group {
    margin-bottom: 0;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    font-size: var(--fs-md);
    cursor: pointer;
}

.check input {
    flex: none;
    width: 1rem;
    height: 1rem;
    margin: 0.125rem 0 0;
    accent-color: var(--text-primary);
}

.actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-md);
}

.actions-hint {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.btn-primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--btn-primary-bg) 86%, var(--bg));
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-primary:active:not(:disabled),
.btn-secondary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

@media (prefers-reduced-motion: reduce) {
    .btn-primary:active:not(:disabled),
    .btn-secondary:active {
        transform: none;
    }
}

@media (max-width: 56rem) {
    .step {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-xl);
    }
}

/* Console tables: numbers align, long names truncate, row actions stay small. */

.data-table .num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.data-table .cell-name {
    max-width: 13rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table .cell-sub {
    display: block;
    color: var(--text-muted);
}

.scan-table td,
.scan-table th {
    white-space: nowrap;
}

.data-table .cell-action {
    text-align: right;
    white-space: nowrap;
}

.btn-small {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--fs-sm);
}

/* The screening page: one group of rows per seller, its decision under its findings. */

.screen-table th,
.screen-table td {
    vertical-align: top;
    white-space: nowrap;
}

.screen-table tbody + tbody {
    border-top: 1px solid var(--border-light);
}

/* A name screened and a list entry can be long, and the founder must read them whole. */
.screen-table .cell-wrap {
    min-width: 8rem;
    white-space: normal;
}

.screen-table .cell-list {
    min-width: 5rem;
    white-space: normal;
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
}

.screen-table .cell-name .cell-sub {
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table .cell-note {
    color: var(--text-secondary);
}

.cell-wait {
    color: var(--text-muted);
}

.page-notice {
    margin-bottom: var(--space-lg);
}

.decide {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--space-sm);
}

/* One width in every row, so each "Clear" sits under the last, with or without "Confirm hit". */
.decide .form-input {
    flex: 0 1 13.5rem;
    min-width: 0;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--fs-sm);
}

/* The browser's own placeholder grey is under 4.5:1 on a card. Every field takes the muted
   text colour instead. */
.form-input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.action-row .field-error {
    margin-top: var(--space-xs);
}

.action-note {
    margin: var(--space-xs) 0 0;
    color: var(--text-muted);
}

/* A refused list in the page head: the sentence, then the quiet accept on one line under it. */
.lists-facts dd {
    max-width: 30rem;
}

.list-notice {
    margin: 0;
}

.list-time {
    white-space: nowrap;
}

/* With a refused list the head grows to several lines: the title sits on the line of the first
   fact instead of in the middle. */
.ops .page-header:has(> .lists-facts .fact + .fact) {
    align-items: baseline;
}

.list-accept {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-xs);
}

.list-accept .form-input {
    flex: 0 1 13.5rem;
    min-width: 0;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--fs-sm);
}


/* ---- The white design (2026-11-15). White surfaces, ink for the next action, colour for
   state only. These rules sit last on purpose and refine the ones above. ---- */

body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.site-header {
    background: var(--bg);
}

.wordmark {
    font-weight: 650;
    letter-spacing: -0.02em;
}

/* The brand reads "Stoa | Data": a thin upright line between the two names. */
.brand-divider {
    width: 1px;
    height: 1.125rem;
    margin: 0 0.25rem;
    background: var(--border-strong);
}

.site-name {
    color: var(--text-secondary);
    font-weight: 500;
}

/* The right end of the bar: a few links, then the account button. */
.header-end {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.header-link {
    display: inline-flex;
    align-items: center;
    height: 2rem;
    padding: 0 var(--space-md);
    border-radius: var(--r-md);
    color: var(--text-secondary);
    font-size: var(--fs-md);
    font-weight: 500;
    text-decoration: none;
}

.header-link:hover,
.header-link[aria-current="page"] {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.card {
    box-shadow: var(--shadow-1);
}

/* Buttons: 40 px high, one radius, a real pressed and focus state. */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0 var(--space-lg);
    border-radius: var(--r-md);
    font-size: var(--fs-md);
    font-weight: 550;
    letter-spacing: -0.005em;
    white-space: nowrap;
    transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out),
        box-shadow var(--dur-1) var(--ease-out);
}

.btn-primary {
    box-shadow: 0 1px 2px rgba(var(--ink-rgb), 0.24);
}

.btn-primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--btn-primary-bg) 84%, var(--bg));
}

.btn-secondary {
    background: var(--bg-card);
    border-color: var(--border-light);
    box-shadow: var(--shadow-1);
}

.btn-secondary:hover {
    background: var(--bg-th);
    border-color: var(--border-strong);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text-primary);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-small {
    min-height: 2rem;
    padding: 0 var(--space-md);
    font-size: var(--fs-sm);
}

/* Fields: 44 px high, the label above in a quiet weight. */
.form-label {
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    font-weight: 500;
}

.form-input,
.form-select {
    min-height: 2.75rem;
    padding: 0 var(--space-md);
    border-radius: var(--r-md);
    font-size: 0.9375rem;
    transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}

textarea.form-input {
    min-height: 6rem;
    padding: var(--space-md);
    line-height: 1.5;
}

.form-input:hover,
.form-select:hover {
    border-color: var(--text-muted);
}

.form-input:focus-visible,
.form-select:focus-visible {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(var(--ink-rgb), 0.12);
}

/* Chips: a soft fill and no edge. */
.chip {
    padding: 0.1875rem 0.625rem;
    border-color: transparent;
    background: var(--bg-card-hover);
    font-weight: 550;
}

.chip-waiting {
    color: var(--text-secondary);
}

.chip-done {
    background: var(--ok-bg);
}

.chip-needs_you {
    background: var(--warn-bg);
}

.chip-refused {
    background: var(--danger-bg);
}

.tag {
    padding: 0.0625rem 0.375rem;
    background: var(--bg-card-hover);
    border-color: transparent;
}

/* Tables: a white sheet with small tracked headers and a hover line. */
.table-wrap {
    background: var(--bg-card);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
}

.data-table {
    font-size: var(--fs-md);
}

.data-table th {
    padding: 0.625rem var(--space-lg);
    color: var(--text-muted);
    font-size: var(--fs-min);
    font-weight: 550;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Every row 44 px, with a chip or without. */
.data-table td {
    height: 2.75rem;
    padding: var(--space-xs) var(--space-lg);
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover td {
    background: var(--bg-th);
}

/* A form step: the title carries the page. */
.step-label {
    font-size: var(--fs-md);
}

.step-title {
    font-size: var(--fs-2xl);
    font-weight: 650;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.step-help {
    font-size: 1rem;
    line-height: 1.55;
}

.drop-zone {
    padding: 3rem var(--space-xl);
    background: var(--bg-th);
    border: 1.5px dashed var(--border-strong);
}

.drop-zone.is-over {
    background: var(--bg-card-hover);
}

.drop-title {
    font-size: 1rem;
    font-weight: 600;
}

.alert,
.page-notice {
    border-radius: var(--r-md);
}
