@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
/* Galaxy Plastic overrides on top of gla's stylesheets. Loaded last. */

/* App font (gla ships Outfit). Digits are fixed-width so numbers line up in table columns. */
:root { --theme-fonts: 'Inter', sans-serif; }
body { font-variant-numeric: tabular-nums lining-nums; }
.btn, .btn.btn-sm, .btn.btn-xs, .btn.btn-action { border-radius: 4px !important; }

/* Card header tools (filters + buttons): one row, vertically centred, even gaps */
.card-header .card-tool { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.card-header .card-tool .btn + .btn { margin-left: 0; }
.card-header .card-tool .form-control { margin: 0; }

/* Row buttons that carry text next to the icon ("Details") stay on one line */
.btn.btn-action { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 13px; vertical-align: middle; }

/* List pages: status tabs on top, then one slim filter line (sales orders, production jobs) */
.status-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 15px; border-bottom: 1px solid #dee2e6; }
.status-tabs a { padding: 10px 14px; color: #6c757d; font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.status-tabs a:hover { color: var(--dark); }
.status-tabs a.active { color: var(--theme); border-bottom-color: var(--theme); }
.status-tabs a .count { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 4px; border-radius: 10px; background: var(--light-light); color: var(--dark); font-size: 11px; text-align: center; }
.status-tabs a.active .count { background: var(--theme); color: #fff; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 15px 0; }
.filter-bar .form-control, .filter-bar .select2-container { width: auto !important; min-width: 150px; height: 32px; margin: 0; }
.filter-bar .filter-search { flex: 1 1 220px; max-width: 320px; }
.filter-bar .select2-container { min-width: 220px; }
.filter-bar .select2-container .select2-selection--single { height: 32px; }
.filter-bar .filter-dates { display: none; align-items: center; gap: 6px; }
.filter-bar .filter-dates.show { display: flex; }
.filter-bar .filter-reset { font-size: 13px; }
.filter-bar .filter-summary { margin-left: auto; color: #6c757d; font-size: 13px; white-space: nowrap; }
/* the row "more" menu must not be clipped by the scrolling table wrapper on desktop */
@media (min-width: 992px) { .list-card .table-responsive { overflow: visible; } }
.list-card .dropdown-menu { font-size: 13px; }
.list-card .dropdown-item i { width: 18px; display: inline-block; }

/* Larger text than gla's defaults (was: table cells 12px, headers 13px, labels and small inputs 12px, small buttons 12px, badges 11px) */
.table-compact tbody tr td { font-size: 14px; }
.table-compact thead tr th, .table-compact tfoot tr th { font-size: 14px; }
.form-group label:not(.custom-control-label):not(.error), .form_wrap .form-group label:not(.custom-control-label):not(.error) { font-size: 13px; line-height: 16px; }
.form-control-sm, .form_wrap .form-control-sm { font-size: 14px; }
.btn-sm { font-size: 13px; }
.badge { font-size: 12px; }
.status-tabs a { font-size: 14px; }

/* One button colour everywhere (owner's choice: no colour coding by action).
   Save/submit and "new" buttons are solid blue; every other button is the same light blue. */
.btn:not(.btn-link) { background-color: var(--light-info) !important; border-color: var(--light-info) !important; color: var(--theme) !important; }
.btn:not(.btn-link):hover, .btn:not(.btn-link):focus { background-color: var(--light-hover-info) !important; border-color: var(--light-hover-info) !important; color: var(--theme) !important; }
.btn.btn-theme, .btn[type=submit] { background-color: var(--theme) !important; border-color: var(--theme) !important; color: #fff !important; }
.btn.btn-theme:hover, .btn.btn-theme:focus, .btn[type=submit]:hover, .btn[type=submit]:focus { background-color: #0f4a96 !important; border-color: #0f4a96 !important; color: #fff !important; }

/* Section headings inside cards (e.g. "Order Items") match the card title size */
.card-body > h5, .card-body > h6 { font-size: 15px; font-weight: 500; margin-bottom: 10px; }

/* Read-only / edit switch on detail pages: the form carries .view-mode until "Edit" is pressed */
.view-mode .edit-only { display: none !important; }
form:not(.view-mode) .view-only { display: none !important; }

/* Sales order page: key numbers strip and customer panel */
.order-summary { display: flex; flex-wrap: wrap; border-bottom: 1px solid #dee2e6; }
.order-summary > div { flex: 1 1 120px; padding: 8px 15px; border-right: 1px solid #dee2e6; }
.order-summary > div:last-child { border-right: 0; }
.order-summary b { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
.order-summary span { color: #6c757d; font-size: 12px; }
.order-customer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; padding: 12px 15px; background: var(--light-dark); border-bottom: 1px solid #dee2e6; }
.order-customer .order-customer-select { flex: 0 1 460px; }
.order-customer .order-customer-select select { flex: 1; min-width: 0; }
.order-customer-details { display: flex; flex-wrap: wrap; gap: 4px 18px; padding-bottom: 6px; }
.order-customer-details i { color: #6c757d; }
.order-customer .order-customer-select .select2-container { flex: 1; min-width: 0; width: auto !important; }

/* Popup forms: label above the box everywhere (owner's choice; the label-left rows were removed) */
.card-iframe > form > .card-body { padding: 15px 20px 8px; }
.card-iframe > form > .card-footer { padding: 10px 20px; }

/* Drawn icons for actions gla's icon font has no glyph for; sized like the font icons */
.btn .icon-svg { width: 17px; height: 17px; display: block; }

/* The one colour exception: delete buttons are red, both record deletes (.execute-record) and remove-row buttons in forms */
.btn.delete-row, .btn.delete-item-row, .btn.delete-part-row,
.btn.execute-record { background-color: var(--light-danger) !important; border-color: var(--light-danger) !important; color: var(--danger) !important; }
.btn.delete-row:hover, .btn.delete-row:focus, .btn.delete-item-row:hover, .btn.delete-item-row:focus, .btn.delete-part-row:hover, .btn.delete-part-row:focus,
.btn.execute-record:hover, .btn.execute-record:focus { background-color: var(--light-hover-danger) !important; border-color: var(--light-hover-danger) !important; color: var(--danger) !important; }

/* Search suggestions: a clear floating panel above the page content, not text blending into the table below */
.ui-autocomplete.ui-menu { background: #fff !important; border: 1px solid #c9d3e0 !important; border-radius: 6px; box-shadow: 0 8px 24px rgba(15, 35, 70, 0.18) !important; padding: 4px; max-height: 300px; overflow-y: auto; overflow-x: hidden; z-index: 10000 !important; font-family: var(--theme-fonts); }
.ui-autocomplete.ui-menu .ui-menu-item { margin: 0; list-style: none; }
.ui-autocomplete.ui-menu .ui-menu-item-wrapper { display: block; padding: 8px 10px; border: 0 !important; border-radius: 4px; margin: 0 !important; font-size: 14px; color: var(--dark); background: transparent; cursor: pointer; }
.ui-autocomplete.ui-menu .ui-menu-item + .ui-menu-item .ui-menu-item-wrapper { border-top: 1px solid #f0f2f5 !important; }
.ui-autocomplete.ui-menu .ui-menu-item-wrapper.ui-state-active, .ui-autocomplete.ui-menu .ui-menu-item-wrapper:hover { background: var(--light-info) !important; color: var(--theme) !important; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(0 0 0 0); height: 1px; width: 1px; overflow: hidden; }

/* Rounded corners on every table. A collapsed-border table cannot be rounded, so borders are drawn
   once per cell (right + bottom) inside a rounded outer border, and the header colour sits on the cells. */
.table.table-bordered.table-compact { border-collapse: separate !important; border-spacing: 0; border: 1px solid #dee2e6; border-radius: 4px; }
.table.table-bordered.table-compact > * > tr > th,
.table.table-bordered.table-compact > * > tr > td { border-width: 0 1px 1px 0 !important; border-style: solid; border-color: #dee2e6; }
.table.table-bordered.table-compact > * > tr > :last-child { border-right-width: 0 !important; }
.table.table-bordered.table-compact > :last-child > tr:last-child > * { border-bottom-width: 0 !important; }
.table.table-bordered.table-compact > thead:not(.thead-control) { background-color: transparent; }
.table.table-bordered.table-compact > thead:not(.thead-control) > tr > th { background-color: #F1F5F9; }
.table.table-bordered.table-compact > :first-child > tr:first-child > :first-child { border-top-left-radius: 3px; }
.table.table-bordered.table-compact > :first-child > tr:first-child > :last-child { border-top-right-radius: 3px; }
.table.table-bordered.table-compact > :last-child > tr:last-child > :first-child { border-bottom-left-radius: 3px; }
.table.table-bordered.table-compact > :last-child > tr:last-child > :last-child { border-bottom-right-radius: 3px; }

/* Current page inside an open side-menu group */
.main-sidebar .sidebar-menu li.treeview .treeview-menu li.active > a { color: var(--theme) !important; font-weight: 600; background-color: var(--light-info); border-radius: 4px; }

/* Form sections on full-page forms: a small heading with a rule, and a muted hint line */
.form-section-title { font-size: 14px; font-weight: 600; color: var(--dark); border-bottom: 1px solid #e9ecef; padding-bottom: 6px; margin: 4px 0 12px; }
.form-section-title:not(:first-child) { margin-top: 18px; }
.form-section-title small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.form-hint { color: #6c757d; font-size: 13px; margin: -4px 0 0; }

/* Production job form. A run is planned in three steps. */
.job-step { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: var(--dark); margin: 22px 0 12px; }
.job-step:first-of-type { margin-top: 2px; }
.job-step-no { flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--side-panel-bg); color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; }
/* production lines are few and fixed, so they are buttons to press, not a list to open */
.line-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.line-option { margin: 0 !important; cursor: pointer; }
.line-option input { position: absolute; opacity: 0; }
.line-option span { display: block; min-width: 96px; padding: 9px 18px; border: 1px solid #c9d3e0; border-radius: 4px; background: #fff; font-size: 14px; font-weight: 500; text-align: center; color: var(--dark); }
.line-option:hover span { border-color: var(--theme); }
.line-option input:checked + span { background: var(--theme); border-color: var(--theme); color: #fff; }
.line-option input:focus-visible + span { outline: 2px solid var(--theme); outline-offset: 2px; }
.run-sentence { padding: 12px 14px; margin-bottom: 12px; border-left: 3px solid var(--theme); background: var(--light-info); border-radius: 0 4px 4px 0; font-size: 15px; color: var(--dark); }
.stock-check { display: flex; align-items: center; gap: 10px; }
.stock-check .stock-bar { flex: 0 0 90px; height: 8px; border-radius: 4px; background: #e3e8ef; overflow: hidden; }
.stock-check .stock-bar i { display: block; height: 100%; background: var(--success); }
.stock-check span { font-size: 13px; color: var(--success); font-weight: 500; }
.stock-check.is-short .stock-bar i { background: var(--danger); }
.stock-check.is-short span { color: var(--danger); }

/* Sticker print range in the job header */
.sticker-form { gap: 6px; flex-wrap: nowrap; }
.sticker-form label { margin: 0; font-size: 13px; font-weight: 500; }
.sticker-form input { width: 70px !important; }
.sticker-form .btn[type=submit] { background-color: var(--light-info) !important; border-color: var(--light-info) !important; color: var(--theme) !important; }

/* Table with a filter row on top (gla's thead-control): the filter row has no borders at all,
   so the outer border moves from the table onto the cells below it. */
.table.table-bordered.table-compact:has(> .thead-control) { border: 0; border-radius: 0; }
.table.table-bordered.table-compact:has(> .thead-control) > .thead-control > tr > th { border: 0 !important; border-radius: 0 !important; padding: 0 3px 8px; background: transparent; }
.table.table-bordered.table-compact:has(> .thead-control) > .thead-control > tr > th:first-child { padding-left: 0; }
.table.table-bordered.table-compact:has(> .thead-control) > .thead-control > tr > th:last-child { padding-right: 0; }
.table.table-bordered.table-compact:has(> .thead-control) > :not(.thead-control) > tr > :first-child { border-left-width: 1px !important; }
.table.table-bordered.table-compact:has(> .thead-control) > :not(.thead-control) > tr > :last-child { border-right-width: 1px !important; }
.table.table-bordered.table-compact:has(> .thead-control) > thead:not(.thead-control) > tr > th { border-top-width: 1px !important; }
.table.table-bordered.table-compact:has(> .thead-control) > :last-child > tr:last-child > * { border-bottom-width: 1px !important; }
.table.table-bordered.table-compact:has(> .thead-control) > thead:not(.thead-control) > tr > :first-child { border-top-left-radius: 4px; }
.table.table-bordered.table-compact:has(> .thead-control) > thead:not(.thead-control) > tr > :last-child { border-top-right-radius: 4px; }
.table.table-bordered.table-compact:has(> .thead-control) > :last-child > tr:last-child > :first-child { border-bottom-left-radius: 4px; }
.table.table-bordered.table-compact:has(> .thead-control) > :last-child > tr:last-child > :last-child { border-bottom-right-radius: 4px; }
.thead-control .form-control { width: 100%; height: 32px; margin: 0; font-size: 14px; font-weight: 400; }

/* Table that fills its card edge to edge (card-body p-0): the card already draws the outer border */
.table.table-bordered.table-compact.table-flush { border: 0; border-radius: 0; }
.table.table-bordered.table-compact.table-flush > * > tr > * { border-radius: 0 !important; }
.table.table-bordered.table-compact.table-flush > * > tr > :first-child { padding-left: 20px; }
.table.table-bordered.table-compact.table-flush > * > tr > :last-child { padding-right: 20px; }
/* Dashboard lists: every card the same height, a long list scrolls inside its card */
.card-body.card-fixed { height: 260px; overflow-y: auto; }
.card-fixed .table.table-bordered.table-compact.table-flush > :last-child > tr:last-child > * { border-bottom-width: 1px !important; }
/* filter row text the same size as the table (gla shrinks it to 13px, placeholder 10px) */
.table-compact thead.thead-control tr th .form-control-sm { font-size: 14px; padding: 4px 8px; }
.table-compact thead.thead-control tr th .form-control-sm::placeholder { font-size: 14px; }

/* Column filter row: slightly smaller boxes than regular form fields */
.table-compact thead.thead-control tr th .form-control-sm { height: 28px; font-size: 13px; padding: 2px 8px; }
.table-compact thead.thead-control tr th .form-control-sm::placeholder { font-size: 13px; }
.thead-control .select2-container .select2-selection--single { height: 28px; }
.thead-control .select2-container--default .select2-selection--single .select2-selection__rendered { padding: 0 26px 0 8px; line-height: 26px; font-size: 13px; color: var(--dark); text-align: left; }
.thead-control .select2-container--default .select2-selection--single .select2-selection__placeholder { color: #939698; }
.thead-control .select2-container--default .select2-selection--single .select2-selection__arrow { top: 9px; right: 8px; height: 9px; width: 10px; }
.thead-control .select2-container--default .select2-selection--single .select2-selection__arrow b { background-size: 10px; }

/* Buttons placed in a tab row (report Print) keep their button look, not the tab-link styling */
.status-tabs a.btn { padding: 4px 10px; margin-bottom: 0; border: 1px solid transparent; font-size: 13px; color: var(--theme); }

/* Small screens (tablet/phone): full-width content, side menu slides in from the header menu button */
.mobile-nav-toggle, .sidebar-backdrop { display: none; }
@media (max-width: 991px) {
    .content-wrapper { margin-left: 0; }
    .main-header .menu-dashboard { flex: 0 0 auto; max-width: none; gap: 10px; }
    .mobile-nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 4px; color: var(--dark); font-size: 20px; text-decoration: none; }
    .main-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    body.sidebar-open .main-sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 9; }
    .card-header { flex-wrap: wrap; gap: 8px; }
    .status-tabs { padding: 0 10px; }
    .status-tabs a { padding: 8px 10px; }
}

/* Column sizing on every table: the action-button column and image/thumbnail columns shrink to their content,
   so text columns get the space. width:1% + nowrap = "as narrow as the buttons allow". */
.table-compact > tbody > tr > td:has(> .btn-action),
.table-compact > tbody > tr > td:has(> img:only-child),
.table-compact > tbody > tr > td:has(> .item-thumb) { width: 1%; white-space: nowrap; }

/* Searchable dropdowns (select.select-search -> select2): same height, text size and colour as the small inputs next to them */
select.select-search + .select2-container .select2-selection--single { height: calc(1.5em + .5rem + 2px); border-radius: .2rem; }
select.select-search + .select2-container--default .select2-selection--single .select2-selection__rendered { padding: 0 26px 0 8px; line-height: calc(1.5em + .5rem); font-size: 14px; color: var(--dark); }
select.select-search + .select2-container--default .select2-selection--single .select2-selection__placeholder { color: #939698; }
select.select-search + .select2-container--default .select2-selection--single .select2-selection__arrow { top: 50%; transform: translateY(-50%); right: 8px; height: 9px; width: 10px; }
select.select-search + .select2-container--default .select2-selection--single .select2-selection__arrow b { background-size: 10px; }

/* Key-number strip (assembly job: available / ongoing / need to produce): label on top, big number below */
.stat-strip { display: flex; flex-wrap: wrap; border: 1px solid #dee2e6; border-radius: 4px; background: #fff; }
.stat-strip > div { flex: 1 1 160px; padding: 12px 18px; border-right: 1px solid #dee2e6; }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip span { display: block; font-size: 13px; font-weight: 500; color: #6c757d; margin-bottom: 4px; }
.stat-strip b { display: block; font-size: 24px; font-weight: 600; line-height: 1.2; }
.stat-strip .text-warning { color: #d39e00 !important; }

/* Dispatch: one light row per storage location (name, stock, pick box) instead of a nested table */
.pick-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px dashed #e3e8ef; }
.pick-row:first-child { padding-top: 0; }
.pick-row .pick-loc { flex: 1 1 auto; font-weight: 600; color: var(--dark); white-space: nowrap; }
.pick-row .pick-loc i { color: var(--theme); margin-right: 2px; }
.pick-row .pick-stock { flex: 0 0 90px; font-size: 13px; white-space: nowrap; }
.pick-row .pick-stock.text-warning { color: #d39e00 !important; }
.pick-row .pick-input { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; font-size: 13px; color: #6c757d; }
.pick-row .pick-input .form-control { width: 90px; text-align: right; }
.pick-total { text-align: right; font-size: 13px; color: #6c757d; padding-top: 6px; }

/* Selected rows (row checkbox ticked, e.g. Sales Orders "Print Selected"): highlight the whole row */
.table-compact > tbody > tr:has(.row-checkbox:checked) > td { background-color: var(--light-info); }
