:root {
    --bg: #07141f;
    --bg-soft: #10273a;
    --panel: rgba(14, 30, 44, 0.86);
    --panel-solid: #102236;
    --line: rgba(148, 192, 209, 0.16);
    --text: #edf5f8;
    --muted: #9bb8c6;
    --navy: #12334c;
    --teal: #4f9677;
    --teal-bright: #6bc39b;
    --danger: #d96a6a;
    --success: #51b982;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    --radius: 24px;
    --font: "Segoe UI", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    background:
        radial-gradient(circle at top left, rgba(79, 150, 119, 0.2), transparent 35%),
        radial-gradient(circle at top right, rgba(26, 68, 102, 0.35), transparent 40%),
        linear-gradient(145deg, #061019, #0d2231 46%, #12334c);
    color: var(--text);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.app-loader {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #07141f, #12334c);
    display: grid;
    place-items: center;
    z-index: 1000;
    transition: opacity .5s ease, visibility .5s ease;
}

.app-loader.hidden { opacity: 0; visibility: hidden; }

.loader-brand {
    display: grid;
    gap: 1rem;
    justify-items: center;
    text-align: center;
    animation: fadeUp .8s ease;
}

.loader-brand img {
    width: 170px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.flash {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 999;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    max-width: 420px;
}

.flash-success { background: rgba(30, 76, 53, 0.9); }
.flash-error { background: rgba(98, 39, 39, 0.92); }

.auth-shell,
.dashboard-shell,
.client-shell,
.single-form-shell,
.install-shell {
    width: min(1380px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.chat-app-shell {
    width: min(1560px, calc(100% - 1.5rem));
    margin: 0 auto;
    padding: 1.25rem 0 2rem;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.25rem;
}

.chat-left-rail,
.chat-main-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.chat-left-rail {
    padding: 1.25rem;
    display: grid;
    gap: 1rem;
    align-content: start;
}

.chat-main-panel {
    padding: 1rem;
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: calc(100vh - 3rem);
}

.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 1rem 1rem;
    border-bottom: 1px solid var(--line);
}

.chat-topbar-user {
    display: flex;
    align-items: center;
    gap: .9rem;
}

.chat-topbar-user span,
.chat-topbar-pills {
    color: var(--muted);
}

.chat-avatar {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--teal), var(--navy));
    color: white;
    font-weight: 800;
}

.chat-stage {
    padding: 1rem;
    display: grid;
    gap: 1rem;
    min-height: 0;
}

.chat-intro-banner {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(79, 150, 119, .12), rgba(18, 51, 76, .16));
}

.chat-intro-banner h2,
.rail-card h3 {
    margin-bottom: .25rem;
}

.admin-chat-layout {
    display: grid;
    grid-template-columns: 1.25fr 360px;
    gap: 1rem;
    min-height: 0;
}

.chat-column,
.context-column {
    display: grid;
    gap: 1rem;
    min-height: 0;
}

.context-card,
.rail-card {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 1rem;
}

.thread-list,
.mini-request-list {
    display: grid;
    gap: .8rem;
    max-height: 48vh;
    overflow: auto;
}

.thread-card {
    display: grid;
    gap: .2rem;
    padding: .95rem 1rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.04);
}

.thread-card.active {
    background: rgba(79, 150, 119, .16);
    border-color: rgba(107, 195, 155, .55);
}

.thread-head {
    display: flex;
    justify-content: space-between;
    gap: .8rem;
    align-items: center;
}

.rail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
}

.rail-stat,
.meta-pair {
    display: grid;
    gap: .2rem;
}

.rail-stat span,
.meta-pair span,
.thread-card span,
.thread-card small {
    color: var(--muted);
}

.modern-stream {
    background:
        radial-gradient(circle at top left, rgba(107, 195, 155, .05), transparent 26%),
        linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 1rem;
    min-height: 420px;
    max-height: 58vh;
    overflow: auto;
}

.message-row {
    display: flex;
    margin-bottom: .8rem;
}

.own-row {
    justify-content: flex-end;
}

.remote-row {
    justify-content: flex-start;
}

.modern-bubble {
    max-width: min(72%, 720px);
    border-radius: 22px;
    padding: 1rem 1.05rem;
    box-shadow: 0 10px 26px rgba(0,0,0,.16);
}

.modern-bubble.from-admin {
    background: linear-gradient(135deg, rgba(31, 68, 95, .9), rgba(18, 51, 76, .9));
}

.modern-bubble.from-client.self,
.modern-bubble.from-client {
    background: linear-gradient(135deg, rgba(79, 150, 119, .2), rgba(32, 89, 66, .34));
}

.chat-composer {
    display: grid;
}

.composer-box {
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(6, 18, 28, .8);
    padding: .85rem;
    display: grid;
    gap: .75rem;
}

.composer-box textarea {
    min-height: 96px;
    resize: vertical;
    background: transparent;
    border: 0;
    outline: none;
}

.composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.composer-shortcuts {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

.composer-status-text {
    color: var(--muted);
    font-size: .9rem;
    flex: 1;
    min-width: 220px;
}

.file-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .8rem 1rem;
    background: rgba(255,255,255,.04);
    cursor: pointer;
}

.file-chip input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.empty-chat-state {
    border: 1px dashed rgba(107, 195, 155, .28);
    border-radius: 24px;
    padding: 2rem 1.4rem;
    text-align: center;
    color: var(--muted);
}

.chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.chat-search-input {
    flex: 1;
    min-width: 220px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.04);
    color: var(--text);
    padding: .85rem 1rem;
    font: inherit;
}

.typing-indicator {
    min-height: 1.2rem;
    color: var(--teal-bright);
    font-size: .92rem;
}

.live-pulse {
    min-height: 1.2rem;
    color: var(--muted);
    font-size: .86rem;
    transition: color .2s ease, transform .2s ease;
}

.live-pulse.is-live {
    color: var(--teal-bright);
    transform: translateY(-1px);
}

.pinned-banner {
    border: 1px solid rgba(107, 195, 155, .24);
    border-radius: 20px;
    padding: .9rem 1rem;
    background: rgba(79, 150, 119, .08);
}

.pinned-banner.hidden {
    display: none;
}

.inline-pin-form {
    margin-top: .6rem;
}

.pin-link {
    border: 0;
    background: transparent;
    color: var(--teal-bright);
    font-weight: 700;
    padding: 0;
    cursor: pointer;
}

.voice-note-player {
    display: block;
    width: 100%;
    margin: .6rem 0;
    filter: saturate(.9);
}

.emoji-picker {
    position: relative;
}

.emoji-panel {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    display: none;
    gap: .35rem;
    grid-template-columns: repeat(5, 1fr);
    padding: .6rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(8, 18, 27, .96);
    box-shadow: var(--shadow);
    z-index: 30;
}

.emoji-panel.active {
    display: grid;
}

.emoji-panel button {
    border: 0;
    background: rgba(255,255,255,.05);
    border-radius: 12px;
    padding: .5rem;
    cursor: pointer;
    font-size: 1.05rem;
}

.dropzone-hint {
    font-size: .86rem;
    color: var(--muted);
    padding-bottom: .25rem;
}

.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    padding: .75rem .9rem;
    border-radius: 18px;
    border: 1px solid rgba(107, 195, 155, .24);
    background: rgba(79, 150, 119, .08);
}

.reply-preview.hidden {
    display: none;
}

.reply-preview strong,
.reply-snippet strong {
    display: block;
    color: var(--teal-bright);
    margin-bottom: .15rem;
}

.reply-preview span,
.reply-snippet span {
    color: var(--muted);
    font-size: .84rem;
}

.reply-cancel,
.reply-trigger {
    border: 0;
    background: transparent;
    color: var(--teal-bright);
    font-weight: 700;
    cursor: pointer;
}

.reply-snippet {
    margin-bottom: .7rem;
    padding: .65rem .8rem;
    border-left: 3px solid var(--teal-bright);
    border-radius: 12px;
    background: rgba(255,255,255,.04);
}

.composer-box.drag-active {
    border-color: rgba(107, 195, 155, .65);
    background: rgba(79, 150, 119, .08);
}

.day-divider {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.day-divider span {
    background: rgba(255,255,255,.06);
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 999px;
    padding: .35rem .8rem;
    font-size: .8rem;
}

.delivery-marker {
    margin-top: .45rem;
    color: var(--muted);
    font-size: .78rem;
    text-align: right;
}

.receipt-detail {
    margin-top: .2rem;
    color: var(--muted);
    font-size: .72rem;
    text-align: right;
    opacity: .9;
}

.mini-pill {
    display: inline-flex;
    align-items: center;
    padding: .5rem .8rem;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: .82rem;
    font-weight: 700;
}

.mini-request {
    display: grid;
    gap: .3rem;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: .85rem;
}

.client-meta-stack,
.rail-actions {
    display: grid;
    gap: .8rem;
}

.rail-search input {
    flex: 1;
}

.hero-panel,
.dashboard-card,
.request-panel,
.single-form-card,
.install-card,
.client-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-panel {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 2rem;
    padding: 2.5rem;
    min-height: 72vh;
    align-items: center;
}

.hero-logo {
    width: 220px;
    border-radius: 24px;
    margin-bottom: 1rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .24em;
    font-size: .72rem;
    color: var(--teal-bright);
}

h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2.2rem, 4vw, 4.6rem); line-height: 1.04; margin-bottom: 1rem; }
h2 { font-size: clamp(1.4rem, 2vw, 2.2rem); }
p { color: var(--muted); line-height: 1.6; }

.hero-actions,
.action-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.danger-btn,
.success-btn,
.text-link {
    border: 0;
    cursor: pointer;
    border-radius: 999px;
    padding: .95rem 1.3rem;
    font-weight: 700;
    transition: transform .2s ease, opacity .2s ease, background .2s ease;
}

.primary-btn { background: linear-gradient(135deg, var(--teal), var(--navy)); color: white; }
.ghost-btn { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--line); }
.danger-btn { background: linear-gradient(135deg, #b75454, #7d2d2d); color: white; }
.success-btn { background: linear-gradient(135deg, #3d9c6c, #205942); color: white; }
.text-link { padding: 0; background: transparent; color: var(--teal-bright); }
.primary-btn:hover, .ghost-btn:hover, .danger-btn:hover, .success-btn:hover { transform: translateY(-1px); }
.full-width { width: 100%; text-align: center; justify-content: center; display: inline-flex; }

.hero-orbit { display: grid; gap: 1rem; }
.orbit-card {
    background: rgba(10, 22, 33, 0.75);
    border: 1px solid rgba(107, 195, 155, 0.22);
    padding: 1.2rem;
    border-radius: 22px;
}
.orbit-card span { display: block; color: var(--teal-bright); margin-bottom: .45rem; }
.floating-card { animation: float 5s ease-in-out infinite; }
.delay-1 { animation-delay: .7s; }
.delay-2 { animation-delay: 1.4s; }

.setup-key-box {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px dashed rgba(107, 195, 155, .35);
    background: rgba(79, 150, 119, .08);
}

.request-panel,
.single-form-card,
.install-card {
    margin-top: 2rem;
    padding: 2rem;
}

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

.grid-form label {
    display: grid;
    gap: .55rem;
    color: var(--muted);
    font-size: .96rem;
}

.grid-form input,
.grid-form textarea,
.grid-form select,
.chat-form textarea,
.chat-form input[type="file"] {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(141, 183, 203, 0.16);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: .95rem 1rem;
    font: inherit;
}

.span-2 { grid-column: span 2; }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 13, 0.76);
    display: none;
    place-items: center;
    padding: 1rem;
    z-index: 900;
}

.modal.active { display: grid; }

.modal-card {
    width: min(720px, 100%);
    background: rgba(9, 20, 31, 0.96);
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 2rem;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    color: white;
    border: 0;
    font-size: 2rem;
    cursor: pointer;
}

.role-switch,
.client-list,
.sidebar-nav,
.dashboard-stats,
.quick-replies,
.inline-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.role-tab,
.client-pill,
.sidebar-nav a,
.chat-thread {
    padding: .9rem 1rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.04);
}

.role-tab.active,
.client-pill.active,
.chat-thread.active {
    border-color: rgba(107, 195, 155, .55);
    background: rgba(79, 150, 119, .12);
}

.role-panel { display: none; margin-top: 1rem; }
.role-panel.active { display: grid; gap: 1rem; }

.dashboard-shell,
.client-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

.dashboard-sidebar,
.client-sidebar {
    position: sticky;
    top: 1rem;
    align-self: start;
    background: rgba(9, 22, 34, 0.88);
    border: 1px solid var(--line);
    border-radius: 26px;
    padding: 1.4rem;
    box-shadow: var(--shadow);
}

.brand-inline {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.brand-inline img {
    width: 72px;
    border-radius: 18px;
}

.sidebar-nav { margin: 1.5rem 0; }
.sidebar-nav a { width: 100%; }

.dashboard-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.stat-card,
.request-card,
.empty-state,
.chat-thread,
.client-pill,
.message-bubble {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
}

.stat-card {
    min-width: 160px;
    padding: 1rem;
    border-radius: 18px;
}

.stat-card span,
.chat-thread span,
.chat-thread small,
.client-pill span { display: block; color: var(--muted); }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.15fr .95fr;
    gap: 1.5rem;
}

.dashboard-card { padding: 1.5rem; }
.dashboard-section { margin-bottom: 1.5rem; }
.table-stack { display: grid; gap: 1rem; }

.request-card {
    padding: 1rem 1.2rem;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.client-list { margin: 1rem 0 1.4rem; }

.client-pill,
.chat-thread {
    display: grid;
    gap: .2rem;
}

.chat-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1rem;
}

.chat-sidebar,
.message-stream {
    display: grid;
    gap: .85rem;
    align-content: start;
}

.message-stream {
    min-height: 440px;
    max-height: 560px;
    overflow: auto;
    padding-right: .4rem;
}

.message-bubble {
    border-radius: 20px;
    padding: 1rem;
}

.message-bubble header {
    display: flex;
    justify-content: space-between;
    gap: .8rem;
    margin-bottom: .4rem;
    color: var(--muted);
    font-size: .88rem;
}

.from-admin { border-left: 4px solid var(--teal-bright); }
.from-client { border-left: 4px solid #7fb4d8; }
.self { background: rgba(79, 150, 119, .12); }

.chat-form { display: grid; gap: .8rem; margin-top: 1rem; }
.quick-reply {
    border: 1px solid var(--line);
    background: rgba(79, 150, 119, .09);
    color: var(--text);
    border-radius: 999px;
    padding: .65rem 1rem;
    cursor: pointer;
}
.compact-form { margin-bottom: 1rem; }
.badge {
    display: inline-block;
    min-width: 1.4rem;
    padding: .15rem .45rem;
    border-radius: 999px;
    background: var(--teal-bright);
    color: #052033;
    font-size: .75rem;
    text-align: center;
}
.priority-urgent { border-left: 4px solid #ff8d6b; }
.priority-high { border-left: 4px solid #f5c25e; }
.priority-normal { border-left: 4px solid #6bc39b; }
.priority-low { border-left: 4px solid #7fb4d8; }
.two-factor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.two-factor-card {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1rem;
}
.qr-code {
    width: 220px;
    max-width: 100%;
    background: white;
    padding: .5rem;
    border-radius: 16px;
}
.secret-code {
    display: block;
    background: rgba(255,255,255,.05);
    border-radius: 12px;
    padding: .9rem 1rem;
    margin-bottom: 1rem;
    word-break: break-all;
}

.attachment-link {
    color: var(--teal-bright);
    font-weight: 600;
}

.inline-image-preview {
    display: block;
    margin: .6rem 0;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    max-width: min(280px, 100%);
}

.inline-image-preview img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.attachment-gallery-panel {
    display: grid;
    gap: .8rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255,255,255,.03);
}

.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.attachment-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .85rem;
}

.gallery-card {
    display: grid;
    gap: .6rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.04);
    overflow: hidden;
}

.gallery-preview {
    display: grid;
    min-height: 120px;
    background: rgba(255,255,255,.04);
}

.gallery-preview img {
    width: 100%;
    height: 100%;
    min-height: 120px;
    object-fit: cover;
}

.gallery-audio-badge,
.gallery-file-badge {
    display: grid;
    place-items: center;
    min-height: 120px;
    font-weight: 700;
    color: var(--text);
    background: linear-gradient(135deg, rgba(79, 150, 119, .18), rgba(18, 51, 76, .22));
}

.gallery-meta {
    display: grid;
    gap: .15rem;
    padding: 0 .85rem .85rem;
}

.gallery-meta span,
.gallery-empty {
    color: var(--muted);
    font-size: .84rem;
}

.gallery-empty {
    border: 1px dashed var(--line);
    border-radius: 18px;
    padding: 1rem;
}

.story-strip {
    display: flex;
    gap: .85rem;
    overflow-x: auto;
    padding-bottom: .2rem;
}

.story-card {
    min-width: 86px;
    border: 0;
    background: transparent;
    color: var(--text);
    display: grid;
    gap: .45rem;
    justify-items: center;
    cursor: pointer;
}

.story-card small {
    width: 86px;
    color: var(--muted);
    font-size: .76rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.story-ring {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    padding: 3px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--teal-bright), #7fb4d8, var(--navy));
}

.story-ring img,
.story-icon {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.story-ring img {
    object-fit: cover;
    border: 3px solid #07141f;
}

.story-icon {
    display: grid;
    place-items: center;
    background: #0f2435;
    color: var(--text);
    font-size: .82rem;
    border: 3px solid #07141f;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 8, 14, .88);
    backdrop-filter: blur(18px);
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.lightbox-overlay.hidden {
    display: none;
}

.lightbox-dialog {
    width: min(960px, 100%);
    max-height: calc(100vh - 2.5rem);
    display: grid;
    gap: 1rem;
}

.lightbox-stage {
    min-height: 320px;
    max-height: calc(100vh - 11rem);
    display: grid;
    place-items: center;
    border-radius: 28px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.03);
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 12rem);
    object-fit: contain;
}

.lightbox-audio-shell,
.lightbox-file-shell {
    width: min(520px, 100%);
    display: grid;
    gap: 1rem;
    justify-items: center;
    text-align: center;
    padding: 2rem;
}

.lightbox-audio {
    width: 100%;
}

.lightbox-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.05);
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.08);
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

.mobile-bottom-nav {
    display: none;
}

.status-pill {
    display: inline-block;
    border-radius: 999px;
    padding: .2rem .6rem;
    font-size: .8rem;
    font-weight: 700;
}

.status-pill.paid { background: rgba(81, 185, 130, .18); color: #80ddb0; }
.status-pill.unpaid { background: rgba(217, 106, 106, .18); color: #ffaaaa; }

.invoice-body {
    background: #edf3f7;
    color: #173246;
    padding: 2rem;
}

.invoice-sheet {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 18px 40px rgba(0,0,0,.12);
}

.invoice-logo { width: 180px; margin-bottom: 1rem; }

.invoice-header,
.invoice-grid,
.invoice-footer {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.invoice-grid { margin: 2rem 0; }

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.invoice-table th,
.invoice-table td {
    padding: 1rem;
    border-bottom: 1px solid #d9e5ec;
    text-align: left;
}

.invoice-watermark {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-24deg);
    font-size: 7rem;
    font-weight: 900;
    color: rgba(81, 185, 130, .14);
    letter-spacing: .2em;
}

.empty-state {
    padding: 1rem 1.2rem;
    border-radius: 18px;
    color: var(--muted);
}

.install-body { background: linear-gradient(135deg, #061019, #12334c); }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

@media (max-width: 1080px) {
    .hero-panel,
    .dashboard-shell,
    .client-shell,
    .dashboard-grid,
    .chat-layout,
    .two-factor-grid,
    .chat-app-shell,
    .admin-chat-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar,
    .client-sidebar { position: static; }
    .chat-main-panel { min-height: auto; }
}

@media (max-width: 720px) {
    .grid-form,
    .dashboard-header,
    .request-card,
    .invoice-header,
    .invoice-grid,
    .invoice-footer {
        grid-template-columns: 1fr;
        display: grid;
    }

    .span-2 { grid-column: span 1; }
    .hero-panel,
    .dashboard-card,
    .request-panel,
    .single-form-card,
    .install-card,
    .invoice-sheet,
    .chat-left-rail,
    .chat-main-panel { padding: 1.25rem; }
    h1 { font-size: 2rem; }
    .modern-bubble { max-width: 100%; }
    .chat-intro-banner,
    .composer-actions,
    .chat-topbar { display: grid; }
    .composer-shortcuts {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .file-chip {
        justify-content: center;
        width: 100%;
        padding: .85rem .8rem;
    }
    .attachment-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .mobile-composer-actions {
        grid-template-columns: 1fr;
    }
    .chat-stage {
        padding-bottom: 6.5rem;
    }
    .floating-mobile-composer {
        position: sticky;
        bottom: .75rem;
        z-index: 20;
        border-radius: 28px;
        border-color: rgba(107, 195, 155, .26);
        background: rgba(7, 20, 31, .94);
        box-shadow: 0 24px 50px rgba(0, 0, 0, .34);
    }
    .floating-mobile-composer textarea {
        min-height: 54px;
        max-height: 180px;
        border-radius: 18px;
        background: rgba(255,255,255,.04);
        padding: .9rem 1rem;
    }
    .composer-status-text {
        min-width: 0;
    }
    .chat-toolbar {
        gap: .75rem;
    }
    .lightbox-caption {
        display: grid;
    }
    .mobile-panel {
        display: none;
    }
    .mobile-panel.active {
        display: grid;
    }
    .mobile-bottom-nav {
        position: fixed;
        left: .75rem;
        right: .75rem;
        bottom: .75rem;
        z-index: 50;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: .5rem;
        padding: .55rem;
        border-radius: 24px;
        border: 1px solid var(--line);
        background: rgba(7, 20, 31, .95);
        box-shadow: 0 24px 50px rgba(0, 0, 0, .34);
    }
    .client-chat-shell + .mobile-bottom-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .mobile-nav-btn {
        border: 0;
        border-radius: 16px;
        padding: .8rem .55rem;
        background: rgba(255,255,255,.05);
        color: var(--muted);
        font: inherit;
        font-weight: 700;
    }
    .mobile-nav-btn.active {
        background: linear-gradient(135deg, rgba(79, 150, 119, .26), rgba(18, 51, 76, .5));
        color: var(--text);
    }
}

@media print {
    body { background: white; }
    .no-print { display: none; }
    .invoice-sheet { box-shadow: none; border-radius: 0; max-width: none; }
}
