/* ==========================================================================
   HELMECH — application theme
   --------------------------------------------------------------------------
   A replacement skin for the Rubick admin template. Loaded after
   dist/css/app.css and before @stack('styles').

   Design: slate + indigo, light shell, compact density.
     canvas  #ffffff      sidebar #f8fafc      card #ffffff / 1px #e2e8f0
     accent  #4f46e5      ink #0f172a          muted #64748b

   Rubick's signature devices are deliberately switched off rather than
   layered over — the curved sidebar notches (SVG background-images on
   :before/:after), the floating rounded content panel, and the royal-blue
   html background. Overriding those only partially is what produces stray
   white blocks, so each is neutralised explicitly and commented.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Surfaces */
    --h-canvas: #ffffff;
    --h-canvas-sunken: #f8fafc;
    --h-card: #ffffff;

    /* Dark rail. Text tokens are chosen to clear 4.5:1 on --h-sidebar:
       #94a3b8 → 5.2:1, #e2e8f0 → 12.6:1. */
    --h-sidebar: #0f172a;
    --h-sidebar-line: #1e293b;
    --h-sidebar-ink: #cbd5e1;
    --h-sidebar-muted: #94a3b8;
    --h-sidebar-hover: #1e293b;
    --h-sidebar-active-bg: rgba(99, 102, 241, 0.18);
    --h-sidebar-active-ink: #c7d2fe;

    /* Lines */
    --h-line: #e2e8f0;
    --h-line-soft: #eef2f6;
    --h-line-strong: #cbd5e1;

    /* Ink */
    --h-ink: #0f172a;
    --h-ink-2: #334155;
    --h-muted: #64748b;
    --h-faint: #94a3b8;

    /* Accent */
    --h-accent: #4f46e5;
    --h-accent-hover: #4338ca;
    --h-accent-soft: #eef2ff;
    --h-accent-line: #c7d2fe;

    /* Status */
    /* #059669 is only 3.8:1 on white — short of 4.5 for the status labels and
       for white text on the filled success button. #047857 clears it at 5.5. */
    --h-success: #047857;
    --h-success-soft: #ecfdf5;
    --h-warning: #d97706;
    --h-warning-soft: #fffbeb;
    --h-danger: #dc2626;
    --h-danger-soft: #fef2f2;
    --h-info: #0284c7;
    --h-info-soft: #f0f9ff;

    /* Shape */
    --h-r-sm: 4px;
    --h-r: 6px;
    --h-r-lg: 8px;

    --h-ring: 0 0 0 3px rgba(79, 70, 229, 0.18);
    --h-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --h-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
    --h-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

    /* Density — compact */
    --h-row-h: 38px;
    --h-cell-y: 6px;
    --h-cell-x: 10px;
    --h-control-h: 32px;
    --h-text: 13px;

    --h-topbar-h: 56px;
    --h-sidebar-w: 232px;
    --h-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   2. Shell
   Rubick paints the page blue on <html> and floats .content as a rounded
   panel on top. The new theme is a flat two-column shell instead.
   -------------------------------------------------------------------------- */
html {
    background-color: var(--h-canvas) !important;
}

body.main {
    background: var(--h-canvas);
    /* The theme insets the whole app by 1.25rem top/bottom and 12px on the
       sides, which leaves a stray white gutter to the left of the sidebar.
       The shell should meet the window edge. */
    padding: 0 !important;
    color: var(--h-ink);
    font-size: var(--h-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.content {
    background-color: var(--h-canvas) !important;
    border-radius: 0;
    min-height: 100vh;
    padding: 0 28px 56px;
    /* The theme's intro animation starts elements at translateX(50px), which
       flashes a horizontal scrollbar on load. `clip` suppresses it without
       creating a scroll container, so the sticky top bar still works. */
    overflow-x: clip;
}

@media (max-width: 767.98px) {
    .content {
        padding: 0 16px 40px;
    }
}

/* Figures line up down the column. */
.table,
.table td,
.table th,
input.form-control,
.badge,
.pagination {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--h-ink);
    letter-spacing: -0.014em;
    font-weight: 600;
}

h2.intro-y.fs-lg,
h2.fs-lg {
    font-size: 18px;
    font-weight: 600;
}

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

a:hover {
    color: var(--h-accent-hover);
}

hr {
    border-color: var(--h-line);
    opacity: 1;
}

/* --------------------------------------------------------------------------
   3. Sidebar
   -------------------------------------------------------------------------- */
.side-nav {
    position: sticky;
    top: 0;
    align-self: stretch;
    width: var(--h-sidebar-w);
    /* Fill the window even when the menu is shorter than the viewport, so the
       rail does not stop mid-page and expose white beneath it. */
    min-height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 12px 32px;
    background-color: var(--h-sidebar);
    border-right: 1px solid var(--h-sidebar-line);
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.side-nav::-webkit-scrollbar {
    width: 8px;
}

.side-nav::-webkit-scrollbar-thumb {
    background-color: #334155;
    border-radius: 999px;
}

/* Logo block. The wordmark is dark artwork, so it sits on a white plate
   rather than being filtered — that keeps the brand colours intact. */
.side-nav > a:first-child {
    display: block !important;
    padding: 14px 4px 10px !important;
    margin: 0;
}

.side-nav > a:first-child img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    padding: 10px 12px;
    background: #ffffff;
    border-radius: var(--h-r-lg);
}

.side-nav .side-nav__devider {
    background-color: var(--h-sidebar-line) !important;
    margin: 2px 0 10px !important;
    opacity: 1;
}

/* Menu filter */
.side-nav > .pb-3 {
    position: sticky;
    top: 0;
    z-index: 6;
    padding: 6px 0 10px;
    background-color: var(--h-sidebar);
}

.side-nav #menuSearch {
    height: 34px;
    padding: 0 10px;
    font-size: 12.5px;
    color: var(--h-sidebar-ink);
    background-color: #1e293b !important;
    border: 1px solid #334155;
    border-radius: var(--h-r);
    box-shadow: none;
}

.side-nav #menuSearch::placeholder {
    color: #64748b;
}

.side-nav #menuSearch:focus {
    border-color: var(--h-accent);
    background-color: #1e293b !important;
    box-shadow: var(--h-ring);
}

/* Nav items */
.side-nav .side-menu {
    height: 34px;
    margin-bottom: 1px;
    padding: 0 10px;
    border-radius: var(--h-r);
    font-size: 13px;
    font-weight: 500;
    color: var(--h-sidebar-ink);
    transition: background-color 0.12s var(--h-ease), color 0.12s var(--h-ease);
}

.side-nav .side-menu:hover {
    background-color: var(--h-sidebar-hover);
    color: #ffffff;
}

.side-nav .side-menu .side-menu__title {
    margin-left: 10px;
    font-size: 13px;
}

.side-nav .side-menu .side-menu__icon {
    color: var(--h-sidebar-muted);
}

.side-nav .side-menu .side-menu__icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.9;
}

.side-nav .side-menu .side-menu__sub-icon {
    margin-right: 0;
}

.side-nav .side-menu .side-menu__sub-icon svg {
    width: 14px;
    height: 14px;
    color: var(--h-faint);
}

/* Active state.
   Rubick draws the active item as a light pill plus two 30x30 curved corner
   notches rendered as SVG background-images on :before/:after. Those only
   make sense against the blue rail, so both pseudo-elements are removed
   outright — never merely recoloured. */
.side-nav > ul > li > .side-menu.side-menu--active:before,
.side-nav > ul > li > .side-menu.side-menu--active:after,
.side-nav .side-menu.side-menu--active:before,
.side-nav .side-menu.side-menu--active:after {
    content: none !important;
    display: none !important;
    background-image: none !important;
}

.side-nav .side-menu.side-menu--active,
.side-nav > ul > li > .side-menu.side-menu--active {
    background-color: var(--h-sidebar-active-bg) !important;
    color: var(--h-sidebar-active-ink) !important;
    font-weight: 600;
}

.side-nav .side-menu.side-menu--active .side-menu__title,
.side-nav > ul > li > .side-menu.side-menu--active .side-menu__title {
    color: var(--h-sidebar-active-ink) !important;
}

.side-nav .side-menu.side-menu--active .side-menu__icon,
.side-nav > ul > li > .side-menu.side-menu--active .side-menu__icon {
    color: var(--h-sidebar-active-ink) !important;
}

/* The theme also masks the pill with a pseudo-element on the icon. */
.side-nav > ul > li > .side-menu.side-menu--active .side-menu__icon:before {
    content: none !important;
    display: none !important;
}

/* Sub-menus: hairline guide, quieter type. */
.side-nav ul ul {
    margin: 2px 0 4px 18px;
    padding-left: 10px;
    border-left: 1px solid var(--h-sidebar-line);
}

/* The theme colours sub-items with `.side-nav>ul ul li a:not(.side-menu--active)`
   — specificity (0,2,4), and a pale lavender meant to sit on the blue rail.
   Match that weight or the text stays near-invisible on the light sidebar. */
.side-nav > ul ul li a.side-menu:not(.side-menu--active),
.side-nav ul ul .side-menu {
    height: 31px;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--h-sidebar-muted);
}

.side-nav > ul ul li a.side-menu:not(.side-menu--active):hover {
    background-color: var(--h-sidebar-hover);
    color: #ffffff;
}

/* The theme fills open sub-menu panels with deep blue (rgb(26,56,159)) to sit
   on the old rail. Every nesting level has to be cleared, or sub-item text
   sits on a blue block inside the light sidebar. */
.side-nav ul ul,
.side-nav ul ul ul,
.side-nav .side-menu__sub-open {
    background-color: transparent !important;
}

.side-nav ul ul .side-menu .side-menu__title {
    font-size: 12.5px;
}

.side-nav ul ul .side-menu .side-menu__icon svg {
    width: 14px;
    height: 14px;
}

/* --------------------------------------------------------------------------
   4. Top bar
   -------------------------------------------------------------------------- */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 51;
    height: var(--h-topbar-h);
    margin-inline: -28px;
    padding-inline: 28px;
    background-color: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--h-line);
}

@media (max-width: 767.98px) {
    .top-bar {
        margin-inline: -16px;
        padding-inline: 16px;
    }
}

/* Breadcrumb was white-on-blue; it is now dark-on-white. */
.top-bar .breadcrumb a {
    color: var(--h-muted);
    font-size: 13px;
    font-weight: 500;
}

.top-bar .breadcrumb a:hover {
    color: var(--h-ink);
}

.top-bar .breadcrumb .breadcrumb--active {
    color: var(--h-ink);
    font-weight: 600;
}

.top-bar .breadcrumb .breadcrumb__icon {
    width: 14px;
    height: 14px;
    color: var(--h-faint);
    margin: 0 6px;
}

/* Fiscal-year pill: the view sets colours inline, so they are forced here. */
.top-bar .rounded-pill[data-bs-toggle="dropdown"] {
    height: 30px;
    background-color: var(--h-canvas) !important;
    color: var(--h-ink) !important;
    border: 1px solid var(--h-line) !important;
    border-radius: var(--h-r) !important;
    box-shadow: none !important;
    font-size: 12.5px !important;
    font-weight: 600;
}

.top-bar .rounded-pill[data-bs-toggle="dropdown"]:hover {
    background-color: var(--h-canvas-sunken) !important;
    border-color: var(--h-line-strong) !important;
}

.top-bar .rounded-pill[data-bs-toggle="dropdown"] svg {
    color: var(--h-muted);
}

.top-bar .dropdown-toggle.rounded-pill.image-fit {
    border: 1px solid var(--h-line);
    box-shadow: none !important;
    background-color: var(--h-canvas);
}

/* Uploaded avatars are usually wide company wordmarks (388x180 here). The
   theme's `object-fit: cover` crops that to an unreadable centre slice, so
   fit the whole image inside the circle instead. */
.top-bar .image-fit > img {
    object-fit: contain;
    padding: 3px;
    background-color: var(--h-canvas);
}

/* Account dropdown was a dark panel; align it with the rest. */
.top-bar .dropdown-content.bg-theme-26 {
    background-color: var(--h-card) !important;
    color: var(--h-ink) !important;
}

.top-bar .dropdown-content.bg-theme-26 .text-white,
.top-bar .dropdown-content.bg-theme-26 .dropdown-item {
    color: var(--h-ink) !important;
}

.top-bar .dropdown-content.bg-theme-26 .dropdown-item:hover {
    background-color: var(--h-canvas-sunken) !important;
    color: var(--h-accent) !important;
}

/* --------------------------------------------------------------------------
   5. Cards / panels
   Flat, bordered, no drop shadow.
   -------------------------------------------------------------------------- */
.box {
    background-color: var(--h-card) !important;
    border: 1px solid var(--h-line);
    border-radius: var(--h-r-lg);
    box-shadow: none;
}

/* Panel header strip on add/edit forms. */
.box > .d-flex.border-bottom:first-child {
    gap: 8px;
    padding: 12px 16px !important;
    background-color: var(--h-canvas-sunken);
    border-color: var(--h-line) !important;
    border-radius: var(--h-r-lg) var(--h-r-lg) 0 0;
}

.box > .d-flex.border-bottom:first-child h2 {
    font-size: 14px;
    font-weight: 600;
}

/* --- Dashboard stat tiles -------------------------------------------
   The view assigns each icon a different theme utility (text-theme-10/11/12,
   theme-9, theme-6), so the tiles read as eight unrelated colours. One
   treatment for all of them: a soft accent chip, with the figure carrying
   the emphasis. */
.report-box .box {
    padding: 16px !important;
}

/* Two classes deep so this beats the .text-theme-* status overrides defined
   further down this file — those also use !important and would otherwise win
   on source order. */
.report-box .report-box__icon,
.report-box svg.report-box__icon {
    width: 34px !important;
    height: 34px !important;
    padding: 7px;
    border-radius: var(--h-r);
    background-color: var(--h-accent-soft);
    color: var(--h-accent) !important;
    stroke-width: 2;
}

.report-box__total {
    margin-top: 14px !important;
    font-size: 26px !important;
    font-weight: 650;
    line-height: 1.1;
    color: var(--h-ink);
    letter-spacing: -0.025em;
}

.report-box .fs-base {
    font-size: 12.5px !important;
    color: var(--h-muted) !important;
}

.report-box.zoom-in:hover {
    transform: none;
}

.report-box .box:hover {
    border-color: var(--h-accent-line);
}

.box .fs-3xl,
.box .fs-2xl {
    color: var(--h-ink);
    font-weight: 650;
    letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   6. Tables
   -------------------------------------------------------------------------- */
.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
    font-size: var(--h-text);
    border-color: var(--h-line);
}

.table > thead > tr > th {
    padding: 8px var(--h-cell-x);
    background-color: var(--h-canvas-sunken);
    color: var(--h-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
    border-bottom: 1px solid var(--h-line-strong);
}

.table > tbody > tr > td {
    height: var(--h-row-h);
    padding: var(--h-cell-y) var(--h-cell-x);
    line-height: 1.35;
    vertical-align: middle;
    color: var(--h-ink-2);
    border-color: var(--h-line-soft);
}

/* The first column is the record identifier on every grid in this app (job
   no, tran no, voucher no). Those are hyphenated, so the browser happily
   breaks them across three lines in a narrow column — pin them to one line
   and let the wider descriptive columns absorb the wrapping instead. */
.table > tbody > tr > td:first-child,
.table > thead > tr > th:first-child {
    white-space: nowrap;
}

.table > tbody > tr {
    transition: background-color 0.1s var(--h-ease);
}

.table > tbody > tr:hover > td {
    background-color: var(--h-canvas-sunken);
}

/* Full grid lines on every table, not just `.table-bordered`. On dense
   freight/accounts grids the vertical rules are what let the eye track a
   value back to its column. */
.table > :not(caption) > * > *,
.table.table-bordered > :not(caption) > * > * {
    border-width: 1px;
    border-style: solid;
    border-color: var(--h-line);
}

.table > thead > tr > th {
    border-color: var(--h-line-strong) !important;
}

/* Outer frame, so the grid reads as one block inside the panel. */
.table {
    border: 1px solid var(--h-line);
    border-radius: var(--h-r);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

.table > :not(caption) > * > *:first-child { border-left: 0; }
.table > :not(caption) > * > *:last-child { border-right: 0; }
.table > thead > tr:first-child > * { border-top: 0; }
.table > tbody > tr:last-child > * { border-bottom: 0; }

/* Status tints the app paints on job-charge rows must still win. */
.table > tbody > tr > td.background-green-td,
.table > tbody > tr > td.background-grey-td,
.table > tbody > tr > td.background-white-td,
.table > tbody > tr.bg-theme-9-table > td,
.table > tbody > tr.bg-gray-300 > td {
    background-color: inherit;
}

/* Inputs inside grid cells must not inflate the row. */
.table .form-control,
.table .form-select {
    height: 28px;
    min-height: 28px;
    padding: 2px 8px;
    font-size: 12.5px;
    border-radius: var(--h-r-sm);
}

.table .form-check-input {
    margin-top: 0;
}

/* Frozen columns on the job charge grids.
   charges.blade.php pins four columns with an inline <style> block that paints
   them in the old brand blue (#1c3faa) — so a wide grid showed four dark blue
   headers next to four light ones. That block loads after this file, so the
   colours have to be forced. The sticky positioning itself is kept: on a grid
   this wide, pinned identity columns are genuinely useful. */
#receiveableTable > thead > tr > th,
#payableTable > thead > tr > th {
    background-color: var(--h-canvas-sunken) !important;
    color: var(--h-muted) !important;
    border-bottom: 1px solid var(--h-line-strong) !important;
    box-shadow: 1px 0 0 var(--h-line) !important;
}

/* The pinned body cells are hard-coded #fff, which is right on the white
   canvas but must not swallow the row hover. */
#receiveableTable > tbody > tr:hover > td,
#payableTable > tbody > tr:hover > td {
    background-color: var(--h-canvas-sunken) !important;
}

.table > tbody:empty::after {
    content: "No records found";
    display: block;
    padding: 32px 16px;
    text-align: center;
    color: var(--h-faint);
}

.overflow-auto {
    scrollbar-width: thin;
    scrollbar-color: var(--h-line-strong) transparent;
}

.overflow-auto::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.overflow-auto::-webkit-scrollbar-thumb {
    background-color: var(--h-line-strong);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
    --bs-btn-border-radius: var(--h-r);
    height: var(--h-control-h);
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
    border-radius: var(--h-r);
    border-width: 1px;
    border-style: solid;
    box-shadow: none !important;
    transition: background-color 0.15s var(--h-ease), border-color 0.15s var(--h-ease),
        color 0.15s var(--h-ease), transform 0.1s var(--h-ease);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn:hover:not(:disabled):not(.disabled) {
    transform: translateY(-1px);
}

.btn:active:not(:disabled):not(.disabled) {
    transform: translateY(0) scale(0.98);
    transition-duration: 0.04s;
}

.btn > svg,
.btn > i[data-feather] {
    width: 14px;
    height: 14px;
    margin: 0 !important;
    flex-shrink: 0;
}

/* Size variants */
.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 11.5px;
    gap: 4px;
}

.btn-lg {
    height: 38px;
    padding: 0 20px;
    font-size: 13.5px;
    gap: 8px;
}

/* Icon-only buttons (square) */
.btn-icon {
    width: var(--h-control-h);
    padding: 0;
}

.btn-icon.btn-sm { width: 28px; }
.btn-icon.btn-lg { width: 38px; }

/* ── Primary ── */
.btn-primary,
.btn-elevated-primary {
    background-color: var(--h-accent);
    border-color: var(--h-accent);
    color: #fff;
}

.btn-primary:hover,
.btn-elevated-primary:hover,
.btn-primary:focus,
.btn-elevated-primary:focus {
    background-color: var(--h-accent-hover);
    border-color: var(--h-accent-hover);
    color: #fff;
}

.btn-outline-primary {
    background-color: transparent;
    border-color: var(--h-accent);
    color: var(--h-accent);
}

.btn-outline-primary:hover {
    background-color: var(--h-accent);
    border-color: var(--h-accent);
    color: #fff;
}

.btn-soft-primary {
    background-color: rgba(79, 70, 229, 0.1);
    border-color: transparent;
    color: var(--h-accent);
}

.btn-soft-primary:hover {
    background-color: rgba(79, 70, 229, 0.18);
    border-color: transparent;
    color: var(--h-accent);
}

/* ── Secondary / neutral ── */
.btn-secondary,
.btn-outline-secondary {
    background-color: var(--h-canvas);
    border-color: var(--h-line-strong);
    color: var(--h-ink-2);
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
    background-color: var(--h-canvas-sunken);
    border-color: var(--h-ink-3);
    color: var(--h-ink);
}

/* ── Success ── */
.btn-success, .btn-elevated-success {
    background-color: var(--h-success);
    border-color: var(--h-success);
    color: #fff;
}

.btn-success:hover, .btn-elevated-success:hover {
    background-color: #065f46;
    border-color: #065f46;
    color: #fff;
}

.btn-outline-success {
    background-color: transparent;
    border-color: var(--h-success);
    color: var(--h-success);
}

.btn-outline-success:hover {
    background-color: var(--h-success);
    border-color: var(--h-success);
    color: #fff;
}

.btn-soft-success {
    background-color: rgba(5, 150, 105, 0.1);
    border-color: transparent;
    color: var(--h-success);
}

.btn-soft-success:hover {
    background-color: rgba(5, 150, 105, 0.18);
    border-color: transparent;
    color: var(--h-success);
}

/* ── Danger ── */
.btn-danger, .btn-elevated-danger {
    background-color: var(--h-danger);
    border-color: var(--h-danger);
    color: #fff;
}

.btn-danger:hover, .btn-elevated-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.btn-outline-danger {
    background-color: transparent;
    border-color: var(--h-danger);
    color: var(--h-danger);
}

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

.btn-soft-danger {
    background-color: rgba(220, 38, 38, 0.1);
    border-color: transparent;
    color: var(--h-danger);
}

.btn-soft-danger:hover {
    background-color: rgba(220, 38, 38, 0.18);
    border-color: transparent;
    color: var(--h-danger);
}

/* ── Warning ── */
.btn-warning, .btn-elevated-warning {
    background-color: #b45309;
    border-color: #b45309;
    color: #fff;
}

.btn-warning:hover, .btn-elevated-warning:hover {
    background-color: #92400e;
    border-color: #92400e;
    color: #fff;
}

.btn-outline-warning {
    background-color: transparent;
    border-color: #b45309;
    color: #b45309;
}

.btn-outline-warning:hover {
    background-color: #b45309;
    border-color: #b45309;
    color: #fff;
}

.btn-soft-warning {
    background-color: rgba(180, 83, 9, 0.1);
    border-color: transparent;
    color: #b45309;
}

.btn-soft-warning:hover {
    background-color: rgba(180, 83, 9, 0.18);
    border-color: transparent;
    color: #b45309;
}

/* ── Info ── */
.btn-info {
    background-color: #0891b2;
    border-color: #0891b2;
    color: #fff;
}

.btn-info:hover {
    background-color: #0e7490;
    border-color: #0e7490;
    color: #fff;
}

.btn-outline-info {
    background-color: transparent;
    border-color: #0891b2;
    color: #0891b2;
}

.btn-outline-info:hover {
    background-color: #0891b2;
    border-color: #0891b2;
    color: #fff;
}

.btn-soft-info {
    background-color: rgba(8, 145, 178, 0.1);
    border-color: transparent;
    color: #0891b2;
}

.btn-soft-info:hover {
    background-color: rgba(8, 145, 178, 0.18);
    border-color: transparent;
    color: #0891b2;
}

/* ── Dark / Light utility ── */
.btn-dark {
    background-color: var(--h-ink);
    border-color: var(--h-ink);
    color: #fff;
}

.btn-dark:hover {
    background-color: var(--h-ink-2);
    border-color: var(--h-ink-2);
    color: #fff;
}

.btn-light {
    background-color: var(--h-canvas-sunken);
    border-color: var(--h-line);
    color: var(--h-ink-2);
}

.btn-light:hover {
    background-color: var(--h-line);
    border-color: var(--h-line-strong);
    color: var(--h-ink);
}

/* ── Row action buttons: compact & quiet ── */
.table .btn {
    height: 26px;
    padding: 0 8px;
    font-size: 11px;
    gap: 4px;
    font-weight: 500;
    border-radius: var(--h-r-sm);
}

.table .btn > svg,
.table .btn > i[data-feather] {
    width: 13px;
    height: 13px;
}

/* ── States ── */
.btn:focus-visible {
    outline: none;
    box-shadow: var(--h-ring) !important;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
}

/* ── Submit spinner ── */
.submitBtn:disabled {
    position: relative;
    color: transparent !important;
}

.submitBtn:disabled::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: h-spin 0.6s linear infinite;
}

@keyframes h-spin {
    to { transform: rotate(360deg); }
}

/* ── Button group refinement ── */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: var(--h-r);
    border-bottom-left-radius: var(--h-r);
}

.btn-group .btn:last-child {
    border-top-right-radius: var(--h-r);
    border-bottom-right-radius: var(--h-r);
}

.btn-group .btn + .btn {
    margin-left: -1px;
}

/* ── Dropdown toggle caret ── */
.btn.dropdown-toggle::after {
    margin-left: 4px;
    vertical-align: 0.15em;
    border-top-width: 4px;
    border-right-width: 4px;
    border-left-width: 4px;
}

/* --------------------------------------------------------------------------
   8. Forms
   -------------------------------------------------------------------------- */
/* Half the forms label fields with `.form-label`, the other half with a bare
   <label> that inherits nothing — which is why "Cost Center" and "Job Kind"
   rendered as large dark headings next to a small grey "JOB NO". One rule for
   both. Checkbox/radio captions are excluded: they sit beside their control,
   not above it, and must stay sentence case. */
.form-label,
.box label:not(.form-check-label):not(.btn):not(.form-check-input),
form label:not(.form-check-label):not(.btn):not(.form-check-input) {
    display: block;
    margin-bottom: 4px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--h-muted);
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

/* Captions that sit BESIDE a control, not above it, must stay inline.
   These forms label their checkboxes with `.form-label` too, so the block
   display above pushed the caption onto its own line under the box. Any
   label immediately following a checkbox/radio is treated as a caption. */
.form-check-label,
label.form-check-label,
input[type="checkbox"] + label,
input[type="radio"] + label,
input[type="checkbox"] + .form-label,
input[type="radio"] + .form-label,
.form-check label {
    display: inline-block !important;
    margin-bottom: 0 !important;
    margin-left: 6px;
    vertical-align: middle;
    font-size: var(--h-text) !important;
    font-weight: 500 !important;
    line-height: 1.3;
    color: var(--h-ink-2) !important;
    text-transform: none !important;
    letter-spacing: 0;
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
    vertical-align: middle;
}

/* Control alignment.
   The selects in these forms carry a `mt-2` utility (`class="tom-select w-full
   mt-2"`), and both tom-select and select2 copy the original element's classes
   onto the wrapper they generate. The result is every dropdown sitting ~8px
   lower than the plain text input beside it, so a row of fields never lines
   up. Controls sit directly beneath their own label here, so the top margin is
   never wanted. */
.ts-wrapper,
.select2-container,
select.tom-select,
select.select2,
.box .row > [class*="col-"] > .form-control,
.box .row > [class*="col-"] > .form-select,
.box .row > [class*="col-"] > select,
.box .row > [class*="col-"] > textarea {
    margin-top: 0 !important;
}

/* Every control in a field cell resolves to the same box height so labels and
   inputs align across the row. */
.form-control,
.form-select,
select.form-control,
.select2-container .select2-selection--single {
    height: var(--h-control-h);
    min-height: var(--h-control-h);
    box-sizing: border-box;
}

/* TomSelect structure in this build — verified by inspecting the children:
       .ts-control            wrapper — ALSO contains the dropdown
         .ts-input            the visible box
         .ts-dropdown         the option list (absolutely positioned)
   `.ts-control` must therefore stay an unstyled, unsized wrapper. Giving it a
   height clips the dropdown, which then renders in normal flow at the bottom
   of the page; giving it a border/padding double-draws the box. */
.ts-control,
.ts-wrapper .ts-control,
.ts-wrapper.single .ts-control,
.tom-select .ts-control {
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    line-height: normal;
    position: relative;
}

/* A checkbox and its caption travel together. Without this the pair splits
   across lines in narrow columns, leaving the caption under the box. */
.check-pair {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    margin-right: 18px;
    min-height: var(--h-control-h);
}

.check-pair > label {
    margin-left: 6px !important;
}

/* Vertical rhythm: each field cell gets the same gap, so columns with
   differing field counts still scan as even rows. */
.box .row > [class*="col-md-"],
.box .row > [class*="col-lg-"],
.box .row > [class*="col-xl-"] {
    margin-bottom: 12px;
}

.form-control,
.form-select {
    height: var(--h-control-h);
    min-height: var(--h-control-h);
    padding: 0 10px;
    font-size: var(--h-text);
    color: var(--h-ink);
    background-color: var(--h-canvas);
    border: 1px solid var(--h-line-strong);
    border-radius: var(--h-r);
    box-shadow: none;
    transition: border-color 0.12s var(--h-ease), box-shadow 0.12s var(--h-ease);
}

/* Native select chevron — a CSS-drawn chevron matching select2/tom-select. */
.form-select {
    padding-right: 30px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgb(100 116 139)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-position: center right 8px;
    background-repeat: no-repeat;
    background-size: 16px;
}

textarea.form-control {
    height: auto;
    min-height: 64px;
    padding: 8px 10px;
}

.form-control::placeholder {
    color: var(--h-faint);
}

.form-control:hover:not(:disabled):not([readonly]),
.form-select:hover:not(:disabled) {
    border-color: #b6c2d2;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--h-accent);
    box-shadow: var(--h-ring);
    outline: none;
}

.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
    background-color: var(--h-canvas-sunken);
    border-color: var(--h-line);
    color: var(--h-muted);
    cursor: not-allowed;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--h-danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.form-check-input:checked {
    background-color: var(--h-accent);
    border-color: var(--h-accent);
}

.form-check-input:focus {
    border-color: var(--h-accent);
    box-shadow: var(--h-ring);
}

input[type="number"].form-control {
    text-align: right;
}

/* Field labels that double as actions.
   Across the job/BL/invoice forms the label above a party dropdown is an
   <a class="add-party text-decoration-underline"> — clicking it opens the
   "add party" modal. Left as a link it renders as bold underlined indigo,
   so eleven labels on one form shout louder than the data. Style them as
   labels; the affordance returns on hover. */
a.add-party,
a[class*="add-"].text-decoration-underline,
a.text-decoration-underline.fw-medium,
label a.text-decoration-underline,
.form-label a {
    display: inline-block;
    margin-bottom: 4px;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    text-decoration: none !important;
    color: var(--h-muted) !important;
    cursor: pointer;
    transition: color 0.12s var(--h-ease);
}

a.add-party:hover,
a[class*="add-"].text-decoration-underline:hover,
a.text-decoration-underline.fw-medium:hover,
label a.text-decoration-underline:hover,
.form-label a:hover {
    color: var(--h-accent) !important;
    text-decoration: underline !important;
}

/* The required marker is inline-styled red in the markup. */
a.add-party span[style*="red"],
.form-label span[style*="red"] {
    color: var(--h-danger) !important;
    font-weight: 700;
}

/* Checkboxes and radios carried a black 1px border from the browser default. */
.form-check-input {
    width: 15px;
    height: 15px;
    border: 1px solid var(--h-line-strong);
    border-radius: var(--h-r-sm);
    background-color: var(--h-canvas);
    cursor: pointer;
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-input:hover:not(:disabled) {
    border-color: #b6c2d2;
}

.form-check-label {
    font-size: var(--h-text);
    color: var(--h-ink-2);
    cursor: pointer;
}

/* File inputs: the browser button is styled to match the neutral button. */
.form-control[type="file"] {
    padding: 0;
    line-height: 30px;
}

.form-control[type="file"]::file-selector-button {
    height: 30px;
    margin: 0 10px 0 0;
    padding: 0 12px;
    border: 0;
    border-right: 1px solid var(--h-line-strong);
    background-color: var(--h-canvas-sunken);
    color: var(--h-ink-2);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
}

.form-control[type="file"]:hover::file-selector-button {
    background-color: #eef2f6;
}

/* --- select2 --------------------------------------------------------- */
/* The project's select2.css puts `border: 1px solid #000` plus its own
   background-image chevron directly on `.select2-container`. That creates a
   double border: one on the container, one on `.select2-selection--single`
   inside it. Strip the container back to an unstyled wrapper. */
.select2-container {
    border: 0 !important;
    padding: 0 !important;
    background-image: none !important;
    background-color: transparent !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    font-size: var(--h-text);
}

.select2-container--default .select2-selection--multiple {
    min-height: var(--h-control-h);
    padding: 2px 6px;
    border: 1px solid var(--h-line-strong);
    border-radius: var(--h-r);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    margin: 2px 4px 2px 0;
    padding: 0 6px;
    font-size: 12px;
    line-height: 20px;
    background-color: var(--h-accent-soft);
    border: 1px solid var(--h-accent-line);
    border-radius: var(--h-r-sm);
    color: var(--h-accent);
}

/* select2 is built by JS after load and its own stylesheet sizes the control
   (.select2-container .select2-selection--single is 28px there, but the live
   widget renders taller than either). It cannot be measured in a static
   snapshot, so the sizing is forced rather than relying on cascade order. */
.select2-container--default .select2-selection--single,
.select2-container .select2-selection--single {
    height: var(--h-control-h) !important;
    min-height: var(--h-control-h) !important;
    padding: 0 !important;
    border: 1px solid var(--h-line-strong) !important;
    border-radius: var(--h-r) !important;
    background-color: var(--h-canvas);
    background-image: none !important;
    display: flex !important;
    align-items: center;
    overflow: hidden;
}

.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container .select2-selection--single .select2-selection__rendered {
    flex: 1 1 auto;
    min-width: 0;
    height: 30px !important;
    line-height: 30px !important;
    padding-left: 10px !important;
    font-size: var(--h-text);
    color: var(--h-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The caret was rendering clipped at the control's rounded corner. With the
   control now a flex row, the arrow becomes a normal flex item instead of an
   absolutely-positioned box that can escape the border radius. */
.select2-container--default .select2-selection--single .select2-selection__arrow,
.select2-container .select2-selection--single .select2-selection__arrow {
    position: static !important;
    flex: 0 0 26px;
    width: 26px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Replace select2's filled triangle with a chevron drawn from two borders, so
   the control matches the native selects and tom-select beside it. */
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    position: static !important;
    width: 7px !important;
    height: 7px !important;
    margin: -3px 0 0 0 !important;
    border: 0 !important;
    border-right: 1.6px solid var(--h-muted) !important;
    border-bottom: 1.6px solid var(--h-muted) !important;
    transform: rotate(45deg);
    transition: transform 0.15s var(--h-ease);
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    margin: 2px 0 0 0 !important;
    transform: rotate(-135deg);
}

.select2-container--default .select2-selection--single:hover {
    border-color: #b6c2d2 !important;
}

.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--h-accent) !important;
    box-shadow: var(--h-ring);
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--h-faint);
}

/* Never give the original <select> a height. select2 keeps it in the DOM as
   a screen-reader-only element (.select2-hidden-accessible); sizing it makes
   the native control — and its own caret — reappear beside the widget. */
select.select2 {
    height: auto;
}

.select2-hidden-accessible {
    height: 1px !important;
    width: 1px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
}

/* Nothing inside the widget should paint its own chevron: the container, the
   wrapper and the original select all inherit background art from the theme,
   which is what produced a second caret outside the rounded border. */
.select2-container,
.select2-container .selection,
.select2-container .select2-selection,
select.select2 {
    background-image: none !important;
}

.select2-container,
.select2-container *,
.select2-container *:focus {
    outline: none !important;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: var(--h-accent) !important;
    box-shadow: var(--h-ring);
    outline: none !important;
}

.select2-dropdown {
    border: 1px solid var(--h-line-strong) !important;
    border-radius: var(--h-r) !important;
    box-shadow: var(--h-shadow-lg);
    overflow: hidden;
    background-color: var(--h-canvas);
    margin-top: 2px;
}

.select2-container--open .select2-dropdown--below {
    border-top: 1px solid var(--h-line-strong) !important;
    border-top-left-radius: var(--h-r) !important;
    border-top-right-radius: var(--h-r) !important;
}

.select2-container--open .select2-dropdown--above {
    border-bottom: 1px solid var(--h-line-strong) !important;
    border-bottom-left-radius: var(--h-r) !important;
    border-bottom-right-radius: var(--h-r) !important;
    margin-top: 0;
    margin-bottom: 2px;
}

.select2-container--open .select2-selection--single {
    border-bottom-left-radius: var(--h-r) !important;
    border-bottom-right-radius: var(--h-r) !important;
}

.select2-container--default .select2-results__option {
    font-size: var(--h-text);
    padding: 6px 10px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--h-accent);
}

/* select2's in-dropdown search box renders unstyled (20px, no border). */
.select2-container--default .select2-search--dropdown .select2-search__field {
    height: 30px;
    padding: 0 8px;
    font-size: var(--h-text);
    border: 1px solid var(--h-line-strong);
    border-radius: var(--h-r-sm);
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    outline: none;
    border-color: var(--h-accent);
    box-shadow: var(--h-ring);
}

/* --- tom-select ------------------------------------------------------
   Measured against real pages, tom-select rendered at 42px and 63px while
   every other control was 32px — the single most visible inconsistency in
   the forms. Its own padding is what inflates it, so that is reset rather
   than just setting a height. */
/* All box styling lives on `.ts-input` — the only element that is actually
   the control. Its own 7.5px vertical padding is what rendered these at 42px
   against a 32px input; the right padding is left alone as it clears the
   caret. */
.ts-input,
.ts-control .ts-input,
.ts-wrapper .ts-input {
    min-height: var(--h-control-h) !important;
    height: var(--h-control-h);
    box-sizing: border-box;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 10px !important;
    line-height: 30px;
    font-size: var(--h-text);
    color: var(--h-ink);
    border: 1px solid var(--h-line-strong);
    border-radius: var(--h-r);
    background-color: var(--h-canvas);
}

/* The option list must escape the control, never sit in flow.
   Main styling block is further down, after the chevron rules. */

.ts-wrapper.single .ts-control > input,
.ts-wrapper.single .ts-control > .item,
.ts-input > input,
.ts-input > .item {
    height: 30px;
    line-height: 30px;
    margin: 0;
    padding: 0;
    font-size: var(--h-text);
}

/* select2's inline typing area inside a multi-select is borderless by design;
   only its metrics need to line up with the rest. */
.select2-search--inline .select2-search__field {
    height: 22px;
    margin: 0;
    font-size: var(--h-text);
    line-height: 22px;
}

/* Multi-select keeps growing with its chips, but starts at the same height. */
.ts-wrapper.multi .ts-control {
    padding: 3px 6px;
    line-height: normal;
}

.ts-wrapper.multi .ts-control > .item {
    margin: 1px 3px 1px 0;
    padding: 1px 6px;
    font-size: 12px;
    line-height: 18px;
    background-color: var(--h-accent-soft);
    border: 1px solid var(--h-accent-line);
    border-radius: var(--h-r-sm);
    color: var(--h-accent);
}

/* States apply to .ts-input, since that is what carries the border. */
.ts-input:hover:not(.focus):not(.disabled) {
    border-color: #b6c2d2;
}

.ts-wrapper.focus .ts-input,
.ts-control.focus .ts-input,
.ts-input.focus {
    border-color: var(--h-accent) !important;
    box-shadow: var(--h-ring);
}

.ts-wrapper.disabled .ts-input,
.ts-control.disabled .ts-input {
    background-color: var(--h-canvas-sunken) !important;
    border-color: var(--h-line) !important;
    color: var(--h-muted);
    cursor: not-allowed;
    opacity: 1;
}

/* Placeholder inside tom-select */
.ts-input > input::placeholder,
.ts-control > .ts-input > input::placeholder {
    color: var(--h-faint) !important;
    opacity: 1;
}

/* The theme's chevron SVG uses stroke='rgb(74 85 104)' which fits the palette.
   Keep it but tighten size to match select2's 7px chevron visually. On open
   state the theme flips it via .dropdown-active — kept as-is. */
.tom-select .ts-input {
    background-size: 16px !important;
    background-position: center right 8px !important;
    padding-right: 30px !important;
}

.ts-dropdown {
    position: absolute;
    z-index: 60;
    border-color: var(--h-line-strong);
    border-radius: var(--h-r);
    box-shadow: var(--h-shadow-lg);
    font-size: var(--h-text);
}

.ts-dropdown .option {
    padding: 6px 10px;
}

.ts-dropdown .option:hover {
    background-color: var(--h-canvas-sunken);
}

.ts-dropdown .active {
    background-color: var(--h-accent-soft);
    color: var(--h-accent);
}

/* The dropdown_input plugin adds a search field inside the option list. */
.ts-dropdown .dropdown-input {
    height: 30px;
    padding: 0 8px;
    font-size: var(--h-text);
    border: 1px solid var(--h-line-strong);
    border-radius: var(--h-r-sm);
    margin: 6px 6px 4px;
    width: calc(100% - 12px);
}

.ts-dropdown .dropdown-input:focus {
    outline: none;
    border-color: var(--h-accent);
    box-shadow: var(--h-ring);
}

/* --------------------------------------------------------------------------
   9. Tabs, badges, alerts
   -------------------------------------------------------------------------- */
/* Tabs.
   The active pill measured 50px against 31px for its siblings, which is what
   made the form header look lopsided. Rebuilt as underline tabs: every item
   the same height, the active one marked by a rule rather than a filled
   block, so the eye goes to the fields and not the chrome. */
.nav-pills {
    gap: 2px;
    border-bottom: 1px solid var(--h-line);
}

.nav-pills .nav-link {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px !important;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background-color: transparent !important;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--h-muted);
    white-space: nowrap;
}

.nav-pills .nav-link:hover:not(.active) {
    color: var(--h-ink);
    border-bottom-color: var(--h-line-strong);
}

.nav-pills .nav-link.active {
    background-color: transparent !important;
    color: var(--h-accent) !important;
    font-weight: 600;
    border-bottom-color: var(--h-accent);
    box-shadow: none;
}

/* Vertical step navigation (Job Info / Job Detail / Vessel / Weight) uses the
   same markup, so it needs the horizontal rules undone. */
.nav-pills.flex-column,
ul.nav-pills:not(.flex-row).d-block {
    border-bottom: 0;
    gap: 1px;
}

.nav-pills.flex-column .nav-link {
    width: 100%;
    height: 34px;
    justify-content: flex-start;
    margin-bottom: 0;
    padding: 0 12px !important;
    border-bottom: 0;
    border-left: 2px solid transparent;
    border-radius: var(--h-r-sm);
    text-align: left;
}

.nav-pills.flex-column .nav-link.active {
    background-color: var(--h-accent-soft) !important;
    border-left-color: var(--h-accent);
}

.badge {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
}

.alert {
    padding: 10px 14px;
    font-size: var(--h-text);
    border: 1px solid transparent;
    border-radius: var(--h-r);
    box-shadow: none;
}

.alert-success { background-color: var(--h-success-soft); border-color: #a7f3d0; color: #065f46; }
.alert-danger  { background-color: var(--h-danger-soft);  border-color: #fecaca; color: #991b1b; }
.alert-warning { background-color: var(--h-warning-soft); border-color: #fde68a; color: #92400e; }
.alert-info    { background-color: var(--h-info-soft);    border-color: #bae6fd; color: #075985; }

/* --------------------------------------------------------------------------
   10. Dropdowns, modals, pagination
   -------------------------------------------------------------------------- */
.dropdown-menu {
    padding: 4px;
    border: 1px solid var(--h-line);
    border-radius: var(--h-r-lg);
    box-shadow: var(--h-shadow-lg);
}

.dropdown-item {
    padding: 7px 10px;
    border-radius: var(--h-r-sm);
    font-size: 12.5px;
    color: var(--h-ink-2);
}

.dropdown-item:hover {
    background-color: var(--h-canvas-sunken);
    color: var(--h-ink);
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--h-accent-soft);
    color: var(--h-accent);
}

.dropdown-header {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--h-faint);
}

.dropdown-divider {
    border-color: var(--h-line);
}

.modal-content {
    border: 0;
    border-radius: var(--h-r-lg);
    box-shadow: var(--h-shadow-lg);
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--h-line);
}

.modal-header .modal-title,
.modal-header h2 {
    font-size: 14px;
    font-weight: 600;
}

.modal-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding: 18px;
    font-size: var(--h-text);
}

.modal-footer {
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--h-line);
}

/* The theme's #718096 only reaches 4.0:1 on white; both of these carry real
   information (record counts, page numbers) so they need to clear 4.5:1. */
.text-gray-600,
.text-gray-500 {
    color: var(--h-muted) !important;
}

/* Status text utilities. The theme's lime (#91c714) manages only 2.0:1 on a
   white card — unreadable for the Approved / Pending labels on the dashboard
   and job grids. Remapped to the palette's accessible status colours.
   `.text-white` is deliberately untouched: it sits on filled buttons. */
.text-theme-9,
.text-success {
    color: var(--h-success) !important;
}

.text-theme-6,
.text-danger {
    color: var(--h-danger) !important;
}

.text-theme-11,
.text-theme-12,
.text-warning {
    color: #b45309 !important;
}

.text-theme-10,
.text-info,
.text-primary {
    color: var(--h-accent) !important;
}

.pagination .page-item .page-link,
.pagination .page-link {
    color: var(--h-ink-2);
}

.pagination .page-link {
    min-width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 2px;
    font-size: 12.5px;
    color: var(--h-ink-2);
    background-color: var(--h-canvas);
    border: 1px solid var(--h-line);
    border-radius: var(--h-r-sm);
}

.pagination .page-link:hover {
    background-color: var(--h-canvas-sunken);
    color: var(--h-ink);
}

.pagination .page-item.active .page-link {
    background-color: var(--h-accent) !important;
    border-color: var(--h-accent);
    color: #fff !important;
    box-shadow: none;
}

.pagination .page-item.disabled .page-link {
    opacity: 0.45;
}

/* DataTables controls used on the dashboard */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    height: var(--h-control-h);
    padding: 0 10px;
    font-size: var(--h-text);
    border: 1px solid var(--h-line-strong);
    border-radius: var(--h-r);
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    outline: none;
    border-color: var(--h-accent);
    box-shadow: var(--h-ring);
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
    font-size: 12.5px;
    color: var(--h-muted);
}

/* --- SweetAlert2 toasts ------------------------------------------------
   The portal uses SweetAlert2 for success/error/info notifications. Align
   them with the design system rather than the default SA2 styling. */
.swal2-popup.swal2-toast {
    font-size: var(--h-text);
    padding: 10px 14px;
    border-radius: var(--h-r-lg);
    box-shadow: var(--h-shadow-lg);
    border: 1px solid var(--h-line);
    background-color: var(--h-card);
}

.swal2-popup.swal2-toast .swal2-title {
    font-size: var(--h-text);
    font-weight: 500;
    color: var(--h-ink);
    margin: 0 0 0 8px;
    padding: 0;
}

.swal2-popup.swal2-toast .swal2-icon {
    width: 22px;
    min-width: 22px;
    height: 22px;
    margin: 0;
    border-width: 2px;
}

.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content {
    font-size: 14px;
}

/* Confirmation modals */
.swal2-popup:not(.swal2-toast) {
    border-radius: var(--h-r-lg);
    font-size: var(--h-text);
    box-shadow: var(--h-shadow-lg);
    border: 1px solid var(--h-line);
}

.swal2-popup:not(.swal2-toast) .swal2-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--h-ink);
}

.swal2-popup:not(.swal2-toast) .swal2-html-container {
    font-size: var(--h-text);
    color: var(--h-ink-2);
}

.swal2-popup:not(.swal2-toast) .swal2-confirm {
    background-color: var(--h-accent) !important;
    border-radius: var(--h-r);
    font-size: 12.5px;
    font-weight: 500;
    box-shadow: none !important;
}

.swal2-popup:not(.swal2-toast) .swal2-cancel {
    border-radius: var(--h-r);
    font-size: 12.5px;
    font-weight: 500;
}

/* --- DataTables pagination --------------------------------------------- */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 12px;
    text-align: right;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 30px;
    height: 30px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 2px;
    padding: 0 8px !important;
    font-size: 12.5px;
    color: var(--h-ink-2) !important;
    background: var(--h-canvas) !important;
    border: 1px solid var(--h-line) !important;
    border-radius: var(--h-r-sm);
    box-shadow: none !important;
    cursor: pointer;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
    background-color: var(--h-canvas-sunken) !important;
    border-color: var(--h-line-strong) !important;
    color: var(--h-ink) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: var(--h-accent) !important;
    border-color: var(--h-accent) !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.45;
    cursor: default;
}

/* DataTables processing overlay */
.dataTables_wrapper .dataTables_processing {
    padding: 10px 16px;
    font-size: var(--h-text);
    color: var(--h-muted);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--h-line);
    border-radius: var(--h-r);
    box-shadow: var(--h-shadow-sm);
}

/* --------------------------------------------------------------------------
   10b. Login screen
   The theme ships a blue gradient panel with a decorative SVG. Rebuilt as a
   split screen: brand panel left, a single bordered card right.
   -------------------------------------------------------------------------- */
body.login {
    background: var(--h-canvas) !important;
    min-height: 100vh;
}

/* Kill the template's decorative background artwork. */
body.login:before,
body.login:after {
    content: none !important;
    background-image: none !important;
}

@media (min-width: 1280px) {
    body.login {
        background: linear-gradient(180deg, #1e1b4b 0%, #312e81 55%, #4338ca 100%) !important;
    }

    body.login > .container {
        max-width: none;
        padding: 0 !important;
    }

    body.login > .container > .grid {
        gap: 0 !important;
        min-height: 100vh;
        align-items: stretch;
    }

    /* Right-hand column becomes a white sheet holding the form. */
    body.login > .container > .grid > div:last-child {
        background: var(--h-canvas);
        margin: 0 !important;
        padding: 0 !important;
        align-items: center;
        justify-content: center;
    }

    body.login > .container > .grid > div:last-child > div {
        margin: 0 !important;
        width: 100%;
        max-width: 380px;
        padding: 0 !important;
    }
}

/* Brand panel */
body.login > .container > .grid > div:first-child {
    padding: 48px;
}

body.login > .container > .grid > div:first-child img {
    max-width: 240px;
    height: auto;
}

body.login h2 {
    font-size: 24px !important;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--h-ink);
    text-align: left !important;
}

body.login form {
    margin-top: 22px;
}

/* Login inputs are roomier than grid inputs — this screen is not a data table. */
body.login .login__input,
body.login .form-control,
body.login select.form-control {
    height: 42px !important;
    padding: 0 14px !important;
    font-size: 14px;
    border: 1px solid var(--h-line-strong) !important;
    border-radius: var(--h-r);
    background-color: var(--h-canvas);
}

body.login .form-control:focus {
    border-color: var(--h-accent) !important;
    box-shadow: var(--h-ring);
}

body.login .form-control::placeholder {
    color: var(--h-faint);
}

body.login .btn-primary {
    width: 100% !important;
    height: 42px;
    margin: 0 !important;
    font-size: 14px;
    font-weight: 600;
}

body.login .alert {
    margin-bottom: 14px;
}

body.login a {
    color: var(--h-accent);
    font-weight: 500;
}

body.login small,
body.login .text-gray-500 {
    color: var(--h-muted) !important;
    font-size: 12px;
}

body.login .form-check-input {
    margin-top: 0;
}

/* The card gets a real border on small screens where it floats on the gradient. */
@media (max-width: 1279.98px) {
    body.login {
        background: linear-gradient(180deg, #1e1b4b, #4338ca) !important;
    }

    body.login > .container > .grid > div:last-child > div {
        border: 1px solid var(--h-line);
        border-radius: var(--h-r-lg);
        box-shadow: var(--h-shadow-lg);
    }
}

/* --------------------------------------------------------------------------
   10c. Intro animations
   The theme starts every element at opacity:0 / translateX(50px) with a
   staggered delay. This fires on every page navigation and causes a flash
   of invisible content + horizontal scrollbar. Suppressed entirely for a
   production business app — content should appear instantly.
   -------------------------------------------------------------------------- */
.intro-x, .-intro-x, .intro-y, .-intro-y,
* > .intro-x, * > .-intro-x,
* > .intro-y, * > .-intro-y {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
}

/* --------------------------------------------------------------------------
   10d. Input groups, tooltips, misc
   -------------------------------------------------------------------------- */
/* Input group addons (calendar pickers, search buttons) */
.input-group-text {
    height: var(--h-control-h);
    padding: 0 10px;
    font-size: var(--h-text);
    background-color: var(--h-canvas-sunken);
    border: 1px solid var(--h-line-strong);
    color: var(--h-muted);
}

/* Tooltip theming */
.tooltip-inner {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--h-r-sm);
    background-color: var(--h-sidebar);
}

.tooltip .tooltip-arrow::before {
    border-top-color: var(--h-sidebar);
}

/* Card body compact density */
.box > .p-5 {
    padding: 16px !important;
}

/* Compact spacing for stacked form rows inside cards */
.box > .p-5 > .row,
.box > .p-5 > form > .row {
    margin-bottom: 0;
}

/* Per-page record selector (show 10/25/50) beside pagination */
.d-flex > select.form-select[name*="per"],
select.form-select.w-20,
select[onchange*="perPage"],
.perPage {
    height: 30px;
    min-height: 30px;
    padding: 0 26px 0 8px;
    font-size: 12.5px;
    border-radius: var(--h-r-sm);
    background-size: 14px;
    background-position: center right 6px;
}

/* Empty-state placeholder in select2 and tom-select */
.select2-container--default .select2-selection--single .select2-selection__placeholder,
.ts-input > input[placeholder]::placeholder {
    color: var(--h-faint);
}

/* Scrollable modal body inner tables */
.modal-body .table-responsive,
.modal-body .overflow-auto {
    max-height: calc(100vh - 300px);
}

/* Fix progress bars to use accent */
.progress-bar {
    background-color: var(--h-accent);
}

/* Align icon-only buttons in table action columns */
.table td .d-flex {
    gap: 4px;
}

/* --------------------------------------------------------------------------
   11. Accessibility
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 2px solid var(--h-accent);
    outline-offset: 2px;
    border-radius: var(--h-r-sm);
}

.app-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-skip-link:focus {
    position: fixed !important;
    top: 12px;
    left: 12px;
    z-index: 9999;
    width: auto;
    height: auto;
    clip: auto;
    margin: 0;
    padding: 10px 16px;
    background: var(--h-canvas);
    color: var(--h-accent);
    border-radius: var(--h-r);
    box-shadow: var(--h-shadow-lg);
    font-weight: 600;
}

/* The theme starts every element at opacity 0 with a ~0.33s staggered delay.
   Under reduced motion, suppress the animation AND make sure the content is
   left visible rather than stuck transparent. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-delay: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .intro-x, .-intro-x, .intro-y, .-intro-y,
    * > .intro-x:first-child, * > .-intro-x:first-child,
    * > .intro-y:first-child, * > .-intro-y:first-child {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* --------------------------------------------------------------------------
   12. Print
   -------------------------------------------------------------------------- */
@media print {
    html, body.main { background: #fff !important; }

    .side-nav,
    .top-bar,
    .pagination,
    .btn,
    button,
    #faq-accordion-collapse-1 {
        display: none !important;
    }

    .content {
        min-height: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
    }

    .box { border: 0 !important; box-shadow: none !important; }

    .table { font-size: 11px; }

    .table > thead > tr > th {
        background: #eee !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .overflow-auto { overflow: visible !important; }

    tr, img { page-break-inside: avoid; }
    thead { display: table-header-group; }
}
