/* Mobile / webview: allow full-page scroll (avoid clipped content) */
html {
    -webkit-text-size-adjust: 100%;
    height: auto;
}

body {
    -webkit-overflow-scrolling: touch;
    height: auto;
    min-height: 100dvh;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Flex shell: at least full viewport so footer can sit at bottom when content is short */
#appShell {
    min-height: 100dvh;
}

/* Additional styles on top of Tailwind */
.table-wrap {
    overflow-x: auto;
}

.soft-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.soft-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
}

.dark .soft-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.dark .soft-card:hover {
    border-color: rgba(129, 140, 248, 0.35);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

/* Table micro-interactions */
.table-interactive tbody tr {
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.table-interactive tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.06);
    box-shadow: inset 3px 0 0 rgb(99, 102, 241);
}

.dark .table-interactive tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.12);
}

.table-interactive tbody tr:active {
    transform: scale(0.998);
}

/* Mobile table -> card layout */
@media (max-width: 767px) {
    .table-interactive thead {
        display: none;
    }

    .table-interactive,
    .table-interactive tbody,
    .table-interactive tr,
    .table-interactive td {
        display: block;
        width: 100%;
    }

    .table-interactive tr {
        border: 1px solid rgba(148, 163, 184, 0.25);
        border-radius: 0.75rem;
        margin-bottom: 0.75rem;
        padding: 0.5rem 0.75rem;
        background: rgba(255, 255, 255, 0.8);
    }

    .dark .table-interactive tr {
        background: rgba(15, 23, 42, 0.7);
        border-color: rgba(100, 116, 139, 0.35);
    }

    .table-interactive td {
        border: 0;
        padding: 0.4rem 0;
        text-align: right;
        position: relative;
    }

    .table-interactive td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: rgb(71 85 105);
    }

    .dark .table-interactive td::before {
        color: rgb(148 163 184);
    }
}

/* Bugs tables: explicit line under each row (desktop) and between fields (mobile cards) */
.table-bugs-split-rows thead tr {
    border-bottom: 2px solid rgb(203 213 225);
}

.dark .table-bugs-split-rows thead tr {
    border-bottom-color: rgb(71 85 105);
}

.table-bugs-split-rows tbody tr {
    border-bottom: 1px solid rgb(226 232 240);
}

.dark .table-bugs-split-rows tbody tr {
    border-bottom-color: rgb(51 65 85 / 0.75);
}

.table-bugs-split-rows tbody tr.bugs-table-empty-row {
    border-bottom: none;
}

@media (max-width: 767px) {
    .table-bugs-split-rows.table-interactive tr {
        border: 1px solid rgba(148, 163, 184, 0.35);
    }

    .dark .table-bugs-split-rows.table-interactive tr {
        border-color: rgba(100, 116, 139, 0.45);
    }

    .table-bugs-split-rows.table-interactive td {
        border-bottom: 1px solid rgba(148, 163, 184, 0.35);
        padding-top: 0.55rem;
        padding-bottom: 0.55rem;
    }

    .dark .table-bugs-split-rows.table-interactive td {
        border-bottom-color: rgba(100, 116, 139, 0.4);
    }

    .table-bugs-split-rows.table-interactive td:last-child {
        border-bottom: none;
        padding-bottom: 0.35rem;
    }

    .table-bugs-split-rows.table-interactive tr.bugs-table-empty-row td {
        border-bottom: none;
    }
}

#appSidebar.collapsed {
    width: 5.5rem;
}

#appSidebar.collapsed .sidebar-brand-row {
    justify-content: center;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

#appSidebar.collapsed .sidebar-brand-row > .flex {
    justify-content: center;
}

#appSidebar.collapsed .sidebar-label {
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.sidebar-nav-group + .sidebar-nav-group {
    padding-top: 0.15rem;
}

.sidebar-nav-group-label {
    margin: 0 0 0.45rem;
    padding: 0 0.65rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(100, 116, 139);
}

.dark .sidebar-nav-group-label {
    color: rgb(148, 163, 184);
}

#appSidebar.collapsed .sidebar-nav-group-label {
    display: none;
}

#appSidebar.collapsed .sidebar-nav {
    gap: 0.35rem;
}

#appSidebar.collapsed .sidebar-nav-group + .sidebar-nav-group {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.dark #appSidebar.collapsed .sidebar-nav-group + .sidebar-nav-group {
    border-top-color: rgba(100, 116, 139, 0.35);
}

@media (max-width: 767px) {
    #appSidebar.collapsed {
        width: 18rem;
    }

    #appSidebar.collapsed .sidebar-label {
        display: block;
    }

    #appSidebar.collapsed .sidebar-brand-row {
        justify-content: space-between;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    #appSidebar.collapsed .sidebar-brand-row > .flex {
        justify-content: flex-start;
    }

    #appSidebar.collapsed nav a.nav-item {
        justify-content: flex-start;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    #appSidebar.collapsed .sidebar-icon {
        margin: 0;
    }
}

@media (min-width: 768px) {
    #appSidebar.collapsed nav a.nav-item {
        justify-content: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    #appSidebar.collapsed .sidebar-icon {
        margin: 0 auto;
    }
}

/* Active nav subtle pulse on icon */
a[data-nav-active] .sidebar-icon svg {
    animation: nav-icon-pop 0.45s ease-out;
}

@keyframes nav-icon-pop {
    0% {
        transform: scale(0.92);
    }
    50% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
    }
}

/* Dashboard welcome emojis */
@keyframes welcome-float {
    0%,
    100% {
        transform: translateY(0) rotate(-2deg);
    }
    50% {
        transform: translateY(-6px) rotate(3deg);
    }
}

@keyframes welcome-pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.92;
    }
}

.welcome-emoji {
    display: inline-block;
    animation: welcome-float 2.4s ease-in-out infinite;
    will-change: transform;
}

.welcome-emoji:nth-child(1) {
    animation-delay: 0s;
}

.welcome-emoji:nth-child(2) {
    animation-delay: 0.2s;
    animation-name: welcome-pulse;
    animation-duration: 1.8s;
}

.welcome-emoji:nth-child(3) {
    animation-delay: 0.4s;
}

.modal-backdrop {
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(6px);
    animation: modal-fade-in 0.2s ease-out;
}

.modal-panel {
    animation: modal-slide-up 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* SaaS page shell — hero, panels, forms, cards */
.page-hero,
.chat-list-hero {
    position: relative;
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.95), rgba(255, 255, 255, 0.98));
}

.dark .page-hero,
.dark .chat-list-hero {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.55), rgba(15, 23, 42, 0.92));
}

.page-hero-bg,
.chat-list-hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 100% 0%, rgba(99, 102, 241, 0.18), transparent 42%),
        radial-gradient(circle at 0% 100%, rgba(37, 99, 235, 0.12), transparent 38%);
    pointer-events: none;
}

.page-hero-icon,
.chat-list-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1.1rem;
    background: linear-gradient(135deg, rgb(79, 70, 229), rgb(37, 99, 235));
    color: #fff;
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.35);
}

.page-hero-actions .btn-primary,
.page-hero-actions .btn-secondary {
    width: 100%;
}

@media (min-width: 640px) {
    .page-hero-actions .btn-primary,
    .page-hero-actions .btn-secondary {
        width: auto;
        white-space: nowrap;
    }
}

@media (max-width: 767px) {
    .page-hero:not(.page-hero--dashboard) {
        background: transparent;
        border: none;
        box-shadow: none;
        margin-bottom: 1rem;
        overflow: visible;
    }

    .page-hero:not(.page-hero--dashboard) .page-hero-bg {
        display: none;
    }

    .page-hero:not(.page-hero--dashboard) .page-hero-inner {
        padding: 0;
        gap: 0;
    }

    .page-hero:not(.page-hero--dashboard) .page-hero-intro,
    .page-hero:not(.page-hero--dashboard) .page-hero-stats {
        display: none !important;
    }

    .page-hero:not(.page-hero--dashboard) .page-hero-aside {
        width: 100%;
    }

    .page-hero:not(.page-hero--dashboard) .page-hero-actions {
        width: 100%;
    }

    .page-hero:not(.page-hero--dashboard) .page-hero-actions .btn-primary,
    .page-hero:not(.page-hero--dashboard) .page-hero-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .page-hero:not(.page-hero--dashboard):not(:has(.page-hero-actions .btn-primary, .page-hero-actions .btn-secondary)) {
        display: none;
    }

    .page-hero--dashboard .page-hero-inner {
        padding: 1rem;
        gap: 1rem;
    }

    .page-hero--dashboard .page-hero-intro {
        width: 100%;
    }

    .page-hero--dashboard .page-hero-aside {
        width: 100%;
        align-items: stretch;
    }

    .page-hero--dashboard .page-hero-stats {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 0.5rem;
    }

    .page-hero--dashboard .page-hero-stats .page-stat {
        min-width: 0;
        width: 100%;
        padding: 0.7rem 0.5rem;
    }

    .page-hero--dashboard .page-hero-stats .page-stat:nth-child(5):last-child {
        grid-column: 1 / -1;
        max-width: 12rem;
        justify-self: center;
    }

    .page-hero--dashboard .page-stat-value {
        font-size: 1.25rem;
    }

    .page-hero--dashboard .page-stat-label {
        font-size: 0.62rem;
    }
}

.page-stat,
.chat-list-stat {
    min-width: 6.5rem;
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.82);
    text-align: center;
    backdrop-filter: blur(8px);
}

.dark .page-stat,
.dark .chat-list-stat {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(100, 116, 139, 0.35);
}

.page-stat--alert,
.chat-list-stat--alert {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(254, 242, 242, 0.9);
}

.dark .page-stat--alert,
.dark .chat-list-stat--alert {
    background: rgba(127, 29, 29, 0.28);
    border-color: rgba(248, 113, 113, 0.35);
}

.page-stat-value,
.chat-list-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
    color: rgb(30, 41, 59);
}

.dark .page-stat-value,
.dark .chat-list-stat-value {
    color: rgb(248, 250, 252);
}

.page-stat--alert .page-stat-value,
.chat-list-stat--alert .chat-list-stat-value {
    color: rgb(220, 38, 38);
}

.page-stat-label,
.chat-list-stat-label {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(100, 116, 139);
}

.page-panel {
    border-radius: 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    padding: 1.15rem 1.25rem;
}

.dark .page-panel {
    background: rgba(30, 41, 59, 0.88);
    border-color: rgba(100, 116, 139, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.page-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.page-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: rgb(30, 41, 59);
}

.dark .page-panel-title {
    color: rgb(248, 250, 252);
}

.page-panel-subtitle {
    font-size: 0.78rem;
    color: rgb(100, 116, 139);
    margin-top: 0.15rem;
}

.page-toolbar {
    border-radius: 1.15rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
}

.dark .page-toolbar {
    background: rgba(30, 41, 59, 0.82);
    border-color: rgba(100, 116, 139, 0.32);
}

.page-toolbar-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    color: rgb(51, 65, 85);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dark .page-toolbar-toggle {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(100, 116, 139, 0.35);
    color: rgb(226, 232, 240);
}

.page-toolbar-toggle[aria-expanded="true"] .page-toolbar-chevron {
    transform: rotate(180deg);
}

.page-toolbar-chevron {
    transition: transform 0.2s ease;
}

/* List page toolbar — stats hero first, then filters + action row */
.list-page-toolbar {
    box-sizing: border-box;
}

.list-page-toolbar-spacer {
    display: block;
    width: 100%;
    flex-shrink: 0;
    min-height: 3.75rem;
}

.list-page-main {
    position: relative;
    z-index: 1;
}

.list-page-sticky-inner {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    align-items: center;
}

@media (max-width: 767px) {
    .list-page-sticky-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }
}

.list-page-sticky-filter-toggle {
    flex: 1;
    min-width: 0;
    margin-bottom: 0 !important;
}

.list-page-sticky-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

.list-page-sticky-action-btn {
    white-space: nowrap;
    padding: 0.62rem 0.95rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 0.8rem;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.22);
    min-height: auto;
}

@media (max-width: 767px) {
    .list-page-toolbar {
        position: fixed;
        z-index: 19;
        padding: 0.55rem 1rem 0.65rem;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid rgba(148, 163, 184, 0.22);
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
        overflow: visible;
    }

    .dark .list-page-toolbar {
        background: rgba(15, 23, 42, 0.97);
        border-bottom-color: rgba(100, 116, 139, 0.32);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    }

    .list-page-sticky-filter-toggle {
        padding: 0.65rem 0.85rem;
        font-size: 0.8125rem;
        flex: unset;
        width: 100%;
        min-width: 0;
    }

    .list-page-sticky-filter-toggle--active {
        border-color: rgba(79, 70, 229, 0.42);
        background: rgba(238, 242, 255, 0.95);
    }

    .dark .list-page-sticky-filter-toggle--active {
        border-color: rgba(129, 140, 248, 0.45);
        background: rgba(49, 46, 129, 0.35);
    }
}

@media (min-width: 768px) {
    .list-page-toolbar {
        position: sticky;
        top: 4rem;
        z-index: 18;
        margin-bottom: 1.25rem;
        padding: 0.15rem 0 0.25rem;
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }

    .list-page-toolbar-spacer {
        display: none;
    }

    .list-page-sticky-filter-toggle {
        flex: 0 1 auto;
        width: auto;
        min-width: 12rem;
        max-width: 18rem;
    }

    .list-page-sticky-filter-toggle--active {
        border-color: rgba(79, 70, 229, 0.42);
        background: rgba(238, 242, 255, 0.95);
    }

    .dark .list-page-sticky-filter-toggle--active {
        border-color: rgba(129, 140, 248, 0.45);
        background: rgba(49, 46, 129, 0.35);
    }

    .list-page-sticky-action-btn {
        padding: 0.72rem 1.2rem;
        font-size: 0.875rem;
        border-radius: 0.85rem;
    }
}

.list-page-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, rgb(79, 70, 229), rgb(37, 99, 235));
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
}

.list-page-filter-form {
    margin-bottom: 0;
    box-shadow: none;
    gap: 1rem;
}

.filter-drawer-field-grid {
    display: grid;
    gap: 0.85rem;
}

.filter-drawer-field-grid--dates {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Side filter drawer — bottom sheet on mobile, side panel on desktop */
.filter-drawer--side {
    position: fixed;
    z-index: 87;
    pointer-events: none;
}

.filter-drawer--side.is-open {
    pointer-events: auto;
}

.filter-drawer--side .filter-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(3px);
}

.filter-drawer--side.is-open .filter-drawer-backdrop {
    opacity: 1;
}

.filter-drawer--side .filter-drawer-panel {
    position: absolute;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -16px 48px rgba(15, 23, 42, 0.18);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.dark .filter-drawer--side .filter-drawer-panel {
    background: rgba(15, 23, 42, 0.98);
}

.filter-drawer-handle {
    display: none;
    width: 2.75rem;
    height: 0.28rem;
    margin: 0.65rem auto 0;
    border-radius: 9999px;
    background: rgba(148, 163, 184, 0.55);
    flex-shrink: 0;
}

.filter-drawer--side .filter-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    flex-shrink: 0;
}

.dark .filter-drawer--side .filter-drawer-head {
    border-bottom-color: rgba(100, 116, 139, 0.32);
}

.filter-drawer--side .filter-drawer-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: rgb(15, 23, 42);
    line-height: 1.2;
}

.dark .filter-drawer--side .filter-drawer-title {
    color: rgb(248, 250, 252);
}

.filter-drawer-subtitle {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: rgb(100, 116, 139);
    line-height: 1.35;
}

.dark .filter-drawer-subtitle {
    color: rgb(148, 163, 184);
}

.filter-drawer--side .filter-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(248, 250, 252, 0.9);
    color: rgb(71, 85, 105);
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.dark .filter-drawer--side .filter-drawer-close {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(100, 116, 139, 0.35);
    color: rgb(226, 232, 240);
}

.filter-drawer--side .filter-drawer-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
}

.filter-drawer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.96);
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 2;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
}

.dark .filter-drawer-foot {
    border-top-color: rgba(100, 116, 139, 0.32);
    background: rgba(15, 23, 42, 0.96);
}

.filter-drawer-clear {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(100, 116, 139);
    text-decoration: none;
    padding: 0.55rem 0.25rem;
}

.filter-drawer-clear:hover {
    color: rgb(79, 70, 229);
}

.filter-drawer-clear--muted {
    pointer-events: none;
    opacity: 0.55;
}

.dark .filter-drawer-clear {
    color: rgb(148, 163, 184);
}

.dark .filter-drawer-clear:hover {
    color: rgb(199, 210, 254);
}

.filter-drawer-apply {
    min-width: 9.5rem;
    padding: 0.7rem 1.15rem;
}

body.filter-drawer-open {
    overflow: hidden;
}

body.filter-drawer-open #appMobileBottomNav {
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 767px) {
    .filter-drawer--side {
        z-index: 100;
        top: var(--list-fixed-toolbar-bottom, 4rem);
        left: 0;
        right: 0;
        bottom: 0;
    }

    .filter-drawer--side .filter-drawer-panel {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: min(
            82dvh,
            calc(100dvh - var(--list-fixed-toolbar-bottom, 4rem) - env(safe-area-inset-bottom, 0px))
        );
        border-radius: 1.35rem 1.35rem 0 0;
        transform: translateY(100%);
    }

    .filter-drawer--side .filter-drawer-foot {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .filter-drawer--side.is-open .filter-drawer-panel {
        transform: translateY(0);
    }

    .filter-drawer-handle {
        display: block;
    }
}

@media (min-width: 768px) {
    .filter-drawer--side {
        top: 4rem;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .filter-drawer--side .filter-drawer-panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(100%, 24rem);
        border-left: 1px solid rgba(148, 163, 184, 0.28);
        border-radius: 0;
        box-shadow: -12px 0 40px rgba(15, 23, 42, 0.14);
        transform: translateX(100%);
    }

    .dark .filter-drawer--side .filter-drawer-panel {
        border-left-color: rgba(100, 116, 139, 0.35);
    }

    .filter-drawer--side.is-open .filter-drawer-panel {
        transform: translateX(0);
    }

    .filter-drawer-field-grid {
        grid-template-columns: 1fr;
    }
}

.page-empty,
.chat-list-empty {
    border-style: dashed;
}

.page-empty-icon,
.chat-list-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 1.35rem;
    background: rgba(99, 102, 241, 0.12);
    color: rgb(79, 70, 229);
}

.entity-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.92);
    padding: 1.15rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.entity-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 16px 36px rgba(79, 70, 229, 0.12);
}

.dark .entity-card {
    background: rgba(30, 41, 59, 0.88);
    border-color: rgba(100, 116, 139, 0.35);
}

.entity-card-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.85rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, rgb(79, 70, 229), rgb(14, 165, 233));
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.25);
    flex-shrink: 0;
}

.entity-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.entity-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgb(100, 116, 139);
}

.form-label-optional {
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: rgb(148, 163, 184);
}

.form-control {
    width: 100%;
    min-height: 2.85rem;
    padding: 0.72rem 0.95rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.38);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: rgb(15, 23, 42);
    font-size: 0.925rem;
    line-height: 1.45;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, transform 0.12s ease;
}

.form-control::placeholder {
    color: rgb(148, 163, 184);
}

.form-control:hover:not(:disabled):not([readonly]) {
    border-color: rgba(99, 102, 241, 0.45);
}

.form-control:focus {
    outline: none;
    border-color: rgb(99, 102, 241);
    background: #fff;
    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.14),
        0 8px 20px rgba(79, 70, 229, 0.08);
}

select.form-control:focus {
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1rem;
}

.form-control:disabled,
.form-control[readonly] {
    opacity: 0.72;
    cursor: not-allowed;
    background: rgb(248, 250, 252);
}

textarea.form-control {
    min-height: 6.5rem;
    resize: vertical;
    padding-top: 0.85rem;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
    background-color: #f8fafc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1rem;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

input[type="date"].form-control,
input[type="datetime-local"].form-control,
input[type="time"].form-control {
    color-scheme: light;
}

.dark input[type="date"].form-control,
.dark input[type="datetime-local"].form-control,
.dark input[type="time"].form-control {
    color-scheme: dark;
}

.dark .form-control {
    background: linear-gradient(180deg, rgb(30, 41, 59) 0%, rgb(15, 23, 42) 100%);
    border-color: rgba(100, 116, 139, 0.48);
    color: rgb(248, 250, 252);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.dark select.form-control {
    background-color: rgb(30, 41, 59);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1rem;
}

.dark .form-control:hover:not(:disabled):not([readonly]) {
    border-color: rgba(129, 140, 248, 0.55);
}

.dark select.form-control:hover:not(:disabled):not([readonly]) {
    background-color: rgb(30, 41, 59);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1rem;
}

.dark .form-control:focus {
    background: rgb(30, 41, 59);
    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.22),
        0 8px 20px rgba(0, 0, 0, 0.22);
}

.dark select.form-control:focus {
    background-color: rgb(30, 41, 59);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1rem;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.15rem;
    border-radius: 0.85rem;
    border: 0;
    background: linear-gradient(135deg, rgb(79, 70, 229), rgb(37, 99, 235));
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.28);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
    opacity: 0.95;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.15rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: #fff;
    color: rgb(51, 65, 85);
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.dark .btn-secondary {
    background: rgb(30, 41, 59);
    border-color: rgba(100, 116, 139, 0.45);
    color: rgb(226, 232, 240);
}

.btn-secondary:hover {
    background: rgb(248, 250, 252);
}

.dark .btn-secondary:hover {
    background: rgb(51, 65, 85);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.15rem;
    border-radius: 0.85rem;
    border: 0;
    background: linear-gradient(135deg, rgb(220, 38, 38), rgb(185, 28, 28));
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(220, 38, 38, 0.25);
}

.app-modal-panel {
    border-radius: 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.dark .app-modal-panel {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.96));
    border-color: rgba(100, 116, 139, 0.35);
}

.app-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.app-modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: rgb(15, 23, 42);
}

.dark .app-modal-title {
    color: rgb(248, 250, 252);
}

.app-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: rgb(100, 116, 139);
    transition: background-color 0.2s ease;
}

.app-modal-close:hover {
    background: rgba(148, 163, 184, 0.12);
}

@media (max-width: 767px) {
    .modal-backdrop {
        align-items: flex-start;
        justify-content: center;
        padding:
            calc(4.35rem + env(safe-area-inset-top, 0px))
            0.75rem
            calc(5.25rem + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .modal-backdrop > .app-modal-panel,
    .modal-backdrop > .soft-card.modal-panel,
    .modal-backdrop > .modal-panel.soft-card,
    .modal-backdrop > .modal-panel {
        width: 100%;
        max-height: calc(
            100dvh - 9.75rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
        );
        margin-top: 0;
        overflow-y: auto;
    }

    #projectTeamPickerModal .app-modal-panel {
        max-height: min(
            26rem,
            calc(100dvh - 10rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
        );
        overflow: hidden;
    }

    #projectTeamPickerModal .project-team-picker-list {
        max-height: min(12rem, 34vh);
        flex: none;
    }

    #createProjectModal .app-modal-panel,
    [id^="editProjectModal"] .app-modal-panel {
        max-height: calc(
            100dvh - 9.75rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
        );
    }

    #imageLightbox.modal-backdrop {
        align-items: center;
        padding: 1rem;
        padding-top: calc(1rem + env(safe-area-inset-top, 0px));
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: capitalize;
}

.status-pill--active {
    background: rgba(16, 185, 129, 0.14);
    color: rgb(4, 120, 87);
}

.dark .status-pill--active {
    background: rgba(16, 185, 129, 0.22);
    color: rgb(110, 231, 183);
}

.status-pill--inactive {
    background: rgba(239, 68, 68, 0.12);
    color: rgb(185, 28, 28);
}

.dark .status-pill--inactive {
    background: rgba(239, 68, 68, 0.22);
    color: rgb(252, 165, 165);
}

.page-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: rgb(100, 116, 139);
}

.page-pagination a,
.page-pagination span {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    transition: background-color 0.2s ease;
}

.page-pagination a {
    background: #fff;
    color: rgb(51, 65, 85);
    font-weight: 600;
}

.dark .page-pagination a {
    background: rgb(30, 41, 59);
    color: rgb(226, 232, 240);
}

.page-pagination a:hover {
    background: rgb(248, 250, 252);
}

.page-pagination span.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Auth pages */
.auth-page {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 45%, #e0f2fe 100%);
}

.dark .auth-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
}

.auth-page-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.18), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(14, 165, 233, 0.14), transparent 38%);
}

.auth-page-wrap {
    position: relative;
    width: 100%;
    max-width: 28rem;
}

.auth-card {
    padding: 1.85rem 1.65rem;
    border-radius: 1.5rem;
    box-shadow: 0 24px 60px rgba(79, 70, 229, 0.1);
}

.auth-card-brand {
    text-align: center;
    margin-bottom: 1.35rem;
}

.auth-card-logo {
    width: 4.5rem;
    height: 4.5rem;
    object-fit: contain;
    border-radius: 1rem;
    margin: 0 auto 0.85rem;
    padding: 0.35rem;
    background: #fff;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.15);
}

.dark .auth-card-logo {
    background: rgb(30, 41, 59);
}

.auth-card-eyebrow {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgb(79, 70, 229);
}

.auth-card-title {
    margin-top: 0.35rem;
    font-size: 1.55rem;
    font-weight: 800;
    color: rgb(15, 23, 42);
}

.dark .auth-card-title {
    color: rgb(248, 250, 252);
}

.auth-card-subtitle {
    margin-top: 0.45rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgb(100, 116, 139);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.auth-form .form-control {
    min-height: 3rem;
    font-size: 0.95rem;
}

.auth-flash {
    margin-bottom: 1rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.auth-flash--success {
    background: rgba(16, 185, 129, 0.12);
    color: rgb(4, 120, 87);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.auth-flash--error {
    background: rgba(239, 68, 68, 0.1);
    color: rgb(185, 28, 28);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.auth-foot-link {
    margin-top: 1.15rem;
    text-align: center;
    font-size: 0.82rem;
}

.auth-foot-link a {
    font-weight: 700;
    color: rgb(79, 70, 229);
    text-decoration: none;
}

.auth-foot-link--legal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: rgb(100, 116, 139);
}

.auth-foot-link--legal span {
    opacity: 0.55;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-control--otp {
    text-align: center;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.35em;
}

.form-section {
    padding: 0.85rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(248, 250, 252, 0.8);
}

.dark .form-section {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(100, 116, 139, 0.28);
}

.form-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(79, 70, 229);
    margin-bottom: 0.65rem;
}

.form-wizard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.form-wizard-dots {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.form-wizard-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 9999px;
    background: rgba(148, 163, 184, 0.45);
    transition: background 0.2s ease, transform 0.2s ease;
}

.form-wizard-dot.is-active {
    background: rgb(79, 70, 229);
    transform: scale(1.15);
}

.form-wizard-dot.is-done {
    background: rgba(79, 70, 229, 0.45);
}

.form-wizard-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgb(100, 116, 139);
}

.dark .form-wizard-label {
    color: rgb(148, 163, 184);
}

.form-wizard-step {
    display: none;
}

.form-wizard-step.is-active,
.form-wizard-step:not([hidden]) {
    display: block;
}

.form-wizard-step[hidden] {
    display: none !important;
}

.form-wizard-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-top: 0.25rem;
}

.form-control-file {
    cursor: pointer;
}

.form-control-file::file-selector-button {
    margin-right: 0.75rem;
    border: 0;
    border-radius: 0.65rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(37, 99, 235, 0.12));
    color: rgb(67, 56, 202);
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.18);
}

.dark .form-control-file::file-selector-button {
    background: rgba(99, 102, 241, 0.22);
    color: rgb(165, 180, 252);
}

/* SaaS file upload dropzone */
.file-upload-zone {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    border: 2px dashed rgba(148, 163, 184, 0.45);
    background:
        radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.07), transparent 55%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.92));
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.file-upload-zone:hover,
.file-upload-zone.is-dragover {
    border-color: rgba(99, 102, 241, 0.65);
    box-shadow: 0 10px 28px rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}

.file-upload-zone.is-dragover {
    background: rgba(238, 242, 255, 0.95);
}

.dark .file-upload-zone {
    border-color: rgba(100, 116, 139, 0.45);
    background:
        radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.12), transparent 55%),
        linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.92));
}

.dark .file-upload-zone.is-dragover {
    background: rgba(49, 46, 129, 0.28);
}

.file-upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 1.35rem 1rem;
    text-align: center;
    pointer-events: none;
}

.file-upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.95rem;
    background: rgba(99, 102, 241, 0.12);
    color: rgb(79, 70, 229);
}

.file-upload-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: rgb(51, 65, 85);
}

.file-upload-title strong {
    color: rgb(79, 70, 229);
}

.file-upload-hint {
    font-size: 0.75rem;
    color: rgb(100, 116, 139);
}

.dark .file-upload-title {
    color: rgb(226, 232, 240);
}

.dark .file-upload-title strong {
    color: rgb(165, 180, 252);
}

.file-upload-preview {
    margin-top: 0.75rem;
}

.file-upload-preview-inner {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    padding: 0.85rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(248, 250, 252, 0.92);
}

.dark .file-upload-preview-inner {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(100, 116, 139, 0.35);
}

.file-upload-thumb-wrap {
    display: block;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #fff;
}

.file-upload-thumb {
    display: block;
    width: 5.5rem;
    height: 5.5rem;
    object-fit: cover;
}

.file-upload-preview-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: rgb(30, 41, 59);
}

.file-upload-preview-hint {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: rgb(100, 116, 139);
}

.file-upload-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

/* Checkbox / radio SaaS styling */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.form-check-inline {
    align-items: center;
}

.form-check-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.12rem;
    flex-shrink: 0;
    border-radius: 0.35rem;
    border: 1.5px solid rgba(148, 163, 184, 0.65);
    background-color: #fff;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.form-check-input:checked {
    border-color: rgb(79, 70, 229);
    background-color: rgb(79, 70, 229);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.75rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.28);
}

.form-check-input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.form-check-input:checked:focus-visible {
    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.18),
        0 4px 10px rgba(79, 70, 229, 0.28);
}

.form-check-body {
    min-width: 0;
    flex: 1;
}

.form-check-title {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(15, 23, 42);
}

.form-check-subtitle {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.75rem;
    color: rgb(100, 116, 139);
}

.form-check-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgb(71, 85, 105);
}

.dark .form-check-input:not(:checked) {
    background-color: rgb(30, 41, 59);
    border-color: rgba(100, 116, 139, 0.55);
}

.dark .form-check-input:checked {
    border-color: rgb(129, 140, 248);
    background-color: rgb(79, 70, 229);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.75rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.dark .form-check-title {
    color: rgb(248, 250, 252);
}

.recipient-check:has(.form-check-input:checked) {
    background: rgba(99, 102, 241, 0.08);
}

.dark .recipient-check:has(.form-check-input:checked) {
    background: rgba(99, 102, 241, 0.16);
}

.recipient-picker {
    max-height: 14rem;
    overflow-y: auto;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.72);
}

.dark .recipient-picker {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(100, 116, 139, 0.35);
}

.recipient-check {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    transition: background-color 0.15s ease;
}

.recipient-check:last-child {
    border-bottom: 0;
}

.recipient-check:hover {
    background: rgba(99, 102, 241, 0.05);
}

.dark .recipient-check:hover {
    background: rgba(99, 102, 241, 0.1);
}

.btn-sm {
    padding: 0.45rem 0.8rem;
    font-size: 0.78rem;
    border-radius: 0.7rem;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: 0.7rem;
    border: 0;
    background: transparent;
    color: rgb(79, 70, 229);
    font-size: 0.78rem;
    font-weight: 700;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
    background: rgba(99, 102, 241, 0.1);
}

.dark .btn-ghost {
    color: rgb(165, 180, 252);
}

/* Top bar */
.topbar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.88);
    color: rgb(51, 65, 85);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.topbar-icon-btn:hover,
.topbar-icon-btn[aria-expanded="true"] {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(238, 242, 255, 0.95);
    color: rgb(79, 70, 229);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.12);
}

.dark .topbar-icon-btn {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(100, 116, 139, 0.35);
    color: rgb(226, 232, 240);
}

.dark .topbar-icon-btn:hover,
.dark .topbar-icon-btn[aria-expanded="true"] {
    background: rgba(49, 46, 129, 0.35);
    border-color: rgba(129, 140, 248, 0.45);
    color: rgb(199, 210, 254);
}

.topbar-badge {
    position: absolute;
    top: -0.15rem;
    right: -0.15rem;
    min-width: 1.05rem;
    height: 1.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: linear-gradient(135deg, rgb(239, 68, 68), rgb(220, 38, 38));
    color: #fff;
    font-size: 0.58rem;
    font-weight: 800;
    padding: 0 0.25rem;
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35);
}

.dark .topbar-badge {
    border-color: rgb(30, 41, 59);
}

.topbar-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.65rem;
    height: 2.65rem;
    padding: 0;
    border-radius: 0.85rem;
    border: 0;
    background: linear-gradient(135deg, rgb(239, 68, 68), rgb(220, 38, 38));
    color: #fff;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.22);
    transition: opacity 0.15s ease, transform 0.12s ease;
}

.topbar-logout-btn:hover {
    opacity: 0.95;
}

.topbar-logout-btn:active {
    transform: scale(0.98);
}

.topbar-profile-btn {
    padding: 0;
}

.topbar-profile-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, rgb(99, 102, 241), rgb(59, 130, 246));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.profile-menu-panel {
    animation: profile-menu-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes profile-menu-in {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-menu-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.1rem 1.1rem 0.85rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.dark .profile-menu-head {
    border-bottom-color: rgba(100, 116, 139, 0.32);
}

.profile-menu-avatar {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 0.85rem;
}

.profile-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(248, 250, 252, 0.9);
    color: rgb(71, 85, 105);
    font-size: 1rem;
    line-height: 1;
}

.dark .profile-menu-close {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(100, 116, 139, 0.35);
    color: rgb(226, 232, 240);
}

.profile-menu-list {
    display: flex;
    flex-direction: column;
    padding: 0.45rem;
    padding-bottom: max(0.45rem, env(safe-area-inset-bottom));
}

.profile-menu-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem;
    border-radius: 0.85rem;
    border: 0;
    background: transparent;
    color: rgb(51, 65, 85);
    font-size: 0.925rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.profile-menu-item:hover {
    background: rgba(238, 242, 255, 0.85);
}

.dark .profile-menu-item {
    color: rgb(226, 232, 240);
}

.dark .profile-menu-item:hover {
    background: rgba(49, 46, 129, 0.25);
}

.profile-menu-theme {
    justify-content: space-between;
}

.profile-menu-item--danger {
    color: rgb(220, 38, 38);
}

.profile-menu-item--danger:hover {
    background: rgba(254, 226, 226, 0.85);
}

.dark .profile-menu-item--danger {
    color: rgb(248, 113, 113);
}

.dark .profile-menu-item--danger:hover {
    background: rgba(127, 29, 29, 0.35);
}

.profile-menu-theme-toggle {
    display: inline-flex;
    cursor: pointer;
}

.profile-menu-theme-track {
    position: relative;
    display: inline-block;
    width: 2.75rem;
    height: 1.5rem;
    border-radius: 9999px;
    background: rgb(203, 213, 225);
    transition: background-color 0.2s ease;
}

.profile-menu-theme-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 9999px;
    background: #fff;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}

.profile-menu-theme-toggle input:checked + .profile-menu-theme-track {
    background: rgb(79, 70, 229);
}

.profile-menu-theme-toggle input:checked + .profile-menu-theme-track::after {
    transform: translateX(1.25rem);
}

.dark .profile-menu-theme-track {
    background: rgb(71, 85, 105);
}

/* Notification dropdown */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 0.65rem);
    right: 0;
    width: min(22rem, calc(100vw - 1.5rem));
    max-height: min(28rem, calc(100dvh - 6rem));
    display: flex;
    flex-direction: column;
    border-radius: 1.15rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.16),
        0 0 0 1px rgba(255, 255, 255, 0.65) inset;
    backdrop-filter: blur(14px);
    overflow: hidden;
    z-index: 80;
    animation: notification-drop-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.dark .notification-dropdown {
    background: rgba(15, 23, 42, 0.98);
    border-color: rgba(100, 116, 139, 0.35);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

@keyframes notification-drop-in {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.notification-dropdown-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.notification-dropdown-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: rgb(15, 23, 42);
}

.dark .notification-dropdown-title {
    color: rgb(248, 250, 252);
}

.notification-dropdown-subtitle {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: rgb(100, 116, 139);
}

.notification-dropdown-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

.notification-item:hover {
    background: rgba(99, 102, 241, 0.06);
}

.notification-item--unread {
    background: rgba(238, 242, 255, 0.65);
}

.dark .notification-item--unread {
    background: rgba(49, 46, 129, 0.22);
}

.notification-item-thumb {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.75rem;
    object-fit: cover;
    flex-shrink: 0;
}

.notification-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.75rem;
    background: rgba(99, 102, 241, 0.12);
    color: rgb(79, 70, 229);
    flex-shrink: 0;
}

.notification-item-body {
    min-width: 0;
    flex: 1;
}

.notification-item-title {
    display: block;
    font-size: 0.84rem;
    font-weight: 700;
    color: rgb(15, 23, 42);
    line-height: 1.3;
}

.dark .notification-item-title {
    color: rgb(248, 250, 252);
}

.notification-item-text {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.76rem;
    line-height: 1.4;
    color: rgb(100, 116, 139);
}

.notification-item-meta {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.68rem;
    color: rgb(148, 163, 184);
}

.notification-item-dot {
    width: 0.5rem;
    height: 0.5rem;
    margin-top: 0.35rem;
    border-radius: 9999px;
    background: rgb(79, 70, 229);
    flex-shrink: 0;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.notification-empty {
    padding: 2rem 1.25rem;
    text-align: center;
}

.notification-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    background: rgba(99, 102, 241, 0.1);
    color: rgb(79, 70, 229);
}

.notification-empty-title {
    margin-top: 0.85rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: rgb(30, 41, 59);
}

.dark .notification-empty-title {
    color: rgb(248, 250, 252);
}

.notification-empty-text {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: rgb(100, 116, 139);
}

.notification-dropdown-foot {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(248, 250, 252, 0.85);
}

.dark .notification-dropdown-foot {
    background: rgba(15, 23, 42, 0.65);
}

.notification-view-all {
    display: block;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: rgb(79, 70, 229);
    text-decoration: none;
}

.dark .notification-view-all {
    color: rgb(165, 180, 252);
}

/* Admin notification cards — 4 per row on desktop */
.notification-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .notification-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .notification-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.notification-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0;
}

a.notification-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.notification-card--unread {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
}

.notification-card:hover {
    transform: translateY(-2px);
}

.notification-card-image {
    width: 100%;
    height: 8.5rem;
    object-fit: cover;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.notification-card-image--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.95), rgba(224, 231, 255, 0.85));
}

.dark .notification-card-image--empty {
    background: linear-gradient(135deg, rgba(49, 46, 129, 0.35), rgba(30, 41, 59, 0.9));
}

.notification-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.65rem;
    padding: 0.9rem 1rem 1rem;
}

.notification-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.notification-card-head-end {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.notification-card-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.95);
    color: rgb(100, 116, 139);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.notification-card-icon-btn:hover {
    transform: scale(1.05);
}

.notification-card-icon-btn--danger {
    color: rgb(220, 38, 38);
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(254, 242, 242, 0.95);
}

.notification-card-icon-btn--danger:hover {
    color: rgb(255, 255, 255);
    background: rgb(220, 38, 38);
    border-color: rgb(220, 38, 38);
}

.dark .notification-card-icon-btn {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(100, 116, 139, 0.35);
    color: rgb(148, 163, 184);
}

.dark .notification-card-icon-btn--danger {
    color: rgb(248, 113, 113);
    background: rgba(127, 29, 29, 0.25);
    border-color: rgba(248, 113, 113, 0.25);
}

.dark .notification-card-icon-btn--danger:hover {
    color: rgb(255, 255, 255);
    background: rgb(220, 38, 38);
    border-color: rgb(220, 38, 38);
}

.notification-card-cancel-link {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgb(100, 116, 139);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.notification-card-cancel-link:hover {
    color: rgb(79, 70, 229);
}

.notification-card-title {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.3;
    color: rgb(15, 23, 42);
    min-width: 0;
}

.dark .notification-card-title {
    color: rgb(248, 250, 252);
}

.notification-card-text {
    font-size: 0.78rem;
    line-height: 1.45;
    color: rgb(100, 116, 139);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.4rem;
}

.dark .notification-card-text {
    color: rgb(148, 163, 184);
}

.notification-card-text--muted {
    color: rgb(148, 163, 184);
    font-style: italic;
}

.notification-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 0.65rem;
    margin-top: auto;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    font-size: 0.68rem;
}

.notification-card-meta dt {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgb(100, 116, 139);
}

.notification-card-meta dd {
    margin-top: 0.1rem;
    font-weight: 600;
    color: rgb(51, 65, 85);
}

.dark .notification-card-meta dd {
    color: rgb(226, 232, 240);
}

.notification-card-meta-wide {
    grid-column: 1 / -1;
}

.notification-card-error {
    font-size: 0.68rem;
    color: rgb(220, 38, 38);
}

.notification-card-foot {
    margin-top: 0.35rem;
}

.notification-card-action-form {
    margin: 0;
}

/* Notification detail view */
.notification-detail {
    max-width: 42rem;
    padding: 1.25rem 1.35rem 1.35rem;
}

.notification-detail-head {
    margin-bottom: 1rem;
}

.notification-detail-title {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.3;
    color: rgb(15, 23, 42);
}

.dark .notification-detail-title {
    color: rgb(248, 250, 252);
}

.notification-detail-media {
    margin-bottom: 1rem;
    text-align: center;
}

.notification-detail-image-btn {
    display: inline-flex;
    max-width: 100%;
    padding: 0.65rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(248, 250, 252, 0.92);
    cursor: zoom-in;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.notification-detail-image-btn:hover {
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.12);
}

.dark .notification-detail-image-btn {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(100, 116, 139, 0.35);
}

.notification-detail-image {
    display: block;
    max-width: min(100%, 18rem);
    max-height: 10rem;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
}

.notification-detail-media-hint {
    margin-top: 0.45rem;
    font-size: 0.72rem;
    color: rgb(100, 116, 139);
}

.notification-detail-body {
    margin-bottom: 1rem;
}

.notification-detail-text {
    font-size: 0.95rem;
    line-height: 1.65;
    color: rgb(51, 65, 85);
    white-space: pre-wrap;
}

.dark .notification-detail-text {
    color: rgb(226, 232, 240);
}

.notification-detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 0.85rem;
}

.notification-detail-meta dt {
    font-weight: 700;
    color: rgb(100, 116, 139);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.notification-detail-meta dd {
    margin-top: 0.2rem;
    font-weight: 600;
    color: rgb(51, 65, 85);
}

.dark .notification-detail-meta dd {
    color: rgb(226, 232, 240);
}

.notification-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 75;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(2px);
}

.notification-dropdown-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.notification-dropdown-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(248, 250, 252, 0.95);
    color: rgb(100, 116, 139);
    font-size: 0.85rem;
}

.dark .notification-dropdown-close {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(100, 116, 139, 0.35);
    color: rgb(203, 213, 225);
}

@media (max-width: 767px) {
    #mobileSidebarBackdrop {
        z-index: 94;
    }

    #appSidebar {
        z-index: 95;
        top: 0;
        height: 100dvh;
        height: 100svh;
        padding-top: env(safe-area-inset-top, 0px);
    }

    #appTopHeader {
        z-index: 86;
        overflow: visible;
    }

    .notification-dropdown {
        position: fixed;
        top: calc(4.25rem + env(safe-area-inset-top, 0px));
        left: 0.75rem;
        right: 0.75rem;
        width: auto;
        max-width: none;
        max-height: min(26rem, calc(100dvh - 7rem - env(safe-area-inset-bottom, 0px)));
        z-index: 85;
    }

    body.notification-panel-open {
        overflow: hidden;
    }

    body.mobile-sidebar-open {
        overflow: hidden;
    }
}

@media (min-width: 768px) {
    .notification-dropdown-backdrop {
        display: none !important;
    }
}

/* Recipient search */
.recipient-search-wrap {
    position: relative;
    margin-bottom: 0.65rem;
}

.recipient-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: rgb(148, 163, 184);
    pointer-events: none;
}

.recipient-search-input {
    padding-left: 2.35rem;
}

.recipient-picker-empty {
    padding: 1.25rem 0.85rem;
    text-align: center;
    font-size: 0.82rem;
    color: rgb(100, 116, 139);
}

/* Project team picker */
.project-team-members {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    min-height: 0.5rem;
}

.project-team-empty-hint {
    margin-top: 0.65rem;
    font-size: 0.78rem;
    color: rgb(100, 116, 139);
}

.project-team-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    max-width: 100%;
    padding: 0.45rem 0.55rem 0.45rem 0.45rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.dark .project-team-chip {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(100, 116, 139, 0.35);
}

.project-team-chip-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(59, 130, 246, 0.12));
    color: rgb(79, 70, 229);
    font-size: 0.82rem;
    font-weight: 800;
    flex-shrink: 0;
}

.project-team-chip-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.project-team-chip-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: rgb(15, 23, 42);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 12rem;
}

.dark .project-team-chip-name {
    color: rgb(248, 250, 252);
}

.project-team-chip-meta {
    font-size: 0.68rem;
    color: rgb(100, 116, 139);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 12rem;
}

.project-team-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: rgb(148, 163, 184);
    cursor: pointer;
    flex-shrink: 0;
}

.project-team-chip-remove:hover {
    background: rgba(248, 113, 113, 0.12);
    color: rgb(220, 38, 38);
}

.project-team-picker-list {
    max-height: min(22rem, 52vh);
}

.project-team-picker-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.project-team-picker-row:last-child {
    border-bottom: 0;
}

.project-team-picker-row.is-added {
    opacity: 0.72;
    background: rgba(99, 102, 241, 0.04);
}

.project-team-picker-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1;
}

.project-team-picker-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.75rem;
    background: rgba(99, 102, 241, 0.12);
    color: rgb(79, 70, 229);
    font-weight: 800;
    flex-shrink: 0;
}

.project-team-picker-name {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: rgb(15, 23, 42);
}

.dark .project-team-picker-name {
    color: rgb(248, 250, 252);
}

.project-team-picker-sub {
    display: block;
    font-size: 0.72rem;
    color: rgb(100, 116, 139);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(100%, 18rem);
}

.project-team-picker-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.project-team-picker-actions .form-control-sm {
    min-height: 2.35rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
    min-width: 7.5rem;
}

.project-team-picker-added {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgb(79, 70, 229);
    padding: 0.35rem 0.55rem;
}

.recipient-check.is-hidden {
    display: none;
}

.data-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
    padding: 1.1rem;
    border-radius: 1.15rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.data-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 16px 36px rgba(79, 70, 229, 0.1);
}

.dark .data-card {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(100, 116, 139, 0.35);
}

.data-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.data-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.data-card-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: rgb(100, 116, 139);
}

.data-card-row strong {
    color: rgb(51, 65, 85);
    font-weight: 600;
}

.dark .data-card-row strong {
    color: rgb(226, 232, 240);
}

.data-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.priority-pill {
    display: inline-flex;
    padding: 0.18rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 700;
}

.priority-pill--critical { background: rgba(239, 68, 68, 0.14); color: rgb(185, 28, 28); }
.priority-pill--high { background: rgba(245, 158, 11, 0.16); color: rgb(180, 83, 9); }
.priority-pill--medium { background: rgba(99, 102, 241, 0.14); color: rgb(67, 56, 202); }
.priority-pill--low { background: rgba(148, 163, 184, 0.2); color: rgb(71, 85, 105); }

.mobile-nav-badge {
    position: absolute;
    top: -0.15rem;
    right: -0.2rem;
    min-width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgb(239, 68, 68);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 0 0.25rem;
    border: 2px solid #fff;
}

.dark .mobile-nav-badge {
    border-color: rgb(15, 23, 42);
}

/* Project chats list */

.chat-list-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}

.chat-list-card {
    position: relative;
    display: block;
    border-radius: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-list-card:hover {
    transform: translateY(-2px);
}

.chat-list-card-glow {
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(37, 99, 235, 0.2));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-list-card:hover .chat-list-card-glow,
.chat-list-card--unread .chat-list-card-glow {
    opacity: 1;
}

.chat-list-card-inner {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.1rem 1.15rem;
    border-radius: inherit;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.dark .chat-list-card-inner {
    background: rgba(30, 41, 59, 0.88);
    border-color: rgba(100, 116, 139, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.chat-list-card--unread .chat-list-card-inner {
    border-color: rgba(99, 102, 241, 0.45);
    background: linear-gradient(180deg, rgba(238, 242, 255, 0.95), rgba(255, 255, 255, 0.98));
}

.dark .chat-list-card--unread .chat-list-card-inner {
    background: linear-gradient(180deg, rgba(49, 46, 129, 0.35), rgba(30, 41, 59, 0.92));
}

.chat-list-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.chat-list-card-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.9rem;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, rgb(79, 70, 229), rgb(14, 165, 233));
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.28);
    flex-shrink: 0;
}

.chat-list-unread-badge {
    display: inline-flex;
    min-width: 1.35rem;
    height: 1.35rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgb(239, 68, 68);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0 0.35rem;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.chat-list-card-preview {
    min-height: 2.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.85rem;
    background: rgba(241, 245, 249, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.18);
    font-size: 0.82rem;
    line-height: 1.45;
    color: rgb(71, 85, 105);
}

.dark .chat-list-card-preview {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(100, 116, 139, 0.25);
    color: rgb(203, 213, 225);
}

.chat-list-card-sender {
    font-weight: 700;
    color: rgb(51, 65, 85);
}

.dark .chat-list-card-sender {
    color: rgb(226, 232, 240);
}

.chat-list-card-snippet {
    word-break: break-word;
}

.chat-list-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.15rem;
}

.chat-list-card-time {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: rgb(100, 116, 139);
}

.chat-list-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: rgb(79, 70, 229);
}

.dark .chat-list-card-cta {
    color: rgb(129, 140, 248);
}

/* Project chat */
.project-chat-shell {
    display: grid;
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    height: calc(100dvh - 11rem);
    min-height: 420px;
    max-height: calc(100dvh - 7rem);
    position: relative;
}

.chat-mobile-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.chat-header-btn {
    display: inline-flex;
    height: 2.5rem;
    width: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.9);
    color: rgb(51, 65, 85);
    flex-shrink: 0;
}

.dark .chat-header-btn {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(100, 116, 139, 0.45);
    color: rgb(226, 232, 240);
}

.chat-sidebar-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.chat-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(2px);
}

.chat-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(248, 250, 252, 0.9);
    min-height: 0;
}

.dark .chat-sidebar {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(100, 116, 139, 0.35);
}

.chat-sidebar-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.chat-sidebar-tab {
    flex: 1;
    border-radius: 0.65rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgb(100, 116, 139);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.chat-sidebar-tab.is-active {
    background: rgb(79, 70, 229);
    color: #fff;
}

.chat-sidebar-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chat-sidebar-panel {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 0.75rem;
}

.chat-sidebar-panel.is-active {
    display: block;
}

.chat-members-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-member-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.85);
    padding: 0.65rem 0.75rem;
}

.dark .chat-member-item {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(100, 116, 139, 0.35);
}

.chat-member-avatar {
    display: inline-flex;
    height: 2.25rem;
    width: 2.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.15);
    color: rgb(79, 70, 229);
    font-weight: 700;
    flex-shrink: 0;
}

.chat-media-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.chat-media-thumb,
.chat-media-file {
    aspect-ratio: 1;
    border-radius: 0.65rem;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.8);
}

.chat-media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-media-file {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    font-size: 0.68rem;
    font-weight: 700;
    color: rgb(51, 65, 85);
    text-decoration: none;
    padding: 0.35rem;
    gap: 0.35rem;
}

.chat-media-file-preview {
    flex: 1;
    min-height: 0;
    border-radius: 0.45rem;
    overflow: hidden;
    background: rgb(248, 250, 252);
}

.chat-media-file-preview iframe {
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
}

.chat-media-file-icon {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    border-radius: 0.45rem;
    background: rgba(99, 102, 241, 0.1);
    color: rgb(79, 70, 229);
}

.chat-media-file--pdf .chat-media-file-icon,
.chat-media-file--zip .chat-media-file-icon,
.chat-media-file--docx .chat-media-file-icon,
.chat-media-file--csv .chat-media-file-icon {
    background: rgba(99, 102, 241, 0.1);
}

.chat-media-file--pdf .chat-media-file-icon { color: rgb(220, 38, 38); background: rgba(239, 68, 68, 0.1); }
.chat-media-file--zip .chat-media-file-icon { color: rgb(217, 119, 6); background: rgba(245, 158, 11, 0.12); }
.chat-media-file--docx .chat-media-file-icon { color: rgb(37, 99, 235); background: rgba(37, 99, 235, 0.1); }
.chat-media-file--csv .chat-media-file-icon { color: rgb(5, 150, 105); background: rgba(16, 185, 129, 0.12); }

.chat-media-file-label {
    text-align: center;
    line-height: 1.2;
    font-size: 0.62rem;
}

.chat-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: rgba(255, 255, 255, 0.65);
}

.dark .chat-main {
    background: rgba(15, 23, 42, 0.35);
}

.chat-main-header {
    flex-shrink: 0;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.chat-load-older {
    flex-shrink: 0;
    text-align: center;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.chat-date-separator {
    align-self: center;
    flex-shrink: 0;
    margin: 0.35rem auto;
    padding: 0.3rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgb(71, 85, 105);
    background: rgba(148, 163, 184, 0.22);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.dark .chat-date-separator {
    color: rgb(203, 213, 225);
    background: rgba(51, 65, 85, 0.65);
}

.chat-message {
    position: relative;
    max-width: min(88%, 520px);
    align-self: flex-start;
}

.chat-message.is-mine {
    align-self: flex-end;
}

.chat-message.is-highlighted::before,
.chat-message.is-flash-highlighted::before {
    content: '';
    position: absolute;
    top: -0.35rem;
    bottom: -0.35rem;
    left: calc(-1 * var(--msg-highlight-left, 0px));
    right: calc(-1 * var(--msg-highlight-right, 0px));
    border-radius: 0.75rem;
    background: rgba(99, 102, 241, 0.12);
    box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.5), 0 0 0 4px rgba(99, 102, 241, 0.08);
    pointer-events: none;
    z-index: 0;
}

.dark .chat-message.is-highlighted::before,
.dark .chat-message.is-flash-highlighted::before {
    background: rgba(99, 102, 241, 0.18);
    box-shadow: inset 0 0 0 2px rgba(129, 140, 248, 0.55), 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.chat-message.is-highlighted > *,
.chat-message.is-flash-highlighted > * {
    position: relative;
    z-index: 1;
}

.chat-message.is-flash-highlighted::before {
    animation: chat-flash-highlight-row 0.45s ease-out;
}

@keyframes chat-flash-highlight-row {
    from {
        background: rgba(99, 102, 241, 0.24);
        box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.85), 0 0 0 8px rgba(99, 102, 241, 0.18);
    }
    to {
        background: rgba(99, 102, 241, 0.12);
        box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.5), 0 0 0 4px rgba(99, 102, 241, 0.08);
    }
}

.chat-message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
    margin-bottom: 0.25rem;
    font-size: 0.72rem;
    color: rgb(100, 116, 139);
}

.chat-message.is-mine .chat-message-meta {
    justify-content: flex-end;
}

.chat-message-bubble {
    border-radius: 1rem;
    padding: 0.65rem 0.85rem;
    background: rgba(241, 245, 249, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
}

.dark .chat-message-bubble {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(100, 116, 139, 0.35);
}

.chat-message.is-mine .chat-message-bubble {
    background: linear-gradient(135deg, rgb(79, 70, 229), rgb(37, 99, 235));
    color: #fff;
    border-color: transparent;
}

.chat-message.is-mine .chat-msg-reply-ref {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.95);
}

.chat-message.is-mine button.chat-msg-reply-ref:hover {
    background: rgba(255, 255, 255, 0.24);
}

.chat-msg-reply-ref {
    display: block;
    width: 100%;
    margin-bottom: 0.45rem;
    border: 0;
    border-left: 3px solid rgb(99, 102, 241);
    padding: 0.35rem 0.5rem;
    border-radius: 0.45rem;
    background: rgba(99, 102, 241, 0.08);
    font-size: 0.78rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

button.chat-msg-reply-ref:hover {
    background: rgba(99, 102, 241, 0.16);
}

button.chat-msg-reply-ref:active {
    transform: scale(0.99);
}

.chat-msg-deleted {
    font-style: italic;
    opacity: 0.75;
}

.chat-msg-edited {
    font-size: 0.7rem;
    opacity: 0.7;
}

.chat-msg-media img {
    margin-top: 0.35rem;
    max-height: 220px;
    border-radius: 0.65rem;
}

.chat-msg-file-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.4rem;
    max-width: min(280px, 100%);
    border-radius: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #fff;
    color: rgb(30, 41, 59);
    text-decoration: none;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.chat-message.is-mine .chat-msg-file-card {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
}

.chat-msg-file-card--pdf {
    display: block;
    padding: 0;
}

.chat-msg-file-card-preview {
    display: block;
    height: 148px;
    overflow: hidden;
    background: rgb(248, 250, 252);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    text-decoration: none;
}

.chat-msg-file-card-preview iframe {
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
}

.chat-msg-file-card-footer {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
    text-decoration: none;
    color: inherit;
    background: #fff;
}

.chat-message.is-mine .chat-msg-file-card-footer {
    background: rgba(255, 255, 255, 0.98);
}

.chat-msg-file-card-footer-icon {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.55rem;
    background: rgba(239, 68, 68, 0.12);
    color: rgb(220, 38, 38);
    flex-shrink: 0;
}

.chat-msg-file-card-footer-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 0.72rem;
    line-height: 1.25;
}

.chat-msg-file-card-footer-text strong {
    font-size: 0.78rem;
}

.chat-msg-file-card-footer-text span {
    color: rgb(100, 116, 139);
}

.chat-msg-file-card-icon-wrap {
    position: relative;
    display: inline-flex;
    width: 3rem;
    height: 3rem;
    align-items: center;
    justify-content: center;
    margin: 0.55rem 0 0.55rem 0.55rem;
    border-radius: 0.7rem;
    flex-shrink: 0;
    background: rgba(99, 102, 241, 0.12);
    color: rgb(79, 70, 229);
}

.chat-msg-file-card-icon-wrap--pdf {
    background: rgba(239, 68, 68, 0.12);
    color: rgb(220, 38, 38);
}

.chat-msg-file-card-icon-wrap--zip {
    background: rgba(245, 158, 11, 0.14);
    color: rgb(217, 119, 6);
}

.chat-msg-file-card-icon-wrap--docx {
    background: rgba(37, 99, 235, 0.12);
    color: rgb(37, 99, 235);
}

.chat-msg-file-card-icon-wrap--csv {
    background: rgba(16, 185, 129, 0.14);
    color: rgb(5, 150, 105);
}

.chat-file-card-svg {
    width: 1.45rem;
    height: 1.45rem;
}

.chat-msg-file-card-ext {
    position: absolute;
    right: -0.15rem;
    bottom: -0.15rem;
    border-radius: 0.35rem;
    background: rgb(30, 41, 59);
    color: #fff;
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 0.1rem 0.28rem;
    line-height: 1.2;
}

.chat-msg-file-card-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0.55rem 0.65rem 0.55rem 0;
}

.chat-msg-file-card-label {
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
}

.chat-msg-file-card-hint {
    margin-top: 0.15rem;
    font-size: 0.68rem;
    color: rgb(100, 116, 139);
}

.chat-message.is-mine .chat-msg-file-card-hint {
    color: rgb(71, 85, 105);
}

.chat-message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.chat-message:hover .chat-message-actions,
.chat-message:focus-within .chat-message-actions {
    opacity: 1;
}

.chat-msg-action {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgb(79, 70, 229);
}

.chat-reply-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    border-top: 1px solid rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.08);
}

.chat-edit-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    border-top: 1px solid rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.1);
}

.chat-composer.is-editing .chat-icon-btn {
    opacity: 0.45;
    pointer-events: none;
}

.chat-composer.is-editing .chat-input {
    border-color: rgba(245, 158, 11, 0.45);
}

.chat-composer.is-editing .chat-send-btn {
    background: linear-gradient(135deg, rgb(217, 119, 6), rgb(245, 158, 11));
}

.chat-composer-error {
    flex-shrink: 0;
    margin: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(220, 38, 38);
    background: rgba(254, 226, 226, 0.85);
    border-top: 1px solid rgba(248, 113, 113, 0.35);
}

.dark .chat-composer-error {
    color: rgb(252, 165, 165);
    background: rgba(127, 29, 29, 0.35);
    border-top-color: rgba(248, 113, 113, 0.25);
}

.chat-composer {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.92);
}

.dark .chat-composer {
    background: rgba(15, 23, 42, 0.85);
}

.chat-input {
    flex: 1;
    min-height: 2.85rem;
    max-height: 120px;
    resize: none;
    border-radius: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.38);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 0.72rem 0.95rem;
    font-size: 0.925rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.75);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.chat-input:focus {
    outline: none;
    border-color: rgb(99, 102, 241);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}

.dark .chat-input {
    background: rgb(30, 41, 59);
    border-color: rgba(100, 116, 139, 0.45);
    color: rgb(241, 245, 249);
}

.chat-icon-btn,
.chat-send-btn {
    display: inline-flex;
    height: 2.5rem;
    width: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.chat-icon-btn {
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: rgb(100, 116, 139);
}

.chat-send-btn {
    background: linear-gradient(135deg, rgb(79, 70, 229), rgb(37, 99, 235));
    color: #fff;
}

.chat-attach-preview {
    flex-shrink: 0;
    padding: 0.55rem 0.75rem 0;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(248, 250, 252, 0.9);
}

.dark .chat-attach-preview {
    background: rgba(15, 23, 42, 0.55);
}

.chat-attach-preview-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: #fff;
    padding: 0.5rem 0.65rem;
}

.dark .chat-attach-preview-card {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(100, 116, 139, 0.35);
}

.chat-attach-preview-media img {
    max-height: 4.5rem;
    max-width: 5.5rem;
    border-radius: 0.55rem;
    object-fit: cover;
}

.chat-attach-preview-file {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.chat-attach-preview-file .chat-msg-file-card-icon-wrap {
    width: 2.6rem;
    height: 2.6rem;
    margin: 0;
}

.chat-attach-clear {
    margin-left: auto;
    border-radius: 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 0.35rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgb(100, 116, 139);
}

.nav-badge {
    display: inline-flex;
    min-width: 1.25rem;
    height: 1.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgb(239, 68, 68);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 0.35rem;
    line-height: 1;
}

.nav-badge--icon {
    position: absolute;
    top: -0.2rem;
    right: -0.2rem;
    min-width: 1rem;
    height: 1rem;
    font-size: 0.58rem;
    border: 2px solid #fff;
}

.dark .nav-badge--icon {
    border-color: rgb(30, 41, 59);
}

@media (max-width: 767px) {
    body.chat-mobile-fullscreen {
        overflow: hidden;
    }

    body.chat-mobile-fullscreen #appSidebar,
    body.chat-mobile-fullscreen #appTopHeader,
    body.chat-mobile-fullscreen #appMobileBottomNav,
    body.chat-mobile-fullscreen #mobileSidebarBackdrop {
        display: none !important;
    }

    body.chat-mobile-fullscreen #appShell {
        min-height: 100dvh;
        height: 100dvh;
    }

    body.chat-mobile-fullscreen #appContentColumn {
        min-height: 100dvh;
        height: 100dvh;
    }

    body.chat-mobile-fullscreen #appMainContent.chat-main-content {
        padding: 0 !important;
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: 100dvh;
        overflow: hidden;
    }

    body.chat-mobile-fullscreen .project-chat-shell {
        grid-template-columns: 1fr;
        flex: 1;
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        min-height: 100dvh;
        padding-top: 0;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }

    body.chat-mobile-fullscreen .project-chat-shell:hover {
        transform: none;
        box-shadow: none;
    }

    .project-chat-shell {
        grid-template-columns: 1fr;
        height: calc(100dvh - 9.5rem);
    }

    .chat-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 320px);
        z-index: 70;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        box-shadow: 12px 0 30px rgba(15, 23, 42, 0.2);
    }

    .chat-sidebar.is-open {
        transform: translateX(0);
    }

    .chat-main-header {
        padding-top: max(0.65rem, env(safe-area-inset-top));
    }

    .chat-message {
        max-width: 92%;
    }

    .chat-message-actions {
        opacity: 1;
    }
}

/* Project milestones */
.milestone-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .milestone-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .milestone-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.milestone-grid--dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

@media (max-width: 767px) {
    .milestone-grid--dashboard {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.75rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.35rem;
        margin-inline: -0.25rem;
        padding-inline: 0.25rem;
        scrollbar-width: none;
    }

    .milestone-grid--dashboard::-webkit-scrollbar {
        display: none;
    }

    .milestone-grid--dashboard .milestone-card {
        flex: 0 0 min(78vw, 16.5rem);
        scroll-snap-align: start;
    }
}

.milestone-grid--list {
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
}

@media (min-width: 640px) {
    .milestone-grid--list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .milestone-grid--dashboard {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }

    .milestone-grid--list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.milestone-card-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.milestone-grid--dashboard .milestone-card {
    padding: 0.75rem;
}

.milestone-grid--dashboard .milestone-card-title {
    font-size: 0.82rem;
}

.milestone-grid--dashboard .milestone-card-text,
.milestone-grid--dashboard .milestone-card-meta,
.milestone-grid--dashboard .milestone-progress-label {
    font-size: 0.68rem;
}

.milestone-card-title-link {
    color: inherit;
    text-decoration: none;
}

.milestone-card-title-link:hover {
    color: rgb(79, 70, 229);
    text-decoration: underline;
}

.dark .milestone-card-title-link:hover {
    color: rgb(165, 180, 252);
}

.notification-milestone-link {
    color: rgb(79, 70, 229);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.notification-milestone-link:hover {
    color: rgb(67, 56, 202);
}

.dark .notification-milestone-link {
    color: rgb(165, 180, 252);
}

.dark .notification-milestone-link:hover {
    color: rgb(199, 210, 254);
}

.milestone-card {
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.72);
}

.dark .milestone-card {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(100, 116, 139, 0.35);
}

.milestone-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.milestone-card-title {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.3;
    color: rgb(15, 23, 42);
}

.dark .milestone-card-title {
    color: rgb(248, 250, 252);
}

.milestone-card-text {
    font-size: 0.82rem;
    line-height: 1.5;
    color: rgb(100, 116, 139);
    margin-bottom: 0.75rem;
}

.milestone-progress-wrap {
    margin-bottom: 0.75rem;
}

.milestone-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: rgb(100, 116, 139);
    margin-bottom: 0.25rem;
}

.milestone-progress-bar {
    height: 0.45rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    overflow: hidden;
}

.milestone-progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgb(79, 70, 229), rgb(59, 130, 246));
}

.milestone-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    font-size: 0.72rem;
}

.milestone-card-meta--single {
    grid-template-columns: minmax(0, 1fr);
}

.milestone-card-meta dt {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgb(100, 116, 139);
}

.milestone-card-meta dd {
    margin-top: 0.15rem;
    font-weight: 600;
    color: rgb(51, 65, 85);
}

.dark .milestone-card-meta dd {
    color: rgb(226, 232, 240);
}

.milestone-card-meta-sub {
    margin-top: 0.1rem !important;
    font-size: 0.68rem !important;
    font-weight: 500 !important;
    color: rgb(100, 116, 139) !important;
}

.milestone-card-reason {
    margin-top: 0.65rem;
    font-size: 0.75rem;
    color: rgb(180, 83, 9);
}

.milestone-history summary {
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgb(79, 70, 229);
}

.milestone-history-list {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.milestone-history-list li {
    font-size: 0.72rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.55rem;
    background: rgba(148, 163, 184, 0.12);
}

.milestone-history-change {
    display: block;
    font-weight: 700;
    color: rgb(51, 65, 85);
}

.milestone-history-meta {
    display: block;
    color: rgb(100, 116, 139);
    margin-top: 0.1rem;
}

.milestone-history-reason {
    display: block;
    margin-top: 0.15rem;
    color: rgb(180, 83, 9);
}

.milestone-draft-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.milestone-draft-row {
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 0.9rem;
    padding: 0.85rem;
    background: rgba(248, 250, 252, 0.65);
}

.dark .milestone-draft-row {
    background: rgba(15, 23, 42, 0.35);
}

.milestone-draft-row-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.65rem;
}

@media (min-width: 640px) {
    .milestone-draft-row-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.milestone-draft-remove {
    margin-top: 0.5rem;
    border: 0;
    background: transparent;
    color: rgb(220, 38, 38);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.milestone-existing-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.milestone-existing-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.65rem;
    border: 1px solid rgb(226, 232, 240);
    background: rgb(248, 250, 252);
}

.dark .milestone-existing-item {
    border-color: rgb(51, 65, 85);
    background: rgb(30, 41, 59);
}

.milestone-existing-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: rgb(15, 23, 42);
}

.dark .milestone-existing-title {
    color: rgb(248, 250, 252);
}

.milestone-existing-meta {
    width: 100%;
    font-size: 0.75rem;
    color: rgb(100, 116, 139);
}

.dark .milestone-existing-meta {
    color: rgb(148, 163, 184);
}

.milestone-card--deadline-urgent {
    border: 2px solid color-mix(
        in srgb,
        rgb(249, 115, 22) calc(100% - var(--deadline-urgency, 0) * 1%),
        rgb(220, 38, 38)
    );
    box-shadow: 0 0 0 1px color-mix(
        in srgb,
        rgb(249, 115, 22) calc(100% - var(--deadline-urgency, 0) * 1%),
        rgb(220, 38, 38)
    );
    transition: border-color 0.75s ease, box-shadow 0.75s ease;
}

.dark .milestone-card--deadline-urgent {
    border-color: color-mix(
        in srgb,
        rgb(251, 146, 60) calc(100% - var(--deadline-urgency, 0) * 1%),
        rgb(248, 113, 113)
    );
    box-shadow: 0 0 0 1px color-mix(
        in srgb,
        rgb(251, 146, 60) calc(100% - var(--deadline-urgency, 0) * 1%),
        rgb(248, 113, 113)
    );
}

.milestone-deadline-urgent-text {
    font-weight: 700;
    color: color-mix(
        in srgb,
        rgb(234, 88, 12) calc(100% - var(--deadline-urgency, 0) * 1%),
        rgb(220, 38, 38)
    ) !important;
}

.dark .milestone-deadline-urgent-text {
    color: color-mix(
        in srgb,
        rgb(251, 146, 60) calc(100% - var(--deadline-urgency, 0) * 1%),
        rgb(248, 113, 113)
    ) !important;
}
