/* Custom styles for Earthtone Repair Manager */

/* Theme palettes */
:root {
    --earth-primary: #5a4a3a;
    --earth-primary-hover: #493c30;
    --earth-secondary: #8b7d6b;
    --earth-success: #6b8e6b;
    --earth-info: #6a8e9e;
    --earth-warning: #c4a35a;
    --earth-danger: #a66b5c;
    --earth-light: #f5f1e8;
    --earth-surface: #ebe5d9;
    --earth-dark: #3f3429;
    --earth-muted: #8b7d6b;
    --earth-link: #4a6b7c;
    --earth-link-hover: #36525f;
    --earth-primary-soft: #b9ad9f;
    --earth-success-soft: #b5d4b5;
    --earth-info-soft: #a8c4d4;
    --earth-warning-soft: #d9c79f;
    --earth-danger-soft: #d4a8a0;
    --earth-alert-success-bg: #d4e4d4;
    --earth-alert-info-bg: #d4e4e9;
    --earth-alert-warning-bg: #f4ead4;
    --earth-alert-danger-bg: #e9d9d4;
}

.theme-default {
    --earth-primary: #5a4a3a;
    --earth-primary-hover: #493c30;
    --earth-secondary: #8b7d6b;
    --earth-success: #6b8e6b;
    --earth-info: #6a8e9e;
    --earth-warning: #c4a35a;
    --earth-danger: #a66b5c;
    --earth-light: #f5f1e8;
    --earth-surface: #ebe5d9;
    --earth-dark: #3f3429;
    --earth-muted: #8b7d6b;
    --earth-link: #4a6b7c;
    --earth-link-hover: #36525f;
    --earth-primary-soft: #b9ad9f;
    --earth-success-soft: #b5d4b5;
    --earth-info-soft: #a8c4d4;
    --earth-warning-soft: #d9c79f;
    --earth-danger-soft: #d4a8a0;
    --earth-alert-success-bg: #d4e4d4;
    --earth-alert-info-bg: #d4e4e9;
    --earth-alert-warning-bg: #f4ead4;
    --earth-alert-danger-bg: #e9d9d4;
}

.theme-blue {
    --earth-primary: #4a6b7c;
    --earth-primary-hover: #3b5867;
    --earth-secondary: #6d7f8a;
    --earth-success: #5f8a78;
    --earth-info: #5f8da3;
    --earth-warning: #b99f67;
    --earth-danger: #a76666;
    --earth-light: #eef4f6;
    --earth-surface: #dfeaf0;
    --earth-dark: #2d4350;
    --earth-muted: #6f8490;
    --earth-link: #2f6f8f;
    --earth-link-hover: #254f66;
    --earth-primary-soft: #a8bfca;
    --earth-success-soft: #afcec1;
    --earth-info-soft: #add0df;
    --earth-warning-soft: #d8c79d;
    --earth-danger-soft: #d3adad;
    --earth-alert-success-bg: #d8ebe3;
    --earth-alert-info-bg: #d8eaf1;
    --earth-alert-warning-bg: #f0e6cb;
    --earth-alert-danger-bg: #ecdada;
}

.theme-green {
    --earth-primary: #6b8e6b;
    --earth-primary-hover: #5a7a5a;
    --earth-secondary: #7d8b6b;
    --earth-success: #5f956f;
    --earth-info: #648f8a;
    --earth-warning: #b49b55;
    --earth-danger: #a66b5c;
    --earth-light: #f1f6ef;
    --earth-surface: #e2eddf;
    --earth-dark: #3f5d3f;
    --earth-muted: #72866a;
    --earth-link: #4d7f6b;
    --earth-link-hover: #3d6655;
    --earth-primary-soft: #a8c5a8;
    --earth-success-soft: #afd5bc;
    --earth-info-soft: #acd0cc;
    --earth-warning-soft: #d6c78f;
    --earth-danger-soft: #d4a8a0;
    --earth-alert-success-bg: #d8ead8;
    --earth-alert-info-bg: #d8ebe8;
    --earth-alert-warning-bg: #efe6c6;
    --earth-alert-danger-bg: #eadad6;
}

.theme-purple {
    --earth-primary: #7c6b8e;
    --earth-primary-hover: #68587a;
    --earth-secondary: #8a7a91;
    --earth-success: #6f8e7a;
    --earth-info: #6f7fa3;
    --earth-warning: #b69a62;
    --earth-danger: #a66373;
    --earth-light: #f3f0f6;
    --earth-surface: #e7e0ee;
    --earth-dark: #4d405a;
    --earth-muted: #82738c;
    --earth-link: #695592;
    --earth-link-hover: #514171;
    --earth-primary-soft: #b9adc7;
    --earth-success-soft: #b4d0bd;
    --earth-info-soft: #b4bedb;
    --earth-warning-soft: #d8c596;
    --earth-danger-soft: #d6aab5;
    --earth-alert-success-bg: #dceade;
    --earth-alert-info-bg: #dfe3f0;
    --earth-alert-warning-bg: #f0e5cc;
    --earth-alert-danger-bg: #ecd9de;
}

.theme-red {
    --earth-primary: #a66b5c;
    --earth-primary-hover: #8e584a;
    --earth-secondary: #94746b;
    --earth-success: #758c66;
    --earth-info: #6c8794;
    --earth-warning: #bf9554;
    --earth-danger: #a85b5b;
    --earth-light: #f7f0ed;
    --earth-surface: #eddfda;
    --earth-dark: #624036;
    --earth-muted: #927468;
    --earth-link: #8d594d;
    --earth-link-hover: #6d443b;
    --earth-primary-soft: #d0aaa0;
    --earth-success-soft: #becdab;
    --earth-info-soft: #b4c9d1;
    --earth-warning-soft: #dec291;
    --earth-danger-soft: #d4a3a3;
    --earth-alert-success-bg: #e2ead7;
    --earth-alert-info-bg: #dfe9ed;
    --earth-alert-warning-bg: #f1e2c7;
    --earth-alert-danger-bg: #eed8d8;
}

body {
    min-height: 100vh;
    background-color: var(--earth-light);
}

body.global-search-active {
    overflow-x: hidden;
}

.jumbotron {
    background-color: var(--earth-surface);
}

.card {
    margin-bottom: 1rem;
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(90, 74, 58, 0.1);
}

.settings-menu .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.settings-menu-card {
    border: 1px solid transparent;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.settings-menu-card:hover,
.settings-menu-card:focus {
    background-color: #fffdf8;
    border-color: rgba(90, 74, 58, 0.16);
    box-shadow: 0 0.35rem 0.9rem rgba(90, 74, 58, 0.16);
    color: inherit;
}

.settings-menu-card:focus-visible {
    outline: 0.2rem solid rgba(74, 107, 124, 0.35);
    outline-offset: 0.15rem;
}

.settings-menu .bi {
    color: var(--earth-success) !important;
}

.settings-card-logo {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    background-color: var(--earth-success);
    mask: url("../img/square-logo.svg") center / contain no-repeat;
    -webkit-mask: url("../img/square-logo.svg") center / contain no-repeat;
}

.config-option-row {
    align-items: center;
    background-color: #fffdf8;
    border: 1px solid rgba(90, 74, 58, 0.08);
    border-radius: 0.5rem;
    box-shadow: 0 0.2rem 0.55rem rgba(90, 74, 58, 0.08);
    display: flex;
    gap: 1rem;
    padding: 1rem 1.1rem;
}

.config-option-main {
    flex: 1 1 16rem;
    min-width: 0;
}

.config-option-input {
    border-color: rgba(90, 74, 58, 0.16);
    font-size: 1rem;
    min-height: 3.1rem;
}

.config-option-delete {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    height: 3.1rem;
    justify-content: center;
    width: 3.1rem;
}

.config-add-button,
.config-actions .btn {
    align-items: center;
    display: inline-flex;
    font-size: 1rem;
    font-weight: 600;
    gap: 0.4rem;
    min-height: 3rem;
    padding: 0.65rem 1rem;
}

@media (max-width: 575.98px) {
    .config-option-row {
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.85rem;
    }
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.app-navbar {
    background-color: var(--earth-primary) !important;
    position: relative;
    z-index: 1060;
}

.modal-backdrop {
    z-index: 1090;
}

.modal {
    z-index: 1100;
}

.app-navbar .navbar-collapse {
    min-width: 0;
}

.app-navbar .navbar-nav.me-auto {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.app-navbar .navbar-nav.ms-auto {
    flex: 0 0 auto;
}

.navbar-mobile-actions {
    gap: 0.65rem;
    margin-left: auto;
}

@media (min-width: 992px) {
    .app-navbar .navbar-collapse {
        display: flex !important;
    }

    .app-navbar .navbar-nav {
        align-items: center;
    }

    .app-navbar .navbar-nav.me-auto {
        flex-wrap: nowrap;
    }

    .app-navbar .navbar-nav.ms-auto {
        margin-left: 0 !important;
    }

    .app-navbar .navbar-nav > .nav-item {
        position: relative;
    }

    .app-navbar .navbar-nav > .nav-item:not([hidden]) + .nav-item:not([hidden])::before {
        background-color: rgba(255, 255, 255, 0.18);
        content: "";
        height: 1.35rem;
        left: 0;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 1px;
    }

    .app-navbar .navbar-nav > .nav-item > .nav-link:not(.quick-create-toggle):not(.navbar-icon-toggle) {
        align-items: center;
        display: inline-flex;
        gap: 0.35rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        white-space: nowrap;
    }

    .app-navbar .navbar-nav.me-auto > .nav-item > .nav-link:not(.quick-create-toggle):not(.navbar-icon-toggle) .bi {
        flex: 0 0 auto;
        line-height: 1;
    }
}

@media (min-width: 992px) and (max-width: 1399.98px) {
    .app-navbar .navbar-nav.me-auto > .nav-item > .nav-link:not(.quick-create-toggle):not(.navbar-icon-toggle) {
        flex-direction: column;
        gap: 0.25rem;
        justify-content: center;
        line-height: 1.15;
        text-align: center;
    }

    .app-navbar .navbar-nav.me-auto > .nav-item > .nav-link:not(.quick-create-toggle):not(.navbar-icon-toggle) .bi {
        margin: 0 auto;
    }
}

@media (min-width: 1200px) {
    .app-navbar .navbar-nav > .nav-item > .nav-link:not(.quick-create-toggle):not(.navbar-icon-toggle) {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (min-width: 1400px) {
    .app-navbar .navbar-nav > .nav-item > .nav-link:not(.quick-create-toggle):not(.navbar-icon-toggle) {
        padding-left: 1.2rem;
        padding-right: 1.2rem;
    }
}

.quick-create-toggle,
.navbar-icon-toggle {
    align-items: center;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.95) !important;
    display: inline-flex;
    font-size: 1.45rem;
    height: 2.65rem;
    justify-content: center;
    line-height: 1;
    margin: 0.15rem 0;
    padding: 0;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    width: 2.65rem;
}

.mobile-quick-create-toggle,
.mobile-navbar-icon-toggle {
    height: 3rem;
    margin: 0;
    width: 3rem;
}

.quick-create-toggle:hover,
.quick-create-toggle:focus,
.quick-create-toggle.show,
.navbar-icon-toggle:hover,
.navbar-icon-toggle:focus,
.global-search-toggle[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.78);
    color: #fff !important;
    transform: translateY(-1px);
}

.quick-create-menu {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.75rem 1.75rem rgba(63, 52, 41, 0.24);
    min-width: 18rem;
    padding: 0.55rem;
}

.nav-overflow-item[hidden] {
    display: none !important;
}

.nav-overflow-item .dropdown-toggle {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    white-space: nowrap;
}

.nav-overflow-menu {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.75rem 1.75rem rgba(63, 52, 41, 0.24);
    min-width: 14rem;
    padding: 0.45rem;
}

.nav-overflow-link {
    align-items: center;
    border-radius: 0.4rem;
    display: flex;
    gap: 0.6rem;
    padding: 0.65rem 0.75rem;
}

.quick-create-item {
    align-items: center;
    border-radius: 0.4rem;
    display: flex;
    gap: 0.85rem;
    padding: 0.8rem 0.85rem;
}

.quick-create-item:hover,
.quick-create-item:focus {
    background-color: var(--earth-light);
}

.quick-create-icon {
    align-items: center;
    border-radius: 0.45rem;
    color: #fff;
    display: inline-flex;
    flex: 0 0 2.5rem;
    font-size: 1.25rem;
    height: 2.5rem;
    justify-content: center;
    width: 2.5rem;
}

.quick-create-title,
.quick-create-subtitle {
    display: block;
}

.quick-create-title {
    color: var(--earth-dark);
    font-weight: 700;
    line-height: 1.2;
}

.quick-create-subtitle {
    color: var(--earth-muted);
    font-size: 0.85rem;
    line-height: 1.25;
    margin-top: 0.15rem;
}

.alert {
    border-radius: 0.25rem;
}

.notification-toast-container {
    z-index: 1080;
    width: min(24rem, calc(100vw - 1.5rem));
    pointer-events: none;
}

.notification-toast-container-top {
    top: 4.5rem;
}

.notification-toast-container-bottom {
    bottom: 1rem;
}

.notification-toast {
    width: 100%;
    border-width: 1px;
    border-style: solid;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(90, 74, 58, 0.18);
    pointer-events: auto;
}

.notification-toast .toast-body {
    color: var(--earth-dark);
}

/* Dashboard card hover effects */
.dashboard-stats-row > [class*="col"] {
    display: flex;
}

.dashboard-stat-link {
    display: flex;
    width: 100%;
}

.dashboard-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    width: 100%;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(90, 74, 58, 0.2);
}

.dashboard-insights-chart {
    position: relative;
    width: 100%;
    height: 150px;
}

.dashboard-calendar-card .btn-group .btn {
    border-color: rgba(255, 255, 255, 0.55);
    line-height: 1.2;
}

.dashboard-calendar-card .btn-group .btn.active {
    background-color: #fff;
    color: var(--earth-primary);
}

.dashboard-calendar-table {
    table-layout: fixed;
}

.dashboard-calendar-table th {
    border-bottom-color: rgba(90, 74, 58, 0.12);
    color: var(--earth-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    text-align: center;
    text-transform: uppercase;
}

.dashboard-calendar-table td {
    border-color: rgba(90, 74, 58, 0.1);
    height: 2.95rem;
    padding: 0;
    position: relative;
    vertical-align: top;
    width: 14.285%;
}

.dashboard-calendar-day-link,
.dashboard-calendar-week-link {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 0.3rem;
    color: var(--earth-dark);
    display: flex;
    justify-content: center;
    min-height: 100%;
    min-width: 0;
    position: relative;
    text-decoration: none;
}

a.dashboard-calendar-day-link:hover,
a.dashboard-calendar-week-link:hover,
a.dashboard-calendar-day-link:focus,
a.dashboard-calendar-week-link:focus {
    background-color: color-mix(in srgb, var(--earth-primary-soft) 34%, #fff);
    color: var(--earth-link-hover);
    text-decoration: none;
}

.dashboard-calendar-day-muted .dashboard-calendar-day-link {
    color: var(--earth-muted);
    opacity: 0.58;
}

.dashboard-calendar-day-weekend .dashboard-calendar-day-link,
.dashboard-calendar-day-weekend .dashboard-calendar-week-link {
    background-color: color-mix(in srgb, var(--earth-surface) 42%, #fff);
}

.dashboard-calendar-day-has-orders .dashboard-calendar-day-link,
.dashboard-calendar-day-has-orders .dashboard-calendar-week-link {
    background-color: color-mix(in srgb, var(--earth-info-soft) 28%, #fff);
    border-color: rgba(90, 74, 58, 0.14);
}

.dashboard-calendar-day-number,
.dashboard-calendar-week-number {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    line-height: 1;
}

.dashboard-calendar-day-number {
    color: var(--earth-muted);
    font-size: 0.76rem;
    font-weight: 700;
    left: 0.35rem;
    min-height: 1rem;
    min-width: 1rem;
    position: absolute;
    top: 0.3rem;
}

.dashboard-calendar-day-today .dashboard-calendar-day-number,
.dashboard-calendar-day-today .dashboard-calendar-week-number {
    background-color: var(--earth-primary);
    border-radius: 999px;
    color: #fff;
    min-height: 1.35rem;
    min-width: 1.35rem;
}

.dashboard-calendar-count {
    align-items: center;
    background-color: var(--earth-info);
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    box-shadow: 0 0.1rem 0.25rem rgba(47, 86, 100, 0.18);
    font-size: 0.76rem;
    font-weight: 700;
    height: 1.45rem;
    justify-content: center;
    min-width: 1.45rem;
    padding: 0 0.32rem;
}

.dashboard-calendar-week {
    display: grid;
    gap: 0.45rem;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.dashboard-calendar-week-day {
    min-width: 0;
}

.dashboard-calendar-week-link {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.55rem;
    justify-content: space-between;
    min-height: 5.25rem;
    padding: 0.6rem;
}

.dashboard-calendar-week-date {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    min-width: 0;
}

.dashboard-calendar-week-name {
    color: var(--earth-muted);
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

.dashboard-calendar-week-number {
    color: var(--earth-dark);
    font-size: 1.15rem;
    font-weight: 700;
}

.dashboard-calendar-week-link .dashboard-calendar-count {
    align-self: flex-end;
}

.dashboard-calendar-popover {
    --bs-popover-max-width: 18rem;
    --bs-popover-border-color: rgba(90, 74, 58, 0.16);
    --bs-popover-border-radius: 0.4rem;
    --bs-popover-box-shadow: 0 0.65rem 1.6rem rgba(46, 39, 31, 0.18);
    --bs-popover-body-padding-x: 0.7rem;
    --bs-popover-body-padding-y: 0.7rem;
}

.dashboard-calendar-popover-body {
    color: var(--earth-dark);
    display: grid;
    gap: 0.5rem;
}

.dashboard-calendar-popover-date {
    color: var(--earth-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.dashboard-calendar-popover-list {
    display: grid;
    gap: 0.45rem;
}

.dashboard-calendar-popover-order {
    border-left: 0.2rem solid var(--earth-info);
    color: var(--earth-dark);
    display: grid;
    gap: 0.08rem;
    line-height: 1.2;
    padding-left: 0.45rem;
    text-decoration: none;
}

.dashboard-calendar-popover-order:hover,
.dashboard-calendar-popover-order:focus {
    color: var(--earth-link-hover);
    text-decoration: none;
}

.dashboard-calendar-popover-order-number {
    color: var(--earth-link);
    font-weight: 700;
}

.dashboard-calendar-popover-order-meta {
    color: var(--earth-muted);
    font-size: 0.8rem;
}

@media (max-width: 575.98px) {
    .dashboard-calendar-table th {
        font-size: 0.65rem;
    }

    .dashboard-calendar-table td {
        height: 2.75rem;
    }

    .dashboard-calendar-day-link {
        min-height: 100%;
    }

    .dashboard-calendar-week {
        gap: 0.25rem;
    }

    .dashboard-calendar-week-link {
        min-height: 4.7rem;
        padding: 0.45rem 0.35rem;
    }

    .dashboard-calendar-count {
        font-size: 0.68rem;
        height: 1.25rem;
        min-width: 1.25rem;
    }
}

.global-search-backdrop {
    background-color: rgba(63, 52, 41, 0.34);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: fixed;
    right: 0;
    top: var(--global-search-top, 0);
    z-index: 1030;
}

.global-search-backdrop[hidden] {
    display: none !important;
}

.global-search-panel {
    left: 0;
    pointer-events: none;
    position: fixed;
    right: 0;
    top: var(--global-search-top, 0);
    z-index: 1050;
}

.global-search-panel .container {
    pointer-events: auto;
}

.global-search-shell {
    background-color: #fff;
    border: 1px solid rgba(90, 74, 58, 0.14);
    border-radius: 0 0 0.45rem 0.45rem;
    box-shadow: 0 0.85rem 2rem rgba(63, 52, 41, 0.24);
    padding: 1rem;
    position: relative;
}

.global-search-shell .input-group-text {
    background-color: var(--earth-light);
    border-color: rgba(90, 74, 58, 0.16);
    color: var(--earth-primary);
}

.global-search-wrapper {
    position: relative;
}

.global-search-suggestions {
    display: none;
    left: 0;
    max-height: 22rem;
    overflow-y: auto;
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 1040;
    border: 1px solid rgba(90, 74, 58, 0.16);
    border-radius: 0.35rem;
    box-shadow: 0 0.75rem 1.5rem rgba(90, 74, 58, 0.16);
}

.global-search-suggestions.show {
    display: block;
}

.global-search-suggestion,
.search-result-row {
    align-items: flex-start;
    display: flex;
    gap: 0.75rem;
}

.search-result-icon {
    align-items: center;
    background-color: var(--earth-light);
    border: 1px solid rgba(90, 74, 58, 0.12);
    border-radius: 0.35rem;
    color: var(--earth-primary);
    display: inline-flex;
    flex: 0 0 auto;
    height: 2.25rem;
    justify-content: center;
    width: 2.25rem;
}

.search-result-copy {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.search-result-title {
    color: var(--earth-dark);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.search-result-subtitle,
.search-result-meta {
    color: var(--earth-muted);
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.search-result-matches {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: flex-end;
    max-width: 42%;
}

.search-results-card {
    height: 100%;
}

@media (max-width: 575.98px) {
    .global-search-suggestion,
    .search-result-row {
        gap: 0.6rem;
    }

    .search-result-matches {
        flex-basis: 100%;
        justify-content: flex-start;
        margin-left: 3rem;
        max-width: none;
    }

    .global-search-suggestion,
    .search-result-row {
        flex-wrap: wrap;
    }
}

.document-library-list {
    max-height: 760px;
    overflow-y: auto;
}

.calendar-table {
    min-width: 900px;
    table-layout: fixed;
}

.calendar-table th {
    background-color: var(--earth-surface);
    color: var(--earth-dark);
    font-size: 0.82rem;
    letter-spacing: 0;
    text-align: center;
    text-transform: uppercase;
}

.calendar-table td {
    background-color: #fff;
    border-color: rgba(90, 74, 58, 0.14);
    height: 9.75rem;
    padding: 0.55rem;
    vertical-align: top;
    width: 14.285%;
}

.calendar-day-muted {
    background-color: color-mix(in srgb, var(--earth-light) 68%, #fff) !important;
}

.calendar-day-muted .calendar-day-number {
    color: var(--earth-muted);
    opacity: 0.55;
}

.calendar-day-today {
    background-color: color-mix(in srgb, var(--earth-primary-soft) 28%, #fff) !important;
    box-shadow: inset 0 0 0 2px var(--earth-primary);
    position: relative;
}

.calendar-day-number {
    align-items: center;
    color: var(--earth-dark);
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    line-height: 1;
    margin-bottom: 0.45rem;
    min-height: 1.65rem;
    min-width: 1.65rem;
}

.calendar-day-today .calendar-day-number {
    background-color: var(--earth-primary);
    border-radius: 999px;
    color: #fff;
}

.calendar-orders {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.calendar-orders-compact {
    gap: 0.25rem;
}

.calendar-order-item {
    background-color: var(--earth-light);
    border: 1px solid rgba(90, 74, 58, 0.14);
    border-left: 0.25rem solid var(--earth-primary);
    border-radius: 0.25rem;
    color: var(--earth-dark);
    display: flex;
    gap: 0.2rem;
    line-height: 1.2;
    min-width: 0;
    padding: 0.25rem 0.45rem 0.25rem 0.15rem;
    text-decoration: none;
}

.calendar-order-item:hover,
.calendar-order-item:focus-within {
    background-color: var(--earth-surface);
    color: var(--earth-dark);
    text-decoration: none;
}

.calendar-order-item-dragging {
    opacity: 0.55;
}

.calendar-order-item-compact {
    align-items: center;
    padding-bottom: 0.18rem;
    padding-top: 0.18rem;
}

.calendar-order-item-compact .calendar-order-link {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-order-grip {
    align-items: center;
    align-self: stretch;
    background: transparent;
    border: 0;
    color: var(--earth-muted);
    cursor: grab;
    display: inline-flex;
    flex: 0 0 1.25rem;
    justify-content: center;
    padding: 0;
}

.calendar-order-grip:active {
    cursor: grabbing;
}

.calendar-order-grip:focus-visible {
    border-radius: 0.2rem;
    box-shadow: 0 0 0 0.15rem rgba(90, 74, 58, 0.2);
    outline: 0;
}

.calendar-order-link {
    color: inherit;
    display: block;
    min-width: 0;
    text-decoration: none;
}

.calendar-order-link:hover,
.calendar-order-link:focus {
    color: inherit;
    text-decoration: none;
}

.calendar-order-item-past-due {
    border-left-color: #dc3545;
}

.calendar-order-item-past-due .calendar-order-number {
    color: #dc3545;
    font-weight: 700;
}

.calendar-order-number,
.calendar-order-customer,
.calendar-order-instrument,
.calendar-order-status {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-order-number {
    color: var(--earth-link);
    font-weight: 700;
}

.calendar-order-customer {
    font-size: 0.88rem;
}

.calendar-order-item-compact .calendar-order-number,
.calendar-order-item-compact .calendar-order-customer {
    display: inline;
    font-size: 0.78rem;
}

.calendar-order-item-compact .calendar-order-number::after {
    color: var(--earth-muted);
    content: " · ";
    font-weight: 400;
}

.calendar-order-instrument,
.calendar-order-status {
    color: var(--earth-muted);
    font-size: 0.78rem;
    margin-top: 0.15rem;
}

.calendar-drop-active {
    background-color: color-mix(in srgb, var(--earth-primary-soft) 46%, #fff) !important;
    box-shadow: inset 0 0 0 2px var(--earth-primary);
}

.calendar-context-menu {
    background-color: #fff;
    border: 1px solid rgba(90, 74, 58, 0.16);
    border-radius: 0.35rem;
    min-width: 13rem;
    padding: 0.3rem;
    position: fixed;
    z-index: 1080;
}

.calendar-context-menu-item {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0.25rem;
    color: var(--earth-dark);
    display: flex;
    gap: 0.55rem;
    padding: 0.5rem 0.65rem;
    text-align: left;
    text-decoration: none;
    width: 100%;
}

.calendar-context-menu-item:hover,
.calendar-context-menu-item:focus {
    background-color: var(--earth-light);
    color: var(--earth-dark);
    text-decoration: none;
}

.calendar-order-popover {
    --bs-popover-max-width: 19rem;
    --bs-popover-border-color: rgba(90, 74, 58, 0.16);
    --bs-popover-border-radius: 0.4rem;
    --bs-popover-box-shadow: 0 0.65rem 1.6rem rgba(46, 39, 31, 0.18);
    --bs-popover-body-padding-x: 0.65rem;
    --bs-popover-body-padding-y: 0.65rem;
}

.calendar-order-popover-body {
    align-items: flex-start;
    color: var(--earth-dark);
    display: flex;
    gap: 0.65rem;
    line-height: 1.25;
}

.calendar-order-popover-photo {
    aspect-ratio: 4 / 3;
    border: 1px solid rgba(90, 74, 58, 0.18);
    border-radius: 0.3rem;
    flex: 0 0 5.5rem;
    height: 4.125rem;
    max-height: 4.125rem;
    max-width: 5.5rem;
    object-fit: cover;
    overflow: hidden;
    width: 5.5rem;
}

.calendar-order-popover-details {
    display: grid;
    font-size: 0.82rem;
    gap: 0.18rem;
    min-width: 0;
}

.calendar-order-popover-title {
    color: var(--earth-link);
    font-weight: 700;
}

.document-preview-frame {
    width: 100%;
    min-height: 680px;
    border: 1px solid rgba(90, 74, 58, 0.2);
    border-radius: 0.25rem;
    background: white;
}

.insights-stat-card .display-6 {
    font-weight: 700;
    line-height: 1;
}

.insights-stat-card .bi {
    font-size: 2.4rem;
    opacity: 0.72;
}

.insights-chart {
    position: relative;
    width: 100%;
    min-height: 340px;
}

.insights-chart-sm {
    min-height: 280px;
}

.document-token-picker .autocomplete-wrapper {
    position: relative;
}

.document-token-picker .autocomplete-suggestions {
    position: absolute;
    z-index: 1060;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    max-height: 220px;
    overflow-y: auto;
    background: white;
    border: 1px solid rgba(90, 74, 58, 0.2);
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(90, 74, 58, 0.15);
}

.document-token-picker .autocomplete-suggestion {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(90, 74, 58, 0.08);
}

.document-token-picker .autocomplete-suggestion:hover {
    background-color: var(--earth-light);
}

.metadata-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 0.25rem;
}

.metadata-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(90, 74, 58, 0.2);
    border-radius: 999px;
    background: var(--earth-light);
    color: var(--earth-dark);
    font-size: 0.875rem;
}

.metadata-chip button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--earth-muted);
    line-height: 1;
}

.metadata-chip button:hover {
    background: rgba(90, 74, 58, 0.12);
    color: var(--earth-dark);
}

@media (max-width: 991.98px) {
    .document-preview-frame {
        min-height: 520px;
    }
}

/* Earthy Bootstrap overrides */
.btn-primary {
    background-color: var(--earth-primary);
    border-color: var(--earth-primary);
    color: white;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--earth-primary-hover);
    border-color: var(--earth-primary-hover);
}

.btn-outline-primary {
    border-color: var(--earth-primary);
    color: var(--earth-primary);
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: var(--earth-primary);
    border-color: var(--earth-primary);
    color: white;
}

.btn-success {
    background-color: var(--earth-success);
    border-color: var(--earth-success);
    color: white;
}

.btn-success:hover, .btn-success:focus {
    background-color: var(--earth-dark);
    border-color: var(--earth-dark);
}

.btn-info {
    background-color: var(--earth-info);
    border-color: var(--earth-info);
    color: white;
}

.btn-info:hover, .btn-info:focus {
    background-color: var(--earth-link-hover);
    border-color: var(--earth-link-hover);
}

.btn-warning {
    background-color: var(--earth-warning);
    border-color: var(--earth-warning);
    color: white;
}

.btn-warning:hover, .btn-warning:focus {
    background-color: var(--earth-primary-hover);
    border-color: var(--earth-primary-hover);
}

.btn-danger {
    background-color: var(--earth-danger);
    border-color: var(--earth-danger);
    color: white;
}

.btn-danger:hover, .btn-danger:focus {
    background-color: var(--earth-primary-hover);
    border-color: var(--earth-primary-hover);
}

.bg-primary {
    background-color: var(--earth-primary) !important;
}

.bg-success {
    background-color: var(--earth-success) !important;
}

.bg-info {
    background-color: var(--earth-info) !important;
}

.bg-warning {
    background-color: var(--earth-warning) !important;
}

.bg-danger {
    background-color: var(--earth-danger) !important;
}

.bg-light {
    background-color: var(--earth-light) !important;
}

.text-primary {
    color: var(--earth-primary) !important;
}

.text-success {
    color: var(--earth-success) !important;
}

.text-info {
    color: var(--earth-info) !important;
}

.text-warning {
    color: var(--earth-warning) !important;
}

.text-danger {
    color: var(--earth-danger) !important;
}

.text-muted {
    color: var(--earth-muted) !important;
}

.badge.bg-primary {
    background-color: var(--earth-primary) !important;
}

.badge.bg-success {
    background-color: var(--earth-success) !important;
}

.badge.bg-info {
    background-color: var(--earth-info) !important;
}

.badge.bg-warning {
    background-color: var(--earth-warning) !important;
}

.badge.bg-danger {
    background-color: var(--earth-danger) !important;
}

.alert-success {
    background-color: var(--earth-alert-success-bg);
    border-color: var(--earth-success);
    color: var(--earth-dark);
}

.alert-info {
    background-color: var(--earth-alert-info-bg);
    border-color: var(--earth-info);
    color: var(--earth-dark);
}

.alert-warning {
    background-color: var(--earth-alert-warning-bg);
    border-color: var(--earth-warning);
    color: var(--earth-dark);
}

.alert-danger {
    background-color: var(--earth-alert-danger-bg);
    border-color: var(--earth-danger);
    color: var(--earth-dark);
}

.target-date-past-due {
    color: #dc3545 !important;
    font-weight: 700;
}

.completed-date-badge {
    background-color: var(--earth-success-soft);
    color: var(--earth-dark);
    font-weight: 600;
}

footer.bg-light {
    background-color: var(--earth-surface) !important;
    border-top-color: var(--earth-muted) !important;
}

/* Dashboard cards with pastel earthy backgrounds */
.dashboard-card.bg-primary {
    background-color: var(--earth-primary-soft) !important;
}

.dashboard-card.bg-warning {
    background-color: var(--earth-warning-soft) !important;
}

.dashboard-card.bg-success {
    background-color: var(--earth-success-soft) !important;
}

.dashboard-card.bg-info {
    background-color: var(--earth-info-soft) !important;
}

.dashboard-card.bg-danger {
    background-color: var(--earth-danger-soft) !important;
}

.dashboard-card.text-white {
    color: var(--earth-dark) !important;
}

.card-header.bg-primary {
    background-color: var(--earth-primary) !important;
}

.card-header.bg-secondary {
    background-color: var(--earth-secondary) !important;
}

.card.border-primary {
    border-color: var(--earth-primary) !important;
}

/* Styled links in tables and lists */
.table a:not(.btn) {
    color: var(--earth-link) !important;
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
}

.table a:not(.btn):hover {
    color: var(--earth-link-hover) !important;
}

.table a:not(.btn).fw-bold:hover {
    text-decoration: underline;
    text-decoration-color: var(--earth-link);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

/* Links in list groups (dashboard, etc.) */
.list-group-item a:not(.btn) {
    color: var(--earth-link) !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

.list-group-item a:not(.btn):hover {
    color: var(--earth-link-hover) !important;
    text-decoration: underline;
    text-decoration-color: var(--earth-link);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

/* General text links (not in tables or buttons) */
p a:not(.btn), .text-muted a:not(.btn) {
    color: var(--earth-link) !important;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

p a:not(.btn):hover, .text-muted a:not(.btn):hover {
    color: var(--earth-link-hover) !important;
    border-bottom-color: var(--earth-link);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--earth-primary);
    box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--earth-primary) 25%, transparent);
}

.theme-preview {
    border: 1px solid var(--earth-primary-soft);
    border-radius: 0.375rem;
    overflow: hidden;
    background-color: var(--earth-light);
}

.theme-preview-nav {
    align-items: center;
    background-color: var(--earth-primary);
    color: white;
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
}

.theme-preview-body {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem;
}

.theme-preview-body a {
    color: var(--earth-link);
    font-weight: 600;
    text-decoration: none;
}

.theme-preview-footer {
    background-color: var(--earth-surface);
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}

.theme-preview-swatch {
    border-radius: 999px;
    display: inline-block;
    height: 1rem;
    width: 1rem;
}
