/* ============================================
   Reusable UI components
   Every value comes from a role of tokens.css: never a literal colour, font
   stack, off-scale font size or radius (test_design_tokens.py fails on one).
   ============================================ */

/* ============================================
   Cards: white sheets on the cool canvas, hairline plus long shadow
   ============================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md), var(--ring-inset);
}

/* Reference dark block, kept for the contrast guard (test_design_tokens.py): it re-points
   the ink, hairline, sheet and focus roles to their inverse counterparts, which is what the
   dark sidebar reads. A role computed at :root from --accent (--focus-ring, --accent-strong)
   does not follow a local --accent: it is re-pointed here explicitly. */
.card-inverse {
    --text-primary: var(--text-inverse);
    --text-secondary: var(--text-inverse-secondary);
    --text-tertiary: var(--text-inverse-secondary);
    --accent: var(--accent-on-inverse);
    --accent-strong: var(--text-inverse);
    --focus-ring: var(--accent-on-inverse);
    --border-color: var(--border-inverse);
    --border-strong: var(--border-inverse);
    --border-hover: var(--text-inverse-secondary);
    --border-control: var(--text-inverse-secondary);
    --card-bg: var(--surface-inverse-hover);
    --input-bg: var(--surface-inverse-hover);
    --hover-bg: var(--hover-bg-inverse);
    background: var(--surface-inverse);
    color: var(--text-primary);
    border-color: var(--surface-inverse);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   Buttons. Hierarchy, in descending order of weight; all actions are pills.
     .btn-primary        graphite fill    the one action of the screen
     .btn-secondary      white, hairline  everything else
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1.2rem;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-tight);
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--transition-fast),
                border-color var(--transition-fast),
                color var(--transition-fast),
                box-shadow var(--transition-fast),
                opacity var(--transition-fast);
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { opacity: 0.85; }
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary {
    background-color: var(--surface-inverse);
    color: var(--text-on-fill);
    box-shadow: var(--shadow-button);
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--surface-inverse-hover);
    color: var(--text-on-fill);
}
/* On the dark block a graphite pill would vanish: the primary inverts. */
.btn-secondary {
    background-color: var(--card-bg);
    border-color: var(--border-strong);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) {
    border-color: var(--border-hover);
    color: var(--text-primary);
}
.btn-sm {
    font-size: var(--text-sm);
    padding: 0.35rem 0.75rem;
    gap: 0.35rem;
}
.btn-sm svg { width: 14px; height: 14px; }

/* ============================================
   Forms: white fields, control outline, accent halo on focus
   ============================================ */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--space-sm);
}
.form-label,
.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}
/* .form-control and .form-select, plus the bare fields Django renders inside a
   .form-group (the login form): the same field everywhere. The :where() keeps
   the type filter at zero specificity, so the :hover and :focus rules below
   win over this base rule. */
.form-control,
.form-select,
.form-group input:where(:not([type="checkbox"], [type="radio"], [type="hidden"])),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border-control);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: var(--leading-snug);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
/* A text field grows downwards only: dragged sideways it would leave its card. */
textarea.form-control, .form-group textarea { resize: vertical; max-width: 100%; }
.form-control::placeholder,
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-tertiary); }
.form-control:hover,
.form-select:hover,
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: var(--text-tertiary); }
.form-control:focus,
.form-select:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--focus-ring);
    box-shadow: var(--shadow-focus);
}
.form-control:disabled,
.form-select:disabled,
.form-group :is(input, select, textarea):disabled {
    background: var(--bg-secondary);
    border-color: var(--border-strong);
    color: var(--text-tertiary);
    cursor: not-allowed;
}
.help-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-2xs);
}
.field-error {
    color: var(--danger-text);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    margin-top: var(--space-2xs);
}
.field-error ul { list-style: none; }
.form-errors {
    background-color: var(--danger-bg);
    color: var(--danger-text);
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--danger-line);
    border-left: 3px solid var(--danger);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
    font-size: var(--text-ui);
}
.form-errors ul { list-style: none; }

/* Checkboxes: a vertical list of labelled boxes in the accent */
.checkbox-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-base);
    color: var(--text-primary);
    cursor: pointer;
}
.checkbox-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-fill);
    cursor: pointer;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Alerts: a status wash, a status line, status ink
   ============================================ */
.alert {
    padding: 0.75rem var(--space-sm);
    border-radius: var(--radius-sm);
    border: 1px solid;
    border-left-width: 3px;
    margin-bottom: var(--space-sm);
    font-size: var(--text-ui);
}
.alert-error {
    background: var(--danger-bg);
    border-color: var(--danger-line);
    border-left-color: var(--danger);
    color: var(--danger-text);
}

/* ============================================
   Toast notifications. The status roles are translucent: the tint goes in as
   a background LAYER over the opaque raised surface, so what the toast floats
   over never shows through the text.
   ============================================ */
.toast-container {
    position: fixed;
    top: 72px;
    right: var(--space-sm);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    pointer-events: none;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
.toast {
    pointer-events: auto;
    padding: 0.7rem var(--space-sm);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    background-color: var(--surface-raised);
    color: var(--info-text);
    font-size: var(--text-ui);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.5s forwards;
    max-width: 400px;
}
.toast--success {
    background-image: linear-gradient(var(--success-bg), var(--success-bg));
    border-left-color: var(--success);
    color: var(--success-text);
}
.toast--error {
    background-image: linear-gradient(var(--danger-bg), var(--danger-bg));
    border-left-color: var(--danger);
    color: var(--danger-text);
}
.toast--warning {
    background-image: linear-gradient(var(--warning-bg), var(--warning-bg));
    border-left-color: var(--warning);
    color: var(--warning-text);
}


/* Django messages (login page): the same look as the toasts, in flow. */
.messages { margin-bottom: var(--space-sm); }
.messages .message {
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--info-line);
    border-left: 3px solid var(--info);
    background: var(--info-bg);
    color: var(--info-text);
    font-size: var(--text-ui);
    margin-bottom: var(--space-xs);
}
.messages .message.success {
    background: var(--success-bg);
    border-color: var(--success-line);
    border-left-color: var(--success);
    color: var(--success-text);
}
.messages .message.warning {
    background: var(--warning-bg);
    border-color: var(--warning-line);
    border-left-color: var(--warning);
    color: var(--warning-text);
}
.messages .message.error {
    background: var(--danger-bg);
    border-color: var(--danger-line);
    border-left-color: var(--danger);
    color: var(--danger-text);
}
/* "Annuler" after a dismissal: a text button at the end of the message line. */
.messages .message-undo { display: inline; margin-left: var(--space-xs); }
.messages .message-undo-button {
    padding: 0 2px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: var(--font-weight-semibold);
    text-decoration: underline;
    cursor: pointer;
}
.messages .message-undo-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================
   Confirm modal (shared, markup in base.html)
   ============================================ */
.confirm-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--scrim);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: var(--space-sm);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.confirm-modal-overlay.active {
    display: flex;
    animation: confirmFadeIn 0.18s ease-out;
}
@keyframes confirmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.confirm-modal {
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: confirmSlideIn 0.18s ease-out;
}
@keyframes confirmSlideIn {
    from { opacity: 0; transform: scale(0.97) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.confirm-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-sm);
}
.confirm-modal-icon:empty { display: none; }
.confirm-modal-icon svg { width: 24px; height: 24px; }
.confirm-modal-icon--danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}
.confirm-modal-icon--warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}
.confirm-modal-icon--info {
    background: var(--accent-wash);
    color: var(--accent);
}
.confirm-modal h3 {
    font-size: var(--text-lg);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}
.confirm-modal p {
    color: var(--text-secondary);
    font-size: var(--text-ui);
    line-height: var(--leading-normal);
    margin-bottom: 0;
}
.confirm-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}
.confirm-modal-actions .btn { min-width: 110px; }

/* ============================================
   Tooltip: a small graphite label
   ============================================ */

/* ============================================
   Data-type badges (columns, categories): mono ink on its own wash
   ============================================ */

/* ============================================
   Demo-specific: response viewer
   ============================================ */
/* No italic: Geist Mono ships upright only, and a synthesized oblique reads
   as a different face. */

/* ============================================================
   COCKPIT SHELL (direction D): sidebar, page head, panels, score
   figures and the small parts pages are assembled from.
   Contract for the page authors: CONTRACT.md of the integration.
   ============================================================ */

kbd {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xs);
    background: var(--card-bg);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: var(--leading-snug);
    color: var(--text-secondary);
}

/* ---- Buttons of the cockpit ----
   .btn-brand is the violet call to action (the one per screen). The yellow
   .btn-accent above is NOT used by pages: the spark lives on the sidebar's
   Refresh button only. .btn-ui turns any .btn into the 44px squared control
   of the mockups; .btn-block makes it full width. */
.btn-brand {
    background-color: var(--accent-fill);
    color: var(--text-on-fill);
}
.btn-brand:hover:not(:disabled) {
    background-color: var(--accent-strong);
    color: var(--text-on-fill);
}
.btn-ui {
    min-height: 44px;
    padding: 0 1.1rem;
    border-radius: var(--radius-md);
    font-size: var(--text-ui);
    box-shadow: none;
}
.btn-ui.btn-sm {
    min-height: 36px;
    padding: 0 0.85rem;
    font-size: var(--text-sm);
}
.btn-block { display: flex; width: 100%; }
.btn-pill {
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
}
.btn-pill:hover { border-color: var(--border-hover); }
.link-action {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 6px;
    color: var(--accent);
    font-weight: var(--font-weight-semibold);
}

/* ---- App shell: graphite sidebar + content ---- */
.skip-link {
    position: absolute;
    left: var(--space-xs);
    top: -4rem;
    z-index: 1100;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    background: var(--surface-inverse);
    color: var(--text-inverse);
}
.skip-link:focus { top: var(--space-xs); }

.app-shell {
    --sidebar-width: 248px;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
    /* The graphite column is painted on the shell, so it runs to the bottom of a long page. */
    background: linear-gradient(to right, var(--surface-inverse) var(--sidebar-width), transparent var(--sidebar-width));
}
.app-main {
    min-width: 0;
    padding: 28px 32px 48px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.app-main > .messages { margin-bottom: 0; }

.sidebar {
    --focus-ring: var(--accent-on-inverse);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    background: var(--surface-inverse);
    color: var(--text-inverse);
    font-size: var(--text-ui);
}
.sidebar a { text-decoration: none; }
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px;
    color: var(--text-on-fill);
    font-weight: var(--font-weight-heavy);
    font-size: var(--text-md);
    letter-spacing: var(--tracking-tight);
}
.sidebar-brand:hover { color: var(--text-on-fill); }
.brand-mark-bg { fill: var(--accent-fill); }
.brand-mark-dot { fill: var(--text-inverse); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    color: var(--text-inverse);
    transition: background-color var(--transition-fast);
}
.side-link:hover { background: var(--hover-bg-inverse); color: var(--text-on-fill); }
.side-link.is-active {
    background: var(--hover-bg-inverse);
    color: var(--text-on-fill);
    font-weight: var(--font-weight-semibold);
}
.side-link.is-active .side-count { color: var(--accent-on-inverse); }
.side-count {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
}

/* Collecte block (missions/partials/sidebar_collect_*.html): one figure ("N neuves  à HH:MM"), one
   amber alert line that unfolds, the Refresh button, the source checklist folded in a <details>, and
   the AI quota line with its gauge. */
.collect-panel {
    margin-top: auto;
    padding: 16px;
    border: 1px solid var(--border-inverse);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.collect-panel > div:empty { display: none; }
/* State of a run (partials/collect_progress_side.html, missions/static/missions/js/progress.js): under way, the
   balance, or the failure. While the run is under way it takes the place of the Refresh form, which stays in the
   DOM (disabled) for the scripts; the limit and the status line come back at the end. */
.collect-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 12px;
    border: 1px solid var(--border-inverse);
    border-radius: var(--radius-md);
    background: var(--surface-inverse-hover);
}
.collect-progress[hidden] { display: none; }
.collect-progress p { margin: 0; }
.collect-progress-head { display: flex; align-items: center; gap: var(--space-xs); }
.collect-progress-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-ui); font-weight: var(--font-weight-semibold); color: var(--text-inverse); white-space: nowrap; }
.collect-progress-time {
    flex: none;
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    color: var(--text-inverse-secondary);
}
.collect-progress-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
.collect-progress-spin {
    box-sizing: border-box;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-inverse);
    border-top-color: var(--accent-on-inverse);
    border-radius: 50%;
    animation: collect-progress-spin 0.9s linear infinite;
}
.collect-progress-check { color: var(--accent-on-inverse); }
.collect-progress-warn { font-size: var(--text-sm); font-weight: var(--font-weight-heavy); color: var(--warning-on-inverse); }
.collect-progress:not([data-state="running"]) .collect-progress-spin,
.collect-progress:not([data-state="done"]) .collect-progress-check,
.collect-progress:not([data-state="failed"]) .collect-progress-warn { display: none; }
.collect-progress-bar {
    height: 4px;
    border-radius: var(--radius-xs);
    background: var(--border-inverse);
    overflow: hidden;
}
.collect-progress-bar > span {
    display: block;
    width: var(--w, 0%);
    height: 100%;
    border-radius: var(--radius-xs);
    background: var(--accent-on-inverse);
    transition: width 0.25s linear;
}
.collect-progress:not([data-state="running"]) .collect-progress-bar { display: none; }
.collect-progress-sub { font-size: var(--text-sm); line-height: var(--leading-snug); color: var(--text-inverse-secondary); overflow-wrap: anywhere; }
.collect-progress-sub:empty { display: none; }
.collect-progress[data-state="failed"] .collect-progress-sub { color: var(--warning-on-inverse); }
.collect-progress-line { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-inverse); }
.collect-progress-note { font-size: var(--text-xs); color: var(--warning-on-inverse); }
.collect-progress-line[hidden], .collect-progress-note[hidden], .collect-progress-note:empty { display: none; }
.collect-panel.is-collecting > #collectInfo,
.collect-panel.is-collecting > #refreshForm,
.collect-panel.is-collecting > .collect-limit,
.collect-panel.is-collecting > .collect-status { display: none; }
@keyframes collect-progress-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .collect-progress-spin { animation: none; }
    .collect-progress-bar > span { transition: none; }
}
.collect-summary { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-xs); }
.collect-summary p { margin: 0; }
.collect-total {
    display: flex;
    align-items: baseline;
    gap: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--text-inverse-secondary);
}
.collect-total--none { font-size: var(--text-xs); }
.collect-total-value {
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-medium);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    font-variant-numeric: tabular-nums;
    color: var(--text-inverse);
}
.collect-time { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-inverse-secondary); }
/* Sources that cannot run, failed or were skipped: one amber line, unfolding into one entry each. */
.collect-alerts-summary {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    min-height: 24px;
    list-style: none;
    color: var(--warning-on-inverse);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
}
.collect-alerts-summary::-webkit-details-marker { display: none; }
.collect-alerts-summary:hover { text-decoration: underline; }
.collect-alerts-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--warning-on-inverse); }
.collect-alerts-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 8px 0 0; padding: 0; }
.collect-warn { display: flex; flex-direction: column; gap: 2px; font-size: var(--text-xs); line-height: 1.5; }
.collect-warn-name { color: var(--warning-on-inverse); font-weight: var(--font-weight-semibold); }
.collect-warn-tip { color: var(--text-inverse-secondary); overflow-wrap: anywhere; }
/* The fold: a summary row "Sources  6 sur 7", then the checklist grouped by profile kind. */
.collect-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xs);
    min-height: 28px;
    list-style: none;
    color: var(--text-inverse-secondary);
    font-size: var(--text-xs);
    cursor: pointer;
}
.collect-toggle::-webkit-details-marker { display: none; }
.collect-toggle:hover { color: var(--text-inverse); }
.collect-toggle-count {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-inverse-secondary);
}
.collect-chevron { flex: none; transition: transform var(--transition-base); }
.collect-sources[open] .collect-chevron { transform: rotate(180deg); }
.collect-toggle:focus-visible, .collect-alerts-summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.collect-sources-body { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; }
/* With JS the summary opens the checklist in a modal (refresh.js), on the sidebar's graphite so the
   checklist keeps its colours; the sidebar keeps its height. The chevron then points sideways. */
.collect-sources.is-dialog .collect-chevron { transform: rotate(-90deg); }
.collect-dialog {
    --focus-ring: var(--accent-on-inverse);
    width: min(420px, calc(100vw - 32px));
    max-height: min(640px, calc(100vh - 48px));
    margin: auto;
    padding: 0;
    border: 1px solid var(--border-inverse);
    border-radius: var(--radius-lg);
    background: var(--surface-inverse);
    color: var(--text-inverse);
    font-size: var(--text-ui);
    box-shadow: var(--shadow-lg);
}
.collect-dialog[open] { display: flex; flex-direction: column; animation: confirmSlideIn 0.18s ease-out; }
.collect-dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.collect-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xs);
    padding: 16px 16px 12px 20px;
    border-bottom: 1px solid var(--border-inverse);
}
.collect-dialog-title { margin: 0; font-size: var(--text-base); font-weight: var(--font-weight-semibold); color: var(--text-inverse); }
.collect-dialog-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-inverse-secondary);
    cursor: pointer;
}
.collect-dialog-close:hover { background: var(--hover-bg-inverse); color: var(--text-inverse); }
.collect-dialog-close:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.collect-dialog-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 20px; }
.collect-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: var(--space-xs); }
.collect-group-title {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    min-height: 18px;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-inverse-secondary);
}
.collect-group-title::after { content: ""; flex: 1; height: 1px; background: var(--border-inverse); }
.collect-list { list-style: none; display: flex; flex-direction: column; font-size: var(--text-sm); }
.collect-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-xs); }
.collect-pick {
    flex: 1;
    min-width: 0;
    min-height: 28px;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
}
.collect-check { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent-on-inverse); cursor: pointer; }
.collect-check:disabled { cursor: not-allowed; }
/* A long name wraps (at its hyphen for Freelance-Informatique) rather than being cut. */
.collect-name { min-width: 0; padding: 3px 0; line-height: var(--leading-snug); overflow-wrap: anywhere; }
.collect-pick:hover .collect-name { color: var(--text-on-fill); }
.collect-row:has(.collect-check:not(:checked)) .collect-name,
.collect-row:has(.collect-check:not(:checked)) .collect-count { color: var(--text-inverse-secondary); }
.collect-count {
    flex: none;
    min-width: 3ch;
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-inverse);
}
.collect-count.is-stale { color: var(--text-inverse-secondary); cursor: help; }
.collect-state { flex: none; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-inverse-secondary); white-space: nowrap; }
.collect-state--warn { display: inline-flex; color: var(--warning-on-inverse); }
.collect-row--error .collect-state,
.collect-row--running .collect-state { color: var(--accent-on-inverse); }
/* Short reason of a failed or skipped run, under the name (checkbox 16px + gap 8px). */
.collect-detail { flex: 1 0 100%; padding-left: 24px; font-size: var(--text-xs); color: var(--text-inverse-secondary); overflow-wrap: anywhere; }
.collect-empty { font-size: var(--text-sm); color: var(--text-inverse-secondary); }
.sidebar-refresh {
    width: 100%;
    min-height: 40px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--spark);
    color: var(--text-on-spark);
    font-size: var(--text-ui);
    font-weight: var(--font-weight-heavy);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}
.sidebar-refresh:hover:not(:disabled) { background: var(--spark-hover); }
.sidebar-refresh:disabled { opacity: 0.6; cursor: progress; }
.collect-status { font-size: var(--text-xs); color: var(--text-inverse); }
.collect-status:empty { display: none; }
.sidebar-refresh:disabled:not([aria-busy="true"]) { cursor: not-allowed; }
.collect-limit { display: flex; flex-direction: column; gap: 2px; font-size: var(--text-2xs); color: var(--text-inverse-secondary); }
.collect-limit[hidden] { display: none; }
.collect-limit p { margin: 0; }
.collect-limit-count { font-family: var(--font-mono); }
.collect-limit-next { color: var(--text-inverse); }
/* The rule shows when the button is blocked; otherwise it sits in the title of the counter. */
.collect-limit-hint { display: none; }
.collect-limit.is-blocked .collect-limit-hint { display: block; }
.collect-limit.is-blocked .collect-limit-count { color: var(--warning-on-inverse); }
.collect-cost {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--border-inverse);
    font-size: var(--text-xs);
    color: var(--text-inverse-secondary);
}
.quota-head { display: flex; justify-content: space-between; gap: var(--space-xs); }
.collect-cost-value { font-family: var(--font-mono); color: var(--text-inverse); }
.quota-gauge {
    display: block;
    width: 100%;
    height: 3px;
    border: 0;
    border-radius: var(--radius-xs);
    appearance: none;
    background: var(--border-inverse);
}
.quota-gauge::-webkit-progress-bar { background: var(--border-inverse); border-radius: var(--radius-xs); }
.quota-gauge::-webkit-progress-value { background: var(--accent-on-inverse); border-radius: var(--radius-xs); }
.quota-gauge::-moz-progress-bar { background: var(--accent-on-inverse); border-radius: var(--radius-xs); }
.quota-note { margin: 0; font-size: var(--text-2xs); }

.sidebar-menu-toggle {
    display: none;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border-inverse);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-inverse);
    font-size: var(--text-ui);
    font-weight: var(--font-weight-heavy);
    cursor: pointer;
}
.sidebar-menu-toggle:hover { background: var(--hover-bg-inverse); color: var(--text-on-fill); }
.sidebar-menu-toggle[hidden] { display: none !important; }
/* Account: avatar + e-mail open a menu (password, instance settings, language, logout). The button
   stays hidden until sidebar.js runs; without it the menu is simply open in the page. */
.sidebar-account { position: relative; }
.account-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-inverse);
    cursor: pointer;
    text-align: left;
    transition: background-color var(--transition-fast);
}
.account-toggle[hidden] { display: none; }
.account-toggle:hover, .account-toggle[aria-expanded="true"] { background: var(--hover-bg-inverse); }
.account-avatar {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-inverse-hover);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-heavy);
}
.account-email {
    flex: 1;
    min-width: 0;
    font-size: var(--text-xs);
    color: var(--text-inverse-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.account-toggle svg { flex: none; color: var(--text-inverse-secondary); }
/* One chevron: up while the menu (which opens above the button) is closed, down once it is open. */
.account-chevron { transition: transform 120ms ease; }
.account-toggle[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }
.account-menu {
    --focus-ring: var(--accent);
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
}
.account-menu[hidden] { display: none; }
/* With JS on (html.js, set in the head), the menu stays closed from the first paint instead of
   showing until sidebar.js runs at the end of the page. */
html.js .sidebar-account:not(.has-js) .account-menu { display: none; }
.sidebar-account.has-js .account-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20; }
.account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: var(--text-sm);
    text-align: left;
    cursor: pointer;
}
a.account-item:hover, button.account-item:hover { background: var(--hover-bg); color: var(--text-primary); }
.account-logout { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--border-color); }
.account-lang { cursor: default; }
.account-lang .language-switch-group, .account-switch-group { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-sm); background: var(--bg-secondary); }
.account-switch { margin: 0; }
.account-lang-button {
    min-height: 26px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--text-2xs);
}
.account-lang-button[aria-current="true"], .account-lang-button[aria-pressed="true"] { background: var(--card-bg); color: var(--text-primary); }

/* ---- Page head: mono eyebrow, sentence title, actions on the right ---- */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
}
/* A page that fills no title shows no head (pages still on the old .page-header). */
.page-head:has(.page-head-title:empty) { display: none; }
.page-head-text { min-width: 0; flex: 1 1 480px; }
.page-head-eyebrow {
    margin-bottom: 6px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--accent);
}
.page-head-eyebrow:empty { display: none; }
.page-head-title {
    font-size: var(--text-2xl);
    line-height: 1.2;
    font-weight: var(--font-weight-heavy);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
}
.page-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head-actions:empty { display: none; }

/* ---- Panel: the white sheet of the cockpit ---- */
.panel {
    min-width: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.panel-open { overflow: visible; }
.panel-pad { padding: 24px; }
.panel-stack { display: flex; flex-direction: column; gap: 20px; }
.panel-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.inline-form { display: inline-flex; margin: 0; }
.panel-title { font-size: var(--text-base); font-weight: var(--font-weight-heavy); }
.panel-foot { padding: 14px 16px; font-size: var(--text-sm); color: var(--text-tertiary); }
.panel-split { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.panel-split > * { flex: 1 1 420px; min-width: 0; }
.panel-split > .panel-wide { flex: 999 1 520px; }

/* ---- Segmented tabs (active = graphite via --chip-active-*) ---- */
.seg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.seg-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--card-bg);
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast),
                background-color var(--transition-fast);
}
.seg-tab:hover { border-color: var(--border-strong); color: var(--text-primary); text-decoration: none; }
.seg-tab:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.seg-tab.is-active, .seg-tab[aria-pressed="true"], .seg-tab[aria-current="page"],
.seg-tab.is-active:hover, .seg-tab[aria-pressed="true"]:hover, .seg-tab[aria-current="page"]:hover {
    background: var(--chip-active-bg);
    border-color: var(--chip-active-border);
    color: var(--chip-active-text);
}
.seg-count { font-family: var(--font-mono); font-size: var(--text-xs); opacity: 0.8; }
/* Boxed variant (dashboard views): tabs sit in a well, the chosen one raised on a card.
   A tab at zero is greyed but stays a link. */
.seg-boxed { gap: 4px; padding: 4px; border-radius: var(--radius-md); background: var(--bg-secondary); }
.seg-boxed .seg-tab { min-height: 34px; padding: 0 14px; border-color: transparent; background: transparent; font-weight: var(--font-weight-semibold); }
.seg-boxed .seg-tab:hover { border-color: transparent; color: var(--text-primary); }
.seg-boxed .seg-tab.is-empty { color: var(--text-tertiary); }
.seg-boxed .seg-tab.is-empty .seg-count { opacity: 0.6; }
.seg-boxed .seg-tab.is-active, .seg-boxed .seg-tab.is-active:hover {
    background: var(--card-bg);
    border-color: transparent;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}
.seg-boxed .seg-tab.is-active .seg-count { color: var(--accent); opacity: 1; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---- Verdicts: set .verdict-<top|good|maybe|none> on a wrapper; everything inside reads it ---- */
.verdict-top   { --verdict-ink: var(--verdict-top);   --verdict-wash: var(--verdict-top-bg); }
.verdict-good  { --verdict-ink: var(--verdict-good);  --verdict-wash: var(--verdict-good-bg); }
.verdict-maybe { --verdict-ink: var(--verdict-maybe); --verdict-wash: var(--verdict-maybe-bg); }
.verdict-none  { --verdict-ink: var(--verdict-none);  --verdict-wash: var(--verdict-none-bg); }

.score-fig { display: flex; flex-direction: column; gap: 6px; }
.score-fig-value {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: var(--font-weight-medium);
    font-variant-numeric: tabular-nums;
    color: var(--verdict-ink);
}
.mini-bar {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}
.mini-bar::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--w, 0%);
    background: var(--verdict-ink);
    border-radius: inherit;
}
/* A stale score (profile changed since): the bar turns dotted, explained by the list legend. */
.mini-bar.is-stale::after,
.stale-swatch {
    background: repeating-linear-gradient(90deg, var(--verdict-ink) 0 3px, transparent 3px 6px);
}
.score-hero { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.score-hero-figure { display: inline-flex; align-items: baseline; gap: 6px; }
.score-hero-value {
    font-family: var(--font-mono);
    font-size: var(--text-4xl);
    font-weight: var(--font-weight-medium);
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--verdict-ink);
}
.score-hero-max { font-family: var(--font-mono); font-size: var(--text-ui); color: var(--text-tertiary); }
.verdict-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--verdict-wash);
    color: var(--verdict-ink);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-heavy);
}
.score-basis { margin-left: auto; font-size: var(--text-xs); color: var(--text-tertiary); }

/* ---- Mission list rows (the whole row is one link or button) ---- */
.list-rows { list-style: none; }
.list-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    width: 100%;
    padding: 13px 16px;
    border: 0;
    border-bottom: 1px solid var(--bg-secondary);
    background: var(--card-bg);
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.list-row:hover { background: var(--hover-bg); color: var(--text-primary); text-decoration: none; }
.list-row.is-current,
.list-row[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.list-row-main { min-width: 0; display: flex; flex-direction: column; }
.list-row-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.list-row-main { gap: 4px; }
.list-row-title,
.list-row-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-title { font-weight: var(--font-weight-semibold); font-size: var(--text-base); }
.list-row-meta { font-size: var(--text-sm); color: var(--text-tertiary); }
/* The flag of an offer's country, in front of its place (list, preview, facts). The hairline keeps
   white flags visible on a white card and on the selected row. */
.flag {
    display: inline-block;
    flex: none;
    width: 16px;
    height: 12px;
    margin-inline-end: 5px;
    vertical-align: -1px;
    border-radius: var(--radius-2xs);
    outline: 1px solid var(--border-strong);
    outline-offset: -1px;
}
/* Right column: the contract, and the pay only when the offer states it. */
.list-row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 72px; }
.list-row-rate {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-align: right;
    white-space: nowrap;
}

/* ---- Contract pill: lightness tells the three kinds apart, not the hue alone; none when unknown ---- */
.contract-pill {
    flex: 0 0 auto;
    padding: 1px 7px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
}
.contract-freelance { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.contract-contract { background: var(--card-bg); border-color: var(--warning-line); color: var(--warning-text); }
.contract-permanent { background: var(--surface-inverse); border-color: var(--surface-inverse); color: var(--text-inverse); }
.dot-new {
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}

/* ---- Sub-scores: mini gauges, label and value over a thin track (amber under 50) ---- */
.subscore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px 24px;
}
.subscore { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.subscore-head { display: flex; justify-content: space-between; gap: 8px; font-size: var(--text-sm); }
.subscore-label { color: var(--text-secondary); }
.subscore-track {
    display: block;
    height: 4px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}
.subscore-track::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--w, 0%);
    background: var(--accent);
    border-radius: inherit;
}
.subscore-track.is-low::after { background: var(--subscore-low); }
.subscore-value { font-family: var(--font-mono); color: var(--text-primary); }

/* ---- Score sections: a mono eyebrow, no box ("Pourquoi", "Détail de la note", "À surveiller") ---- */
.score-section { display: flex; flex-direction: column; gap: 10px; }
.section-eyebrow {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--accent);
}
.section-eyebrow.is-muted { color: var(--text-tertiary); }
.section-eyebrow.is-warning { color: var(--warning-text); }
.why-text { font-size: var(--text-base); line-height: var(--leading-normal); color: var(--text-secondary); white-space: pre-line; }
.why-toggle {
    align-self: flex-start;
    padding: 6px 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
}
.why-toggle:hover { color: var(--accent-strong); }
.why-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.score-note { font-size: var(--text-xs); color: var(--text-tertiary); }
.watch-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.watch-list li {
    display: flex;
    gap: 10px;
    align-items: baseline;
    font-size: var(--text-ui);
    line-height: var(--leading-snug);
    color: var(--text-secondary);
}
.watch-list li::before {
    content: "";
    flex: 0 0 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning);
    transform: translateY(-2px);
}
.new-chip,
.status-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-heavy);
}
.new-chip { background: var(--accent-soft); color: var(--accent-strong); }
.status-chip { background: var(--chip-active-bg); color: var(--chip-active-text); }

/* ---- Key facts (dl) ---- */
.facts {
    display: grid;
    grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
    gap: 12px 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--well-bg);
}
.facts-3 { --cols: 3; }
/* The stated facts, then one line for the others ("Non précisé dans l'offre : contrat, TJM"). */
.facts-group { display: flex; flex-direction: column; gap: 8px; }
.facts-unknown { font-size: var(--text-xs); color: var(--text-tertiary); }
.facts-panel {
    padding: 18px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}
.facts .fact { min-width: 0; }
.facts dt { font-size: var(--text-xs); color: var(--text-tertiary); }
.facts dd {
    margin: 2px 0 0;
    font-size: var(--text-ui);
    font-weight: var(--font-weight-semibold);
    overflow-wrap: anywhere;
}
.facts-panel dd { font-size: var(--text-base); }

/* ---- Step strip (stages of an application) ---- */
.stepper { list-style: none; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.step { display: flex; align-items: center; gap: 6px; }
.step:not(:last-child)::after {
    content: "";
    width: 7px;
    height: 7px;
    border-top: 2px solid var(--border-hover);
    border-right: 2px solid var(--border-hover);
    transform: rotate(45deg);
    margin-right: 4px;
}
.step-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
}
.step.is-current .step-pill {
    background: var(--chip-active-bg);
    color: var(--chip-active-text);
    font-weight: var(--font-weight-heavy);
}
.step.is-done .step-pill { color: var(--text-primary); }

/* ---- Timeline (history of a mission) ---- */
.timeline { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.timeline-item { display: flex; gap: 12px; align-items: flex-start; }
.timeline-item::before {
    content: "";
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--fill-muted);
}
.timeline-item.is-current::before { background: var(--accent); }
.timeline-title { font-weight: var(--font-weight-semibold); }
.timeline-time {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ---- Dashed note (duplicates, empty states, hints) ---- */
.dash-note {
    padding: 16px 18px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ---- Follow-up bar and small navigation helpers ---- */
.followup-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 10px 12px 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
}
.followup-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: var(--font-weight-heavy);
    color: var(--warning-text);
}
.followup-title::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
}
.followup-item { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.followup-item a { font-weight: var(--font-weight-semibold); color: var(--text-primary); }
.followup-item a:hover { color: var(--accent); }
.crumbs { font-size: var(--text-sm); color: var(--text-tertiary); }
.crumbs a { font-weight: var(--font-weight-semibold); }
.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--text-primary);
}
.icon-link:hover { border-color: var(--border-hover); text-decoration: none; }
.icon-link[aria-disabled="true"] { color: var(--border-hover); border-color: var(--border-color); pointer-events: none; }
.search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--text-tertiary);
    flex: 0 1 300px;
}
.search-field input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: var(--text-ui);
    color: var(--text-primary);
}
.search-field:focus-within { border-color: var(--focus-ring); box-shadow: var(--shadow-focus); }

/* ---- Login: graphite brand half, form half ---- */
.auth-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; background: var(--card-bg); }
.auth-brand {
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 48px;
    background: var(--surface-inverse);
    color: var(--text-inverse);
}
.auth-brand-name { display: flex; align-items: center; gap: 10px; font-weight: var(--font-weight-heavy); font-size: var(--text-lg); color: var(--text-on-fill); }
.auth-brand-pitch {
    max-width: 520px;
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: var(--font-weight-heavy);
    line-height: 1.15;
    letter-spacing: var(--tracking-tighter);
}
.auth-brand-sources {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-inverse-secondary);
}
.auth-panel { padding: 48px 32px; display: flex; align-items: center; justify-content: center; }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 18px; }
.auth-form h1 { font-size: var(--text-2xl); font-weight: var(--font-weight-heavy); }
.auth-form .auth-lead { margin-top: 6px; color: var(--text-tertiary); }
.auth-form .form-group { margin-bottom: 0; }
.auth-form .form-group input:where(:not([type="hidden"])) { min-height: 44px; padding: 0 14px; border-radius: var(--radius-md); }
.auth-form .btn-brand { min-height: 48px; margin-top: 6px; font-size: var(--text-base); font-weight: var(--font-weight-heavy); }
.auth-panel-inner { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.auth-panel-inner .messages { margin-bottom: 0; }

/* ---- Small screens: the sidebar sits above the content, previews give way to links ---- */
@media (max-width: 768px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); background: none; }
    .sidebar {
        position: static; height: auto; overflow: visible; padding: 12px 16px; gap: 12px;
        display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center;
    }
    .sidebar > * { grid-column: 1 / -1; }
    .sidebar > .sidebar-brand { grid-column: 1; padding: 0; }
    /* The collect panel dissolves: its Refresh form joins the top row, the rest folds into the menu. */
    .collect-panel { display: contents; }
    .collect-panel > * { grid-column: 1 / -1; }
    .collect-panel > form { grid-column: 2; grid-row: 1; }
    .sidebar-refresh { width: auto; padding: 0 16px; }
    .sidebar-menu-toggle { display: inline-flex; grid-column: 3; grid-row: 1; }
    .sidebar.is-collapsed .sidebar-fold,
    .sidebar.is-collapsed .collect-progress:not([data-state="running"]) { display: none; }
    .collect-status, .collect-limit { padding: 0 8px; }
    .account-menu { position: static !important; box-shadow: none; }
    .app-main { padding: 20px 16px 40px; gap: 16px; }
    .page-head-title { font-size: var(--text-xl); }
    .facts { --cols: 2; }
    .list-row { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; padding: 12px; }
    .list-row-rate { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
    .auth-split { grid-template-columns: 1fr; }
    .auth-brand { padding: 28px 24px; gap: 24px; }
    .auth-brand-pitch { font-size: var(--text-xl); }
    .auth-panel { padding: 32px 20px; }
}

/* ---- Language switch: one small button per language (templates/partials/language_switch.html) ---- */
.language-switch { margin: 0; }
.language-switch-group { display: inline-flex; gap: var(--space-xs); }
.language-switch button { cursor: pointer; font-family: var(--font-mono); letter-spacing: var(--tracking-wide); }
.language-switch button[aria-current="true"] { font-weight: var(--font-weight-heavy); }
.language-switch .home-link-inverse { background: none; border: 0; padding: 0 var(--space-xs); }
.language-switch .home-link-inverse[aria-current="true"] { text-decoration: underline; }

/* ---- Profile guidance (missions/profile_guidance.py): progress ring, sidebar mark, page lede ----
   The ring (partials/guidance_ring.html) shows the steps done out of two; violet on light surfaces,
   the light violet of the sidebar on graphite, amber for a CV read poorly. Never the spark. */
.guide-ring { flex: none; display: block; }
.guide-ring circle { fill: none; stroke-width: 2.25; }
.guide-ring-track { stroke: var(--accent-wash-strong); }
.guide-ring-arc { stroke: var(--accent); stroke-linecap: round; }
.guide-ring-warning .guide-ring-track { stroke: var(--warning-line); }
.guide-ring-warning .guide-ring-arc { stroke: var(--warning); }
.guide-ring-inverse .guide-ring-track { stroke: var(--border-inverse); }
.guide-ring-inverse .guide-ring-arc { stroke: var(--accent-on-inverse); }
/* Profil entry of the sidebar: the ring and "1/2" in the place of a count, or an amber dot. */
.side-guide { display: inline-flex; align-items: center; gap: 6px; }
.side-guide .side-count { color: var(--accent-on-inverse); }
.side-dot-warning {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning-on-inverse);
}
/* Under the Refresh button, for an account without CV. */
.collect-guide { margin: 0; font-size: var(--text-xs); line-height: var(--leading-snug); color: var(--text-inverse-secondary); }
.collect-guide a { color: var(--accent-on-inverse); font-weight: var(--font-weight-semibold); }
.collect-guide a:hover { color: var(--text-inverse); }
/* Two progress segments, one per step (setup of the dashboard, head of the Profile page). */
.guide-segments { display: inline-flex; gap: 4px; }
.guide-segment { width: 22px; height: 4px; border-radius: var(--radius-full); background: var(--border-strong); }
.guide-segment.is-done { background: var(--accent); }
/* One sentence under a page title (base.html, block page_lede). */
.page-head-lede { margin-top: 6px; font-size: var(--text-ui); color: var(--text-secondary); }
