button > * {
    display: inline-block;
    vertical-align: middle;
}

/*
 * Shared building blocks of the pages (ui-*), on top of the MDL layout.
 */
:root {
    --ui-primary: #3f51b5;
    --ui-primary-light: #e8eaf6;
    --ui-success: #2e7d32;
    --ui-danger: #c62828;
    --ui-warning: #ef6c00;
    --ui-text: #212121;
    --ui-muted: #757575;
    --ui-border: #e0e0e0;
    --ui-row-border: #f0f0f0;
    --ui-hover: #f5f5f5;
}

/* page frame: light header above the content (the sidebar is styled in _Drawer) */
body { font-family: Roboto, Helvetica, Arial, sans-serif; }
.mdl-layout__content { background: #f4f5f9; }
.mdl-layout__header.ui-header { background: #fff; color: var(--ui-text); box-shadow: 0 1px 0 var(--ui-border), 0 1px 4px rgba(0,0,0,.04); }
.ui-header .mdl-layout-title { font-size: 18px; font-weight: 400; color: #424242; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-header .mdl-layout__drawer-button { color: #616161; }
.ui-header .mdl-button--icon { color: #616161; }
.ui-header-account { display: inline-flex; align-items: center; gap: .4em; border: 1px solid var(--ui-border); border-radius: 18px; padding: .25em .4em .25em .8em; margin-right: .6em; color: #616161; font-size: 13px; }
.ui-header-account .material-icons { font-size: 18px; }
.ui-header-account select { border: 0; background: transparent; font: inherit; color: var(--ui-text); cursor: pointer; padding: .2em; }
.ui-header-account select:focus { outline: none; }
/* search in the header (uiGlobalSearch) */
.ui-global-search { position: relative; margin-right: .8em; }
.ui-global-search .ui-global-search-open { display: none; }
.ui-global-search-field { display: flex; align-items: center; gap: .4em; width: 280px; box-sizing: border-box; padding: 0 .5em 0 .7em; height: 36px; border: 1px solid var(--ui-border); border-radius: 18px; background: #f7f7f8; color: #757575; transition: width .15s, background .15s; }
.ui-global-search-field:focus-within { width: 340px; background: #fff; border-color: var(--ui-primary); box-shadow: 0 0 0 2px var(--ui-primary-light); }
.ui-global-search-field .material-icons { font-size: 19px; }
.ui-global-search-field input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 14px; color: var(--ui-text); outline: none; }
.ui-global-search-field kbd { font: 11px/1 inherit; color: #9e9e9e; border: 1px solid #ddd; border-radius: 4px; padding: 2px 6px; }
.ui-global-search-field:focus-within kbd { display: none; }
.ui-global-search-results { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 420px; max-height: min(70vh, 520px); overflow-y: auto; padding: .3em 0; background: #fff; border: 1px solid var(--ui-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.ui-global-search-group { padding: .7em 1em .3em; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #9e9e9e; }
.ui-global-search-results a { display: flex; align-items: flex-start; gap: .7em; padding: .45em 1em; color: var(--ui-text); text-decoration: none; font-size: 14px; line-height: 1.35; }
.ui-global-search-results a .material-icons { font-size: 19px; color: #9e9e9e; margin-top: 1px; }
.ui-global-search-results a.active, .ui-global-search-results a:hover { background: var(--ui-primary-light); }
.ui-global-search-results a.active .material-icons { color: var(--ui-primary); }
.ui-global-search-text { display: flex; flex-direction: column; min-width: 0; }
.ui-global-search-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-global-search-text .ui-muted { font-size: 12px; }
.ui-global-search-text b { font-weight: 600; }
.ui-global-search-empty { padding: 1em; color: var(--ui-muted); font-size: 14px; text-align: center; }

/* cards with an optional head (title + actions) */
.ui-card { background: #fff; border-radius: 4px; box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12); margin: 0 auto 1.5em; max-width: 1400px; }
.ui-card.narrow { max-width: 900px; }
.ui-card-head { display: flex; align-items: center; gap: 1em; flex-wrap: wrap; padding: 1.1em 1.5em; border-bottom: 1px solid var(--ui-border); }
.ui-card-head h2 { font-size: 20px; line-height: 1.3; font-weight: 400; margin: 0; flex: 1; min-width: 0; }
.ui-card-head h2 small { display: block; font-size: 13px; color: var(--ui-muted); }
.ui-card-body { padding: 1.5em; }
.ui-card-body.flush { padding: 0; }

/* buttons */
.ui-btn { display: inline-flex; align-items: center; gap: .4em; border: 1px solid var(--ui-border); background: #fff; color: var(--ui-text); border-radius: 4px; padding: .5em 1.1em; font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; line-height: 1.4; }
.ui-btn:hover { background: var(--ui-hover); }
.ui-btn.primary { background: var(--ui-primary); border-color: var(--ui-primary); color: #fff; }
.ui-btn.primary:hover { background: #3949ab; }
.ui-btn.danger { background: var(--ui-danger); border-color: var(--ui-danger); color: #fff; }
.ui-btn.danger:hover { background: #b71c1c; }
.ui-btn:disabled { opacity: .6; cursor: default; }
.ui-btn .material-icons { font-size: 18px; }
.ui-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: var(--ui-muted); text-decoration: none; border: 0; background: none; padding: 0; cursor: pointer; vertical-align: middle; }
.ui-icon-btn:hover { background: #eeeeee; color: var(--ui-text); }
.ui-icon-btn.danger:hover { background: #ffebee; color: var(--ui-danger); }
.ui-icon-btn .material-icons { font-size: 20px; }
.ui-link { border: 0; background: none; color: var(--ui-primary); font: inherit; font-size: 13px; cursor: pointer; padding: .3em .4em; text-decoration: none; }
.ui-link:hover { text-decoration: underline; }

/* search, filters and counters above a list */
.ui-toolbar { display: flex; flex-wrap: wrap; gap: .5em; align-items: center; margin-bottom: .6em; }
.ui-card-body > .ui-toolbar:last-child { margin-bottom: 0; }
.ui-search { width: 100%; box-sizing: border-box; padding: .55em .8em; border: 1px solid #ccc; border-radius: 4px; font: inherit; margin-bottom: .6em; background: #fff; }
.ui-search:focus { outline: none; border-color: var(--ui-primary); }
.ui-toolbar .ui-search { flex: 1 1 16em; margin: 0; max-width: 32em; }
.ui-count { margin-left: auto; font-size: 13px; color: #616161; white-space: nowrap; }
.ui-count b { color: var(--ui-text); font-size: 15px; }
.ui-chip { border: 1px solid #c5cae9; background: #fff; border-radius: 16px; padding: .3em .9em; font: inherit; font-size: 13px; cursor: pointer; color: #303f9f; }
.ui-chip.all { background: var(--ui-primary); border-color: var(--ui-primary); color: #fff; }
.ui-chip.some { background: var(--ui-primary-light); }
.ui-chip span { opacity: .75; margin-left: .3em; }

/* tables */
.ui-scroll { border: 1px solid var(--ui-border); border-radius: 4px; overflow-y: auto; }
.ui-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ui-table th { position: sticky; top: 0; background: #eeeeee; text-align: left; font-weight: 500; padding: .7em .9em; z-index: 1; white-space: nowrap; }
.ui-table td { padding: .55em .9em; border-bottom: 1px solid var(--ui-row-border); vertical-align: middle; }
.ui-table tbody tr:last-child td { border-bottom: 0; }
.ui-table tbody tr:hover { background: #fafafa; }
.ui-table tr[data-href] { cursor: pointer; }
.ui-table tr[data-href]:hover { background: var(--ui-hover); }
.ui-table td.num, .ui-table th.num { text-align: right; white-space: nowrap; }
.ui-table td.actions { text-align: right; white-space: nowrap; width: 1%; padding-top: .2em; padding-bottom: .2em; }
.ui-table td.wrap { white-space: normal; word-break: break-word; }
.ui-table small, .ui-muted { color: var(--ui-muted); }
.ui-table input[type=checkbox] { accent-color: var(--ui-primary); }
.ui-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 40em; }
.ui-empty { padding: 2em; text-align: center; color: #9e9e9e; }
.ui-pager { display: flex; gap: .5em; padding: 1em 1.5em; }

/* period selection, key figures, tabs */
.ui-segmented { display: inline-flex; border: 1px solid #c5cae9; border-radius: 4px; overflow: hidden; flex-wrap: wrap; }
.ui-segmented a, .ui-segmented button { padding: .4em .9em; font: inherit; font-size: 13px; color: #303f9f; text-decoration: none; background: #fff; border: 0; border-left: 1px solid #c5cae9; cursor: pointer; }
.ui-segmented > :first-child { border-left: 0; }
.ui-segmented a:hover, .ui-segmented button:hover { background: var(--ui-primary-light); }
.ui-segmented .active { background: var(--ui-primary); color: #fff; }
.ui-segmented .active:hover { background: var(--ui-primary); }
/* previous / current / next, e.g. the month of the bookings */
.ui-stepper { flex-wrap: nowrap; align-items: stretch; }
.ui-stepper a { display: inline-flex; align-items: center; padding: 0 .35em; }
.ui-stepper a .material-icons { font-size: 20px; }
.ui-stepper > span { display: inline-flex; align-items: center; justify-content: center; min-width: 6.5em; padding: .4em .6em; font-size: 13px; font-weight: 500; color: var(--ui-primary); background: var(--ui-primary-light); border-left: 1px solid #c5cae9; }
.ui-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10em, 1fr)); gap: 1em; margin: 1em 0 1.2em; }
.ui-stats > div { border: 1px solid var(--ui-border); border-radius: 4px; padding: .7em 1em; }
.ui-stats span { display: block; font-size: 12px; color: var(--ui-muted); }
.ui-stats b { font-size: 22px; font-weight: 400; white-space: nowrap; }
.ui-amount-positive { color: var(--ui-success); }
.ui-amount-negative { color: var(--ui-danger); }
.ui-tabs { display: flex; gap: .2em; border-bottom: 1px solid var(--ui-border); margin-bottom: 1em; }
.ui-tabs button { border: 0; background: none; font: inherit; font-size: 14px; padding: .7em 1.1em; color: var(--ui-muted); cursor: pointer; }
.ui-tabs button.active { color: var(--ui-text); box-shadow: inset 0 -3px 0 var(--ui-primary); }
.ui-tab-panel { display: none; }
.ui-tab-panel.active { display: block; }
.ui-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5em; }
.ui-grid-2 h3 { font-size: 16px; font-weight: 500; margin: 0 0 .6em; line-height: 1.3; }
.ui-table tr.ui-sum td { background: #eeeeee; font-weight: 500; border-bottom: 0; }
.ui-table tbody tr.ui-sum:hover { background: none; }

/* labels and messages */
.ui-tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--ui-border); color: #424242; margin-left: .4em; vertical-align: 1px; }
.ui-tag.success { background: #c8e6c9; color: #1b5e20; }
.ui-alert { background: #fff3e0; border-left: 3px solid var(--ui-warning); padding: .6em .8em; font-size: 13px; margin-top: .8em; }
.ui-alert.error { background: #ffebee; border-color: var(--ui-danger); }
.ui-alert.info { background: var(--ui-primary-light); border-color: var(--ui-primary); }
.ui-icon-warn { color: var(--ui-danger); vertical-align: middle; text-decoration: none; }
.ui-icon-warn .material-icons { font-size: 18px; }

/* forms: label above the input, two columns on wide screens */
.ui-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1em 1.5em; }
.ui-field { display: flex; flex-direction: column; gap: .35em; min-width: 0; }
.ui-field.wide { grid-column: 1 / -1; }
.ui-field > label, .ui-field > .ui-label { font-size: 12px; font-weight: 500; color: #616161; }
.ui-field input:not([type=checkbox]), .ui-field select, .ui-field textarea { width: 100%; box-sizing: border-box; padding: .6em .75em; border: 1px solid #ccc; border-radius: 4px; font: inherit; font-size: 14px; background: #fff; color: var(--ui-text); }
.ui-field textarea { resize: vertical; min-height: 7em; }
.ui-field input:focus, .ui-field select:focus, .ui-field textarea:focus { outline: none; border-color: var(--ui-primary); box-shadow: 0 0 0 2px var(--ui-primary-light); }
.ui-field-row { display: flex; gap: .5em; }
.ui-field-row > * { flex: 1; min-width: 0; }
.ui-input-prefix { position: relative; }
.ui-input-prefix > span { position: absolute; left: .75em; top: 50%; transform: translateY(-50%); color: var(--ui-muted); }
.ui-field .ui-input-prefix input { padding-left: 1.8em; }
.ui-check { display: flex; align-items: center; gap: .6em; font-size: 14px; cursor: pointer; align-self: start; padding: .5em 0; }
.ui-check input { width: 18px; height: 18px; accent-color: var(--ui-primary); margin: 0; }
/* rich text field (uiEditor) */
.ui-editor { position: relative; border: 1px solid #ccc; border-radius: 4px; background: #fff; }
.ui-editor:focus-within { border-color: var(--ui-primary); box-shadow: 0 0 0 2px var(--ui-primary-light); }
.ui-editor-toolbar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 2px 6px; padding: 4px; border-bottom: 1px solid var(--ui-border); background: #fafafa; border-radius: 4px 4px 0 0; }
.ui-editor-group { display: flex; gap: 1px; }
.ui-editor-group + .ui-editor-group { padding-left: 6px; border-left: 1px solid var(--ui-border); }
.ui-editor-toolbar button { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 4px; border: 0; border-radius: 4px; background: none; color: #424242; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.ui-editor-toolbar button .material-icons { font-size: 19px; }
.ui-editor-toolbar button:hover:not(:disabled) { background: var(--ui-hover); }
.ui-editor-toolbar button.active { background: var(--ui-primary-light); color: var(--ui-primary); }
.ui-editor-toolbar button:disabled { color: #bdbdbd; cursor: default; }
.ui-editor-color i { position: absolute; left: 7px; right: 7px; bottom: 4px; height: 3px; border-radius: 2px; background: transparent; }
.ui-editor-palette { position: absolute; z-index: 2; display: grid; grid-template-columns: repeat(5, 26px); gap: 4px; padding: 6px; background: #fff; border: 1px solid var(--ui-border); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.ui-editor-palette button { width: 26px; min-width: 0; height: 26px; padding: 0; border: 1px solid rgba(0,0,0,.12); border-radius: 50%; }
.ui-editor-palette button .material-icons { font-size: 16px; }
.ui-editor-content .tiptap { min-height: 12em; padding: .6em .9em; font-size: 14px; line-height: 1.5; outline: none; overflow-wrap: anywhere; }
.ui-editor-content .tiptap > :first-child { margin-top: 0; }
.ui-editor-content .tiptap p { margin: 0 0 .5em; }
.ui-editor-content .tiptap h1 { font-size: 1.6em; line-height: 1.3; margin: .6em 0 .3em; }
.ui-editor-content .tiptap h2 { font-size: 1.3em; line-height: 1.3; margin: .6em 0 .3em; }
.ui-editor-content .tiptap ul, .ui-editor-content .tiptap ol { padding-left: 1.6em; margin: 0 0 .5em; }
.ui-editor-content .tiptap li > p { margin: 0; }
.ui-editor-content .tiptap blockquote { margin: 0 0 .5em; padding-left: .9em; border-left: 3px solid var(--ui-border); color: var(--ui-muted); }
.ui-editor-content .tiptap a { color: var(--ui-primary); }
.ui-editor-content .tiptap img { max-width: 100%; height: auto; }
.ui-editor-content .tiptap mark { border-radius: 2px; padding: 0 1px; }
.ui-form-actions { display: flex; justify-content: flex-end; gap: .6em; padding: 1.1em 1.5em; border-top: 1px solid var(--ui-border); }

/* message after saving or deleting, hides itself */
.ui-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; gap: .8em; max-width: calc(100vw - 32px); box-sizing: border-box; background: #323232; color: #fff; border-radius: 6px; padding: .55em .5em .55em 1em; font-size: 14px; box-shadow: 0 3px 12px rgba(0,0,0,.3); animation: ui-toast-in .2s ease-out; }
.ui-toast > .material-icons { color: #81c784; font-size: 20px; }
.ui-toast .ui-icon-btn { color: #bdbdbd; width: 28px; height: 28px; }
.ui-toast .ui-icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.ui-toast.hiding { opacity: 0; transition: opacity .3s; }
.ui-toast-undo { margin: 0; }
.ui-toast-undo button { border: 0; background: none; color: #9fa8da; font: inherit; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: .35em .5em; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.ui-toast-undo button:hover { background: rgba(255,255,255,.1); }
@keyframes ui-toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* dialogs (ui.js uiOpenModal): the card of the page, without its margins */
.ui-modal { border: 0; padding: 0; background: none; width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: visible; }
.ui-modal.wide { width: min(900px, calc(100vw - 32px)); }
.ui-modal.small { width: min(480px, calc(100vw - 32px)); }
.ui-modal.small .ui-form { grid-template-columns: 1fr; }
.ui-modal::backdrop { background: rgba(33, 33, 33, .45); }
.ui-modal[open] { animation: ui-modal-in .15s ease-out; }
.ui-modal > .ui-card { margin: 0; max-width: none; max-height: calc(100dvh - 48px); display: flex; flex-direction: column; box-shadow: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12); }
.ui-modal > .ui-card > .ui-card-body { overflow-y: auto; flex: 1; min-height: 0; }
.ui-modal .ui-card-head { flex-wrap: nowrap; padding-right: .8em; }
.ui-modal .ui-card-head h2 { flex-basis: auto; }
.ui-modal .ui-modal-error { margin: 0 1.5em 1em; }
.ui-modal .ui-toast { position: fixed; }
.ui-field-row > .ui-icon-btn { flex: none; align-self: center; }
/* Chart.js canvas (responsive), the height comes from the container */
.ui-chart { position: relative; width: 100%; margin: .5em 0 1.5em; }
html.ui-loading, html.ui-loading * { cursor: progress !important; }
@keyframes ui-modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }

@media (max-width: 1000px) {
    .ui-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .ui-form { grid-template-columns: 1fr; }
    .ui-card-head, .ui-card-body { padding-left: 1em; padding-right: 1em; }
    .ui-table th, .ui-table td { padding-left: .6em; padding-right: .6em; }
    .ui-hide-mobile { display: none; }

    /* phones: short page title, compact account selector, card titles above their buttons */
    .ui-title-path { display: none; }
    .ui-header .mdl-layout__header-row { padding-left: 64px; padding-right: 8px; }
    .ui-header-account { margin-right: .2em; padding-left: .5em; }
    .ui-header-account .material-icons { display: none; }
    .ui-header-account select { max-width: 7.5em; }
    /* search: a magnifier, opening the field over the header */
    .ui-global-search { margin-right: 0; position: static; }
    .ui-global-search .ui-global-search-open { display: inline-flex; }
    .ui-global-search-field { display: none; }
    .ui-global-search.open .ui-global-search-field { display: flex; position: fixed; top: 10px; left: 8px; right: 8px; width: auto; z-index: 21; background: #fff; border-color: var(--ui-primary); }
    .ui-global-search.open .ui-global-search-field kbd { display: none; }
    .ui-global-search-results { position: fixed; top: 54px; left: 8px; right: 8px; width: auto; }
    .ui-card-head { gap: .6em; padding-top: .9em; padding-bottom: .9em; }
    .ui-card-head h2 { flex-basis: 100%; }
    .ui-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6em; }
    .ui-stats b { white-space: normal; overflow-wrap: anywhere; font-size: 19px; }
    .ui-toast { bottom: 12px; }

    /* phones: forms in dialogs fill the screen, confirmations stay small */
    .ui-modal:not(.small) { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; }
    .ui-modal:not(.small) > .ui-card { height: 100%; max-height: none; border-radius: 0; }
    /* the toolbar wraps: separators would stand at the start of a row */
    .ui-editor-toolbar { gap: 2px 12px; }
    .ui-editor-group + .ui-editor-group { padding-left: 0; border-left: 0; }
    /* small dialogs sit at the top, the keyboard opening for the focused field would cover the middle */
    .ui-modal.small { margin: 16px auto auto; }
    .ui-modal .ui-card-head { padding-right: .4em; }
    .ui-modal .ui-form-actions { padding: .8em 1em; }
}
