/*
 * Application styles (TASKS T-311; visual system first written in T-207).
 *
 * One plain CSS file: the CSP allows only `style-src 'self'`, so templates
 * carry no `style=""` attribute and no `<style>` block. No external font or CDN
 * is referenced (PLAN §9): typography uses the operating system font stack.
 *
 * Design: calm, work-focused admin panel. Neutral grey canvas, white cards with
 * a thin border and a very light shadow, one accent colour (deep teal) for
 * buttons, links and the active menu item. Status is never communicated by
 * colour alone — every badge also carries text.
 *
 * Spacing follows a 4/8 px scale; the readable content width is 1200 px.
 */

:root {
    /* canvas and surface */
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #fbfcfd;
    --border: #e3e5e8;
    --border-strong: #d3d7dc;

    /* text */
    --text: #1f2328;
    --muted: #59636e;

    /* accent */
    --accent: #0f766e;
    --accent-strong: #0b5c56;
    --accent-soft: #e6f4f2;
    --accent-contrast: #ffffff;

    /* status: light background + dark text (WCAG AA) */
    --ok-bg: #e7f6ec;
    --ok-fg: #14532d;
    --ok-border: #b7e2c6;
    --danger-bg: #fdecec;
    --danger-fg: #8a1c13;
    --danger-border: #f0bcb6;
    --failed-bg: #f6dcdc;
    --failed-fg: #7a1210;
    --failed-border: #e3acac;
    --warn-bg: #fff4e0;
    --warn-fg: #854a0d;
    --warn-border: #f0cf9c;
    --neutral-bg: #eef0f3;
    --neutral-fg: #4a5460;
    --neutral-border: #d9dde2;
    --info-bg: #e9f0fd;
    --info-fg: #1d3f7f;
    --info-border: #c3d4f4;
    --purple-bg: #f2e9ff;
    --purple-fg: #4c1d95;
    --purple-border: #d3bcf2;

    /* geometry */
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;

    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

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

h1,
h2,
h3 {
    margin: 0 0 var(--space-3);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.5rem;
}

h2 {
    margin-top: var(--space-5);
    font-size: 1.125rem;
}

h3 {
    font-size: 0.95rem;
}

p {
    margin: 0 0 var(--space-3);
}

ul,
ol {
    padding-left: 1.25rem;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-strong);
    text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

code,
pre,
kbd {
    font-family: var(--font-mono);
    font-size: 0.85em;
}

pre {
    margin: 0 0 var(--space-3);
    padding: var(--space-3);
    overflow-x: auto;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--space-5) 0;
}

.muted,
small {
    color: var(--muted);
}

.mono {
    font-family: var(--font-mono);
}

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

.skip-link {
    position: absolute;
    left: -9999px;
}

.skip-link:focus {
    left: var(--space-4);
    top: var(--space-2);
    z-index: 50;
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* --- top bar ---------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.topbar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-5);
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-3) var(--space-4);
}

.topbar__brand {
    margin: 0;
    line-height: 1.2;
}

.topbar__brand a {
    display: flex;
    flex-direction: column;
    color: var(--text);
    text-decoration: none;
}

.topbar__brand a:hover {
    text-decoration: none;
    color: var(--text);
}

.topbar__app {
    font-size: 0.95rem;
    font-weight: 650;
}

.topbar__store {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.nav {
    flex: 1 1 auto;
}

.nav__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav__item a {
    display: inline-block;
    padding: var(--space-2) 0 var(--space-1);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

.nav__item a:hover {
    color: var(--text);
    text-decoration: none;
}

.nav__item a[aria-current="page"] {
    color: var(--accent-strong);
    font-weight: 600;
    border-bottom-color: var(--accent);
}

.topbar__tools {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: auto;
}

.lang-switcher {
    display: inline-flex;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}

.lang-switcher button {
    padding: var(--space-1) var(--space-2);
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.lang-switcher button + button {
    border-left: 1px solid var(--border);
}

.lang-switcher button[aria-current="true"] {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.user-menu {
    position: relative;
}

.user-menu summary {
    padding: var(--space-1) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    list-style: none;
}

.user-menu summary::-webkit-details-marker {
    display: none;
}

.user-menu summary::after {
    content: " ▾";
    color: var(--muted);
}

.user-menu__list {
    position: absolute;
    right: 0;
    top: calc(100% + var(--space-1));
    z-index: 30;
    min-width: 12rem;
    margin: 0;
    padding: var(--space-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    list-style: none;
}

.user-menu__list li + li {
    margin-top: var(--space-1);
}

.user-menu__list a,
.user-menu__list .link-button {
    display: block;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
}

.user-menu__list a:hover,
.user-menu__list .link-button:hover {
    background: var(--bg);
    text-decoration: none;
}

/* --- banners (full width, directly below the top bar) ------------------ */

.banners {
    display: grid;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.banner {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--warn-bg);
    color: var(--warn-fg);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--warn-border);
}

.banner::before {
    flex: 0 0 auto;
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.1rem;
    border: 1px solid currentColor;
    border-radius: 50%;
    content: "!";
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1rem;
    text-align: center;
}

.banner p {
    margin: 0;
}

.banner--error {
    background: var(--danger-bg);
    color: var(--danger-fg);
    border-bottom-color: var(--danger-border);
}

.banner--error::before {
    content: "×";
}

.banner--ok {
    background: var(--ok-bg);
    color: var(--ok-fg);
    border-bottom-color: var(--ok-border);
}

/* --- page frame ------------------------------------------------------- */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-5) var(--space-4) var(--space-6);
}

.container--narrow {
    max-width: 44rem;
}

.footer {
    margin-top: var(--space-6);
    padding: var(--space-4);
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
    border-top: 1px solid var(--border);
}

/* Page timing line (T-318): one small grey line, warning colour when slow. */
.footer__timing {
    margin: var(--space-1) 0 0;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.footer__timing--slow {
    color: var(--warn-fg);
    font-weight: 600;
}

.footer__timing-details {
    margin-top: var(--space-1);
    text-align: left;
}

.footer__timing-details summary {
    cursor: pointer;
    text-align: center;
}

.footer__statements {
    margin: var(--space-1) 0 0;
    padding-left: var(--space-4);
    max-width: 100%;
}

.footer__statements li {
    margin-bottom: var(--space-1);
    overflow-wrap: anywhere;
}

.footer__statements code {
    font-size: 0.75rem;
    color: var(--muted);
}

/* --- buttons ---------------------------------------------------------- */

button,
.button {
    display: inline-block;
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-contrast);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: var(--accent-contrast);
    text-decoration: none;
}

.button--secondary,
button.button--secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
    font-weight: 500;
}

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

.button--danger,
button.button--danger {
    background: var(--danger-bg);
    color: var(--danger-fg);
    border-color: var(--danger-border);
}

.button--danger:hover {
    background: var(--danger-bg);
    color: var(--danger-fg);
    border-color: var(--danger-fg);
}

button[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.link-button {
    display: inline;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 0.875rem;
    text-decoration: underline;
    cursor: pointer;
}

.link-button:hover {
    background: none;
    color: var(--accent-strong);
}

.inline-form {
    display: inline;
    margin: 0;
}

/* --- forms ------------------------------------------------------------ */

label {
    display: block;
    margin-bottom: var(--space-1);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
}

input[type="text"],
input[type="search"],
input[type="password"],
input[type="date"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    max-width: 28rem;
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
}

input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
}

textarea {
    min-height: 8rem;
    resize: vertical;
}

input.input--code,
textarea.input--code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.45;
    tab-size: 4;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-2) var(--space-4);
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.filters p {
    margin: 0;
}

.filters br {
    display: none;
}

.filters input,
.filters select {
    min-width: 10rem;
}

.filters button {
    margin-right: var(--space-2);
}

/* --- alerts, notices, flash ------------------------------------------- */

.alert {
    margin: 0 0 var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-sm);
    color: var(--danger-fg);
    font-size: 0.875rem;
}

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

.alert--warning {
    background: var(--warn-bg);
    border-color: var(--warn-border);
    color: var(--warn-fg);
}

.notice {
    margin: 0 0 var(--space-4);
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
}

.flash {
    display: grid;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.flash__item {
    margin: 0;
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.flash__item--success {
    background: var(--ok-bg);
    border-color: var(--ok-border);
    border-left-color: var(--ok-fg);
    color: var(--ok-fg);
}

.flash__item--error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    border-left-color: var(--danger-fg);
    color: var(--danger-fg);
}

/* --- panels and cards ------------------------------------------------- */

.panel,
.card,
.setting {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.panel {
    margin: 0 0 var(--space-4);
    padding: var(--space-4);
}

.auth-panel {
    margin-top: var(--space-5);
    padding: var(--space-5);
}

.cards {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    margin: 0 0 var(--space-5);
}

.card {
    padding: var(--space-3) var(--space-4);
}

.card--wide {
    grid-column: 1 / -1;
}

.card__title {
    margin: 0 0 var(--space-2);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card__value {
    margin: 0 0 var(--space-2);
    font-size: 1.5rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.card__list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.875rem;
}

.card__list li {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-1) 0;
    border-top: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}

.card__list li:first-child {
    border-top: 0;
}

/* --- tables ----------------------------------------------------------- */

.table-wrap {
    margin: 0 0 var(--space-4);
    max-width: 100%;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: var(--space-2) var(--space-3);
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

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

.table tbody tr:nth-child(even) td {
    background: var(--surface-2);
}

.table tbody tr:hover td {
    background: var(--accent-soft);
}

.table td.num,
.table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table--scroll {
    display: block;
    overflow-x: auto;
}

/* --- pagination ------------------------------------------------------- */

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.875rem;
}

.pagination__info {
    margin: 0;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.pagination__list {
    display: flex;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.pagination__list a {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
}

/* --- tabs (group navigation, plain links) ----------------------------- */

.tabs {
    margin: 0 0 var(--space-4);
    border-bottom: 1px solid var(--border);
}

.tabs__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.tabs__link {
    display: inline-block;
    padding: var(--space-2) var(--space-3);
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

.tabs__link:hover {
    color: var(--text);
    text-decoration: none;
}

.tabs__link--active {
    color: var(--accent-strong);
    font-weight: 600;
    border-bottom-color: var(--accent);
}

/* --- badges ----------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.05rem 0.45rem;
    background: var(--neutral-bg);
    border: 1px solid var(--neutral-border);
    border-radius: 999px;
    color: var(--neutral-fg);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.55;
    white-space: nowrap;
}

/* unit and job states */
.badge--state-current {
    background: var(--ok-bg);
    border-color: var(--ok-border);
    color: var(--ok-fg);
}

.badge--state-missing {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-fg);
}

.badge--state-outdated,
.badge--warn {
    background: var(--warn-bg);
    border-color: var(--warn-border);
    color: var(--warn-fg);
}

.badge--state-excluded {
    background: var(--neutral-bg);
    border-color: var(--neutral-border);
    color: var(--neutral-fg);
}

.badge--state-queued,
.badge--state-pending_review,
.badge--state-pending,
.badge--state-running {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-fg);
}

.badge--state-failed {
    background: var(--failed-bg);
    border-color: var(--failed-border);
    color: var(--failed-fg);
}

.badge--state-done {
    background: var(--ok-bg);
    border-color: var(--ok-border);
    color: var(--ok-fg);
}

.badge--state-cancelled {
    background: var(--neutral-bg);
    border-color: var(--neutral-border);
    color: var(--neutral-fg);
}

/* An empty Latvian source (OQ-023): not "excluded by a rule", but "there is
   nothing to translate". Grey, with the ⊘ icon next to the text (T-313c). */
.badge--empty-source {
    background: var(--neutral-bg);
    border-color: var(--neutral-border);
    color: var(--neutral-fg);
}

.badge__icon {
    font-size: 0.8rem;
    line-height: 1;
}

/* section modes (ADR-022): off / review / auto / mixed */
.badge--mode-off,
.badge--mode-mixed {
    background: var(--neutral-bg);
    border-color: var(--neutral-border);
    border-style: dashed;
    color: var(--neutral-fg);
}

.badge--mode-review {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-fg);
}

.badge--mode-auto {
    background: var(--purple-bg);
    border-color: var(--purple-border);
    color: var(--purple-fg);
    font-weight: 700;
}

.badge--env {
    background: var(--warn-bg);
    border-color: var(--warn-border);
    color: var(--warn-fg);
}

/* --- counters, meta and empty state ----------------------------------- */

.counters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0 0 var(--space-4);
    padding: 0;
    list-style: none;
}

.counters li {
    display: flex;
    flex-direction: column;
    min-width: 7rem;
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.counters__value {
    font-size: 1.3rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}

.counters__label {
    color: var(--muted);
    font-size: 0.78rem;
}

.meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--space-1) var(--space-4);
    margin: 0 0 var(--space-5);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

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

.meta dd {
    margin: 0;
    word-break: break-word;
}

.empty {
    margin: 0 0 var(--space-4);
    padding: var(--space-5) var(--space-4);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

.link-list {
    padding-left: 1.25rem;
}

.record-list {
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    list-style: none;
}

details summary {
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
}

dialog.dialog {
    max-width: 32rem;
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    color: var(--text);
}

dialog.dialog::backdrop {
    background: rgba(31, 35, 40, 0.45);
}

.alert p {
    margin: 0;
}

.dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

/* --- settings page ---------------------------------------------------- */

.setting {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2) var(--space-5);
    margin: 0 0 var(--space-3);
    padding: var(--space-3) var(--space-4);
}

.setting__body {
    flex: 1 1 22rem;
    min-width: 0;
}

.setting__control {
    display: flex;
    flex: 0 1 26rem;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.setting__header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-2);
}

.setting__label {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.setting__meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.75rem;
}

.setting__description {
    margin: var(--space-1) 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.setting__default {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.setting__value {
    margin: 0;
    font-size: 0.85rem;
}

.setting__value code {
    display: inline-block;
    max-width: 100%;
    padding: var(--space-1) var(--space-2);
    overflow-wrap: anywhere;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.setting__form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
}

.setting__form p {
    margin: 0;
}

.setting__form label {
    display: block;
}

.setting__form button {
    align-self: flex-start;
}

.setting__error {
    margin: 0;
    color: var(--danger-fg);
    font-size: 0.82rem;
    font-weight: 600;
}

.setting textarea,
.setting input[type="text"],
.setting select {
    max-width: 100%;
}

/* --- dashboard section matrix ----------------------------------------- */

.matrix {
    min-width: 46rem;
}

.matrix th[scope="row"] {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface);
    font-weight: 500;
    white-space: nowrap;
}

.matrix__group th,
.table tbody tr.matrix__group td,
.table tbody tr.matrix__group th,
.matrix__group td {
    background: var(--bg);
    font-weight: 650;
}

.matrix__group th[scope="row"] {
    font-size: 0.9rem;
}

.matrix__detail td {
    padding: 0 var(--space-3) var(--space-3);
    background: var(--surface);
}

.matrix__detail summary {
    padding: var(--space-1) 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.matrix--types {
    margin: var(--space-2) 0 var(--space-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.matrix--types thead th {
    background: var(--surface-2);
}

.matrix--types th[scope="row"] {
    padding-left: var(--space-5);
    color: var(--muted);
    font-weight: 500;
    font-size: 0.82rem;
}

.matrix__totals th,
.table tbody tr.matrix__totals td,
.table tbody tr.matrix__totals th,
.matrix__totals td {
    background: var(--accent-soft);
    font-weight: 650;
}

.matrix__totals th[scope="row"] {
    background: var(--accent-soft);
}

.cell {
    min-width: 9.5rem;
}

.cell__main {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}

.cell__percent {
    font-size: 1.05rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.cell__fraction {
    color: var(--muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.cell__meta {
    display: block;
    margin-top: var(--space-1);
    color: var(--muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.cell__words,
.cell__cost {
    color: var(--muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.cell--source {
    max-width: 22rem;
    overflow-wrap: anywhere;
}

.cell--total {
    background: var(--accent-soft);
}

/* Thin progress bar: the value is an attribute, never an inline style. */
progress.meter {
    display: block;
    width: 100%;
    height: 6px;
    margin: var(--space-1) 0;
    overflow: hidden;
    appearance: none;
    background: var(--neutral-bg);
    border: 0;
    border-radius: 999px;
}

progress.meter::-webkit-progress-bar {
    background: var(--neutral-bg);
    border-radius: 999px;
}

progress.meter::-webkit-progress-value {
    background: var(--accent);
    border-radius: 999px;
}

progress.meter::-moz-progress-bar {
    background: var(--accent);
    border-radius: 999px;
}

/* Long machine values (GIDs, payloads, source HTML) wrap instead of stretching
   the table; the content itself is always escaped plain text. */
.table td code,
.cell--source code,
.setting__value code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* --- responsive layout ------------------------------------------------ */

@media (max-width: 900px) {
    .topbar__inner {
        gap: var(--space-2) var(--space-4);
    }

    .nav {
        order: 3;
        flex-basis: 100%;
    }

    .nav__list {
        gap: var(--space-1) var(--space-3);
    }

    .topbar__tools {
        margin-left: auto;
    }
}

@media (max-width: 720px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: var(--space-4) var(--space-3) var(--space-5);
    }

    h1 {
        font-size: 1.3rem;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .setting {
        flex-direction: column;
    }

    .setting__control {
        flex-basis: auto;
        width: 100%;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filters input,
    .filters select {
        min-width: 0;
    }

    .meta {
        grid-template-columns: 1fr;
    }

    .meta dd {
        margin-bottom: var(--space-2);
    }
}

/* --- resource preview image (T-313) ----------------------------------- */

.preview {
    margin: 0 0 var(--space-4);
}

.preview__image {
    max-width: 420px;
    max-height: 420px;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 4px);
    background: var(--surface);
}

/* --- resource detail page (T-313b) ------------------------------------ */

.page-head {
    margin: 0 0 var(--space-4);
}

.page-head h1 {
    margin-bottom: var(--space-2);
}

.page-head__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2);
    margin: 0;
}

.page-head__note {
    font-size: 0.78rem;
}

/* Main column and a sticky sidebar; one column below 1000 px, where the
   sidebar (actions included) follows the page heading. Every grid child gets
   `min-width: 0`: without it the automatic minimum size of a card is the
   min-content width of the fields table (56 rem), and the card grows over the
   sidebar column instead of scrolling inside `.table-wrap`. */
.page-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: var(--space-4);
    align-items: start;
}

.page-grid > *,
.page-grid__main > * {
    min-width: 0;
}

.page-grid__main {
    display: grid;
    gap: var(--space-4);
    min-width: 0;
}

.sidebar {
    position: sticky;
    top: calc(var(--space-6) * 2);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-self: start;
    max-width: 100%;
    min-width: 0;
}

.sidebar__card {
    padding: var(--space-3) var(--space-4);
}

.sidebar__label {
    margin: var(--space-3) 0 var(--space-1);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar__label:first-of-type {
    margin-top: 0;
}

.sidebar__value {
    margin: 0 0 var(--space-2);
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

/* Summary card: the only place that prints a raw GID, small and selectable. */
.summary {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: var(--space-1) var(--space-3);
    margin: 0;
    font-size: 0.85rem;
}

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

.summary dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* Summary card: the only place that prints a raw GID, small and selectable.
   One line with an ellipsis (the full value is in `title`): an id broken in the
   middle is unreadable, and the selectable code keeps it copyable. */
.summary__gid {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
    user-select: all;
}

/* Actions: equal-width secondary buttons in one row, notes below. */
.actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    margin: 0;
}

.actions--single {
    grid-template-columns: minmax(0, 1fr);
}

.actions form {
    margin: 0;
    min-width: 0;
}

.actions button {
    width: 100%;
    white-space: normal;
}

.actions__note {
    margin: var(--space-2) 0 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.actions__admin {
    margin: var(--space-2) 0 0;
    font-size: 0.85rem;
}


/* Language chips: colour + icon + text (the visible code plus aria-label);
   they wrap horizontally and never stack into a vertical list. */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0 var(--space-2);
    background: var(--neutral-bg);
    border: 1px solid var(--neutral-border);
    border-radius: 999px;
    color: var(--neutral-fg);
    font-size: 0.68rem;
    font-weight: 650;
    line-height: 1.7;
    white-space: nowrap;
}

.chip--ok {
    background: var(--ok-bg);
    border-color: var(--ok-border);
    color: var(--ok-fg);
}

.chip--missing,
.chip--failed {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-fg);
}

.chip--warn {
    background: var(--warn-bg);
    border-color: var(--warn-border);
    color: var(--warn-fg);
}

.chip--info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-fg);
}

.chip__icon {
    font-size: 0.72rem;
    line-height: 1;
}

.chip__count {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.chip--link {
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}

.chip--link:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
    text-decoration: none;
}


/* Fields × languages matrix. The first column stays in view while the table
   scrolls horizontally; a long source value is clamped to two lines and the
   full text opens in `<details>`. */
.field-matrix {
    min-width: 56rem;
    table-layout: auto;
}

.field-matrix th[scope="row"] {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 15rem;
    max-width: 20rem;
    background: var(--surface);
    font-weight: 400;
}

.field-matrix thead th:first-child {
    left: 0;
    z-index: 3;
}

.field-matrix tbody tr:nth-child(even) th[scope="row"] {
    background: var(--surface-2);
}

/* Row highlight only on pointer hover and in a neutral tone: the accent tint
   made a whole field row look selected (T-313c step d). */
.field-matrix tbody tr:hover th[scope="row"],
.field-matrix tbody tr:hover td {
    background: var(--neutral-bg);
}

.field-matrix__label {
    display: block;
    margin-bottom: var(--space-1);
}

.field-matrix__label code {
    font-size: 0.8rem;
    font-weight: 600;
}

.field-matrix__source {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: var(--space-1);
    color: var(--text);
    font-size: 0.82rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* Empty Latvian source: the fields table says what to do in Shopify instead of
   leaving an empty cell (T-313c step c). */
.field-matrix__hint {
    display: block;
    margin-top: var(--space-1);
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.field-matrix__more {
    margin-top: var(--space-1);
}
.field-matrix__more summary {
    color: var(--accent);
    font-size: 0.75rem;
    cursor: pointer;
}

.field-matrix__full {
    max-height: 16rem;
    margin: var(--space-1) 0 0;
    overflow: auto;
    font-size: 0.78rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.field-matrix__counts {
    display: block;
    margin-top: var(--space-1);
    color: var(--muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.cell__text {
    display: block;
    max-width: 14rem;
    margin-top: var(--space-1);
    overflow: hidden;
    color: var(--muted);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* Image grid: 4–6 square cards in the main column; the caption is the Latvian
   alt text, never the GID. */
.img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: var(--space-3);
    margin: 0 0 var(--space-2);
    padding: 0;
    list-style: none;
}

.img-grid__item {
    min-width: 0;
}

.img-grid__link {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    height: 100%;
    padding: var(--space-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
}

.img-grid__link:hover {
    border-color: var(--accent);
    color: var(--text);
    text-decoration: none;
}

.img-grid__frame {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.img-grid__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.img-grid__missing {
    color: var(--muted);
    font-size: 0.78rem;
}

.img-grid__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.8rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.img-grid__title--empty {
    color: var(--muted);
    font-style: italic;
}

.sidebar .preview {
    margin: 0;
    padding: var(--space-3);
    text-align: center;
}

.preview__caption {
    margin-top: var(--space-2);
    font-size: 0.78rem;
}

@media (max-width: 1000px) {
    .page-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: static;
        order: -1;
    }
}

/* --- rule preview and version history (T-505) ------------------------- */
.preview-output {
    white-space: pre-wrap;
    word-break: break-word;
    padding: 0.75rem;
    border: 1px solid var(--border, #d6d9de);
    border-radius: 4px;
    background: var(--surface-2, #fbfcfd);
}

.rule-version {
    margin-block-end: 1rem;
}

.rule-version .table tr.diff-changed td,
.rule-version .table tr.diff-changed th {
    font-weight: 600;
    background: var(--surface-2, #fbfcfd);
}

/* --- review queue and manual translation (T-604) ---------------------- */
.badge--ok {
    background: var(--ok-bg);
    border-color: var(--ok-border);
    color: var(--ok-fg);
}

.nav__badge {
    display: inline-block;
    min-width: 1.25rem;
    margin-inline-start: 0.25rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
}

.review-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4, 1rem);
    margin-block-end: var(--space-4, 1rem);
}

.review-pane {
    min-width: 0;
}

.review-value {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono, monospace);
    font-size: 0.85rem;
}

.review-frame {
    width: 100%;
    min-height: 320px;
    border: 1px solid var(--border, #d6d9de);
    border-radius: 4px;
    background: #fff;
}

.review-edit {
    display: grid;
    gap: var(--space-2, 0.5rem);
    margin-block-start: var(--space-4, 1rem);
}

.review-edit textarea {
    width: 100%;
}

.cell__manual {
    margin-block-start: 0.35rem;
}

.cell__manual-form {
    display: grid;
    gap: 0.35rem;
    margin-block-start: 0.35rem;
}

.cell__manual-form textarea {
    width: 100%;
    font-size: 0.8rem;
}

.cell__manual-note {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.75rem;
}

/* T-905: the validation badge opens the full issue list (code + detail). */
.cell__issues {
    margin-block-start: 0.35rem;
    font-size: 0.75rem;
}

.cell__issues summary {
    cursor: pointer;
}

.issue-list {
    margin: 0.35rem 0 0;
    padding-inline-start: 1rem;
    display: grid;
    gap: 0.2rem;
}

.issue-list code {
    font-size: 0.72rem;
}

@media (min-width: 1000px) {
    .review-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* T-1016: bulk mode editor of the coverage matrix. One select per cell, one
   sticky "Save all" bar and the mode summary of the collapsed section rows.
   The bar sticks to the viewport bottom while the table scrolls inside
   `.table-wrap`, so it stays next to the cell the operator is editing. */
.matrix__bulk-form {
    margin: 0;
}

.cell__mode {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.4rem;
    font-size: 0.75rem;
}

.cell__mode-label {
    color: var(--muted);
}

.cell__mode select {
    max-width: 100%;
    padding: 0.15rem 0.25rem;
    font-size: 0.75rem;
}

.matrix__savebar {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    margin: 0 0 var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.matrix__savebar-confirm {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
}

.matrix__savebar-list {
    color: var(--muted);
    font-size: 0.75rem;
}

/* T-1016 fix: an `auto` selection without the confirmation — the message
   becomes a warning and the save button stays disabled (never colour alone:
   the text names what is missing). */
.matrix__savebar-list--warn {
    color: var(--danger-fg);
    font-weight: 600;
}

.matrix__savebar-confirm input:disabled {
    opacity: 0.5;
}

.matrix__group .badge--mode {
    margin-top: 0.25rem;
}

/* T-605: cell actions of the coverage matrix and the manual triggers. The
   per-cell mode form moved into the bulk form in T-1016 (`.cell__mode`). */
.cell__actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.cell__trigger {
    margin: 0;
}

.cell__trigger button {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

.missing-translate-cell {
    white-space: nowrap;
}

.row-translate-form {
    display: none;
}

/* T-805: bulk selection toolbar and header checkbox. The controls carry
   `hidden` in the HTML and `app.js` reveals them, so a page without JavaScript
   keeps its previous look. The explicit rule is needed because `button` sets
   `display: inline-block`, which would otherwise beat the browser's
   `[hidden] { display: none }`. */
.select-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-2);
}

.select-toolbar [hidden],
.table [data-select-all][hidden] {
    display: none;
}

.select-toolbar__count {
    color: var(--muted);
    font-size: 0.8rem;
}

.select-toolbar button {
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
}

.table th > input[type="checkbox"],
.table td > input[type="checkbox"] {
    margin-right: 0.35rem;
    vertical-align: middle;
}


/* T-902: bulk translation pages. `progress` is the native element, so the
   percentage needs no inline style (CSP) and stays accessible. */
.progress {
    width: 12rem;
    max-width: 100%;
    height: 0.6rem;
    vertical-align: middle;
}

.notice--error {
    border-left-color: var(--danger-fg);
    background: var(--danger-bg);
    color: var(--danger-fg);
}

.filters fieldset {
    margin: 0 0 var(--space-3);
    padding: 0;
    border: 0;
}

.filters fieldset legend {
    padding: 0;
    font-weight: 600;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin: 0 var(--space-3) var(--space-1) 0;
    font-weight: 400;
}

.cell--source {
    max-width: 18rem;
}

.cell--source .cell__text {
    max-width: 100%;
    white-space: normal;
}

/* T-903: the bulk translation form. The old `class="filters"` bar spread 25 type
   labels over a narrow flex row (a label and its box landed in different grid
   cells, the language list and the limit sharing one line). The form is now a
   vertical stack of fieldsets at most 960 px wide; a checkbox is always a
   `<label class="check">` whose text sits right next to the box, so the whole
   row is clickable and nothing depends on the grid. */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 960px;
    margin: 0 0 var(--space-4);
}

.form-stack fieldset.form-section {
    margin: 0;
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.form-stack fieldset.form-section > legend {
    padding: 0 var(--space-1);
    font-size: 1.05rem;
    font-weight: 700;
}

.form-stack fieldset.form-section > legend + * {
    margin-top: var(--space-2);
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 0.3rem 0.45rem;
    border-radius: var(--radius-sm);
    font-weight: 400;
    cursor: pointer;
}

.check:hover {
    background: var(--neutral-bg);
}

.check input[type="checkbox"] {
    flex: none;
    margin: 0.15rem 0 0;
}

.check__label {
    flex: 1 1 auto;
}

.check--disabled,
.check--disabled:hover {
    background: none;
    opacity: 0.55;
    cursor: not-allowed;
}

.check-grid {
    display: grid;
    gap: var(--space-1);
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.check-card {
    margin: 0 0 var(--space-3);
}

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

.check-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin: 0 0 var(--space-1);
}

.check-card__title {
    margin: 0;
    font-size: 0.95rem;
}

.check-card__actions {
    display: flex;
    gap: var(--space-1);
    margin: 0;
}

.check-card__actions button {
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.75rem;
    cursor: pointer;
}

.check-card__actions button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0 0 var(--space-2);
}

.field:last-child {
    margin-bottom: 0;
}

.field > label,
.field > summary {
    font-weight: 600;
}

.field input[type="number"] {
    width: 8rem;
}

.field__hint {
    color: var(--muted);
    font-size: 0.8rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin: 0;
}

.form-stack details > summary {
    cursor: pointer;
    font-weight: 600;
}

.form-stack details[open] > summary {
    margin-bottom: var(--space-2);
}

@media (max-width: 720px) {
    .check-grid {
        grid-template-columns: 1fr;
    }
}

/* T-904: the publish-status and order groups live inside the Options fieldset. */
.field--nested {
    margin: 0 0 var(--space-2);
    padding: 0;
    border: 0;
    min-width: 0;
}

.field__legend {
    padding: 0;
    font-weight: 600;
}

/* T-904 step 9: a PRG redirect carries the anchor of the changed row/section,
   so the page opens at that row. The target flashes once, CSS only (no
   JavaScript, no inline style); reduced motion gets a static outline instead. */
@keyframes anchor-flash {
    from {
        background-color: var(--warn-bg);
    }

    to {
        background-color: transparent;
    }
}

.card:target,
tr:target,
p:target,
section:target,
form:target {
    animation: anchor-flash 2s ease-out 1;
}

@media (prefers-reduced-motion: reduce) {
    .card:target,
    tr:target,
    p:target,
    section:target,
    form:target {
        animation: none;
        outline: 2px solid var(--warn-border);
        outline-offset: 2px;
    }
}


