/* custom CSS styles for Arise with AI Unified Dashboard */

/* Dynamic Design System Variables */
:root {
    --color-background: #fbf9f5;
    --color-on-background: #1b1c1a;
    --color-surface: #fbf9f5;
    --color-on-surface: #1b1c1a;
    --color-primary: #000000;
    --color-on-primary: #ffffff;
    --color-surface-container-lowest: #ffffff;
    --color-surface-container-low: #f5f3ef;
    --color-surface-container: #efeeea;
    --color-surface-container-high: #eae8e4;
    --color-surface-container-highest: #e4e2de;
    --color-on-surface-variant: #444748;
    --color-outline: #747878;
    --color-outline-variant: #c4c7c7;
    --color-secondary-container: #fea619;
    --color-on-secondary-container: #684000;
    --color-secondary-fixed: #ffddb8;
    --color-on-secondary-fixed: #2a1700;
    --color-tertiary-fixed: #c7eae1;
    --color-on-tertiary-fixed-variant: #2d4c46;
    --color-border-opacity: rgba(229, 225, 218, 1);
}

.dark {
    --color-background: #121210;
    --color-on-background: #f2f0ed;
    --color-surface: #181816;
    --color-on-surface: #f2f0ed;
    --color-primary: #ffffff;
    --color-on-primary: #121210;
    --color-surface-container-lowest: #1d1d1b;
    --color-surface-container-low: #262623;
    --color-surface-container: #2f2f2c;
    --color-surface-container-high: #383834;
    --color-surface-container-highest: #43433e;
    --color-on-surface-variant: #babbbc;
    --color-outline: #8e9192;
    --color-outline-variant: #525556;
    --color-secondary-container: #e08c07;
    --color-on-secondary-container: #ffeed6;
    --color-secondary-fixed: #5a3f12;
    --color-on-secondary-fixed: #ffe5c4;
    --color-tertiary-fixed: #1e3f36;
    --color-on-tertiary-fixed-variant: #c7eae1;
    --color-border-opacity: rgba(67, 67, 62, 0.5);
}

/* Custom Typography & Scrollbar Settings */
html,
body {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html {
    background-color: var(--color-background);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-background);
    color: var(--color-on-background);
    touch-action: manipulation;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#main-layout {
    min-height: 100dvh;
}

@media (max-width: 767px) {
    .app-shell-header {
        height: calc(72px + env(safe-area-inset-top, 0px) + 8px) !important;
        padding-top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
        padding-bottom: 8px !important;
        align-items: center;
    }

    .app-shell-content {
        padding-top: calc(72px + env(safe-area-inset-top, 0px) + 8px) !important;
    }
}

body.upload-lock-active {
    overflow: hidden;
}

.upload-status-overlay {
    position: fixed;
    inset: 0;
    z-index: 420;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

.upload-status-overlay.hidden {
    display: none;
}

.upload-status-panel {
    width: min(92vw, 460px);
    border-radius: 18px;
    padding: 16px;
    background: rgba(18, 18, 16, 0.94);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

.upload-status-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.upload-status-kicker {
    font-size: 10px;
    line-height: 1.2;
    letter-spacing: 0;
    font-weight: 700;
    color: var(--color-secondary-container, #fea619);
    text-transform: uppercase;
}

.upload-status-title {
    font-size: 14px;
    line-height: 1.35;
    font-weight: 800;
}

.upload-status-detail {
    font-size: 11px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.72);
    word-break: break-word;
}

.upload-status-bar-shell {
    position: relative;
    height: 28px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.upload-status-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #fea619, #ffc65c);
    transition: width 0.18s ease;
}

.upload-status-overlay.is-complete .upload-status-bar {
    background: linear-gradient(90deg, #2e7d32, #66bb6a);
}

.upload-status-overlay.is-error .upload-status-bar {
    background: linear-gradient(90deg, #ba1a1a, #ff8a80);
}

.upload-status-overlay.is-complete .upload-status-kicker {
    color: #8ef0a0;
}

.upload-status-overlay.is-error .upload-status-kicker {
    color: #ffb4ab;
}

.upload-status-percent {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

/* Hide scrollbar for a clean minimal aesthetic */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-outline-variant);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-outline);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--color-surface-container-lowest);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border-opacity);
}

/* Ambient glow shadows */
.shadow-amber-glow {
    box-shadow: 0px 4px 20px rgba(245, 158, 11, 0.15);
}

.shadow-premium-card {
    box-shadow: 0px 4px 20px rgba(26, 26, 26, 0.03);
}

.dark .shadow-premium-card {
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);
}

/* Page Transition Animations */
.view-pane, .view-content {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Active navigation states styling */
.nav-item.active-nav {
    background-color: var(--color-secondary-fixed) !important;
    color: var(--color-on-secondary-fixed) !important;
    font-weight: 700 !important;
    transform: scale(0.98);
}

.nav-item.active-nav span.material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

/* Mobile bottom nav active button state */
nav button.nav-item.active-nav {
    background-color: var(--color-secondary-fixed) !important;
    color: var(--color-on-secondary-fixed) !important;
    border-radius: 9999px;
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
    transform: scale(0.93);
    transition: all 0.25s ease-out;
}

/* Custom background pattern for login */
.hero-pattern {
    background-image: radial-gradient(circle at center, rgba(200, 198, 197, 0.15) 0%, transparent 75%);
    background-size: 100% 100%;
}

.dark .hero-pattern {
    background-image: radial-gradient(circle at center, rgba(255, 255, 255, 0.03) 0%, transparent 75%);
}

/* Micro-animations */
.btn-animate {
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
}

.btn-animate:hover {
    transform: translateY(-1px);
}

.btn-animate:active {
    transform: translateY(1px);
}

/* Login — keep signed in */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.login-keep-signed-in {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.125rem;
    border-radius: 1.25rem;
    border: 1px solid var(--color-outline-variant, #c4c7c7);
    background: var(--color-surface-container-lowest, #fff);
    box-shadow: 0 4px 20px rgba(26, 26, 26, 0.04);
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.login-keep-signed-in:hover {
    border-color: var(--color-secondary, #855300);
    background: var(--color-surface-container-low, #f5f3ef);
}

.login-keep-signed-in-box {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    border-radius: 0.375rem;
    border: 2px solid var(--color-outline-variant, #c4c7c7);
    background: var(--color-surface, #fbf9f5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.login-keep-signed-in-box::after {
    content: "";
    width: 0.35rem;
    height: 0.6rem;
    border: solid var(--color-on-secondary-container, #684000);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    margin-top: -2px;
    transition: transform 0.15s ease;
}

.login-keep-signed-in-input:checked + .login-keep-signed-in-box {
    border-color: var(--color-secondary-container, #fea619);
    background: var(--color-secondary-container, #fea619);
}

.login-keep-signed-in-input:checked + .login-keep-signed-in-box::after {
    transform: rotate(45deg) scale(1);
}

.login-keep-signed-in-input:focus-visible + .login-keep-signed-in-box {
    outline: 2px solid var(--color-secondary, #855300);
    outline-offset: 2px;
}

.login-keep-signed-in-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-align: left;
}

.login-keep-signed-in-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-primary, #000);
    line-height: 1.3;
}

.login-keep-signed-in-hint {
    font-size: 0.6875rem;
    color: var(--color-on-surface-variant, #444748);
    line-height: 1.4;
}

/* Group access gate (non-members / pending) */
.group-access-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
    padding: 2.5rem 1.5rem;
    border-radius: 1.5rem;
    border: 1px dashed var(--color-outline-variant, #c4c7c7);
    background: var(--color-surface-container-low, #f5f3ef);
}

.group-access-gate.hidden {
    display: none;
}

.group-access-gate .gate-icon {
    font-size: 2.5rem;
    color: var(--color-outline, #747878);
}

.group-access-gate .gate-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-primary, #000);
}

.group-access-gate .gate-sub {
    font-size: 0.75rem;
    color: var(--color-on-surface-variant, #444748);
    line-height: 1.55;
    max-width: 22rem;
}

.group-access-gate .gate-join-btn {
    margin-top: 0.25rem;
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    background: var(--color-primary, #000);
    color: var(--color-on-primary, #fff);
    font-size: 0.8125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: opacity 0.2s ease;
}

.group-access-gate .gate-join-btn:hover {
    opacity: 0.92;
}

.group-access-gate .gate-join-btn.hidden {
    display: none;
}

/* Custom checkbox animation */
.habit-checkbox {
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.habit-checkbox:active {
    transform: scale(0.9);
}

/* Chat bubble styling tweaks */
.chat-bubble-received {
    border-top-left-radius: 0.25rem;
}

.chat-bubble-sent {
    border-top-right-radius: 0.25rem;
}

/* Custom indicator dot pulsing */
.pulse-indicator {
    box-shadow: 0 0 0 0 rgba(254, 166, 25, 0.4);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(254, 166, 25, 0.5);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(254, 166, 25, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(254, 166, 25, 0);
    }
}

/* Habit Monthly Calendar Pulse and Glowing animations */
@keyframes slow-glow {
    0%, 100% {
        transform: scale(0.92);
        box-shadow: 0 0 6px rgba(254, 166, 25, 0.4);
        opacity: 0.85;
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 16px rgba(254, 166, 25, 0.8);
        opacity: 1;
    }
}

.dot-glow {
    animation: slow-glow 4s ease-in-out infinite;
}

/* Golden Spotlight Highlight Flash Animation */
@keyframes target-flash {
    0% {
        box-shadow: 0 0 0 0px rgba(254, 166, 25, 0);
        border-color: rgba(254, 166, 25, 0);
        background-color: transparent;
    }
    15% {
        box-shadow: 0 0 0 6px rgba(254, 166, 25, 0.5);
        border-color: rgba(254, 166, 25, 1);
        background-color: rgba(254, 166, 25, 0.08);
    }
    100% {
        box-shadow: 0 0 0 12px rgba(254, 166, 25, 0);
        border-color: transparent;
        background-color: transparent;
    }
}

.highlight-flash {
    animation: target-flash 2.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    border: 2px solid transparent !important;
    border-radius: 1rem;
    z-index: 10;
}

/* Day selector chips active state */
.day-chip {
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.day-chip.active-chip {
    background-color: var(--color-secondary-container, #fea619) !important;
    color: var(--color-on-secondary-container, #684000) !important;
    border-color: var(--color-secondary-container, #fea619) !important;
    font-weight: 700;
}

/* Curated preset avatars active state */
.preset-avatar.active-preset {
    border-color: var(--color-secondary-container, #fea619) !important;
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(254, 166, 25, 0.4);
}

/* Enhanced Dark Mode Compatibilities */
html.dark {
    color-scheme: dark;
}
html.dark body {
    background-color: var(--color-background) !important;
    color: var(--color-on-background) !important;
}

/* Modal Content Dark Mode Support */
#modal-habit .bg-surface-container-lowest,
#modal-saved-activities .bg-surface-container-lowest,
#modal-chat-media .bg-surface-container-lowest {
    background-color: var(--color-surface-container-lowest) !important;
    color: var(--color-on-surface) !important;
}

/* Modal form inputs dark mode correction */
html.dark #modal-habit input,
html.dark #modal-habit textarea,
html.dark #modal-chat-media button {
    background-color: var(--color-surface-container-low) !important;
    color: var(--color-on-surface) !important;
    border-color: var(--color-surface-container-high) !important;
}

/* Activity history item styles */
.activity-card {
    transition: transform 0.2s ease, background-color 0.2s ease;
}
.activity-card:hover {
    transform: translateY(-2px);
    background-color: var(--color-surface-container-low) !important;
}

/* Swipeable Calendar (snap-to-month) */
.swipe-calendar {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    touch-action: pan-y;
}
.calendar-day-cell {
    touch-action: manipulation;
}
.swipe-month-page {
    flex: 0 0 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    min-width: 100%;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
}

/* Group selector cards */
.group-card-chip {
    min-width: 220px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.group-card-chip.active-group {
    border-color: var(--color-secondary-container, #fea619) !important;
    box-shadow: 0px 6px 18px rgba(254, 166, 25, 0.18);
    transform: translateY(-2px);
}
.group-card-chip:hover:not(.active-group) {
    transform: translateY(-1px);
}

/* Joined task card hover */
.joined-task-card:hover {
    transform: translateY(-1px);
    box-shadow: 0px 6px 18px rgba(26, 26, 26, 0.06);
}

.resource-block {
    border: 1px solid var(--color-surface-container-high, #e5e5e5);
    background: color-mix(in srgb, var(--color-surface-container, #efeeea) 42%, transparent);
    border-radius: 18px;
    padding: 14px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .resource-block:hover {
        box-shadow: 0px 6px 18px rgba(26, 26, 26, 0.06);
        border-color: color-mix(in srgb, var(--color-secondary-container, #fea619) 55%, var(--color-surface-container-high, #e5e5e5));
    }
}

.resource-icon {
    width: 34px;
    height: 34px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-on-secondary-container, #684000);
    background: var(--color-secondary-container, #fea619);
}

.resource-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-primary, #1a1a1a);
    background: var(--color-surface-container, #efeeea);
}

.resource-item-action {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-container-lowest, #fff);
    border: 1px solid var(--color-surface-container-high, #e5e5e5);
    flex-shrink: 0;
}

.resource-class-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    background: var(--color-surface-container-lowest, #fff);
    border: 1px solid var(--color-surface-container-high, #e5e5e5);
}

.resource-subsection {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.tool-link-row,
.task-detail-file-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 14px;
    background: var(--color-surface-container-lowest, #fff);
    border: 1px solid var(--color-surface-container-high, #e5e5e5);
    -webkit-tap-highlight-color: transparent;
}

.qr-invite-frame {
    width: min(100%, 304px);
    padding: 14px;
    border-radius: 28px;
    background: var(--color-surface-container-lowest, #fff);
    border: 1px solid var(--color-surface-container-high, #e5e5e5);
    box-shadow: 0 8px 24px rgba(26, 26, 26, 0.08);
}

.qr-invite-frame canvas,
.qr-invite-frame img {
    display: block;
    width: 100%;
    height: auto;
}

.group-task-card {
    transition: box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
    transform: none;
    will-change: box-shadow, border-color;
}

.group-task-card:hover {
    border-color: color-mix(in srgb, #bc6c25 48%, var(--color-surface-container-high, #e5e5e5));
    box-shadow: 0px 6px 18px rgba(26, 26, 26, 0.06);
    transform: none;
}

.group-task-number-tag {
    background: #bc6c25;
    color: #ffffff;
}

#btn-host-add-task,
.btn-edit-task,
.btn-delete-task,
.btn-toggle-join-task {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 767px) {
    #btn-host-add-task {
        min-height: 44px;
    }

    .btn-edit-task,
    .btn-delete-task {
        width: 44px !important;
        height: 44px !important;
    }

    .btn-toggle-join-task {
        min-height: 40px;
    }
}

.task-detail-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--color-surface-container, #efeeea);
    color: var(--color-on-surface-variant, #444748);
    font-size: 10px;
    font-weight: 700;
}

.task-detail-chip.is-joined {
    background: color-mix(in srgb, var(--color-secondary-container, #fea619) 24%, transparent);
    color: var(--color-secondary, #9b6100);
}

.task-detail-chip.is-out {
    background: rgba(139, 46, 46, 0.1);
    color: #8b2e2e;
}

.task-detail-member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--color-surface-container-high, #e5e5e5);
    background: var(--color-surface-container-lowest, #fff);
    border-radius: 16px;
    padding: 10px;
}

.task-detail-member-row.is-muted {
    opacity: 0.62;
}

.task-detail-status {
    flex-shrink: 0;
    border-radius: 999px;
    padding: 4px 8px;
    background: var(--color-surface-container, #efeeea);
    color: var(--color-on-surface-variant, #444748);
    font-size: 10px;
    font-weight: 800;
}

.task-detail-status.done {
    background: var(--color-secondary-container, #fea619);
    color: var(--color-on-secondary-container, #684000);
}

.task-detail-status.out {
    background: rgba(139, 46, 46, 0.1);
    color: #8b2e2e;
}

.task-detail-status.joined {
    background: color-mix(in srgb, var(--color-tertiary-fixed, #c7eae1) 70%, white);
    color: var(--color-on-tertiary-fixed-variant, #2d4c46);
}

/* Avatar stack offset for member avatars */
.avatar-stack > * {
    border: 2px solid var(--color-surface-container-lowest);
}

/* Slide-up bottom-sheet animation for quick group switcher */
@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.animate-slide-up {
    animation: slideUp 0.18s ease-out;
}

/* Long-press visual feedback */
.tab-pressing {
    transform: scale(0.92);
    transition: transform 0.12s ease-out;
}

/* Hours dropdown / select styling - native select with custom chrome */
.hours-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    padding-right: 26px;
}
.hours-select.hours-set {
    background-color: var(--color-secondary-container, #FEA619);
    color: var(--color-on-secondary-container, #2D1C00);
    border-color: var(--color-secondary-container, #FEA619);
}

/* Active state for member-view toggle pills */
.member-view-toggle {
    color: var(--color-on-surface-variant, #4a4a4a);
    background: transparent;
}
.member-view-toggle.is-active {
    background: var(--color-secondary-container, #FEA619);
    color: var(--color-on-secondary-container, #2D1C00);
    font-weight: 700;
}

/* Full-width snap carousel for groups */
.group-carousel-frame {
    overflow: hidden;
    width: 100%;
    overscroll-behavior-x: contain;
    contain: layout style;
}
#group-selector-container {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-font-smoothing: antialiased;
}
.group-carousel-track {
    width: 100%;
    -webkit-overflow-scrolling: touch;
    overflow-x: visible !important;
    scroll-snap-type: none !important;
    scroll-behavior: auto !important;
    touch-action: pan-y;
    overscroll-behavior-x: auto;
    cursor: grab;
    transform: translate3d(0, 0, 0);
    transition: none;
}
.group-carousel-track.is-animating {
    transition: transform 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.group-carousel-track.is-dragging {
    cursor: grabbing;
    transition: none !important;
}
.group-carousel-track.is-dragging .group-carousel-card {
    pointer-events: none;
    transition: none;
}
.group-carousel-card {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
    scroll-snap-align: center;
    scroll-snap-stop: normal;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--color-surface-container-high, #e5e5e5);
    background: var(--color-surface-container-lowest, #fff);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 18px rgba(26, 26, 26, 0.06);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}
.group-carousel-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 2px rgba(254, 166, 25, 0.55);
    opacity: 0;
    pointer-events: none;
    z-index: 3;
    transition: opacity 0.12s ease;
}
.group-carousel-card.is-active::after {
    opacity: 1;
}
@media (hover: hover) and (pointer: fine) {
    .group-carousel-card:hover {
        box-shadow: 0 6px 24px rgba(26, 26, 26, 0.10);
    }
}
.group-carousel-card .banner {
    width: 100%;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    background-color: var(--color-surface-container-high, #e5e5e5);
    position: relative;
}
.group-carousel-card .banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.55) 100%);
    pointer-events: none;
}
.group-carousel-card .banner-overlay {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 12px;
    z-index: 2;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.group-carousel-card .banner-overlay h4 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}
.group-carousel-card .banner-overlay p {
    font-size: 11px;
    opacity: 0.95;
    margin: 4px 0 0 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.group-carousel-card .body {
    padding: 12px 16px 14px 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.group-carousel-card .group-card-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    min-width: 0;
}
.group-carousel-card .group-card-host,
.group-carousel-card .group-card-members,
.group-carousel-card .group-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.group-carousel-card .group-card-host-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--color-secondary-container, #FEA619);
    color: var(--color-on-secondary-container, #2D1C00);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--color-surface-container-lowest, #fff);
    box-shadow: 0 2px 8px rgba(26,26,26,0.08);
}
.group-carousel-card .group-card-host-avatar img,
.group-carousel-card .group-card-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.group-carousel-card .group-card-host-label {
    display: block;
    font-size: 10px;
    line-height: 1;
    color: var(--color-outline, #747878);
    font-weight: 700;
}
.group-carousel-card .group-card-host-name {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.15;
    color: var(--color-primary, #000);
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.group-carousel-card .group-card-members {
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 6px;
}
.group-carousel-card .group-card-member-stack {
    display: inline-flex;
    align-items: center;
    padding-left: 2px;
}
.group-carousel-card .group-card-member-avatar,
.group-carousel-card .group-card-member-more {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    overflow: hidden;
    margin-left: -4px;
    background: var(--color-surface-container, #efeeea);
    color: var(--color-on-surface-variant, #444748);
    border: 2px solid var(--color-surface-container-lowest, #fff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
}
.group-carousel-card .group-card-member-count {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-on-surface-variant, #444748);
}
.group-carousel-card .group-card-meta {
    color: var(--color-on-surface-variant, #444748);
    font-size: 11px;
    flex-wrap: wrap;
}
.group-carousel-card .active-pill {
    display: none;
    align-self: flex-end;
    background: var(--color-secondary-container, #FEA619);
    color: var(--color-on-secondary-container, #2D1C00);
    font-weight: 700;
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    align-items: center;
    gap: 4px;
}
.group-carousel-card.is-active .active-pill {
    display: inline-flex;
}
.group-carousel-card .banner-edit-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.group-carousel-card .banner-edit-btn:hover {
    background: rgba(0,0,0,0.75);
}
.group-carousel-card .banner-uploading-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.42);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    backdrop-filter: blur(2px);
}
.banner-spinner,
.group-carousel-card .banner-spinner {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 3px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    animation: bannerSpin 0.8s linear infinite;
}
@keyframes bannerSpin {
    to { transform: rotate(360deg); }
}
.group-carousel-card .host-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    background: linear-gradient(135deg, #FFC76C, #FEA619);
    color: #2D1C00;
    font-weight: 700;
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(254, 166, 25, 0.45);
    letter-spacing: 0.04em;
}
.group-carousel-card .host-tag-badge {
    background: #C84A4A;
    color: #fff;
    font-weight: 800;
    font-size: 9px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 999px;
    margin-left: 4px;
    letter-spacing: 0;
}
.group-carousel-card.tab-pressing {
    transform: none;
    transition: transform 0.18s ease;
}
.group-carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-surface-container-high, #ccc);
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    padding: 0;
}
.group-carousel-dot.is-active {
    width: 22px;
    border-radius: 4px;
    background: var(--color-secondary-container, #FEA619);
}

/* Day-of-week pill in host-task modal */
.host-task-day.active-day,
.host-task-once.active-day {
    background-color: var(--color-secondary-container, #FEA619);
    border-color: var(--color-secondary-container, #FEA619);
    color: var(--color-on-secondary-container, #2D1C00);
    font-weight: 700;
}

/* Avatar greyed out for "not completed yet" */
.task-assignee-pending {
    filter: grayscale(1);
    opacity: 0.55;
}

/* Post aspect-ratio pill buttons */
.post-aspect-btn {
    color: var(--color-on-surface-variant, #6B6B6B);
}
.post-aspect-btn.active-aspect {
    background-color: var(--color-secondary-container, #FEA619);
    color: var(--color-on-secondary-container, #2D1C00);
    font-weight: 700;
}

/* Post image preview thumbnails */
.post-image-thumb {
    position: relative;
    flex: 0 0 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--color-surface-container-high, #E5E5E5);
}
.post-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.post-image-thumb .btn-remove-thumb {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    border: none;
}

/* Post card image gallery (Instagram style) */
.post-images-gallery {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.post-images-gallery .post-image-slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
.post-images-gallery .post-image-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Member card carousel: each card spans full width on mobile, 60% on >=640px */
.member-card {
    flex: 0 0 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    background: var(--color-surface-container-lowest, #fff);
    border: 1px solid var(--color-surface-container-high, #e5e5e5);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(26, 26, 26, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: min(620px, calc(100dvh - 180px));
}
@media (min-width: 768px) {
    .member-card {
        flex: 0 0 calc(100% - 2rem);
    }
}
#modal-group-members > div {
    max-height: calc(100dvh - 24px);
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
#group-detail-summary {
    flex-shrink: 0;
}
#member-cards-track {
    align-items: stretch;
    touch-action: pan-x pan-y;
    overscroll-behavior: contain;
}
.member-status-panel {
    border: 1px solid var(--color-surface-container-high, #e5e5e5);
    background: color-mix(in srgb, var(--color-surface-container, #efeeea) 38%, transparent);
    border-radius: 18px;
    padding: 12px;
}
.member-status-tile {
    min-width: 0;
    border-radius: 14px;
    background: var(--color-surface-container-lowest, #fff);
    border: 1px solid var(--color-surface-container-high, #e5e5e5);
    padding: 10px;
}
.member-card-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-surface-container-high, #ccc);
    transition: all 0.2s ease;
}

[id^="modal-"] {
    overscroll-behavior: contain;
}

[id^="modal-"] > div {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

html:has([id^="modal-"].fixed:not(.hidden)) body {
    overflow: hidden;
}
.member-card-dot.active {
    width: 22px;
    border-radius: 4px;
    background: var(--color-secondary-container, #FEA619);
}

/* Comment section under each post */
.post-comments-section {
    border-top: 1px solid var(--color-surface-container-high, #e5e5e5);
    padding-top: 12px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.post-comment-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.post-comment-textarea {
    flex: 1 1 auto;
    resize: none;
    min-height: 38px;
    max-height: 120px;
    padding: 8px 12px;
    border-radius: 16px;
    border: 1px solid var(--color-outline-variant, #ccc);
    font-size: 13px;
    background: var(--color-surface, #fff);
    outline: none;
}
.post-comment-textarea:focus {
    border-color: var(--color-primary, #1a1a1a);
}

.post-comments-more {
    align-self: flex-start;
}

.action-work-pager {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

.action-work-page {
    flex: 0 0 100%;
    min-width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.action-work-toggle.is-active {
    background: var(--color-secondary-container, #fea619);
    color: var(--color-on-secondary-container, #684000);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.18);
}

.action-work-toggle:not(.is-active) {
    color: var(--color-on-surface-variant);
}

#btn-open-growth-trends {
    cursor: pointer;
}

.growth-mini-chart {
    height: 82px;
    min-height: 82px;
}

.growth-axis {
    stroke: color-mix(in srgb, var(--color-outline, #837568) 62%, transparent);
    stroke-width: 1;
}

.growth-gridline {
    stroke: color-mix(in srgb, var(--color-outline-variant, #d6c4b0) 58%, transparent);
    stroke-width: 0.8;
    stroke-dasharray: 3 3;
}

.growth-line {
    fill: none;
    stroke: var(--color-secondary-container, #fea619);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.growth-area {
    fill: color-mix(in srgb, var(--color-secondary-container, #fea619) 22%, transparent);
}

.growth-point {
    fill: var(--color-secondary-container, #fea619);
    stroke: var(--color-surface-container-lowest, #fff);
    stroke-width: 1.5;
}

.growth-axis-label {
    fill: var(--color-outline, #837568);
    font-size: 8px;
    font-weight: 700;
}

html.chat-view-active,
body.chat-view-active {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body.chat-view-active #main-layout {
    overflow: hidden;
}

body.chat-view-active #app-shell-content {
    height: 100dvh;
    overflow: hidden;
}

body.chat-view-active #app-shell-content > div {
    min-height: 0;
    overflow: hidden;
}

body.chat-view-active #pane-chat {
    min-height: 0 !important;
    overflow: hidden;
}

#pane-chat > div {
    min-height: 0;
}

#chat-member-content {
    min-height: 0;
    overflow: hidden;
}

#chat-messages-container {
    min-height: 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

#chat-conversation-list {
    position: relative;
}

.chat-picker-wrap {
    position: relative;
    padding: 10px;
}

.chat-picker-button {
    width: 100%;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--color-surface-container-high);
    border-radius: 18px;
    padding: 9px 12px;
    background: var(--color-surface-container-lowest);
    color: var(--color-on-surface);
    text-align: left;
    box-shadow: 0 6px 18px rgba(26, 26, 26, 0.045);
}

.chat-picker-button:focus-visible,
.chat-picker-option:focus-visible {
    outline: 2px solid var(--color-secondary-container);
    outline-offset: 2px;
}

.chat-picker-avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--color-surface-container);
    border: 1px solid var(--color-surface-container-high);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.chat-picker-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-picker-copy,
.chat-picker-option-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1 1 auto;
}

.chat-picker-kicker {
    font-size: 10px;
    line-height: 1.1;
    font-weight: 800;
    color: var(--color-secondary-container);
}

.chat-picker-title,
.chat-picker-option-title {
    font-size: 13px;
    line-height: 1.25;
    font-weight: 800;
    color: var(--color-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-picker-subtitle,
.chat-picker-option-subtitle {
    font-size: 11px;
    line-height: 1.25;
    color: var(--color-on-surface-variant);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-picker-arrow {
    color: var(--color-on-surface-variant);
    flex: 0 0 auto;
}

.chat-unread-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    border: 2px solid var(--color-surface-container-lowest);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    flex: 0 0 auto;
}

.chat-options-wrap {
    position: relative;
    flex: 0 0 auto;
}

.chat-options-menu {
    position: absolute;
    z-index: 95;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    padding: 8px;
    border: 1px solid var(--color-surface-container-high);
    border-radius: 16px;
    background: var(--color-surface-container-lowest);
    box-shadow: 0 16px 42px rgba(26, 26, 26, 0.16);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-options-menu.hidden {
    display: none;
}

.chat-options-item {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 12px;
    padding: 8px 10px;
    background: transparent;
    color: var(--color-on-surface);
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    touch-action: manipulation;
}

.chat-options-item:hover,
.chat-options-item:focus-visible {
    background: color-mix(in srgb, var(--color-secondary-container) 18%, transparent);
    outline: none;
}

.chat-picker-menu {
    position: absolute;
    z-index: 80;
    top: calc(100% - 6px);
    left: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(56dvh, 460px);
    padding: 10px;
    border: 1px solid var(--color-surface-container-high);
    border-radius: 20px;
    background: var(--color-surface-container-lowest);
    box-shadow: 0 18px 50px rgba(26, 26, 26, 0.16);
    overflow: hidden;
    touch-action: pan-y;
}

.chat-picker-menu.hidden {
    display: none;
}

.chat-picker-search {
    height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--color-surface-container-low);
    border: 1px solid var(--color-surface-container-high);
}

.chat-picker-search-input {
    min-width: 0;
    width: 100%;
    background: transparent;
    border: 0;
    outline: none;
    color: var(--color-primary);
    font-size: 12px;
}

.chat-picker-options {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(min(56dvh, 460px) - 62px);
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
    -webkit-overflow-scrolling: touch;
}

.chat-picker-option {
    width: 100%;
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 14px;
    padding: 8px 9px;
    background: transparent;
    color: var(--color-on-surface);
    text-align: left;
    transition: background 0.16s ease;
}

.chat-picker-option:hover,
.chat-picker-option.is-active {
    background: color-mix(in srgb, var(--color-secondary-container) 18%, transparent);
}

.chat-picker-empty {
    padding: 18px 12px;
    text-align: center;
    color: var(--color-on-surface-variant);
    font-size: 12px;
}

@media (min-width: 768px) {
    body.chat-view-active #app-shell-content > div {
        height: calc(100dvh - 80px);
        padding-top: 18px;
        padding-bottom: 18px;
    }

    body.chat-view-active #pane-chat {
        height: 100% !important;
    }

    body.chat-view-active #pane-chat > div {
        height: 100%;
    }
}

@media (max-width: 767px) {
    #main-layout {
        --mobile-nav-offset: 0px;
        --mobile-nav-safe-bottom: env(safe-area-inset-bottom, 0px);
        --mobile-nav-height: 72px;
        --mobile-nav-outer-height: calc(var(--mobile-nav-height) + var(--mobile-nav-safe-bottom));
        --mobile-menu-attach-height: var(--mobile-nav-height);
        --mobile-nav-bottom-pad: calc(8px + var(--mobile-nav-safe-bottom));
        --chat-dock-viewport-shift: max(0px, calc(env(safe-area-inset-top, 0px) - var(--mobile-nav-safe-bottom)));
        --chat-composer-height: 82px;
        --chat-dock-height: calc(var(--chat-composer-height) + var(--mobile-menu-attach-height) + 6px);
        --chat-dock-x: 10px;
        --chat-dock-gap: 4px;
        padding-bottom: 9rem;
    }

    #mobile-bottom-nav {
        bottom: 0 !important;
        left: 10px;
        right: 10px;
        width: calc(100% - 20px);
        height: var(--mobile-nav-outer-height) !important;
        padding-bottom: var(--mobile-nav-bottom-pad);
        border-radius: 24px 24px 16px 16px;
        box-shadow: 0 -8px 28px rgba(26, 26, 26, 0.12);
    }

    #pane-chat {
        height: calc(100dvh - 128px) !important;
        min-height: 0 !important;
        padding-bottom: 0 !important;
    }

    #chat-member-content,
    #chat-messages-container {
        min-height: 0;
    }

    #chat-messages-container {
        padding-bottom: 1rem !important;
    }

    #chat-composer-shell {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        z-index: 20;
        min-height: var(--chat-composer-height);
        padding: 10px 12px;
        border-radius: 0;
        box-shadow: 0 -8px 18px rgba(26, 26, 26, 0.06);
    }

    #chat-input-form {
        max-width: 720px;
        margin: 0 auto;
    }

    html.chat-view-active,
    body.chat-view-active {
        height: 100%;
        overflow: hidden;
        overscroll-behavior: none;
    }

    body.chat-view-active {
        position: static;
        inset: auto;
        width: 100%;
        max-width: 100%;
    }

    body.chat-view-active #main-layout {
        height: 100dvh;
        min-height: 0;
        padding-bottom: 0;
        overflow: hidden;
    }

    body.chat-view-active #mobile-bottom-nav {
        left: 10px;
        right: 10px;
        width: calc(100% - 20px);
        height: var(--mobile-nav-outer-height) !important;
        bottom: 0 !important;
        align-items: flex-end;
        padding: 2px 2px var(--mobile-nav-bottom-pad);
        z-index: 80;
        border: 1px solid var(--color-surface-container-high);
        border-radius: 0;
        background: var(--color-surface);
        box-shadow: 0 -8px 28px rgba(26, 26, 26, 0.12);
        overflow: visible;
    }

    body.chat-view-active #mobile-bottom-nav::before {
        content: none;
    }

    body.chat-view-active #mobile-bottom-nav .nav-item {
        position: relative;
        z-index: 90;
        flex: 1 1 0;
    }

    body.chat-view-active #mobile-bottom-nav .nav-item > span {
        position: relative;
        z-index: 91;
    }

    body.chat-view-active #app-shell-content {
        padding-bottom: 0 !important;
    }

    body.chat-view-active #app-shell-content > div {
        height: calc(100dvh - 72px - env(safe-area-inset-top, 0px) - 8px - var(--chat-dock-height) - var(--chat-dock-gap));
        padding: 8px 10px 0;
        gap: 0;
        overflow: hidden;
    }

    body.chat-view-active #pane-chat {
        height: 100% !important;
    }

    body.chat-view-active #pane-chat > div {
        height: 100%;
        border-radius: 22px;
    }

    body.chat-view-active #chat-composer-shell {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(var(--mobile-nav-outer-height) - 1px);
        z-index: 85;
        min-height: var(--chat-composer-height);
        padding: 10px 10px 8px;
        border: 1px solid var(--color-surface-container-high);
        border-bottom: 0;
        border-radius: 24px 24px 0 0;
        background: var(--color-surface);
        box-shadow: none;
        touch-action: manipulation;
    }

    body.chat-view-active #mobile-bottom-nav #chat-composer-shell {
        position: fixed;
        top: auto;
        left: 10px;
        right: 10px;
        bottom: calc(var(--mobile-nav-outer-height) - 1px);
        z-index: 85;
        width: auto;
        min-height: var(--chat-composer-height);
        display: block;
        visibility: visible;
        opacity: 1;
        padding: 10px 10px 8px;
        border: 1px solid var(--color-surface-container-high);
        border-bottom: 0;
        border-radius: 24px 24px 0 0;
        background: var(--color-surface);
        box-shadow: none;
        pointer-events: auto;
    }

    body.chat-view-active #chat-input-form {
        max-width: none;
        width: 100%;
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    body.chat-view-active #chat-messages-container {
        padding-bottom: 0.75rem !important;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
    }

    body.chat-view-active .chat-picker-shell,
    body.chat-view-active .chat-active-header {
        touch-action: auto;
    }

    body.chat-view-active .chat-picker-button {
        touch-action: manipulation;
    }

    body.chat-view-active .chat-picker-menu {
        touch-action: pan-y;
    }

    body.chat-view-active .chat-picker-options {
        overscroll-behavior-y: contain;
        touch-action: pan-y;
    }

    body.chat-view-active #app-shell-content {
        height: 100dvh;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        overflow: hidden;
    }

    body.chat-view-active #app-shell-content > div {
        height: 100dvh;
        max-width: none;
        padding: 0 !important;
        gap: 0;
        overflow: hidden;
    }

    body.chat-view-active #pane-chat {
        position: fixed;
        top: var(--chat-shell-top, calc(88px + env(safe-area-inset-top, 0px)));
        left: var(--chat-dock-x);
        right: var(--chat-dock-x);
        bottom: var(--chat-shell-bottom, calc(var(--chat-dock-height) + var(--chat-dock-gap)));
        width: auto;
        height: auto !important;
        min-height: 0 !important;
        max-height: none;
        padding: 0 !important;
        z-index: 35;
        display: flex !important;
        flex-direction: column;
        overflow: hidden;
        overscroll-behavior: contain;
    }

    body.chat-view-active #pane-chat > div {
        flex: 1 1 auto;
        height: 100%;
        min-height: 0;
        max-height: 100%;
        overflow: hidden;
    }

    body.chat-view-active #chat-member-content {
        flex: 1 1 0;
        min-height: 0;
        max-height: 100%;
        overflow: hidden;
    }

    body.chat-view-active #chat-messages-container {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
    }

    .chat-active-header {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .chat-picker-wrap {
        padding: 8px;
    }

    .chat-picker-button {
        min-height: 58px;
        border-radius: 16px;
    }

    .chat-picker-menu {
        max-height: min(50dvh, 390px);
        left: 8px;
        right: 8px;
    }

    .chat-picker-options {
        max-height: calc(min(50dvh, 390px) - 62px);
    }

    #modal-group-manage {
        align-items: flex-end;
        justify-content: center;
        padding: 0;
    }

    #modal-group-manage > div {
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 12px);
        border-radius: 28px 28px 0 0;
    }

    #modal-group-manage > div > div:last-child {
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
}

/* App toast (quota / save errors) */
.app-toast {
    position: fixed;
    left: 50%;
    bottom: 6rem;
    transform: translateX(-50%) translateY(12px);
    max-width: min(92vw, 420px);
    padding: 12px 18px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 8px 28px rgba(26, 26, 26, 0.18);
}
.app-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}
.app-toast--info {
    background: var(--color-primary, #1a1a1a);
    color: var(--color-on-primary, #fff);
}
.app-toast--error {
    background: #8b2e2e;
    color: #fff;
}
@media (max-width: 768px) {
    .app-toast {
        bottom: 5.5rem;
    }
}
