/* Flower Sales & Order Management Platform
 *
 * White theme. Surfaces, borders and text are neutral; pink is an accent kept
 * for buttons, focus, links and the few places that mark state - it never
 * tints a panel or a table. Data is always the highest-contrast thing on the
 * page.
 *
 * Everything is driven from the tokens below, so the accent can be retuned in
 * one place without touching a component.
 */

/* ---------------------------------------------------------------- tokens - */

:root {
    /* Accent. Used deliberately and sparingly - see the note above. */
    --pink-50:  #fdf7f9;
    --pink-100: #fbeef3;
    --pink-200: #f4dde5;
    --pink-300: #e9b9cb;
    --pink-400: #d98aa9;
    --pink-500: #c9628a;
    --pink-600: #b5476b;
    --pink-700: #8c3a56;

    /* Neutral text. Previously warm-tinted; now grey so white reads as white. */
    --ink:        #33343a;
    --ink-strong: #17181d;
    --ink-muted:  #6b6d76;
    --ink-faint:  #9a9ca4;

    /* Surfaces. The page itself is pure white; cards are separated by their
       border and shadow, and panels and table headers are a light neutral,
       never pink. */
    --surface:      #ffffff;
    --surface-sunk: #f6f7f8;
    --ground:       #ffffff;
    --border:       #e6e7ea;
    --border-strong:#d3d5da;

    /* A neutral row hover, so tables do not wash pink on every pass. */
    --hover:        #f4f5f7;

    /* Status colours, shared by the dashboard, calendar and order views:
       amber = pending, blue = processing, green = approved, soft red = cancelled. */
    --status-pending:    #b8791b;
    --status-pending-bg: #fdf3e3;
    --status-processing:    #2f6fae;
    --status-processing-bg: #ebf3fa;
    --status-approved:    #2f7d55;
    --status-approved-bg: #eaf5ee;
    --status-cancelled:    #a84b4b;
    --status-cancelled-bg: #f9eaea;

    --danger:    #b3392f;
    --danger-bg: #fdeeec;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;

    /* Neutral shadows - a warm-tinted shadow reads as pink against white. */
    --shadow-sm: 0 1px 2px rgba(20, 22, 28, .05);
    --shadow:    0 1px 3px rgba(20, 22, 28, .06), 0 6px 18px rgba(20, 22, 28, .05);
    --shadow-lg: 0 8px 28px rgba(20, 22, 28, .12);

    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;

    --sidebar-width: 232px;
}

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

body {
    margin: 0;
    font: 15px/1.6 var(--font);
    color: var(--ink);
    background: var(--ground);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--pink-600); text-underline-offset: 2px; }
a:hover { color: var(--pink-700); }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--surface);
    padding: 10px 16px;
    border-radius: 0 0 var(--radius) 0;
    z-index: 100;
}
.skip-link:focus { left: 0; }

/* Visible focus everywhere - this is a keyboard-heavy data entry tool. */
:focus-visible {
    outline: 2px solid var(--pink-500);
    outline-offset: 2px;
}

/* ------------------------------------------------------------ auth pages - */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    background: var(--ground);
}

.auth-shell { width: 100%; max-width: 400px; }

/* The Flower House logo, centred above the sign-in card. */
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    text-align: center;
}

.auth-brand__logo {
    display: block;
    width: 150px;
    height: auto;
}

.auth-brand p {
    margin: 0;
    font-size: 12.5px;
    color: var(--ink-muted);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px 30px 30px;
}

.auth-title {
    margin: 0 0 6px;
    font-size: 19px;
    color: var(--ink-strong);
}

.auth-lead {
    margin: 0 0 20px;
    font-size: 13.5px;
    color: var(--ink-muted);
}

.auth-title + form { margin-top: 20px; }

.auth-help {
    margin: 18px 0 0;
    font-size: 12.5px;
    color: var(--ink-muted);
    text-align: center;
}

.auth-foot {
    margin: 18px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--ink-faint);
}

/* ----------------------------------------------------------- app shell - */

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 0 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    /* The groups collapse so the navigation fits the viewport; on a very short
       window it still scrolls (wheel, keyboard), just without a second
       scrollbar beside the page's own. */
    overflow-y: auto;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar { display: none; }

.sidebar__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0 18px;
    text-align: center;
    text-decoration: none;
}

.sidebar__logo {
    display: block;
    width: 96px;
    height: auto;
}

.sidebar__brand span {
    font-size: 11.5px;
    color: var(--ink-muted);
}

.sidebar__nav ul {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
}

/* A group heading doubles as the toggle for its sub-list. */
.sidebar__group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    cursor: pointer;
    list-style: none;
    -webkit-user-select: none;
    user-select: none;
}

.sidebar__group::-webkit-details-marker { display: none; }

.sidebar__group:hover { color: var(--ink-strong); }

/* Chevron: points right when closed, down when open. */
.sidebar__group::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .15s;
}

.sidebar__section[open] > .sidebar__group { color: var(--ink-strong); }
.sidebar__section[open] > .sidebar__group::after { transform: rotate(45deg); }

.sidebar__nav a {
    display: block;
    padding: 7px 18px;
    font-size: 13.5px;
    color: var(--ink);
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar__nav a:hover {
    background: var(--hover);
    color: var(--pink-700);
}

.sidebar__nav a[aria-current="page"] {
    background: var(--surface-sunk);
    border-left-color: var(--pink-500);
    color: var(--pink-700);
    font-weight: 600;
}

.app__body { min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar__title {
    margin: 0;
    font-size: 18px;
    color: var(--ink-strong);
    letter-spacing: -.01em;
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar__identity {
    text-align: right;
    line-height: 1.25;
    margin-right: 4px;
}

.topbar__identity strong { display: block; font-size: 13px; }
.topbar__identity span { font-size: 11.5px; color: var(--ink-muted); }

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

.content {
    padding: 24px 28px 48px;
    max-width: 1400px;
}

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

.field { margin-bottom: 16px; }

.field label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-strong);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="date"],
.field input[type="time"],
.field select,
.field textarea {
    width: 100%;
    padding: 9px 11px;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color .12s, box-shadow .12s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--pink-500);
    box-shadow: 0 0 0 3px var(--pink-100);
}

.field--invalid input,
.field--invalid select,
.field--invalid textarea {
    border-color: var(--danger);
}

.field--invalid input:focus {
    box-shadow: 0 0 0 3px var(--danger-bg);
}

.field__error {
    margin: 5px 0 0;
    font-size: 12.5px;
    color: var(--danger);
}

.field__hint {
    margin: 5px 0 0;
    font-size: 12px;
    color: var(--ink-muted);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .12s, border-color .12s, color .12s;
}

.btn--primary {
    background: var(--pink-600);
    border-color: var(--pink-600);
    color: #fff;
}

.btn--primary:hover {
    background: var(--pink-700);
    border-color: var(--pink-700);
    color: #fff;
}

.btn--ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--ink);
}

.btn--ghost:hover {
    background: var(--hover);
    border-color: var(--border-strong);
    color: var(--pink-700);
}

.btn--block { width: 100%; }
.btn--sm { padding: 6px 11px; font-size: 12.5px; }

/* -------------------------------------------------------------- alerts - */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 16px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
}

.alert__icon {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.alert--success { background: var(--status-approved-bg); border-color: #cfe6d8; color: #205c3d; }
.alert--success .alert__icon { background: var(--status-approved); }

.alert--error { background: var(--danger-bg); border-color: #f3ccc7; color: #8f2c24; }
.alert--error .alert__icon { background: var(--danger); }

.alert--warning { background: var(--status-pending-bg); border-color: #f0dcbb; color: #8a5a12; }
.alert--warning .alert__icon { background: var(--status-pending); }

.alert--info { background: var(--status-processing-bg); border-color: #cfe0ef; color: #24557f; }
.alert--info .alert__icon { background: var(--status-processing); }

/* ---------------------------------------------------------------- misc - */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px 26px;
}

.lead { margin: 0 0 20px; color: var(--ink-muted); }

.kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 20px;
    margin: 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 14px;
}

.kv dt { color: var(--ink-muted); }
.kv dd { margin: 0; }

/* Tablet: the sidebar becomes a top strip. Office staff on desktop are the
   primary users, so this is a fallback rather than a mobile-first layout. */
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }

    .sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 20px;
        padding: 12px 18px;
    }

    .sidebar__brand { padding: 0; flex-direction: row; gap: 10px; }
    .sidebar__logo { width: 72px; }
    .sidebar__group { padding: 6px 4px; }
    .sidebar__nav { flex: 1 1 100%; }
    .sidebar__nav ul { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 0; }
    .sidebar__nav a { padding: 6px 10px; border-left: none; border-radius: var(--radius-sm); }
    .sidebar__nav a[aria-current="page"] { border-left: none; }

    .topbar { padding: 12px 18px; }
    .content { padding: 18px 18px 40px; }
}

/* ---------------------------------------------------------- utilities - */

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.muted { color: var(--ink-faint); }

/* -------------------------------------------------------------- toolbar - */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar__filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar__filters input[type="search"],
.toolbar__filters input[type="text"],
.toolbar__filters input[type="date"],
.toolbar__filters select {
    padding: 7px 10px;
    font: inherit;
    font-size: 13.5px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}

.toolbar__filters input[type="search"] { min-width: 240px; }

.toolbar__filters input:focus,
.toolbar__filters select:focus {
    outline: none;
    border-color: var(--pink-500);
    box-shadow: 0 0 0 3px var(--pink-100);
}

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

/* Wide tables scroll inside their own container so the page body never
   scrolls sideways. */
.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th,
.table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table thead th {
    background: var(--surface-sunk);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink-muted);
    white-space: nowrap;
    position: sticky;
    /* Tables are hosted by horizontal/contained scroll wrappers. Their sticky
       origin is the wrapper, not the browser viewport, so a topbar-sized
       offset displaces the header into the table body. */
    top: 0;
    z-index: 5;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--hover); }

.table__sort {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.table__sort:hover { color: var(--pink-600); }

.table__actions {
    white-space: nowrap;
    text-align: right;
}

.table__actions .btn { margin-left: 4px; }

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

.row--inactive td { opacity: .58; }

/* ---------------------------------------------------------------- pills - */

.pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.pill--ok      { background: var(--status-approved-bg);   color: var(--status-approved);   border-color: #cfe6d8; }
.pill--info    { background: var(--status-processing-bg); color: var(--status-processing); border-color: #cfe0ef; }
.pill--warn    { background: var(--status-pending-bg);    color: var(--status-pending);    border-color: #f0dcbb; }
.pill--danger  { background: var(--danger-bg);            color: var(--danger);            border-color: #f3ccc7; }
.pill--muted   { background: var(--surface-sunk);         color: var(--ink-muted);         border-color: var(--border); }
.pill--action {
    font-family: inherit;
    line-height: inherit;
    cursor: pointer;
}
.pill--action:hover { filter: brightness(.96); text-decoration: underline; }
.pill--action:focus-visible {
    outline: 2px solid var(--pink-500);
    outline-offset: 2px;
}

/* Order status, matching the calendar key: amber / blue / green. */
.status--PENDING    { background: var(--status-pending-bg);    color: var(--status-pending);    border-color: #f0dcbb; }
.status--PROCESSING { background: var(--status-processing-bg); color: var(--status-processing); border-color: #cfe0ef; }
.status--APPROVED   { background: var(--status-approved-bg);   color: var(--status-approved);   border-color: #cfe6d8; }
.status--CANCELLED  { background: var(--status-cancelled-bg);  color: var(--status-cancelled);  border-color: #edcaca; }

/* ---------------------------------------------------------- empty state - */

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 40px 28px;
    text-align: center;
    color: var(--ink-muted);
}

.empty-state p { margin: 0 0 6px; }
.empty-state p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------- pager - */

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 13px;
    color: var(--ink-muted);
}

.pager__summary { margin: 0; }

.pager__links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pager__links a,
.pager__current,
.pager__disabled,
.pager__gap {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
}

.pager__links a { color: var(--pink-600); border: 1px solid var(--border); background: var(--surface); }
.pager__links a:hover { background: var(--hover); border-color: var(--border-strong); }
.pager__current { background: var(--pink-600); color: #fff; font-weight: 600; }
.pager__disabled { color: var(--ink-faint); }
.pager__gap { padding-inline: 4px; }

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

.form-card { max-width: 900px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 22px;
}

.input-suffix {
    display: flex;
    align-items: stretch;
}

.input-suffix input { min-width: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-suffix span {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-left: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface-sunk);
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.shipping-fields {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-sunk);
}

.shipping-fields[hidden] { display: none; }
.shipping-fields__head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}
.shipping-fields__head h3 { margin: 0; font-size: 15px; }
.shipping-fields__head p { margin: 4px 0 0; color: var(--ink-muted); font-size: 12px; }

.field--full { grid-column: 1 / -1; }

.field__required { color: var(--pink-600); margin-left: 2px; }

.field__check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-top: 26px;
}

.field__check input { width: 16px; height: 16px; accent-color: var(--pink-600); }

.btn--xs { padding: 4px 9px; font-size: 12px; }

.btn--danger { color: var(--danger); border-color: #f0cdc8; }
.btn--danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

/* ------------------------------------------------------------ user pages - */

.credentials-card { max-width: 620px; }

.credentials {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 10px 22px;
    margin: 20px 0 22px;
    padding: 18px 20px;
    background: var(--surface-sunk);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

.credentials dt { color: var(--ink-muted); }
.credentials dd { margin: 0; }

.credentials__secret {
    font-family: var(--font-mono);
    font-size: 15px;
    letter-spacing: .04em;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    user-select: all;
}

/* --------------------------------------------------------- status pages - */

.status-page { max-width: 480px; text-align: center; margin: 40px auto; }

.status-page__code {
    margin: 0;
    font-size: 46px;
    font-weight: 700;
    line-height: 1;
    color: var(--border-strong);
}

@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
    .toolbar__filters input[type="search"] { min-width: 0; flex: 1 1 160px; }
}

/* ------------------------------------------------- history button + modal - */

/* A count on a button, e.g. History 40. */
.btn__count {
    display: inline-block;
    min-width: 16px;
    padding: 0 5px;
    margin-left: 2px;
    border-radius: 999px;
    background: var(--surface-sunk);
    border: 1px solid var(--border);
    color: var(--ink-muted);
    font-size: 10.5px;
    font-weight: 700;
    text-align: center;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; border-color: var(--border-strong); color: var(--ink); }

/* The history modal is a reading surface, so it is narrower than a form
   modal and its body carries the scroll. */
.modal--history { width: min(680px, calc(100vw - 32px)); }
.modal--history .modal__body { padding: 18px 22px; }
.modal--history .timeline { border-left-color: var(--border); }

/* A purchase order heading its sub POs, on the farm confirmations page. */
.table tr.table__group th {
    padding: 10px 14px;
    background: var(--surface-sunk);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.table tbody tr.table__group:hover { background: transparent; }

.group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 18px;
}

.group-head__main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.group-head__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12.5px;
    color: var(--ink-muted);
}

/* Sub POs indented under their order. */
.table--grouped tbody tr:not(.table__group) td:first-child { padding-left: 28px; }

/* One farm's sub PO, opened from its column header over the order grid. */
.modal--subpo { width: min(1400px, calc(100vw - 24px)); }
.modal--add-farm { width: min(1200px, calc(100vw - 32px)); }

.modal--subpo .modal__body {
    padding: 0;
    max-height: min(78vh, 780px);
    overflow-y: auto;
    background: var(--surface-sunk);
}

.modal--subpo .subpo-facts { margin: 0 0 14px; }
.modal--subpo .alert { margin-bottom: 14px; }

.modal--subpo .table th,
.modal--subpo .table td {
    padding-top: 7px;
    padding-bottom: 7px;
}

/* ------------------------------------------------- purchase order page - */

.section__empty { margin: 0; font-size: 13.5px; color: var(--ink-faint); }

/* Apply a charge: charge, quantity and button on one aligned row, with a
   single line of guidance beneath rather than a hint under each field (which
   is what used to push the labels out of line). */
.charge-form {
    display: grid;
    grid-template-columns: minmax(0, 360px) 120px auto;
    justify-content: start;
    align-items: start;
    gap: 6px 10px;
    margin-top: 14px;
}

.charge-form .field { margin: 0; }

.charge-form .field select,
.charge-form .field input {
    height: 38px;
    padding-top: 0;
    padding-bottom: 0;
}

/* Drops the button by one label's height so it sits level with the inputs. */
.charge-form > .btn {
    height: 38px;
    margin-top: calc(13px * 1.6 + 5px);
}

.charge-form__hint {
    grid-column: 1 / -1;
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--ink-muted);
}

@media (max-width: 720px) {
    .charge-form { grid-template-columns: 1fr; }
    .charge-form > .btn { margin-top: 0; justify-self: start; }
}

/* A short confirmation that asks for one thing, e.g. a cancel reason. */
.modal--confirm { width: min(480px, calc(100vw - 32px)); }
.modal--confirmation { width: min(760px, calc(100vw - 32px)); }
.modal--confirm .field { margin-bottom: 0; }
.modal--confirm .modal__foot { justify-content: flex-end; }

.btn--danger-solid {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn--danger-solid:hover {
    background: #962f26;
    border-color: #962f26;
    color: #fff;
}

/* Farms already assigned to an order, shown on Edit order so an unused farm
   can be removed. New farm assignment happens from the order grid. */
.farm-picker {
    min-width: 0;
    margin: 18px 0 0;
    padding: 0;
    border: 0;
}

.add-farm__choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 7px 12px;
    max-height: 150px;
    padding: 10px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-sunk);
}

.add-farm__choice-grid .check-row { margin: 0; }
.add-farm__table input[type="number"] { min-width: 90px; }

.farm-picker legend {
    padding: 0;
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-strong);
}

.farm-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.farm-picker.field--invalid .farm-picker__grid {
    padding: 6px;
    margin-left: -6px;
    margin-right: -6px;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
}

.farm-choice {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.farm-choice:hover { background: var(--hover); }

.farm-choice input {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--pink-600);
}

.farm-choice:has(input:checked) {
    background: var(--pink-50);
    border-color: var(--pink-500);
}

.farm-choice__text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.farm-choice__name { font-size: 13px; color: var(--ink); }
.farm-choice__meta { font-size: 11.5px; color: var(--ink-muted); }

/* On the order and not removable here - confirmed, approved or declined. */
.farm-choice--fixed { cursor: default; }
.farm-choice--fixed:hover { background: var(--surface); }
.farm-choice--fixed:has(input:checked):hover { background: var(--pink-50); }

.farm-choice--cancelled .farm-choice__name {
    color: var(--ink-muted);
    text-decoration: line-through;
}

/* Deviations a farm confirmed, listed under its sub PO on the farm
   confirmations page. A substitution waiting for the client is approved
   from here. */
.table tbody tr.row--has-deviations td { border-bottom: 0; }

.table tbody tr.deviation-row:hover { background: transparent; }

.table tbody tr.deviation-row td { padding: 0 14px 12px 28px; }

.deviation-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.deviation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    padding: 8px 12px;
    font-size: 12.5px;
    background: var(--surface-sunk);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.deviation--pending {
    background: #fffbeb;
    border-color: #fcd34d;
}

.deviation__line {
    min-width: 150px;
    font-weight: 600;
    color: var(--ink-strong);
}

.deviation__what { flex: 1 1 300px; color: var(--ink); }
.deviation__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.deviation__action { margin-left: auto; }
