/*
 * One look for one kind of control, app-wide (Task 39818, client mail 5. 11. 2026: the same
 * button is plain text in one table and a bordered button on the next page).
 *
 * The theme strips the border and background of every button in a panel heading
 * (.panel > .panel-heading .btn:not(.btn-link)), so a worded panel action such as
 * "Založit nové zařízení" or "Založit další výjezd" read as plain grey text, while the same
 * action in a list header, the sidebar or a Výjezd card is a bordered button. A worded panel
 * action now gets the theme's default-button look; icon-only controls (+, the ... menu) stay
 * as they are.
 */
.panel > .panel-heading .btn.panel-action:not(.btn-link):not(:has(> .fas, > .far, > .fab, > .fa, > .glyphicon)) {
    background-color: var(--btn-default-bg);
    border-color: var(--btn-default-border);
    color: var(--btn-default-color);
}

.panel > .panel-heading .btn.panel-action:not(.btn-link):not(:has(> .fas, > .far, > .fab, > .fa, > .glyphicon)):hover,
.panel > .panel-heading .btn.panel-action:not(.btn-link):not(:has(> .fas, > .far, > .fab, > .fa, > .glyphicon)):focus {
    background-color: var(--btn-default-hover-bg);
    border-color: var(--btn-default-hover-border);
    color: var(--btn-default-color);
}

/* Spacing standard for buttons in a panel (SUP-2684, client mail 6. 11. 2026: the new buttons are
   pushed to the edge, the old ones keep a gap from the top and from the side of the panel). The old
   buttons sit inside the panel body, 14px (its padding) from the panel edge. The theme draws the
   heading's button group flush with the top edge and pulls it 10px past the side padding, which
   only transparent icon buttons could afford. A heading with a worded (bordered) button therefore
   keeps its whole button group 14px from the top and from the side; the title stays centred on
   the button row because the theme centres both on the same --panel-heading-height.
   :has() cannot nest, so "worded" is spelled as: no panel action in the group holds an icon. */
.panel > .panel-heading:has(> .btn-group > .btn.panel-action:not(.btn-link)):not(:has(> .btn-group > .btn.panel-action > :is(.fas, .far, .fab, .fa, .glyphicon))) {
    padding-top: var(--14px);
    padding-right: calc(var(--14px) + var(--10px));
}

/* Autocrm list inline edit un-clips every cell of the list while one cell is edited, so long
   names of the other columns ran into each other; only the cell being edited is un-clipped. */
.list.edit-mode > table td:not(:has(input, select, textarea, .selectize-control)) {
    overflow: hidden;
}

/* Gap standard for buttons in a panel (SUP-2692, client mail 6. 11. 2026: buttons without a gap
   next to buttons with a gap look bad). Worded buttons in a panel are separate small buttons 4px
   apart, like the buttons of a Výjezd card (Upravit, Ukončit výjezd). The theme joins the heading's
   button group into one bar (shared borders, square inner corners), so each worded heading action
   gets its own rounded corners and a 4px gap; the transparent "..." toggle stays where it was. */
.panel > .panel-heading > .btn-group > .btn.panel-action:not(.btn-link):not(:has(> .fas, > .far, > .fab, > .fa, > .glyphicon)) {
    border-radius: 6px;
}

.panel > .panel-heading > .btn-group > .btn.panel-action:not(.btn-link):not(:has(> .fas, > .far, > .fab, > .fa, > .glyphicon)) + .btn.panel-action {
    margin-left: var(--4px);
}

/* The transparent "..." toggle after the panel actions does not show a corner, so the action
   before it rounds its own (icon groups too). */
.panel > .panel-heading > .btn-group > .btn.panel-action:has(+ .dropdown-toggle) {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Colour carries meaning in a header (rule S6): white = an ordinary action, green = the next step
   of the document's workflow, red = cancel only. The modules coloured some ordinary actions red
   or blue ("Exportovat do Excelu" red like a delete, "Vytvořit příjemku" blue next to white
   "Vytvořit …" buttons). The theme draws each style from variables, so remapping them on the
   button keeps hover and active states right. */
.header-buttons > .btn-danger[data-name="createXlsx"],
.header-buttons > .btn-danger[data-name="composeEmail"],
.header-buttons > .btn-primary[data-name="createGoodsReceipt"],
.header-buttons > .btn-primary[data-name="createGoodsIssue"],
.header-buttons > .btn-success[data-name="createGoodsIssue"],
.header-buttons > .btn-primary[data-name="uploadFromZip"] {
    --btn-danger-color: var(--btn-default-color);
    --btn-danger-bg: var(--btn-default-bg);
    --btn-danger-border: var(--btn-default-border);
    --btn-danger-hover-bg: var(--btn-default-hover-bg);
    --btn-danger-hover-border: var(--btn-default-hover-border);
    --btn-danger-active-bg: var(--btn-default-active-bg);
    --btn-danger-active-border: var(--btn-default-active-border);
    --btn-primary-color: var(--btn-default-color);
    --btn-primary-bg: var(--btn-default-bg);
    --btn-primary-border: var(--btn-default-border);
    --btn-primary-hover-bg: var(--btn-default-hover-bg);
    --btn-primary-hover-border: var(--btn-default-hover-border);
    --btn-primary-active-bg: var(--btn-default-active-bg);
    --btn-primary-active-border: var(--btn-default-active-border);
    --btn-success-color: var(--btn-default-color);
    --btn-success-bg: var(--btn-default-bg);
    --btn-success-border: var(--btn-default-border);
    --btn-success-hover-bg: var(--btn-default-hover-bg);
    --btn-success-hover-border: var(--btn-default-hover-border);
    --btn-success-active-bg: var(--btn-default-active-bg);
    --btn-success-active-border: var(--btn-default-active-border);
}

/* Workflow steps green: "Zpracovat" of a physical inventory was red, "Rezervovat" yellow. */
.header-buttons > .btn-danger[data-name="process"],
.header-buttons > .btn-warning[data-name="reserve"] {
    --btn-danger-color: var(--btn-success-color);
    --btn-danger-bg: var(--btn-success-bg);
    --btn-danger-border: var(--btn-success-border);
    --btn-danger-hover-bg: var(--btn-success-hover-bg);
    --btn-danger-hover-border: var(--btn-success-hover-border);
    --btn-danger-active-bg: var(--btn-success-active-bg);
    --btn-danger-active-border: var(--btn-success-active-border);
    --btn-warning-color: var(--btn-success-color);
    --btn-warning-bg: var(--btn-success-bg);
    --btn-warning-border: var(--btn-success-border);
    --btn-warning-hover-bg: var(--btn-success-hover-bg);
    --btn-warning-hover-border: var(--btn-success-hover-border);
    --btn-warning-active-bg: var(--btn-success-active-bg);
    --btn-warning-active-border: var(--btn-success-active-border);
}

/* "Zrušit rezervaci" is a cancel: red like every other cancel. */
.header-buttons > .btn-warning[data-name="cancelReservation"] {
    --btn-warning-color: var(--btn-danger-color);
    --btn-warning-bg: var(--btn-danger-bg);
    --btn-warning-border: var(--btn-danger-border);
    --btn-warning-hover-bg: var(--btn-danger-hover-bg);
    --btn-warning-hover-border: var(--btn-danger-hover-border);
    --btn-warning-active-bg: var(--btn-danger-active-bg);
    --btn-warning-active-border: var(--btn-danger-active-border);
}

/* Every status is a label (rule S3). A status without a meaning colour (draft, inactive,
   archived) gets the grey label; Espo renders the "default" style as plain text. */
.label-neutral {
    background-color: var(--label-default-bg);
}
