/* ==========================================================================
   SynthOS Shell — Layout & Chrome
   Provides structural styles for the SynthOS page shell (chat panel, viewer
   panel, modals, toggle, brainstorm, attachments, etc.).
   Uses FluentLM semantic tokens so it adapts to any v3 theme.
   ========================================================================== */

/* --- Reset ---------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root { --toolbar-width: 48px; }

body {
    font-family: var(--fontFamily, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif);
    background: var(--bodyBackground);
    color: var(--bodyText);
    height: 100vh;
    display: flex;
    padding-left: var(--toolbar-width);
}

/* --- Shell Toolbar -------------------------------------------------------- */
.shell-toolbar {
    width: var(--toolbar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    gap: 4px;
    background: var(--bodyStandoutBackground);
    border-right: 1px solid var(--bodyDivider);
}

.shell-toolbar-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--bodySubtext);
    cursor: pointer;
    position: relative;
    transition: background 0.2s, color 0.2s;
}

.shell-toolbar-btn:hover {
    background: var(--bodyBackgroundHovered);
    color: var(--themePrimary);
}

body:not(.chat-collapsed) .shell-toolbar-btn#builderToggle {
    color: var(--themePrimary);
}

.shell-toolbar-btn svg {
    width: 28px;
    height: 28px;
}

.shell-toolbar-spacer {
    flex: 1;
}

/* Tooltip — CSS-only, right of button */
.shell-toolbar-btn::after {
    content: attr(aria-label);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bodyStandoutBackground);
    color: var(--bodyText);
    border: 1px solid var(--bodyDivider);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 1002;
}

.shell-toolbar-btn:hover::after {
    opacity: 1;
}

/* --- Toolbar: dock right ------------------------------------------------- */
[data-toolbar="right"] body { padding-left: 0; padding-right: var(--toolbar-width); overflow: hidden; }
[data-toolbar="right"] .shell-toolbar {
    left: auto; right: 0;
    border-right: none; border-left: 1px solid var(--bodyDivider);
}
[data-toolbar="right"] .shell-toolbar-btn::after {
    left: auto; right: calc(100% + 8px);
}
[data-toolbar="right"] .chat-panel {
    order: 2;
    border-right: none;
    border-left: 1px solid var(--bodyDivider);
    transition: margin-right 0.3s ease, border-left-color 0.3s ease;
}
[data-toolbar="right"] .viewer-panel { order: 1; }
[data-toolbar="right"] .chat-collapsed .chat-panel {
    margin-left: 0; margin-right: -30%;
    border-left-color: transparent;
}

/* --- Chat Panel ----------------------------------------------------------- */
.chat-panel {
    width: 30%;
    background: var(--bodyStandoutBackground);
    padding: 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--bodyDivider);
    position: relative;
    transition: margin-left 0.3s ease, border-right-color 0.3s ease;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--themePrimary);
    letter-spacing: 1px;
}

.chat-header-close {
    background: none;
    border: none;
    color: var(--bodySubtext);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.chat-header-close:hover {
    color: var(--themePrimary);
    background: var(--bodyBackgroundHovered);
}

/* --- Chat Messages -------------------------------------------------------- */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    margin-top: 15px;
    background: var(--defaultStateBackground);
    border-radius: 15px;
    border: 1px solid var(--bodyDivider);
}

.chat-message {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: var(--bodyBackgroundHovered);
    border-radius: 15px;
    border: 1px solid var(--bodyDivider);
}

.chat-message p {
    margin-bottom: 5px;
    line-height: 1.5;
}

.chat-message p strong {
    font-weight: 600;
    color: var(--themePrimary);
}

/* User message body — preserves blank lines and wraps long lines. */
.chat-user-body {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

/* Clamp tall user messages until the "More" toggle is pressed. */
.chat-user-body--clamped {
    max-height: calc(1.5em * 6);
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 75%, transparent 100%);
}

.chat-user-body--clamped.chat-user-body--expanded {
    max-height: none;
    -webkit-mask-image: none;
    mask-image: none;
}

.chat-more-toggle {
    margin-top: 6px;
    padding: 2px 8px;
    background: transparent;
    color: var(--themePrimary, #58a6ff);
    border: 1px solid var(--themePrimary, #58a6ff);
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    font-family: inherit;
}

.chat-more-toggle:hover {
    background: var(--themePrimary, #58a6ff);
    color: var(--bodyBackground, #fff);
}

.chat-message p code {
    background: var(--bodyBackgroundChecked);
    padding: 2px 6px;
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
    color: var(--themeSecondary);
    border: 1px solid var(--bodyDivider);
}

/* --- Chat Markdown Styles ------------------------------------------------- */
.chat-message a {
    color: var(--themePrimary, #58a6ff);
    text-decoration: underline;
    cursor: pointer;
}
.chat-message a:hover {
    color: var(--themeDark, #388bfd);
}
/* Send links — button-like appearance */
.chat-message a[href^="send:"] {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--themePrimary, #58a6ff);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
}
.chat-message a[href^="send:"]:hover {
    background: var(--themePrimary, #58a6ff);
    color: var(--bodyBackground, #fff);
}
/* Suggestion chips — aggregated at the bottom of a message */
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.suggestion-chip {
    padding: 5px 12px;
    font-size: 12px;
    border: 1px solid var(--bodyDivider);
    border-radius: 16px;
    background: var(--defaultStateBackground);
    color: var(--bodySubtext);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
    font-family: inherit;
}
.suggestion-chip:hover {
    border-color: var(--themePrimary);
    color: var(--themePrimary);
    background: var(--bodyBackgroundHovered);
}
.suggestion-chip:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}
/* While a chat request is in flight, visually disable every inline
 * affordance inside the chat panel: suggestion chips, send: links
 * ("Let me try to fix it"), undo / try again links, and the Reset /
 * Clear-conversation link. The .chat-busy class is toggled on
 * #chatMessages by setChatBusy() in shell.v3.js. */
.chat-busy .suggestion-chip,
.chat-busy .synthos-undo-link a,
.chat-busy .synthos-clear-action a,
.chat-busy a[href^="send:"] {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}
/* Markdown block elements inside chat messages */
.chat-message ul, .chat-message ol {
    margin: 4px 0 4px 20px;
    padding: 0;
}
.chat-message pre {
    background: var(--bodyBackgroundChecked);
    border: 1px solid var(--bodyDivider);
    border-radius: 5px;
    padding: 8px;
    overflow-x: auto;
    font-size: 0.9em;
}
.chat-message pre code {
    background: none;
    border: none;
    padding: 0;
}
.chat-message blockquote {
    border-left: 3px solid var(--themePrimary, #58a6ff);
    margin: 4px 0;
    padding: 2px 10px;
    color: var(--bodySubtext);
}

/* --- Chat Form ------------------------------------------------------------ */
#chatForm {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--inputBorder);
    border-radius: 16px;
    background: var(--inputBackground);
    padding: 8px 12px;
    gap: 4px;
    margin-top: 8px;
}

#chatForm:focus-within {
    border-color: var(--inputFocusBorderAlt);
}

.chat-input {
    border: none;
    background: transparent;
    resize: none;
    min-height: 48px;
    max-height: 120px;
    overflow-y: auto;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--inputText);
    flex-grow: 1;
}

.chat-input::placeholder {
    color: var(--inputPlaceholderText);
}

/* --- Viewer Panel --------------------------------------------------------- */
.viewer-panel {
    flex: 1;
    min-width: 0;
    padding: 0;
    background: var(--bodyBackground);
    position: relative;
    overflow: hidden;
}

#viewerFrame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.viewer-panel.full-viewer {
    padding: 0;
}

/* --- Chat error messages -------------------------------------------------- */
.chat-message-error {
    border-left: 3px solid var(--errorText, #e81123);
    background-color: var(--errorBackground, rgba(232, 17, 35, 0.06));
    border-radius: var(--roundedCorner4, 4px);
    padding: 8px 12px;
    margin-top: 4px;
}

.chat-error-details {
    font-size: 0.78rem;
    color: var(--bodySubtext, #605e5c);
    margin-top: 4px;
    font-family: var(--fontFamilyMonospace, monospace);
    word-break: break-word;
}

/* --- Loading -------------------------------------------------------------- */
.loading-overlay {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Masked inner layer: everything here fades at the corners so the page peeks
   through. The progress bar is a sibling (outside the mask) so it stays 100%
   opaque. JS applies the radial mask on show using LOADING_FADE_SIZE /
   LOADING_FADE_SOFTNESS constants. */
.loading-overlay .loading-masked {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bodyBackground, #fff);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-overlay .loading-bp-anim {
    width: 80px; height: 72px;
    margin-bottom: var(--spacingL1, 20px);
    position: relative;
}
.loading-overlay .loading-bp-anim svg {
    width: 80px; height: 72px; overflow: visible;
}
.loading-overlay .bp-line {
    stroke: var(--themePrimary); stroke-width: 2;
    fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.loading-overlay .bp-fill-rect {
    fill: var(--themePrimary); opacity: 0;
}
.loading-overlay .bp-frame {
    stroke-dasharray: 280; stroke-dashoffset: 280;
    animation: bp-draw 3s ease-in-out infinite;
}
.loading-overlay .bp-inner1 {
    stroke-dasharray: 60; stroke-dashoffset: 60;
    animation: bp-draw-short 3s ease-in-out infinite;
    animation-delay: 0.6s;
}
.loading-overlay .bp-inner2 {
    stroke-dasharray: 60; stroke-dashoffset: 60;
    animation: bp-draw-short 3s ease-in-out infinite;
    animation-delay: 0.9s;
}
.loading-overlay .bp-inner3 {
    stroke-dasharray: 40; stroke-dashoffset: 40;
    animation: bp-draw-short2 3s ease-in-out infinite;
    animation-delay: 1.2s;
}
.loading-overlay .bp-inner4 {
    stroke-dasharray: 30; stroke-dashoffset: 30;
    animation: bp-draw-short3 3s ease-in-out infinite;
    animation-delay: 1.0s;
}
.loading-overlay .bp-fill1 { animation: bp-fill 3s ease-in-out infinite; animation-delay: 1.5s; }
.loading-overlay .bp-fill2 { animation: bp-fill 3s ease-in-out infinite; animation-delay: 1.8s; }

@keyframes bp-draw {
    0% { stroke-dashoffset: 280; }
    40% { stroke-dashoffset: 0; }
    75% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 280; }
}
@keyframes bp-draw-short {
    0% { stroke-dashoffset: 60; }
    30% { stroke-dashoffset: 0; }
    70% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 60; }
}
@keyframes bp-draw-short2 {
    0% { stroke-dashoffset: 40; }
    30% { stroke-dashoffset: 0; }
    70% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 40; }
}
@keyframes bp-draw-short3 {
    0% { stroke-dashoffset: 30; }
    30% { stroke-dashoffset: 0; }
    70% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 30; }
}
@keyframes bp-fill {
    0% { opacity: 0; }
    25% { opacity: 0.6; }
    65% { opacity: 0.6; }
    100% { opacity: 0; }
}

.loading-overlay .loading-status {
    font-size: var(--fontSizeXLarge, 20px);
    font-weight: var(--fontWeightSemibold, 600);
    color: var(--bodyText);
    margin-bottom: var(--spacingS1, 8px);
}
.loading-overlay .loading-substatus {
    font-size: var(--fontSizeMedium, 14px);
    color: var(--bodySubtext);
    margin-bottom: var(--spacingL1, 20px);
    min-height: 20px;
    transition: opacity 0.3s ease;
}
.loading-overlay .loading-substatus.fade-out { opacity: 0; }

.loading-overlay .loading-tip-area {
    display: flex; align-items: center; gap: 10px;
    color: var(--bodySubtext); font-size: var(--fontSizeMedium, 14px);
    margin-top: var(--spacingM, 16px);
    padding: 0 var(--spacingL1, 20px);
    text-align: center;
}
.loading-overlay .loading-bulb { color: var(--yellow, #ffd400); font-size: 16px; }

/* Progress bar — sibling of .loading-masked, unmasked, always 100% opacity. */
.loading-overlay .loading-progress-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: var(--neutralLighter, #e1dfdd);
    overflow: hidden;
    opacity: 1;
    z-index: 1;
}
.loading-overlay .loading-progress-fill {
    height: 100%; width: 30%;
    background: linear-gradient(90deg, var(--themePrimary), var(--themeTertiary));
    border-radius: 0 2px 2px 0;
    animation: shell-loading-indeterminate 1.8s ease-in-out infinite;
}
@keyframes shell-loading-indeterminate {
    0% { transform: translateX(-100%); width: 30%; }
    50% { width: 50%; }
    100% { transform: translateX(350%); width: 30%; }
}

/* --- Scrollbar ------------------------------------------------------------ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--defaultStateBackground); border-radius: 10px; }
::-webkit-scrollbar-thumb {
    background: var(--themePrimary);
    border-radius: 10px;
    border: 2px solid var(--defaultStateBackground);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--themeSecondary);
}
::-webkit-scrollbar-corner { background: var(--defaultStateBackground); }
* { scrollbar-width: thin; scrollbar-color: var(--themePrimary) var(--defaultStateBackground); }

/* --- Chat Collapsed State ------------------------------------------------- */
body.chat-collapsed .chat-panel {
    margin-left: -30%;
    border-right-color: transparent;
}

/* --- Modal ---------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--overlayBackground, rgba(0,0,0,0.6));
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-overlay.show { display: flex; }

.modal-content {
    background: var(--bodyBackground);
    border: 1px solid var(--bodyDivider);
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.modal-header {
    background: var(--primaryButtonBackground);
    color: var(--primaryButtonText);
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 600;
}

.modal-body { padding: 20px; }

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--bodyDivider);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.modal-footer-right { display: flex; gap: 10px; margin-left: auto; }

/* --- Form Elements (modals) ----------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
    display: block;
    font-size: 13px;
    color: var(--bodySubtext);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--inputBorder);
    border-radius: 8px;
    background: var(--inputBackground);
    color: var(--inputText);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus { border-color: var(--inputFocusBorderAlt); }
.form-input:read-only { opacity: 0.7; cursor: not-allowed; }
.form-input::placeholder { color: var(--inputPlaceholderText); opacity: 0.7; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--themePrimary);
    cursor: pointer;
}

.checkbox-label span { font-size: 14px; color: var(--bodyText); }

/* --- Modal Buttons -------------------------------------------------------- */
.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.modal-btn-primary {
    background: var(--primaryButtonBackground);
    color: var(--primaryButtonText);
}

.modal-btn-primary:hover {
    background: var(--primaryButtonBackgroundHovered);
}

.modal-btn-secondary {
    background: var(--buttonBackground);
    color: var(--buttonText);
    border: 1px solid var(--buttonBorder);
}

.modal-btn-secondary:hover {
    background: var(--buttonBackgroundHovered);
    border-color: var(--buttonBorder);
}

.modal-btn-danger { background: #dc3545; color: white; }

.modal-btn-danger:hover {
    background: #c82333;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

/* --- Chat Input Wrapper (icon row) & Brainstorm Icon --------------------- */
.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.brainstorm-icon-btn {
    background: transparent;
    border: none;
    color: var(--bodySubtext);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.brainstorm-icon-btn:hover {
    color: var(--themePrimary);
    background: var(--bodyBackgroundHovered);
}

/* --- Chat Send Button ---------------------------------------------------- */
.chat-send-btn {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primaryButtonBackground);
    color: var(--primaryButtonText);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--primaryButtonBackgroundHovered);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Brainstorm Modal ----------------------------------------------------- */
.brainstorm-modal .modal-content {
    max-width: none;
    width: calc(100% - 80px);
    height: calc(100% - 80px);
    display: flex;
    flex-direction: column;
}

.brainstorm-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.brainstorm-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.brainstorm-close-btn:hover { opacity: 1; }

.brainstorm-messages {
    flex: 1;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.brainstorm-message {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 85%;
    word-wrap: break-word;
}

.brainstorm-user {
    background: var(--primaryButtonBackground);
    color: var(--primaryButtonText);
    align-self: flex-end;
}

.brainstorm-assistant {
    background: var(--bodyStandoutBackground);
    color: var(--bodyText);
    border: 1px solid var(--bodyDivider);
    align-self: flex-start;
}

.brainstorm-input-row {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--bodyDivider);
    flex-shrink: 0;
}

.brainstorm-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--inputBorder);
    border-radius: 8px;
    background: var(--inputBackground);
    color: var(--inputText);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.brainstorm-input:focus { border-color: var(--inputFocusBorderAlt); }
.brainstorm-input::placeholder { color: var(--inputPlaceholderText); opacity: 0.7; }

.brainstorm-send-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--primaryButtonBackground);
    color: var(--primaryButtonText);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.brainstorm-send-btn:hover {
    background: var(--primaryButtonBackgroundHovered);
}

.brainstorm-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.brainstorm-assistant p { margin: 4px 0; }
.brainstorm-assistant pre { background: var(--defaultStateBackground); padding: 10px; border-radius: 6px; overflow-x: auto; margin: 8px 0; }
.brainstorm-assistant code { font-size: 13px; }
.brainstorm-assistant ul, .brainstorm-assistant ol { margin: 4px 0; padding-left: 20px; }

.brainstorm-build-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.brainstorm-build-btn {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: var(--primaryButtonBackground);
    color: var(--primaryButtonText);
    cursor: pointer;
    transition: all 0.2s;
}

.brainstorm-build-btn:hover {
    background: var(--primaryButtonBackgroundHovered);
}

.brainstorm-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.brainstorm-suggestion-chip {
    padding: 5px 12px;
    font-size: 12px;
    border: 1px solid var(--bodyDivider);
    border-radius: 16px;
    background: var(--defaultStateBackground);
    color: var(--bodySubtext);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.brainstorm-suggestion-chip:hover {
    border-color: var(--themePrimary);
    color: var(--themePrimary);
    background: var(--bodyBackgroundHovered);
}

.brainstorm-suggestion-chip:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.brainstorm-thinking {
    align-self: flex-start;
    padding: 12px 16px;
    background: var(--bodyStandoutBackground);
    border: 1px solid var(--bodyDivider);
    border-radius: 10px;
    color: var(--bodySubtext);
    font-size: 14px;
    font-style: italic;
}

/* --- Save Line ------------------------------------------------------------ */
.save-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 15px;
    font-size: 11px;
    color: var(--bodySubtext);
    opacity: 0.7;
}

.save-line::before,
.save-line::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--bodyDivider);
}

.save-line-label {
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* --- Shared page rules ---------------------------------------------------- */
.chat-input:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Attach Button -------------------------------------------------------- */
.attach-btn {
    background: transparent;
    border: none;
    color: var(--bodySubtext);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.attach-btn:hover {
    color: var(--themePrimary);
    background: var(--bodyBackgroundHovered);
}

/* --- Attach Menu ---------------------------------------------------------- */
.attach-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    background: var(--menuBackground);
    border: 1px solid var(--bodyDivider);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 100;
    min-width: 160px;
}

.attach-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--menuItemText);
    cursor: pointer;
    transition: background 0.15s;
}

.attach-menu-item:hover {
    background: var(--menuItemBackgroundHovered);
}

/* --- Attachment Pills ----------------------------------------------------- */
.attachment-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 4px;
    min-height: 0;
}

.attachment-pills:empty { display: none; }

.attachment-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--defaultStateBackground);
    border: 1px solid var(--bodyDivider);
    border-radius: 6px;
    padding: 4px 8px;
    max-width: 180px;
}

.attachment-pill-remove {
    background: none;
    border: none;
    color: var(--bodySubtext);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
}

.attachment-pill-remove:hover {
    color: #ff6b6b;
}

/* --- Screenshot Overlay --------------------------------------------------- */
.screenshot-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    cursor: crosshair;
    z-index: 1000;
}

.screenshot-rect {
    display: none;
    position: absolute;
    border: 2px solid red;
    background: rgba(255, 0, 0, 0.05);
    pointer-events: none;
}
