/* ==========================================
   CADENCEA AI
   Premium Black / Grey / Orange UI
   Mobile First Design
========================================== */


/* ==========================================
   VARIABLES
========================================== */

:root {

    --bg: #0b0b0b;

    --surface: #121212;
    --surface-2: #191919;
    --surface-3: #222222;

    --text: #f5f5f5;
    --text-light: #999999;

    --border: rgba(255,255,255,.08);

    --accent: #ff7900;
    --accent2: #ff9a3d;

    --assistant: #191919;
    --user: #292019;

    --orange-glow: rgba(255,121,0,.18);

    --shadow: 0 15px 45px rgba(0,0,0,.35);

}


/* LIGHT THEME */

body:not(.dark){

    --bg: #f4f4f4;

    --surface: #ffffff;
    --surface-2: #eeeeee;
    --surface-3: #e4e4e4;

    --text: #171717;
    --text-light: #777777;

    --border: rgba(0,0,0,.09);

    --assistant: #ffffff;
    --user: #fff0e4;

}


/* ==========================================
   RESET
========================================== */

* {

    margin: 0;
    padding: 0;

    box-sizing: border-box;

    font-family: "Inter", sans-serif;

}

html,
body {

    width: 100%;
    height: 100%;

    overflow: hidden;

}

body {

    background: var(--bg);

    color: var(--text);

    transition: background .25s, color .25s;

    -webkit-font-smoothing: antialiased;

}

button {

    border: none;
    outline: none;

    cursor: pointer;

    color: inherit;

    -webkit-tap-highlight-color: transparent;

}

img {

    max-width: 100%;

    display: block;

}

::selection {

    background: var(--accent);

    color: white;

}


/* ==========================================
   BACKGROUND
========================================== */

.background {

    position: fixed;

    inset: 0;

    z-index: -1;

    background:
        radial-gradient(
            ellipse at 50% -18%,
            rgba(214, 170, 122, .075),
            transparent 46%
        ),
        radial-gradient(
            ellipse at 100% 100%,
            rgba(80, 95, 115, .065),
            transparent 38%
        ),
        linear-gradient(
            145deg,
            #08090a 0%,
            #111214 52%,
            #090a0c 100%
        );

    pointer-events: none;

}

body:not(.dark) .background {
    background:
        radial-gradient(
            ellipse at 50% -18%,
            rgba(174, 136, 98, .09),
            transparent 48%
        ),
        linear-gradient(
            145deg,
            #f8f7f4 0%,
            #efeee9 52%,
            #faf9f6 100%
        );
}


/* ==========================================
   APP
========================================== */

.app {

    width: 100%;

    height: 100dvh;

    display: flex;

    flex-direction: column;

    overflow: hidden;

}


/* ==========================================
   HEADER
========================================== */

header {

    height: 76px;

    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 6%;

    border-bottom: 1px solid var(--border);

    background: rgba(12,12,12,.85);

    backdrop-filter: blur(20px);

    z-index: 10;

}

body:not(.dark) header {

    background: rgba(255,255,255,.85);

}


/* BRAND */

.header-brand {

    display: flex;

    align-items: center;

    gap: 13px;

    min-width: 0;

}

.brand-mark {

    width: 43px;
    height: 43px;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 14px;

    background: linear-gradient(
        135deg,
        #ff7900,
        #ff9a3d
    );

    color: white;

    font-size: 23px;

    font-weight: 800;

    box-shadow: 0 5px 22px var(--orange-glow);

    flex-shrink: 0;

}

.brand-mark span {

    font-weight: 800;

}

.brand h1 {

    font-size: 21px;

    font-weight: 700;

    letter-spacing: -.8px;

}

.brand h1 span {

    color: var(--accent);

}

.brand p {

    margin-top: 4px;

    font-size: 11px;

    color: var(--text-light);

}


/* HEADER ACTIONS */

.header-actions {

    display: flex;

    align-items: center;

    gap: 15px;

}

.status-indicator {

    display: flex;

    align-items: center;

    gap: 7px;

    color: var(--text-light);

    font-size: 12px;

}

.status-indicator span {

    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #22c55e;

    box-shadow: 0 0 10px rgba(34,197,94,.5);

}


/* PROFILE */

.profile {

    width: 37px;
    height: 37px;

    border-radius: 50%;

    overflow: hidden;

    border: 1px solid var(--border);

    background: var(--surface-2);

    flex-shrink: 0;

}

.profile img {

    width: 100%;
    height: 100%;

    object-fit: cover;

}


/* THEME BUTTON */

#themeToggle {

    width: 38px;
    height: 38px;

    border-radius: 12px;

    background: var(--surface-2);

    font-size: 19px;

    transition: .2s;

}

#themeToggle:hover {

    background: var(--surface-3);

    color: var(--accent);

}


/* ==========================================
   MAIN CHAT
========================================== */

main {

    flex: 1;

    min-height: 0;

    overflow-y: auto;

    overflow-x: hidden;

    display: flex;

    flex-direction: column;

    gap: 22px;

    padding: 35px 8%;

    scroll-behavior: auto;

}


/* SCROLLBAR */

* {

    scrollbar-width: thin;

    scrollbar-color: #444 transparent;

}

::-webkit-scrollbar {

    width: 6px;
    height: 6px;

}

::-webkit-scrollbar-thumb {

    background: #444;

    border-radius: 20px;

}

::-webkit-scrollbar-track {

    background: transparent;

}


/* ==========================================
   GREETING
========================================== */

.greeting {

    width: 100%;

    max-width: 650px;

    margin: auto;

    text-align: center;

    padding: 35px 10px;

    animation: fadeIn .6s ease;

}

.greeting-icon {

    width: 68px;
    height: 68px;

    display: flex;

    align-items: center;

    justify-content: center;

    margin: 0 auto 24px;

    border-radius: 22px;

    background: linear-gradient(
        135deg,
        #ff7900,
        #ff9a3d
    );

    box-shadow: 0 10px 45px var(--orange-glow);

    color: white;

    font-size: 34px;

    font-weight: 800;

}

.greeting-label {

    display: inline-block;

    color: var(--accent);

    font-size: 10px;

    font-weight: 700;

    letter-spacing: 2px;

    margin-bottom: 17px;

}

.greeting h2 {

    font-size: clamp(30px, 5vw, 47px);

    line-height: 1.18;

    letter-spacing: -2px;

    font-weight: 700;

}

.greeting h2 span {

    background: linear-gradient(
        90deg,
        #ff7900,
        #ffb36f
    );

    -webkit-background-clip: text;

    background-clip: text;

    color: transparent;

}

.greeting > p {

    max-width: 470px;

    margin: 19px auto 30px;

    color: var(--text-light);

    font-size: 14px;

    line-height: 1.8;

}


/* SUGGESTIONS */

.suggestion-list {

    display: flex;

    flex-wrap: wrap;

    justify-content: center;

    gap: 10px;

}

.suggestion-card {

    padding: 12px 15px;

    display: flex;

    align-items: center;

    gap: 9px;

    border-radius: 12px;

    border: 1px solid var(--border);

    background: var(--surface);

    color: var(--text-light);

    font-size: 12px;

    transition: .2s;

}

.suggestion-card:hover {

    border-color: var(--accent);

    color: var(--text);

    transform: translateY(-3px);

}

.suggestion-icon {

    color: var(--accent);

    font-size: 16px;

}


/* ==========================================
   CHAT MESSAGES
========================================== */

.message {

    position: relative;

    display: flex;

    flex-direction: column;

    gap: 10px;

    width: fit-content;

    max-width: min(78%, 750px);

    padding: 17px 19px;

    border-radius: 18px;

    font-size: 14px;

    line-height: 1.8;

    word-break: break-word;

    overflow-wrap: anywhere;

    flex-shrink: 0;

    animation: messageIn .25s ease;

}

@keyframes messageIn {

    from {

        opacity: 0;

        transform: translateY(10px);

    }

    to {

        opacity: 1;

        transform: translateY(0);

    }

}


/* AI */

.ai {

    align-self: flex-start;

    background: var(--assistant);

    border: 1px solid var(--border);

    color: var(--text);

    border-top-left-radius: 5px;

}


/* USER */

.user {

    align-self: flex-end;

    background: var(--user);

    border: 1px solid rgba(255,121,0,.18);

    color: var(--text);

    border-top-right-radius: 5px;

}


/* MESSAGE CONTENT */

.message-content {

    width: 100%;

    min-width: 0;

    overflow-wrap: anywhere;

}

.message-content > *:first-child {

    margin-top: 0;

}

.message-content > *:last-child {

    margin-bottom: 0;

}

.message-content p {

    margin: 10px 0;

}

.message-content h1,
.message-content h2,
.message-content h3 {

    margin: 17px 0 10px;

    line-height: 1.35;

}

.message-content ul,
.message-content ol {

    padding-left: 23px;

    margin: 12px 0;

}

.message-content li {

    margin: 6px 0;

}

.message-content blockquote {

    border-left: 3px solid var(--accent);

    padding-left: 14px;

    margin: 15px 0;

    color: var(--text-light);

}

.message-content a {

    color: var(--accent2);

    text-decoration: none;

}

.message-content a:hover {

    text-decoration: underline;

}

.message-content hr {

    border: none;

    border-top: 1px solid var(--border);

    margin: 18px 0;

}


/* CODE */

.message pre {

    background: #090909;

    border: 1px solid rgba(255,255,255,.08);

    border-radius: 12px;

    padding: 15px;

    overflow-x: auto;

    margin: 14px 0;

    max-width: 100%;

}

.message pre code {

    background: none;

    padding: 0;

    color: #f5f5f5;

    font-family: monospace;

    font-size: 13px;

}

.message code {

    background: rgba(255,121,0,.12);

    color: var(--accent2);

    padding: 3px 6px;

    border-radius: 5px;

    font-family: monospace;

    font-size: .92em;

}


/* TABLES */

.message-content table {

    display: block;

    max-width: 100%;

    overflow-x: auto;

    border-collapse: collapse;

    margin: 15px 0;

}

.message-content th,
.message-content td {

    border: 1px solid var(--border);

    padding: 9px 12px;

    text-align: left;

}

.message-content th {

    background: rgba(255,121,0,.12);

}


/* IMAGES */

.chat-image {

    display: block;

    max-width: 320px;

    width: 100%;

    height: auto;

    border-radius: 13px;

    object-fit: contain;

}

.message-content img {

    border-radius: 12px;

}


/* COPY BUTTON */

.copy-btn {

    width: 34px;
    height: 34px;

    border-radius: 9px;

    background: var(--surface-2);

    display: flex;

    align-items: center;

    justify-content: center;

}

.copy-btn:hover {

    color: var(--accent);

    background: var(--surface-3);

}

.copy-icon {

    width: 17px;
    height: 17px;

}

.message-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 1px;
}

.message-actions .copy-btn,
.response-action-btn {
    min-height: 32px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text-light);
    font-size: 11px;
    font-weight: 600;
    transition: color .16s, background .16s, border-color .16s;
}

.message-actions .copy-btn {
    width: 34px;
    height: 32px;
    padding: 0;
    cursor: pointer;
}

.response-action-btn {
    padding: 0 10px;
}

.message-actions .copy-btn:hover,
.response-action-btn:hover {
    border-color: rgba(214, 170, 122, .38);
    background: var(--surface-3);
    color: var(--text);
}

.report-dialog {
    width: min(520px, calc(100vw - 28px));
    max-height: min(86dvh, 760px);
    overflow: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 90px rgba(0, 0, 0, .48);
}

.report-dialog::backdrop {
    background: rgba(0, 0, 0, .62);
    backdrop-filter: blur(4px);
}

.report-dialog form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
}

.report-dialog-header h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -.02em;
}

.report-dialog-header p {
    margin: 6px 0 4px;
    color: var(--text-light);
    font-size: 12px;
    line-height: 1.5;
}

.report-field-label {
    margin-top: 4px;
    color: var(--text-light);
    font-size: 11px;
    font-weight: 650;
}

.report-response-preview {
    max-height: 180px;
    overflow: auto;
    margin: 0;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

#reportDetails {
    width: 100%;
    min-height: 88px;
    max-height: 200px;
    resize: vertical;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
}

#reportDetails:focus {
    border-color: rgba(214, 170, 122, .55);
}

.report-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 5px;
}

.report-dialog-actions button {
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
}

.report-dialog-actions .report-open-email-button {
    border-color: transparent;
    background: linear-gradient(135deg, #ff7900, #ff9a3d);
    color: #fff;
}


/* ==========================================
   INPUT AREA
========================================== */

footer {

    flex-shrink: 0;

    position: relative;

    padding: 15px 8% 12px;

    background: rgba(11,11,11,.92);

    border-top: 1px solid var(--border);

    backdrop-filter: blur(20px);

}

body:not(.dark) footer {

    background: rgba(255,255,255,.92);

}


/* INPUT CONTAINER */

.input-container {

    width: 100%;

    max-width: 850px;

    margin: auto;

    display: flex;

    align-items: flex-end;

    gap: 10px;

    padding: 9px;

    border: 1px solid rgba(255,255,255,.11);

    border-radius: 19px;

    background: #171717;

    box-shadow: 0 8px 35px rgba(0,0,0,.25);

    transition: .2s;

}

bbody:not(.dark) .input-container {

    background: #ffffff;

}

.input-container:focus-within {

    border-color: rgba(255,121,0,.55);

    box-shadow: 0 0 0 3px rgba(255,121,0,.08);

}


/* TEXTAREA */

textarea {

    flex: 1;

    min-width: 0;

    min-height: 44px;

    max-height: 160px;

    resize: none;

    padding: 12px 7px;

    border: none;

    outline: none;

    background: transparent;

    color: var(--text);

    font-size: 14px;

    line-height: 1.5;

}

textarea::placeholder {

    color: #777;

}


/* INPUT BUTTONS */

#attach,
#send {

    width: 43px;
    height: 43px;

    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 12px;

    background: transparent;

    transition: .2s;

}

#attach:hover {

    background: var(--surface-3);

    color: var(--accent);

}

#send {

    background: linear-gradient(
        135deg,
        #ff7900,
        #ff9a3d
    );

    color: white;

    box-shadow: 0 4px 15px var(--orange-glow);

}

#send:hover {

    transform: translateY(-2px);

    box-shadow: 0 7px 22px var(--orange-glow);

}

#send {
    position: relative;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.voice-hold-wave {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.voice-hold-wave i {
    width: 3px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    transform: scaleY(.55);
}

#send.voice-recording {
    background: linear-gradient(135deg, #f04b32, #ff7900);
    box-shadow: 0 0 0 5px rgba(255, 111, 50, .16), 0 0 26px rgba(255, 111, 50, .72);
    animation: voice-send-glow .8s ease-in-out infinite alternate;
}

#send.voice-recording .footer-icon {
    display: none;
}

#send.voice-recording .voice-hold-wave {
    display: flex;
}

#send.voice-recording .voice-hold-wave i {
    animation: voice-wave .48s ease-in-out infinite alternate;
}

#send.voice-recording .voice-hold-wave i:nth-child(2),
#send.voice-recording .voice-hold-wave i:nth-child(4) {
    animation-delay: .12s;
}

#send.voice-recording .voice-hold-wave i:nth-child(3) {
    animation-delay: .24s;
}

#send.voice-recording .voice-hold-wave i:nth-child(5) {
    animation-delay: .18s;
}

#send.voice-transcribing {
    cursor: wait;
    opacity: .7;
}

@keyframes voice-wave {
    to { transform: scaleY(1.9); }
}

@keyframes voice-send-glow {
    to { box-shadow: 0 0 0 8px rgba(255, 111, 50, .1), 0 0 34px rgba(255, 111, 50, .9); }
}

#send[hidden],
#stopResponse[hidden] {
    display: none !important;
}

#stopResponse {
    min-width: 76px;
    height: 43px;
    padding: 0 13px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 12px;
    background: rgba(255, 255, 255, .045);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    transition: background .2s, border-color .2s, opacity .2s;
}

#stopResponse:hover:not(:disabled) {
    background: rgba(255, 255, 255, .09);
    border-color: rgba(255, 255, 255, .22);
}

#stopResponse:disabled {
    cursor: wait;
    opacity: .65;
}

.stop-response-icon {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    background: currentColor;
}

body:not(.dark) #stopResponse {
    border-color: rgba(0, 0, 0, .12);
    background: rgba(0, 0, 0, .035);
}

body:not(.dark) #stopResponse:hover:not(:disabled) {
    background: rgba(0, 0, 0, .075);
    border-color: rgba(0, 0, 0, .2);
}

.response-status {
    align-self: flex-end;
    color: var(--text-light);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.footer-icon {

    width: 21px;
    height: 21px;

    object-fit: contain;

}


/* FOOTER NOTE */

.footer-note {

    text-align: center;

    color: var(--text-light);

    font-size: 10px;

    margin-top: 10px;

}


/* ==========================================
   ATTACHMENT MENU
========================================== */

.attachment-wrapper {

    position: relative;

    flex-shrink: 0;

}

.attach-menu {

    position: absolute;

    left: 0;

    bottom: calc(100% + 12px);

    display: flex;

    flex-direction: column;

    gap: 7px;

    padding: 9px;

    border-radius: 15px;

    background: var(--surface-2);

    border: 1px solid var(--border);

    box-shadow: var(--shadow);

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transform: translateY(8px);

    transition: .2s;

    z-index: 9999;

    width: min(268px, calc(100vw - 28px));

}

.attach-menu.show {

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

    transform: translateY(0);

}

.attach-menu button {

    width: 42px;
    height: 42px;

    border-radius: 11px;

    background: var(--surface-3);

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 21px;

    color: var(--text);

}

.attach-menu button:hover {

    background: var(--accent);

    color: white;

}

.task-menu-selector {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.task-menu-selector label {
    color: var(--text-light);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
}

#taskMode {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    font-weight: 650;
}

.audio-file-picker,
.attach-menu .audio-file-picker {
    width: 100%;
    min-height: 34px;
    height: auto;
    justify-content: center;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 11px;
    font-weight: 650;
}

.audio-file-picker[hidden] { display: none !important; }

.attachment-file-actions {
    display: grid;
    grid-template-columns: repeat(3, 42px);
    justify-content: center;
    gap: 8px;
    padding: 3px 0;
}

.attachment-file-actions button {
    width: 42px;
    height: 42px;
}

.menu-icon {

    width: 21px;
    height: 21px;

}


/* ==========================================
   IMAGE PREVIEW
========================================== */

#imagePreview {

    position: absolute;

    left: 8%;

    bottom: calc(100% + 10px);

    display: flex;

    align-items: center;

    gap: 8px;

    z-index: 100;

}

#imagePreview img,
.preview-image {

    width: 75px;
    height: 75px;

    object-fit: cover;

    border-radius: 12px;

    border: 2px solid var(--accent);

}

.image-preview-item {
    position: relative;
    width: 75px;
    height: 75px;
    flex: 0 0 75px;
}

#imagePreview .image-preview-item .preview-image {
    display: block;
    width: 100%;
    height: 100%;
}

#imagePreview .image-preview-remove {
    position: absolute;
    top: -7px;
    right: -7px;
    display: grid;
    width: 25px;
    height: 25px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .75);
    border-radius: 50%;
    background: #252525;
    color: #fff;
    font: 700 18px/1 Arial, sans-serif;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .28);
}

#imagePreview .image-preview-remove:hover {
    background: var(--accent);
}

.document-preview-card {
    display: flex;
    min-width: 0;
    max-width: min(290px, calc(100vw - 32px));
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text);
    box-shadow: var(--shadow);
}

.document-preview-icon {
    display: grid;
    width: 34px;
    height: 38px;
    flex: 0 0 34px;
    place-items: center;
    border: 1px solid rgba(255, 121, 0, .24);
    border-radius: 8px;
    background: rgba(255, 121, 0, .1);
    color: var(--accent2);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .04em;
}

.document-preview-name {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-memory-note {
    width: min(225px, calc(100vw - 130px));
    margin: 0;
    color: var(--text-light);
    font-size: 10px;
    line-height: 1.4;
}


/* ==========================================
   TYPING INDICATOR
========================================== */

.typing {

    display: flex;

    align-items: center;

    gap: 6px;

    min-height: 18px;

}

.typing span {

    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--accent);

    animation: bounce 1.2s infinite;

}

.typing span:nth-child(2) {

    animation-delay: .2s;

}

.typing span:nth-child(3) {

    animation-delay: .4s;

}

@keyframes bounce {

    0%, 60%, 100% {

        transform: translateY(0);

        opacity: .4;

    }

    30% {

        transform: translateY(-7px);

        opacity: 1;

    }

}


/* ==========================================
   LOGIN OVERLAY
========================================== */

.welcome-overlay {

    position: fixed;

    inset: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 20px;

    background: rgba(0,0,0,.78);

    backdrop-filter: blur(15px);

    z-index: 99999;

}

.welcome-box {

    width: min(410px, 100%);

    padding: 38px 30px;

    text-align: center;

    border-radius: 24px;

    background: #151515;

    border: 1px solid rgba(255,255,255,.09);

    box-shadow: 0 25px 90px rgba(0,0,0,.6);

    animation: popup .35s ease;

}

body:not(.dark) .welcome-box {

    background: #ffffff;

}

.brand-mark.large {

    width: 78px;
    height: 78px;

    border-radius: 23px;

    font-size: 42px;

    margin: 0 auto 25px;

}

.welcome-box h2 {

    font-size: 31px;

    margin-bottom: 12px;

    letter-spacing: -1px;

}

.welcome-box h2 span {

    color: var(--accent);

}

.welcome-box p {

    color: var(--text-light);

    font-size: 13px;

    line-height: 1.8;

    margin: 15px 0 25px;

}

.welcome-box button {

    width: 100%;

    height: 53px;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 12px;

    border-radius: 13px;

    background: #ffffff;

    color: #171717;

    font-size: 14px;

    font-weight: 600;

    transition: .2s;

}

.welcome-box button:hover {

    transform: translateY(-2px);

    box-shadow: 0 8px 25px rgba(255,255,255,.12);

}

.login-note {

    color: var(--text-light);

    font-size: 10px;

    margin-top: 17px;

}

.welcome-box .install-app-button {

    margin-top: 18px;
    background: linear-gradient(135deg, #ff7900, #ff9a3d);
    color: #fff;
    box-shadow: 0 8px 24px rgba(255, 121, 0, .2);

}

.welcome-box .install-app-button[hidden],
.install-app-help[hidden] {

    display: none;

}

.welcome-box .install-app-help {

    margin: 14px 0 0;
    color: var(--text-light);
    font-size: 11px;
    line-height: 1.6;

}

@keyframes popup {

    from {

        opacity: 0;

        transform: scale(.94);

    }

    to {

        opacity: 1;

        transform: scale(1);

    }

}


/* ==========================================
   ANIMATIONS
========================================== */

@keyframes fadeIn {

    from {

        opacity: 0;

        transform: translateY(12px);

    }

    to {

        opacity: 1;

        transform: translateY(0);

    }

}

button,
textarea {

    transition:
        background .2s,
        color .2s,
        border-color .2s,
        transform .2s,
        box-shadow .2s;

}

button:active {

    transform: scale(.96);

}


/* ==========================================
   TABLET
========================================== */

@media (max-width: 768px) {

    header {

        padding: 0 20px;

    }

    main {

        padding: 25px 5%;

    }

    footer {

        padding-left: 5%;
        padding-right: 5%;

    }

    .message {

        max-width: 88%;

    }

}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 480px) {

    header {

        height: 64px;

        padding: 0 13px;

    }

    .header-brand {

        gap: 9px;

    }

    .brand-mark {

        width: 36px;
        height: 36px;

        border-radius: 11px;

        font-size: 19px;

    }

    .brand h1 {

        font-size: 17px;

    }

    .brand p {

        font-size: 10px;

    }

    .header-actions {

        gap: 9px;

    }

    .status-indicator {

        display: none;

    }

    .profile {

        width: 33px;
        height: 33px;

    }

    #themeToggle {

        width: 34px;
        height: 34px;

        font-size: 17px;

    }


    /* CHAT */

    main {

        padding: 19px 13px;

        gap: 14px;

    }

    .greeting {

        padding: 20px 4px;

    }

    .greeting-icon {

        width: 57px;
        height: 57px;

        font-size: 28px;

        border-radius: 18px;

        margin-bottom: 21px;

    }

    .greeting h2 {

        font-size: 31px;

        letter-spacing: -1.4px;

    }

    .greeting > p {

        font-size: 12px;

        line-height: 1.7;

        margin: 16px auto 23px;

    }

    .suggestion-list {

        gap: 8px;

    }

    .suggestion-card {

        font-size: 11px;

        padding: 10px 11px;

    }


    /* MESSAGES */

    .message {

        max-width: 94%;

        padding: 13px 14px;

        font-size: 13px;

        line-height: 1.7;

        border-radius: 15px;

    }

    .chat-image {

        max-width: 100%;

    }


    /* INPUT */

    footer {

        padding: 10px 10px max(10px, env(safe-area-inset-bottom));

    }

    .input-container {

        gap: 5px;

        padding: 6px;

        border-radius: 16px;

    }

    #attach,
    #send {

        width: 37px;
        height: 40px;

        border-radius: 10px;

    }

    #stopResponse {
        min-width: 58px;
        height: 38px;
        padding: 0 9px;
        gap: 6px;
        font-size: 11px;
    }

    .footer-icon {

        width: 19px;
        height: 19px;

    }

    textarea {

        min-height: 40px;

        max-height: 120px;

        padding: 10px 4px;

        font-size: 13px;

    }

    .footer-note {

        font-size: 9px;

        margin-top: 8px;

    }


    /* PREVIEW */

    #imagePreview {

        left: 10px;

        bottom: calc(100% + 10px);

    }

    #imagePreview img,
    .preview-image {

        width: 62px;
        height: 62px;

    }

    .image-preview-item {
        width: 62px;
        height: 62px;
        flex-basis: 62px;
    }


    /* LOGIN */

    .welcome-box {

        padding: 30px 23px;

        border-radius: 21px;

    }

    .welcome-box h2 {

        font-size: 27px;

    }

    .welcome-box p {

        font-size: 12px;

    }

}


/* ==========================================
   SMALL MOBILE
========================================== */

@media (max-width: 350px) {

    .brand p {

        display: block;
        font-size: 8px;

    }

    .header-actions {

        gap: 6px;

    }

    #attach,
    #send {

        width: 33px;

    }

    .suggestion-card {

        font-size: 10px;

        padding: 9px;

    }

}


/* ==========================================
   REDUCED MOTION
========================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {

        animation-duration: .01ms !important;

        animation-iteration-count: 1 !important;

        scroll-behavior: auto !important;

        transition-duration: .01ms !important;

    }

}
/* ==========================================
   CADENCEA AI — ALIGNMENT FIX
========================================== */

/* HEADER */
header {
    height: 68px;
    min-height: 68px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    min-width: 0;
}

.header-left {
    gap: 10px;
}

.header-right {
    gap: 12px;
}

/* BRAND GRAPHIC */
.brand-graphic {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    display: grid;
    flex: 0 0 36px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 12px;
    background:
        radial-gradient(circle at 72% 24%, rgba(255, 154, 61, .18), transparent 43%),
        linear-gradient(145deg, var(--surface-2), var(--surface));
    box-shadow: 0 5px 20px rgba(255, 121, 0, .12);
}

.brand-graphic svg {
    width: 26px;
    height: 26px;
    overflow: visible;
    filter: drop-shadow(0 2px 6px rgba(255, 121, 0, .24));
}

.brand {
    min-width: 0;
}

.brand h1 {
    font-size: 23px;
    font-weight: 750;
    line-height: 1.05;
    margin: 0;
}

.brand p {
    display: block;
    margin: 3px 0 0;
    font-size: 9px;
    line-height: 1.1;
    white-space: nowrap;
}

/* PROFILE */
.profile {
    width: 35px;
    height: 35px;
    flex-shrink: 0;
}

/* THEME BUTTON */
#themeToggle {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: grid;
    place-items: center;
}

/* CHAT */
#chat {
    width: 100%;
    max-width: 100%;
    padding: 28px  max(20px, calc((100% - 900px) / 2));
    gap: 18px;
}

/* MESSAGE ALIGNMENT */
.message {
    max-width: min(78%, 720px);
}

/* FOOTER */
footer {
    padding: 12px 20px 14px;
}

.input-container {
    max-width: 820px;
    min-height: 58px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 7px;
}

/* INPUT ICON BUTTONS */
#attach,
#send {
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.footer-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

/* MAKE ICONS CONSISTENT */
#attach img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

#send img {
    width: 19px;
    height: 19px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* ATTACHMENT MENU */
.attachment-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.attach-menu {
    left: 0;
    bottom: calc(100% + 12px);
}

.attach-menu button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
}

.menu-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* IMAGE PREVIEW */
#imagePreview {
    left: 20px;
    bottom: calc(100% + 10px);
    display: none;
}

/* GOOGLE LOGIN LOGO */
.welcome-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-icon img {
    width: 58px !important;
    height: 58px !important;
    object-fit: contain;
}

/* GOOGLE BUTTON */
#googleLogin img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

/* MOBILE */
@media (max-width: 600px) {
    header {
        height: 60px;
        min-height: 60px;
        padding: 0 12px;
    }

    .brand-graphic {
        width: 31px !important;
        height: 31px !important;
        min-width: 31px;
        flex-basis: 31px;
        border-radius: 10px;
    }

    .brand-graphic svg {
        width: 23px;
        height: 23px;
    }

    .brand h1 {
        font-size: 20px;
    }

    .header-right {
        gap: 8px;
    }

    #chat {
        padding: 18px 12px;
        gap: 14px;
    }

    .message {
        max-width: 91%;
    }

    footer {
        padding: 9px 9px max(9px, env(safe-area-inset-bottom));
    }

    .input-container {
        min-height: 52px;
        gap: 4px;
        padding: 5px;
    }

    #attach,
    #send {
        width: 36px;
        height: 38px;
        min-width: 36px;
    }

    .footer-icon {
        width: 18px;
        height: 18px;
    }

    textarea {
        min-height: 38px;
        padding: 9px 4px;
        font-size: 14px;
    }

    .welcome-icon img {
        width: 52px !important;
        height: 52px !important;
    }
}

/* Calm, glowing composer */
.input-container {
    position: relative;
    isolation: isolate;
    border-color: var(--border);
    background: var(--bg) !important;
    box-shadow: 0 8px 35px rgba(0, 0, 0, .2);
}

.input-container::before {
    position: absolute;
    z-index: -1;
    inset: -17px -20px;
    border-radius: 30px;
    background:
        radial-gradient(ellipse at 24% 50%, rgba(255, 121, 0, .28), transparent 54%),
        radial-gradient(ellipse at 78% 50%, rgba(149, 105, 255, .2), transparent 52%);
    content: "";
    filter: blur(24px);
    opacity: .65;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
}

.input-container:focus-within::before {
    opacity: .95;
    transform: scale(1.025);
}

.sent-message-flight {
    position: fixed;
    z-index: 1000;
    max-height: 100px;
    overflow: hidden;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--user);
    color: var(--text);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .3), 0 0 22px var(--orange-glow);
    font-size: 14px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    pointer-events: none;
    transform-origin: top left;
    will-change: transform, opacity;
}

.message-flight-pending {
    visibility: hidden;
}

.message-flight-arrived {
    animation: message-arrive .22s ease-out both;
}

@keyframes message-arrive {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
#imagePreview {
    animation: none !important;
    transition: none !important;
}

#imagePreview img {
    animation: none !important;
    transition: none !important;
}
.attach-menu:not(.show) {
    display: none !important;
}

.attach-menu.show {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition: none;
}/* LIGHT THEME CHAT */
body:not(.dark) #chat {
    background: #f4f4f4;
}

body:not(.dark) .message.ai {
    background: #ffffff;
    color: #171717;
    border-color: rgba(0,0,0,.10);
}

body:not(.dark) .message.user {
    background: #fff0e4;
    color: #171717;
    border-color: rgba(255,121,0,.2);
}

body:not(.dark) .input-container {
    background: #ffffff;
    border-color: rgba(0,0,0,.12);
}

body:not(.dark) textarea {
    color: #171717;
}

/* Floating navigation rail */
.sidebar {
    position: fixed;
    z-index: 30;
    top: 50%;
    left: 12px;
    width: 8px;
    height: 112px;
    overflow: hidden;
    transform: translateY(-50%);
    border: 1px solid transparent;
    border-radius: 999px;
    background: linear-gradient(180deg, #f2c69d, #b98053 50%, #f2c69d);
    box-shadow: 0 0 22px rgba(214, 170, 122, .18);
    transition:
        top .22s ease,
        right .22s ease,
        bottom .22s ease,
        left .22s ease,
        width .28s cubic-bezier(.2, .8, .2, 1),
        height .28s cubic-bezier(.2, .8, .2, 1),
        border-radius .28s,
        background .2s,
        box-shadow .2s;
}

.sidebar-handle {
    position: absolute;
    z-index: 2;
    inset: 0 auto 0 0;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
}

.sidebar-handle-line {
    width: 4px;
    height: 54px;
    border-radius: 99px;
    background: linear-gradient(180deg, #f2c69d, #b98053 50%, #f2c69d);
    transition: height .2s, width .2s;
}

.sidebar-content {
    position: absolute;
    inset: 0 0 0 30px;
    display: flex;
    min-height: 0;
    flex-direction: column;
    padding: 20px 14px 16px 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-7px);
    transition: opacity .18s, transform .18s, visibility .18s;
}

.sidebar.is-open {
    width: min(318px, calc(100vw - 28px));
    height: min(700px, calc(100dvh - 32px));
    border-color: var(--border);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .38);
}

.sidebar.is-open .sidebar-content {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

.sidebar-account {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    padding: 2px 4px 16px;
    border-bottom: 1px solid var(--border);
}

#sidebarAvatar,
.sidebar-avatar-fallback {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-avatar-fallback {
    display: grid;
    place-items: center;
    background: var(--surface-3);
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
}

.sidebar-avatar-fallback[hidden],
#sidebarAvatar[hidden] {
    display: none !important;
}

.sidebar-account-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.sidebar-account-copy strong,
.sidebar-account-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-account-copy strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
}

.sidebar-account-copy span {
    color: var(--text-light);
    font-size: 11px;
}

.sidebar-new-chat {
    width: 100%;
    min-height: 43px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0 20px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    transition: background .18s, border-color .18s;
}

.sidebar-new-chat:hover:not(:disabled) {
    border-color: rgba(214, 170, 122, .35);
    background: var(--surface-3);
}

.sidebar-new-chat > span {
    color: var(--accent2);
    font-size: 21px;
    font-weight: 400;
    line-height: 1;
}

.sidebar-section-heading {
    margin: 0 7px 8px;
    color: var(--text-light);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sidebar-usage {
    flex: 0 0 auto;
    margin: 0 2px 14px;
    padding: 10px 10px 9px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

.sidebar-usage-heading,
.sidebar-storage-labels {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-usage-heading strong {
    color: var(--text);
    font-size: 11px;
    font-weight: 650;
}

.sidebar-usage-heading > span,
.sidebar-storage-labels {
    color: var(--text-light);
    font-size: 9px;
}

.sidebar-storage-bar {
    height: 6px;
    overflow: hidden;
    margin: 8px 0 5px;
    border-radius: 999px;
    background: var(--surface-3);
}

.sidebar-storage-bar > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff7900, #ffb35e);
    transition: width .25s ease;
}

.sidebar-usage-note {
    margin: 6px 0 0;
    color: var(--text-light);
    font-size: 9px;
    line-height: 1.4;
}

.sidebar-daily-usage {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.sidebar-daily-usage span {
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-light);
    font-size: 9px;
    line-height: 1.2;
}

.chat-list-heading-row {
    min-height: 25px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.chat-select-mode-button {
    margin: -5px 4px 5px 0;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-light);
    font-size: 10px;
    font-weight: 650;
    transition: color .16s, background .16s, border-color .16s;
}

.chat-select-mode-button:hover:not(:disabled),
.chat-select-mode-button[aria-pressed="true"] {
    border-color: rgba(214, 170, 122, .38);
    background: var(--surface-3);
    color: var(--text);
}

.chat-select-mode-button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.chat-selection-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: -2px 2px 8px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

.chat-selection-toolbar[hidden] {
    display: none;
}

.chat-select-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    font-size: 10px;
    white-space: nowrap;
    cursor: pointer;
}

.chat-select-all input,
.chat-list-select {
    accent-color: var(--accent2);
}

.chat-delete-selected {
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid rgba(211, 106, 93, .28);
    border-radius: 8px;
    background: rgba(211, 106, 93, .1);
    color: #e49a91;
    font-size: 10px;
    font-weight: 650;
    white-space: nowrap;
}

.chat-delete-selected:hover:not(:disabled) {
    background: rgba(211, 106, 93, .18);
}

.chat-delete-selected:disabled {
    opacity: .48;
    cursor: not-allowed;
}

.attachment-usage-status {
    min-width: 185px;
    max-width: 210px;
    padding: 5px 3px 2px;
    color: var(--text-light);
    font-size: 9px;
    line-height: 1.35;
}

.attachment-usage-status span {
    display: block;
}

.attach-menu button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.chat-list {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 2px 12px;
    scrollbar-color: var(--surface-3) transparent;
    scrollbar-width: thin;
}

.chat-list-row {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 3px;
}

.chat-list-select {
    display: none;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    margin: 0 1px 0 4px;
    cursor: pointer;
}

.sidebar.chat-selection-mode .chat-list-select {
    display: block;
}

.chat-list-item {
    width: 100%;
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    text-align: left;
    transition: background .16s, border-color .16s;
}

.chat-list-item:hover:not(:disabled),
.chat-list-item.active {
    border-color: var(--border);
    background: var(--surface-2);
}

.chat-list-item.selected {
    border-color: rgba(214, 170, 122, .42);
    background: var(--surface-2);
}

.chat-list-title,
.chat-list-preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-list-title {
    font-size: 12px;
    font-weight: 600;
}

.chat-list-preview {
    color: var(--text-light);
    font-size: 10px;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.sidebar-action {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border-radius: 11px;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    text-align: left;
    transition: background .16s;
}

.sidebar-action:hover {
    background: var(--surface-2);
}

.sidebar-action-icon {
    width: 18px;
    color: var(--text-light);
    font-size: 16px;
    text-align: center;
}

.sidebar-logout:hover {
    color: #f0a39a;
}

.sidebar-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 4px 6px 28px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-light);
    font-size: 10px;
}

.sidebar-settings-panel[hidden] {
    display: none;
}

.sidebar-theme-toggle {
    padding: 8px 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font-size: 11px;
    text-align: left;
}

.empty-chat-state {
    align-self: center;
    margin: auto 12px;
    color: var(--text-light);
    text-align: center;
}

.empty-chat-state strong {
    display: block;
    max-width: 720px;
    margin-bottom: 0;
    color: var(--text);
    font-size: clamp(24px, 4vw, 38px);
    font-weight: 600;
    letter-spacing: -.035em;
    line-height: 1.15;
}

.empty-chat-state p {
    font-size: 12px;
}

@media (hover: hover) and (pointer: fine) {
    .sidebar:hover,
    .sidebar:focus-within {
        width: min(318px, calc(100vw - 28px));
        height: min(700px, calc(100dvh - 32px));
        border-color: var(--border);
        border-radius: 24px;
        background: var(--surface);
        box-shadow: 0 24px 80px rgba(0, 0, 0, .38);
    }

    .sidebar:hover .sidebar-content,
    .sidebar:focus-within .sidebar-content {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
    }

    .sidebar:hover .sidebar-handle-line {
        width: 3px;
        height: 38px;
        opacity: .65;
    }
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
    .sidebar {
        left: 7px;
        width: 46px;
        height: 96px;
        border-color: rgba(255, 255, 255, .2);
        background: rgba(255, 255, 255, .1);
        backdrop-filter: blur(16px) saturate(145%);
        -webkit-backdrop-filter: blur(16px) saturate(145%);
        box-shadow: 0 8px 28px rgba(0, 0, 0, .22), inset 0 0 0 1px rgba(255, 255, 255, .04);
    }

    .sidebar-handle {
        width: 100%;
        touch-action: none;
        cursor: grab;
        user-select: none;
        -webkit-user-select: none;
    }

    .sidebar-handle:active {
        cursor: grabbing;
        transform: none;
    }

    .sidebar.is-open .sidebar-handle {
        width: 28px;
        touch-action: manipulation;
        cursor: pointer;
    }

    .sidebar.is-open .sidebar-handle-line {
        opacity: 0;
        visibility: hidden;
    }

    .sidebar[data-mobile-side="left"] {
        top: clamp(
            calc(env(safe-area-inset-top, 0px) + 12px),
            calc(var(--sidebar-anchor-y, 50%) - 48px),
            calc(100dvh - env(safe-area-inset-bottom, 0px) - 108px)
        );
        right: auto;
        bottom: auto;
        left: calc(env(safe-area-inset-left, 0px) + 8px);
        transform: none;
    }

    .sidebar[data-mobile-side="right"] {
        top: clamp(
            calc(env(safe-area-inset-top, 0px) + 12px),
            calc(var(--sidebar-anchor-y, 50%) - 48px),
            calc(100dvh - env(safe-area-inset-bottom, 0px) - 108px)
        );
        right: calc(env(safe-area-inset-right, 0px) + 8px);
        bottom: auto;
        left: auto;
        transform: none;
    }

    .sidebar.is-open[data-mobile-side] {
        top: 50%;
        transform: translateY(-50%);
    }

    .sidebar[data-dragging="true"] {
        transition: none !important;
    }

    .sidebar[data-dragging="true"] .sidebar-handle {
        cursor: grabbing;
    }

    body:not(.dark) .sidebar {
        border-color: rgba(0, 0, 0, .12);
        background: rgba(255, 255, 255, .56);
        box-shadow: 0 8px 28px rgba(0, 0, 0, .12), inset 0 0 0 1px rgba(255, 255, 255, .48);
    }

    .sidebar.is-open {
        width: min(300px, calc(100vw - 18px));
        height: min(660px, calc(100dvh - 20px));
        border-radius: 21px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .sidebar-content {
        padding-top: 16px;
        padding-bottom: 12px;
    }
}

.task-suggestion-banner {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 24px;
    border-bottom: 1px solid rgba(255, 121, 0, .24);
    background: linear-gradient(100deg, rgba(255, 121, 0, .12), rgba(143, 92, 255, .1));
    color: var(--text);
}

.task-suggestion-banner[hidden] { display: none; }

.task-suggestion-banner p {
    min-width: 0;
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
}

.task-suggestion-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 7px;
}

.task-suggestion-actions button {
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 11px;
    font-weight: 650;
}

.task-suggestion-actions #acceptTaskSuggestion {
    border-color: transparent;
    background: var(--accent);
    color: #fff;
}

.image-gen-loading {
    position: relative;
    min-width: min(280px, 100%);
    overflow: hidden;
    padding: 13px 16px;
    border: 1px solid rgba(255, 214, 48, .42);
    border-radius: 16px;
    background: linear-gradient(155deg, #0c0c0a, #17160d 58%, #0b0b0b);
    box-shadow: 0 0 18px rgba(255, 211, 36, .13), 0 0 42px rgba(255, 211, 36, .07);
}

.image-gen-loading::before {
    position: absolute;
    inset: -40% -80%;
    background: linear-gradient(105deg, transparent 43%, rgba(255, 214, 48, .05) 47%, rgba(255, 211, 36, .72) 49%, rgba(255, 244, 157, .86) 51%, transparent 56%);
    content: "";
    filter: blur(5px);
    animation: image-lightning-sweep 1.25s linear infinite;
    pointer-events: none;
}

.image-gen-loading .image-gen-loading-copy {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    color: #fff0a6;
    font-size: 13px;
    font-weight: 650;
    text-shadow: 0 0 12px rgba(255, 214, 48, .28);
}

.image-gen-loading .image-gen-bolt {
    color: #ffe24c;
    font-size: 19px;
    line-height: 1;
    animation: image-lightning-pulse .75s ease-in-out infinite alternate;
}

.image-gen-progress-copy { flex: 1; min-width: 0; }

.image-gen-progress-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.image-gen-percent {
    color: #ffe24c;
    font-size: 11px;
    white-space: nowrap;
}

.image-gen-progress {
    height: 6px;
    overflow: hidden;
    margin-top: 9px;
    border: 1px solid rgba(255, 226, 76, .26);
    border-radius: 999px;
    background: #090909;
}

.image-gen-progress-fill {
    display: block;
    width: 20%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #9b7900, #ffd629 68%, #fff29b);
    box-shadow: 0 0 12px rgba(255, 220, 62, .8);
    transition: width .42s ease-out;
}

.image-gen-progress-note {
    display: block;
    margin-top: 5px;
    color: #cbb95a;
    font-size: 9px;
    font-weight: 500;
    text-shadow: none;
}

.generated-chat-image {
    display: block;
    width: auto !important;
    max-width: min(100%, 560px) !important;
    max-height: 68vh;
    height: auto !important;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.generated-image-frame {
    position: relative;
    display: inline-block;
    max-width: min(100%, 560px);
    overflow: hidden;
    border-radius: 14px;
    vertical-align: top;
}

.generated-image-frame .generated-chat-image { display: block; }

.message-content .generated-image-download {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(255, 222, 67, .62);
    border-radius: 10px;
    background: rgba(8, 8, 7, .86);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .38), 0 0 13px rgba(255, 214, 48, .17);
    color: #ffe24c;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.message-content .generated-image-download svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.message-content .generated-image-download:hover,
.message-content .generated-image-download:focus-visible {
    background: #ffd629;
    color: #101008;
    transform: translateY(-1px);
}

.message-content .generated-image-download:focus-visible {
    outline: 2px solid #fff29b;
    outline-offset: 2px;
}

.generated-image-note {
    display: block;
    color: var(--text-light);
    font-size: 10px;
    line-height: 1.4;
}

.generated-image-note { margin-top: 5px; }

.audio-preview-card { padding-right: 7px; }
.audio-preview-icon {
    color: #fff;
    background: linear-gradient(145deg, #9262ff, #5744c9);
    font-size: 21px;
}

.audio-attachment-note {
    color: var(--text-light);
    font-size: 12px;
}

@keyframes image-lightning-sweep {
    from { transform: translateX(-28%) rotate(-7deg); opacity: .25; }
    45% { opacity: .78; }
    to { transform: translateX(28%) rotate(-7deg); opacity: .24; }
}

@keyframes image-lightning-pulse {
    from { filter: drop-shadow(0 0 2px #b38c00); transform: scale(.92); }
    to { filter: drop-shadow(0 0 9px #ffe24c); transform: scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
    .image-gen-loading::before,
    .image-gen-loading .image-gen-bolt {
        animation: none;
    }
    .image-gen-progress-fill { transition: none; }
}

@media (max-width: 600px) {
    .task-suggestion-banner {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
    }
}
