/* Back-office theme corrections, loaded on every admin page via UNFOLD["STYLES"].
 *
 * Hand-written CSS on purpose: the Tailwind build (static/src/input.css → app.css) only
 * scans templates/ for the front site, and the admin is styled by Unfold's own compiled
 * stylesheet. Colours come from the CSS variables Unfold publishes from UNFOLD["COLORS"],
 * so this file never hard-codes a brand colour.
 */

/* --- Changelist: where do I tap to open the record? ---------------------------------
 * Unfold renders the link to a record in the same colour and weight as the plain text
 * beside it. On a phone every row collapses into a card, and that link is the only
 * tappable thing on it — with nothing to say so. Give changelist links the same
 * treatment links get everywhere else in the app (primary + underline).
 */
#result_list tbody a {
    color: var(--color-primary-600);
    text-decoration: underline;
    text-underline-offset: 2px;
}

#result_list tbody a:hover {
    color: var(--color-primary-700);
}

.dark #result_list tbody a {
    color: var(--color-primary-400);
}

.dark #result_list tbody a:hover {
    color: var(--color-primary-300);
}

/* Below Unfold's `lg` breakpoint each row is a card; mark the record's own link as the
 * way in rather than leaving it to look like one more value. */
@media (max-width: 1023px) {
    /* \203A is "›" written as an escape: a stylesheet is served without a charset, so a
       literal non-ASCII character can be decoded as latin-1 and print as mojibake. */
    #result_list tbody th a::after {
        content: " \203A";
        text-decoration: none;
        font-weight: 600;
    }

    #result_list tbody th a {
        font-weight: 600;
    }
}

/* --- Changelist: keep the phone cards inside the phone -------------------------------
 * A card row is `label … value` on one line, and cells that Django marks `nowrap` (or that
 * hold a long list like Job scope) refuse to break — so the row, the table and with it the
 * whole page grow wider than the screen. Everything then sits half off the right edge,
 * including the link into the record. Let a value wrap under its label instead; the table
 * keeps its own horizontal scroll on the desktop layout, which is where it belongs.
 */
@media (max-width: 1023px) {
    #result_list,
    #result_list > tbody,
    #result_list > tbody > tr {
        max-width: 100%;
    }

    #result_list > tbody > tr > td,
    #result_list > tbody > tr > th {
        flex-wrap: wrap;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* --- Changelist: the action bar on phones -------------------------------------------
 * Unfold pins the "run an action" bar with `position: fixed` and binds its `left` to the
 * *desktop* sidebar width, which stays set on a phone (where the sidebar is an overlay).
 * The bar then starts ~288px into a ~390px screen, so the action picker and the Run
 * button end up squeezed into — or past — the bottom-right corner. The inner element also
 * carries an inline pixel width measured from the changelist, which can be wider than the
 * viewport. Both are inline styles, hence `!important`.
 */
@media (max-width: 1023px) {
    #changelist-form > div:has(> #changelist-actions-wrapper) {
        left: 0 !important;
        right: 0 !important;
        padding: 0.5rem;
    }

    #changelist-actions {
        width: 100% !important;
        margin-left: 0;
        margin-right: 0;
    }

    /* Stack picker + Run + counter instead of overflowing sideways on a narrow screen. */
    #changelist-actions > div {
        margin-left: 0;
        margin-right: 0;
    }

    /* The bar floats over the list, so leave room for it: without this the rows it covers
     * can't be reached, and the last one is never fully readable. */
    #changelist-form:has(input.action-select:checked) {
        padding-bottom: 6rem;
    }
}

/* --- Goods Receipt lines: narrower columns so the row fits without scrolling ----------
 * Nine columns wide-open by default forces the tabular inline's own horizontal scroll
 * strip on every screen, desktop included. The short/numeric columns don't need the same
 * width as a Select2 combobox — capping them is usually enough to fit the row without it.
 * ID-scoped to this one inline (#lines-data is GoodsReceipt.lines' table id) so nothing
 * else with a `quantity`/`unit_cost` column is affected.
 *
 * `.field-*`, not `.column-*`: Unfold puts `column-<name>` on the header <th> only — the
 * widgets live in `<td class="field-<name>">`. The id keeps this ahead of the `max-w-2xl`
 * Unfold's own widget classes carry.
 */
#lines-data .field-received_qty input,
#lines-data .field-quantity input,
#lines-data .field-rejected_qty input,
#lines-data .field-unit_cost input {
    max-width: 6rem;
}

#lines-data .field-rejection_reason textarea {
    max-width: 12rem;
}

/* --- Product routing ("Product operations" inline): room for the operation name ------
 * The operation select is the column people read, but every other column was as wide as
 * its header or Unfold's `min-w-20` inputs, which squeezed the operation name down to a few
 * characters. The headers are shortened in ProductOperationInlineForm; this caps the short
 * inputs (`min-width: 0` undoes `min-w-20`, which otherwise beats any max-width) and hands
 * the operation column whatever is left. Desktop only (`lg`, where Unfold draws the inline
 * as a table); below it every row is a card with one field per line. Widths only — no
 * colour, so there is no `.dark` twin.
 */
@media (min-width: 1024px) {
    #routing-data th.column-sequence,
    #routing-data th.column-default_rate,
    #routing-data th.column-target_qty_per_unit,
    #routing-data th.column-is_required_for_completion,
    #routing-data th.column-smv {
        white-space: normal;
        width: 1%;
    }

    /* Fixed widths, not caps: the headers above are `width: 1%`, so a column shrinks to
     * whatever its input insists on. Wide enough for a 4-decimal rate. */
    #routing-data .field-sequence input {
        min-width: 0;
        width: 4rem;
    }

    #routing-data .field-department select {
        min-width: 0;
        width: 8rem;
    }

    #routing-data .field-default_rate input {
        min-width: 0;
        width: 6rem;
    }

    #routing-data .field-target_qty_per_unit input,
    #routing-data .field-smv input {
        min-width: 0;
        width: 5rem;
    }

    #routing-data td.field-operation {
        width: 100%;
    }

    /* "Waits for": one tick per routing step. Unfold truncates each label, so the column
     * keeps room for a task name ("Vertical Hemming") instead of shrinking to the ticks. */
    #routing-data th.column-waits_for {
        white-space: normal;
    }

    #routing-data td.field-waits_for {
        min-width: 11rem;
    }

    #routing-data td.field-waits_for label {
        font-size: 0.8125rem;
    }

    #routing-data .field-operation select,
    #routing-data .field-operation .picker-input {
        max-width: none;
        min-width: 16rem;
    }
}

/* On a phone each routing row is a card, and "Required" and "SMV" are two more lines per
 * step that almost nobody changes there — so they are left off. Hidden, not removed: the
 * inputs still post, so a saved row keeps its values and a new one takes the defaults.
 * Both are on the desktop table as before. */
@media (max-width: 1023.98px) {
    #routing-data td.field-is_required_for_completion,
    #routing-data td.field-smv {
        display: none;
    }
}

/* --- Status / priority chips in a changelist ----------------------------------------
 * The front site paints its status badges from the Tailwind build (`badge_class` →
 * `.badge-success` etc. in static/src/input.css). The admin never loads that stylesheet,
 * so the same markup rendered here came out as bare text — a "Status" column that reads
 * like an unstyled string next to Unfold's own chips. These are the admin's own copy of
 * that palette, deliberately named `erp-chip-*` so nothing is shared by accident: the two
 * stylesheets serve different shells and one changing must never silently restyle the
 * other.
 *
 * Tones are tinted rather than solid, matching the front site's reasoning — a saturated
 * fill with a derived near-black foreground is what made these unreadable in the first
 * place. Every tone carries its `.dark` rule in the same block, so a chip is never
 * defined for one theme only.
 */
.erp-chip {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    border-radius: 9999px;
    border-width: 1px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.25rem;
    font-weight: 500;
}

.erp-chip-neutral { background: rgb(241 245 249); border-color: rgb(226 232 240); color: rgb(51 65 85); }
.erp-chip-info    { background: rgb(224 242 254); border-color: rgb(186 230 253); color: rgb(7 89 133); }
.erp-chip-success { background: rgb(209 250 229); border-color: rgb(167 243 208); color: rgb(6 95 70); }
.erp-chip-warning { background: rgb(254 243 199); border-color: rgb(253 230 138); color: rgb(146 64 14); }
.erp-chip-error   { background: rgb(254 226 226); border-color: rgb(254 202 202); color: rgb(153 27 27); }
.erp-chip-accent  { background: rgb(237 233 254); border-color: rgb(221 214 254); color: rgb(91 33 182); }

.dark .erp-chip-neutral { background: rgb(51 65 85 / 0.6);  border-color: rgb(71 85 105);  color: rgb(203 213 225); }
.dark .erp-chip-info    { background: rgb(12 74 110 / 0.5); border-color: rgb(3 105 161);  color: rgb(186 230 253); }
.dark .erp-chip-success { background: rgb(6 78 59 / 0.5);   border-color: rgb(4 120 87);   color: rgb(167 243 208); }
.dark .erp-chip-warning { background: rgb(120 53 15 / 0.5); border-color: rgb(180 83 9);   color: rgb(253 230 138); }
.dark .erp-chip-error   { background: rgb(127 29 29 / 0.5); border-color: rgb(185 28 28);  color: rgb(254 202 202); }
.dark .erp-chip-accent  { background: rgb(76 29 149 / 0.5); border-color: rgb(109 40 217); color: rgb(221 214 254); }

/* An overdue date in a changelist. Same idea: `text-red-600` is a Tailwind class this
 * shell does not have. */
.erp-overdue { color: rgb(220 38 38); font-weight: 600; }
.dark .erp-overdue { color: rgb(248 113 113); }

/* --- Operation Task: the picker and the duplicate warning ---------------------------
 * Styling for static/js/operation_task_suggest.js, which turns the Operation Task box into
 * a searchable list of the tasks that already exist and warns while a near-duplicate is
 * being typed.
 *
 * Hand-written here for the same reason as the chips above: the admin shell is Unfold's
 * precompiled Tailwind, so a class the JS invents is a class that does not exist. Colours
 * come from Unfold's published variables where there is one, and from the same tinted
 * amber as `.erp-chip-warning` where there isn't — with the `.dark` rule in the same block,
 * so neither piece is ever defined for one theme only.
 */
.erp-task-field { position: relative; }

.erp-task-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 50;
    margin-top: 0.25rem;
    max-height: 16rem;
    overflow-y: auto;
    border-radius: var(--border-radius, 0.375rem);
    border: 1px solid var(--color-base-200);
    background: white;
    padding: 0.25rem 0;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.dark .erp-task-menu { border-color: var(--color-base-700); background: var(--color-base-800); }

.erp-task-option {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.erp-task-option:hover { background: var(--color-base-100); }
.dark .erp-task-option:hover { background: var(--color-base-700); }

.erp-task-option-name { font-weight: 500; }
.erp-task-option-meta { font-size: 0.75rem; color: var(--color-base-500); }

/* The near-duplicate warning under the box. Amber tinted rather than solid, matching
 * `.erp-chip-warning` — this has to be noticed without reading as a validation error,
 * because saving anyway is a legitimate choice. */
.erp-task-warning {
    margin-top: 0.5rem;
    border-radius: var(--border-radius, 0.375rem);
    border: 1px solid rgb(253 230 138);
    background: rgb(254 243 199);
    color: rgb(146 64 14);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.dark .erp-task-warning {
    border-color: rgb(180 83 9);
    background: rgb(120 53 15 / 0.5);
    color: rgb(253 230 138);
}

.erp-task-warning-lead { font-weight: 600; }
.erp-task-warning-list { margin: 0.25rem 0 0; padding-left: 1.1rem; list-style: disc; }
.erp-task-warning a { text-decoration: underline; text-underline-offset: 2px; color: inherit; }
.erp-task-warning-note { margin-top: 0.25rem; font-size: 0.75rem; opacity: 0.85; }
.erp-task-hidden { display: none !important; }

/* --- Attendance pages: Today, Month, Close period ------------------------------------
 * The attendance admin's own pages (attendance/templates/attendance/admin/). This shell has
 * only the Tailwind classes Unfold itself compiled, so layout lives here, on Unfold's colour
 * variables, with every rule's `.dark` twin beside it. Phone first: the tiles wrap, the
 * tables scroll inside their card, and the calendar keeps seven columns but drops the hours
 * below 480px.
 */
.att-page { display: flex; flex-direction: column; gap: 1.25rem; max-width: 72rem; }
.att-muted { color: var(--color-base-500); font-size: 0.875rem; }
.dark .att-muted { color: var(--color-base-400); }

.att-stats { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.att-tile {
    display: block; padding: 0.875rem 1rem; border: 1px solid var(--color-base-200);
    border-radius: var(--border-radius, 0.375rem); background: white; text-decoration: none;
}
.dark .att-tile { border-color: var(--color-base-700); background: var(--color-base-900); }
.att-tile-value { font-size: 1.75rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--color-base-900); }
.dark .att-tile-value { color: var(--color-base-100); }
.att-tile-label { font-size: 0.8125rem; color: var(--color-base-500); }
.dark .att-tile-label { color: var(--color-base-400); }
.att-tile-good  .att-tile-value { color: rgb(4 120 87); }
.att-tile-bad   .att-tile-value { color: rgb(185 28 28); }
.att-tile-warn  .att-tile-value { color: rgb(180 83 9); }
.dark .att-tile-good .att-tile-value { color: rgb(110 231 183); }
.dark .att-tile-bad  .att-tile-value { color: rgb(252 165 165); }
.dark .att-tile-warn .att-tile-value { color: rgb(252 211 77); }
/* A figure below what is owed (piece-work sheet: below the minimum for the hours worked). */
.att-short { color: rgb(180 83 9); font-weight: 600; }
.dark .att-short { color: rgb(252 211 77); }
a.att-tile:hover { border-color: var(--color-primary-400); }

.att-card {
    border: 1px solid var(--color-base-200); border-radius: var(--border-radius, 0.375rem);
    padding: 1rem; background: white; overflow-x: auto;
}
.dark .att-card { border-color: var(--color-base-700); background: var(--color-base-900); }
.att-card h2 { font-weight: 600; margin-bottom: 0.75rem; }

.att-table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
.att-table th { text-align: left; font-weight: 600; padding: 0.375rem 0.625rem 0.375rem 0; white-space: nowrap; }
.att-table td { padding: 0.375rem 0.625rem 0.375rem 0; border-top: 1px solid var(--color-base-100); vertical-align: top; }
.dark .att-table td { border-top-color: var(--color-base-800); }
.att-num, .att-table .att-num { text-align: right; font-variant-numeric: tabular-nums; }
.att-table a, .att-link { color: var(--color-primary-600); text-decoration: underline; }
.dark .att-table a, .dark .att-link { color: var(--color-primary-400); }

.att-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.att-toolbar select, .att-toolbar input[type=date], .att-toolbar input[type=month] {
    border: 1px solid var(--color-base-200); border-radius: var(--border-radius, 0.375rem);
    padding: 0.375rem 0.5rem; background: white; font-size: 0.875rem; max-width: 100%;
}
.dark .att-toolbar select, .dark .att-toolbar input[type=date], .dark .att-toolbar input[type=month] {
    border-color: var(--color-base-700); background: var(--color-base-900); color: var(--color-base-100);
}
.att-btn {
    display: inline-flex; align-items: center; padding: 0.4rem 0.9rem; border-radius: var(--border-radius, 0.375rem);
    background: var(--color-primary-600); color: white; font-size: 0.875rem; font-weight: 500; border: 0; cursor: pointer;
}
.att-btn:hover { background: var(--color-primary-700); }
/* A button inside a table is still a button, not one of the table's underlined links. */
.att-table a.att-btn, .dark .att-table a.att-btn { color: white; text-decoration: none; white-space: nowrap; }
.att-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.att-btn-ghost { background: transparent; color: var(--color-primary-600); border: 1px solid var(--color-base-200); }
.dark .att-btn-ghost { color: var(--color-primary-400); border-color: var(--color-base-700); }
.att-btn-ghost:hover { background: var(--color-base-100); }
.dark .att-btn-ghost:hover { background: var(--color-base-800); }

.att-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.25rem; }
.att-cal-head { font-size: 0.75rem; font-weight: 600; text-align: center; color: var(--color-base-500); }
.att-cal-day {
    min-height: 4.25rem; padding: 0.25rem 0.375rem; border: 1px solid var(--color-base-200);
    border-radius: var(--border-radius, 0.375rem); display: flex; flex-direction: column; gap: 0.2rem;
    text-decoration: none; background: white;
}
.dark .att-cal-day { border-color: var(--color-base-700); background: var(--color-base-900); }
.att-cal-out { opacity: 0.35; }
.att-cal-num { font-size: 0.75rem; color: var(--color-base-500); }
.att-cal-hours { font-size: 0.75rem; font-variant-numeric: tabular-nums; color: var(--color-base-600); }
.dark .att-cal-hours { color: var(--color-base-300); }
a.att-cal-day:hover { border-color: var(--color-primary-400); }
.att-cal-flag { width: 0.5rem; height: 0.5rem; border-radius: 9999px; background: rgb(217 119 6); display: inline-block; }
@media (max-width: 480px) {
    .att-cal-day { min-height: 3.25rem; padding: 0.2rem; }
    .att-cal-hours { display: none; }
    .att-cal-day .erp-chip { padding: 0 0.3rem; font-size: 0.6875rem; }
}

.att-check { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-top: 1px solid var(--color-base-100); }
.dark .att-check { border-top-color: var(--color-base-800); }
.att-check:first-child { border-top: 0; }

/* The muster roll is 31 day columns wide: let the page use the width it has, keep each
 * cell tight, and scroll inside the card on anything narrower. */
.att-page-wide { max-width: none; }
.att-muster th, .att-muster td { padding-right: 0.25rem; }
.att-muster .erp-chip { padding: 0 0.3rem; font-size: 0.6875rem; }

/* Pay book: quick picks that read as one control, labelled filters, the book's own heading. */
.att-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--color-base-200);
           border-radius: var(--border-radius, 0.375rem); overflow: hidden; }
.dark .att-seg { border-color: var(--color-base-700); }
.att-seg a { padding: 0.375rem 0.75rem; font-size: 0.875rem; color: var(--color-base-700);
             border-left: 1px solid var(--color-base-200); text-decoration: none; }
.dark .att-seg a { color: var(--color-base-300); border-left-color: var(--color-base-700); }
.att-seg a:first-child { border-left: 0; }
.att-seg a:hover { background: var(--color-base-100); }
.dark .att-seg a:hover { background: var(--color-base-800); }
.att-seg a.is-active, .dark .att-seg a.is-active { background: var(--color-primary-600); color: white; }
.att-stepper { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.att-span { font-variant-numeric: tabular-nums; }
.att-nowrap { white-space: nowrap; }
.att-filters { align-items: flex-end; }
.att-filter { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.75rem; color: var(--color-base-500); }
.dark .att-filter { color: var(--color-base-400); }
.att-filter[hidden] { display: none; }
.att-filter-check { flex-direction: row; align-items: center; gap: 0.4rem; font-size: 0.875rem; padding-bottom: 0.4rem; }
.att-filter .att-input { padding: 0.375rem 0.5rem; min-width: 10rem; }
.att-notes ul { list-style: disc; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.875rem; }
.att-notes { border-left: 3px solid rgb(217 119 6); }
/* Face enrolment: an employee marked for re-enrolment (EmployeeProfile.reenrol_reason). */
.att-reenrol-note { margin: 0.5rem 0; padding: 0.5rem 0.75rem; border-left: 3px solid rgb(217 119 6);
  border-radius: 0.375rem; background: rgb(254 243 199 / 0.6); color: rgb(120 53 15); font-size: 0.875rem; }
.att-reenrol-note .att-muted { color: inherit; opacity: 0.85; }
.dark .att-reenrol-note { background: rgb(120 53 15 / 0.35); border-left-color: rgb(245 158 11); color: rgb(253 230 138); }
.att-reenrol .att-input { flex: 1 1 14rem; min-width: 0; }
.att-book-head { text-align: center; margin-bottom: 0.75rem; }
.att-book-head h2 { margin-bottom: 0.125rem; text-transform: uppercase; letter-spacing: 0.02em; }
.att-book { font-size: 0.8125rem; }
.att-book th { white-space: normal; vertical-align: bottom; min-width: 3.5rem; }
.att-book th, .att-book td { padding-right: 0.5rem; }
.att-book td.att-book-name { white-space: nowrap; }
.att-book .att-book-net { font-weight: 600; }
.att-book tfoot td { border-top: 2px solid var(--color-base-300); }
.dark .att-book tfoot td { border-top-color: var(--color-base-600); }
@media (max-width: 640px) {
    .att-filters .att-filter { flex: 1 1 calc(50% - 0.5rem); }
    .att-filters .att-filter select, .att-filters .att-filter input[type=date], .att-filters .att-filter .att-input { width: 100%; min-width: 0; }
    .att-filters .att-filter-check { flex-basis: 100%; }
}

/* Inputs on the attendance pages' own forms (Mark attendance). */
.att-input {
    border: 1px solid var(--color-base-200); border-radius: var(--border-radius, 0.375rem);
    padding: 0.3rem 0.5rem; background: white; font-size: 0.875rem; max-width: 100%;
}
.dark .att-input { border-color: var(--color-base-700); background: var(--color-base-900); color: var(--color-base-100); }

/* A form table that becomes one card per row on a phone (Mark attendance): a supervisor in the
 * field marks from a phone, and a row scrolling sideways hides the note and the state. */
@media (max-width: 640px) {
    .att-stack thead { display: none; }
    .att-stack, .att-stack tbody, .att-stack tr, .att-stack td { display: block; width: 100%; }
    .att-stack tr { padding: 0.5rem 0; border-top: 1px solid var(--color-base-100); }
    .dark .att-stack tr { border-top-color: var(--color-base-800); }
    .att-stack td, .att-stack .att-num { border: 0; padding: 0.2rem 0; text-align: left; }
    .att-stack td[data-label]::before { content: attr(data-label); display: block; font-size: 0.75rem;
                                        color: var(--color-base-500); }
    .att-stack .att-input { width: 100%; }
    /* A read-mostly row (Today's attendance, a day's punches): three facts to a line instead
     * of one, so a phone shows a few people per screen, not one. ``att-span`` takes a line. */
    .att-stack-grid tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.15rem 0.75rem; }
    .att-stack-grid td.att-span { grid-column: 1 / -1; }
}

/* Fix a day (attendance/fixday.py): the day's flags, the punches with a fix each, the check. */
.att-fix .att-card { margin-top: 0.75rem; }
.att-fix-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; }
.att-fix-now { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.att-fix-flags { margin: 0.5rem 0 0; padding-left: 1.1rem; list-style: disc; color: rgb(180 83 9); font-size: 0.875rem; }
.dark .att-fix-flags { color: rgb(252 211 77); }
.att-fix-sub { font-weight: 600; margin: 1rem 0 0.5rem; }
.att-fix-new { display: flex; flex-direction: column; gap: 0.4rem; }
.att-fix-why { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 0.75rem; font-size: 0.875rem; }
.att-fix-why label { display: flex; flex-direction: column; gap: 0.2rem; flex: 1 1 14rem; }
.att-fix-result { margin-top: 0.75rem; padding: 0.6rem 0.8rem; border-radius: var(--border-radius, 0.375rem);
                  border: 1px solid var(--color-base-200); border-left: 3px solid var(--color-primary-600);
                  background: var(--color-base-50); font-size: 0.875rem; }
.dark .att-fix-result { border-color: var(--color-base-700); border-left-color: var(--color-primary-500);
                        background: var(--color-base-800); }
.att-fix-replaced td:first-child, .att-fix-replaced td[data-label="Way"] { text-decoration: line-through; opacity: 0.6; }
/* Today's attendance: a fix link that has to be noticed. */
.att-table a.att-fix-due { color: rgb(180 83 9); font-weight: 600; }
.dark .att-table a.att-fix-due { color: rgb(252 211 77); }

/* Face enrolment: the camera, the row of taken pictures. */
.att-enrol { display: flex; flex-direction: column; gap: 0.75rem; max-width: 32rem; }
.att-camera { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--border-radius, 0.375rem); overflow: hidden;
              background: var(--color-base-900); border: 1px solid var(--color-base-200); }
.dark .att-camera { border-color: var(--color-base-700); }
.att-camera video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.att-shots { display: flex; gap: 0.25rem; min-height: 1.25rem; }
/* "Not the same person" — offered after a face was refused as somebody already enrolled. */
.att-lookalike { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.75rem 0.9rem; font-size: 0.875rem;
                 border: 1px solid var(--color-base-200); border-left: 3px solid var(--color-primary-600);
                 border-radius: var(--border-radius, 0.375rem); background: var(--color-base-50); cursor: pointer; }
.dark .att-lookalike { border-color: var(--color-base-700); border-left-color: var(--color-primary-500);
                       background: var(--color-base-800); }
.att-lookalike input { margin-top: 0.2rem; flex: none; width: 1.1rem; height: 1.1rem; }
/* A plain admin form page (Company details): one field per row, label above. */
.att-form { display: flex; flex-direction: column; gap: 1rem; max-width: 40rem; }
.att-field { display: flex; flex-direction: column; gap: 0.35rem; }
.att-field label { font-weight: 600; font-size: 0.875rem; }
.att-field .att-input { width: 100%; }
.att-field .att-input.att-input-short { width: 8rem; }
/* A heading between groups of fields in one form (Automatic notices). */
.att-form .att-group { margin: 0.25rem 0 -0.25rem; padding-top: 1rem; border-top: 1px solid var(--color-base-200);
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-base-500); }
.att-form .att-group:first-of-type { padding-top: 0; border-top: 0; }
.dark .att-form .att-group { border-color: var(--color-base-700); color: var(--color-base-400); }
.att-error { color: var(--color-red-600, #dc2626); font-size: 0.875rem; }
.dark .att-error { color: #f87171; }

/* The enrolment station: panel, the one camera, the list. */
.att-station { display: flex; flex-direction: column; gap: 1rem; }
.att-station .att-camera { position: relative; max-width: 32rem; }
.att-camera-note { position: absolute; inset: auto 0 0 0; margin: 0; padding: 0.5rem; text-align: center;
                   color: #fff; background: rgb(0 0 0 / 0.5); font-size: 0.875rem; }
.att-camera-note[hidden], .att-station [hidden] { display: none; }
.att-station-message { border-radius: var(--border-radius, 0.375rem); padding: 0.6rem 0.9rem; font-size: 0.875rem;
                       border: 1px solid var(--color-base-200); }
.att-station-message.is-ok { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.att-station-message.is-bad { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.dark .att-station-message.is-ok { border-color: #065f46; background: rgb(6 78 59 / 0.4); color: #a7f3d0; }
.dark .att-station-message.is-bad { border-color: #991b1b; background: rgb(127 29 29 / 0.4); color: #fecaca; }

/* The consent the employee reads and agrees to before the camera opens (attendance.consent). */
.att-consent-panel { display: flex; flex-direction: column; gap: 0.75rem; max-width: 40rem; }
.att-consent-text { border: 1px solid var(--color-base-200); border-radius: var(--border-radius, 0.375rem);
                    padding: 1rem 1.25rem; background: var(--color-base-50); font-size: 1rem; line-height: 1.6; }
.dark .att-consent-text { border-color: var(--color-base-700); background: var(--color-base-800); }
.att-consent-text h3 { font-weight: 600; font-size: 1.125rem; margin-bottom: 0.5rem; }
.att-consent-text p + p { margin-top: 0.5rem; }

/* "Use my current location" under a Unit's or a Check-in place's latitude and longitude. */
.att-locate { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.75rem 0; }
.att-locate .att-btn[disabled] { opacity: 0.6; cursor: progress; }

/* --- Quick-add a dropdown value (static/js/spec_option_quick_add.js) -----------------
 * The "+" beside a spec dropdown opens a native <dialog>. Unfold has no modal of its own
 * that a plain script can open, so the panel is styled here from Unfold's variables.
 */
.spec-option-dialog {
    /* border-box: the padding sits inside the width, or a phone gets 2.5rem of overflow. */
    box-sizing: border-box;
    width: min(28rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    margin: auto;
    padding: 1.25rem;
    border: 1px solid var(--color-base-200);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--color-base-700);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.15), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.spec-option-dialog::backdrop {
    background: rgb(0 0 0 / 0.45);
}

.dark .spec-option-dialog {
    border-color: var(--color-base-700);
    background: var(--color-base-900);
    color: var(--color-base-200);
}

.spec-option-error {
    color: rgb(220 38 38);
}

.dark .spec-option-error {
    color: rgb(248 113 113);
}

.spec-option-note {
    color: var(--color-primary-700);
}

.dark .spec-option-note {
    color: var(--color-primary-300);
}

/* The Select2 box keeps its full width beside the button (it measures its own <select>). */
.spec-option-quick-add > .select2-container {
    flex: 1 1 auto;
    min-width: 0;
}

/* --- VasanERP credit (core.branding) ------------------------------------------------------
   One quiet line at the foot of the sidebar (templates/unfold/helpers/navigation.html) and a
   logo + link under the sign-in form (templates/admin/login.html). Both are absent on a
   white-label instance, so nothing here needs a switch of its own. */
.vasanerp-credit {
    margin-top: auto;
    padding: 0.75rem 1.5rem;
    font-size: 11px;
    line-height: 1.4;
    color: var(--color-base-500);
}

.vasanerp-credit a,
.vasanerp-login-credit a {
    color: inherit;
    text-decoration: none;
}

.vasanerp-credit a:hover {
    color: var(--color-primary-600);
}

.dark .vasanerp-credit {
    color: var(--color-base-400);
}

.dark .vasanerp-credit a:hover {
    color: var(--color-primary-400);
}

.vasanerp-login-credit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    margin-top: 2rem;
    font-size: 12px;
    text-align: center;
    color: var(--color-base-500);
}

.vasanerp-login-credit img {
    height: 1.75rem;
    width: auto;
}

.vasanerp-login-credit a {
    color: var(--color-primary-600);
    font-weight: 500;
}

.vasanerp-login-credit a:hover {
    text-decoration: underline;
}

.vasanerp-logo-dark {
    display: none;
}

.dark .vasanerp-login-credit {
    color: var(--color-base-400);
}

.dark .vasanerp-login-credit a {
    color: var(--color-primary-400);
}

.dark .vasanerp-logo-light {
    display: none;
}

.dark .vasanerp-logo-dark {
    display: block;
}

/* Phone alerts (attendance admin_views.phone_alerts): the QR an employee scans at HR's desk.
   The QR itself stays dark on white in either theme — what a phone camera reads best. */
.att-phone-qr-row { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; margin-bottom: 1rem; }
.att-phone-qr { flex: none; width: min(100%, 18rem); padding: 0.5rem; background: #fff; border-radius: 0.75rem;
                border: 1px solid var(--color-base-200); }
.dark .att-phone-qr { border-color: var(--color-base-700); }
.att-phone-qr svg { display: block; width: 100%; height: auto; }
.att-phone-qr-text { flex: 1 1 18rem; min-width: 0; font-size: 1rem; line-height: 1.6; }
.att-phone-qr-text p { margin: 0 0 0.6rem; }
/* HR's link QR: the time it has left, red in its last half-minute (link_phone.html). */
.att-link-clock { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--color-base-700); }
.dark .att-link-clock { color: var(--color-base-200); }
.att-link-clock.att-link-clock-low { color: var(--color-red-600, #dc2626); }
.dark .att-link-clock.att-link-clock-low { color: #f87171; }
/* The one-scan phone set-up on HR's QR card: what it sets up, then each step as it lands. */
.att-setup-steps { margin: 0 0 0.6rem; padding-left: 1.25rem; list-style: disc; }
#link-progress.att-setup-steps { list-style: none; padding-left: 0; }
.att-setup-steps li { margin: 0.15rem 0; }
.att-setup-mark { display: inline-block; width: 1.1rem; font-weight: 700; color: var(--color-base-400); }
.att-setup-done .att-setup-mark, .att-setup-done .att-setup-state { color: var(--color-green-700, #15803d); }
.dark .att-setup-done .att-setup-mark, .dark .att-setup-done .att-setup-state { color: #4ade80; }
.att-phone-scan { font-weight: 600; font-size: 1.1rem; }
.att-card .att-muted + .att-toolbar, .att-card .att-muted + form.att-toolbar { margin-top: 0.75rem; }
.att-tick { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }

/* Above a read-only trip (templates/admin/transport/trip_planner_link.html): the way back to
 * the Trips planner, where trips are changed. */
.erp-planner-link {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  margin-bottom: 1rem; padding: 0.75rem 1rem; border-radius: 0.5rem;
  border: 1px solid var(--color-primary-200);
  background: var(--color-primary-50);
  font-size: 0.875rem;
}
.erp-planner-link span { flex: 1 1 16rem; }
.erp-planner-link a {
  display: inline-flex; align-items: center; padding: 0.5rem 0.875rem; border-radius: 0.375rem;
  background: var(--color-primary-600); color: #fff; font-weight: 600; text-decoration: none;
}
.erp-planner-link a:hover { background: var(--color-primary-700); }
.dark .erp-planner-link { border-color: var(--color-primary-800); background: color-mix(in srgb, var(--color-primary-500) 10%, transparent); }

/* --- Searchable select (static/js/searchable_select.js) ----------------------------------
 * The operation pickers: the routing rows and the assignment form. The native select stays
 * in the form underneath the search box (it still posts and is still `required`), so it is
 * laid over the box, invisible and untouchable. The box takes the select's own Unfold
 * classes, so only the parts that are new need styling here.
 *
 * The panel is placed on <body> with `position: fixed` by the script — an inline table
 * scrolls sideways, and an absolutely-placed list inside it would be clipped.
 */
.picker {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
}

.picker-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.picker-input {
    cursor: text;
    user-select: text;
    -webkit-user-select: text;
}

.picker-invalid .picker-input {
    border-color: rgb(220 38 38);
}

.picker-panel {
    position: fixed;
    z-index: 1000;
    max-height: 16rem;
    overflow-y: auto;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    border: 1px solid var(--color-base-200);
    border-radius: var(--border-radius, 0.375rem);
    background: #fff;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    font-size: 0.875rem;
}

.picker-group {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-base-400);
}

.picker-option {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.5rem 0.75rem;
    line-height: 1.25;
    cursor: pointer;
    color: var(--color-base-700);
}

.picker-option.is-selected {
    font-weight: 600;
}

.picker-option.is-active {
    background: var(--color-primary-600);
    color: #fff;
}

.picker-option-blank .picker-text {
    color: var(--color-base-400);
}

.picker-hint {
    font-size: 0.75rem;
    color: var(--color-base-500);
}

.picker-option.is-active .picker-hint,
.picker-option.is-active.picker-option-blank .picker-text {
    color: rgb(255 255 255 / 0.8);
}

.picker-empty {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--color-base-500);
}

/* Scrolling the list never drags the page behind it. */
.picker-panel {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* A finger, not a mouse: rows a thumb can hit (44px), in phone-sized type. */
@media (pointer: coarse) {
    .picker-panel {
        font-size: 1rem;
    }
    .picker-option {
        min-height: 2.75rem;
        justify-content: center;
        padding-top: 0.625rem;
        padding-bottom: 0.625rem;
    }
    .picker-hint {
        font-size: 0.8125rem;
    }
}

.dark .picker-invalid .picker-input {
    border-color: rgb(248 113 113);
}

.dark .picker-panel {
    border-color: var(--color-base-700);
    background: var(--color-base-900);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

.dark .picker-group,
.dark .picker-option-blank .picker-text {
    color: var(--color-base-500);
}

.dark .picker-option {
    color: var(--color-base-200);
}

.dark .picker-option.is-active {
    background: var(--color-primary-600);
    color: #fff;
}

.dark .picker-hint,
.dark .picker-empty {
    color: var(--color-base-400);
}

/* --- Scheduled jobs (core/admin_scheduler.py) ---------------------------------------------
 * The "is the scheduler running?" banner above the list and the job page, a muted second
 * line under a job's name, the live schedule preview, and a run's output. Tones match the
 * erp-chip palette; each rule has its .dark twin in the same block.
 */
.erp-scheduler-state {
    display: flex; gap: 0.6rem; align-items: flex-start;
    border-width: 1px; border-radius: 0.5rem; padding: 0.6rem 0.9rem; margin-bottom: 1rem;
    font-size: 0.875rem; line-height: 1.35rem;
}
.erp-scheduler-dot { flex: none; width: 0.6rem; height: 0.6rem; border-radius: 9999px; margin-top: 0.4rem; }
.erp-scheduler-ok   { background: rgb(209 250 229 / 0.6); border-color: rgb(167 243 208); color: rgb(6 95 70); }
.erp-scheduler-ok .erp-scheduler-dot   { background: rgb(16 185 129); }
.erp-scheduler-down { background: rgb(254 226 226); border-color: rgb(254 202 202); color: rgb(153 27 27); }
.erp-scheduler-down .erp-scheduler-dot { background: rgb(220 38 38); }
.erp-scheduler-state code { font-size: 0.8rem; word-break: break-all; }
.dark .erp-scheduler-ok   { background: rgb(6 78 59 / 0.35); border-color: rgb(4 120 87); color: rgb(167 243 208); }
.dark .erp-scheduler-down { background: rgb(127 29 29 / 0.4); border-color: rgb(185 28 28); color: rgb(254 202 202); }

/* inline-block: a link's underline does not reach into it, so a job's name is the link and
 * its description under it reads as plain text. */
.erp-job-description { display: inline-block; width: 100%; font-size: 0.75rem; line-height: 1.1rem;
    color: rgb(100 116 139); white-space: normal; text-decoration: none; font-weight: 400; }
.dark .erp-job-description { color: rgb(148 163 184); }
.erp-job-intro { margin: 0 0 1rem; font-size: 0.875rem; color: rgb(71 85 105); }
.dark .erp-job-intro { color: rgb(203 213 225); }

.erp-schedule-preview {
    border-width: 1px; border-radius: 0.5rem; padding: 0.5rem 0.75rem; font-size: 0.875rem;
    background: rgb(238 242 255); border-color: rgb(199 210 254); color: rgb(55 48 163);
}
.dark .erp-schedule-preview { background: rgb(49 46 129 / 0.35); border-color: rgb(67 56 202); color: rgb(199 210 254); }

.erp-job-output {
    max-height: 18rem; overflow: auto; white-space: pre-wrap; word-break: break-word;
    margin-top: 0.4rem; padding: 0.5rem; border-radius: 0.375rem; font-size: 0.75rem;
    background: rgb(248 250 252); color: rgb(30 41 59);
}
.dark .erp-job-output { background: rgb(15 23 42); color: rgb(226 232 240); }
/* Below Unfold's lg breakpoint a changelist row becomes a card of 45px label/value lines, too
 * short for a name and its description: the name alone, on the right like every value. */
@media (max-width: 1023.98px) {
    th.field-job .erp-job-description,
    td.field-job .erp-job-description { display: none; }
    th.field-job > a, td.field-job > a {
        margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
}

/* --- Product → Operation flow (admin/catalog/product/operation_flow.html) -----------
 * One card per routing step; the earlier steps it may wait for are chips toggled by a
 * tap (a real checkbox inside each, visually hidden, so the form posts as ever and the
 * keyboard still works). The strip at the top is the flow redrawn as it is ticked
 * (static/js/operation_flow.js). Phone-first: cards stack, chips wrap, the Save button is
 * full width below `sm`. Every colour has its `.dark` rule beside it.
 */
.erp-flow-card,
.erp-flow-step {
    border: 1px solid var(--color-base-200);
    border-radius: 0.5rem;
    padding: 1rem;
    background: white;
}
.dark .erp-flow-card,
.dark .erp-flow-step { border-color: var(--color-base-700); background: var(--color-base-900); }

.erp-flow-help { margin-top: 0.75rem; font-size: 0.875rem; line-height: 1.375rem; color: var(--color-base-600); }
.dark .erp-flow-help { color: var(--color-base-300); }

.erp-flow-preview {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: var(--color-base-50);
    border: 1px dashed var(--color-base-200);
}
.dark .erp-flow-preview { background: var(--color-base-800); border-color: var(--color-base-700); }

.erp-flow-preview-empty { font-size: 0.875rem; color: var(--color-base-500); }

.erp-flow-stage {
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
    border-radius: 0.375rem;
    padding: 0.25rem;
    border: 1px solid var(--color-base-200);
    background: white;
}
.dark .erp-flow-stage { border-color: var(--color-base-600); background: var(--color-base-900); }

.erp-flow-stage-step {
    border-radius: 0.25rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    color: var(--color-primary-700);
    background: var(--color-primary-50);
}
.dark .erp-flow-stage-step { color: var(--color-primary-200); background: color-mix(in oklab, var(--color-primary-600) 25%, transparent); }

.erp-flow-arrow { font-size: 1.125rem; color: var(--color-base-400); }

.erp-flow-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.erp-flow-preset {
    border-radius: 9999px;
    border: 1px solid var(--color-base-300);
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-base-700);
    background: white;
}
.erp-flow-preset:hover { border-color: var(--color-primary-500); color: var(--color-primary-700); }
.dark .erp-flow-preset { border-color: var(--color-base-600); color: var(--color-base-200); background: var(--color-base-800); }
.dark .erp-flow-preset:hover { border-color: var(--color-primary-400); color: var(--color-primary-300); }

.erp-flow-steps { display: flex; flex-direction: column; gap: 0.5rem; list-style: none; padding: 0; margin: 0; }

.erp-flow-step.is-inherited { background: var(--color-base-50); }
.dark .erp-flow-step.is-inherited { background: var(--color-base-800); }

.erp-flow-step-head { display: flex; align-items: center; gap: 0.75rem; }

.erp-flow-seq {
    flex: none;
    min-width: 2.25rem;
    border-radius: 0.375rem;
    padding: 0.125rem 0.375rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-base-600);
    background: var(--color-base-100);
}
.dark .erp-flow-seq { color: var(--color-base-300); background: var(--color-base-700); }

.erp-flow-step-title { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.erp-flow-step-title strong { font-weight: 600; overflow-wrap: anywhere; }
.erp-flow-step-title span { font-size: 0.75rem; color: var(--color-base-500); }

.erp-flow-state {
    flex: none;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--color-base-500);
}
.erp-flow-state.is-waiting { color: var(--color-primary-700); font-weight: 500; }
.dark .erp-flow-state.is-waiting { color: var(--color-primary-300); }

.erp-flow-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
}

.erp-flow-chips-label { margin-right: 0.25rem; font-size: 0.75rem; font-weight: 500; color: var(--color-base-500); }

.erp-flow-chip { position: relative; display: inline-flex; cursor: pointer; }
.erp-flow-chip.is-fixed { cursor: default; }

/* The checkbox stays in the form and in the tab order; only the pill is seen. */
.erp-flow-chip input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: inherit;
}

.erp-flow-chip span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 9999px;
    border: 1px solid var(--color-base-300);
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.125rem;
    color: var(--color-base-600);
    background: white;
    user-select: none;
}
.erp-flow-chip span::before { content: "+"; font-weight: 600; color: var(--color-base-400); }
.erp-flow-chip:hover span { border-color: var(--color-primary-400); }
.erp-flow-chip input:focus-visible + span { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }

.erp-flow-chip input:checked + span {
    border-color: var(--color-primary-600);
    background: var(--color-primary-600);
    color: white;
    font-weight: 500;
}
/* \2713 is a check mark, escaped for the same charset reason as the changelist arrow. */
.erp-flow-chip input:checked + span::before { content: "\2713"; color: white; }

.dark .erp-flow-chip span { border-color: var(--color-base-600); color: var(--color-base-300); background: var(--color-base-800); }
.dark .erp-flow-chip span::before { color: var(--color-base-500); }
.dark .erp-flow-chip input:checked + span { border-color: var(--color-primary-500); background: var(--color-primary-600); color: white; }
.dark .erp-flow-chip input:checked + span::before { color: white; }

.erp-flow-chip.is-fixed input:checked + span { opacity: 0.75; }

.erp-flow-note { margin-top: 0.5rem; font-size: 0.75rem; color: var(--color-base-500); }

.erp-flow-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.erp-flow-save {
    width: 100%;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: white;
    background: var(--color-primary-600);
}
.erp-flow-save:hover { background: var(--color-primary-700); }
.dark .erp-flow-save { background: var(--color-primary-600); }
.dark .erp-flow-save:hover { background: var(--color-primary-500); }

.erp-flow-cancel { text-align: center; font-size: 0.875rem; color: var(--color-base-500); }
.erp-flow-cancel:hover { text-decoration: underline; }

@media (min-width: 640px) {
    .erp-flow-actions { flex-direction: row; align-items: center; }
    .erp-flow-save { width: auto; padding-left: 2rem; padding-right: 2rem; }
}

/* The one-off hint above the flow when steps still share a Seq.: amber, like
 * `.erp-chip-warning` — worth reading, not an error. */
.erp-flow-tip {
    margin-top: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid rgb(253 230 138);
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: rgb(146 64 14);
    background: rgb(254 243 199);
}
.dark .erp-flow-tip { border-color: rgb(180 83 9); color: rgb(253 230 138); background: rgb(120 53 15 / 0.5); }

/* Company details: how the workers' phone app shows on a home screen (attendance/admin/company.html). */
.att-app-preview { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; max-width: 32rem; }
.att-app-preview img { width: 3.5rem; height: 3.5rem; border-radius: 1rem; flex: none;
                       box-shadow: 0 1px 3px rgb(0 0 0 / .15); background: var(--color-base-100); }
.att-app-preview p { margin: .15rem 0 0; }
.dark .att-app-preview img { background: var(--color-base-800); box-shadow: 0 1px 3px rgb(0 0 0 / .5); }

/* HR letters form (attendance/admin/letters.html): radio choices as a row of chips. */
.att-field-label { font-weight: 600; font-size: 0.875rem; }
.att-choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.att-choice { position: relative; display: inline-flex; cursor: pointer; }
.att-choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.att-choice span {
    padding: 0.4rem 0.85rem; border: 1px solid var(--color-base-200); border-radius: var(--border-radius, 0.375rem);
    font-size: 0.875rem; color: var(--color-base-700); background: white;
}
.dark .att-choice span { border-color: var(--color-base-700); color: var(--color-base-300); background: var(--color-base-900); }
.att-choice input:checked + span, .dark .att-choice input:checked + span {
    background: var(--color-primary-600); border-color: var(--color-primary-600); color: white;
}
.att-choice input:focus-visible + span { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
