:root {
    --primary-color: #f8f9fa;
    --bg-color: #f3f3f3;
    --border-color: #e5e7eb;
    --text-dark: #0f1117;
    --text-mid: #374151;
    --text-soft: #6b7280;
    --text-muted: #9ca3af;
    --surface: #ffffff;
    --surface-alt: #fafbfc;
    --surface-hover: #f3f4f6;
    --row-line: #f0f1f3;
    --on-strong: #ffffff;
    --negative: #993300;
    --sans: 'DM Sans', system-ui, -apple-system, sans-serif;
}

body {
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    position: relative;
    display: flex;
    background-color: var(--bg-color);
}

#option-dialog {
    position: fixed;
}

.deal-advanced {
    display: none;
}

#rake-back-group-table td {
    border-bottom: 0;
    padding: 0;
}

.sidebar {
    padding-top: 1em;
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    z-index: 1000;
    background-color: var(--primary-color);
    border-right: 0.5px solid var(--border-color);

    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar-hidden {
    transform: translateX(-250px);
}

.sidebar-ease-in {
    transition: 0.2s ease-in-out;
}

#sidebar-close-button {
    position: fixed;
    right: 0.5em;
    top: 0.5em;
    z-index: 1;
}

#sidebar-transparent-fill {
    height: 100vh;
    position: fixed;
    width: 100%;
    right: 0;
    top: 0;
    background: black;
    opacity: 0.3;
    z-index: 1;
}

.aalign-user-dropdown {
    bottom: 3em;
    position: fixed;
    margin-bottom: 0.2em;
    text-align: center;
}

.aalign-copyright {
    position: fixed;
    bottom: 0.5em;
    width: 250px;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 0 0.5em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aalign-powered-by {
    position: fixed;
    bottom: 0;
    width: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3em;
    padding: 0.45em 0;
    border-top: 0.5px solid var(--border-color);
    background-color: var(--primary-color);
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.aalign-powered-by:hover {
    background-color: var(--border-color);
    color: var(--text-mid);
}

.aalign-powered-by-label {
    font-weight: 400;
    letter-spacing: 0.02em;
}

.aalign-powered-by-brand {
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-dark);
}

#settings-box {
    text-align: center;
    width: 200px;
    color: var(--text-soft);
    font-size: 1.05rem;
    border-radius: 2em;
    text-decoration: none;
}

#settings-box a {
    text-decoration: none;
    color: var(--text-mid);
}


.wrapper {
    padding: 1em 1em 1em 1em;
    flex-grow: 1;
    width: calc(100vw - 250px);
}

.wrapper-padding-left {
    padding-left: calc(1em + 250px) !important;
}

#sibebar-toggle-card svg {
    height: 2em;
}

#floating-full-screen-info {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    cursor: not-allowed;
}

.form-check {
    padding-top: 0.5em;
    padding-bottom: 0.5em;
}

#floating-full-screen-info .card {
    position: fixed;
    width: fit-content;
    height: fit-content;
    margin-top: 4.2em;
    left: 50%;
    transform: translate(-50%, 0);
}

#floating-full-screen-info .card-body {
    font-size: 1.6em;
}

#floating-full-screen-info .card-body * {
    max-height: 80vh;
}

.card {
    background-color: var(--primary-color);
    border: 0.5px solid var(--border-color) !important;
    border-radius: 12px !important;
}

.card.shadow-sm {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
}

.card .card {
    background-color: var(--bg-color);
    border-color: var(--border-color) !important;
}

.btn-primary {
    margin-bottom: 1px;
}

.card h5 {
    margin-bottom: 0.9em;
    color: var(--text-dark);
}

#login-box {
    display: flex;
    justify-content: center;
    margin-top: 5em;
}

#logo {
    height: 3em;
}

.login-message {
    position: absolute;
    margin-top: -5em;
}

.btn {
    border-radius: 7px;
    /*font-size: 0.875rem;*/
}

.btn-dark {
    background-color: var(--text-dark);
    border-color: var(--text-dark);
}

.btn-dark:hover {
    background-color: var(--text-mid);
    border-color: var(--text-mid);
}

/*.data-negative {*/
/*    background-color: #f9cfa9;*/
/*    color: black;*/
/*}*/

#accounting-wrapper {
    visibility: hidden;
}


.btn-flat {
    padding: 0 1em;
}

.dropdown-menu {
    min-width: 0px;
}

.aop-other-week td {
    background-color: #a4c2f4 !important;
}

.aop-button-in-table-header {
    padding-left: 0.5em;
    padding-right: 0.5em;
}

.pre-wrap {
    white-space: pre;
}

.navbar-brand {
    margin-top: 1em;
    margin-bottom: 0.2em;
}

.nav-item-image-xxx {
    margin-top: -0.2em;
    width: 22px;
    margin-right: 0.5em;
    font-size: 1.1rem;
    vertical-align: middle;
}

.nav-link-xxx {
    color: var(--text-mid);
    font-size: 1.2rem;
    padding-left: 1em !important;
    padding-right: 1em !important;
    margin-bottom: 0.2em;
}

.nav-link-xxx:hover {
    transition: 0.2s;
    background-color: var(--bg-color) !important;
    color: var(--text-dark) !important;
}

.active-xxx {
    background-color: var(--bg-color) !important;
    color: var(--text-dark) !important;
    border-radius: 8px;
}

.active-xxx .aop-blend-nav-item-to-color {
    filter: sepia(1) saturate(10) hue-rotate(90deg) brightness(1.2) contrast(1.5);
}

.aop-choose-button-parent {
    padding: 0px 5px !important;
    text-align: center;
    display: table-cell;
    vertical-align: middle;
}

.aop-small-button {
    border-radius: .25rem;
    cursor: pointer;
    padding: 2px 10px;
    width: 100%;
}

.account-confirmed > td:not(.last-edited-field) {
    background-color: #d1e7dd !important;
}

.account-unconfirmed > td:not(.last-edited-field) {
    background-color: #fde2e4 !important;
}

.last-edited-field {
    background-color: #fff3cd !important;
    box-shadow: inset 0 0 0 2px #ffc107;
}

.aop-small-button:hover {
    background-color: darkgrey;
    transition: background-color 0.5s;
}

/* the + that adds an account or a benefactor to a deal is only as wide as the sign */
.aop-small-button[title="Add account to deal"],
.aop-small-button[title="Add benefactor to deal"] {
    display: block;
    width: fit-content;
    min-width: 2.5rem;
    margin: 0 auto;
}

.d-invisible {
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

.dropdown .notification-bubble {
    margin-left: -12px;
}

.lock-small-button {
    border-radius: .25rem;
    cursor: pointer;
    padding: 2px 10px;
}

.aop-choose-button-parent span:hover {
    transition: 0.5s;
    background-color: #bbb !important;
    color: black !important;
}

.xxx-tab {
    border-radius: 0;
}

/*.clickable-with-hover td {*/
/*    padding: 0 0 0 0.2em !important;*/
/*}*/

.lds-ring {
    margin: 0 auto;
    position: relative;
    width: 80px;
    height: 80px;
}

.lds-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 64px;
    height: 64px;
    margin: 8px;
    border: 8px solid var(--text-dark);
    border-radius: 50%;
    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--text-dark) transparent transparent transparent;
}

.lds-ring div:nth-child(1) {
    animation-delay: -0.45s;
}

.lds-ring div:nth-child(2) {
    animation-delay: -0.3s;
}

.lds-ring div:nth-child(3) {
    animation-delay: -0.15s;
}

@keyframes lds-ring {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.lds-facebook {
    margin: 0 auto;
    position: relative;
    width: 80px;
    height: 80px;
}

.lds-facebook div {
    display: inline-block;
    position: absolute;
    left: 8px;
    width: 16px;
    background: var(--text-dark);
    animation: lds-facebook 1.2s cubic-bezier(0, 0.5, 0.5, 1) infinite;
}

.lds-facebook div:nth-child(1) {
    left: 8px;
    animation-delay: -0.24s;
}

.lds-facebook div:nth-child(2) {
    left: 32px;
    animation-delay: -0.12s;
}

.lds-facebook div:nth-child(3) {
    left: 56px;
    animation-delay: 0ms;
}

@keyframes lds-facebook {
    0% {
        top: 8px;
        height: 64px;
    }
    50%, 100% {
        top: 24px;
        height: 32px;
    }
}

.remove-before-saving {
    padding: 0 !important;
}

.button-card button {
    margin-bottom: 1px;
}

.card-body-xxx {
    padding-right: 0;
    padding-left: 0;
    padding-bottom: 0;
    margin-right: 1rem;
    margin-left: 1rem;
    margin-bottom: 1rem;
}

pre {
    margin-bottom: 0;
}

.aop-no-overflow-td-permanent, .aop-no-overflow-td-permanent > pre, .aop-no-overflow-td {
    overflow: visible !important;
    white-space: normal !important;
}

.btn-flat {
    border: 1px solid #212529 !important;
}

.aop-hide-button {
    padding-left: 0.5em;
    padding-right: 0.5em;
    background: none;
    border: none;
    position: absolute;
    margin-top: -1em;
}

.rake-structure-box {
    border: 1px solid #cccccc;
    overflow: visible;
    word-wrap: normal;
    font-size: 0.8em;
}

.aop-no-overflow-td-permanent > .rake-structure-box:not(:first-child) {
    margin-top: 2px;
}

.deal-assign-box {
    border: 1px solid black;
    overflow: visible;
    word-wrap: normal;
}


.deal-assign-box > .aop-small-button {
    width: inherit !important;
}

.deal-assign-box-parent {
    color: black;
    background-color: lightgray;
}

.deal-assign-box-roles {
    background-color: darkorange;
}

.show-on-mobile {
    display: none;
}

.hide-on-mobile {
}

.aop-hide-button:hover {
    background: none;
    outline: none;
    font-size: 18px;
    transition: 0.1s;
}

.edited-input {
    background-color: rgb(191, 208, 126);
}

.attention-button {
    transition: transform 0.5s ease-in-out;
    animation: attentionAnimation 2s infinite alternate, colorAnimation 4s infinite;
    animation-timing-function: ease-in-out;
}

@keyframes attentionAnimation {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes colorAnimation {
    0% { color: red; }
    40% { color: yellow; }
    60% { color: green; }
    100% { color: red; }
}

.scroll-arrow {
    position: absolute;
    display: none;
    left: 0.3em;
    top: 0.3em;
}

.scroll-arrow-right {
    left: 0.3em;
    top: 0.3em;
}

.aop-page-button {
    padding: 0 0.3em;
    width: 20px;
    height: inherit;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: none;
    cursor: pointer;
    display: inline-block;
}

.aop-page-indicator {
    display: flex;
    text-align: center;
    justify-content: center;
    margin-top: 1px;
}

.aop-page-button-forward {
    background-image: url('/acc/icons8-forward-64.png');
    margin-right: 0.2em;
}

.aop-page-button-back {
    background-image: url('/acc/icons8-back-64.png');
}

#user-info-box {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.rotate-180 {
    transform: rotate(180deg);
    transition: all 0.8s;
}

#generic-div-to-load-in {
    z-index: 100;
    position: absolute;
    margin-top: 1em;
    padding-right: 1em;
}

.date-end-field {
    width: 100%;
}

.input-group-last {
    border-radius: 0.25rem !important;
}

.select-monday {
    width: fit-content;
}

.notification-bubble {
    position: absolute;
    background-color: #a83248;
    border: 1px solid #a83248;
    border-radius: 9em;
    margin-top: -2.34em;
    color: #fff;
    left: 0;
    /*right: calc(2.5em + 20px);*/
    font-size: 0.7em;
    padding: 0 0.4em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

    opacity: 1; /* Ensure the bubble is visible initially */
    transform: scale(0); /* Ensure the bubble is at its original size initially */
    transition: all 0.8s ease-in-out; /* Smooth transition for pop effect */
}

.notification-bubble.animate {
    animation: moveRight 0.5s forwards;
}

@keyframes moveRight {
    from {
        transform: translateX(0) scale(0);
    }
    to {
        transform: translateX(20px) scale(1);
    }
}

.notification-bubble-pop {
    transform: scale(1.2); /* Increase the size slightly to create a pop effect */
    opacity: 0; /* Slightly reduce opacity to enhance the effect */
}

.btn .bi,
button .bi {
    font-size: 1em;
}

/* Large heading text is cap-height dominated; shift icon up to visually center it */
h1 .bi, h2 .bi, h3 .bi {
    vertical-align: 0;
    margin-right: 0.3em;
}

btn .b1 {
    vertical-align: 0;
}

h4 .bi, h5 .bi {
    margin-right: 0.25em;
}

.input-group-text .bi {
    font-size: 1rem;
}

/* A page shown in a frame of another page (the Apps tabs of Deal & Account) has no sidebar and title of its own */
html.embedded .sidebar,
html.embedded #sidebar-close-button,
html.embedded #sidebar-transparent-fill,
html.embedded #sibebar-toggle-card {
    display: none !important;
}

/* the page fills the frame, so it is as wide as the Major Site tables of the parent page */
html.embedded .wrapper,
html.embedded .wrapper-padding-left {
    width: 100%;
    padding: 0 !important;
}

html.embedded .wrapper > h1,
html.embedded .page-head h1 {
    display: none;
}

/* ===== Sidebar (added at the end on purpose: these rules override the older ones above) ===== */
.nav-item-image-xxx {
    width: 22px;
    height: 22px;
    margin: 0;
    font-size: 1.2rem;
    line-height: 22px;
    text-align: center;
    object-fit: contain;
    flex: none;
    vertical-align: baseline;
}

.nav-link-xxx {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: 1.05rem;
    padding: .55rem .9rem !important;
    margin: 0 0 .15rem;
    border-radius: 10px;
}

.nav-link-xxx.dropdown-toggle::after {
    margin-left: auto;
}

.nav-link-xxx.active-xxx {
    font-weight: 500;
}

.nav-link-xxx.active-xxx::before {
    content: "";
    position: absolute;
    left: -.45rem;
    top: .45rem;
    bottom: .45rem;
    width: 3px;
    border-radius: 3px;
    background: var(--text-dark);
}

.sidebar .navbar,
.sidebar .navbar .container-fluid {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

#aopnavbar {
    width: 100%;
    padding: 0 .75rem;
}

.nav-section-label {
    list-style: none;
    margin: 1rem .9rem .3rem;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* the number bubbles sit at the right of the item, not over its icon */
.notification-bubble-container {
    position: relative;
}

.dropdown .notification-bubble {
    margin-left: 0;
}

.notification-bubble {
    top: 50%;
    right: .8rem;
    left: auto;
    margin: 0;
    min-width: 1.4rem;
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.25rem;
    padding: 0 .4rem;
    transform: translateY(-50%) scale(0);
}

.dropdown-toggle .notification-bubble {
    right: 2rem;
}

.notification-bubble.animate {
    animation: bubbleIn 0.4s forwards;
}

@keyframes bubbleIn {
    from {
        transform: translateY(-50%) scale(0);
    }
    to {
        transform: translateY(-50%) scale(1);
    }
}

.notification-bubble-pop {
    transform: translateY(-50%) scale(1.2);
}

/* the user at the bottom */
.aalign-user-dropdown {
    bottom: 2.6em;
    width: 250px;
    padding: .7rem 1.4rem .4rem;
    text-align: left;
    border-top: 1px solid var(--border-color);
    background-color: var(--primary-color);
}

#user-info-box {
    display: block;
    font-size: .8rem;
    color: var(--text-muted);
}

#own-username {
    color: var(--text-dark);
    font-weight: 600;
}

#settings-box > a {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: var(--text-mid);
    text-decoration: none;
    padding: .35rem 0;
}

#settings-box > a:hover {
    color: var(--text-dark);
}

/* the user block has padding: keep it inside the 250px sidebar */
.aalign-user-dropdown {
    box-sizing: border-box;
    left: 0;
}


/* ===== Dark theme: data-theme="dark" is set on <html> (system preference by default, toggle in the Settings menu) ===== */
html[data-theme="dark"] {
    color-scheme: dark;
    --primary-color: #16181d;
    --bg-color: #0e1014;
    --border-color: #2a2e37;
    --text-dark: #f1f3f7;
    --text-mid: #d1d5db;
    --text-soft: #9aa3b2;
    --text-muted: #747c8a;
    --surface: #1a1d23;
    --surface-alt: #1e2128;
    --surface-hover: #262a33;
    --row-line: #262a33;
    --on-strong: #0f1117;
    --negative: #ff8a65;
}


/* the one-time hint about the dark theme */
.theme-hint {
    position: absolute; left: 12px; right: 12px; bottom: calc(100% + 10px); z-index: 1100;
    display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem .6rem .9rem;
    background: var(--text-dark); color: var(--on-strong); border-radius: 12px; font-size: .82rem; line-height: 1.25;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25); animation: themeHintIn .5s ease both;
}
.theme-hint::after {
    content: ""; position: absolute; left: 28px; bottom: -7px; width: 14px; height: 14px;
    background: var(--text-dark); transform: rotate(45deg); border-radius: 2px;
}
.theme-hint-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.theme-hint-text span { opacity: .75; }
.theme-hint-try { border: 0; border-radius: 8px; padding: .3rem .65rem; background: var(--on-strong); color: var(--text-dark); font-weight: 600; font-size: .8rem; }
.theme-hint-close { border: 0; background: transparent; color: inherit; opacity: .6; font-size: 1.2rem; line-height: 1; padding: 0 .2rem; }
.theme-hint-close:hover { opacity: 1; }
.theme-hint-pulse { animation: themeHintPulse 1.8s ease-in-out infinite; border-radius: 10px; }
@keyframes themeHintIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes themeHintPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(91, 132, 214, .0); } 50% { box-shadow: 0 0 0 6px rgba(91, 132, 214, .25); } }
@media (prefers-reduced-motion: reduce) { .theme-hint, .theme-hint-pulse { animation: none; } }


/* the suggestion menu of the inputs with a list (combo.js) */
.aop-combo { position: fixed; z-index: 2000; overflow-y: auto; padding: .25rem 0; font-size: .95rem; border-radius: .25rem; }
.aop-combo .dropdown-item { display: block; width: 100%; padding: .4rem 1rem; text-align: left; white-space: normal; }
.aop-combo .aop-combo-active { background-color: var(--surface-hover); color: var(--text-dark); }

/* Switches are small on a phone: on small and touch screens they are bigger, with more room around them */
.form-switch {
    min-height: 2rem;
    padding-left: 3.7rem;
}

.form-switch .form-check-input {
    width: 3.1rem;
    height: 1.7rem;
    margin-top: .05rem;
    margin-left: -3.7rem;
    cursor: pointer;
}

.form-switch .form-check-label {
    padding-top: .2rem;
}

.form-switch.login-remember {
    padding-left: 3.7rem;
}

/* The small buttons and selects of the lists (the icons at the end of a row ...) are easy to miss with a finger */
@media (pointer: coarse) {
    .btn-sm {
        min-width: 2.4rem;
        min-height: 2.4rem;
    }

    .form-select-sm,
    .form-control-sm {
        min-height: 2.4rem;
    }
}


/* Impersonation ("Login as"): a red bar over the whole page, so nobody forgets whose account this is */
#impersonation-banner {
    position: fixed; top: 0; left: 0; right: 0; height: 40px; z-index: 2000;
    display: flex; align-items: center; justify-content: center; gap: 1rem;
    padding: 0 1rem; background: #c62828; color: #fff; font-size: .92rem; line-height: 1.2;
}
#impersonation-banner form { margin: 0; flex: none; }
#impersonation-banner .btn { white-space: nowrap; font-weight: 600; }
html.embedded #impersonation-banner { display: none; }
#impersonation-banner .impersonation-hide { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; color: #fff; opacity: .75; padding: .3rem .5rem; line-height: 1; }
#impersonation-banner .impersonation-hide:hover { opacity: 1; }
html:not(.embedded) body:has(#impersonation-banner) { padding-top: 40px; }
html:not(.embedded) body:has(#impersonation-banner) .sidebar { top: 40px; height: calc(100vh - 40px); }
@media (max-width: 700px) {
    #impersonation-banner { height: auto; min-height: 40px; padding: .35rem .75rem; font-size: .8rem; flex-wrap: wrap; }
    html:not(.embedded) body:has(#impersonation-banner) { padding-top: 64px; }
    html:not(.embedded) body:has(#impersonation-banner) .sidebar { top: 64px; height: calc(100vh - 64px); }
}
