/* ================================================================
   Sage & Co. Portal — Shared Styles
   All portal pages include this file.
   ================================================================ */

/* Profile dropdown in header */
.portal-header__profile {
    position: relative;
    display: flex;
    align-items: center;
}
.portal-header__profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    padding: 5px 14px 5px 5px;
    color: #E5DFD5;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: border-color 0.15s, background 0.15s;
}
.portal-header__profile-btn:hover {
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.05);
}
.portal-header__profile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #7C9A82;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.portal-header__profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #FAF7F2;
    border: 1px solid #E5DFD5;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(44,62,45,0.12);
    padding: 4px;
    min-width: 180px;
    z-index: 150;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
}
.portal-header__profile-menu.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.portal-header__profile-menu a,
.portal-header__profile-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #4A5D4B;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s;
}
.portal-header__profile-menu a:hover,
.portal-header__profile-menu button:hover {
    background: #EFE9DD;
}
.portal-header__profile-menu svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #8B8578;
}
.portal-header__profile-menu .divider {
    height: 1px;
    background: #E5DFD5;
    margin: 4px 0;
}

/* Prevent horizontal overflow on mobile — stops the "shifted left" issue
   where something wider than the viewport pushes content off-screen.
   Use `overflow-x: clip` (not `hidden`) so it doesn't create a scroll
   container — `hidden` on html/body breaks `position: sticky` for
   the header. `clip` gives the same visual result without that side-effect.
   Supported in Chrome 90+, Firefox 81+, Safari 16+. */
html, body {
    overflow-x: clip;
    max-width: 100vw;
}

/* Prevent iOS Safari from auto-zooming when tapping input fields.
   Safari zooms in on any input with font-size < 16px, then doesn't
   zoom back out after login/submit — leaving the page stuck zoomed in.
   Setting min 16px on all inputs prevents the zoom entirely. */
@media screen and (max-width: 768px) {
    input, textarea, select, .chat__input {
        font-size: 16px !important;
    }
}

/* --- Hide marketing site chrome --- */
.site-header,
.mobile-nav,
.mobile-nav__overlay,
.site-footer,
.cookie-banner { display: none !important; }

/* ================================================================
   Skeleton Loading
   ================================================================ */

@keyframes skeleton-pulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton {
    display: inline-block;
    min-width: 80px;
    height: 1em;
    border-radius: 6px;
    background: linear-gradient(90deg, #E5DFD5 25%, #F0EBE3 50%, #E5DFD5 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.8s ease-in-out infinite;
    vertical-align: middle;
}

.skeleton--wide { min-width: 140px; }
.skeleton--short { min-width: 50px; }
.skeleton--stat {
    display: block;
    width: 48px;
    height: 32px;
    margin: 0 auto;
    border-radius: 8px;
}

.skeleton--card {
    width: 100%;
    height: 68px;
    border-radius: 12px;
    min-width: unset;
}

/* ================================================================
   Header
   ================================================================ */

.portal-header {
    background: #2C3E2D;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    /* Safe area: on devices with notch/status bar, push content below it.
       env() resolves to 0 on desktop/non-notch devices, so no harm. */
    padding-top: env(safe-area-inset-top);
}
@media (min-width: 640px) { .portal-header { padding: 0 24px; } }
@media (min-width: 1024px) { .portal-header { padding: 0 80px; } }

.portal-header__inner {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: relative;
}

.portal-header__left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.portal-header__logo {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 500;
    font-size: 18px;
    color: #FAF7F2;
    text-decoration: none;
}
.portal-header__logo:hover { color: #FAF7F2; }

.portal-header__logo span {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 400;
    font-size: 13px;
    color: #A3BAA7;
    margin-left: 8px;
}

/* --- Nav links --- */

.portal-header__nav {
    display: flex;
    align-items: center;
    gap: 4px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.portal-header__nav-link {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #A3BAA7;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.portal-header__nav-link:hover {
    color: #FAF7F2;
    background: rgba(250, 247, 242, 0.08);
}
.portal-header__nav-link.is-active {
    color: #FAF7F2;
    background: rgba(250, 247, 242, 0.12);
    font-weight: 600;
}

/* Hide desktop nav on mobile, show hamburger */
@media (max-width: 767px) {
    .portal-header__nav { display: none; }
    .portal-header__signout { display: none; }
    .portal-header__user { display: none !important; }
}

/* Hamburger button — hidden on desktop */
.portal-header__hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: #A3BAA7;
    transition: color 0.2s ease;
    padding: 0;
}
.portal-header__hamburger:hover { color: #FAF7F2; }
.portal-header__hamburger svg { width: 22px; height: 22px; }
@media (min-width: 768px) { .portal-header__hamburger { display: none; } }

/* ================================================================
   Mobile Drawer (left-slide)
   ================================================================ */

.portal-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 45, 0.35);
    z-index: 350;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.portal-drawer-overlay.is-visible { opacity: 1; visibility: visible; }

.portal-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: #FAF7F2;
    z-index: 400;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 8px 0 32px rgba(44, 62, 45, 0);
}
.portal-drawer.is-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(44, 62, 45, 0.12);
}

.portal-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    padding-top: calc(20px + env(safe-area-inset-top));
    flex-shrink: 0;
}

.portal-drawer__logo {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 20px;
    color: #2C3E2D;
    text-decoration: none;
}

.portal-drawer__close {
    width: 36px;
    height: 36px;
    background: #E8EFEA;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #2C3E2D;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}
.portal-drawer__close:hover {
    background: #C5D4C8;
    transform: rotate(90deg);
}
.portal-drawer__close svg { width: 18px; height: 18px; }

.portal-drawer__divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #C5D4C8, transparent);
    margin: 0 24px;
    flex-shrink: 0;
}

.portal-drawer__links {
    flex: 1;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.portal-drawer__link {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 500;
    font-size: 16px;
    color: #2C3E2D;
    text-decoration: none;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px;
    transition: background 0.2s ease, transform 0.2s ease;
    position: relative;
    /* Staggered entrance */
    opacity: 0;
    transform: translateX(-16px);
    transition: background 0.2s ease, color 0.2s ease,
                opacity 0.35s ease, transform 0.35s ease;
}
.is-open .portal-drawer__link {
    opacity: 1;
    transform: translateX(0);
}
.portal-drawer__link:nth-child(1) { transition-delay: 0s, 0s, 0.1s, 0.1s; }
.portal-drawer__link:nth-child(2) { transition-delay: 0s, 0s, 0.16s, 0.16s; }
.portal-drawer__link:nth-child(3) { transition-delay: 0s, 0s, 0.22s, 0.22s; }

.portal-drawer__link:hover {
    background: #E8EFEA;
    transform: translateX(4px);
}
.portal-drawer__link.is-active {
    background: #E8EFEA;
    font-weight: 600;
    color: #2C3E2D;
}
.portal-drawer__link.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #7C9A82;
    border-radius: 3px;
}

.portal-drawer__link svg {
    width: 20px;
    height: 20px;
    color: #7C9A82;
    flex-shrink: 0;
}

.portal-drawer__footer {
    padding: 20px 24px 32px;
    flex-shrink: 0;
    border-top: 1px solid #E5DFD5;
    /* Staggered entrance */
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s ease 0.35s, transform 0.35s ease 0.35s;
}
.is-open .portal-drawer__footer { opacity: 1; transform: translateY(0); }

.portal-drawer__email {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    color: #8B8578;
    margin-bottom: 16px;
    word-break: break-all;
}

.portal-drawer__signout {
    display: block;
    width: 100%;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    padding: 12px 24px;
    background: none;
    color: #2C3E2D;
    border: 1.5px solid #E5DFD5;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.portal-drawer__signout:hover {
    background: #2C3E2D;
    color: #FAF7F2;
    border-color: #2C3E2D;
}

.portal-header__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-header__user {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    color: #C5D4C8;
    display: none;
}
@media (min-width: 768px) { .portal-header__user { display: block; } }

.portal-header__signout {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #A3BAA7;
    background: none;
    border: 1px solid rgba(165, 186, 167, 0.3);
    border-radius: 50px;
    padding: 6px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.portal-header__signout:hover {
    color: #FAF7F2;
    border-color: rgba(250, 247, 242, 0.4);
}

/* ================================================================
   Page Layout
   ================================================================ */

.portal {
    padding: 24px 16px 64px;
    min-height: calc(100vh - 56px);
}
@media (min-width: 640px) { .portal { padding: 32px 24px 64px; } }
@media (min-width: 1024px) { .portal { padding: 48px 80px 64px; } }

.portal__inner {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.portal__inner--wide {
    max-width: 100%;
    min-width: 0;
}

/* Tasks page: fixed viewport, no page scroll */
.portal--board {
    height: calc(100vh - 56px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}

.portal--board .portal__inner--wide {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    width: 100%;
}

.portal--board .portal__topbar {
    flex-shrink: 0;
}

.portal--board .board {
    flex: 1;
    min-height: 0;
    height: auto;
}

.portal__topbar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}
@media (min-width: 640px) {
    .portal__topbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
}

.portal__greeting h1 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 24px;
    font-weight: 500;
    color: #2C3E2D;
    margin: 0 0 4px;
}
@media (min-width: 768px) { .portal__greeting h1 { font-size: 28px; } }

.portal__greeting p {
    font-size: 14px;
    color: #8B8578;
    margin: 0;
}

.portal__actions { display: flex; gap: 8px; }

/* ================================================================
   Stats Row
   ================================================================ */

.portal__stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
@media (min-width: 768px) { .portal__stats { grid-template-columns: repeat(4, 1fr); } }

.portal__stat {
    background: #FFFFFF;
    border: 1px solid #E5DFD5;
    border-radius: 16px;
    padding: 16px;
    text-align: center;
}

.portal__stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8B8578;
    margin-bottom: 4px;
}

.portal__stat-value {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 28px;
    font-weight: 500;
    color: #2C3E2D;
}

.portal__stat-value--active { color: #7C9A82; }
.portal__stat-value--done { color: #5A7A60; }
.portal__stat-value--waiting { color: #C4745A; }

/* ================================================================
   Dashboard Sections
   ================================================================ */

.dash__grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dash__section {
    background: #FFFFFF;
    border: 1px solid #E5DFD5;
    border-radius: 16px;
    padding: 20px;
}
@media (min-width: 640px) { .dash__section { padding: 24px; } }

.dash__section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.dash__section-header h2 {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8B8578;
    margin: 0;
}

.dash__view-all {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #7C9A82;
    text-decoration: none;
}
.dash__view-all:hover { color: #5A7A60; text-decoration: underline; }

.dash__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    transition: background 0.15s ease;
}
.dash__item:hover { background: rgba(124, 154, 130, 0.04); }

.dash__item--link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.dash__item--activity {
    border-bottom: 1px solid rgba(229, 223, 213, 0.5);
    border-radius: 0;
}
.dash__item--activity:last-child { border-bottom: none; }

.dash__item-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    margin-top: 6px;
}

.dash__item-icon {
    min-width: 18px;
    margin-top: 2px;
}

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

.dash__item-title {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #2C3E2D;
    margin-bottom: 4px;
    line-height: 1.4;
}

.dash__item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dash__item-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dash__item-status {
    font-size: 12px;
    font-weight: 500;
}

.dash__item-agent {
    font-size: 12px;
    color: #8B8578;
}

/* Deliverable rows */
.dash__deliverable {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    transition: background 0.15s ease;
}
.dash__deliverable:not(:last-child) {
    border-bottom: 1px solid rgba(229, 223, 213, 0.5);
    border-radius: 0;
}
.dash__deliverable:hover { background: rgba(124, 154, 130, 0.04); }

.dash__deliverable-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: #E8EFEA;
    border-radius: 10px;
}

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

.dash__deliverable-title {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #2C3E2D;
    line-height: 1.4;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash__deliverable-meta {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 12px;
    color: #8B8578;
}

.dash__deliverable-download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: #7C9A82;
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    transition: background 0.2s ease;
}
.dash__deliverable-download:hover { background: #5A7A60; }

.dash__empty {
    text-align: center;
    padding: 24px 12px;
    color: #8B8578;
    font-size: 13px;
    font-style: italic;
}

.dash__empty a {
    color: #7C9A82;
    text-decoration: none;
}
.dash__empty a:hover { text-decoration: underline; }

/* ================================================================
   Kanban Board
   ================================================================ */

.board {
    overflow-x: scroll;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    height: calc(100vh - 220px);
    min-height: 400px;
    cursor: grab;
}
.board:active { cursor: grabbing; }

.board__columns {
    display: flex;
    gap: 16px;
    /* Always at least 5 columns × 280px + gaps, even before cards load */
    min-width: calc(280px * 5 + 16px * 4);
    height: 100%;
}
/* Always-visible scrollbar */
.board::-webkit-scrollbar { height: 12px; }
.board::-webkit-scrollbar-track { background: #E5DFD5; border-radius: 6px; }
.board::-webkit-scrollbar-thumb { background: #B8B2A8; border-radius: 6px; min-width: 60px; }
.board::-webkit-scrollbar-thumb:hover { background: #8B8578; }

.board__column {
    flex: 0 0 280px;
    min-height: 0;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
@media (min-width: 1280px) {
    .board__columns { min-width: 100%; }
    .board__column { flex: 1 1 0; min-width: 200px; }
}

.board__column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 10px;
    background: #FFFFFF;
    border: 1px solid #E5DFD5;
}

.board__column-title {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8B8578;
}

.board__column-count {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #8B8578;
    background: #E5DFD5;
    border-radius: 50px;
    padding: 2px 8px;
    min-width: 22px;
    text-align: center;
}

/* Column color accents */
.board__column[data-col="backlog"] .board__column-header { border-left: 3px solid #8B8578; }
.board__column[data-col="next"] .board__column-header { border-left: 3px solid #B8860B; }
.board__column[data-col="doing"] .board__column-header { border-left: 3px solid #7C9A82; }
.board__column[data-col="waiting"] .board__column-header { border-left: 3px solid #C4745A; }
.board__column[data-col="done"] .board__column-header { border-left: 3px solid #5A7A60; }

.board__cards {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px;
    border-radius: 10px;
    transition: background 0.2s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #E5DFD5 transparent;
}
.board__cards::-webkit-scrollbar { width: 5px; }
.board__cards::-webkit-scrollbar-track { background: transparent; }
.board__cards::-webkit-scrollbar-thumb { background: #D5CFC5; border-radius: 3px; }

.board__cards.drag-over {
    background: rgba(124, 154, 130, 0.08);
    outline: 2px dashed #C5D4C8;
    outline-offset: -2px;
    border-radius: 10px;
}

.board__empty {
    text-align: center;
    padding: 24px 12px;
    color: #8B8578;
    font-size: 13px;
    font-style: italic;
}

/* ================================================================
   Task Cards
   ================================================================ */

.task-card {
    background: #fff;
    border: 0.5px solid #E5DFD5;
    border-radius: 12px;
    padding: 14px;
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.task-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(44, 62, 45, 0.08);
}

.task-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.task-card__title {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #2C3E2D;
    margin-bottom: 8px;
    line-height: 1.4;
}

.task-card__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.task-card__priority {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.task-card__priority--P0 { background: #F8D7DA; color: #721C24; }
.task-card__priority--P1 { background: #FAEAE5; color: #9E5840; }
.task-card__priority--P2 { background: #E8EFEA; color: #3D5240; }
.task-card__priority--P3 { background: #F0F0F0; color: #666; }

.task-card__agent {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 11px;
    color: #8B8578;
}

.task-card__time {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 11px;
    color: #8B8578;
}

.task-card__dl-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: auto;
    color: #7C9A82;
    border-radius: 4px;
    transition: background 0.15s ease;
    text-decoration: none;
}
.task-card__dl-icon:hover {
    background: #E8EFEA;
    color: #5A7A60;
}

/* ================================================================
   File Drop Zone
   ================================================================ */

.file-drop {
    border: 2px dashed #E5DFD5;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}
.file-drop--active,
.file-drop:hover {
    border-color: #7C9A82;
    background: rgba(124, 154, 130, 0.04);
}

.file-drop__prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #8B8578;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
}
.file-drop__prompt a {
    color: #7C9A82;
    text-decoration: underline;
    font-weight: 500;
}

.file-drop__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 0;
}
.file-drop__list:not(:empty) { margin-top: 12px; }

.file-drop__file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #E5DFD5;
    border-radius: 8px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
}

.file-drop__file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2C3E2D;
    font-weight: 500;
}

.file-drop__file-size {
    color: #8B8578;
    font-size: 11px;
    flex-shrink: 0;
}

.file-drop__file-remove {
    background: none;
    border: none;
    color: #C4745A;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}
.file-drop__file-remove:hover { color: #9E5840; }

/* Attachment links in detail modal */
.detail__attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #E5DFD5;
    border-radius: 8px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #2C3E2D;
    text-decoration: none;
    margin-bottom: 6px;
    transition: background 0.15s ease;
}
.detail__attachment:hover { background: #E8EFEA; }
.detail__attachment svg { color: #7C9A82; flex-shrink: 0; }

/* Full download button (used in detail modal) */
.task-card__download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: #7C9A82;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 50px;
    transition: background 0.2s ease;
}
.task-card__download:hover { background: #5A7A60; color: #fff; }

/* ================================================================
   Modals
   ================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.is-visible { opacity: 1; visibility: visible; }

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    background: #FAF7F2;
    border-radius: 16px;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
}
.modal.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #E5DFD5;
}

.modal__header h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 20px;
    font-weight: 500;
    color: #2C3E2D;
    margin: 0;
}

.modal__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #8B8578;
    transition: color 0.2s ease;
}
.modal__close:hover { color: #2C3E2D; }
.modal__close svg { width: 20px; height: 20px; }

.modal__body { padding: 24px; }

.modal__field { margin-bottom: 16px; }

.modal__field label {
    display: block;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #4A5D4B;
    margin-bottom: 6px;
}

.modal__field input,
.modal__field select,
.modal__field textarea {
    width: 100%;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    padding: 10px 14px;
    border: 1.5px solid #E5DFD5;
    border-radius: 10px;
    background: #fff;
    color: #2C3E2D;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}
.modal__field input:focus,
.modal__field select:focus,
.modal__field textarea:focus { border-color: #7C9A82; }

.modal__field textarea { resize: vertical; min-height: 60px; }

.modal__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid #E5DFD5;
}

.modal__actions .btn--ghost {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    background: none;
    border: 1px solid #C5D4C8;
    color: #7C9A82;
    border-radius: 50px;
    padding: 10px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.modal__actions .btn--ghost:hover { background: #7C9A82; color: #fff; }

.modal__actions .btn--primary {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    background: #2C3E2D;
    color: #FAF7F2;
    border: none;
    border-radius: 50px;
    padding: 10px 24px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.modal__actions .btn--primary:hover { background: #3D5240; }
.modal__actions .btn--primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* Task detail rows */
.detail__row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 14px;
}

.detail__label {
    min-width: 80px;
    font-weight: 600;
    color: #8B8578;
    font-size: 13px;
}

.detail__value {
    color: #2C3E2D;
    word-break: break-word;
}

/* ================================================================
   Settings Page
   ================================================================ */

.settings__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 600px;
}

.settings__card {
    background: #FFFFFF;
    border: 1px solid #E5DFD5;
    border-radius: 16px;
    padding: 24px;
}

.settings__card-title {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8B8578;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #E5DFD5;
}

.settings__field {
    margin-bottom: 16px;
}

.settings__field label {
    display: block;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #4A5D4B;
    margin-bottom: 6px;
}

.settings__field input,
.settings__field textarea,
.settings__field select {
    width: 100%;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    padding: 10px 14px;
    border: 1.5px solid #E5DFD5;
    border-radius: 10px;
    background: #fff;
    color: #2C3E2D;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    line-height: 1.5;
}
.settings__field textarea {
    resize: vertical;
    min-height: 72px;
}
.settings__field input:focus,
.settings__field textarea:focus,
.settings__field select:focus { border-color: #7C9A82; }

/* ================================================================
   Settings Tabs
   ================================================================ */

/* Two-column layout: sidebar + content */
.settings__layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 1000px;
}
@media (min-width: 768px) {
    .settings__layout {
        grid-template-columns: 220px 1fr;
        gap: 32px;
        align-items: start;
    }
}

.settings__sidebar {
    background: #FFFFFF;
    border: 1px solid #E5DFD5;
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
@media (min-width: 768px) {
    .settings__sidebar {
        position: sticky;
        top: 80px;
    }
}

.settings__tab {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #8B8578;
    background: none;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}
.settings__tab svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #A3BAA7;
    transition: color 0.2s ease;
}
.settings__tab:hover {
    color: #2C3E2D;
    background: #F5EDE4;
}
.settings__tab:hover svg { color: #7C9A82; }
.settings__tab.is-active {
    background: #E8EFEA;
    color: #2C3E2D;
    font-weight: 600;
}
.settings__tab.is-active svg { color: #7C9A82; }

.settings__content {
    min-width: 0;
}

.settings__panel {
    display: none;
}
.settings__panel.is-active {
    display: block;
    animation: settings-fade-in 0.25s ease;
}

@keyframes settings-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.settings__section-heading {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 16px;
    font-weight: 500;
    color: #2C3E2D;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #E5DFD5;
}
.settings__section-heading:first-child { margin-top: 0; }

.settings__card-sub {
    font-size: 13px;
    color: #8B8578;
    margin: -12px 0 20px;
    line-height: 1.5;
}

.settings__field-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
@media (min-width: 640px) {
    .settings__field-grid { grid-template-columns: 1fr 1fr; }
    .settings__field-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
}
.settings__field-grid .settings__field { margin-bottom: 0; }

/* Account info grid */
.settings__info-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings__info-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(229, 223, 213, 0.5);
}
.settings__info-row:last-child { border-bottom: none; }

.settings__info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: #E8EFEA;
    border-radius: 10px;
}

.settings__info-content { flex: 1; min-width: 0; }

.settings__info-label {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8B8578;
    margin-bottom: 2px;
}

.settings__info-value {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #2C3E2D;
}

.settings__repeater {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.settings__repeater-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: center;
}

@media (max-width: 540px) {
    .settings__repeater-row {
        grid-template-columns: 1fr auto;
    }
    .settings__repeater-row input[type="text"] {
        grid-column: 1 / -1;
    }
}

.settings__repeater-row input {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    padding: 10px 14px;
    border: 1.5px solid #E5DFD5;
    border-radius: 10px;
    background: #fff;
    color: #2C3E2D;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    line-height: 1.5;
    width: 100%;
}
.settings__repeater-row input:focus { border-color: #7C9A82; }

.settings__repeater-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1.5px solid #E5DFD5;
    border-radius: 10px;
    background: #fff;
    color: #8B8578;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.settings__repeater-remove:hover {
    border-color: #C4745A;
    color: #C4745A;
    background: #FBF4F0;
}
.settings__repeater-remove svg { width: 16px; height: 16px; }

.settings__repeater-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #7C9A82;
    background: none;
    border: 1.5px dashed #C9D4CC;
    border-radius: 10px;
    padding: 9px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.settings__repeater-add:hover {
    border-color: #7C9A82;
    background: #F0F5F1;
    border-style: solid;
}

.settings__hint {
    font-size: 13px;
    color: #8B8578;
    margin-top: 8px;
    line-height: 1.5;
}

.settings__hint a {
    color: #7C9A82;
    text-decoration: none;
}
.settings__hint a:hover { text-decoration: underline; }

.settings__message {
    font-size: 13px;
    margin-bottom: 12px;
    min-height: 0;
}

.settings__message--error { color: #C4745A; }
.settings__message--success { color: #5A7A60; }

/* Toggle switches */
.settings__toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(229, 223, 213, 0.5);
}
.settings__toggle-row:last-of-type { border-bottom: none; }

.settings__toggle-label {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #2C3E2D;
}

.settings__toggle-hint {
    font-size: 12px;
    color: #8B8578;
    margin-top: 2px;
}

.settings__switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    min-width: 44px;
}

.settings__switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.settings__switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E5DFD5;
    transition: 0.2s;
    border-radius: 24px;
}

.settings__switch-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

.settings__switch input:checked + .settings__switch-slider {
    background-color: #7C9A82;
}

.settings__switch input:checked + .settings__switch-slider::before {
    transform: translateX(20px);
}

/* Coming Soon card */
.settings__card--coming-soon {
    position: relative;
}

.settings__coming-soon-badge {
    position: absolute;
    top: 22px;
    right: 24px;
    background: #C4745A;
    color: #fff;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px;
    border-radius: 50px;
}

.settings__coming-soon-content {
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
}

.settings__switch input:disabled + .settings__switch-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================================================
   Toast
   ================================================================ */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #2C3E2D;
    color: #FAF7F2;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    padding: 12px 20px;
    border-radius: 10px;
    z-index: 1000;
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 320px;
}
.toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

/* ================================================================
   Mobile Responsive
   ================================================================ */

@media (max-width: 767px) {
    /* Greeting */
    .portal__greeting h1 { font-size: 22px; }

    /* Stats: 2-col on mobile */
    .portal__stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .portal__stat { padding: 12px; }
    .portal__stat-value { font-size: 24px; }

    /* Dashboard sections stack */
    .dash__grid { grid-template-columns: 1fr; gap: 16px; }
    .dash__section { padding: 16px; }

    /* Board columns narrower on mobile */
    .board__column { flex: 0 0 260px; }

    /* Task cards tighter */
    .task-card { padding: 12px; }
    .task-card__title { font-size: 13px; }

    /* Modals: nearly full screen */
    .modal {
        width: 95%;
        max-width: none;
        max-height: 95vh;
    }

    /* Settings: full width */
    .settings__grid { max-width: 100%; }
    .settings__card { padding: 20px; }

    /* Toast: full width bottom */
    .toast {
        left: 16px;
        right: 16px;
        max-width: none;
    }

    /* Topbar: stack on small screens */
    .portal__topbar {
        flex-direction: column;
        gap: 12px;
    }

    /* Chat: full height on mobile, tighter padding */
    .portal--chat { padding: 0; }
    .portal--chat .portal__inner { padding: 0 8px; }
    .chat { padding: 0; }
    .chat__messages { border-radius: 0; border-left: none; border-right: none; padding: 16px 8px; }
    .chat__input-wrap { border-radius: 12px; }
    .chat__input-area { padding: 8px; }
    .chat__status { border-radius: 0; margin: 0; }
    .chat__typing { border-left: none; border-right: none; }
    .chat__file-preview { border-left: none; border-right: none; }
    .message { max-width: 88%; }
    .message__image { max-height: 200px; }
}

/* ================================================================
   Chat
   ================================================================ */

.portal--chat {
    padding: 0 16px;
}

.portal--chat .portal__inner {
    max-width: 720px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    padding: 0;
}

/* Status bar */
.chat__status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #FFFFFF 0%, #E8EFEA 100%);
    border: 1px solid #C5D4C8;
    border-radius: 16px 16px 0 0;
    margin-top: 16px;
}

.chat__status-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #7C9A82;
    color: #fff;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}
.chat__status-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat__status-name {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 15px;
    color: #2C3E2D;
}

.chat__status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7C9A82;
    flex-shrink: 0;
}

.chat__status-label {
    font-size: 13px;
    color: #8B8578;
}

/* Messages area */
.chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    background: #fff;
    border-left: .5px solid #E5DFD5;
    border-right: .5px solid #E5DFD5;
    display: flex;
    flex-direction: column;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
}

.chat__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 20px;
    flex: 1;
}

.chat__loading-spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid #E5DFD5;
    border-top-color: #7C9A82;
    border-radius: 50%;
    animation: chatSpin 0.7s linear infinite;
}

@keyframes chatSpin {
    to { transform: rotate(360deg); }
}

.chat__loading-text {
    font-size: 13px;
    color: #8B8578;
    font-weight: 500;
}

/* Date separator */
.chat__date-sep {
    text-align: center;
    font-size: 12px;
    color: #8B8578;
    padding: 12px 0;
    font-weight: 500;
}

/* Welcome / empty state */
.chat__welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    padding: 40px 20px;
    color: #5A5549;
    font-size: 15px;
    line-height: 1.6;
}

.chat__welcome-wave {
    font-size: 36px;
    margin-bottom: 12px;
}

.chat__welcome p {
    max-width: 340px;
}

.chat__welcome strong {
    color: #2C3E2D;
}

/* Message bubbles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    margin-bottom: 4px;
}

.message--client {
    align-self: flex-end;
    align-items: flex-end;
}

.message--agent {
    align-self: flex-start;
    align-items: flex-start;
}

.message__sender {
    font-family: 'Fraunces', serif;
    font-size: 12px;
    font-weight: 600;
    color: #2C3E2D;
    margin-bottom: 2px;
    padding-left: 4px;
}

.message__bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    max-width: 100%;
}

.message--client .message__bubble {
    background: #E8EFEA;
    border: .5px solid #C5D4C8;
    border-bottom-right-radius: 4px;
    color: #2C3E2D;
}

.message--agent .message__bubble {
    background: #FAF7F2;
    border: .5px solid #E5DFD5;
    border-bottom-left-radius: 4px;
    color: #3A3630;
}

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

.message__time {
    font-size: 11px;
    color: #8B8578;
    margin-top: 2px;
    padding: 0 4px;
}

/* ========= Message reactions ========= */

/* The reaction picker — floats at the top-right of agent messages on hover */
.reaction__bar {
    display: flex;
    gap: 2px;
    position: absolute;
    top: -14px;
    right: 8px;
    background: #fff;
    border: 1px solid #E5DFD5;
    border-radius: 20px;
    padding: 2px 4px;
    box-shadow: 0 2px 8px rgba(44, 62, 45, 0.1);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    z-index: 5;
}
.message--agent:hover .reaction__bar {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.reaction__btn {
    background: none;
    border: none;
    font-size: 16px;
    padding: 3px 5px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s, transform 0.12s;
    line-height: 1;
}
.reaction__btn:hover {
    transform: scale(1.3);
}
.reaction__btn.is-active {
    transform: scale(1.15);
}

/* Existing reactions displayed below the bubble */
.reaction__display {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    padding: 0 4px;
}
.reaction__pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: #FAF7F2;
    border: 1px solid #E5DFD5;
    border-radius: 12px;
    padding: 2px 8px;
    cursor: default;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Pop animation when a reaction is added */
@keyframes reactionPop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}
.reaction__pill--new {
    animation: reactionPop 0.3s ease-out;
}

/* The agent message needs position:relative so the reaction bar can position absolutely */
.message--agent {
    position: relative;
}

/* Message entrance animation */
.message--new {
    animation: msgSlideIn 0.2s ease-out;
}

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

/* Attachments in messages */
.message__attachments {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.message__attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #7C9A82;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(124, 154, 130, 0.08);
    transition: background 0.15s;
}

.message__attachment:hover {
    background: rgba(124, 154, 130, 0.16);
}

/* Typing indicator */
.chat__typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    border-left: .5px solid #E5DFD5;
    border-right: .5px solid #E5DFD5;
}

.chat__typing-text {
    font-size: 13px;
    color: #8B8578;
    font-style: italic;
}

.chat__typing-dots {
    display: flex;
    gap: 3px;
}

.chat__typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8B8578;
    animation: typingBounce 1.2s infinite ease-in-out;
}

.chat__typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat__typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Input area */
.chat__input-area {
    padding: 12px 0 16px;
    flex-shrink: 0;
}

.chat__input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid #E5DFD5;
    border-radius: 16px;
    padding: 8px 8px 8px 12px;
    transition: border-color 0.15s;
}

.chat__input-wrap:focus-within {
    border-color: #7C9A82;
}

/* When file preview is showing, connect it to the input wrap */
.chat__file-preview + .chat__input-wrap {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.chat__input {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    color: #2C3E2D;
    background: transparent;
    min-height: 24px;
    max-height: 120px;
}

.chat__input::placeholder {
    color: #B0A99F;
}

.chat__send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #2C3E2D;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, opacity 0.15s;
}

.chat__send:hover {
    background: #3D5240;
}

.chat__send:disabled {
    opacity: 0.35;
    cursor: default;
}

.chat__send:disabled:hover {
    background: #2C3E2D;
}

/* Attach button */
.chat__attach {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #8B8578;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.chat__attach:hover {
    color: #7C9A82;
    background: rgba(124, 154, 130, 0.08);
}

/* File preview strip (inside input area) */
.chat__file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: #FAF7F2;
    border: 1.5px solid #E5DFD5;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
}

.chat__file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #FAF7F2;
    border: .5px solid #E5DFD5;
    border-radius: 10px;
    font-size: 12px;
    color: #3A3630;
    animation: msgSlideIn 0.15s ease-out;
}

.chat__file-chip-icon {
    display: flex;
    flex-shrink: 0;
}

.chat__file-chip-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.chat__file-chip-size {
    color: #8B8578;
    font-size: 11px;
}

.chat__file-chip-remove {
    display: flex;
    align-items: center;
    border: none;
    background: none;
    padding: 0;
    margin-left: 2px;
    cursor: pointer;
    color: #8B8578;
    transition: color 0.15s;
}

.chat__file-chip-remove:hover {
    color: #C4745A;
}

/* File cards in messages (agent → client) */
.message__file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(124, 154, 130, 0.06);
    border: .5px solid #E5DFD5;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    margin-top: 6px;
}

.message__file-card:hover {
    background: rgba(124, 154, 130, 0.12);
}

.message__file-icon {
    display: flex;
    flex-shrink: 0;
}

.message__file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.message__file-name {
    font-size: 13px;
    font-weight: 500;
    color: #2C3E2D;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message__file-size {
    font-size: 11px;
    color: #8B8578;
}

.message__file-download {
    display: flex;
    flex-shrink: 0;
    color: #7C9A82;
}

/* Inline images in messages */
.message__image-wrap {
    margin-top: 8px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}

.message__image {
    display: block;
    max-width: 100%;
    max-height: 280px;
    border-radius: 10px;
    object-fit: cover;
    transition: opacity 0.15s;
}

.message__image:hover {
    opacity: 0.9;
}

/* Inline video player */
.message__video-wrap {
    margin-top: 8px;
    border-radius: 10px;
    overflow: hidden;
}

.message__video {
    display: block;
    width: 100%;
    max-height: 320px;
    border-radius: 10px;
    background: #000;
}

/* Markdown styles in agent messages */
.message--agent .message__body {
    white-space: normal;
}

.message--agent .message__body p {
    margin: 0 0 8px;
}

.message--agent .message__body p:last-child {
    margin-bottom: 0;
}

.message--agent .message__body h1,
.message--agent .message__body h2,
.message--agent .message__body h3 {
    font-family: 'Fraunces', serif;
    margin: 12px 0 6px;
    line-height: 1.3;
}

.message--agent .message__body h1 { font-size: 18px; }
.message--agent .message__body h2 { font-size: 16px; }
.message--agent .message__body h3 { font-size: 14px; font-weight: 600; }

.message--agent .message__body ul,
.message--agent .message__body ol {
    margin: 4px 0 8px;
    padding-left: 20px;
}

.message--agent .message__body li {
    margin-bottom: 2px;
}

.message--agent .message__body code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12.5px;
    background: rgba(44, 62, 45, 0.06);
    padding: 2px 5px;
    border-radius: 4px;
}

.message--agent .message__body pre {
    margin: 8px 0;
    padding: 12px;
    background: #2C3E2D;
    color: #E8EFEA;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12.5px;
    line-height: 1.5;
}

.message--agent .message__body pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.message--agent .message__body blockquote {
    margin: 8px 0;
    padding: 4px 12px;
    border-left: 3px solid #7C9A82;
    color: #5A5549;
}

.message--agent .message__body a {
    color: #7C9A82;
    text-decoration: underline;
}

.message--agent .message__body strong {
    font-weight: 600;
}

.message--agent .message__body hr {
    border: none;
    border-top: 1px solid #E5DFD5;
    margin: 12px 0;
}

/* Load earlier messages */
.chat__load-earlier {
    display: block;
    margin: 0 auto 12px;
    padding: 6px 16px;
    border: 1px solid #E5DFD5;
    border-radius: 50px;
    background: #FAF7F2;
    color: #8B8578;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.chat__load-earlier:hover {
    background: #E8EFEA;
    color: #2C3E2D;
}

.chat__load-earlier:disabled {
    cursor: default;
    opacity: 0.6;
}

/* Drag-and-drop overlay */
.chat__drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(232, 239, 234, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.chat__drop-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.chat__drop-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 60px;
    border: 2px dashed #7C9A82;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 500;
    color: #2C3E2D;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.lightbox.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.lightbox__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}

.lightbox__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    object-fit: contain;
}
