:root {
    --app-sidebar-width: 256px;
    --app-bg: #f4f7fb;
    --app-surface: #fff;
    --app-surface-subtle: #f8fafc;
    --app-border: #e2e8f0;
    --app-text: #172033;
    --app-muted: #64748b;
    --app-primary: #2563eb;
    --app-primary-dark: #1d4ed8;
    --app-accent: #16a36a;
    --app-accent-soft: #eafaf3;
    --app-topbar: #172554;
    --app-focus: rgba(37, 99, 235, .24);
    --app-radius: .65rem;
    --app-shadow: 0 .3rem 1rem rgba(15, 23, 42, .055);
}

html[data-theme='dark'] {
    color-scheme: dark;
}

body.admin-body {
    --admin-bg: #f4f7fb;
    --admin-surface: #fff;
    --admin-border: #dfe5ee;
    --admin-muted: #687386;
    background: var(--admin-bg);
}

html[data-theme='dark'] body.admin-body {
    --admin-bg: #121821;
    --admin-surface: #1a2330;
    --admin-border: #2d3948;
    --admin-muted: #9daabd;
    color: #e6edf5;
    --bs-body-bg: var(--admin-bg);
    --bs-body-color: #e6edf5;
    --bs-heading-color: #f5f7fa;
}

.admin-navbar {
    min-height: 64px;
    background: #172131;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 .2rem .8rem rgba(15, 23, 42, .12);
}

.admin-brand-mark {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .55rem;
    background: #3b82f6;
    color: #fff;
}

.admin-shell {
    min-height: calc(100vh - 64px);
    align-items: stretch;
}

.admin-sidebar {
    width: 256px;
    min-width: 256px;
    flex: 0 0 256px;
    background: var(--admin-surface);
    border-color: var(--admin-border) !important;
}

.admin-sidebar-nav {
    position: sticky;
    top: 0;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
}

.admin-sidebar-label,
.admin-breadcrumb {
    color: var(--admin-muted) !important;
    letter-spacing: .06em;
}

.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    color: var(--admin-muted);
    border-radius: .55rem;
    font-weight: 500;
    white-space: nowrap;
}

.admin-sidebar .nav-link i {
    width: 1.35rem;
    flex: 0 0 1.35rem;
    text-align: center;
    font-size: 1rem;
}

.admin-sidebar .nav-link.active {
    color: #fff;
    background: #2563eb;
    box-shadow: 0 .25rem .6rem rgba(37, 99, 235, .2);
}

.admin-sidebar .nav-link:not(.active):hover {
    color: #2563eb;
    background: rgba(37, 99, 235, .08);
}

.admin-main {
    min-width: 0;
    background: var(--admin-bg);
}

.admin-main .app-content {
    min-width: 0;
}

.admin-mobile-nav {
    background: var(--admin-surface);
    border-color: var(--admin-border) !important;
}

.admin-mobile-nav .nav-link {
    white-space: nowrap;
}

html[data-theme='dark'] body.admin-body .card,
html[data-theme='dark'] body.admin-body .table,
html[data-theme='dark'] body.admin-body .list-group-item,
html[data-theme='dark'] body.admin-body .dropdown-menu,
html[data-theme='dark'] body.admin-body .modal-content,
html[data-theme='dark'] body.admin-body .bg-white,
html[data-theme='dark'] body.admin-body .bg-light,
html[data-theme='dark'] body.admin-body .bg-body-tertiary {
    --bs-card-bg: var(--admin-surface);
    --bs-body-bg: var(--admin-surface);
    --bs-body-color: #e6edf5;
    background-color: var(--admin-surface) !important;
    color: #e6edf5;
    border-color: var(--admin-border);
}

html[data-theme='dark'] body.admin-body .card-header,
html[data-theme='dark'] body.admin-body .card-footer {
    background-color: #202b3a !important;
    color: #f0f4f8 !important;
    border-color: var(--admin-border) !important;
}

html[data-theme='dark'] body.admin-body .card-body,
html[data-theme='dark'] body.admin-body .card-body > *,
html[data-theme='dark'] body.admin-body .card-header > * {
    color: inherit;
}

html[data-theme='dark'] body.admin-body .card h1,
html[data-theme='dark'] body.admin-body .card h2,
html[data-theme='dark'] body.admin-body .card h3,
html[data-theme='dark'] body.admin-body .card h4,
html[data-theme='dark'] body.admin-body .card h5,
html[data-theme='dark'] body.admin-body .card h6,
html[data-theme='dark'] body.admin-body .card strong {
    color: #f5f7fa;
}

html[data-theme='dark'] body.admin-body .table-light,
html[data-theme='dark'] body.admin-body .table thead,
html[data-theme='dark'] body.admin-body .table thead th {
    --bs-table-bg: #202b3a;
    --bs-table-color: #f0f4f8;
    background-color: #202b3a;
    color: #f0f4f8;
}

html[data-theme='dark'] body.admin-body .border,
html[data-theme='dark'] body.admin-body .border-top,
html[data-theme='dark'] body.admin-body .border-end,
html[data-theme='dark'] body.admin-body .border-bottom,
html[data-theme='dark'] body.admin-body .border-start {
    border-color: var(--admin-border) !important;
}

html[data-theme='dark'] body.admin-body .form-label,
html[data-theme='dark'] body.admin-body .form-check-label,
html[data-theme='dark'] body.admin-body .card-title,
html[data-theme='dark'] body.admin-body .card-header,
html[data-theme='dark'] body.admin-body .modal-title {
    color: #f0f4f8;
}

html[data-theme='dark'] body.admin-body .table {
    --bs-table-color: #e6edf5;
    --bs-table-border-color: var(--admin-border);
}

html[data-theme='dark'] body.admin-body .text-muted {
    color: var(--admin-muted) !important;
}

html[data-theme='dark'] body.admin-body .form-control,
html[data-theme='dark'] body.admin-body .form-select {
    background-color: #151d28;
    border-color: var(--admin-border);
    color: #e6edf5;
}

body.app-body {
    background-color: var(--app-bg);
    color: var(--app-text);
    font-size: .95rem;
    line-height: 1.55;
}

.app-navbar {
    position: relative;
    z-index: 1030;
}

.app-topbar {
    min-height: 68px;
    background: var(--app-topbar) !important;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 .25rem 1rem rgba(15, 23, 42, .14);
}

.app-brand {
    letter-spacing: -.02em;
}

.brand-logo-mark {
    display: block;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
}

.app-topbar .btn-outline-light {
    border-color: rgba(255, 255, 255, .28);
    color: rgba(255, 255, 255, .9);
}

.app-topbar .btn-outline-light:hover,
.app-topbar .btn-outline-light:focus-visible {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .58);
    color: #fff;
}

.app-topbar .form-control {
    min-height: 38px;
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .18);
    color: #fff;
}

.app-topbar .form-control::placeholder {
    color: rgba(255, 255, 255, .65);
}

.assistant-launcher {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 48px;
    padding: .7rem 1rem;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    background: var(--app-topbar);
    box-shadow: 0 .5rem 1.25rem rgba(15, 23, 42, .24);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.assistant-launcher:hover,
.assistant-launcher:focus-visible {
    background: #1e3a8a;
    box-shadow: 0 .65rem 1.5rem rgba(15, 23, 42, .3);
    color: #fff;
    transform: translateY(-2px);
}

.assistant-launcher:focus-visible {
    outline: 3px solid rgba(96, 165, 250, .75);
    outline-offset: 3px;
}

.assistant-launcher i {
    font-size: 1.15rem;
}

.assistant-chat-panel {
    position: fixed;
    right: 1.25rem;
    bottom: 5.75rem;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: min(430px, calc(100vw - 2rem));
    height: min(650px, calc(100vh - 7rem));
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    background: var(--app-surface);
    box-shadow: 0 1rem 3rem rgba(15, 23, 42, .25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(1rem) scale(.98);
    transition: opacity .15s ease, transform .15s ease;
}

.assistant-chat-panel.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.assistant-chat-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; background: var(--app-topbar); color: #fff; }
.assistant-chat-header .btn:focus-visible, .assistant-chat-composer button:focus-visible { outline: 3px solid rgba(96, 165, 250, .75); outline-offset: 2px; }
.assistant-chat-messages { flex: 1 1 auto; overflow-y: auto; padding: 1rem; background: var(--app-bg); }
.assistant-chat-empty { padding: 3rem 1rem; color: var(--app-muted); text-align: center; }
.assistant-chat-message { display: flex; margin-bottom: .75rem; }
.assistant-chat-message.is-user { justify-content: flex-end; }
.assistant-chat-bubble { max-width: 88%; padding: .65rem .8rem; border-radius: .85rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.is-user .assistant-chat-bubble { background: var(--app-topbar); color: #fff; border-bottom-right-radius: .2rem; }
.is-assistant .assistant-chat-bubble { background: var(--app-surface); border: 1px solid var(--app-border); border-bottom-left-radius: .2rem; }
.assistant-chat-preview { margin: 0 1rem 1rem; padding: .75rem; border: 1px solid var(--app-border); border-radius: .75rem; color: var(--app-text); font-size: .875rem; }
.assistant-chat-composer { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--app-border); background: var(--app-surface); }
.assistant-chat-composer textarea { resize: none; }
.assistant-chat-thinking span { display: inline-block; width: .4rem; height: .4rem; margin: 0 .12rem; border-radius: 50%; background: var(--app-muted); animation: assistant-thinking 1s infinite ease-in-out; }
.assistant-chat-thinking span:nth-child(2) { animation-delay: .15s; }
.assistant-chat-thinking span:nth-child(3) { animation-delay: .3s; }
@keyframes assistant-thinking { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-.2rem); } }

@media (max-width: 575.98px) {
    .assistant-launcher {
        right: 1rem;
        bottom: 1rem;
        width: 48px;
        height: 48px;
        justify-content: center;
        padding: 0;
    }

    .assistant-launcher-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .assistant-chat-panel { right: .5rem; bottom: .5rem; width: calc(100vw - 1rem); height: calc(100dvh - 1rem); max-height: none; border-radius: .85rem; }
}

.app-shell {
    min-height: calc(100vh - 68px);
}

.app-main {
    min-width: 0;
    width: 0;
}

.app-sidebar {
    width: var(--app-sidebar-width);
    min-width: var(--app-sidebar-width);
    flex: 0 0 var(--app-sidebar-width);
    overflow-x: hidden;
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        align-self: flex-start;
    }
}

.app-sidebar-nav .nav-link {
    border-radius: .5rem;
    min-height: 42px;
    padding: .6rem .85rem;
    color: var(--app-muted);
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.app-sidebar-nav .nav-link i {
    width: 1.35rem;
    flex: 0 0 1.35rem;
    text-align: center;
    font-size: 1rem;
}

.app-sidebar-nav .nav-link.active {
    background-color: var(--app-primary);
    color: #fff;
    box-shadow: 0 .35rem .75rem rgba(37, 99, 235, .18);
}

.app-sidebar-nav .nav-link:not(.active):hover {
    background-color: #eff6ff;
    color: var(--app-primary-dark);
    transform: translateX(2px);
}

.app-content {
    min-width: 0;
    padding-top: 1.5rem !important;
    padding-bottom: 2.5rem !important;
}

.app-page-header {
    padding: 1.15rem 1.35rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: .75rem;
    background: linear-gradient(115deg, #172554 0%, #2447b8 68%, #168a60 100%);
    box-shadow: 0 .45rem 1.25rem rgba(15, 23, 42, .13);
    color: #fff;
}

.app-page-header h1 {
    color: #fff;
    font-size: clamp(1.45rem, 2vw, 1.85rem);
    font-weight: 700;
    letter-spacing: 0;
}

.app-page-header p {
    color: rgba(255, 255, 255, .76) !important;
    max-width: 72ch;
}

.app-page-eyebrow {
    margin-bottom: .15rem;
    color: rgba(255, 255, 255, .68);
    font-size: .68rem;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.app-page-header-copy {
    min-width: 0;
}

.page-header-actions {
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.app-page-header .btn-primary {
    border-color: #2f6df3;
    background: #2f6df3;
    color: #fff;
}

.app-page-header .btn-light {
    border-color: #fff;
    background: #fff;
    color: #172554;
}

.app-page-header .btn-outline-primary,
.app-page-header .btn-outline-secondary,
.app-page-header .btn-outline-light {
    border-color: rgba(255, 255, 255, .68);
    background: transparent;
    color: #fff;
}

.app-page-header .btn-link {
    color: rgba(255, 255, 255, .9);
}

.app-page-header .btn-outline-primary:hover,
.app-page-header .btn-outline-secondary:hover,
.app-page-header .btn-outline-light:hover,
.app-page-header .btn-link:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.app-page-header .form-select,
.app-page-header .form-control {
    min-height: 38px;
    border-color: rgba(255, 255, 255, .45);
    background-color: rgba(255, 255, 255, .96);
    color: #172033;
}

.app-body .card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.app-body .card:hover {
    border-color: #cad5e3;
}

.app-body .card-header,
.app-body .card-footer {
    background: var(--app-surface-subtle);
    border-color: var(--app-border);
}

.app-body .card-header {
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.app-body .card-body {
    padding: 1.25rem;
}

.app-body .btn {
    border-radius: .55rem;
    font-weight: 550;
    transition: box-shadow .15s ease, transform .15s ease, background-color .15s ease;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0 !important;
    line-height: 1;
}

.btn-icon i {
    margin: 0 !important;
}

.people-edit-details {
    position: relative;
}

.people-edit-details > summary {
    list-style: none;
}

.people-edit-details > summary::-webkit-details-marker {
    display: none;
}

.people-edit-popover {
    position: absolute;
    z-index: 20;
    top: calc(100% + .4rem);
    right: 0;
    width: min(17rem, calc(100vw - 3rem));
    padding: 1rem;
    border: 1px solid var(--app-border);
    border-radius: .65rem;
    background: var(--app-surface);
    box-shadow: 0 .8rem 2rem rgba(15, 23, 42, .18);
}

.people-table-wrap {
    overflow: visible;
}

.app-body .btn-primary {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

.app-body .btn-primary:hover {
    background-color: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
    box-shadow: 0 .3rem .7rem rgba(37, 99, 235, .2);
    transform: translateY(-1px);
}

.app-body .form-control,
.app-body .form-select,
.app-body .input-group-text {
    min-height: 42px;
    border-color: var(--app-border);
    border-radius: .55rem;
}

.app-body .form-label {
    margin-bottom: .4rem;
    color: #475569;
    font-size: .82rem;
    font-weight: 650;
}

.app-body .form-control:focus,
.app-body .form-select:focus,
.app-body .btn:focus-visible,
.app-body .nav-link:focus-visible,
.app-body .dropdown-item:focus-visible {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 .2rem var(--app-focus);
    outline: none;
}

.app-body .table {
    --bs-table-border-color: var(--app-border);
    color: var(--app-text);
}

.app-body .table thead th {
    background: var(--app-surface-subtle);
    color: var(--app-muted);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-body .table > :not(caption) > * > * {
    padding: .75rem 1rem;
}

.app-body .table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: #f8fafc;
    color: inherit;
}

.app-body .badge {
    border-radius: 999px;
    font-weight: 650;
    letter-spacing: .01em;
    padding: .4em .7em;
}

.app-body .alert {
    border-radius: var(--app-radius);
    border-width: 1px;
}

.app-body .modal-content {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: 0 1rem 3rem rgba(15, 23, 42, .18);
}

.app-body .modal-header,
.app-body .modal-footer {
    border-color: var(--app-border);
}

.app-body .dropdown-menu {
    border: 1px solid var(--app-border);
    border-radius: .7rem;
    box-shadow: 0 .75rem 2rem rgba(15, 23, 42, .12);
    padding: .4rem;
}

.app-body .dropdown-item {
    border-radius: .45rem;
    padding: .55rem .7rem;
}

.app-body .dropdown-item.active,
.app-body .dropdown-item:active {
    background: var(--app-primary);
}

.app-body .empty-state {
    padding: 3rem 1.5rem;
    color: var(--app-muted);
    text-align: center;
}

.items-eyebrow {
    color: var(--app-primary);
    display: block;
    font-size: .68rem;
    font-weight: 750;
    letter-spacing: .09em;
    margin-bottom: .3rem;
    text-transform: uppercase;
}

.items-filter-panel {
    background: linear-gradient(135deg, var(--app-surface), var(--app-surface-subtle));
    border-color: var(--app-border);
}

.items-filter-panel .form-label {
    font-size: .76rem;
    font-weight: 650;
}

.items-summary-card {
    border-color: var(--app-border);
    box-shadow: 0 .35rem 1rem rgba(15, 23, 42, .05);
}

.items-summary-strip {
    overflow: hidden;
}

.items-summary-cell + .items-summary-cell {
    border-left: 1px solid var(--app-border);
}

.items-summary-strip .stat-icon {
    width: 2.15rem;
    height: 2.15rem;
    flex-basis: 2.15rem;
    border-radius: .55rem;
    font-size: 1rem;
}

.items-summary-card .stat-icon {
    flex: 0 0 2.6rem;
    height: 2.6rem;
    width: 2.6rem;
}

.items-saved-views .card-header {
    background: var(--app-surface-subtle);
    border-bottom-color: var(--app-border);
}

.items-filter-panel .card-body {
    padding: .85rem 1rem;
}

.saved-view-list {
    display: grid;
    gap: .6rem;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.saved-view-row {
    align-items: center;
    background: var(--app-surface-subtle);
    border: 1px solid var(--app-border);
    border-radius: .65rem;
    display: flex;
    gap: .55rem;
    padding: .55rem;
}

.saved-view-row .input-group {
    min-width: 0;
}

.items-results {
    border-color: var(--app-border);
    overflow: hidden;
}

.items-bulk-toolbar {
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
    padding: .8rem 1rem;
}

.items-table thead th {
    background: var(--app-surface-subtle);
    border-bottom-color: var(--app-border);
    color: var(--app-muted);
    font-size: .7rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.items-table .item-table-row > td {
    border-color: var(--app-border);
    padding-block: 1rem;
}

.items-table .item-table-row:hover > td {
    background: var(--app-surface-subtle);
}

.items-select-cell {
    width: 3.25rem;
}

.item-description {
    display: -webkit-box;
    max-width: 23rem;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.item-status-badge {
    white-space: nowrap;
}

.item-mobile-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: .7rem;
    padding: 1rem;
}

.item-mobile-card .item-mobile-actions {
    border-top: 1px solid var(--app-border);
    padding-top: .8rem;
}

.item-mobile-card .item-mobile-actions form {
    flex: 0 0 auto;
}

.items-results .pagination {
    margin: 0;
}

.items-results > .card-body > .mt-3 {
    border-top: 1px solid var(--app-border);
    margin-top: 0 !important;
    padding: 1rem;
}

html[data-theme='dark'] body.app-body .items-bulk-toolbar {
    background: #172b4d;
    border-color: #315b96;
}

@media (max-width: 767.98px) {
    .items-filter-count {
        display: none;
    }

    .saved-view-list {
        grid-template-columns: 1fr;
    }

    .saved-view-row {
        align-items: stretch;
        flex-direction: column;
    }

    .saved-view-row > .btn,
    .saved-view-row > form:last-child {
        width: 100%;
    }

    .items-bulk-toolbar form {
        flex: 1 1 100%;
    }

    .items-bulk-toolbar form .form-select,
    .items-bulk-toolbar form .btn {
        flex: 1 1 auto;
    }
}

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

.calendar-table th {
    background: var(--app-surface-subtle);
    color: var(--app-muted);
    font-size: .72rem;
    letter-spacing: .06em;
    padding: .75rem .85rem !important;
    text-transform: uppercase;
}

.calendar-day {
    height: 8.5rem;
    padding: .7rem !important;
    vertical-align: top;
}

.calendar-day-muted {
    background: var(--app-surface-subtle) !important;
    opacity: .65;
}

.calendar-day-today {
    background: #f0f7ff !important;
    box-shadow: inset 0 3px 0 var(--app-primary);
}

.calendar-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    font-weight: 650;
}

.calendar-day-number.is-today {
    background: var(--app-primary);
    color: #fff;
}

.calendar-event {
    align-items: center;
    background: var(--calendar-event-bg);
    border: 0;
    border-left: 3px solid var(--calendar-event-color);
    border-radius: .3rem;
    color: var(--calendar-event-color);
    display: flex;
    font-size: .72rem;
    gap: .35rem;
    max-width: 100%;
    overflow: hidden;
    padding: .3rem .4rem;
    text-align: left;
    width: 100%;
}

.calendar-event span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event:hover,
.calendar-event:focus-visible {
    filter: brightness(.96);
    outline: 2px solid var(--calendar-event-color);
    outline-offset: 1px;
}

.calendar-event-overdue {
    --calendar-event-color: #b42318;
    --calendar-event-bg: #fef3f2;
}

.calendar-legend-item {
    color: var(--app-muted);
    font-size: .78rem;
}

.calendar-event-row {
    border-color: var(--app-border) !important;
}

.calendar-event-row:last-child {
    border-bottom: 0 !important;
}

.calendar-event-marker {
    align-items: center;
    border-radius: .55rem;
    display: inline-flex;
    flex: 0 0 2.25rem;
    height: 2.25rem;
    justify-content: center;
}

.calendar-event-marker.calendar-event-expiry { background: #eff6ff; color: #2563eb; }
.calendar-event-marker.calendar-event-reminder { background: #fffbeb; color: #b45309; }
.calendar-event-marker.calendar-event-renewal { background: #ecfdf5; color: #047857; }

.calendar-quick-add {
    background: linear-gradient(145deg, #eff6ff, #f8fafc);
    border: 1px solid #bfdbfe;
}

html[data-theme='dark'] body.app-body .calendar-day-today {
    background: #172b4d !important;
}

html[data-theme='dark'] body.app-body .calendar-day-muted {
    background: var(--app-surface-subtle) !important;
}

html[data-theme='dark'] body.app-body .calendar-quick-add {
    background: #172b4d;
    border-color: #315b96;
}

@media (max-width: 767.98px) {
    .calendar-month-wrap {
        display: none;
    }

    .calendar-view-switcher .btn {
        padding-inline: .65rem;
    }
}

.user-horizontal-nav {
    flex: 0 0 auto;
    background: var(--admin-surface, #fff);
    border-color: var(--admin-border, #dee2e6) !important;
}

.user-horizontal-nav .nav-link {
    min-height: 40px;
    white-space: nowrap;
    border-radius: .5rem;
}

.user-horizontal-nav .nav-link.active {
    color: #fff;
    background-color: #0d6efd;
}

.user-horizontal-nav .nav-link:not(.active):hover {
    background-color: rgba(13, 110, 253, .08);
}

.user-horizontal-content {
    width: min(100%, 1440px);
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 4rem) !important;
}

html[data-theme='dark'] body.app-body {
    --user-bg: #121821;
    --user-surface: #1a2330;
    --user-border: #2d3948;
    --user-text: #e6edf5;
    --user-muted: #9daabd;
    background-color: var(--user-bg);
    color: var(--user-text);
    --bs-body-bg: var(--user-bg);
    --bs-body-color: var(--user-text);
    --app-bg: #121821;
    --app-surface: #1a2330;
    --app-surface-subtle: #202b3a;
    --app-border: #2d3948;
    --app-text: #e6edf5;
    --app-muted: #9daabd;
    --app-focus: rgba(96, 165, 250, .28);
    --app-accent: #55d69a;
    --app-accent-soft: #15352d;
}

html[data-theme='dark'] body.app-body .card,
html[data-theme='dark'] body.app-body .app-sidebar,
html[data-theme='dark'] body.app-body .user-horizontal-nav,
html[data-theme='dark'] body.app-body .dropdown-menu,
html[data-theme='dark'] body.app-body .list-group-item,
html[data-theme='dark'] body.app-body .bg-body-tertiary,
html[data-theme='dark'] body.app-body .bg-light,
html[data-theme='dark'] body.app-body .bg-white {
    background-color: var(--user-surface) !important;
    color: var(--user-text);
    border-color: var(--user-border) !important;
}

html[data-theme='dark'] body.app-body .app-sidebar,
html[data-theme='dark'] body.app-body .user-horizontal-nav {
    background-color: var(--user-surface) !important;
}

html[data-theme='dark'] body.app-body .app-sidebar .nav-link.text-body,
html[data-theme='dark'] body.app-body .user-horizontal-nav .nav-link.text-body {
    color: var(--user-text) !important;
}

html[data-theme='dark'] body.app-body .app-sidebar .nav-link:not(.active):hover,
html[data-theme='dark'] body.app-body .user-horizontal-nav .nav-link:not(.active):hover {
    background-color: #263448;
    color: #fff !important;
}

html[data-theme='dark'] body.app-body .dropdown-menu .dropdown-item,
html[data-theme='dark'] body.app-body .dropdown-menu .dropdown-item-text {
    color: var(--user-text);
}

html[data-theme='dark'] body.app-body .dropdown-menu .dropdown-item:hover,
html[data-theme='dark'] body.app-body .dropdown-menu .dropdown-item:focus {
    background-color: #263448;
    color: #fff;
}

html[data-theme='dark'] body.app-body .dropdown-divider {
    border-color: var(--user-border);
}

html[data-theme='dark'] body.app-body .form-control,
html[data-theme='dark'] body.app-body .form-select,
html[data-theme='dark'] body.app-body .input-group-text {
    background-color: #151d28;
    border-color: var(--user-border);
    color: var(--user-text);
}

html[data-theme='dark'] body.app-body .form-control::placeholder {
    color: #8795a8;
}

html[data-theme='dark'] body.app-body .form-label,
html[data-theme='dark'] body.app-body .form-check-label,
html[data-theme='dark'] body.app-body .card-title,
html[data-theme='dark'] body.app-body h1,
html[data-theme='dark'] body.app-body h2,
html[data-theme='dark'] body.app-body h3,
html[data-theme='dark'] body.app-body h4,
html[data-theme='dark'] body.app-body h5,
html[data-theme='dark'] body.app-body h6 {
    color: var(--user-text);
}

html[data-theme='dark'] body.app-body .text-muted {
    color: var(--user-muted) !important;
}

html[data-theme='dark'] body.app-body .table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: #263448;
}

html[data-theme='dark'] body.app-body .app-body .table thead th,
html[data-theme='dark'] body.app-body .table thead th {
    background: var(--app-surface-subtle);
    color: var(--app-muted);
}

html[data-theme='dark'] body.app-body .card-header,
html[data-theme='dark'] body.app-body .card-footer {
    background: var(--app-surface-subtle);
    border-color: var(--app-border);
}

html[data-theme='dark'] body.app-body .card:hover {
    border-color: #3a4a5e !important;
}

html[data-theme='dark'] body.app-body .modal-content,
html[data-theme='dark'] body.app-body .offcanvas,
html[data-theme='dark'] body.app-body .accordion-item,
html[data-theme='dark'] body.app-body .accordion-button {
    background: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}

html[data-theme='dark'] body.app-body .modal-header,
html[data-theme='dark'] body.app-body .modal-footer,
html[data-theme='dark'] body.app-body .accordion-button:not(.collapsed) {
    border-color: var(--app-border);
    background: var(--app-surface-subtle);
    color: var(--app-text);
}

html[data-theme='dark'] body.app-body .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%);
}

.app-footer {
    background-color: var(--app-surface);
    border-color: var(--app-border) !important;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: min(86vw, var(--app-sidebar-width));
        min-width: min(86vw, var(--app-sidebar-width));
    }

    .app-content {
        padding-top: 1.25rem !important;
    }

    .app-page-header {
        padding-bottom: 1rem;
    }
}

/* Visual feedback while a global AJAX form request is in flight */
.ajax-form.is-submitting {
    opacity: .75;
    pointer-events: none;
}

/* Universal jQuery-driven notification toasts (used when ALERT_DRIVER=jquery) */
#app-jquery-notifications {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: 320px;
}

.app-jquery-toast {
    padding: .75rem 1rem;
    border-radius: .5rem;
    color: #fff;
    background-color: #212529;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
    opacity: 1;
    transition: opacity .3s ease, transform .3s ease;
}

.app-jquery-toast-hide {
    opacity: 0;
    transform: translateX(1rem);
}

.app-jquery-toast-success { background-color: #198754; }
.app-jquery-toast-error { background-color: #dc3545; }
.app-jquery-toast-warning { background-color: #fd7e14; }
.app-jquery-toast-info { background-color: #0dcaf0; color: #212529; }

/* Public marketing pages */
.marketing-hero {
    background: linear-gradient(135deg, #172554 0%, #1d4ed8 72%, #168a60 100%);
    color: #fff;
}

.marketing-hero {
    padding-block: 0 !important;
}

.marketing-hero > .container {
    padding-block: 3rem !important;
}

.marketing-section {
    padding: 4rem 0;
}

.marketing-section-alt {
    background-color: #f4f8fc;
}

.marketing-feature-icon {
    width: 3rem;
    height: 3rem;
    border-radius: .75rem;
    background-color: rgba(13, 110, 253, .1);
    color: #0d6efd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.marketing-body {
    background: #fff;
    color: var(--app-text);
}

.marketing-body .navbar {
    min-height: 64px;
    box-shadow: 0 .2rem .8rem rgba(15, 23, 42, .05);
}

.marketing-body .card {
    border-color: var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.marketing-body .btn {
    border-radius: .55rem;
    font-weight: 600;
}

.marketing-body .btn-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.marketing-body a:not(.btn):focus-visible,
.auth-body a:focus-visible {
    border-radius: .2rem;
    outline: 3px solid var(--app-focus);
    outline-offset: 2px;
}

.marketing-step-number {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: #0d6efd;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.marketing-footer {
    background-color: #14181f;
    color: rgba(255, 255, 255, .75);
}

.marketing-footer a {
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
}

.marketing-footer a:hover {
    color: #fff;
    text-decoration: underline;
}

.marketing-footer h6 {
    color: #fff;
}

/* Authentication pages */
.auth-body {
    background:
        linear-gradient(120deg, rgba(37, 99, 235, .08), transparent 38%),
        linear-gradient(300deg, rgba(22, 163, 106, .09), transparent 36%),
        #f4f7fb;
    color: var(--app-text);
}

.auth-card {
    max-width: 460px;
    width: 100%;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: var(--app-text);
}

.auth-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: .55rem;
    background: var(--app-primary);
    color: #fff;
    box-shadow: 0 .3rem .7rem rgba(37, 99, 235, .2);
}

.auth-panel {
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-top: 3px solid var(--app-primary);
    border-radius: .8rem;
    background: var(--app-surface);
    box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, .1);
}

.auth-card > .card {
    overflow: hidden;
    border: 1px solid var(--app-border) !important;
    border-top: 3px solid var(--app-primary) !important;
    border-radius: .8rem;
    background: var(--app-surface);
    box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, .1) !important;
}

.auth-panel::before {
    display: block;
    width: 5rem;
    height: 3px;
    background: var(--app-accent);
    content: '';
}

.auth-body .form-control,
.auth-body .form-select {
    min-height: 46px;
    border-color: var(--app-border);
    border-radius: .55rem;
}

.auth-body .form-control:focus,
.auth-body .form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 .2rem var(--app-focus);
}

.auth-body .btn-primary {
    min-height: 46px;
    border-color: var(--app-primary);
    border-radius: .55rem;
    background: var(--app-primary);
    font-weight: 650;
}

.auth-trust-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    color: var(--app-muted);
    font-size: .78rem;
}

.auth-trust-note i {
    color: var(--app-accent);
}

html[data-theme='dark'] body.auth-body,
html[data-theme='dark'] body.marketing-body {
    --app-bg: #111827;
    --app-surface: #182231;
    --app-surface-subtle: #202c3c;
    --app-border: #304055;
    --app-text: #e8eef6;
    --app-muted: #a4b1c2;
    --app-accent: #55d69a;
    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    background-color: var(--app-bg);
    color: var(--app-text);
}

html[data-theme='dark'] body.auth-body {
    background:
        linear-gradient(120deg, rgba(37, 99, 235, .14), transparent 38%),
        linear-gradient(300deg, rgba(22, 163, 106, .1), transparent 36%),
        var(--app-bg);
}

html[data-theme='dark'] .auth-panel,
html[data-theme='dark'] .auth-card > .card,
html[data-theme='dark'] body.marketing-body .navbar,
html[data-theme='dark'] body.marketing-body .card,
html[data-theme='dark'] body.marketing-body .marketing-section-alt {
    background: var(--app-surface) !important;
    color: var(--app-text);
    border-color: var(--app-border) !important;
}

html[data-theme='dark'] body.auth-body .text-muted,
html[data-theme='dark'] body.marketing-body .text-muted,
html[data-theme='dark'] body.marketing-body .nav-link {
    color: var(--app-muted) !important;
}

html[data-theme='dark'] body.auth-body .form-control,
html[data-theme='dark'] body.auth-body .form-select {
    background: #121b28;
    border-color: var(--app-border);
    color: var(--app-text);
}

html[data-theme='dark'] body.marketing-body .navbar-brand,
html[data-theme='dark'] body.marketing-body h1,
html[data-theme='dark'] body.marketing-body h2,
html[data-theme='dark'] body.marketing-body h3,
html[data-theme='dark'] body.auth-body h1,
html[data-theme='dark'] .auth-brand {
    color: var(--app-text) !important;
}

@media (max-width: 767.98px) {
    .app-page-header {
        margin-bottom: 1rem !important;
        padding: 1rem;
    }

    .page-header-actions,
    .page-header-actions > * {
        width: 100%;
    }

    .page-header-actions .btn {
        width: 100%;
    }

    .items-summary-cell:nth-child(3) {
        border-left: 0;
    }

    .items-summary-cell:nth-child(n+3) {
        border-top: 1px solid var(--app-border);
    }
}

/* Items summary stat cards */
.stat-icon {
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    border-radius: .75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.stat-icon-primary { background-color: rgba(13, 110, 253, .1); color: #0d6efd; }
.stat-icon-success { background-color: rgba(25, 135, 84, .1); color: #198754; }
.stat-icon-warning { background-color: rgba(255, 193, 7, .15); color: #b8860b; }
.stat-icon-danger { background-color: rgba(220, 53, 69, .1); color: #dc3545; }
.stat-icon-info { background-color: rgba(13, 202, 240, .15); color: #0aa2c0; }
.stat-icon-secondary { background-color: rgba(108, 117, 125, .15); color: #6c757d; }

/* Mobile item cards (shown below md, replacing the table) */

