/*
 * Hamly ERP - shared UI theme.
 *
 * The Add/Edit Sale form (resources/views/sell/partials/redesign_styles.blade.php)
 * is the reference design. Every field rule here carries the same values as
 * that sheet - 42px fields, 10px radius inside input groups, inline leading
 * icons, 42px select2 boxes, green "+" add buttons, 12px-radius primary
 * buttons - so any screen matches the sales form to the pixel. Where the sales
 * sheet is scoped to `.sell-redesign`, this one is not; on the sales pages the
 * scoped sheet loads later and simply restates the same numbers.
 *
 * Deliberately CSS only. The toggle switches repaint the markup iCheck already
 * produces, so click handlers, ifToggled/ifChecked and $(el).iCheck('check')
 * keep working - only the painting changes.
 *
 * Loaded after vendor.css in layouts/partials/css.blade.php.
 */

:root {
    /* Brand tokens come from the theme block in css.blade.php, with the
       palette's own values as fallbacks - the same ones the sales sheet reads. */
    --ui-brand:        var(--theme-800, #184d2c);
    --ui-brand-dark:   var(--theme-700, #0d2b1a);
    --ui-brand-soft:   #eaf2ed;
    --ui-brand-ring:   rgba(27, 122, 80, .12);
    --ui-gold:         var(--gold, #c9a84c);
    --ui-gold-dark:    #a8873a;
    --ui-ink:          #1f2937;
    --ui-muted:        #6b7280;
    --ui-icon:         #9aa1ab;
    --ui-line:         #e6e8eb;
    --ui-line-strong:  #d7dcd9;
    --ui-bg:           #f6f7f8;
    --ui-radius:       9px;      /* plain field */
    --ui-radius-group: 10px;     /* field inside an input group */
    --ui-radius-card:  14px;
    --ui-action-radius: 10px;   /* Save / Update / Close / Cancel */
    --ui-field-h:      42px;
}

/* =====================================================================
   Fields: inputs, selects, textareas
   ===================================================================== */
.form-control {
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius);
    box-shadow: none;
    min-height: var(--ui-field-h);
    font-size: 14px;
    color: var(--ui-ink);
}

select.form-control {
    height: var(--ui-field-h);
    width: 100%;
}

textarea.form-control {
    min-height: 74px;
    height: auto;
}

/* Bootstrap's input-sm (product price table, opening stock, payment rows,
   location forms ...) is the same 42px field as everything else; only the
   POS and the sales/purchase line-item tables stay dense. */
.form-control.input-sm {
    min-height: var(--ui-field-h);
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857;
}

.form-control:focus {
    border-color: var(--ui-brand);
    box-shadow: 0 0 0 3px var(--ui-brand-ring);
    outline: none;
}

.form-control::placeholder {
    color: var(--ui-icon);
}

.form-control[readonly],
.form-control[disabled],
fieldset[disabled] .form-control {
    background-color: var(--ui-bg);
}

/* Kill Chrome/Edge autofill yellow on every field. */
input:-webkit-autofill,
select:-webkit-autofill,
textarea:-webkit-autofill,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    box-shadow: 0 0 0 1000px #fff inset !important;
    -webkit-text-fill-color: var(--ui-ink) !important;
    caret-color: var(--ui-ink);
}

/* POS is deliberately dense; the sales form itself keeps its line-item table
   at 36px. Both keep their own sizes. */
#add_pos_sell_form .form-control,
#pos_sidebar_wrap .form-control,
.pos_form_totals .form-control {
    min-height: 34px;
}

#pos_table .form-control,
#purchase_entry_table .form-control {
    min-height: 36px;
}

/* =====================================================================
   Labels
   ===================================================================== */
label {
    color: var(--ui-ink);
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
}

.help-block {
    color: var(--ui-muted);
}

/* =====================================================================
   Input groups - the sales form's inline-icon treatment
   ---------------------------------------------------------------------
   A leading icon addon floats inside the field (transparent, borderless) and
   the field is padded to clear it. An addon that holds a real control (the
   product-expiry switch) or a tooltip stays a boxed addon so it remains
   usable; a trailing addon stays boxed too.
   ===================================================================== */
.input-group {
    position: relative;
    display: table;
    width: 100%;
}

.input-group .form-control {
    border-radius: var(--ui-radius-group);
}

.input-group-addon {
    background: #fff;
    border: 1px solid var(--ui-line);
    color: var(--ui-icon);
    font-size: 13px;
    padding: 0 12px;
}

/* Leading icon -> inline, out of the flow. */
.input-group > .input-group-addon:first-child:not(:has(input, select, button, textarea, [data-toggle])) {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex !important;
    align-items: center;
    width: auto;
    padding: 0 11px;
    background: transparent !important;
    border: 0 !important;
    color: var(--ui-icon) !important;
    font-size: 13px;
    z-index: 4;
    pointer-events: none;
    border-radius: 0 !important;
}

.input-group > .input-group-addon:first-child:not(:has(input, select, button, textarea, [data-toggle])) + .form-control,
.input-group > .input-group-addon:first-child:not(:has(input, select, button, textarea, [data-toggle])) + select + .select2-container .select2-selection__rendered,
.input-group > .input-group-addon:first-child:not(:has(input, select, button, textarea, [data-toggle])) + .select2-container .select2-selection__rendered {
    padding-left: 34px !important;
}

.input-group > .input-group-addon:first-child:not(:has(input, select, button, textarea, [data-toggle])) + .form-control {
    border: 1px solid var(--ui-line) !important;
    border-radius: var(--ui-radius-group) !important;
}

.input-group > .input-group-addon:first-child:not(:has(input, select, button, textarea, [data-toggle])) + .form-control:not(:last-child) {
    border-radius: var(--ui-radius-group) 0 0 var(--ui-radius-group) !important;
}

/* Leading addon that must stay boxed (it holds a control or a tooltip). */
.input-group > .input-group-addon:first-child:has(input, select, button, textarea, [data-toggle]) {
    border-right: 0;
    border-radius: var(--ui-radius-group) 0 0 var(--ui-radius-group);
}

.input-group > .input-group-addon:first-child:has(input, select, button, textarea, [data-toggle]) + .form-control {
    border-radius: 0 var(--ui-radius-group) var(--ui-radius-group) 0;
}

/* Trailing addon stays boxed, rounded on the outside edge. */
.input-group > .form-control:not(:last-child):not(:first-child) {
    border-radius: 0;
}

.input-group > .form-control:first-child:not(:last-child) {
    border-radius: var(--ui-radius-group) 0 0 var(--ui-radius-group);
}

.input-group > .input-group-addon:last-child:not(:first-child) {
    border-left: 0;
    border-radius: 0 var(--ui-radius-group) var(--ui-radius-group) 0;
}

/* Leading button (a search magnifier) -> inline icon, out of the flow.
   #pos_table is excluded, the way the input-group rules above already exclude
   it: the POS cart's quantity stepper is an .input-group whose first button is
   the minus, so this lifted it out of the flow and painted it ON TOP of the
   quantity field - the "minus button inside the input" - and pushed 34px of
   padding into the field to make room for an icon that is not there. */
.input-group > .input-group-btn:first-child:not(:has(.fa-plus-circle)):not(#pos_table *) {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 4;
    width: auto;
}

.input-group > .input-group-btn:first-child:not(:has(.fa-plus-circle)):not(#pos_table *) > .btn {
    background: transparent !important;
    border: 0 !important;
    color: var(--ui-icon) !important;
    box-shadow: none !important;
    height: 100%;
}

.input-group > .input-group-btn:first-child:not(:has(.fa-plus-circle)):not(#pos_table *) ~ .form-control {
    padding-left: 34px;
}

/* Dropdown-toggle groups (a select-like button glued to the field) keep the
   classic joined look with the outside rounding. */
.input-group:has(> .input-group-btn > .btn.dropdown-toggle) > .input-group-btn:last-child > .btn {
    border-radius: 0 var(--ui-radius-group) var(--ui-radius-group) 0;
}

/* Every other trailing action button (add customer / supplier / unit,
   translate, go ...) -> a separate green square beside the field with a small
   gap, exactly as the sales form's add-customer button; the field keeps its
   full rounding on both sides. Quantity steppers use a bare fa-plus inside
   the line-item tables, and the POS has its own skin, so those stay out. */
.input-group:has(> .input-group-btn:last-child > .btn):not(:has(> .input-group-btn > .btn.dropdown-toggle)):not(#add_pos_sell_form *):not(#edit_pos_sell_form *):not(#pos_table *):not(#purchase_entry_table *):not(table.dataTable *) {
    display: flex !important;
    gap: 8px;
    align-items: stretch;
}

.input-group:has(> .input-group-btn:last-child > .btn):not(:has(> .input-group-btn > .btn.dropdown-toggle)):not(#add_pos_sell_form *):not(#edit_pos_sell_form *):not(#pos_table *):not(#purchase_entry_table *):not(table.dataTable *) > .form-control,
.input-group:has(> .input-group-btn:last-child > .btn):not(:has(> .input-group-btn > .btn.dropdown-toggle)):not(#add_pos_sell_form *):not(#edit_pos_sell_form *):not(#pos_table *):not(#purchase_entry_table *):not(table.dataTable *) > .select2-container {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
}

.input-group:has(> .input-group-btn:last-child > .btn):not(:has(> .input-group-btn > .btn.dropdown-toggle)):not(#add_pos_sell_form *):not(#edit_pos_sell_form *):not(#pos_table *):not(#purchase_entry_table *):not(table.dataTable *) > .input-group-btn:last-child {
    display: flex;
    flex: 0 0 auto;
    width: auto;
    gap: 8px;
}

.input-group:has(> .input-group-btn:last-child > .btn):not(:has(> .input-group-btn > .btn.dropdown-toggle)):not(#add_pos_sell_form *):not(#edit_pos_sell_form *):not(#pos_table *):not(#purchase_entry_table *):not(table.dataTable *) > .form-control,
.input-group:has(> .input-group-btn:last-child > .btn):not(:has(> .input-group-btn > .btn.dropdown-toggle)):not(#add_pos_sell_form *):not(#edit_pos_sell_form *):not(#pos_table *):not(#purchase_entry_table *):not(table.dataTable *) .select2-selection {
    border-radius: var(--ui-radius-group) !important;
}

.input-group:not(#add_pos_sell_form *):not(#edit_pos_sell_form *):not(#pos_table *):not(#purchase_entry_table *):not(table.dataTable *) > .input-group-btn:last-child > .btn:not(.dropdown-toggle),
.input-group > .input-group-btn > .btn:has(.fa-plus-circle) {
    background: var(--ui-brand) !important;
    border-color: var(--ui-brand) !important;
    color: #fff !important;
    /* No !important here: the sales sheet sizes its search "+" to the 44px
       search box and must be able to win; 42px applies everywhere else. */
    height: var(--ui-field-h);
    min-width: 44px;
    padding: 0 12px !important;
    border-radius: var(--ui-radius-group) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.input-group:not(#add_pos_sell_form *):not(#edit_pos_sell_form *):not(#pos_table *):not(#purchase_entry_table *):not(table.dataTable *) > .input-group-btn:last-child > .btn:not(.dropdown-toggle) i,
.input-group:not(#add_pos_sell_form *):not(#edit_pos_sell_form *):not(#pos_table *):not(#purchase_entry_table *):not(table.dataTable *) > .input-group-btn:last-child > .btn:not(.dropdown-toggle) svg,
.input-group > .input-group-btn > .btn:has(.fa-plus-circle) i {
    color: #fff !important;
}

.input-group:not(#add_pos_sell_form *):not(#edit_pos_sell_form *):not(#pos_table *):not(#purchase_entry_table *):not(table.dataTable *) > .input-group-btn:last-child > .btn:not(.dropdown-toggle):hover,
.input-group > .input-group-btn > .btn:has(.fa-plus-circle):hover {
    background: var(--ui-brand-dark) !important;
    border-color: var(--ui-brand-dark) !important;
}

/* The pay-term style .multi-input pair sits side by side, never overlapping. */
.multi-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
}

.multi-input > label {
    flex: 1 1 100%;
    margin: 0;
}

.multi-input > br {
    display: none !important;
}

/* Both halves of the pair get the same basis: half the row minus half the
   8px gap. A zero basis is not enough - Chrome floors a padded (border-box)
   input at its padding, so a padded input beside a padding-free select2 box
   came out 24px wider. A percentage basis sizes both the same. */
.multi-input > .form-control,
.multi-input > .form-control.width-40,
.multi-input > .form-control.width-60,
.multi-input > .select2-container {
    flex: 1 1 calc(50% - 4px) !important;
    width: auto !important;
    min-width: 0 !important;
    float: none !important;
    margin: 0 !important;
}

/* =====================================================================
   Select2 - matched to the field
   ===================================================================== */
/* select2 copies the field's width into an inline style when it initialises
   and on some forms does so before the row has width, leaving a ~26px box.
   !important is needed to beat that inline width. */
.form-group > .select2-container,
.form-group > .select2,
.input-group > .select2-container,
.box-body .select2-container {
    width: 100% !important;
    max-width: 100%;
}

.select2-container--default .select2-selection--single {
    height: var(--ui-field-h) !important;
    border: 1px solid var(--ui-line) !important;
    border-radius: var(--ui-radius-group) !important;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--ui-ink) !important;
    flex: 1 1 auto;
}

/* Text, inline icon and caret all sit on the box's centre line. select2 puts
   the caret at a fixed top offset and the text block at the top of the box,
   which left the text ~2px high and the caret ~2px low. */
.select2-container--default .select2-selection--single {
    display: flex !important;
    align-items: center !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered,
.sell-redesign .select2-container--default .select2-selection--single .select2-selection__rendered {
    height: auto !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 0 !important;
    bottom: 0 !important;
    height: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    position: static !important;
    margin: 0 !important;
    transform: translateY(1px);
}

/* a locked select reads as locked: grey field, muted text, faded caret */
.select2-container--disabled .select2-selection--single,
.select2-container--disabled .select2-selection--multiple {
    background: var(--ui-bg) !important;
    border-color: var(--ui-line) !important;
    cursor: not-allowed !important;
    opacity: .85;
}

.select2-container--disabled .select2-selection__rendered {
    color: var(--ui-muted) !important;
}

.select2-container--disabled .select2-selection__arrow {
    opacity: .35;
}

.form-group small.text-muted {
    display: block;
    margin-top: 6px;
    color: var(--ui-muted);
}


.select2-container--default .select2-selection--multiple {
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-group);
    min-height: var(--ui-field-h);
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--ui-brand) !important;
    box-shadow: 0 0 0 3px var(--ui-brand-ring);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--ui-gold);
    color: #fff;
}

/* The row that is currently chosen, when it is not the one under the cursor:
   a wash of the same gold rather than select2's grey, so the list reads as
   one colour. */
.select2-container--default .select2-results__option[aria-selected="true"]:not(.select2-results__option--highlighted) {
    background-color: #f7efd8;
    color: var(--ui-brand-dark);
    font-weight: 600;
}

/* jQuery UI autocomplete (product search, customer search) ships a bright
   blue highlight - repaint it in the brand's secondary colour. */
.ui-autocomplete .ui-state-active,
.ui-autocomplete .ui-state-focus,
.ui-menu .ui-menu-item .ui-state-active,
.ui-menu .ui-menu-item .ui-state-focus,
.ui-menu .ui-state-focus,
.ui-widget-content .ui-menu-item .ui-state-active {
    background: var(--ui-gold) !important;
    border: 1px solid var(--ui-gold) !important;
    color: #fff !important;
}

.ui-autocomplete .ui-menu-item-wrapper {
    padding: 6px 10px;
}

/* =====================================================================
   File uploads - green "Browse" button, as on the sales form
   ---------------------------------------------------------------------
   The chosen file name stays visible here (the sales sheet blanks it for its
   single Attach Document field); on product images, imports and documents the
   user needs to see what they picked. The product-image dropzone widget
   (.upload-element) is its own control and is left alone.
   ===================================================================== */
input[type="file"]:not(.upload-element) {
    display: inline-block;
    width: auto;
    max-width: 100%;
    padding: 5px 6px;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius);
    background: #fff;
    color: var(--ui-muted);
    font-size: 13px;
    line-height: 1.6;
}

input[type="file"]:not(.upload-element)::file-selector-button,
input[type="file"]:not(.upload-element)::-webkit-file-upload-button {
    background: var(--ui-brand);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    margin-right: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .16s ease-in-out;
}

input[type="file"]:not(.upload-element):hover::file-selector-button,
input[type="file"]:not(.upload-element):focus::file-selector-button {
    background: var(--ui-brand-dark);
}

input[type="file"]:not(.upload-element):focus {
    border-color: var(--ui-brand);
    box-shadow: 0 0 0 3px var(--ui-brand-ring);
    outline: none;
}

/* bootstrap-fileinput widget: exactly the sales form's treatment - a single
   green Browse button. The caption box beside it sat 2px shorter with a square
   inner corner against the rounded button, which read as a broken edge; the
   widget's preview thumbnail still shows what was picked. */
.file-caption,
.kv-fileinput-caption,
.file-input .input-group-btn > .fileinput-remove,
.file-input .input-group-btn > .fileinput-cancel,
.file-input .input-group-btn > .fileinput-upload,
.fileinput-remove-button,
.fileinput-upload-button,
.fileinput-cancel-button {
    display: none !important;
}

/* the widget is a wrapping row: Browse button, then the chosen-file chip */
.file-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    max-width: 100%;
}

/* Import pages: label + Browse widget and the Submit button share one line,
   the button bottom-aligned with the 42px widget. */
.import-file-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

.import-file-row > .form-group {
    margin-bottom: 0;
}

.import-file-row > .tw-dw-btn.hamly-btn {
    height: var(--ui-field-h) !important;
    min-height: var(--ui-field-h) !important;
}

/* chosen file: name + a small x, placed beside the Browse button */
.hamly-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: var(--ui-field-h);
    padding: 0 6px 0 14px;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-group);
    background: #fff;
    font-size: 13px;
    color: var(--ui-ink);
    max-width: 100%;
    vertical-align: middle;
}

.hamly-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 260px;
}

.hamly-file-clear {
    border: 0;
    background: transparent;
    color: var(--ui-muted);
    font-size: 20px;
    line-height: 1;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
}

.hamly-file-clear:hover {
    background: #fbeaea;
    color: #d64545;
}

.file-input .input-group,
.file-caption-main {
    display: inline-block;
    width: auto;
}

.btn-file,
.file-input .input-group-btn > .btn-file,
.fileinput .btn-default {
    background: var(--ui-brand) !important;
    border-color: var(--ui-brand) !important;
    color: #fff !important;
    border-radius: 8px !important;
    height: var(--ui-field-h);
    padding: 0 18px !important;
    display: inline-flex;
    align-items: center;
}

/* The folder icon sits on the button's centre line, 8px before the label;
   Bootstrap's glyphicon top:1px nudge reads as off-centre in a flex row. */
.btn-file > .glyphicon,
.fileinput .btn-default > .glyphicon {
    top: 0;
    margin-right: 4px;
}

/* AiAssistance injects "Use AI" as a col-sm-4 / col-sm-6 beside the field
   label. As floats the label hugged the top while the button's 5px margins
   hung into the editor underneath; flex puts both on one centre line. */
.row:has(> .product-description-label),
.row:has(> .image-label) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.row:has(> .product-description-label) > [class*="col-"],
.row:has(> .image-label) > [class*="col-"] {
    float: none;
    width: auto;
}

/* The .row clearfix pseudo-elements would become extra flex items and push
   the label off the left edge. */
.row:has(> .product-description-label)::before,
.row:has(> .product-description-label)::after,
.row:has(> .image-label)::before,
.row:has(> .image-label)::after {
    display: none;
}

.row:has(> .product-description-label) label,
.row:has(> .image-label) label {
    margin-bottom: 0;
}

.tw-dw-btn.get_product_description,
.tw-dw-btn.generate_product_image,
.tw-dw-btn.use_ai_purchase {
    margin: 0 !important;
    height: 30px;
    min-height: 0;
    padding: 0 14px;
    border-radius: 8px !important;
    font-size: 12px;
}

/* Native <select> lists are drawn by the browser; this is the most it will
   honour - the picked row in brand gold. select2 lists are fully themed. */
select.form-control option:checked,
select.form-control option:hover {
    background: var(--ui-gold) linear-gradient(var(--ui-gold), var(--ui-gold));
    color: #fff;
}

/* =====================================================================
   Checkboxes as toggle switches
   ---------------------------------------------------------------------
   iCheck renders <div class="icheckbox_square-blue"> around the real input
   and adds/removes .checked, .hover and .disabled. Repainting that div as a
   switch changes nothing about how it behaves.
   ===================================================================== */
.icheckbox_square-blue {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background-image: none !important;
    background-color: #ccd3cf !important;
    transition: background-color .18s ease-in-out;
    vertical-align: middle;
    cursor: pointer;
}

.icheckbox_square-blue::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
    transition: transform .18s ease-in-out;
}

.icheckbox_square-blue.checked {
    background-color: var(--ui-brand) !important;
}

.icheckbox_square-blue.checked::after {
    transform: translateX(18px);
}

.icheckbox_square-blue.hover:not(.disabled) {
    background-color: #bcc5c0 !important;
}

.icheckbox_square-blue.checked.hover:not(.disabled) {
    background-color: var(--ui-brand-dark) !important;
}

.icheckbox_square-blue.disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Switch and its caption on one line, vertically centred. Bootstrap reserves
   left padding for a native checkbox that iCheck has already replaced. */
.checkbox > label,
label.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-left: 0;
}

.checkbox > label > .icheckbox_square-blue,
label.checkbox-inline > .icheckbox_square-blue,
.checkbox > label > .iradio_square-blue,
label.checkbox-inline > .iradio_square-blue {
    flex: 0 0 auto;
    margin: 0;
}

/* Fallback for checkboxes iCheck has not wrapped - the contact-person template
   rows, for instance, are cloned by JS and can reach the page unprocessed - and
   for .ui-switch, used where JS listens for the native change event that
   iCheck would swallow. Drawn with a background gradient rather than ::after,
   because pseudo-elements do not render on <input>. Inputs that *are* wrapped
   keep iCheck's inline position/opacity, so this never shows through on them. */
input[type="checkbox"].input-icheck,
input[type="checkbox"].ui-switch {
    -webkit-appearance: none;
    appearance: none;
    width: 40px;
    height: 22px;
    border: 0;
    border-radius: 999px;
    background-color: #ccd3cf;
    background-image: radial-gradient(circle 8px at 11px 11px, #fff 98%, rgba(255, 255, 255, 0) 100%);
    background-repeat: no-repeat;
    background-position: 0 0;
    cursor: pointer;
    vertical-align: middle;
    flex: 0 0 auto;
    transition: background-color .18s ease-in-out, background-position .18s ease-in-out;
}

input[type="checkbox"].input-icheck:checked,
input[type="checkbox"].ui-switch:checked {
    background-color: var(--ui-brand);
    background-position: 18px 0;
}

input[type="checkbox"].input-icheck:disabled,
input[type="checkbox"].ui-switch:disabled {
    opacity: .5;
    cursor: not-allowed;
}

input[type="checkbox"].input-icheck:focus-visible,
input[type="checkbox"].ui-switch:focus-visible {
    outline: 2px solid var(--ui-brand);
    outline-offset: 2px;
}

/* Every other checkbox of the application is a switch too (client, 2026-10-07:
   "replace our entire application check box to toggle switch"). Still a tick box:
   a checkbox iCheck has wrapped (it paints the switch itself), the row-select
   boxes of tables and DataTables (bulk selection), DaisyUI's own controls and any
   input marked .no-switch. Behaviour is unchanged: it is the same <input>. */
input[type="checkbox"]:not(.input-icheck, .ui-switch, .no-switch, [class*="tw-dw-"], table *, .dataTables_wrapper *) {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 40px;
    min-width: 40px;
    height: 22px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background-color: #ccd3cf;
    background-image: radial-gradient(circle 8px at 11px 11px, #fff 98%, rgba(255, 255, 255, 0) 100%);
    background-repeat: no-repeat;
    background-position: 0 0;
    cursor: pointer;
    vertical-align: middle;
    flex: 0 0 auto;
    transition: background-color .18s ease-in-out, background-position .18s ease-in-out;
}

input[type="checkbox"]:not(.input-icheck, .ui-switch, .no-switch, [class*="tw-dw-"], table *, .dataTables_wrapper *):checked {
    background-color: var(--ui-brand);
    background-position: 18px 0;
}

input[type="checkbox"]:not(.input-icheck, .ui-switch, .no-switch, [class*="tw-dw-"], table *, .dataTables_wrapper *):disabled {
    opacity: .5;
    cursor: not-allowed;
}

input[type="checkbox"]:not(.input-icheck, .ui-switch, .no-switch, [class*="tw-dw-"], table *, .dataTables_wrapper *):focus-visible {
    outline: 2px solid var(--ui-brand);
    outline-offset: 2px;
}

/* Bootstrap places a .checkbox / .checkbox-inline input absolutely in the label's
   left padding; the label is a flex row here (above), so the switch sits in line. */
.checkbox input[type="checkbox"]:not(.input-icheck, .ui-switch, .no-switch, [class*="tw-dw-"], table *, .dataTables_wrapper *),
.checkbox-inline input[type="checkbox"]:not(.input-icheck, .ui-switch, .no-switch, [class*="tw-dw-"], table *, .dataTables_wrapper *) {
    position: relative;
    margin: 0;
}

/* Radios stay radios - only cleaned up, never turned into switches. */
.iradio_square-blue {
    position: relative;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-image: none !important;
    background-color: #fff !important;
    border: 2px solid var(--ui-line-strong);
    transition: border-color .18s ease-in-out;
    vertical-align: middle;
    cursor: pointer;
}

.iradio_square-blue.checked {
    border-color: var(--ui-brand);
}

.iradio_square-blue.checked::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ui-brand);
}

.iradio_square-blue.disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* =====================================================================
   Buttons - the sales form's shapes and colours
   ===================================================================== */
.btn {
    border-radius: var(--ui-radius-group);
    font-weight: 600;
    transition: background-color .16s ease-in-out, border-color .16s ease-in-out,
                box-shadow .16s ease-in-out, transform .16s ease-in-out;
}

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

.btn:active:not(:disabled):not(.disabled) {
    transform: translateY(0);
    box-shadow: none;
}

/* Primary / Save: deep green, 12px radius, lifts to the lighter green. Table
   action buttons (btn-xs / btn-sm) keep their compact padding. */
.btn-primary,
.btn.hamly-btn {
    background-color: var(--ui-brand-dark);
    border-color: var(--ui-brand-dark);
    color: #fff;
    border-radius: 12px;
}

.btn-primary:not(.btn-xs):not(.btn-sm),
.btn.hamly-btn:not(.btn-xs):not(.btn-sm) {
    padding: 11px 30px;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.btn.hamly-btn:hover,
.btn.hamly-btn:focus {
    background-color: var(--ui-brand);
    border-color: var(--ui-brand);
    color: #fff;
    box-shadow: none;
}

.btn-primary.disabled,
.btn-primary[disabled] {
    background-color: var(--ui-brand-dark);
    border-color: var(--ui-brand-dark);
    opacity: .55;
}

/* Gold: the secondary action (print / save-and-print and friends). */
.btn-gold,
.btn.btn-secondary-gold {
    background-color: var(--ui-gold);
    border-color: var(--ui-gold);
    color: #fff;
    border-radius: 12px;
}

.btn-gold:not(.btn-xs):not(.btn-sm),
.btn.btn-secondary-gold:not(.btn-xs):not(.btn-sm) {
    padding: 11px 30px;
}

.btn-gold:hover,
.btn-gold:focus,
.btn.btn-secondary-gold:hover {
    background-color: var(--ui-gold-dark);
    border-color: var(--ui-gold-dark);
    color: #fff;
    box-shadow: none;
}

/* Default / Close: white with the field border, ink text. */
.btn-default {
    background-color: #fff;
    border-color: var(--ui-line);
    color: var(--ui-ink);
}

.btn-default:hover,
.btn-default:focus {
    background-color: var(--ui-bg);
    border-color: var(--ui-line-strong);
    color: var(--ui-ink);
}

.text-primary {
    color: var(--ui-brand);
}

/* =====================================================================
   Tailwind (tw-dw-btn) buttons - the sales form's Save / Save-and-print
   ---------------------------------------------------------------------
   Every form's Save is a `tw-dw-btn hamly-btn`. The header's inline style
   paints it with a green gradient at 14px; the sales sheet overrides its own
   with !important (solid deep green, 12px, 11px 30px) and so does this,
   app-wide, so every Save matches the sales form to the pixel.
   ===================================================================== */
/* DaisyUI plays a "button-pop" keyframe on every button; it was left on its
   first frame (scale .95) and shrank buttons. Not wanted. */
.tw-dw-btn {
    animation: none !important;
}

.hamly-btn,
.tw-dw-btn-primary {
    background: var(--ui-brand-dark) !important;
    border-color: var(--ui-brand-dark) !important;
    color: #fff !important;
    border-radius: 12px !important;
    padding: 11px 30px;
    font-weight: 600;
    box-shadow: none;
    transition: background-color .16s ease-in-out, border-color .16s ease-in-out,
                box-shadow .16s ease-in-out, transform .16s ease-in-out;
}

.hamly-btn:hover,
.hamly-btn:focus,
.tw-dw-btn-primary:hover,
.tw-dw-btn-primary:focus {
    background: var(--ui-brand) !important;
    border-color: var(--ui-brand) !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: none;
}

.hamly-btn:active,
.tw-dw-btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Secondary action (Save and print, and friends) -> gold. */
.tw-dw-btn-success {
    background: var(--ui-gold) !important;
    border-color: var(--ui-gold) !important;
    color: #fff !important;
    border-radius: 12px !important;
    padding: 11px 30px;
    font-weight: 600;
    box-shadow: none;
    transition: background-color .16s ease-in-out, border-color .16s ease-in-out,
                box-shadow .16s ease-in-out, transform .16s ease-in-out;
}

.tw-dw-btn-success:hover,
.tw-dw-btn-success:focus {
    background: var(--ui-gold-dark) !important;
    border-color: var(--ui-gold-dark) !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: none;
}

.tw-dw-btn-success:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Small in-form actions (Add additional expenses, Import Products ...) take
   the sales sheet's #toggle_additional_expense look: brand green, 8px, sized
   by padding rather than DaisyUI's fixed small height so text never clips. */
.hamly-btn.tw-dw-btn-sm,
.hamly-btn.btn-sm,
.hamly-btn.btn-xs,
.tw-dw-btn-primary.tw-dw-btn-sm {
    background: var(--ui-brand) !important;
    border-color: var(--ui-brand) !important;
    border-radius: 8px !important;
    padding: 9px 18px;
    height: auto;
    min-height: 0;
    font-weight: 600;
}

.hamly-btn.tw-dw-btn-sm:hover,
.hamly-btn.tw-dw-btn-sm:focus,
.hamly-btn.btn-sm:hover,
.hamly-btn.btn-xs:hover,
.tw-dw-btn-primary.tw-dw-btn-sm:hover {
    background: var(--ui-brand-dark) !important;
    border-color: var(--ui-brand-dark) !important;
}

.tw-dw-btn-success.tw-dw-btn-sm {
    border-radius: 8px !important;
    padding: 9px 18px;
    height: auto;
    min-height: 0;
}

/* List-page "Add" buttons (Roles, Users, Brands ...): a DaisyUI btn holding a
   24px tabler "+" svg and a 16px label. The oversized icon and DaisyUI's fixed
   3rem height made it taller and heavier than every other header button; size
   it like the Save buttons (46px, 12px radius) and centre the icon and label. */
.tw-dw-btn.hamly-btn:not(.tw-dw-btn-sm):not(.tw-dw-btn-xs):not(.tw-dw-btn-circle),
.tw-dw-btn.tw-dw-btn-primary:not(.tw-dw-btn-sm):not(.tw-dw-btn-xs):not(.tw-dw-btn-circle) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: auto;
    min-height: 46px;
    /* icon sits closer to the left edge than the label to the right */
    padding: 0 24px 0 14px;
    font-size: 14px !important;
    line-height: 1.2;
}

/* The plus sits in a soft rounded-square backdrop (the reference Add button). */
.tw-dw-btn.hamly-btn > svg.icon-tabler,
.tw-dw-btn.tw-dw-btn-primary > svg.icon-tabler {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    padding: 4px;
    box-sizing: border-box;
    border-radius: 8px;
    background: rgba(255, 255, 255, .18);
    stroke-width: 3;
}

.btn.btn-primary > i.fa-plus:first-child,
.btn.hamly-btn > i.fa-plus:first-child,
.tw-dw-btn.hamly-btn > i.fa-plus:first-child,
.tw-dw-btn.tw-dw-btn-primary > i.fa-plus:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .18);
    font-size: 16px;
    font-weight: 900;
}

/* Round icon buttons (tw-dw-btn-circle) stay round: the colour rules above
   apply to them, the geometry ones must not. */
.tw-dw-btn-circle,
.tw-dw-btn-circle.tw-dw-btn-sm,
.tw-dw-btn-circle.hamly-btn,
.tw-dw-btn-circle.tw-dw-btn-success,
.tw-dw-btn-circle.tw-dw-btn-primary {
    border-radius: 9999px !important;
    padding: 0 !important;
}

.tw-dw-btn-circle:not(.tw-dw-btn-sm) {
    height: 3rem;
    min-height: 3rem;
    width: 3rem;
}

.tw-dw-btn-circle.tw-dw-btn-sm {
    height: 2rem;
    min-height: 2rem;
    width: 2rem;
}

/* =====================================================================
   Card-header tools (Business Settings "Search" and any header field)
   ===================================================================== */
/* A field placed in .box-tools sits in a shrink-to-fit block, and Bootstrap's
   .input-group is display:table, so the select2 inside (forced to 100% of
   its group) collapsed to the placeholder width. Give header fields a fixed
   380px box so every page's header search reads the same. */
.box-header .box-tools .form-group {
    margin: 0;
    width: 380px;
    max-width: 100%;
}

.box-header .box-tools .input-group {
    display: block;
    width: 100%;
}

.box-header .box-tools .input-group > .form-control,
.box-header .box-tools .input-group > .select2-container {
    display: block;
    width: 100% !important;
    float: none;
}

/* Phones: the tools float right and size to their 380px field, so on a narrow
   card the field spilled out to the left (Add Sale's location cut off). Below
   768px the field goes under the title, across the card. */
@media (max-width: 767px) {
    .box-header .box-tools {
        float: none !important;
        position: static !important;
        width: 100%;
        margin-top: 10px;
    }

    .box-header .box-tools .form-group {
        width: 100%;
        min-width: 0 !important;
    }
}

/* =====================================================================
   Page titles - the list-page header card, everywhere
   Pages built on the AdminLTE <section class="content-header"><h1>Title
   <small>note</small></h1> get the same white card as list_header.
   ===================================================================== */
.content-header {
    background: #fff !important;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-card);
    margin: 15px 24px 0 !important;
    padding: 20px 22px 16px;
}

.content-header > h1 {
    margin: 0;
    font-size: 32px !important;
    font-weight: 700 !important;
    color: var(--ui-brand-dark) !important;
    line-height: 1.2;
}

.content-header > h1 > small {
    display: block;
    margin: 12px 0 0 10px;
    font-size: 15px !important;
    font-weight: 400 !important;
    color: var(--ui-ink) !important;
    line-height: 1.5;
}

.content-header .breadcrumb {
    display: none;
}

/* Buttons that lead with an icon (Add, Import ...) show it the way the
   list-page Add button does: a 22px glyph on the text's centre line, 8px
   before the label. */
.btn:has(> i.fa:first-child, > i.fas:first-child, > i.far:first-child),
.tw-dw-btn:has(> i.fa:first-child, > i.fas:first-child, > i.far:first-child) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:has(> i.fa:first-child, > i.fas:first-child, > i.far:first-child) > i,
.tw-dw-btn:has(> i.fa:first-child, > i.fas:first-child, > i.far:first-child) > i {
    margin: 0;
}

.btn-block:has(> i.fa:first-child, > i.fas:first-child, > i.far:first-child) {
    display: flex;
    width: 100%;
}

/* transient class used while measuring a table's natural width */
table.hamly-measure,
table.hamly-measure th,
table.hamly-measure td {
    white-space: nowrap !important;
}

/* =====================================================================
   DataTables "Column visibility" list - styled like the select lists
   ===================================================================== */
.dt-button-collection,
ul.dt-button-collection.dropdown-menu {
    background: #fff !important;
    border: 1px solid var(--ui-line) !important;
    border-radius: var(--ui-radius-group) !important;
    padding: 6px !important;
    min-width: 230px;
    box-shadow: 0 10px 24px rgba(13, 43, 26, .12) !important;
}

.dt-button-collection .dt-button {
    display: flex !important;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0 !important;
    padding: 8px 12px !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--ui-ink) !important;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    line-height: 1.3;
    cursor: pointer;
}

/* a small check box shows which columns are on */
/* the link inside the row carries no box of its own */
ul.dt-button-collection > li.dt-button > a {
    display: inline !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    height: auto !important;
    min-height: 0 !important;
    line-height: inherit !important;
    background: transparent !important;
    color: inherit !important;
    font: inherit;
    text-decoration: none;
}

.dt-button-collection .dt-button.buttons-columnVisibility::before {
    content: '';
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--ui-line);
    border-radius: 4px;
    background: #fff;
}

.dt-button-collection .dt-button.buttons-columnVisibility.active::before {
    border-color: var(--ui-brand);
    background: var(--ui-brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5l9 -10'/%3E%3C/svg%3E") center / 11px no-repeat;
}

.dt-button-collection .dt-button:hover,
.dt-button-collection .dt-button:focus,
ul.dt-button-collection > li.dt-button:hover > a,
ul.dt-button-collection > li.dt-button:focus > a {
    background: var(--ui-gold) !important;
    color: var(--ui-brand-dark) !important;
}

/* =====================================================================
   Form action card - the purchase form's Save card, on every form
   ===================================================================== */
.form-actions-card {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-card);
    padding: 16px 20px;
    margin: 16px 0 24px;
    text-align: right;
    box-shadow: none !important;
}

.form-actions-card > .tw-p-2,
.form-actions-card > .tw-p-3,
.form-actions-card .tw-flow-root,
.form-actions-card .tw-py-2 {
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
    text-align: right;
}

.form-actions-card button,
.form-actions-card input[type="submit"],
.form-actions-card .btn,
.form-actions-card .tw-dw-btn {
    background: var(--ui-brand-dark) !important;
    border: 1px solid var(--ui-brand-dark) !important;
    color: #fff !important;
    border-radius: 12px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 30px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    float: none !important;
    margin: 0 !important;
    width: auto !important;
}

/* a button a page script hides (jQuery .hide() / .toggle(), the hidden
   attribute, .hide) stays hidden: the inline-flex above is !important */
.form-actions-card button[style*="display: none"],
.form-actions-card button[style*="display:none"],
.form-actions-card .btn[style*="display: none"],
.form-actions-card .btn[style*="display:none"],
.form-actions-card .tw-dw-btn[style*="display: none"],
.form-actions-card .tw-dw-btn[style*="display:none"],
.form-actions-card input[type="submit"][style*="display: none"],
.form-actions-card [hidden],
.form-actions-card .hide {
    display: none !important;
}

.form-actions-card button:hover,
.form-actions-card .btn:hover,
.form-actions-card .tw-dw-btn:hover {
    background: var(--ui-brand) !important;
    border-color: var(--ui-brand) !important;
}

/* secondary actions beside the main Save (Save & add another, Save & add
   opening stock ...): outlined in brand green; the gold "Save and print"
   keeps its gold */
.form-actions-card .bg-purple,
.form-actions-card .bg-maroon,
.form-actions-card .btn-default,
.form-actions-card .tw-dw-btn-outline {
    background: #fff !important;
    border: 1px solid var(--ui-brand) !important;
    color: var(--ui-brand-dark) !important;
}

.form-actions-card .bg-purple:hover,
.form-actions-card .bg-maroon:hover,
.form-actions-card .btn-default:hover,
.form-actions-card .tw-dw-btn-outline:hover {
    background: #e8f1eb !important;
    color: var(--ui-brand-dark) !important;
}

.form-actions-card .tw-dw-btn-success {
    background: var(--ui-gold) !important;
    border-color: var(--ui-gold) !important;
    color: var(--ui-brand-dark) !important;
}

/* An actions card that could not be lifted clear of the card it belongs to
   draws a second bordered strip inside that card. It happens whenever the
   form itself lives inside a card rather than around one: one tab panel of a
   multi-tab page (Accounting Settings, ZATCA onboarding, a task's comment
   and upload forms) or inside a widget (the budget form). Those pages cannot
   hoist the button out - it would leave its own <form>, or show a Save that
   belongs to a tab the user is not looking at.

   Nested, it stops pretending to be a card and becomes the panel's own
   footer: no border, no fill, one hairline above it. Same buttons, same
   right alignment, same size. A card placed AFTER its fields card - which is
   what the app does whenever it can - is a sibling, not a descendant, so it
   is untouched and keeps the full card. */
.tab-pane .form-actions-card,
.box .form-actions-card,
[class*="tw-rounded-xl"] .form-actions-card {
    border: 0;
    border-top: 1px solid var(--ui-line);
    border-radius: 0;
    background: transparent;
    padding: 16px 0 0;
    margin: 20px 0 0;
}

/* =====================================================================
   Buttons inside table cells (row actions) - one compact size, aligned
   ===================================================================== */
.table td .btn,
.table td .tw-dw-btn {
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    vertical-align: middle !important;
    margin: 2px 4px 2px 0 !important;
    box-shadow: none !important;
    transform: none !important;
}

.table td .btn-primary,
.table td .tw-dw-btn-primary {
    background: var(--ui-brand) !important;
    border-color: var(--ui-brand) !important;
    color: #fff !important;
}

.table td .btn-primary:hover,
.table td .tw-dw-btn-primary:hover {
    background: var(--ui-brand-dark) !important;
    border-color: var(--ui-brand-dark) !important;
}

.table td .btn i,
.table td .tw-dw-btn i {
    font-size: 12px;
    margin: 0;
}

/* an action cell keeps its buttons on one line (the column fit already
   guarantees the room) */
.table tbody td:has(> .btn),
.table tbody td:has(> .btn-group),
.table tbody td:has(> a.btn) {
    white-space: nowrap;
}

/* =====================================================================
   Scrollbars - slim, rounded, app-wide (page, cards, tables, menus)
   ===================================================================== */
* {
    scrollbar-width: thin;
    scrollbar-color: #c3ccc7 transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c3ccc7;
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ui-brand);
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* =====================================================================
   Dashboards (home, asset, CRM, accounting, project ...) - stat cards,
   section headings and panels in the brand palette
   ===================================================================== */
/* stat card: soft-green icon tile, quiet label, bold dark-green value */
.tw-ring-1.tw-rounded-xl > .tw-p-4 > .tw-flex > .tw-inline-flex.tw-rounded-full,
.tw-ring-1.tw-rounded-xl > .tw-p-4 > .tw-flex > .tw-inline-flex[class*="tw-bg-"] {
    background: #e8f1eb !important;
    color: var(--ui-brand) !important;
    border-radius: 12px !important;
    width: 46px !important;
    height: 46px !important;
}

.tw-ring-1.tw-rounded-xl > .tw-p-4 > .tw-flex > .tw-inline-flex svg {
    width: 22px;
    height: 22px;
    stroke: var(--ui-brand);
    color: var(--ui-brand);
}

.tw-ring-1.tw-rounded-xl p.tw-text-sm.tw-font-medium.tw-text-gray-500 {
    color: var(--ui-muted) !important;
    font-size: 13px !important;
    font-weight: 500;
    margin-bottom: 2px;
}

.tw-ring-1.tw-rounded-xl p.tw-font-mono {
    font-family: inherit !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    color: var(--ui-brand-dark) !important;
    letter-spacing: 0;
    line-height: 1.2;
}

/* section headings: gold marker, dark-green title */
.tw-inline-block.tw-h-5.tw-w-1\.5.tw-rounded-full {
    background: var(--ui-gold) !important;
    height: 22px !important;
    width: 5px !important;
    border-radius: 4px !important;
}

.tw-flex.tw-items-center > h3.tw-text-lg.tw-font-bold,
h3.tw-text-lg.tw-font-bold.tw-text-gray-800 {
    color: var(--ui-brand-dark) !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    letter-spacing: 0;
}

/* every rounded card on these pages: the app's flat white card */
.content .tw-ring-1.tw-rounded-xl,
.content .tw-ring-gray-200 {
    border: 1px solid var(--ui-line) !important;
    border-radius: var(--ui-radius-card) !important;
    box-shadow: none !important;
    --tw-ring-shadow: 0 0 #0000 !important;
    --tw-ring-offset-shadow: 0 0 #0000 !important;
}

.content .tw-ring-1.tw-rounded-xl:hover {
    transform: none;
}

/* panel titles inside cards */
.content .tw-ring-1.tw-rounded-xl:not(.main-title) .box-title,
.content .tw-ring-1.tw-rounded-xl:not(.main-title) h3.box-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ui-brand-dark);
}

/* empty tables */
.content .table td.text-center:only-child,
.content .table td[colspan].text-center {
    color: var(--ui-muted);
    font-style: italic;
    padding: 22px 12px !important;
}

/* status labels (Expired / Expiring) */
.content .label.bg-red,
.content .label.bg-yellow,
.content .label.bg-green,
.content .label.bg-blue,
.content .label.bg-orange {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.content .label.bg-red { background: #fbeaea !important; color: #b93737 !important; }
.content .label.bg-yellow { background: #fbf3dc !important; color: #8a6d1f !important; }
.content .label.bg-green { background: #e8f1eb !important; color: var(--ui-brand-dark) !important; }
.content .label.bg-blue { background: #e9f0f8 !important; color: #2c5282 !important; }
.content .label.bg-orange { background: #fdeede !important; color: #a4541a !important; }

/* =====================================================================
   Dashboard widgets (HRM, Essentials, To-do ...) - icon titles, table
   section rows, amounts and helper rules
   ===================================================================== */
/* card title with a leading icon: icon in a small soft-green tile */
.box-header > i.fa,
.box-header > i.fas,
.box-header > i.far {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-right: 8px;
    border-radius: 9px;
    background: #e8f1eb;
    color: var(--ui-brand);
    font-size: 13px;
    vertical-align: middle;
}

.box-header > .box-title {
    vertical-align: middle;
}

/* "Today" / "Upcoming" section rows inside widget tables */
.table > thead > tr > th.bg-light-gray,
.table > tbody > tr > th.bg-light-gray,
.table th.bg-light-gray {
    background: #f4f7f4 !important;
    color: var(--ui-brand-dark) !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    border: 0 !important;
    border-radius: 8px;
    padding: 8px 12px !important;
    box-shadow: none !important;
}

/* widget tables: flat headers, no floating bars */
.content .tw-ring-1.tw-rounded-xl .table > thead > tr > th,
.content .box .table > thead > tr > th {
    background: transparent;
    box-shadow: none !important;
    border-top: 0;
}

.content .table.no-margin {
    margin-bottom: 0;
}

/* amounts highlighted in the widgets */
.content .tw-ring-1.tw-rounded-xl h4.text-success,
.content .box h4.text-success {
    color: var(--ui-brand) !important;
    font-size: 20px;
    font-weight: 700;
    margin: 4px 0 0;
}

/* dividers between dashboard blocks */
.content > hr,
.content .row > hr {
    border: 0;
    border-top: 1px solid var(--ui-line);
    margin: 6px 0 20px;
}

/* the gold secondary action (My Payrolls) sits with the cards, left-aligned */
.content .col-custom + .text-center,
.content .text-center > a.tw-dw-btn-success {
    text-align: left;
}

.content a.tw-dw-btn-success.tw-rounded-full,
.content button.tw-dw-btn-success.tw-rounded-full {
    height: 44px;
    min-height: 44px;
    padding: 0 22px;
    border-radius: 12px !important;
    font-size: 14px !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* =====================================================================
   Bootstrap "info" (cyan) accents -> brand palette
   buttons, view toggles, callouts, alerts, labels and badges
   ===================================================================== */
.btn-info,
.btn-info:focus {
    /* Was var(--ui-brand) #184d2c - so close to primary that the two were hard
       to tell apart. Now the same green as the DaisyUI `tw-dw-btn-info`
       buttons, so both info families match. White on this: 5.04:1. */
    background: var(--ui-btn-info) !important;
    border-color: var(--ui-btn-info) !important;
    color: #fff !important;
}

.btn-info:hover,
.btn-info.active,
.btn-group > .btn-info.active,
.btn-group.btn-group-toggle > .btn-info.active {
    background: var(--ui-btn-info-hover) !important;
    border-color: var(--ui-btn-info-hover) !important;
    color: #fff !important;
}

/* radio-style view switches (List view / Kanban board) - same green as every
   other info control: unselected reads like an outline info button, selected
   like a filled one. */
.btn-group[data-toggle="buttons"] > .btn-info,
.btn-group > label.btn-info {
    background: #fff !important;
    border: 1px solid var(--ui-btn-info) !important;
    color: var(--ui-btn-info-line) !important;   /* on white: 6.34:1 */
    height: 42px;
    padding: 0 16px !important;
    display: inline-flex !important;
    align-items: center;
    font-weight: 600;
    box-shadow: none !important;
}

.btn-group[data-toggle="buttons"] > .btn-info.active,
.btn-group > label.btn-info.active {
    background: var(--ui-btn-info) !important;   /* white on this: 5.04:1 */
    border-color: var(--ui-btn-info) !important;
    color: #fff !important;
}

.btn-group[data-toggle="buttons"] > .btn-info:hover,
.btn-group > label.btn-info:hover {
    border-color: var(--ui-btn-info-hover) !important;
    color: var(--ui-btn-info-hover) !important;
}

.btn-group[data-toggle="buttons"] > .btn-info.active:hover,
.btn-group > label.btn-info.active:hover {
    background: var(--ui-btn-info-hover) !important;
    border-color: var(--ui-btn-info-hover) !important;
    color: #fff !important;
}

.btn-group > .btn-info:first-child { border-radius: 10px 0 0 10px !important; }
.btn-group > .btn-info:last-child { border-radius: 0 10px 10px 0 !important; }

/* soft notice panels */
.callout.callout-info,
.alert.alert-info,
.bg-info:not(td):not(tr):not(.badge):not(.label),
.bg-aqua:not(td):not(tr) {
    background: #e8f1eb !important;
    color: var(--ui-brand-dark) !important;
    border: 1px solid #cfe0d5 !important;
    border-left: 4px solid var(--ui-gold) !important;
    border-radius: 12px !important;
}

.callout.callout-info h4,
.alert.alert-info h4,
.callout.callout-info a,
.alert.alert-info a {
    color: var(--ui-brand-dark) !important;
}

.callout.callout-warning,
.alert.alert-warning {
    background: #fbf3dc !important;
    color: #7a5f18 !important;
    border: 1px solid #ecdcae !important;
    border-left: 4px solid var(--ui-gold) !important;
    border-radius: 12px !important;
}

.alert.alert-success {
    background: #e8f1eb !important;
    color: var(--ui-brand-dark) !important;
    border: 1px solid #cfe0d5 !important;
    border-left: 4px solid var(--ui-brand) !important;
    border-radius: 12px !important;
}

.alert.alert-danger {
    background: #fbeaea !important;
    color: #9b2c2c !important;
    border: 1px solid #f1c9c9 !important;
    border-left: 4px solid #d64545 !important;
    border-radius: 12px !important;
}

.label-info,
.badge.bg-info,
.badge.bg-aqua,
td.bg-info,
tr.bg-info > td {
    background: #e8f1eb !important;
    color: var(--ui-brand-dark) !important;
}

/* =====================================================================
   Flat surfaces - no section shadows, no striped bands
   ===================================================================== */
.content [class*="tw-shadow-"],
.content-wrapper [class*="tw-shadow-"],
.content .box,
.content .panel,
.content .well,
.content .card {
    box-shadow: none !important;
}

.table-striped > tbody > tr:nth-of-type(odd),
.table-striped > tbody > tr:nth-of-type(odd) > td,
.table-striped > tbody > tr:nth-of-type(odd) > th {
    background-color: transparent;
}

/* =====================================================================
   DataTables toolbar (list pages): length menu | export buttons | search
   ===================================================================== */
/* One flex row so the 42px length select, the export buttons and the 42px
   search box share a centre line. The Bootstrap clearfix pseudo-elements
   would become stray flex items, so they are dropped here. */
.dataTables_wrapper > .row.dt-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 10px;
}

.dataTables_wrapper > .row.dt-toolbar::before,
.dataTables_wrapper > .row.dt-toolbar::after {
    display: none;
}

.dataTables_wrapper > .row.dt-toolbar > [class*="col-"] {
    float: none;
}

/* The length menu and search keep their natural width; the buttons take the
   rest so all five stay on one line at laptop widths. */
.dataTables_wrapper > .row.dt-toolbar > .col-sm-3 {
    width: auto;
    flex: 0 0 auto;
}

.dataTables_wrapper > .row.dt-toolbar > .col-sm-6 {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
}

.dataTables_wrapper .dataTables_filter input {
    min-width: 220px;
}

.dataTables_wrapper .dataTables_length {
    text-align: left;
}

.dataTables_wrapper .dataTables_length label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    white-space: nowrap;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_length select {
    width: auto;
    min-width: 86px;
}

.dataTables_wrapper .dataTables_length .select2-container {
    width: 96px !important;
}

.dataTables_wrapper .dt-buttons {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    float: none;
    vertical-align: middle;
}

.dataTables_wrapper .dt-buttons .tw-dw-btn,
.dataTables_wrapper .dt-buttons .dt-button {
    height: 36px;
    min-height: 36px;
    margin: 0 !important;
    padding: 0 12px;
    border-radius: 8px !important;
    font-size: 12px;
    font-weight: 600;
    color: var(--ui-brand-dark);
    border-color: var(--ui-line);
    background: #fff;
}

.dataTables_wrapper .dt-buttons .tw-dw-btn:hover,
.dataTables_wrapper .dt-buttons .dt-button:hover {
    background: var(--ui-brand) !important;
    border-color: var(--ui-brand) !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_filter {
    text-align: right;
}

.dataTables_wrapper .dataTables_filter label {
    display: block;
    margin: 0;
    width: 100%;
}

.dataTables_wrapper .dataTables_filter input {
    width: 100%;
    margin-left: 0;
}

/* =====================================================================
   Cards - the sales form's boxes
   ===================================================================== */
.box,
.box.box-solid,
.box.box-primary {
    background: #fff;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-card);
    box-shadow: none;
    margin-bottom: 18px;
}

.box > .box-body,
.box-body {
    padding: 18px 20px;
}

.box > .box-header {
    border: 0;
    padding: 16px 20px 0;
}

.box-body .form-group {
    margin-bottom: 16px;
}

.box-body > [class*="col-"] {
    padding-left: 10px;
    padding-right: 10px;
}

.box-body .input-group {
    width: 100%;
}

.box.box-primary,
.box.box-solid.box-primary > .box-header {
    border-top-color: var(--ui-brand);
}

/* =====================================================================
   Tabs (All Products / Stock Report, report tabs ...)
   The active tab takes the tour popup's "Where to find it" look: a soft
   grey-green panel with a gold left bar and dark-green bold text. Icons
   are quiet outline-weight glyphs, no box around them.
   ===================================================================== */
.nav-tabs-custom {
    background: #fff;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-card);
    box-shadow: none !important;
    margin-bottom: 18px;
}

.nav-tabs-custom > .nav-tabs,
.nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 12px;
    margin: 0;
    border-bottom: 1px solid var(--ui-line);
    background: transparent;
}

.nav-tabs > li {
    float: none;
    margin: 0;
}

.nav-tabs > li > a,
.nav-tabs-custom > .nav-tabs > li > a {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 9px 14px 9px 12px !important;
    border: 0 !important;
    border-left: 3px solid transparent !important;
    border-radius: 9px !important;
    background: transparent !important;
    color: var(--ui-muted);
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.3;
    transition: background-color .16s ease-in-out, color .16s ease-in-out, border-color .16s ease-in-out;
}

/* outline-weight icons, same colour as the label, nothing boxed */
.nav-tabs > li > a > i,
.nav-tabs > li > a > .fa,
.nav-tabs > li > a > .fas,
.nav-tabs > li > a > .far {
    font-weight: 400 !important;
    font-size: 14px;
    color: currentColor;
    background: none !important;
    border: 0 !important;
    padding: 0 !important;
    width: auto;
    height: auto;
}

.nav-tabs > li > a > svg {
    width: 16px;
    height: 16px;
    stroke: currentColor !important;
    stroke-width: 1.75 !important;
    fill: none !important;
    color: inherit;
}

.nav-tabs > li > a:hover,
.nav-tabs > li > a:focus,
.nav-tabs-custom > .nav-tabs > li > a:hover {
    background: #f4f7f4 !important;
    color: var(--ui-brand-dark);
    border-left-color: #d9d3c3 !important;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus,
.nav-tabs-custom > .nav-tabs > li.active > a {
    background: #f4f7f4 !important;
    color: var(--ui-brand-dark) !important;
    font-weight: 700 !important;
    border-left-color: var(--ui-gold) !important;
    border-top: 0 !important;
}

.nav-tabs-custom > .nav-tabs > li.active {
    border-top: 0 !important;
}

.nav-tabs > li.active > a > i,
.nav-tabs > li.active > a > .fa {
    color: var(--ui-brand);
}

.nav-tabs > li.active > a > svg {
    stroke: var(--ui-brand) !important;
}

.nav-tabs-custom > .tab-content {
    padding: 16px 18px;
    border-radius: 0 0 var(--ui-radius-card) var(--ui-radius-card);
}

/* =====================================================================
   DataTables "Processing..." - a floating brand pill with a spinner
   ===================================================================== */
.dataTables_processing {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
    width: auto !important;
    margin: 0 !important;
    padding: 10px 18px !important;
    display: none;
    align-items: center;
    gap: 10px;
    background: #fff !important;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(13, 43, 26, .14);
    color: var(--ui-brand-dark) !important;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 20;
}

.dataTables_processing[style*="display: block"] {
    display: inline-flex !important;
}

.dataTables_processing::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #e8f1eb;
    border-top-color: var(--ui-brand);
    border-radius: 50%;
    animation: hamly-spin .8s linear infinite;
}

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

.dataTables_wrapper {
    position: relative;
}

/* Tables read cleaner with a lighter rule. */
.table > thead > tr > th {
    border-bottom: 1px solid var(--ui-line);
    color: var(--ui-ink);
    font-weight: 700;
}

.table > tbody > tr > td {
    border-top: 1px solid #f0f2f1;
}

/* Modal footers: compact Save / Close so dialogs do not end in oversized buttons. */
.modal-footer .tw-dw-btn,
.modal-footer .tw-dw-btn.hamly-btn,
.modal-footer .tw-dw-btn.tw-dw-btn-primary,
.modal-footer .tw-dw-btn.tw-dw-btn-neutral {
    min-height: 40px !important;
    height: 40px !important;
    padding: 8px 24px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    display: inline-flex;
    align-items: center;
}

/* =====================================================================
   Confirmation dialogs (SweetAlert) - app-wide look: rounded card, brand
   coloured buttons, calmer icon colours, readable text.
   ===================================================================== */
.swal-overlay {
    background: rgba(17, 24, 39, .55);
}
.swal-modal {
    border-radius: 16px;
    padding: 28px 28px 22px;
    width: 440px;
    max-width: calc(100% - 32px);
    box-shadow: 0 20px 45px rgba(0, 0, 0, .18);
}
.swal-icon {
    margin: 4px auto 18px;
    transform: scale(.85);
}
.swal-icon--info {
    border-color: var(--ui-brand);
}
.swal-icon--info:before,
.swal-icon--info:after {
    background-color: var(--ui-brand);
}
.swal-icon--warning {
    border-color: var(--ui-gold);
}
.swal-icon--warning__body,
.swal-icon--warning__dot {
    background-color: var(--ui-gold);
}
.swal-icon--success__ring {
    border-color: var(--ui-brand);
}
.swal-icon--success__line {
    background-color: var(--ui-brand);
}
.swal-title {
    margin: 0 0 8px;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}
.swal-text {
    margin: 0 auto;
    padding: 0 4px;
    max-width: 100%;
    text-align: center;
    font-size: 14px;
    line-height: 1.55;
    color: #4b5563;
}
.swal-content {
    margin-top: 12px;
}
.swal-content .swal-content__input {
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 9px 12px;
    font-size: 14px;
}
.swal-footer {
    margin-top: 20px;
    padding: 0;
    text-align: center;
}
.swal-button-container {
    margin: 0 6px;
}
.swal-button {
    border-radius: 12px !important;
    padding: 10px 26px;
    font-size: 14px;
    font-weight: 600;
    min-width: 110px;
    box-shadow: none !important;
    transition: background-color .16s ease-in-out, transform .16s ease-in-out;
}
.swal-button--confirm {
    background-color: var(--ui-brand-dark) !important;
    color: #fff !important;
}
.swal-button--confirm:hover,
.swal-button--confirm:focus {
    background-color: var(--ui-brand) !important;
    transform: translateY(-1px);
}
/* dangerMode confirms stay red - they are the destructive ones - but it is
   the theme's own red, the same one every Delete button uses. */
.swal-button--danger {
    background-color: var(--ui-btn-error, #c62828) !important;
    color: #fff !important;
}
.swal-button--danger:hover,
.swal-button--danger:focus {
    background-color: #a31f1f !important;
}
.swal-button--cancel {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
}
.swal-button--cancel:hover,
.swal-button--cancel:focus {
    background-color: #e5e7eb !important;
}
.swal-button:focus {
    outline: none;
}

/* =====================================================================
   Dashboard / card rows: columns that hold cards line up and stretch to
   the same height, so cards with different content never leave holes
   (floated columns wrap under the tallest card). Header action rows keep
   their buttons on one aligned line.
   ===================================================================== */
.content .row:has(> [class*="col-"] > .box-primary),
.content .row:has(> [class*="col-"] > .box-solid),
.content .row:has(> [class*="col-"] > .box),
.content .row:has(> [class*="col-"] > .small-box),
.content .row:has(> [class*="col-"] > .info-box) {
    display: flex;
    flex-wrap: wrap;
}
.content .row:has(> [class*="col-"] > .box-primary) > [class*="col-"],
.content .row:has(> [class*="col-"] > .box-solid) > [class*="col-"],
.content .row:has(> [class*="col-"] > .box) > [class*="col-"],
.content .row:has(> [class*="col-"] > .small-box) > [class*="col-"],
.content .row:has(> [class*="col-"] > .info-box) > [class*="col-"] {
    display: flex;
    flex-direction: column;
}
/* Those flex rows drop Bootstrap's own stacking: below its breakpoint a
   col-md-* column has no width and would shrink to its content (a header
   card narrower than the page). Give stacked columns the full width again. */
@media (max-width: 991px) {
    .content .row > [class*="col-md-"]:not([class*="col-sm-"]):not([class*="col-xs-"]),
    .content .row > [class*="col-lg-"]:not([class*="col-md-"]):not([class*="col-sm-"]):not([class*="col-xs-"]) {
        width: 100%;
    }
}
@media (max-width: 767px) {
    .content .row > [class*="col-sm-"]:not([class*="col-xs-"]) {
        width: 100%;
    }
}
.content .row > [class*="col-"] > .box-primary,
.content .row > [class*="col-"] > .box-solid,
.content .row > [class*="col-"] > .box,
.content .row > [class*="col-"] > .small-box,
.content .row > [class*="col-"] > .info-box {
    flex: 1 1 auto;
}
.box-header .box-tools .box-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    position: static;
}

/* =====================================================================
   Dropdowns drawn by libraries (Highcharts export menu, date range picker)
   follow the application theme instead of their default blue.
   ===================================================================== */
.highcharts-menu {
    border: 1px solid #e5e7eb !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .12) !important;
    padding: 6px 0 !important;
    background: #fff !important;
}
.highcharts-menu-item {
    padding: 7px 16px !important;
    font-size: 13px !important;
    color: #374151 !important;
    background: transparent !important;
}
.highcharts-menu-item:hover {
    background: var(--ui-brand-dark) !important;
    color: #fff !important;
}
.highcharts-button-box {
    fill: #f3f4f6;
    stroke: #e5e7eb;
    rx: 6;
    ry: 6;
}
.daterangepicker {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .12);
    font-family: inherit;
}
.daterangepicker .ranges li {
    border-radius: 8px;
    margin: 2px 6px;
    padding: 6px 12px;
    color: #374151;
}
.daterangepicker .ranges li:hover {
    background-color: #f3f4f6;
    color: #111827;
}
.daterangepicker .ranges li.active {
    background-color: var(--ui-brand-dark);
    color: #fff;
}
.daterangepicker td.active,
.daterangepicker td.active:hover {
    background-color: var(--ui-brand-dark);
    color: #fff;
}
.daterangepicker td.in-range {
    background-color: #eef4f0;
    color: #111827;
}
.daterangepicker td.available:hover,
.daterangepicker th.available:hover {
    background-color: #e5e7eb;
}
.daterangepicker .drp-buttons .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 6px 16px;
}
.daterangepicker .drp-buttons .applyBtn {
    background-color: var(--ui-brand-dark);
    border-color: var(--ui-brand-dark);
    color: #fff;
}
.daterangepicker .drp-buttons .applyBtn:hover {
    background-color: var(--ui-brand);
    border-color: var(--ui-brand);
}
.dropdown-menu {
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .12);
    padding: 6px 0;
}
.dropdown-menu > li > a {
    padding: 6px 16px;
    color: #374151;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus,
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
    background-color: var(--ui-brand-dark);
    color: #fff;
}

/* Date range picker: the header partial paints every <th> white-on-dark, and the
   month / year selects sit inside a <th>, so they inherited white text and the
   browser drew their native list dark. Keep the whole calendar light. */
.daterangepicker .calendar-table th,
.daterangepicker .calendar-table td {
    color: #111827;
    background: transparent;
}
.daterangepicker .calendar-table th.month {
    font-weight: 700;
}
.daterangepicker .calendar-table select.monthselect,
.daterangepicker .calendar-table select.yearselect {
    color-scheme: light;
    background-color: #fff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 2px 4px;
    font-weight: 600;
}
.daterangepicker .calendar-table select.monthselect option,
.daterangepicker .calendar-table select.yearselect option {
    background-color: #fff;
    color: #111827;
}
.daterangepicker .calendar-table .next span,
.daterangepicker .calendar-table .prev span {
    border-color: #111827;
}
.daterangepicker td.active,
.daterangepicker td.active:hover {
    color: #fff;
}

/* Currency summary cards (Comparison Pricing, Multi Currency Overview) */
.currency-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
    border-top: 4px solid var(--ui-brand-dark, #184d2c);
    transition: all .3s ease;
}
.currency-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}
.currency-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.currency-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
}
.currency-header small {
    color: #999;
}
.currency-symbol {
    font-size: 32px;
    font-weight: bold;
    color: var(--ui-brand-dark, #184d2c);
}
.currency-metrics {
    margin-top: 10px;
}
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f1f1;
}
.metric-row:last-child {
    border-bottom: none;
}
.metric-row span {
    color: #666;
    font-size: 14px;
}
.metric-row strong {
    color: #222;
    font-size: 15px;
    font-weight: 600;
}
.currency-chart-wrap {
    position: relative;
    height: 300px;
    padding: 8px 4px 0;
}
.daterangepicker select.monthselect option:checked,
.daterangepicker select.monthselect option:hover,
.daterangepicker select.yearselect option:checked,
.daterangepicker select.yearselect option:hover {
    background: var(--ui-gold) linear-gradient(var(--ui-gold), var(--ui-gold));
    color: #fff;
}

/* =====================================================================
   Connector > Documentation (in-app API reference)
   ===================================================================== */
.api-docs .api-docs-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.api-docs .api-docs-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--ui-brand-soft); color: var(--ui-brand-dark); font-size: 12px; font-weight: 600; }
.api-docs .api-docs-pill code { background: transparent; color: inherit; padding: 0; font-size: 12px; }
.api-docs .api-docs-pill-link { background: #fff; border: 1px solid var(--ui-line-strong); color: var(--ui-brand); }
.api-docs .api-docs-pill-link:hover { border-color: var(--ui-gold); color: var(--ui-gold-dark); }
.api-docs .api-step { position: relative; padding: 16px 16px 12px 58px; border: 1px solid var(--ui-line); border-radius: var(--ui-radius-card); background: #fff; min-height: 128px; margin-bottom: 16px; }
.api-docs .api-step-no { position: absolute; left: 16px; top: 16px; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--ui-gold), var(--ui-gold-dark)); color: #fff; font-weight: 800; }
.api-docs .api-step h4 { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: var(--ui-brand-dark); }
.api-docs .api-step p { margin: 0; color: var(--ui-muted); font-size: 13px; line-height: 1.6; }
.api-docs .api-step p code, .api-docs .api-note code, .api-docs .api-endpoint-desc code { background: var(--ui-brand-soft); color: var(--ui-brand-dark); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.api-docs .api-code-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ui-muted); margin: 6px 0; }
.api-docs pre.api-code { background: #0f2419; color: #e6efe9; border-radius: 12px; padding: 14px 16px; font-size: 12.5px; line-height: 1.55; margin: 0 0 12px; white-space: pre-wrap; word-break: break-word; border: 0; }
.api-docs pre.api-code-response { max-height: 380px; overflow: auto; }
.api-docs .api-note { font-size: 13px; color: var(--ui-muted); margin: 6px 0 0; }
.api-docs .api-details { border: 1px solid var(--ui-line); border-radius: 10px; padding: 0; margin: 10px 0 0; background: #fff; }
.api-docs .api-details > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: 13px; color: var(--ui-brand); list-style: none; }
.api-docs .api-details > summary::-webkit-details-marker { display: none; }
.api-docs .api-details > summary::before { content: '\25B8'; display: inline-block; width: 16px; color: var(--ui-gold); }
.api-docs .api-details[open] > summary::before { content: '\25BE'; }
.api-docs .api-details > *:not(summary) { margin-left: 14px; margin-right: 14px; }
.api-docs .api-details > pre.api-code { margin-bottom: 14px; }
.api-docs .api-details > .row { margin-bottom: 8px; }
.api-docs .api-nav { background: #fff; border: 1px solid var(--ui-line); border-radius: var(--ui-radius-card); padding: 12px; }
.api-docs .api-nav-search { position: relative; margin-bottom: 10px; }
.api-docs .api-nav-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ui-icon); }
.api-docs .api-nav-search input { padding-left: 34px; }
.api-docs .api-nav-list { list-style: none; margin: 0; padding: 0; }
.api-docs .api-nav-list a { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 9px; color: var(--ui-ink); font-size: 13px; font-weight: 500; }
.api-docs .api-nav-list a:hover { background: var(--ui-bg); }
.api-docs .api-nav-list a.active { background: var(--ui-brand-dark); color: #fff; }
.api-docs .api-nav-count { font-size: 11px; background: var(--ui-brand-soft); color: var(--ui-brand-dark); border-radius: 999px; padding: 1px 8px; }
.api-docs .api-nav-list a.active .api-nav-count { background: var(--ui-gold); color: #fff; }
.api-docs .api-group-title { font-size: 20px; font-weight: 800; color: var(--ui-brand-dark); margin: 6px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--ui-gold); }
.api-docs .api-group-desc { color: var(--ui-muted); margin-bottom: 12px; }
.api-docs .api-endpoint { background: #fff; border: 1px solid var(--ui-line); border-radius: var(--ui-radius-card); padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 6px 18px rgba(13, 43, 26, .04); }
.api-docs .api-endpoint-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-docs .api-method { display: inline-block; min-width: 64px; text-align: center; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 800; letter-spacing: .04em; color: #fff; }
.api-docs .api-method-get { background: var(--ui-brand); }
.api-docs .api-method-post { background: var(--ui-gold); color: var(--ui-brand-dark); }
.api-docs .api-method-put { background: var(--ui-brand-dark); }
.api-docs .api-method-delete { background: #b23b3b; }
.api-docs .api-path { background: var(--ui-bg); color: var(--ui-ink); padding: 5px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.api-docs .api-copy { border: 1px solid var(--ui-line-strong); background: #fff; color: var(--ui-muted); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; }
.api-docs .api-copy:hover { color: var(--ui-gold-dark); border-color: var(--ui-gold); }
.api-docs .api-auth { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--ui-muted); }
.api-docs .api-endpoint-title { margin: 10px 0 4px; font-size: 16px; font-weight: 700; color: var(--ui-brand-dark); }
.api-docs .api-endpoint-desc { color: var(--ui-muted); font-size: 13px; margin-bottom: 8px; }
.api-docs .api-params-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ui-muted); margin: 12px 0 6px; }
.api-docs table.api-table { margin-bottom: 4px; font-size: 13px; }
.api-docs table.api-table > thead > tr > th { background: var(--ui-bg); color: var(--ui-brand-dark); font-weight: 700; border-bottom: 1px solid var(--ui-line); }
.api-docs table.api-table > tbody > tr > td { vertical-align: top; border-top: 1px solid #f0f2f1; }
.api-docs table.api-table code { background: var(--ui-brand-soft); color: var(--ui-brand-dark); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.api-docs .api-required { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; color: #b23b3b; }
.api-docs .api-type { font-size: 11px; font-weight: 600; color: var(--ui-muted); background: var(--ui-bg); padding: 2px 7px; border-radius: 6px; }
.api-docs .api-status { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; color: #fff; }
.api-docs .api-status-ok { background: var(--ui-brand); }
.api-docs .api-status-err { background: #b23b3b; }
.api-docs .api-empty { padding: 18px; background: #fff; border: 1px dashed var(--ui-line-strong); border-radius: var(--ui-radius-card); color: var(--ui-muted); }
@media (max-width: 991px) { .api-docs .api-nav { margin-bottom: 14px; } }

.api-docs .api-permission { font-size: 12px; color: var(--ui-muted); margin: 0 0 8px; }
.api-docs .api-permission code { background: var(--ui-warn-wash, #fff8e1); color: var(--ui-warn-ink, #8a5a00); padding: 1px 6px; border-radius: 5px; font-size: 11.5px; }
.api-docs .api-permission span { font-style: italic; }

/* =====================================================================
   Button legibility fixes
   ---------------------------------------------------------------------
   Three defects, all visible on the "View Payments" modal's Add payment
   button and repeated across the app:

   1. CLIPPED LABELS. The brand rules above paint `.hamly-btn`,
      `.tw-dw-btn-primary` and `.tw-dw-btn-success` with `padding: 11px 30px`
      at every size, but DaisyUI pins `.tw-dw-btn-xs` to a fixed
      height/min-height of 1.5rem and `.tw-dw-btn-sm` to 2rem. 24px box minus
      22px of vertical padding leaves a 0px content box for 12px text, so the
      label spills outside the filled area and is unreadable. Measured on the
      real sheets: xs+primary and xs+success = 0px content box; sm+primary and
      sm+success = 14px for 14px text (descenders clip).
      Fixed by letting the small sizes grow with their content instead of
      fighting a fixed height.

   2. FLOAT NOT CONTAINED. `pull-right` buttons sit alone inside a
      `.col-*`. Bootstrap clearfixes `.row` but not the columns, so the column
      collapses (measured: 1px tall) and the next row is painted straight over
      the button - that is what hides the Add payment label behind the payments
      table.

   3. CONTRAST. DaisyUI's stock warning/info/error fills and the brand gold
      carry white text: gold 2.29:1, info 2.32:1, error 3.08:1, warning
      1.66:1 - all below the 4.5:1 WCAG AA minimum for body-size text, and the
      outline variants repeat the same colours as text on white.
      Light fills keep their colour and take dark ink; dark-enough fills keep
      white. Ratios are noted per rule.

   `.tw-dw-btn-primary` is deliberately left as the theme paints it - solid
   brand green with white text reads at 15.24:1, so only its geometry was
   wrong.
   ===================================================================== */

:root {
    --ui-btn-info:      #2f7d4f;   /* white on this: 5.02:1 - brand green, one step
                                     lighter than primary so the two stay distinct.
                                     Matches the legacy .btn-info remap further up,
                                     which already points Bootstrap cyan at the brand. */
    --ui-btn-info-line: #1d6b3f;   /* outline text on white: 6.34:1 */
    --ui-btn-info-hover:#245f3c;   /* white on this: 7.22:1 */
    --ui-line-soft:     #cfe0d5;   /* soft brand-tinted hairline for outlined controls */
    --ui-btn-error:   #c62828;   /* white on this: 5.31:1 */
    --ui-btn-warn:    #ffbe00;   /* DaisyUI's amber, kept - now with dark ink */
    --ui-btn-warn-ink:#3a2b00;   /* on the amber above: 9.42:1 */
    --ui-btn-warn-line:#8a5a00;  /* outline/warning text on white: 5.74:1 */
    --ui-btn-gold-line:#6f5718;  /* outline/success text on white: 6.93:1 */
}

/* --- 1. Small sizes grow with their content -------------------------- */
.tw-dw-btn.tw-dw-btn-xs.hamly-btn,
.tw-dw-btn.tw-dw-btn-xs.tw-dw-btn-primary,
.tw-dw-btn.tw-dw-btn-xs.tw-dw-btn-success {
    height: auto;
    min-height: 26px;
    padding: 4px 12px;
    font-size: 12px;
    line-height: 1.45;
    border-radius: 8px !important;
}

.tw-dw-btn.tw-dw-btn-sm.hamly-btn,
.tw-dw-btn.tw-dw-btn-sm.tw-dw-btn-primary,
.tw-dw-btn.tw-dw-btn-sm.tw-dw-btn-success {
    height: auto;
    min-height: 34px;
    padding: 7px 16px;
    line-height: 1.45;
}

/* --- 2. Contain floated buttons -------------------------------------- */
[class*="col-"]:has(> .pull-right),
[class*="col-"]:has(> .pull-left),
.box-header:has(> .pull-right),
.box-header:has(> .pull-left) {
    display: flow-root;
}

/* --- 3. Readable fills ------------------------------------------------ */
/* Brand gold keeps its colour; white on gold is 2.29:1, brand ink is 7.02:1.
   Matches `.api-method-post`, which already pairs gold with brand ink. */
.tw-dw-btn.tw-dw-btn-success,
.tw-dw-btn.tw-dw-btn-success.tw-text-white {
    color: var(--ui-brand-dark) !important;
}

.tw-dw-btn.tw-dw-btn-warning:not(.tw-dw-btn-outline),
.tw-dw-btn.tw-dw-btn-warning:not(.tw-dw-btn-outline).tw-text-white {
    background-color: var(--ui-btn-warn) !important;
    border-color: var(--ui-btn-warn) !important;
    color: var(--ui-btn-warn-ink) !important;
}

.tw-dw-btn.tw-dw-btn-info:not(.tw-dw-btn-outline),
.tw-dw-btn.tw-dw-btn-info:not(.tw-dw-btn-outline).tw-text-white {
    background-color: var(--ui-btn-info) !important;
    border-color: var(--ui-btn-info) !important;
    color: #fff !important;
}

.tw-dw-btn.tw-dw-btn-info:not(.tw-dw-btn-outline):hover,
.tw-dw-btn.tw-dw-btn-info:not(.tw-dw-btn-outline):focus {
    background-color: var(--ui-btn-info-hover) !important;
    border-color: var(--ui-btn-info-hover) !important;
    color: #fff !important;
}

.tw-dw-btn.tw-dw-btn-error:not(.tw-dw-btn-outline),
.tw-dw-btn.tw-dw-btn-error:not(.tw-dw-btn-outline).tw-text-white {
    background-color: var(--ui-btn-error) !important;
    border-color: var(--ui-btn-error) !important;
    color: #fff !important;
}

/* --- 3b. Readable outlines (these really do render transparent) ------- */
.tw-dw-btn.tw-dw-btn-outline.tw-dw-btn-error {
    color: var(--ui-btn-error);
    border-color: var(--ui-btn-error);
}

.tw-dw-btn.tw-dw-btn-outline.tw-dw-btn-info {
    color: var(--ui-btn-info-line);
    border-color: var(--ui-btn-info);
}

.tw-dw-btn.tw-dw-btn-outline.tw-dw-btn-warning {
    color: var(--ui-btn-warn-line);
    border-color: var(--ui-btn-warn-line);
}

/* outline+success is painted solid gold by the brand rule above, so it needs
   the ink treatment rather than an outline colour. */
.tw-dw-btn.tw-dw-btn-outline.tw-dw-btn-success {
    color: var(--ui-brand-dark) !important;
}

/* A bare `tw-dw-btn-outline` with no colour modifier defaults to DaisyUI's
   #A6ADBB - 2.25:1 on white. */
.tw-dw-btn.tw-dw-btn-outline:not(.hamly-btn):not(.tw-dw-btn-primary):not(.tw-dw-btn-secondary):not(.tw-dw-btn-accent):not(.tw-dw-btn-info):not(.tw-dw-btn-success):not(.tw-dw-btn-warning):not(.tw-dw-btn-error):not(.tw-dw-btn-neutral) {
    color: var(--ui-ink);
    border-color: var(--ui-line-strong);
}

/* Hover must stay readable too: DaisyUI fills the outline on hover and picks
   its own text colour from the stock palette. */
.tw-dw-btn.tw-dw-btn-outline.tw-dw-btn-error:hover,
.tw-dw-btn.tw-dw-btn-outline.tw-dw-btn-error:focus {
    background-color: var(--ui-btn-error) !important;
    border-color: var(--ui-btn-error) !important;
    color: #fff !important;
}

.tw-dw-btn.tw-dw-btn-outline.tw-dw-btn-info:hover,
.tw-dw-btn.tw-dw-btn-outline.tw-dw-btn-info:focus {
    background-color: var(--ui-btn-info-hover) !important;
    border-color: var(--ui-btn-info-hover) !important;
    color: #fff !important;
}

.tw-dw-btn.tw-dw-btn-outline.tw-dw-btn-warning:hover,
.tw-dw-btn.tw-dw-btn-outline.tw-dw-btn-warning:focus {
    background-color: var(--ui-btn-warn-line) !important;
    border-color: var(--ui-btn-warn-line) !important;
    color: #fff !important;
}

.tw-dw-btn.tw-dw-btn-outline:not(.hamly-btn):not(.tw-dw-btn-primary):not(.tw-dw-btn-secondary):not(.tw-dw-btn-accent):not(.tw-dw-btn-info):not(.tw-dw-btn-success):not(.tw-dw-btn-warning):not(.tw-dw-btn-error):not(.tw-dw-btn-neutral):hover {
    background-color: var(--ui-ink) !important;
    border-color: var(--ui-ink) !important;
    color: #fff !important;
}

/* The rounded "+" badge above is sized for the 46px list-page Add buttons
   (30px icon box); inside an xs/sm button it is taller than the button itself
   and pushed the Add payment control to 40px. Let the icon ride at text size
   on the small sizes. */
.tw-dw-btn-xs.hamly-btn > i.fa-plus:first-child,
.tw-dw-btn-xs.tw-dw-btn-primary > i.fa-plus:first-child,
.tw-dw-btn-sm.hamly-btn > i.fa-plus:first-child,
.tw-dw-btn-sm.tw-dw-btn-primary > i.fa-plus:first-child,
.tw-dw-btn-xs.hamly-btn > svg.icon-tabler,
.tw-dw-btn-xs.tw-dw-btn-primary > svg.icon-tabler,
.tw-dw-btn-sm.hamly-btn > svg.icon-tabler,
.tw-dw-btn-sm.tw-dw-btn-primary > svg.icon-tabler {
    width: auto;
    height: auto;
    flex: 0 0 auto;
    padding: 0;
    background: none;
    border-radius: 0;
    font-size: inherit;
}

.tw-dw-btn-xs.hamly-btn > svg.icon-tabler,
.tw-dw-btn-xs.tw-dw-btn-primary > svg.icon-tabler,
.tw-dw-btn-sm.hamly-btn > svg.icon-tabler,
.tw-dw-btn-sm.tw-dw-btn-primary > svg.icon-tabler {
    width: 1.1em;
    height: 1.1em;
}

/* --- 4. Legacy Bootstrap buttons ------------------------------------- */
/* Same audit over the `.btn-*` classes still in use: no clipping, but three
   fills fail AA with their white text / grey icon.
     .btn-success   #2dce89 + #fff = 2.04:1
     .btn-danger    #f5365c + #fff = 3.77:1
     .btn-box-tool  #97a0b3 on #fff = 2.63:1   (box collapse / remove icons) */
.btn-success,
.btn-success:focus {
    background-color: #157347 !important;   /* white on this: 6.02:1 */
    border-color: #157347 !important;
    color: #fff !important;
}

.btn-success:hover,
.btn-success:active {
    background-color: #10603a !important;
    border-color: #10603a !important;
    color: #fff !important;
}

.btn-danger,
.btn-danger:focus {
    background-color: var(--ui-btn-error) !important;   /* white on this: 5.31:1 */
    border-color: var(--ui-btn-error) !important;
    color: #fff !important;
}

.btn-danger:hover,
.btn-danger:active {
    background-color: #a51f1f !important;
    border-color: #a51f1f !important;
    color: #fff !important;
}

.btn-box-tool {
    color: var(--ui-muted);   /* on white: 4.83:1, was 2.63:1 */
}

.btn-box-tool:hover,
.btn-box-tool:focus {
    color: var(--ui-ink);
}

/* =====================================================================
   List tables too narrow for even their mandatory columns
   ---------------------------------------------------------------------
   __fitDataTable in public/js/app.js picks Action plus the two most
   important columns without a width test, so on a narrow card those few can
   still be wider than the room available. It used to pin the table to 100%
   anyway and the values wrapped over three or four lines. It now tags the
   wrapper instead and the values stay on one line, so the scrollX container
   the table already has gives the user a horizontal scrollbar.
   Both tables are covered: scrollX keeps the header in its own cloned table.
   ===================================================================== */
.dataTables_wrapper.hamly-overflow-scroll table > thead > tr > th,
.dataTables_wrapper.hamly-overflow-scroll table > tbody > tr > td {
    white-space: nowrap;
}

/* =====================================================================
   Radio-style toggle groups  .btn-group[data-toggle="buttons"]
   ---------------------------------------------------------------------
   The rules further up only dressed the .btn-info flavour (List view /
   Kanban board). The contact ledger's "Ledger format" switch is built from
   .btn-default labels, so it kept Bootstrap's grey buttons - and four of
   them inside a col-md-4 spilled onto a second line, where .btn-group's
   floats and negative margins made them sit on top of each other.

   Every toggle group now gets the same treatment: a wrapping flex row of
   individually rounded pills, unselected reading like an outline info
   button and selected like a filled one, matching the other info controls.
   Individually rounded rather than segmented precisely so that a wrapped
   second row still looks deliberate instead of broken.
   ===================================================================== */
.btn-group[data-toggle="buttons"] {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    vertical-align: middle;
}

.btn-group[data-toggle="buttons"] > .btn,
.btn-group[data-toggle="buttons"] > label.btn {
    float: none;
    margin: 0 !important;
    height: 38px;
    min-height: 38px;
    padding: 0 14px !important;
    display: inline-flex !important;
    align-items: center;
    background: #fff !important;
    /* A soft brand-tinted hairline rather than the full info green: at four
       pills in a row the saturated outline read louder than the labels. */
    border: 1px solid var(--ui-line-soft) !important;
    color: var(--ui-btn-info-line) !important;   /* on white: 6.34:1, unchanged */
    border-radius: 10px !important;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: none !important;
}

.btn-group[data-toggle="buttons"] > .btn.active,
.btn-group[data-toggle="buttons"] > label.btn.active {
    background: var(--ui-btn-info) !important;   /* white on this: 5.04:1 */
    border-color: var(--ui-btn-info) !important;
    color: #fff !important;
}

.btn-group[data-toggle="buttons"] > .btn:hover,
.btn-group[data-toggle="buttons"] > label.btn:hover {
    border-color: var(--ui-btn-info) !important;
    color: var(--ui-btn-info-hover) !important;
}

.btn-group[data-toggle="buttons"] > .btn.active:hover,
.btn-group[data-toggle="buttons"] > label.btn.active:hover {
    background: var(--ui-btn-info-hover) !important;
    border-color: var(--ui-btn-info-hover) !important;
    color: #fff !important;
}

/* =====================================================================
   .nav-tabs.nav-justified  (contact view, and 7 other tabbed pages)
   ---------------------------------------------------------------------
   The theme lays .nav-tabs out as a wrapping flex row, but Bootstrap's
   nav-justified still says

       .nav-justified > li { display: table-cell; width: 1% }

   A table-cell that is 1% wide inside a flex row collapses to almost
   nothing, so the tab labels were drawn on top of each other - "Ledger",
   "Documents & Notes" and "Contact Persons" all piled into the same spot.

   Bootstrap's justified sizing simply does not apply once the row is flex,
   so it is switched off here and the tabs size to their own labels.
   ===================================================================== */
.nav-tabs.nav-justified > li,
.nav-tabs-custom > .nav-tabs.nav-justified > li {
    display: block;
    width: auto;
    float: none;
    flex: 0 0 auto;
}

.nav-tabs.nav-justified > li > a,
.nav-tabs-custom > .nav-tabs.nav-justified > li > a {
    margin-bottom: 0;
    text-align: left;
    white-space: nowrap;
}

/* =====================================================================
   Close / Cancel buttons  (.tw-dw-btn-neutral)
   ---------------------------------------------------------------------
   The brand rules above dress .hamly-btn, .tw-dw-btn-primary and
   .tw-dw-btn-success, but never .tw-dw-btn-neutral - which is what every
   Close and Cancel button in the app uses. Sitting next to a primary or
   success button in a modal footer it was the odd one out: 8px corners
   against their 12px (heights and padding already agreed at 40px / 8px 24px).

   Only the shape is matched here. The neutral colour is deliberate - a
   dismissive action should not compete with the primary one - and the small
   sizes keep the 8px radius the rest of the xs/sm buttons use.
   ===================================================================== */
.tw-dw-btn.tw-dw-btn-neutral:not(.tw-dw-btn-sm):not(.tw-dw-btn-xs):not(.tw-dw-btn-circle) {
    /* Was a hardcoded 12px, which left a Close button rounder than the Save
       beside it. Shares the action radius now so a dialog's buttons match. */
    border-radius: var(--ui-action-radius, 10px) !important;
}

.tw-dw-btn.tw-dw-btn-neutral.tw-dw-btn-sm,
.tw-dw-btn.tw-dw-btn-neutral.tw-dw-btn-xs {
    border-radius: 8px !important;
}

/* =====================================================================
   Toasts
   ---------------------------------------------------------------------
   Toastr ships solid colour blocks with a white glyph baked in as a
   background-image. Restyled to the same quiet card the rest of the app
   uses - white, hairline border, one coloured edge and a coloured icon -
   so an alert reads as part of the product instead of a browser default.
   The type colours are the theme's own accessible tokens.
   ===================================================================== */
#toast-container > div {
    background-image: none !important;   /* drop toastr's baked-in white glyph */
    color: var(--ui-ink, #1f2937) !important;
    border: 1px solid var(--ui-line, #e6e8eb);
    border-left: 5px solid var(--ui-brand, #184d2c);
    border-radius: var(--ui-radius-card, 14px);
    box-shadow: 0 10px 30px rgba(17, 17, 26, .20) !important;
    opacity: 1 !important;
    padding: 15px 18px 15px 52px !important;
    width: 360px;
}

#toast-container > div:hover {
    box-shadow: 0 14px 38px rgba(17, 17, 26, .26) !important;
}

/* Our own icon, in the type's colour, where toastr's glyph used to sit. */
#toast-container > div::before {
    font-family: 'Font Awesome\ 5 Free';
    font-weight: 900;
    position: absolute;
    top: 14px;
    left: 17px;
    font-size: 21px;
    line-height: 1.2;
    color: var(--ui-brand, #184d2c);
}

/* Each type carries a light wash of its own colour. Enough presence to catch
   the eye at the edge of vision, without going back to the solid blocks. */
#toast-container > .toast-success {
    background-color: #eaf5ed !important;
    border-color: #b9dcc6;
    border-left-color: var(--ui-brand, #184d2c);
}
#toast-container > .toast-success::before { content: '\f058'; color: var(--ui-brand, #184d2c); }

#toast-container > .toast-error {
    background-color: #fdeceb !important;
    border-color: #f3c2bf;
    border-left-color: var(--ui-btn-error, #c62828);
}
#toast-container > .toast-error::before { content: '\f057'; color: var(--ui-btn-error, #c62828); }

#toast-container > .toast-warning {
    background-color: #fff8e1 !important;
    border-color: #f0c36d;
    border-left-color: var(--ui-btn-warn-line, #8a5a00);
}
#toast-container > .toast-warning::before { content: '\f06a'; color: var(--ui-btn-warn-line, #8a5a00); }

#toast-container > .toast-info {
    background-color: #eef4f1 !important;
    border-color: #c3ddce;
    border-left-color: var(--ui-btn-info, #2f7d4f);
}
#toast-container > .toast-info::before { content: '\f05a'; color: var(--ui-btn-info, #2f7d4f); }

#toast-container .toast-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ui-ink, #1f2937);
    margin-bottom: 2px;
}

#toast-container .toast-message {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--ui-ink, #1f2937);
}

#toast-container .toast-close-button {
    color: var(--ui-icon, #9aa1ab);
    text-shadow: none;
    opacity: 1;
    font-size: 16px;
    font-weight: 400;
    top: 2px;
    right: 2px;
}

#toast-container .toast-close-button:hover,
#toast-container .toast-close-button:focus {
    color: var(--ui-ink, #1f2937);
    opacity: 1;
}

#toast-container .toast-progress {
    background-color: currentColor;
    opacity: .25;
    height: 3px;
    border-radius: 0 0 0 4px;
}

/* =====================================================================
   One action-button language
   ---------------------------------------------------------------------
   Save / Update / Close / Cancel were each picking up whatever radius and
   colour their own class happened to carry, so the same pair of buttons
   looked different from one dialog to the next - a black Close in one
   modal, a bordered Cancel in another, and a different corner on each.
   These rules settle the shape and the secondary colour in one place; the
   primary colour still comes from the button's own class.
   ===================================================================== */

/* Same corner on every action button, wherever it lives. */
.modal-footer .tw-dw-btn,
.modal-footer .btn,
.swal-button,
.btn.hamly-btn,
.btn-primary,
.tw-dw-btn.hamly-btn {
    border-radius: var(--ui-action-radius) !important;
}

/* Footers read right-to-left in importance: the way out first, the commit
   last, whatever order the markup happens to put them in. */
.modal-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.modal-footer > .tw-dw-btn,
.modal-footer > .btn {
    margin: 0 !important;
}

.modal-footer > [data-dismiss='modal'],
.modal-footer > .tw-dw-btn-neutral,
.modal-footer > .btn-default {
    order: -1;
}

/* Close / Cancel: a quiet bordered button, not a second solid block.
   Global rather than modal-only: every tw-dw-btn-neutral in the app is a
   Close (46 of them) or a Cancel (9), so they should all read the same, and
   page form footers are exactly where the solid dark Cancel looked like a
   second primary action. The !important beats the tw-text-white utility these
   buttons carry in the markup. */
.tw-dw-btn.tw-dw-btn-neutral,
.modal-footer .btn.btn-default,
.swal-button--cancel {
    background-color: #fff !important;
    background-image: none !important;
    border: 1px solid var(--ui-line-strong, #d7dcd9) !important;
    color: var(--ui-ink, #1f2937) !important;
    box-shadow: none !important;
}

.tw-dw-btn.tw-dw-btn-neutral:hover,
.tw-dw-btn.tw-dw-btn-neutral:focus,
.modal-footer .btn.btn-default:hover,
.modal-footer .btn.btn-default:focus,
.swal-button--cancel:hover,
.swal-button--cancel:focus {
    background-color: var(--ui-bg, #f6f7f8) !important;
    border-color: var(--ui-brand, #184d2c) !important;
    color: var(--ui-brand-dark, #0d2b1a) !important;
}

/* The confirm dialog's own buttons line up with the modal ones. */
.swal-button {
    min-height: 40px;
    padding: 9px 24px !important;
}

.swal-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.swal-button-container { margin: 0 !important; }

/* =====================================================================
   Page loader
   ---------------------------------------------------------------------
   Shown only while the browser is actually leaving the page, and only if
   that takes longer than a moment - a fast navigation never flashes it.
   Deliberately cheap: no images, no extra request, no backdrop-filter,
   and the only animation is a transform, so it stays on the compositor
   and cannot cause layout or paint work while the next page loads. It
   reuses the hamly-spin keyframe and the brand pill the DataTables
   "Processing..." indicator already uses.
   ===================================================================== */
#app-loader {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(246, 247, 248, .72);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* Delaying the visibility change keeps it out of the way until shown. */
    transition: opacity .15s linear, visibility 0s linear .15s;
}

#app-loader.is-visible {
    opacity: 1;
    visibility: visible;
    /* Deliberately still none: the loader reports progress, it does not guard
       the page. Nothing it does can block a click, so even if it lingers the
       app stays usable. */
    pointer-events: none;
    transition-delay: 0s;
    /* Self-clearing, in case the script never runs - JavaScript disabled, or a
       syntax error in an earlier bundle. Generous, because a real page here can
       take half a minute to finish fetching its assets; this is a last resort,
       not the normal way it goes away. */
    animation: app-loader-timeout 0s linear 60s forwards;
}

@keyframes app-loader-timeout {
    to {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

#app-loader .app-loader__pill,
.hamly-block-loader .app-loader__pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #fff;
    border: 1px solid var(--ui-line);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(13, 43, 26, .16);
    color: var(--ui-brand-dark);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .2px;
    white-space: nowrap;
}

#app-loader .app-loader__spin,
.hamly-block-loader .app-loader__spin {
    width: 18px;
    height: 18px;
    border: 2px solid #e8f1eb;
    border-top-color: var(--ui-brand);
    border-radius: 50%;
    animation: hamly-spin .8s linear infinite;
}

#app-loader .app-loader__gold,
.hamly-block-loader .app-loader__gold { color: var(--ui-gold); }

@media (prefers-reduced-motion: reduce) {
    #app-loader .app-loader__spin,
    .hamly-block-loader .app-loader__spin { animation-duration: 2.4s; }
    #app-loader { transition: none; }
}

/* Never let it appear on a printed page. */
@media print {
    #app-loader { display: none !important; }
}

/* =====================================================================
   Loaders: one look across the app
   ---------------------------------------------------------------------
   Every spinning sync / spinner / refresh icon (report totals, table
   placeholders, buttons, POS product list) is drawn as the brand ring the
   page loader uses, so no page markup had to change. Inside a button the
   ring takes the button's text colour.

   A section that loads as a whole (e.g. the VAT return) shows the page
   loader's pill instead: markup from __block_loader() in functions.js.
   ===================================================================== */
i.fa-spin.fa-sync,
i.fa-spin.fa-spinner,
i.fa-spin.fa-refresh {
    display: inline-block;
    box-sizing: border-box;
    width: 1em;
    height: 1em;
    border: .15em solid #e8f1eb;
    border-top-color: var(--ui-brand);
    border-radius: 50%;
    vertical-align: -.125em;
    animation: hamly-spin .8s linear infinite;
}

i.fa-spin.fa-sync::before,
i.fa-spin.fa-spinner::before,
i.fa-spin.fa-refresh::before {
    content: none;
}

.btn i.fa-spin.fa-sync,
.btn i.fa-spin.fa-spinner,
.btn i.fa-spin.fa-refresh,
.tw-dw-btn i.fa-spin.fa-sync,
.tw-dw-btn i.fa-spin.fa-spinner,
.tw-dw-btn i.fa-spin.fa-refresh {
    border-color: currentColor;
    border-top-color: transparent;
}

.hamly-block-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

@media (prefers-reduced-motion: reduce) {
    i.fa-spin.fa-sync,
    i.fa-spin.fa-spinner,
    i.fa-spin.fa-refresh { animation-duration: 2.4s; }
}

/* =====================================================================
   Switch toggle and radio (theme colours) - used instead of plain
   checkboxes / radios on settings screens. Markup:
     <label class="ui-switch"><input type="checkbox" ...><span class="ui-switch-track"></span><span>Label</span></label>
     <input type="radio" class="ui-radio" ...>
   ===================================================================== */
.ui-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    color: var(--ui-ink);
    max-width: 100%;
}
.ui-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}
.ui-switch .ui-switch-track {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: var(--ui-line-strong);
    transition: background .15s ease;
}
.ui-switch .ui-switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: inset-inline-start .15s ease;
}
.ui-switch input:checked + .ui-switch-track { background: var(--ui-brand); }
.ui-switch input:checked + .ui-switch-track::after { inset-inline-start: 21px; }
.ui-switch input:focus-visible + .ui-switch-track { box-shadow: 0 0 0 3px var(--ui-brand-ring); }
.ui-switch input:disabled + .ui-switch-track { opacity: .5; cursor: not-allowed; }
.ui-switch .ui-switch-label { white-space: normal; overflow-wrap: anywhere; }
.ui-switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ui-line); }
.ui-switch-row:last-child { border-bottom: none; }
.ui-switch-row .help-block { margin: 2px 0 0; }

input[type="radio"].ui-radio {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 2px solid var(--ui-line-strong);
    border-radius: 50%;
    background: #fff;
    vertical-align: middle;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="radio"].ui-radio:checked {
    border-color: var(--ui-brand);
    background: radial-gradient(circle, var(--ui-brand) 0 45%, #fff 50%);
}
input[type="radio"].ui-radio:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ui-brand-ring); }
input[type="radio"].ui-radio:disabled { opacity: .5; cursor: not-allowed; }

/* Forms in modals never scroll sideways. */
.modal-body { overflow-x: hidden; }
.modal-body .select2-container { max-width: 100%; }

/* Add / Edit Sale: customer & sale details on a 3-column grid, so every row
   lines up whatever the height of the customer column (addresses). */
.sale-details-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.sale-details-grid > [class*="col-"] { width: auto !important; float: none !important; }
.sale-details-grid > .col-md-12, .sale-details-grid > .col-sm-12 { grid-column: 1 / -1; }
.sale-details-grid > .clearfix { display: none; }
@media (max-width: 991px) { .sale-details-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) { .sale-details-grid { grid-template-columns: minmax(0, 1fr); } }

/* Date / date-time / month / time fields always show their picker button.
   Bootstrap's .form-control:not(select) { appearance: none } (vendor.css) drops
   the browser's calendar button, so these fields could only be typed into.
   The button is drawn here (calendar, clock for time) and opens the picker;
   typing still works. functions.js also opens the picker on a click. */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    display: block;
    opacity: 1;
    width: 18px;
    height: 18px;
    margin-inline-start: 6px;
    cursor: pointer;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f7d4f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
}
input[type="time"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f7d4f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}
input[type="date"]:disabled::-webkit-calendar-picker-indicator,
input[type="datetime-local"]:disabled::-webkit-calendar-picker-indicator,
input[type="month"]:disabled::-webkit-calendar-picker-indicator,
input[type="week"]:disabled::-webkit-calendar-picker-indicator,
input[type="time"]:disabled::-webkit-calendar-picker-indicator { opacity: .4; cursor: not-allowed; }

/* =====================================================================
   [tax rate | method] box on sale, POS and purchase lines (2026-10-07):
   the line's tax on the left, how its price is entered (incl. / excl.
   VAT) on the right, as one control.
   ===================================================================== */
.le-tax-group,
.input-group.le-tax-group {
    display: flex !important; /* over the sale table's .input-group display: table */
    flex-wrap: nowrap;
    width: 100%;
}
.le-tax-group > select.form-control,
.le-tax-group > .select2-container {
    float: none;
    min-width: 0;
}
.le-tax-group > select.tax_id,
.le-tax-group > select.purchase_line_tax_id {
    min-width: 64px;
}
.le-tax-group > select.tax_id,
.le-tax-group > select.purchase_line_tax_id,
.le-tax-group > .select2-container {
    flex: 1 1 auto;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
.le-tax-group > select.row_tax_method,
.le-tax-group > select.purchase_tax_method {
    /* compact: the rate keeps the room ("Incl." / "Excl.") */
    flex: 0 0 68px;
    width: 68px;
    max-width: 68px;
    padding-left: 6px;
    padding-right: 4px;
    margin-left: -1px;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}
