/*
 * Material Design 3 over Bootstrap 5.
 *
 * A theme, not a framework: Bootstrap's markup, classes and scripts stay as
 * they are; its CSS variables are pointed at Material 3 colour roles, shapes
 * and type, and the few components whose shape differs (buttons, fields,
 * dialogs, cards, tables, navigation, Selectize) are reshaped.
 *
 * Colours: a tonal palette from one blue seed. Light mode only, as the
 * application. Type: Roboto (public/vendor/roboto, OFL). Loaded by
 * layouts/app.blade.php after every other stylesheet.
 */

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../vendor/roboto/roboto-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../vendor/roboto/roboto-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------ roles */

:root {
    --md-primary: #0b57d0;
    --md-primary-rgb: 11, 87, 208;
    --md-on-primary: #ffffff;
    --md-primary-container: #d3e3fd;
    --md-on-primary-container: #041e49;
    --md-secondary-container: #c2e7ff;
    --md-on-secondary-container: #001d35;
    --md-tertiary-container: #c4eed0;
    --md-on-tertiary-container: #072711;
    --md-error: #b3261e;
    --md-error-container: #f9dedc;
    --md-on-error-container: #410e0b;
    --md-warning-container: #ffdf99;
    --md-on-warning-container: #251a00;

    --md-surface: #f8fafd;
    --md-surface-lowest: #ffffff;
    --md-surface-low: #f0f4f9;
    --md-surface-container: #e9eef6;
    --md-surface-high: #dde3ea;
    --md-on-surface: #1f1f1f;
    --md-on-surface-variant: #444746;
    --md-outline: #747775;
    --md-outline-variant: #c4c7c5;

    --md-elevation-1: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px 1px rgba(0, 0, 0, .15);
    --md-elevation-2: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 6px 2px rgba(0, 0, 0, .15);
    --md-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .3);

    /* Bootstrap, pointed at the roles. */
    --bs-font-sans-serif: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-font-size: .875rem;
    --bs-body-line-height: 1.43;
    --bs-body-color: var(--md-on-surface);
    --bs-body-color-rgb: 31, 31, 31;
    --bs-body-bg: var(--md-surface-lowest);
    --bs-tertiary-bg: var(--md-surface);
    --bs-secondary-color: var(--md-on-surface-variant);
    --bs-emphasis-color: var(--md-on-surface);
    --bs-primary: var(--md-primary);
    --bs-primary-rgb: var(--md-primary-rgb);
    --bs-link-color: var(--md-primary);
    --bs-link-color-rgb: var(--md-primary-rgb);
    --bs-link-hover-color: var(--md-on-primary-container);
    --bs-border-color: var(--md-outline-variant);
    --bs-border-radius: .25rem;
    --bs-border-radius-sm: .25rem;
    --bs-border-radius-lg: .75rem;
    --bs-focus-ring-color: rgba(var(--md-primary-rgb), .25);
    --bs-success-bg-subtle: var(--md-tertiary-container);
    --bs-danger-bg-subtle: var(--md-error-container);
}

body { letter-spacing: .0178em; }

h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5 { font-weight: 400; letter-spacing: 0; }
.h4, h4 { font-size: 1.75rem; }
.fw-semibold, .fw-bold, strong, b { font-weight: 500 !important; }

body.bg-body-tertiary { background-color: var(--md-surface) !important; }

/* ------------------------------------------------------------ top app bar */

.navbar.bg-dark {
    background-color: var(--md-surface) !important;
    border-bottom: 0 !important;
    min-height: 64px;
}

.navbar[data-bs-theme="dark"] {
    --bs-body-color: var(--md-on-surface);
    --bs-emphasis-color: var(--md-on-surface);
    --bs-navbar-color: var(--md-on-surface-variant);
    --bs-navbar-hover-color: var(--md-on-surface);
    --bs-navbar-active-color: var(--md-on-surface);
    --bs-navbar-brand-color: var(--md-on-surface);
    --bs-navbar-brand-hover-color: var(--md-on-surface);
    --bs-navbar-toggler-border-color: transparent;
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2868, 71, 70, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    color: var(--md-on-surface);
}

.navbar[data-bs-theme="dark"] .navbar-toggler-icon {
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2868, 71, 70, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar .navbar-brand { font-size: 1.375rem; font-weight: 400; }
.navbar .navbar-toggler { border-radius: 50%; }

/* The bar of a Google application: tinted like the ground it sits on, the
   menu button and the product on the left, the account on the right. */
.navbar.app-bar {
    position: sticky;
    top: 0;
    z-index: 1040;
    min-height: 64px;
    padding: 8px 4px;
    background-color: var(--md-surface);
}

.app-bar .navbar-brand {
    color: var(--md-on-surface-variant);
    font-size: 1.375rem;
    font-weight: 400;
    letter-spacing: 0;
    padding: 0;
    margin-left: 4px;
}

.app-bar .app-mark { width: 40px; height: 40px; flex: 0 0 40px; }

/* A round icon button, 48px, as the bar's menu button. */
.app-bar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--md-on-surface-variant);
    transition: background-color .15s;
}

.app-bar-icon:hover { background-color: rgba(31, 31, 31, .08); }
.app-bar-icon:focus-visible { outline: 2px solid var(--md-primary); outline-offset: -2px; }

/* The account: the person's initials on a disc. */
.app-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--md-primary);
    color: var(--md-on-primary);
    font-size: .875rem;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1;
    box-shadow: 0 0 0 0 rgba(31, 31, 31, .08);
    transition: box-shadow .15s;
}

button.app-avatar:hover,
button.app-avatar[aria-expanded="true"] { box-shadow: 0 0 0 4px rgba(31, 31, 31, .12); }

.app-avatar.app-avatar-lg { width: 72px; height: 72px; margin: 0 auto 12px; font-size: 1.75rem; font-weight: 400; display: flex; }

/* Its menu: a rounded card with who is signed in and what they can do. */
.dropdown-menu.app-account {
    --bs-dropdown-border-radius: 28px;
    --bs-dropdown-bg: var(--md-surface-container);
    width: min(22rem, calc(100vw - 16px));
    margin-top: 4px !important;
    padding: 16px;
    box-shadow: var(--md-elevation-2);
}

.app-account-who {
    margin-bottom: 12px;
    padding: 20px 16px;
    border-radius: 20px;
    background-color: var(--md-surface-lowest);
    text-align: center;
    overflow-wrap: anywhere;
}

.app-account .btn-outline-secondary { background-color: var(--md-surface-lowest); }

/* The page: a white sheet with rounded corners on the tinted ground. */
.main-column { padding: 0 8px 8px; }

.app-sheet {
    min-height: calc(100vh - 64px - 8px);
    border-radius: 16px;
    background-color: var(--md-surface-lowest);
}

@media (min-width: 768px) {
    .main-column { padding: 0 16px 16px 0; }
    .app-sheet { min-height: calc(100vh - 64px - 16px); }
}

.app-sheet h1.h4, .app-sheet h1 { font-size: 1.375rem; line-height: 1.75rem; }

/* Signed out: the form on one centred card, as Google's sign-in. */
.app-signed-out { min-height: calc(100vh - 64px); display: flex; flex-direction: column; justify-content: center; padding-bottom: 10vh; }
.app-signed-out .card { --bs-card-border-radius: 28px; --bs-card-inner-border-radius: 28px; border: 0; padding: 20px 12px; }
.app-signed-out .card-header { font-size: 1.75rem; font-weight: 400; padding-top: 1rem; padding-bottom: .5rem; }

/* ------------------------------------------------------------ navigation drawer */

.sidebar { top: 64px; }

.sidebar-column { background-color: var(--md-surface); }

.sidebar .nav-link {
    border-radius: 28px;
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: var(--md-on-surface-variant);
    font-weight: 500;
}

.sidebar .nav .nav .nav-link { font-weight: 400; }
.sidebar .nav-link:hover { background-color: rgba(31, 31, 31, .08); color: var(--md-on-surface); }

.sidebar .nav-link.active,
.sidebar .nav-pills .nav-link.active {
    background-color: var(--md-secondary-container);
    color: var(--md-on-secondary-container) !important;
    font-weight: 500;
}

.sidebar .border-start { border-color: transparent !important; }

/* ------------------------------------------------------------ buttons */

.btn {
    --bs-btn-padding-x: 1.5rem;
    --bs-btn-padding-y: .625rem;
    --bs-btn-font-size: .875rem;
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: 20px;
    --bs-btn-line-height: 1.25rem;
    letter-spacing: .00714em;
    transition: background-color .15s, box-shadow .15s, color .15s;
}

.btn-sm {
    --bs-btn-padding-x: 1rem;
    --bs-btn-padding-y: .375rem;
    --bs-btn-font-size: .8125rem;
    --bs-btn-border-radius: 16px;
}

/* Filled */
.btn-primary {
    --bs-btn-bg: var(--md-primary);
    --bs-btn-border-color: var(--md-primary);
    --bs-btn-color: var(--md-on-primary);
    --bs-btn-hover-bg: #1a62d6;
    --bs-btn-hover-border-color: #1a62d6;
    --bs-btn-hover-color: var(--md-on-primary);
    --bs-btn-active-bg: #2a6dda;
    --bs-btn-active-border-color: #2a6dda;
    --bs-btn-disabled-bg: rgba(31, 31, 31, .12);
    --bs-btn-disabled-border-color: transparent;
    --bs-btn-disabled-color: rgba(31, 31, 31, .38);
}

.btn-primary:hover { box-shadow: var(--md-elevation-1); }

/* Outlined */
.btn-outline-primary,
.btn-outline-secondary {
    --bs-btn-color: var(--md-primary);
    --bs-btn-border-color: var(--md-outline);
    --bs-btn-hover-bg: rgba(var(--md-primary-rgb), .08);
    --bs-btn-hover-border-color: var(--md-outline);
    --bs-btn-hover-color: var(--md-primary);
    --bs-btn-active-bg: rgba(var(--md-primary-rgb), .12);
    --bs-btn-active-border-color: var(--md-outline);
    --bs-btn-active-color: var(--md-primary);
}

.btn-outline-danger {
    --bs-btn-color: var(--md-error);
    --bs-btn-border-color: var(--md-outline);
    --bs-btn-hover-bg: rgba(179, 38, 30, .08);
    --bs-btn-hover-border-color: var(--md-outline);
    --bs-btn-hover-color: var(--md-error);
    --bs-btn-active-bg: rgba(179, 38, 30, .12);
    --bs-btn-active-border-color: var(--md-outline);
    --bs-btn-active-color: var(--md-error);
}

.btn-outline-warning {
    --bs-btn-color: #7a5900;
    --bs-btn-border-color: var(--md-outline);
    --bs-btn-hover-bg: rgba(122, 89, 0, .08);
    --bs-btn-hover-border-color: var(--md-outline);
    --bs-btn-hover-color: #7a5900;
    --bs-btn-active-bg: rgba(122, 89, 0, .12);
    --bs-btn-active-border-color: var(--md-outline);
    --bs-btn-active-color: #7a5900;
}

.btn-warning {
    --bs-btn-bg: var(--md-warning-container);
    --bs-btn-border-color: var(--md-warning-container);
    --bs-btn-color: var(--md-on-warning-container);
    --bs-btn-hover-bg: #f5d27f;
    --bs-btn-hover-border-color: #f5d27f;
    --bs-btn-hover-color: var(--md-on-warning-container);
}

.btn-danger {
    --bs-btn-bg: var(--md-error);
    --bs-btn-border-color: var(--md-error);
    --bs-btn-hover-bg: #bb3a33;
    --bs-btn-hover-border-color: #bb3a33;
}

/* Icon buttons (the + and x of a repeatable row): round. */
.btn.btn-icon { --bs-btn-padding-x: 0; --bs-btn-border-radius: 50%; width: 2.5rem; height: 2.5rem; }

/* The + and x of a form's repeatable rows: the sign alone, no button around it. */
.btn.btn-bare {
    --bs-btn-padding-x: .375rem;
    --bs-btn-padding-y: 0;
    --bs-btn-border-width: 0;
    --bs-btn-bg: transparent;
    --bs-btn-hover-bg: transparent;
    --bs-btn-active-bg: transparent;
    --bs-btn-color: var(--md-primary);
    --bs-btn-hover-color: var(--md-on-primary-container);
    --bs-btn-active-color: var(--md-on-primary-container);
    --bs-btn-font-size: 1.75rem;
    --bs-btn-font-weight: 400;
    --bs-btn-line-height: 1;
    width: auto;
    height: auto;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.card-header .btn.btn-bare { min-height: 0; }
/* Rows of a repeatable list inside a card: the last one needs no gap below. */
.card-body > div > .address-row:last-child { margin-bottom: 0 !important; }

.btn.btn-bare.btn-bare-danger {
    --bs-btn-color: var(--md-on-surface-variant);
    --bs-btn-hover-color: var(--md-error);
    --bs-btn-active-color: var(--md-error);
}

/* Text: the dialog's dismissing action. */
.btn-secondary,
.btn-link {
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-color: var(--md-primary);
    --bs-btn-hover-bg: rgba(var(--md-primary-rgb), .08);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-hover-color: var(--md-primary);
    --bs-btn-active-bg: rgba(var(--md-primary-rgb), .12);
    --bs-btn-active-border-color: transparent;
    --bs-btn-active-color: var(--md-primary);
    text-decoration: none;
}

.navbar .btn-link.nav-link { padding: .5rem; border-radius: 0; }

/* ------------------------------------------------------------ cards */

.card {
    --bs-card-border-radius: 12px;
    --bs-card-inner-border-radius: 12px;
    --bs-card-border-color: var(--md-outline-variant);
    --bs-card-bg: var(--md-surface-lowest);
    --bs-card-cap-bg: transparent;
}

.card.shadow-sm { box-shadow: none !important; }
.card-header { font-size: 1rem; font-weight: 500; border-bottom: 0; padding: 1rem 1rem .25rem; }

/* ------------------------------------------------------------ fields (outlined) */

.form-label { color: var(--md-on-surface-variant); font-size: .8125rem; margin-bottom: .375rem; }

.form-control,
.form-select {
    min-height: 48px;
    border: 1px solid var(--md-outline);
    border-radius: 4px;
    background-color: transparent;
    color: var(--md-on-surface);
    font-size: 1rem;
    padding-left: 1rem;
}

.form-control-sm,
.form-select-sm { min-height: 36px; font-size: .875rem; padding-left: .75rem; }
textarea.form-control { padding-top: .75rem; }

.form-control:hover,
.form-select:hover { border-color: var(--md-on-surface); }

.form-control:focus,
.form-select:focus {
    border-color: var(--md-primary);
    box-shadow: inset 0 0 0 1px var(--md-primary);
    background-color: transparent;
}

.form-control.is-invalid,
.form-select.is-invalid { border-color: var(--md-error); background-image: none; padding-right: 1rem; }
.form-control.is-invalid:focus { box-shadow: inset 0 0 0 1px var(--md-error); }
.invalid-feedback { color: var(--md-error); font-size: .75rem; padding-left: 1rem; }

/* A button joined to a field (the ANAF lookup next to CIF / CNP) keeps the field's shape. */
.input-group > .btn { --bs-btn-border-radius: 4px; --bs-btn-padding-x: 1rem; min-height: 48px; border-color: var(--md-outline); }
.input-group > .form-control:focus { z-index: 5; }

.form-check-input:checked { background-color: var(--md-primary); border-color: var(--md-primary); }
.form-check-input:focus { box-shadow: 0 0 0 .25rem rgba(var(--md-primary-rgb), .2); }

/* Selectize, as an outlined field. */
.selectize-control .selectize-input {
    min-height: 48px;
    border: 1px solid var(--md-outline) !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    background: transparent !important;
    font-size: 1rem;
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.selectize-control .selectize-input.focus {
    border-color: var(--md-primary) !important;
    box-shadow: inset 0 0 0 1px var(--md-primary) !important;
}

.selectize-dropdown {
    border: 0 !important;
    border-radius: 4px !important;
    box-shadow: var(--md-elevation-2) !important;
    background: var(--md-surface-low) !important;
    margin-top: 4px;
    padding: 8px 0;
}

.selectize-dropdown .option { padding: .625rem 1rem; font-size: .9375rem; }
.selectize-dropdown .active { background: rgba(31, 31, 31, .08) !important; color: var(--md-on-surface) !important; }

.selectize-control.multi .selectize-input > div {
    border-radius: 8px !important;
    background: var(--md-secondary-container) !important;
    color: var(--md-on-secondary-container) !important;
    border: 0 !important;
    padding: 2px 8px !important;
}

/* ------------------------------------------------------------ dialogs */

.modal {
    --bs-modal-border-radius: 28px;
    --bs-modal-inner-border-radius: 28px;
    --bs-modal-border-width: 0;
    --bs-modal-bg: var(--md-surface-low);
    --bs-modal-box-shadow: var(--md-elevation-3);
    --bs-modal-header-border-width: 0;
    --bs-modal-footer-border-width: 0;
    --bs-modal-header-padding: 1.5rem 1.5rem .75rem;
    --bs-modal-padding: .75rem 1.5rem;
    --bs-modal-footer-gap: .5rem;
}

.modal-content { box-shadow: var(--md-elevation-3); }
.modal-title { font-size: 1.5rem; font-weight: 400; }
.modal-footer { padding: .75rem 1.5rem 1.5rem; }
.modal .form-control,
.modal .form-select,
.modal .selectize-control .selectize-input { background-color: var(--md-surface-lowest) !important; }
.modal-backdrop { --bs-backdrop-opacity: .32; }

/* ------------------------------------------------------------ tables */

.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(var(--md-primary-rgb), .04);
    --bs-table-border-color: var(--md-outline-variant);
    font-size: .875rem;
}

.table > thead th {
    color: var(--md-on-surface-variant);
    font-weight: 500;
    font-size: .8125rem;
    border-bottom-width: 1px;
    padding-top: .875rem;
    padding-bottom: .875rem;
}

.table > tbody td { padding-top: .75rem; padding-bottom: .75rem; }
.table > :not(caption) > * > * { padding-left: 1rem; padding-right: 1rem; }

/* ------------------------------------------------------------ badges, alerts */

.badge { border-radius: 8px; font-weight: 500; padding: .35em .65em; }
.badge.rounded-pill { border-radius: 8px !important; }
.text-bg-success { background-color: var(--md-tertiary-container) !important; color: var(--md-on-tertiary-container) !important; }
.text-bg-danger { background-color: var(--md-error-container) !important; color: var(--md-on-error-container) !important; }
.text-bg-warning { background-color: var(--md-warning-container) !important; color: var(--md-on-warning-container) !important; }
.text-bg-primary { background-color: var(--md-primary-container) !important; color: var(--md-on-primary-container) !important; }
.text-bg-secondary { background-color: var(--md-surface-high) !important; color: var(--md-on-surface-variant) !important; }
.text-bg-light { background-color: var(--md-surface-container) !important; color: var(--md-on-surface-variant) !important; }

.alert { border: 0; border-radius: 12px; }
.alert-success { background-color: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.alert-danger { background-color: var(--md-error-container); color: var(--md-on-error-container); }
.alert-warning { background-color: var(--md-warning-container); color: var(--md-on-warning-container); }
.alert-info { background-color: var(--md-primary-container); color: var(--md-on-primary-container); }

.spinner-border { color: var(--md-primary); }

/* ------------------------------------------------------------ menus */

.dropdown-menu {
    --bs-dropdown-border-width: 0;
    --bs-dropdown-border-radius: 4px;
    --bs-dropdown-bg: var(--md-surface-low);
    --bs-dropdown-box-shadow: var(--md-elevation-2);
    --bs-dropdown-link-hover-bg: rgba(31, 31, 31, .08);
    --bs-dropdown-link-active-bg: rgba(31, 31, 31, .12);
    --bs-dropdown-link-active-color: var(--md-on-surface);
    --bs-dropdown-item-padding-y: .625rem;
    box-shadow: var(--md-elevation-2);
}

/* ------------------------------------------------------------ off-canvas drawer */

.offcanvas { --bs-offcanvas-bg: var(--md-surface-low); border-radius: 0 16px 16px 0; }

/* The period field: flatpickr shows a copy of it, which takes no inline width
   (but does take its classes: w-100 makes it as wide as its column). */
#filterPeriod + input.form-control { width: 100%; }

/* ------------------------------------------------------------ lists */

/* The actions on ticked rows show only once something is ticked. */
.bulk-action:disabled,
#bulkDeleteBtn:disabled { display: none; }

/* A round icon button: a page's "more" menu, a row's actions. */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--md-on-surface-variant);
    transition: background-color .15s, opacity .15s;
}
.icon-btn:hover,
.icon-btn[aria-expanded="true"] { background-color: rgba(31, 31, 31, .08); }
.icon-btn:focus-visible { outline: 2px solid var(--md-primary); outline-offset: -2px; }
.icon-btn.icon-btn-sm { width: 32px; height: 32px; flex-basis: 32px; }

/* A row's actions stay quiet until the row is pointed at. */
@media (hover: hover) {
    .row-menu .icon-btn { opacity: .35; }
    tr:hover .row-menu .icon-btn,
    .row-menu .icon-btn:focus-visible,
    .row-menu .icon-btn[aria-expanded="true"] { opacity: 1; }
}
tr.row-opens { cursor: pointer; }

/* Above a list: the search, then what narrows it, on one line. */
.list-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.list-filters > input[type="search"] { flex: 1 1 16rem; max-width: 30rem; }
/* A search with its filters inside, at the end of the pill (as in Gmail). */
.list-filters > .search-field { position: relative; flex: 1 1 16rem; max-width: 30rem; }
.search-field > input[type="search"] { width: 100%; padding-right: 3.25rem; }
.search-field > .icon-btn { position: absolute; top: 50%; right: .25rem; transform: translateY(-50%); }
.list-filters > .form-select,
.list-filters > .selectize-control { flex: 0 1 16rem; width: auto; }

/* The search of a Google application: a tinted pill with its magnifier. */
input[type="search"].form-control {
    border-radius: 999px;
    padding-left: 3rem;
    background-color: var(--md-surface-container);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23444746' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 1rem center;
    background-size: 1.15rem;
    box-shadow: none;
}
input[type="search"].form-control:hover { box-shadow: none; background-color: var(--md-surface-high); }
input[type="search"].form-control:focus { background-color: var(--md-surface-lowest); box-shadow: var(--md-elevation-1); }

/* A list's period, beside its search: the same pill, with a calendar, and
   the usual periods behind a button at its end. */
.list-filters > .period-field { flex: 0 0 auto; width: 19rem; max-width: none; }
.period-field > #filterPeriod,
.period-field > #filterPeriod + input.form-control {
    padding-right: 3.25rem;
    border-radius: 999px;
    padding-left: 3rem;
    background-color: var(--md-surface-container);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23444746' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='2'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 1rem center;
    background-size: 1.15rem;
    box-shadow: none;
    cursor: pointer;
}
.period-field > #filterPeriod:hover,
.period-field > #filterPeriod + input.form-control:hover { box-shadow: none; background-color: var(--md-surface-high); }
.period-field > #filterPeriod:focus,
.period-field > #filterPeriod + input.form-control:focus { background-color: var(--md-surface-lowest); box-shadow: var(--md-elevation-1); }
#periodModal .modal-content { overflow: hidden; }
.period-presets { padding-bottom: .5rem; }
.period-presets .list-group-item { padding: .75rem 1.5rem; border: 0; }

/* A list's sums: the arrow that opens them by purpose, turned while open. */
.list-totals .totals-toggle { width: 24px; height: 24px; flex-basis: 24px; margin-left: -.75rem; }
.list-totals .totals-toggle svg { transition: transform .2s; }
.list-totals .totals-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

/* A filter in force: a chip that a click removes. */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 32px;
    padding: 0 .75rem;
    border-radius: 8px;
    background-color: var(--md-secondary-container);
    color: var(--md-on-secondary-container);
    font-size: .875rem;
    text-decoration: none;
    white-space: nowrap;
}
.filter-chip:hover { color: var(--md-on-secondary-container); box-shadow: var(--md-elevation-1); }

/* "Done": a short message at the bottom of the window that leaves by itself. */
.app-sheet > .alert-success[role="alert"] {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 1090;
    max-width: min(36rem, calc(100vw - 48px));
    margin: 0;
    padding: 14px 16px;
    border-radius: 4px;
    background-color: #303030;
    color: #f2f2f2;
    box-shadow: var(--md-elevation-3);
    cursor: pointer;
    transition: opacity .25s, transform .25s;
}
.app-sheet > .alert-success[role="alert"].is-leaving { opacity: 0; transform: translateY(8px); }
.app-sheet > .alert-success[role="alert"] a { color: #a8c7fa; }

.filter-chip.filter-chip-warning { background-color: var(--md-warning-container); color: var(--md-on-warning-container); }

/* "Connected": a green dot before the words. */
.status-dot { display: inline-block; width: .6rem; height: .6rem; margin-right: .35rem; border-radius: 50%; background-color: #1e8e3e; }

/* A number to read and, with a click, to copy. */
.btn-number { display: block; margin-left: auto; margin-right: auto; padding: 0 .5rem; border: 0; border-radius: 16px; background: none; color: inherit; cursor: copy; }
.btn-number:hover { background-color: var(--md-surface-low); }

/* The start page: how many of something wait, on a disc. */
.todo-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 .5rem;
    border-radius: 999px;
    background-color: var(--md-primary-container);
    color: var(--md-on-primary-container);
    font-weight: 500;
}

/* The search of the top bar: for everything, in the middle of the bar. */
.app-bar .app-search { flex: 1 1 auto; max-width: 45rem; margin-left: 2rem; margin-right: 1rem; }
.app-bar .app-search .form-control { background-color: var(--md-surface-container); }
.app-bar .app-search .form-control:focus { background-color: var(--md-surface-lowest); }

/* On a phone: the bar keeps the mark without the name, so the account still
   fits; above a list, the search and the period take a line each. */
@media (max-width: 575.98px) {
    .app-bar .navbar-brand > span { display: none; }
    .list-filters > input[type="search"],
    .list-filters > .search-field,
    .list-filters > .form-select,
    .list-filters > .selectize-control { flex: 1 1 100%; width: 100%; max-width: none; }
    .app-sheet > .alert-success[role="alert"] { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* ============================================================
 * Încasări și plăți: the register's own pieces, on top of the shell above.
 * ============================================================ */

/* Icon buttons whose drawing comes without its own stroke (the page header's back arrow). */
.icon-btn svg:not([stroke]) { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Figures at a glance: tonal tiles, no outline. */
.stat-tile { padding: 16px 20px; border-radius: 16px; background-color: var(--md-surface-low); }
.stat-label { font-weight: 500; }
.stat-value { font-size: 1.75rem; line-height: 2.25rem; margin: 2px 0 6px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.stat-detail { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .8125rem; color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }

/* Primary tabs (the months, the settings): the current one in the primary
   colour over a short bar; on a phone they scroll sideways, no scrollbar. */
.md-tabs { border-bottom: 1px solid var(--md-outline-variant); scrollbar-width: none; }
.md-tabs::-webkit-scrollbar { display: none; }
.md-tabs .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 48px;
    padding: 0 16px;
    border-radius: 0;
    color: var(--md-on-surface-variant);
    font-weight: 500;
    white-space: nowrap;
}
.md-tabs .nav-link:hover { background-color: rgba(31, 31, 31, .06); color: var(--md-on-surface); }
.md-tabs .nav-link.active { color: var(--md-primary); }
.md-tabs .nav-link.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background-color: var(--md-primary);
}

/* The search's results, above the month. */
.search-results { background-color: var(--md-surface-low); border: 0; }

/* A quiet notice: a line of text on a tinted band. */
.notice {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
    padding: 10px 16px; border-radius: 12px;
    background-color: var(--md-surface-low); color: var(--md-on-surface-variant); font-size: .875rem;
}

@media (max-width: 575.98px) {
    .stat-tile { padding: 10px 12px; }
    .stat-value { font-size: 1.375rem; line-height: 1.75rem; }
}

/* A page's header: a back arrow, the title and what it is for, its actions. */
.page-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 20px; }
.page-header .icon-btn { margin-left: -8px; flex: 0 0 auto; }
.page-header-text { flex: 1 1 16rem; min-width: 0; }
.page-header h1 { font-size: 1.375rem; line-height: 1.75rem; font-weight: 400; margin: 0; }
.page-header-sub { color: var(--md-on-surface-variant); font-size: .875rem; }
.page-header-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.page-narrow { max-width: 760px; margin-inline: auto; }
.page-medium { max-width: 960px; margin-inline: auto; }

input[type="password"]::-ms-reveal { display: none; }


details.fold > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px; cursor: pointer; list-style: none; font-weight: 500;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after {
    content: ""; width: 8px; height: 8px; flex: 0 0 auto; margin-right: 4px;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); transition: transform .15s; opacity: .7;
}
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold > summary .fold-hint { margin-left: auto; font-weight: 400; font-size: .875rem; color: var(--md-on-surface-variant); }
details.fold > .fold-body { padding: 4px 20px 20px; }
details.fold.is-danger > summary { color: var(--md-error, #b3261e); }

.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 8px;
    font-size: .75rem; font-weight: 500; line-height: 1.25rem; white-space: nowrap;
    background-color: var(--md-surface-low); color: var(--md-on-surface-variant);
}
.chip.is-on { background-color: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.chip.is-warn { background-color: var(--md-warning-container); color: var(--md-on-warning-container); }

.plain-table { font-variant-numeric: tabular-nums; }
.plain-table > :not(caption) > * > * { padding: .625rem .75rem; border-bottom-color: var(--md-outline-variant); }
.plain-table thead th { font-size: .75rem; font-weight: 500; color: var(--md-on-surface-variant); white-space: nowrap; }
.plain-table tbody tr:last-child > * { border-bottom: 0; }
.plain-table tr.is-muted > * { color: var(--md-on-surface-variant); }

/* Over a modal's form while a document is being read. */
.reading-veil {
    position: absolute; inset: 0; z-index: 10; border-radius: inherit;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    background-color: rgba(255, 255, 255, .8); color: var(--md-on-surface-variant); font-size: .875rem;
}
.reading-veil.d-none { display: none; }
.reading-veil .spinner-border { width: 2.5rem; height: 2.5rem; }

/* The unread count on the app bar's bell. */
.app-bar-badge { position: absolute; top: 6px; right: 4px; font-size: .625rem; padding: .2em .45em; }

/* Selectize (layouts.partials.selectize), as an outlined field. */
.selectize-control { width: 100%; }
.selectize-control .selectize-input {
    min-height: 48px;
    border: 1px solid var(--md-outline) !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--md-on-surface);
    font-size: 1rem;
    padding: .75rem 2.5rem .75rem 1rem;
    display: flex;
    align-items: center;
}
.selectize-control .selectize-input > input { font-size: 1rem; }
.selectize-control .selectize-input.focus {
    border-color: var(--md-primary) !important;
    box-shadow: inset 0 0 0 1px var(--md-primary) !important;
}
.selectize-dropdown {
    z-index: 1060;
    border: 0 !important;
    border-radius: 4px !important;
    box-shadow: var(--md-elevation-2) !important;
    background: var(--md-surface-low) !important;
    margin-top: 4px;
    padding: 8px 0;
}
.selectize-dropdown .option { padding: .625rem 1rem; font-size: .9375rem; }
.selectize-dropdown .active { background: rgba(31, 31, 31, .08) !important; color: var(--md-on-surface) !important; }

/* A select beside the search (the court, on Dosare instanță and DEN): the
   search's own tinted pill and outline, with a courthouse where the search
   has its magnifier; the same colours on hover and while open. */
select.form-select.pill-select,
.selectize-control.pill-select .selectize-input {
    border-radius: 999px !important;
    border-color: var(--md-outline) !important;
    background-color: var(--md-surface-container) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23444746' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9.5 12 4l9 5.5z'/%3E%3Cpath d='M6 12v6M10 12v6M14 12v6M18 12v6'/%3E%3Cpath d='M4 21h16M4 18h16'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: 1rem center !important;
    background-size: 1.15rem !important;
    padding-left: 3rem !important;
    box-shadow: none !important;
}
select.form-select.pill-select:hover,
.selectize-control.pill-select .selectize-input:hover { background-color: var(--md-surface-high) !important; border-color: var(--md-on-surface) !important; }
select.form-select.pill-select:focus,
.selectize-control.pill-select .selectize-input.focus {
    background-color: var(--md-surface-lowest) !important;
    border-color: var(--md-primary) !important;
    box-shadow: var(--md-elevation-1) !important;
}

/* A Selectize control whose field has an error. */
.selectize-control.is-invalid .selectize-input { border-color: var(--md-error) !important; }
.selectize-control.is-invalid .selectize-input.focus { box-shadow: inset 0 0 0 1px var(--md-error) !important; }
