/* App-wide styling of Telerik controls, except the Grid (grid.css). Loaded after the Telerik theme.

   Sections: FileSelect / Upload | Inputs (size of every input-type control, checkboxes) | Forms | TabStrip | Dialogs */

/* ===================== FileSelect / Upload =====================
   Telerik gives the "select files" button no size parameter, so it renders at the default (md) size: same as a
   Size="sm" button instead, so it lines up with the buttons next to it (e.g. Cargo Information's Import from Excel). */
.k-upload .k-upload-button.k-button {
    padding: 4px 8px;
    font-size: 14px;
    line-height: 20px;
}

/* ===================== Inputs =====================
   One size for every Telerik input-type control in the app: TextBox, NumericTextBox, DropDownList,
   ComboBox, MultiColumnComboBox, DatePicker, ... It applies wherever the control is (forms, search
   areas, grid cell editors, grid filter row) and whatever Size it was given, including the controls
   Telerik renders in popups at the end of <body> (dropdown search box, grid filter menu), which
   page-scoped CSS can't reach. Don't size these controls in page or component CSS: change it here. */

.k-input,
.k-picker {
    --kendo-font-size: 0.8rem;      /* controls left at Telerik's default size (md) */
    --kendo-font-size-sm: 0.8rem;   /* Size="sm" */
    min-height: 0;
}

/* Listed per size to match the specificity of Telerik's own rules (.k-input.k-input-sm .k-input-inner);
   this file loads after the theme, so it wins. The plain .k-input / .k-picker lines cover controls
   rendered without a size class (e.g. the grid toolbar's search box). */
.k-input .k-input-inner,
.k-input .k-input-button,
.k-input .k-input-icon,
.k-picker .k-input-inner,
.k-picker .k-input-button,
.k-input.k-input-sm .k-input-icon,
.k-input.k-input-md .k-input-icon,
.k-input.k-input-lg .k-input-icon,
.k-input.k-input-sm .k-input-inner,
.k-input.k-input-md .k-input-inner,
.k-input.k-input-lg .k-input-inner,
.k-input.k-input-sm .k-input-button,
.k-input.k-input-md .k-input-button,
.k-input.k-input-lg .k-input-button,
.k-picker.k-picker-sm .k-input-inner,
.k-picker.k-picker-md .k-input-inner,
.k-picker.k-picker-lg .k-input-inner,
.k-picker.k-picker-sm .k-input-button,
.k-picker.k-picker-md .k-input-button,
.k-picker.k-picker-lg .k-input-button,
/* The clear "X" shown while there's text: with Telerik's padding it is taller than the box and grows it. */
.k-input .k-clear-value,
.k-input.k-input-sm .k-clear-value,
.k-input.k-input-md .k-clear-value,
.k-input.k-input-lg .k-clear-value,
.k-picker .k-clear-value,
.k-picker.k-picker-sm .k-clear-value,
.k-picker.k-picker-md .k-clear-value,
.k-picker.k-picker-lg .k-clear-value {
    padding-block: 0.1rem;
}

/* Number box arrows: two stacked buttons, each half the box height. */
.k-input .k-spin-button .k-button {
    height: auto;
    min-height: 0;
    padding-block: 0;
}

/* Focus ring (the light border around the focused control): 2px instead of the theme's 4px, same colors.
   Listed like the theme's own rules (same specificity; this file loads later, so it wins). */
.k-input:focus,
.k-input.k-focus,
.k-input:focus-within,
.k-input.k-input-solid:focus,
.k-input.k-input-solid.k-focus,
.k-input.k-input-solid:focus-within,
.k-picker:focus,
.k-picker.k-focus,
.k-picker:focus-within,
.k-picker.k-picker-solid:focus,
.k-picker.k-picker-solid.k-focus,
.k-picker.k-picker-solid:focus-within {
    box-shadow: 0 0 0 0.125rem color-mix(in srgb, var(--kendo-color-primary) 25%, transparent);
}

/* The same ring in red on a field that failed validation. */
.k-input.k-invalid:focus,
.k-input.k-invalid.k-focus,
.k-input.k-invalid:focus-within,
.k-input.k-input-solid.k-invalid:focus,
.k-input.k-input-solid.k-invalid.k-focus,
.k-input.k-input-solid.k-invalid:focus-within,
.k-picker.k-invalid:focus,
.k-picker.k-invalid.k-focus,
.k-picker.k-invalid:focus-within,
.k-picker.k-picker-solid.k-invalid:focus,
.k-picker.k-picker-solid.k-invalid.k-focus,
.k-picker.k-picker-solid.k-invalid:focus-within {
    box-shadow: 0 0 0 0.125rem color-mix(in srgb, var(--kendo-color-error) 25%, transparent);
}

/* Popups use the same font size as the inputs: the lists of DropDownList, ComboBox, MultiColumnComboBox
   (its table too), the grid's filter menu... Telerik renders them at the end of <body>, outside any page,
   so they would otherwise get the theme's sizes (14px lists, 16px MultiColumnComboBox table).
   Grid cell editors' popups use the grid's font instead (.grid-editor-popup in grid.css). */
.k-popup {
    --kendo-font-size: 0.8rem;
    --kendo-font-size-sm: 0.8rem;
}

/* Buttons inside popups (grid filter menu: And / Or, Filter, Clear); not a dropdown's own arrow button */
.k-popup .k-button:not(.k-input-button, .k-spin-button .k-button) {
    padding-block: 0.15rem;
    font-size: 0.8rem;
}

/* Phones: the inputs, their popups and the popups' buttons about 10% smaller. */
@media (max-width: 767px) {
    .k-input,
    .k-picker,
    .k-popup {
        --kendo-font-size: 0.725rem;
        --kendo-font-size-sm: 0.725rem;
    }

    .k-popup .k-button:not(.k-input-button, .k-spin-button .k-button) {
        font-size: 0.725rem;
    }
}

/* Checkboxes: one size for every TelerikCheckBox in the app, whatever Size it was given (the theme's sm is only
   12px). Listed per size to match the specificity of the theme's own rules (.k-checkbox.k-checkbox-sm). */
.k-checkbox,
.k-checkbox.k-checkbox-sm,
.k-checkbox.k-checkbox-md,
.k-checkbox.k-checkbox-lg {
    width: 1.125rem;
    height: 1.125rem;
}

/* The check mark inside, in the same proportion as the theme's. */
.k-checkbox::before,
.k-checkbox.k-checkbox-sm::before,
.k-checkbox.k-checkbox-md::before,
.k-checkbox.k-checkbox-lg::before {
    font-size: 1rem;
}

/* Except Confirmation Sent in the quotation header (read-only, among small text): the theme's small size. */
.quotation-header-info .k-checkbox.k-checkbox-sm {
    width: 1rem;
    height: 1rem;
}

.quotation-header-info .k-checkbox.k-checkbox-sm::before {
    font-size: 0.625rem;
}

/* ===================== Forms =====================
   Label above the control (TelerikForm FormItems and the Labeled* controls); red * for required fields. */
.k-form-field {
    display: flex;
    flex-direction: column;
    margin-block-end: 1rem;
}

.k-form-field .k-label {
    margin-block-end: .375rem;
    font-size: 0.725rem;
    font-weight: 600;
}

/* FormGroup title (LabelText). As specific as the theme's .k-form .k-form-legend (font-size-sm). */
.k-form .k-form-legend {
    font-size: 1rem;
}

.k-form-field .required-asterisk {
    margin-inline-start: .25rem;
    color: var(--kendo-color-error);
}

/* Tablets: a form's groups in 2 columns, whatever its Columns (TelerikForm renders Columns="7" as
   .k-form-layout.k-grid-cols-7 directly under the form; each FormGroup is one cell). Forms already at 1 or 2
   columns, and the layouts inside the groups, are left alone. */
@media (min-width: 768px) and (max-width: 1024px) {
    .k-form > .k-form-layout:not(.k-grid-cols-1, .k-grid-cols-2) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Phones: everything in 1 column, the form's groups and the items inside each group (FormGroup Columns),
   and no ColSpan (.k-col-span-N), which would add columns back. TelerikGridLayouts in templates are untouched.
   Labels and group titles about 10% smaller. */
@media (max-width: 767px) {
    .k-form .k-form-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .k-form .k-form-layout > * {
        grid-column: auto;
    }

    .k-form-field .k-label {
        font-size: 0.675rem;
    }

    .k-form .k-form-legend {
        font-size: 0.95rem;
    }
}

/* ===================== TabStrip ===================== */
.k-tabstrip-content,
.k-tabstrip > .k-content {
    border-color: transparent;
}

.k-tabstrip-items-wrapper .k-tabstrip-item,
.k-tabstrip-items-wrapper .k-item {
    color: inherit;
}

/* Tab titles: the inputs' font size (0.8rem, Inputs above) instead of the theme's 0.85rem. As specific as the
   theme's rule (bootstrap-main.css), and this file loads after it. */
.k-tabstrip .k-tabstrip-items .k-link,
.k-tabstrip.k-tabstrip-md .k-tabstrip-items .k-link {
    font-size: 0.85rem;
}

.k-tabstrip-items-wrapper .k-tabstrip-item:active,
.k-tabstrip-items-wrapper .k-tabstrip-item.k-active,
.k-tabstrip-items-wrapper .k-tabstrip-item.k-selected,
.k-tabstrip-items-wrapper .k-item:active,
.k-tabstrip-items-wrapper .k-item.k-active,
.k-tabstrip-items-wrapper .k-item.k-selected {
    border-color: var(--kendo-color-border);
    color: var(--kendo-color-primary);
    background-color: var(--kendo-color-surface-alt);
    font-weight: 500;
}

.k-tabstrip-items-wrapper .k-tabstrip-item:focus,
.k-tabstrip-items-wrapper .k-tabstrip-item.k-focus,
.k-tabstrip-items-wrapper .k-item:focus,
.k-tabstrip-items-wrapper .k-item.k-focus {
    box-shadow: none;
}

/* ===================== Quotation details (compact) =====================
   Telerik controls on the quotation details page only, smaller so the General screen fits without scrolling.
   Scope: the TabStrip that holds the quotation header (.k-tabstrip:has(.quotation-header)); other pages are unchanged. */
.k-tabstrip:has(.quotation-header) > .k-tabstrip-items-wrapper .k-item .k-link {
    padding-block: 0.2rem;
    padding-inline: 0.6rem;
    font-size: 0.8rem;
}

.k-tabstrip:has(.quotation-header) > .k-tabstrip-content,
.k-tabstrip:has(.quotation-header) > .k-content {
    padding: 0.4rem 0.5rem;
}

/* Step bar: circles, icons and labels, less height. */
.k-stepper.quotation-steps .k-step-indicator {
    width: 2rem;
    height: 2rem;
    font-size: 0.875rem;
}

.k-stepper.quotation-steps .k-step-indicator .k-svg-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.k-stepper.quotation-steps .k-step-label,
.k-stepper.quotation-steps .k-step-text {
    font-size: 0.875rem;
}

/* No width cap: the current step's bolder label would otherwise be cut with "…". */
.k-stepper.quotation-steps .k-step-text { max-width: none; }

.k-stepper.quotation-steps .k-step-link { padding-block: 0; }
.k-stepper.quotation-steps .k-step-label { margin-top: 0.2rem; }
.k-stepper.quotation-steps .k-progressbar { top: 1rem; }

/* Favourite star on details pages (FavouriteButton, a ToggleButton): pressed looks the same as not pressed, the
   filled yellow star alone shows it's a favourite (it was hard to see on the theme's blue pressed background). */
.k-button.favourite-button.k-selected {
    background-color: var(--kendo-color-base);
    border-color: var(--kendo-color-base);
    color: var(--kendo-color-on-base);
}

.k-button.favourite-button.k-selected:hover {
    background-color: var(--kendo-color-base-hover);
    border-color: var(--kendo-color-base-hover);
}

/* Bookmark tab (MainLayout; the drawer is in app.css): a blue tab, rounded on the left, the handle of the drawer,
   darker while it is open. 1.75rem wide: closed, it fits in the 30px between the page's content and the window's
   edge, so it never covers a page's buttons (e.g. the favourite star at the end of a details page's toolbar). */
.k-button.records-tab {
    flex-shrink: 0;
    width: 1.75rem;
    height: 2.5rem;
    padding: 0;
    border: none;
    border-radius: 0.5rem 0 0 0.5rem;
    background-color: var(--kendo-color-primary);
    color: var(--kendo-color-on-primary);
    font-size: 1.125rem;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
}

.k-button.records-tab:hover,
.k-button.records-tab.records-tab-open {
    background-color: var(--kendo-color-primary-hover);
    color: var(--kendo-color-on-primary);
}

/* Hover: the same light blue as the template's (--accent, app.css; dark blue in dark mode) on grid rows and on the
   items of every dropdown list, instead of the theme's grey. Selected rows and items keep their own colours. */
.k-list-item:not(.k-selected):is(:hover, .k-hover),
.k-list-optionlabel:not(.k-selected):is(:hover, .k-hover),
.k-list-custom-value:not(.k-selected):is(:hover, .k-hover),
.k-table-list .k-table-row:not(.k-selected):is(:hover, .k-hover),
.k-table-tbody .k-table-row:not(.k-selected):is(:hover, .k-hover),
.k-grid :where(.k-grid-container) .k-table-row:not(.k-selected):is(:hover, .k-hover) {
    background-color: var(--accent);
}

/* Locked (frozen) columns paint their own cells: the same colour there. */
.k-grid .k-master-row.k-table-row:not(.k-selected):is(:hover, .k-hover) .k-table-td.k-grid-content-sticky:not(.k-group-cell) {
    background-color: var(--accent);
}

/* Cards: thinner header and body, smaller title (quotation details; the home page's Favourites / Recently opened). */
.k-card.quotation-card > .k-card-header,
.k-card.home-records-card > .k-card-header {
    padding: 0.3rem 0.6rem;
}

.k-card.quotation-card .k-card-title,
.k-card.home-records-card .k-card-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.k-card.quotation-card > .k-card-body,
.k-card.home-records-card > .k-card-body {
    padding: 0.4rem 0.6rem;
}

/* Light mode only (dark mode keeps the theme's colors): blue card headers with white titles, grey card bodies
   (quotation details; the home page's Favourites / Recently opened), the Quotation Details title in blue. */
html:not(.dark) .k-card.quotation-card,
html:not(.dark) .k-card.home-records-card {
    border: none;
    background-color: #f4f4f5;
}

html:not(.dark) .k-card.quotation-card > .k-card-header,
html:not(.dark) .k-card.home-records-card > .k-card-header {
    background-color: var(--kendo-color-primary);
    color: var(--kendo-color-on-primary);
}

html:not(.dark) .k-panelbar.quotation-details-panel > .k-panelbar-header > .k-link {
    color: var(--kendo-color-primary);
}

/* Quotation Details panel: thinner header. */
.k-panelbar.quotation-details-panel > .k-panelbar-header > .k-link {
    padding-block: 0.3rem;
    font-size: 0.85rem;
}

/* Cargo item cards: the header in the route bars' colors (.quotation-summary-route, app.css); the flat buttons
   (copy, delete, collapse) follow the header's text color. */
.k-card.cargo-item > .k-card-header {
    background-color: var(--kendo-color-primary);
    color: var(--kendo-color-on-primary);
}

.k-card.cargo-item > .k-card-header .k-button-flat {
    color: inherit;
}

/* Every chip (cargo summary and item headers, confirmation chip, multi-select tags): white with dark text. The theme
   colors chips with up to three classes (.k-chip.k-chip-solid.k-chip-base, also on hover), so these selectors match
   it; a plain .k-chip rule loses to them. */
.k-chip,
.k-chip.k-chip-base,
.k-chip.k-chip-solid,
.k-chip.k-chip-solid.k-chip-base,
.k-chip:hover,
.k-chip.k-chip-solid:hover,
.k-chip.k-chip-solid.k-chip-base:hover {
    background-color: #fff;
    color: #212529;
}

/* On the blue cargo item header the border is white too. */
.k-card.cargo-item > .k-card-header .k-chip {
    border-color: #fff;
}

/* Labels and fields closer together on this page. */
.k-tabstrip:has(.quotation-header) .k-form-field {
    margin-block-end: 0.3rem;
}

.k-tabstrip:has(.quotation-header) .k-form-field .k-label {
    margin-block-end: 0.1rem;
}

/* Addresses tab: the "+" card (a button as tall as an address card, a big icon in the middle), as in Softship. */
.k-button.quotation-address-add {
    width: 100%;
    min-height: 20rem;
}

.k-button.quotation-address-add i {
    font-size: 2rem;
}

/* Address cards: fields closer together, as on the General tab. As specific as the theme's .k-form.k-form-sm .k-form-field. */
.k-form.quotation-addresses .k-form-field {
    margin-block-start: 0;
    margin-block-end: 0.3rem;
}

.quotation-addresses .k-form-field .k-label {
    margin-block-end: 0.1rem;
}

/* ===================== Dialogs =====================
   Message boxes (MessageBoxService / MessageBoxHost) and any TelerikDialog:
   the text and buttons at the inputs' size, the title a little larger and bold. */
.k-dialog {
    --kendo-font-size: 0.8rem;
    font-size: 0.8rem;
}

.k-dialog .k-window-title,
.k-dialog .k-dialog-title {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Message box: the type's icon on the left, the text (and a Prompt's text box) next to it. */
.message-box-body {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.message-box-icon {
    flex-shrink: 0;
}

.message-box-text {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
    padding-top: 0.35rem;      /* first line level with the middle of the icon */
    white-space: pre-line;     /* line breaks in the message are kept */
}

/* Theme colors: the same in light and dark mode. */
.message-box-question { color: var(--kendo-color-primary); }
.message-box-info     { color: var(--kendo-color-info); }
.message-box-warning  { color: var(--kendo-color-warning); }
.message-box-error    { color: var(--kendo-color-error); }
.message-box-success  { color: var(--kendo-color-success); }

.k-dialog .k-actions .k-button {
    font-size: 0.8rem;
    padding-block: 0.25rem;
}

/* Phones: the dialog's text, title and buttons about 10% smaller. */
@media (max-width: 767px) {
    .k-dialog {
        --kendo-font-size: 0.725rem;
        font-size: 0.725rem;
    }

    .k-dialog .k-window-title,
    .k-dialog .k-dialog-title {
        font-size: 0.8rem;
    }

    .k-dialog .k-actions .k-button {
        font-size: 0.725rem;
    }
}

/* NumericTextBox with a unit inside it (NumericTextBoxSuffixTemplate): number on the right, next to the unit. */
.numeric-unit .k-input-inner {
    text-align: right;
}

/* No side padding (the theme's .k-input.k-input-sm .k-input-inner has spacing-2), so long numbers fit next to the unit. */
.k-input.numeric-unit .k-input-inner {
    padding-inline: calc(1 * 0.15rem);
    /*padding-inline: 0;*/
}

/* The unit: a gray block the full height of the box, text centered and bold. Rounded on the right like the box.
   As specific as the theme's .k-input .k-input-suffix / .k-input.k-input-solid .k-input-suffix (which set a
   near-white background). Not .k-input-solid itself: the NumericTextBox doesn't render that class. */
.k-input.numeric-unit .k-input-suffix {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    min-width: 1.25rem; /* at least this wide (ft, in, cm); longer units (cbm, mtr, ...) widen it to fit */
    padding-inline: 0.05rem; /* just off the edges: units that fit 1.25rem keep that width */
    background-color: var(--kendo-color-base);
    border-start-end-radius: inherit;
    border-end-end-radius: inherit;
    border-inline-start: 1px solid #d2d3d4;
    font-weight: 550;
}

/* Phones: a narrower unit block with smaller text, so the number keeps more room. */
@media (max-width: 767px) {
    .k-input.numeric-unit .k-input-suffix {
        min-width: 1rem;
        font-size: 0.65rem;
    }
}

.numeric-unit .numeric-unit-text {
    font-weight: 600;
    color: var(--kendo-color-subtle);
}

/* Read-only record (RecordLock: someone else is editing it). The disabled fieldset disables the native inputs and
   buttons; these also stop the pickers that open on a click of their wrapper (DropDownList, ...) and the grids'
   cells (Incell editing), and give the inputs the theme's disabled look. Grids still scroll (the wheel goes to
   the scrolling element under the cells). */
.record-lock-area:disabled .k-input,
.record-lock-area:disabled .k-picker,
.record-lock-area:disabled .k-checkbox,
.record-lock-area:disabled .k-grid-content td {
    pointer-events: none;
}

/* The buttons are disabled by the fieldset, but the theme only greys out .k-disabled ones. */
.record-lock-area:disabled .k-input,
.record-lock-area:disabled .k-picker,
.record-lock-area:disabled .k-button {
    opacity: 0.6;
}