/* =====================================================================
   Anth ERP — global component styles
   Single source of truth for buttons, cards, modals, forms.
   ===================================================================== */

/* =====================================================================
   ANTHE BRAND PALETTE — navy primary · orange accent · grey neutral.
   The Spruko template + theme-switcher set --primary to violet by default on
   :root; we re-point it to the brand navy with !important so it beats the
   switcher's inline (non-important) setProperty and re-themes every
   bg-primary / text-primary utility + component automatically. Semantic
   colours (success/danger/warning/info) are deliberately left untouched.
   Canonical palette source: anthe_flutter/lib/theme.dart (AppTheme).
   ===================================================================== */
:root {
    --primary: 19 32 60 !important;        /* #13203C deep navy */
    --primary-rgb: 19, 32, 60 !important;  /* comma form for rgba(var(--primary-rgb),…) */
    /* Collapse the semantic palette into the brand set. ONLY navy · grey ·
       orange · red(danger, unchanged) are allowed. This re-themes every
       bg-success / text-info / bg-warning / bg-secondary utility + badge +
       stock cell across the whole app in one shot. */
    --success: 19 32 60 !important;        /* green     → navy (positive/ok)  */
    --info: 19 32 60 !important;           /* cyan-blue → navy                */
    --secondary: 122 129 148 !important;   /* cyan      → grey  (#7A8194)     */
    --warning: 253 122 14 !important;      /* amber     → orange (#FD7A0E)    */
    --anth-navy: #13203C;
    --anth-orange: #FD7A0E;
    --anth-grey: #BEBCBF;
}

/* ---------- Buttons ---------- */
.anth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem .9rem;
    border-radius: .375rem;
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1.2;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: opacity .15s ease, box-shadow .15s ease;
}
.anth-btn i { font-size: 1rem; line-height: 1; }
.anth-btn:hover { opacity: .9; }
.anth-btn:disabled { opacity: .55; cursor: not-allowed; }

.anth-btn--sm  { padding: .35rem .6rem;  font-size: .75rem; }
.anth-btn--lg  { padding: .65rem 1.25rem; font-size: .9rem; }
.anth-btn--block { display: flex; width: 100%; }

.anth-btn--primary   { background: #13203C; color: #fff; }
.anth-btn--secondary { background: #7A8194; color: #fff; }
.anth-btn--success   { background: #13203C; color: #fff; }
.anth-btn--danger    { background: #ef4b4b; color: #fff; }
.anth-btn--warning   { background: #FD7A0E; color: #fff; }
.anth-btn--info      { background: #13203C; color: #fff; }
.anth-btn--light     { background: #f5f6f9; color: #536485; border-color: #e9ecef; }
.anth-btn--dark      { background: #1f2d3d; color: #fff; }

.anth-btn--outline-primary { background: #fff; color: #13203C; border-color: #13203C; }
.anth-btn--outline-danger  { background: #fff; color: #ef4b4b; border-color: #ef4b4b; }

.anth-btn-soft--primary { background: rgba(19,32,60,.12); color: #13203C; }
.anth-btn-soft--success { background: rgba(19,32,60,.10);    color: #13203C; }
.anth-btn-soft--danger  { background: rgba(239,75,75,.12);   color: #ef4b4b; }
.anth-btn-soft--info    { background: rgba(19,32,60,.10);    color: #13203C; }
.anth-btn-soft--warning { background: rgba(253,122,14,.14);  color: #d96a06; }

/* ---------- Brand orange accent (for highlight CTAs / selected states) ---------- */
.anth-btn--accent      { background: #FD7A0E; color: #fff; }
.anth-btn-soft--accent { background: rgba(253,122,14,.14); color: #d96a06; }
.anth-text-accent      { color: #FD7A0E; }

/* Solid brand-coloured badges → readable LIGHT text. After the palette
   collapse, bg-primary/info/success/secondary/dark are all dark (navy/grey),
   so any default-grey or dark badge text was invisible on them. Soft badges
   (.bg-*\/10) keep their pale bg + dark text and are NOT matched here. Orange
   (bg-warning) keeps its own dark text — more legible than white on orange. */
.badge.bg-primary, .badge.bg-secondary, .badge.bg-success,
.badge.bg-info, .badge.bg-danger, .badge.bg-dark { color: #fff !important; }

/* Branded focus ring — orange, mirrors the Flutter app's focused field. */
.form-control:focus, .form-select:focus, .ti-form-input:focus,
textarea.form-control:focus {
    border-color: #FD7A0E !important;
    box-shadow: 0 0 0 .18rem rgba(253,122,14,.20) !important;
}

/* Icon-only action button */
.anth-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.9rem; height: 1.9rem; border-radius: .35rem;
    border: 1px solid transparent; cursor: pointer; font-size: .9rem;
    padding: 0;
}

.anth-btn-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

/* Action-button cluster for listing rows. Keeps the per-row icon buttons
   (View / Edit / Delete …) on ONE tidy row instead of wrapping 2+1 when the
   Actions column is narrow — flex-wrap:nowrap is guaranteed by spec, and
   the fixed-size buttons are told not to shrink. */
.anth-actions { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: nowrap; }
.anth-actions > * { flex: 0 0 auto; }
/* Safety net for listings that still emit bare icon buttons (no .anth-actions
   wrapper yet): never let a cell line-break its action buttons. */
td:has(.anth-icon-btn) { white-space: nowrap; }

/* Filter-chip bar — e.g. the "Show: All / Individual / Kits" row on listings.
   Use these INSTEAD of .anth-tabs for inline chips: .anth-tabs is a tab strip
   and drags in a bottom border + 1.25rem margin that mis-centres the chips. */
.anth-filter-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.anth-chip-group { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* ---------- Card / box helpers ---------- */
.anth-section-title {
    font-size: 1rem; font-weight: 600; margin: 0;
    display: flex; align-items: center; gap: .5rem;
}

/* ---------- Modal ---------- */
.anth-modal-backdrop {
    position: fixed; inset: 0; background: rgba(15,23,42,.55);
    z-index: 1050; display: none; align-items: center; justify-content: center;
    padding: 1rem;
}
.anth-modal-backdrop.open { display: flex; }
.anth-modal-box {
    background: #fff; border-radius: 10px; width: 100%; max-width: 980px;
    max-height: 92vh; display: flex; flex-direction: column;
    box-shadow: 0 18px 45px rgba(0,0,0,.25); overflow: hidden;
}
.anth-modal-box--sm { max-width: 520px; }
.anth-modal-box--md { max-width: 680px; }
.anth-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid #eef0f3;
}
.anth-modal-header h5 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.anth-modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.anth-modal-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: .5rem;
    padding: 1rem 1.25rem; border-top: 1px solid #eef0f3;
}
.anth-modal-close {
    background: transparent; border: 0; cursor: pointer;
    font-size: 1.35rem; color: #6c757d; line-height: 1; padding: .15rem;
}

/* ---------- Toggle switch ---------- */
.anth-switch { position: relative; display: inline-block; width: 46px; height: 24px; }
.anth-switch input { opacity: 0; width: 0; height: 0; }
.anth-switch .slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #cfd4dc; border-radius: 24px; transition: .25s;
}
.anth-switch .slider:before {
    content: ""; position: absolute; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .25s;
}
.anth-switch input:checked + .slider { background: #13203C; }
.anth-switch input:checked + .slider:before { transform: translateX(22px); }

/* ---------- File / camera ---------- */
.anth-file-drop {
    border: 1.5px dashed #c9d0da; border-radius: 8px; padding: .85rem;
    text-align: center; background: #fafbfc; cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.anth-file-drop:hover { border-color: #13203C; background: #eff1f6; }

.anth-avatar-ring {
    width: 8rem; height: 8rem; border-radius: 50%; object-fit: cover;
    border: 4px solid #eef0f3;
}

/* ---------- Column-settings grid (datatable modal) ---------- */
.anth-cols-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
    gap: .75rem; list-style: none; padding: 0; margin: 0;
}
@media (max-width: 992px) { .anth-cols-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px) { .anth-cols-grid { grid-template-columns: 1fr; } }
.anth-col-card {
    display: flex; align-items: center; justify-content: space-between;
    padding: .8rem 1rem; border: 1px solid #e9ecef; border-radius: 7px; background: #fff;
}
.anth-col-card.hidden-col { background: #f6f7f9; opacity: .7; }
.anth-col-card label {
    font-size: .875rem; font-weight: 500; color: #1f2d3d; margin: 0;
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.anth-col-card .actions { display: flex; align-items: center; gap: .35rem; }
.anth-col-card .vis, .anth-col-card .grab {
    background: transparent; border: 0; padding: .25rem; cursor: pointer;
    font-size: 1.15rem; color: #6c757d;
}
.anth-col-card .grab { cursor: grab; }
.anth-col-card .grab:active { cursor: grabbing; }

/* ---------- DataTable toolbar ---------- */
.anth-dt-toolbar {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: .5rem; margin-bottom: 1rem;
}

/* ---------- DataTable bulk-delete bar & checkbox column ---------- */
.anth-bulk-bar {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: .75rem;
    padding: .55rem .85rem; margin-bottom: .85rem;
    background: #fdecec; border: 1px solid #f5c2c2; color: #8a1f1f;
    border-radius: .5rem; font-size: .8125rem;
}
.anth-bulk-bar[hidden] { display: none !important; }
.anth-bulk-bar__info { display: flex; align-items: center; gap: .5rem; }
.anth-bulk-bar__info i { font-size: 1.1rem; color: #c2392c; }
.anth-bulk-bar__info strong { color: #1f2d3d; font-weight: 600; }
.anth-bulk-bar__actions { display: flex; align-items: center; gap: .4rem; }

.anth-bulk-col {
    width: 38px; text-align: center; vertical-align: middle;
}
table th.anth-bulk-col, table td.anth-bulk-col { padding-left: .5rem; padding-right: .25rem; }
.anth-bulk-cb, .anth-bulk-cb-all {
    width: 16px; height: 16px; cursor: pointer; accent-color: #13203C;
    vertical-align: middle;
}
tr.anth-row-selected > td { background: #f5efff !important; }

/* ---------- Purchase Invoice — Charges & Totals box ---------- */
.anth-tot-box {
    background: #f8f7fd; border: 1px solid #e4dafa; border-radius: 8px;
    padding: .75rem 1rem; font-size: .8125rem;
}
.anth-tot-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: .25rem 0; color: #536485;
}
.anth-tot-row + .anth-tot-row { border-top: 1px dashed #e4dafa; }
.anth-tot-row strong { color: #1f2d3d; font-variant-numeric: tabular-nums; }
.anth-tot-row--big strong { font-size: 1.05rem; color: #13203C; }
.anth-tot-check { margin-top: .55rem; font-size: .8125rem; font-weight: 500; }
.anth-tot-box.anth-tot-ok   { border-color: #bbf7d0; background: #f0fdf4; }
.anth-tot-box.anth-tot-ok   .anth-tot-check { color: #16a34a; }
.anth-tot-box.anth-tot-warn { border-color: #fde68a; background: #fffbeb; }
.anth-tot-box.anth-tot-warn .anth-tot-check { color: #b45309; }

/* ---------- DataTable serial-number column ---------- */
.anth-sn-col {
    width: 52px;
    text-align: right;
    color: #8c9097;
    font-variant-numeric: tabular-nums;
    font-size: .78rem;
}
table th.anth-sn-col, table td.anth-sn-col {
    padding-left: .35rem; padding-right: .6rem;
}
table th.anth-sn-col { color: #536485; font-weight: 600; }

/* ---------- Product Pricing row (brand × supplier) ---------- */
.anth-pricing-row .anth-pp-derived {
    display: flex; flex-direction: column; justify-content: flex-end;
    background: #f8f7fd; border: 1px dashed #ccd2e0; border-radius: 6px;
    padding: .45rem .65rem; font-size: .78rem; color: #536485;
}
.anth-pp-derived__row {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .15rem 0;
}
.anth-pp-derived__row + .anth-pp-derived__row {
    border-top: 1px dashed #e4dafa;
}
.anth-pp-derived__row strong { font-weight: 600; color: #1f2d3d; }
.anth-pp-derived__row span:last-child {
    font-variant-numeric: tabular-nums; font-weight: 600; color: #13203C;
}
@media (max-width: 768px) {
    .anth-pricing-row .anth-pp-derived { margin-top: .35rem; }
}

/* ---------- AnthSearchSelect (Choices.js wrapper) ---------- */
/* Match Choices container to our form-control look */
.choices.anth-ss { margin-bottom: 0; }
.choices.anth-ss .choices__inner {
    background: #fff; border: 1px solid #e6e8ee; border-radius: .375rem;
    padding: .35rem .6rem; min-height: 2.25rem; font-size: .8125rem;
    color: #1f2d3d;
}
.choices.anth-ss.is-focused .choices__inner,
.choices.anth-ss.is-open .choices__inner {
    border-color: #13203C; box-shadow: 0 0 0 .12rem rgba(19,32,60,.12);
}

/*
 * Closed-state inner — works on EVERY Choices dropdown (not just .anth-ss).
 *
 * Default Choices CSS:
 *   .choices__inner { padding: 7.5px 7.5px 3.75px; min-height: 44px; }
 *   .choices__list--single { padding: 4px 16px 4px 4px; }
 *   .choices__list--single .choices__item { padding-bottom: 0; }
 * On a single-select that combination puts the selected text in the
 * bottom-left of a 44px-tall box, with ~10px of empty space above it.
 * Flex-center + tighter min-height fixes both: text sits vertically
 * centred, box is the same height as our other form-controls (~36px).
 */
.choices .choices__inner {
    display: flex !important;
    align-items: center !important;
    min-height: 2.25rem !important;   /* ~36px, matches .form-control */
    padding: .15rem .6rem !important;
    font-size: .8125rem;
}
.choices .choices__list--single {
    padding: 0 1.25rem 0 0 !important; /* leave room for the caret only */
    width: 100%;
    display: flex !important;
    align-items: center !important;
}
.choices .choices__list--single .choices__item {
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1.4;
}
/*
 * The cloned input inside .choices__inner is what Choices uses for
 * type-to-search. On a single-select it's invisible when a value is
 * shown but still takes vertical space (margin-bottom: 5px + padding)
 * which pushes the selected text to the bottom of the box. Hide it
 * completely on closed single-selects — the search box inside the
 * OPEN dropdown panel still works for finding items.
 */
.choices[data-type*="select-one"] .choices__inner .choices__input--cloned {
    display: none !important;
}

/*
 * Upstream sets margin-bottom: 3.75px on every .choices__item, which
 * stacks extra space between dropdown rows. Zero it out — our padding
 * controls vertical rhythm now.
 */
.choices .choices__list--dropdown .choices__item,
.choices .choices__list[aria-expanded] .choices__item {
    margin: 0 !important;
}
.choices.anth-ss .choices__list--dropdown {
    border: 1px solid #e6e8ee; border-radius: .375rem;
    box-shadow: 0 4px 14px rgba(15, 22, 36, .08);
}
.choices.anth-ss .choices__item--selectable.is-highlighted {
    background: #eaedf3; color: #1f2d3d;
}

/*
 * Choices.js dropdown ITEM density.
 *
 * Default Choices padding renders each option ~38px tall (.75rem top +
 * .75rem bottom) — fine for a chunky mobile UI, way too much in our
 * desktop forms where dropdowns can be 6-30 items long. Tighten across
 * the board so 4 brands don't take half the viewport.
 *
 * Targets every Choices dropdown (not just .anth-ss) so the override
 * applies whether the field was opted in per-select (data-anth-search)
 * or form-wide (data-anth-search-all). The search input inside the
 * dropdown gets the same compact treatment.
 */
.choices .choices__list--dropdown,
.choices .choices__list[aria-expanded] {
    font-size: .8125rem;
}
.choices .choices__list--dropdown .choices__list,
.choices .choices__list[aria-expanded] .choices__list {
    max-height: 280px;
}
/*
 * Two CSS sources fight us on Choices items:
 *   1. Upstream choices.min.css:
 *      .choices__item--selectable { text-align:right; padding-left:100px; padding-right:10px }
 *      .choices__item--selectable { padding-right:100px }     // hover hint space
 *      .choices__item            { padding:10px; font-size:14px }
 *   2. Spruko Ynex theme app-*.css (loaded BEFORE anth.css):
 *      .choices__item--selectable { padding: .75rem !important }
 *      .choices__item            { padding: .025rem .625rem !important;
 *                                  margin-bottom: .25rem !important;
 *                                  border-width: 1px !important }
 *      .choices__item--selectable { padding-left:.75rem !important;
 *                                  padding-right:.75rem !important }
 *      .choices__inner           { padding: .275rem !important }
 *
 * Spruko's selectors all sit at specificity (0,1,0). To outrank them
 * without polluting every selector with !important wars, prefix with
 * `html body` so our specificity becomes (0,3,2)+ — impossible to beat
 * by accident. Then explicitly !important every property that affects
 * height: padding (all 4 sides), margin, border, line-height, min-height.
 */
html body .choices .choices__list--dropdown .choices__item,
html body .choices .choices__list[aria-expanded] .choices__item,
html body .choices .choices__list--dropdown .choices__item--selectable,
html body .choices .choices__list[aria-expanded] .choices__item--selectable {
    padding-top: .3rem !important;
    padding-bottom: .3rem !important;
    padding-left: .65rem !important;
    padding-right: .65rem !important;
    margin: 0 !important;
    border: 0 !important;       /* Spruko sets 1px purple border on every item */
    border-radius: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    line-height: 1.35 !important;
    text-align: left !important;
    font-size: .8125rem !important;
    background-color: transparent;  /* let highlight bg show on .is-highlighted only */
}
/* Highlight only applies to the hovered/keyboard-focused item, and we
   restore its purple background here since we zeroed it above. */
html body .choices .choices__list--dropdown .choices__item--selectable.is-highlighted,
html body .choices .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background-color: #13203C !important;
    color: #fff !important;
}
/* Hide Choices' "Press to select" hint entirely. */
html body .choices .choices__item--selectable::after { display: none !important; }
/* Search input inside the dropdown — tighter to match. */
.choices .choices__input {
    padding: .35rem .6rem;
    font-size: .8125rem;
    margin-bottom: .25rem;
}
/* "No results" / placeholder rows in the dropdown — same compact rhythm. */
.choices .choices__list--dropdown .choices__item--disabled,
.choices .choices__list[aria-expanded] .choices__item--disabled {
    padding: .3rem .65rem;
    font-size: .75rem;
}

/* When ANY Choices dropdown is open, lift it above sticky form footers
   (.anth-form-actions uses z-index:5). Applies to both AnthSearchSelect
   and AnthLocation. The container becomes the stacking context, so the
   absolutely-positioned dropdown list inherits it correctly. */
.choices.is-open {
    z-index: 50;
    position: relative;
}
.choices .choices__list--dropdown,
.choices .choices__list[aria-expanded] {
    z-index: 51;
}

/* "+ Create new" footer button inside the dropdown */
.anth-ss-add-footer {
    border-top: 1px solid #eef0f3; padding: .25rem; background: #fafbfd;
    border-bottom-left-radius: .375rem; border-bottom-right-radius: .375rem;
    position: sticky; bottom: 0;
}
.anth-ss-add-btn {
    width: 100%; display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem .65rem; border: 0; background: transparent;
    color: #13203C; font-size: .8125rem; font-weight: 600; cursor: pointer;
    border-radius: .3rem; text-align: left;
}
.anth-ss-add-btn:hover { background: #eaedf3; }
.anth-ss-add-btn i { font-size: 1rem; }
.anth-ss-add-dynamic { display: none; }

/* Loading row inside the quick-add modal */
.anth-ss-loading {
    padding: 2rem 0; text-align: center; color: #8c9097; font-size: .8125rem;
}
.anth-ss-loading i { font-size: 1.4rem; display: inline-block; animation: anth-spin 1s linear infinite; vertical-align: -3px; margin-right: .4rem; }

/* Quick-add modal — responsive */
.anth-qadd-box {
    max-width: 640px;
}
body.anth-qadd-open { overflow: hidden; }
@media (max-width: 640px) {
    /* Full-screen on mobile */
    #anth-qadd-modal.anth-modal-backdrop { padding: 0; align-items: stretch; }
    #anth-qadd-modal .anth-qadd-box {
        max-width: 100%; width: 100%; height: 100dvh; border-radius: 0;
        display: flex; flex-direction: column;
    }
    #anth-qadd-modal .anth-modal-body { flex: 1 1 auto; overflow-y: auto; }
    #anth-qadd-modal .anth-modal-footer { position: sticky; bottom: 0; background: #fff; }
}

/* ---------- Misc ---------- */
.anth-hint { font-size: .72rem; color: #8c9097; margin-top: .25rem; }
.anth-required { color: #ef4b4b; }
.anth-divider { border: 0; border-top: 1px dashed #e3e6eb; margin: 1rem 0; }

/* ---------- Per-field validation ---------- */
.anth-field-error {
    color: #ef4b4b; font-size: .72rem; margin-top: .3rem; line-height: 1.35;
    display: block; min-height: .35rem;
}
.form-control.is-invalid,
select.form-control.is-invalid,
textarea.form-control.is-invalid {
    border-color: #ef4b4b !important;
    box-shadow: 0 0 0 .12rem rgba(239,75,75,.12) !important;
}
.form-control.is-valid {
    border-color: #26bf94 !important;
}
.anth-input-checking {
    background-image: none;
}
.anth-check-spin {
    display: inline-block; width: 12px; height: 12px; margin-left: .35rem;
    border: 2px solid #c9d0da; border-top-color: #13203C; border-radius: 50%;
    animation: anth-spin .6s linear infinite; vertical-align: middle;
}
@keyframes anth-spin { to { transform: rotate(360deg); } }

/* ---------- DataTables — professional pagination & controls ---------- */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
}
.dataTables_wrapper .dataTables_paginate .pagination {
    display: flex; flex-wrap: wrap; gap: .25rem; margin: 0; padding: 0; list-style: none;
    justify-content: flex-end;
}
.dataTables_wrapper .dataTables_paginate .page-item .page-link,
.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2rem; height: 2rem; padding: 0 .6rem;
    border: 1px solid #e6e8ee; border-radius: .375rem;
    background: #fff; color: #536485; font-size: .8125rem; font-weight: 500;
    cursor: pointer; text-decoration: none; transition: all .15s ease;
}
.dataTables_wrapper .dataTables_paginate .page-item .page-link:hover {
    background: #eaedf3; border-color: #ccd2e0; color: #13203C;
}
.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background: #13203C; border-color: #13203C; color: #fff;
    box-shadow: 0 2px 6px rgba(19,32,60,.35);
}
.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    background: #f7f8fa; color: #b4bcc8; cursor: not-allowed; border-color: #eef0f3;
}
.dataTables_wrapper .dataTables_info {
    font-size: .8125rem; color: #8c9097; padding-top: 1rem;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    font-size: .8125rem; color: #536485; margin-bottom: .25rem;
}
/*
 * The DataTables length-menu and search inputs come wrapped in a <label>.
 * Flex-align so the "Show / entries" text and the select/input share a
 * baseline regardless of select height.
 */
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    display: inline-flex; align-items: center; gap: .35rem; margin: 0;
    font-size: .8125rem; color: #536485;
}
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e6e8ee; border-radius: .375rem;
    font-size: .8125rem; outline: none;
    background: #fff; color: #1f2d3d;
    line-height: 1.2; vertical-align: middle;
}
/*
 * The Ynex/Tailwind base applies width:100% to <select> globally, which
 * blows the length-menu picker out to a ~120px-wide box just to hold "25".
 * Force a tight auto width + a compact padding so the box visually matches
 * the surrounding "Show / entries" text instead of looming over it.
 * !important because the global rule has equal specificity.
 */
.dataTables_wrapper .dataTables_length select {
    margin: 0;
    width: auto !important;
    min-width: 60px !important;
    max-width: 80px !important;
    display: inline-block !important;
    padding: .15rem 1.5rem .15rem .5rem; /* tight; right padding leaves room for caret */
    height: auto;
}
.dataTables_wrapper .dataTables_filter input {
    min-width: 200px;
    padding: .25rem .6rem;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: #13203C; box-shadow: 0 0 0 .12rem rgba(19,32,60,.12);
}
.dataTables_wrapper table.dataTable thead th {
    font-size: .75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .02em; color: #536485; background: #f8f9fc;
    border-bottom: 1px solid #e9ecef; padding: .7rem .75rem;
}
.dataTables_wrapper table.dataTable tbody td {
    font-size: .8125rem; padding: .7rem .75rem; vertical-align: middle;
    border-bottom: 1px solid #f1f2f5;
}
.dataTables_wrapper table.dataTable tbody tr:hover { background: #faf9fe; }
.dataTables_wrapper .dataTables_processing {
    background: #fff; border: 1px solid #e9ecef; border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,.08); color: #536485; font-size: .8125rem;
}

/* ---------- Tabs (full-page forms) ---------- */
.anth-tabs {
    display: flex; flex-wrap: wrap; gap: .15rem;
    border-bottom: 1px solid #e9ecef; margin-bottom: 1.25rem;
}
.anth-tab {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .65rem 1rem; font-size: .8125rem; font-weight: 500;
    color: #6c757d; cursor: pointer; background: none; border: 0;
    border-bottom: 2px solid transparent; white-space: nowrap;
    transition: color .15s ease, border-color .15s ease;
}
.anth-tab i { font-size: 1rem; }
.anth-tab:hover { color: #13203C; }
.anth-tab.active { color: #13203C; border-bottom-color: #13203C; }
.anth-tab.has-error { color: #ef4b4b; }
.anth-tab.has-error.active { border-bottom-color: #ef4b4b; }
.anth-tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem;
    font-size: .65rem; font-weight: 600; border-radius: 999px;
    background: rgba(19,32,60,.14); color: #13203C;
}
.anth-tab-pane { display: none; }
.anth-tab-pane.active { display: block; }

/* ---------- Repeatable rows (OEM / fitment / suppliers / BOM) ---------- */
.anth-repeat-row {
    position: relative; border: 1px solid #e9ecef; border-radius: 8px;
    padding: 1rem; margin-bottom: .75rem; background: #fcfcfd;
}
.anth-repeat-row .anth-row-remove {
    position: absolute; top: .5rem; right: .5rem;
}
.anth-repeat-empty {
    border: 1.5px dashed #d7dbe3; border-radius: 8px; padding: 1.25rem;
    text-align: center; color: #8c9097; font-size: .8125rem;
}

/* ---------- Sticky form action bar ---------- */
.anth-form-actions {
    position: sticky; bottom: 0; z-index: 5;
    display: flex; align-items: center; justify-content: flex-end; gap: .5rem;
    padding: .85rem 1rem; margin-top: 1.25rem;
    background: #fff; border-top: 1px solid #e9ecef;
    border-radius: 0 0 8px 8px; box-shadow: 0 -4px 14px rgba(0,0,0,.04);
}
.anth-form-actions .spacer { flex: 1; }

/* ---------- Image gallery thumbs ---------- */
.anth-thumb-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(96px,1fr));
    gap: .6rem;
}
.anth-thumb {
    position: relative; border: 1px solid #e9ecef; border-radius: 8px;
    overflow: hidden; aspect-ratio: 1; background: #f8f9fc;
}
.anth-thumb img { width: 100%; height: 100%; object-fit: cover; }
.anth-thumb .del {
    position: absolute; top: 3px; right: 3px;
    width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 0;
    background: rgba(239,75,75,.92); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: .85rem;
}

/* ---------- Per-row completeness progress (products listing) ----------
 * Hover popover styled as a white card — high contrast, clean
 * typography hierarchy, percentage colour-matched to the bar.
 * Avoids the native title-tooltip lag + styling and the clipped/
 * cramped feel of an overflow-clipped dark box.
 */
/* Stock on-hand quantity — rendered larger across all stock listings
 * (Stock Overview, Parts Master, Products, Orders ▸ View Stock) so the
 * number is easy to read at a glance. */
.anth-stock-qty { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
/* When the qty sits inside a coloured badge (products / kit listings), keep
 * the badge but enlarge its number. */
.badge.anth-stock-qty { font-size: 1rem; padding: .2rem .55rem; }

/* Attention highlight — draws the eye to easily-missed but important fields
 * (e.g. Sale Currency, VAT) so they aren't skipped during data entry. */
.anth-attn { background:#fff7ed !important; border:1.5px solid #f59e0b !important; }
.anth-attn:focus { outline:none !important; box-shadow:0 0 0 3px rgba(245,158,11,.25) !important; }
/* When .anth-attn is on a <select> that Choices.js has wrapped, the original
   select is hidden — paint the visible .choices__inner instead so the amber
   "you enter this" highlight still shows (order form Channel + Sale Currency). */
.choices:has(select.anth-attn) .choices__inner { background:#fff7ed !important; border:1.5px solid #f59e0b !important; }
.choices.is-focused:has(select.anth-attn) .choices__inner { box-shadow:0 0 0 3px rgba(245,158,11,.25) !important; }

.anth-prog-cell { position: relative; cursor: help; }
.anth-prog-tip {
    position: absolute;
    bottom: calc(100% + 10px); left: 50%;
    transform: translateX(-50%) translateY(2px);
    width: 220px;
    background: #fff;
    color: #1f2937;
    padding: .65rem .8rem .7rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: .8125rem; line-height: 1.45;
    text-align: left;
    opacity: 0; visibility: hidden;
    transition: opacity .12s ease, transform .12s ease;
    pointer-events: none;
    box-shadow: 0 10px 28px rgba(15,22,36,.14), 0 2px 6px rgba(15,22,36,.06);
    z-index: 200;
    white-space: normal;
}
/* Downward-pointing arrow — outer border + inner fill so it matches
 * the card's border. */
.anth-prog-tip::before,
.anth-prog-tip::after {
    content: "";
    position: absolute;
    left: 50%;
    border: 7px solid transparent;
    transform: translateX(-50%);
}
.anth-prog-tip::before { top: 100%; border-top-color: #e5e7eb; }
.anth-prog-tip::after  { top: calc(100% - 1px); border-top-color: #fff; }

/* Tooltips are rendered as a fixed-position PORTAL on <body> (see the
 * .anth-prog-cell handler in layouts/admin.php) so the DataTable's
 * overflow-x:auto scroll wrapper can't clip them (it coerces overflow-y to
 * auto, which clips the upward tooltip on the top rows). The in-cell
 * .anth-prog-tip stays hidden and serves only as the content source the
 * portal clones — hence no :hover reveal here anymore. */
.anth-prog-tip--float {
    position: fixed;
    bottom: auto; left: 0;
    transform: none;
    opacity: 1; visibility: visible;
    z-index: 9999;
    display: none;
}
/* Arrow points down by default (portal sits above the cell); flips to point
 * up when there isn't room above and the portal is placed below the cell. */
.anth-prog-tip--float.is-below::before { top: auto; bottom: 100%;            border-top-color: transparent; border-bottom-color: #e5e7eb; }
.anth-prog-tip--float.is-below::after  { top: auto; bottom: calc(100% - 1px); border-top-color: transparent; border-bottom-color: #fff; }

/* Typography inside the tooltip */
.anth-prog-tip .tip-title {
    font-size: .7rem; font-weight: 600;
    color: #6b7280; text-transform: uppercase; letter-spacing: .05em;
    margin-bottom: .15rem;
}
.anth-prog-tip .tip-pct {
    font-size: 1.5rem; font-weight: 700;
    line-height: 1.1;
    /* colour set inline to match the bar */
}
.anth-prog-tip .tip-frac {
    font-size: .75rem; font-weight: 500; color: #9ca3af;
    margin-left: .35rem;
}
.anth-prog-tip .tip-section {
    margin-top: .55rem;
    padding-top: .45rem;
    border-top: 1px solid #f1f5f9;
    color: #6b7280; font-size: .65rem;
    text-transform: uppercase; font-weight: 600;
    letter-spacing: .06em;
}
.anth-prog-tip ul {
    list-style: none; margin: .3rem 0 0; padding: 0;
}
.anth-prog-tip ul li {
    padding: .15rem 0;
    color: #374151; font-size: .8125rem;
    display: flex; align-items: flex-start; gap: .45rem;
}
.anth-prog-tip ul li::before {
    content: ""; flex: 0 0 5px; width: 5px; height: 5px;
    border-radius: 50%; background: #d97706;
    margin-top: .55rem;
}
.anth-prog-tip .tip-ok {
    color: #16a34a; font-weight: 600; font-size: .8125rem;
    margin-top: .35rem; display: flex; align-items: center; gap: .35rem;
}

/* ===== ANTHE brand logo fit =====
   The supplied ANTHE logo is a WIDE wordmark; the Spruko logo slots were sized
   for a near-square mark. Constrain height + let width scale so it sits neatly
   in the header, sidebar (expanded + collapsed) and the login card, without
   blowing out the bar. Adjust the max-heights if you want it bigger/smaller. */
.app-header .header-logo img,
.app-sidebar .header-logo img {
    max-height: 34px; width: auto; max-width: 100%; object-fit: contain;
}
/* Collapsed sidebar: the wordmark shrinks to fit the narrow rail. */
.app-sidebar.sidemenu-toggled .header-logo img,
[data-toggled] .app-sidebar .header-logo img {
    max-height: 26px;
}
/* Login / auth card logo can be a touch larger. */
.authentication-brand {
    max-height: 52px; width: auto; max-width: 240px; object-fit: contain;
}
