@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;600;700&display=swap');

:root {
    --bg: #030406;
    --panel: rgba(12, 15, 20, 0.76);
    --panel-strong: rgba(15, 18, 24, 0.92);
    --panel-soft: rgba(255, 255, 255, 0.055);
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.2);
    --text: #f7f8fb;
    --muted: #a5adba;
    --accent: #f7f8fb;
    --accent-dark: #111318;
    --success: #70e1b4;
    --danger: #ff7d86;
    --token-orange: #ffae62;
    --token-orange-soft: rgba(255, 174, 98, .14);
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

/* =========================================================
   LANDING CHAT — واجهة صفحات الهبوط المبسطة
   ========================================================= */
.landing-page-studio {
    width: min(820px, 100%);
    margin: 0 auto;
    padding: 10px 0 150px;
    position: relative;
    direction: rtl;
}
.landing-chat-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin: 0 auto 12px;
}
.landing-chat-toolbar button {
    width: auto;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 11px;
    color: #a9c8b8;
    background: rgba(121,226,173,.045);
    border: 1px solid rgba(121,226,173,.12);
    border-radius: 9px;
    font-size: .67rem;
    cursor: pointer;
}
.landing-chat-toolbar button:hover,
.landing-chat-toolbar button[aria-expanded="true"] { color: #edfff4; background: rgba(121,226,173,.1); border-color: rgba(121,226,173,.28); }
.landing-projects-panel {
    width: 100%;
    max-height: 300px;
    display: block;
    margin-bottom: 14px;
    padding: 13px;
    overflow: auto;
    background: rgba(4,14,9,.96);
    border: 1px solid rgba(121,226,173,.13);
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(0,0,0,.2);
}
.landing-projects-panel .landing-panel-title { margin-bottom: 9px; }
.landing-projects-panel .landing-storage-note { margin-top: 10px; }

.landing-conversation {
    min-height: 310px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 12px 0 20px;
}
.landing-conversation .message-row { width: 100%; }
.landing-conversation .message-content { max-width: min(620px, calc(100% - 8px)); }
.landing-welcome-message { margin-bottom: 14px; }
.landing-state-content { width: min(430px, calc(100% - 8px)); max-width: min(430px, calc(100% - 8px)) !important; }
.landing-generation-bubble,
.landing-complete-bubble {
    width: 100%;
    box-sizing: border-box;
    color: #eafff2 !important;
    background: rgba(4,15,10,.96) !important;
    border: 1px solid rgba(121,226,173,.13) !important;
    box-shadow: 0 20px 55px rgba(0,0,0,.25);
}
.landing-generation-bubble { padding: 12px !important; }
.landing-progress-image {
    display: block !important;
    width: min(290px, 100%) !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.landing-live-progress {
    width: 100%;
    height: 9px;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
    background: rgba(121,226,173,.08);
    border: 1px solid rgba(121,226,173,.13);
    border-radius: 999px;
}
.landing-live-progress span {
    width: 42%;
    height: 100%;
    display: block;
    position: absolute;
    left: -42%;
    background: linear-gradient(90deg, transparent, #ffbd72 25%, #79e2ad 75%, transparent);
    border-radius: inherit;
    box-shadow: 0 0 16px rgba(121,226,173,.42);
    animation: landingProgressTravel 1.3s ease-in-out infinite;
}
@keyframes landingProgressTravel { to { left: 100%; } }
.landing-progress-info { display: grid; gap: 2px; margin-top: 10px; text-align: right; }
.landing-progress-info > span { color: #88a797; font-size: .62rem; }
.landing-progress-info > strong { color: #f1fff6; font-size: .82rem; overflow-wrap: anywhere; }
.landing-progress-info > small { color: #ffbd7b; font-size: .59rem; }
.landing-complete-bubble {
    display: grid;
    grid-template-columns: 44px minmax(0,1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 12px !important;
}
.landing-complete-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: #052016;
    background: linear-gradient(145deg, #c8f9df, #79e2ad);
    border-radius: 11px;
}
.landing-complete-bubble > div { min-width: 0; display: grid; gap: 2px; text-align: right; }
.landing-complete-bubble > div > span { color: #79e2ad; font-size: .61rem; font-weight: 800; }
.landing-complete-bubble > div > strong { overflow: hidden; color: #f3fff7; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.landing-complete-bubble > div > small { color: #839f90; font-size: .56rem; }
#landing-open-result-btn {
    width: auto;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    color: #052016;
    background: #79e2ad;
    border: 0;
    border-radius: 9px;
    font-size: .64rem;
    font-weight: 850;
    cursor: pointer;
}

.landing-input-dock {
    width: 100%;
    position: sticky;
    bottom: 0;
    z-index: 30;
    padding: 12px 0 10px;
    background: linear-gradient(180deg, transparent, rgba(1,8,5,.97) 18%, rgba(1,8,5,.99));
}
.landing-required-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; margin-bottom: 8px; }
.landing-required-name { min-width: 0; display: grid; gap: 5px; }
.landing-required-name > span { display: flex; align-items: center; gap: 6px; color: #b8d5c6; font-size: .66rem; }
.landing-required-name > span i { color: #79e2ad; }
.landing-required-name > span b { margin-inline-start: auto; padding: 2px 6px; color: #ffd0a3; background: rgba(255,174,98,.1); border-radius: 5px; font-size: .51rem; }
.landing-required-name input,
.landing-assistant-panel input,
.landing-assistant-panel select,
.landing-assistant-panel textarea {
    width: 100%;
    box-sizing: border-box;
    color: #eafff2;
    background: rgba(3,13,8,.94);
    border: 1px solid rgba(121,226,173,.15);
    border-radius: 9px;
    outline: 0;
}
.landing-required-name input { min-height: 39px; padding: 8px 10px; }
.landing-required-name input:focus,
.landing-assistant-panel input:focus,
.landing-assistant-panel select:focus,
.landing-assistant-panel textarea:focus { border-color: rgba(121,226,173,.5); box-shadow: 0 0 0 3px rgba(121,226,173,.07); }
.landing-required-name.has-error input { border-color: rgba(255,107,119,.75); box-shadow: 0 0 0 3px rgba(255,107,119,.07); }
.landing-assistant-toggle {
    width: auto;
    min-height: 39px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    color: #b6d6c5;
    background: rgba(121,226,173,.055);
    border: 1px solid rgba(121,226,173,.15);
    border-radius: 9px;
    font-size: .65rem;
    cursor: pointer;
}
.landing-assistant-toggle > i:first-child { color: #79e2ad; }
.landing-assistant-toggle > i:last-child { color: #789687; font-size: .55rem; transition: transform .2s ease; }
.landing-assistant-toggle.is-open { color: #edfff4; background: rgba(121,226,173,.11); border-color: rgba(121,226,173,.35); }
.landing-assistant-toggle.is-open > i:last-child { transform: rotate(180deg); }
.landing-assistant-panel {
    margin-bottom: 8px;
    padding: 12px;
    background: rgba(5,18,11,.96);
    border: 1px solid rgba(121,226,173,.14);
    border-radius: 12px;
}
.landing-assistant-panel.hidden { display: none !important; }
.landing-assistant-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.landing-assistant-heading > span { width: 33px; height: 33px; display: grid; place-items: center; color: #79e2ad; background: rgba(121,226,173,.08); border-radius: 9px; }
.landing-assistant-heading > div { display: grid; gap: 2px; }
.landing-assistant-heading strong { color: #e7fff0; font-size: .72rem; }
.landing-assistant-heading small { color: #789687; font-size: .59rem; }
.landing-assistant-panel .landing-form-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
.landing-assistant-panel .landing-field > span { margin-bottom: 5px; }
.landing-assistant-panel input,
.landing-assistant-panel select { min-height: 38px; padding: 7px 9px; }
.landing-assistant-panel textarea { min-height: 72px; padding: 8px 9px; resize: vertical; }

.landing-reference-preview {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 7px;
    padding: 8px 10px;
    color: #dff8e9;
    background: rgba(121,226,173,.06);
    border: 1px solid rgba(121,226,173,.14);
    border-radius: 10px;
}
.landing-reference-preview.hidden { display: none !important; }
.landing-reference-preview > span { width: 32px; height: 32px; display: grid; place-items: center; color: #79e2ad; background: rgba(121,226,173,.08); border-radius: 8px; }
.landing-reference-preview > div { min-width: 0; display: grid; gap: 2px; }
.landing-reference-preview strong { font-size: .66rem; }
.landing-reference-preview small { overflow: hidden; color: #8faa9b; font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
.landing-reference-preview > button { width: 30px; height: 30px; margin-inline-start: auto; color: #9db8aa; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.landing-reference-preview > button:hover { color: #ff9aa3; background: rgba(255,100,110,.08); }
.landing-chat-composer {
    display: grid;
    grid-template-columns: 42px minmax(0,1fr) 44px;
    align-items: end;
    gap: 7px;
    padding: 8px;
    background: rgba(7,24,14,.97);
    border: 1px solid rgba(121,226,173,.22);
    border-radius: 15px;
    box-shadow: 0 17px 50px rgba(0,0,0,.3);
}
.landing-chat-composer textarea {
    width: 100%;
    min-height: 42px;
    max-height: 180px;
    box-sizing: border-box;
    padding: 10px 7px;
    color: #fff;
    background: transparent;
    border: 0;
    outline: 0;
    resize: none;
    line-height: 1.55;
}
.landing-chat-composer textarea::placeholder { color: #7d9d8c; }
.landing-composer-side-btn,
.landing-chat-composer .landing-generate-btn {
    width: 42px !important;
    height: 42px;
    min-height: 42px;
    display: grid;
    place-items: center;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 11px !important;
    cursor: pointer;
}
.landing-composer-side-btn { color: #b6d5c5; background: rgba(121,226,173,.08); border: 1px solid rgba(121,226,173,.14); }
.landing-composer-side-btn:hover,
.landing-composer-side-btn.active { color: #062017; background: #79e2ad; }
.landing-chat-composer .landing-generate-btn {
    width: 44px !important;
    height: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #062017 !important;
    background: #79e2ad !important;
    border: 0 !important;
    border-radius: 7px !important;
    box-shadow: none !important;
    line-height: 1;
}
.landing-chat-composer .landing-generate-btn > i {
    width: 1em;
    height: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    line-height: 1;
}
.landing-chat-composer .landing-generate-btn:disabled { opacity: .5; cursor: wait; }
.landing-composer-tools { display: flex; align-items: center; gap: 8px; padding: 7px 7px 0; color: #708c7e; font-size: .6rem; }
.landing-composer-tools > button {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    color: #a6c6b5;
    background: rgba(121,226,173,.045);
    border: 1px solid rgba(121,226,173,.12);
    border-radius: 8px;
    font-size: .61rem;
    cursor: pointer;
}
.landing-composer-tools > button small { color: #ffbd7b; }
.landing-composer-tools > button > i:last-child { font-size: .5rem; }
.landing-composer-tools > span { margin-inline-start: auto; }
.landing-model-popover {
    width: min(430px, calc(100% - 12px));
    position: absolute;
    right: 6px;
    bottom: calc(100% - 8px);
    z-index: 40;
    padding: 12px;
    background: rgba(4,14,9,.99);
    border: 1px solid rgba(121,226,173,.17);
    border-radius: 13px;
    box-shadow: 0 22px 65px rgba(0,0,0,.45);
}
.landing-model-popover.hidden { display: none !important; }
.landing-popover-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.landing-popover-heading > div { display: grid; gap: 2px; }
.landing-popover-heading strong { color: #e9fff2; font-size: .73rem; }
.landing-popover-heading > button { width: 30px; height: 30px; color: #8da99a; background: rgba(255,255,255,.035); border: 1px solid rgba(121,226,173,.1); border-radius: 8px; cursor: pointer; }
.landing-model-popover .landing-model-cards { gap: 6px; }
.landing-model-popover .landing-model-card { min-height: 50px; }
.landing-input-dock > .landing-status { min-height: 18px; padding: 5px 7px 0; }

.landing-page-studio .landing-output-panel {
    width: 100%;
    margin: 10px 0 22px;
    padding: 14px;
    box-sizing: border-box;
    background: rgba(3,11,7,.97);
    border: 1px solid rgba(121,226,173,.14);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.landing-page-studio .landing-output-panel.hidden { display: none !important; }
.landing-page-studio .landing-output-toolbar { position: sticky; top: 0; z-index: 3; padding: 0 0 11px; background: rgba(3,11,7,.97); }
.landing-page-studio .landing-preview-view { min-height: 440px; }
.landing-page-studio #landing-preview-frame { height: 640px; }

@media (max-width: 700px) {
    .landing-page-studio { padding: 4px 0 135px; }
    .landing-conversation { min-height: 260px; }
    .landing-assistant-toggle { width: 100%; justify-content: center; }
    .landing-progress-image { width: min(260px, 100%) !important; }
    .landing-state-content { width: calc(100% - 4px); max-width: calc(100% - 4px) !important; }
    .landing-complete-bubble { grid-template-columns: 40px minmax(0,1fr) 38px; gap: 8px; }
    .landing-complete-icon { width: 40px; height: 40px; }
    #landing-open-result-btn { width: 38px; height: 38px; padding: 0; justify-content: center; }
    #landing-open-result-btn span,
    .landing-composer-tools > span { display: none; }
    .landing-model-popover { right: 0; width: 100%; }
    .landing-page-studio .landing-output-toolbar { flex-wrap: wrap; }
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #000; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg);
    background-image: none;
    background-repeat: no-repeat;
    background-position: top center;
    background-attachment: fixed;
    background-size: cover;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 14% 20%, rgba(255,255,255,.09), transparent 24%),
        radial-gradient(circle at 82% 68%, rgba(92,106,130,.13), transparent 28%);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.nav {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: rgba(3, 4, 6, 0.54);
    border-bottom: 1px solid rgba(255,255,255,.09);
    backdrop-filter: blur(20px) saturate(135%);
    -webkit-backdrop-filter: blur(20px) saturate(135%);
}

.brand-button {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    color: var(--text);
    background: transparent;
    border: 0;
}

.brand-orbit {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    box-shadow: inset 0 0 18px rgba(255,255,255,.05);
}

.logo { font-size: 1.42rem; font-weight: 700; letter-spacing: .8px; }
.account-actions { display: flex; align-items: center; gap: 10px; }
.account-btn, .credit-pill {
    width: auto;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: var(--text);
    background: rgba(255,255,255,.07);
    border: 1px solid var(--line);
    border-radius: 999px;
}
.account-btn:hover { background: rgba(255,255,255,.13); }
.account-btn.danger { color: #ffd8db; }
.credit-pill { color: var(--success); font-weight: 700; }

.welcome-screen {
    min-height: 100vh;
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding: 150px 0 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: opacity .35s ease, transform .35s ease;
}

.welcome-screen.is-hidden {
    position: fixed;
    opacity: 0;
    transform: translateY(-16px) scale(.98);
    pointer-events: none;
}

.welcome-copy { max-width: 620px; margin-bottom: 28px; }
.eyebrow, .workspace-kicker {
    display: inline-block;
    color: #c9d0da;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: 1.8px;
}
.welcome-copy h1 {
    margin: 12px 0 10px;
    font-size: clamp(2.15rem, 6vw, 4.4rem);
    line-height: 1.08;
    letter-spacing: -1.5px;
}
.welcome-copy p { margin: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.8; }

.quick-chat-card {
    width: min(650px, 100%);
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 12px 12px 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    background: rgba(14, 17, 22, .7);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.05);
    backdrop-filter: blur(18px);
}

.quick-chat-card textarea, .composer textarea {
    min-height: 48px;
    max-height: 180px;
    flex: 1;
    resize: none;
    overflow-y: auto;
    padding: 13px 8px;
    color: var(--text);
    caret-color: #fff;
    background: transparent;
    border: 0;
    outline: 0;
    line-height: 1.55;
}
.quick-chat-card textarea::placeholder, .composer textarea::placeholder { color: #838b98; }

.quick-chat-card button, #send-btn {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #090a0d;
    background: #fff;
    border: 0;
    border-radius: 14px;
    transition: transform .18s ease, opacity .18s ease;
}
.quick-chat-card button:hover, #send-btn:hover { transform: translateY(-2px); }
.quick-chat-card button:disabled, #send-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.quick-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.quick-actions button {
    width: auto;
    padding: 8px 13px;
    color: #cbd1da;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 999px;
}
.quick-actions button:hover { color: #fff; background: rgba(255,255,255,.1); }

.app-shell {
    width: 100%;
    min-height: 100vh;
    padding-top: 72px;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    direction: rtl;
    opacity: 1;
    transition: opacity .35s ease;
}
.app-shell.is-collapsed { position: fixed; inset: 0; opacity: 0; pointer-events: none; }

.tools-sidebar {
    position: sticky;
    top: 72px;
    height: calc(100vh - 72px);
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 20px 14px;
    background: rgba(5, 7, 10, .7);
    border-left: 1px solid var(--line);
    backdrop-filter: blur(20px);
}
.sidebar-title { padding: 4px 12px 12px; color: #78818e; font-size: .74rem; font-weight: 700; letter-spacing: 1px; }
.tool-button {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    color: #aeb6c1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 13px;
    text-align: right;
    transition: .2s ease;
}
.tool-button:hover { color: #fff; background: rgba(255,255,255,.055); }
.tool-button.active {
    color: #fff;
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.13);
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 0 24px rgba(255,255,255,.035);
}
.tool-button.active::after {
    content: '';
    position: absolute;
    right: -15px;
    width: 3px;
    height: 24px;
    background: #fff;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 14px rgba(255,255,255,.8);
}
.tool-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    border-radius: 10px;
    background: rgba(255,255,255,.06);
}
.tool-button.active .tool-icon { background: rgba(255,255,255,.14); }
.sidebar-spacer { flex: 1; }
.tool-button.secondary { border-top: 1px solid var(--line); border-radius: 0; padding-top: 17px; }

.workspace-main {
    width: 100%;
    min-width: 0;
    min-height: calc(100vh - 72px);
    display: flex;
    flex-direction: column;
    padding: 0 clamp(18px, 4vw, 64px) 24px;
    background: linear-gradient(180deg, rgba(3,4,6,.2), rgba(3,4,6,.54));
}
.workspace-header {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.workspace-header h2 { margin: 5px 0 0; font-size: 1.35rem; }
.icon-button, .close-panel-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #c8cfd9;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.icon-button:hover, .close-panel-btn:hover { color: #fff; background: rgba(255,255,255,.12); }

#main-inputs-wrapper { width: min(920px, 100%); margin: 0 auto; display: flex; flex: 1; flex-direction: column; }
.advanced-settings, .glass-panel, .upload-panel, .book-fields, .result-box, #auto-generation-status {
    margin-top: 18px;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 15px 45px rgba(0,0,0,.22);
    backdrop-filter: blur(22px) saturate(125%);
    -webkit-backdrop-filter: blur(22px) saturate(125%);
}
.advanced-settings { width: min(920px, 100%); margin-inline: auto; }
.settings-label { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-weight: 700; }
.settings-label span { margin-right: auto; color: var(--muted); font-size: .78rem; font-weight: 400; }
.controls-grid { display: grid; grid-template-columns: repeat(4, minmax(135px, 1fr)); gap: 12px; }
label { display: block; margin-bottom: 6px; color: #c2c9d3; font-size: .82rem; font-weight: 600; }

select, input {
    width: 100%;
    padding: 11px 12px;
    color: var(--text);
    background: rgba(255,255,255,.065);
    border: 1px solid var(--line);
    border-radius: 11px;
    outline: 0;
}
select option { color: #111; background: #fff; }
select:focus, input:focus { border-color: rgba(255,255,255,.4); box-shadow: 0 0 0 3px rgba(255,255,255,.06); }

.upload-panel { width: min(920px, 100%); margin-inline: auto; border-style: dashed; }
.upload-panel input { margin-top: 8px; }

.book-fields {
    width: min(920px, 100%);
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}
.book-form-intro { grid-column: 1 / -1; display: flex; align-items: center; gap: 13px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.book-form-intro > span { width: 44px; height: 44px; display: grid; place-items: center; background: rgba(255,255,255,.09); border-radius: 13px; }
.book-form-intro h3 { margin: 0 0 4px; }
.book-form-intro p { margin: 0; color: var(--muted); font-size: .83rem; }
.book-section-title { grid-column: 1 / -1; margin-top: 9px; padding-bottom: 7px; color: #e6e9ee; border-bottom: 1px solid rgba(255,255,255,.08); font-weight: 700; }

.chat-stream { flex: 1; min-height: 0; }
.chat-messages { width: min(820px, 100%); min-height: 320px; margin: 0 auto; padding: 26px 0 130px; }
.message-row { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 22px; animation: messageIn .24s ease both; }
.message-row.user-message { flex-direction: row-reverse; }
.message-avatar { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; color: #0b0c10; background: #fff; border-radius: 11px; }
.user-message .message-avatar { color: #d7dde5; background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.message-content { max-width: min(76%, 680px); }
.message-bubble {
    padding: 13px 15px;
    color: #e9ecf1;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 7px 17px 17px 17px;
    white-space: pre-wrap;
    line-height: 1.75;
    overflow-wrap: anywhere;
}
.user-message .message-bubble { background: rgba(255,255,255,.13); border-radius: 17px 7px 17px 17px; }
.message-source { margin-top: 7px; color: #77818e; font-size: .72rem; }
.message-image { display: block; max-width: min(100%, 620px); max-height: 620px; border-radius: 14px; border: 1px solid var(--line); }

.typing-bubble { min-width: 68px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.typing-bubble i { width: 6px; height: 6px; display: block; background: #cfd5dd; border-radius: 50%; animation: typing 1.15s infinite ease-in-out; }
.typing-bubble i:nth-child(2) { animation-delay: .16s; }
.typing-bubble i:nth-child(3) { animation-delay: .32s; }
.typing-bubble i:nth-child(4) { animation-delay: .48s; }

.composer-wrap {
    position: sticky;
    bottom: 0;
    z-index: 20;
    width: min(820px, 100%);
    margin: auto auto 0;
    padding: 12px 0 0;
    background: linear-gradient(180deg, transparent, rgba(4,5,8,.94) 28%);
}
.composer {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 9px 9px 9px 13px;
    background: rgba(17,20,26,.86);
    border: 1px solid var(--line-strong);
    border-radius: 19px;
    box-shadow: 0 14px 45px rgba(0,0,0,.4), inset 0 1px rgba(255,255,255,.04);
    backdrop-filter: blur(22px);
}
.composer-note { display: flex; justify-content: space-between; gap: 12px; padding: 7px 7px 0; color: #68717d; font-size: .69rem; }
#active-model-label { color: #8f99a7; }

.app-shell[data-action="book_outline"] .chat-stream { display: block; }
.app-shell[data-action="book_outline"] .composer-wrap { margin-top: auto; }

/* نتائج التأليف المتخصصة لا تظهر خارج مساحة الكتاب. */
.app-shell:not([data-action="book_outline"]) #result-area,
.app-shell:not([data-action="book_outline"]) #intro-area,
.app-shell:not([data-action="book_outline"]) #auto-generation-status { display: none !important; }

#loader { text-align: center; color: var(--muted); padding: 10px; }
.result-box { width: min(920px, 100%); margin-inline: auto; }
.result-box h3 { color: var(--text); }
#result-text { color: #e1e5eb; white-space: pre-wrap; line-height: 1.75; }
#book-outline-text { min-height: 430px; padding: 18px; color: #16191f; background: rgba(255,255,255,.94); border-radius: 13px; line-height: 1.8; white-space: pre-wrap; outline: none; }
.result-image { max-width: 100%; height: auto; border-radius: 14px; }
.source-badge { display: inline-block; margin-top: 12px; padding: 6px 10px; color: #d8dde5; background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 999px; font-size: .75rem; }

.glass-panel { width: min(920px, 100%); margin-inline: auto; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; }
.panel-heading h3 { margin: 0; }
#my-library-list { max-height: 260px; overflow-y: auto; margin: 14px 0; }
.small-primary-btn { width: auto; padding: 9px 13px; color: #0b0c0e; background: #fff; border: 0; border-radius: 10px; font-weight: 700; }

button { border: 0; }
.book-toolbar { display: flex; flex-wrap: wrap; gap: 10px; width: min(700px,100%); margin-bottom: 15px; padding: 10px; color: #1f2937; background: rgba(255,255,255,.9); border-radius: 12px; justify-content: center; }
.toolbar-btn { width: auto; padding: 6px 11px; color: #333; background: #fff; border: 1px solid #ccc; border-radius: 6px; }
.book-heading { margin-bottom: 20px; font-size: 1.6em; font-weight: 700; text-align: center; }
.book-cover-title { margin-bottom: 20px; padding-bottom: 10px; color: #fff; font-size: 2em; font-weight: 700; text-align: center; }
.theme-white { background-color: #fff; color: #1f2937; }
.theme-sepia { background-color: #f4ecd8; color: #4a3b2c; }
.theme-dark { background-color: #1a1a1a; color: #e5e5e5; }

.modal { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.72); backdrop-filter: blur(10px); }
.modal-content { width: min(360px, 100%); padding: 26px; text-align: center; background: rgba(18,21,27,.95); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.modal-content input { margin-bottom: 12px; }
.modal-content button { width: 100%; padding: 11px; color: #111; background: #fff; border-radius: 10px; font-weight: 700; }

@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .38; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes messageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 980px) {
    .controls-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
    .app-shell { grid-template-columns: 88px minmax(0, 1fr); }
    .sidebar-title, .tool-button > span:last-child { display: none; }
    .tool-button { justify-content: center; }
    .tool-button.active::after { right: -15px; }
}

@media (max-width: 720px) {
    .nav { height: 62px; padding: 0 14px; }
    .logo { font-size: 1.15rem; }
    .brand-orbit { width: 30px; height: 30px; }
    .account-btn { width: 38px; height: 38px; justify-content: center; padding: 0; }
    .account-btn:not(.danger) { font-size: 0; }
    .account-btn i { font-size: .9rem; }
    .credit-pill { padding: 7px 10px; font-size: .78rem; }
    .welcome-screen { padding-top: 110px; }
    .welcome-copy h1 { font-size: 2.35rem; }
    .welcome-copy p { font-size: .92rem; }
    .app-shell { display: block; padding: 62px 0 74px; }
    .tools-sidebar {
        position: fixed;
        inset: auto 0 0;
        z-index: 90;
        height: 68px;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 3px;
        padding: 7px 8px;
        background: rgba(6,8,11,.92);
        border: 1px solid var(--line);
        backdrop-filter: blur(20px);
    }
    .sidebar-title, .sidebar-spacer { display: none; }
    .tool-button { justify-content: center; padding: 6px; border-radius: 11px; }
    .tool-button.secondary { padding-top: 6px; border-top: 0; border-radius: 11px; }
    .tool-button.active::after { right: 50%; bottom: -7px; width: 22px; height: 2px; transform: translateX(50%); }
    .tool-icon { width: 31px; height: 31px; flex-basis: 31px; }
    .workspace-main { min-height: calc(100vh - 136px); padding: 0 14px 14px; }
    .workspace-header { min-height: 76px; }
    .workspace-header h2 { font-size: 1.15rem; }
    .advanced-settings, .glass-panel, .upload-panel, .book-fields, .result-box { border-radius: 15px; padding: 14px; }
    .controls-grid, .book-fields { grid-template-columns: 1fr; }
    .book-form-intro, .book-section-title { grid-column: 1; }
    .book-fields { max-height: none; }
    .chat-messages { padding-top: 18px; }
    .message-content { max-width: 86%; }
    .message-avatar { width: 30px; height: 30px; flex-basis: 30px; }
    .composer-note span:last-child { display: none; }
    .composer-note { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =========================================================
   AKLAKE GREEN SYSTEM â€” ÙˆØ¶ÙˆØ­ Ø£Ø¹Ù„Ù‰ ÙÙˆÙ‚ Ø®Ù„ÙÙŠØ© Ø§Ù„Ù†Ø¬ÙˆÙ…
   ========================================================= */
:root {
    --green: #79e2ad;
    --green-bright: #a5f3cd;
    --green-deep: #174c39;
    --green-soft: rgba(121, 226, 173, .12);
    --green-line: rgba(121, 226, 173, .34);
    --panel: rgba(7, 14, 12, .86);
    --panel-strong: rgba(6, 12, 10, .96);
    --panel-soft: rgba(121, 226, 173, .065);
    --line: rgba(164, 243, 204, .19);
    --line-strong: rgba(164, 243, 204, .35);
    --text: #f4fff9;
    --muted: #b6cec1;
    --success: var(--green);
}

body {
    --parallax-x: 0px;
    --parallax-y: 0px;
    color: var(--text);
    background-attachment: scroll;
    background-position: calc(50% + var(--parallax-x)) calc(50% + var(--parallax-y));
    transition: background-position .09s linear;
}

body::before {
    background:
        radial-gradient(circle at 16% 24%, rgba(121,226,173,.12), transparent 25%),
        radial-gradient(circle at 82% 68%, rgba(121,226,173,.09), transparent 30%),
        linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,8,5,.22));
}

.nav { background: rgba(3, 9, 7, .78); border-color: var(--green-line); }
.brand-orbit { color: var(--green-bright); border-color: var(--green-line); border-radius: 8px; background: var(--green-soft); box-shadow: 0 0 24px rgba(121,226,173,.13); }
.brand-lockup { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.logo { color: var(--green-bright); font-size: 1.34rem; letter-spacing: 2.3px; text-shadow: 0 0 22px rgba(121,226,173,.18); }
.brand-lockup small { margin-top: 5px; color: #d9f9e8; font-size: .54rem; font-weight: 700; letter-spacing: 2px; }

.account-btn, .credit-pill {
    color: var(--green-bright);
    background: rgba(5, 19, 14, .9);
    border-color: var(--green-line);
    border-radius: 8px;
    font-weight: 700;
}
.account-btn:hover { color: #fff; background: rgba(121,226,173,.16); border-color: var(--green); }
.cart-header-btn { position: relative; }
.cart-header-btn b, #drawer-cart-count {
    min-width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    padding: 0 5px;
    color: #042016;
    background: var(--green-bright);
    border-radius: 5px;
    font-size: .72rem;
}

.eyebrow, .workspace-kicker, .panel-eyebrow { color: var(--green-bright); }
.welcome-copy h1 { color: #fff; text-shadow: 0 8px 34px rgba(0,0,0,.85); }
.welcome-copy p { color: #d2e5da; text-shadow: 0 3px 18px #000; }
.quick-chat-card, .composer {
    background: rgba(5, 15, 11, .9);
    border-color: var(--green-line);
    border-radius: 10px;
    box-shadow: 0 18px 65px rgba(0,0,0,.55), inset 0 1px rgba(165,243,205,.08);
}
.quick-chat-card textarea, .composer textarea { color: #fff; }
.quick-chat-card textarea::placeholder, .composer textarea::placeholder { color: #a7c7b6; }
.quick-chat-card button, #send-btn {
    color: #062017;
    background: var(--green-bright);
    border-radius: 7px;
    box-shadow: 0 0 20px rgba(121,226,173,.16);
}
.quick-actions button, .art-prompt-chips button {
    color: #d8f8e7;
    background: rgba(7,20,15,.88);
    border-color: var(--green-line);
    border-radius: 7px;
    font-weight: 600;
}
.quick-actions button:hover, .art-prompt-chips button:hover { color: #fff; background: var(--green-soft); border-color: var(--green); }

.tools-sidebar { background: rgba(3, 10, 7, .86); border-color: var(--green-line); }
.sidebar-title { color: #9bcbb1; }
.tool-button { color: #c1dfcf; border-radius: 7px; }
.tool-button:hover { color: #fff; background: rgba(121,226,173,.09); border-color: rgba(121,226,173,.18); }
.tool-button.active { color: var(--green-bright); background: rgba(121,226,173,.14); border-color: var(--green-line); box-shadow: inset 0 1px rgba(165,243,205,.12), 0 0 26px rgba(121,226,173,.08); }
.tool-button.active::after { background: var(--green-bright); box-shadow: 0 0 15px var(--green); }
.tool-icon { color: var(--green-bright); background: rgba(121,226,173,.09); border-radius: 6px; }
.tool-button.secondary { color: #d8f8e7; }

.workspace-main { background: linear-gradient(180deg, rgba(0,8,5,.24), rgba(0,8,5,.66)); }
.workspace-header { border-color: rgba(121,226,173,.18); }
.workspace-header h2, .panel-heading h3, .studio-intro h3 { color: #fff; }
.icon-button, .close-panel-btn, .danger-icon-btn {
    color: var(--green-bright);
    background: rgba(5,18,13,.92);
    border: 1px solid var(--green-line);
    border-radius: 7px;
}
.icon-button:hover, .close-panel-btn:hover { color: #fff; background: var(--green-soft); border-color: var(--green); }

.advanced-settings, .glass-panel, .upload-panel, .book-fields, .result-box, #auto-generation-status,
#book-actions, #intro-refine-section {
    color: var(--text) !important;
    background: rgba(5, 14, 10, .9) !important;
    border-color: var(--green-line) !important;
    border-radius: 9px !important;
    box-shadow: 0 18px 50px rgba(0,0,0,.35) !important;
}
.advanced-settings *, .upload-panel *, .book-fields *, .result-box *, #book-actions *, #intro-refine-section * { border-color: var(--line); }
.settings-label, label, .book-section-title, .book-form-intro h3 { color: #e7fff2; }
.settings-label span, .book-form-intro p { color: #b3d3c1; }
.book-form-intro > span { color: var(--green-bright); background: var(--green-soft); border-radius: 7px; }
.book-section-title { color: var(--green-bright); border-color: rgba(121,226,173,.22); }

select, input, textarea {
    color: #f3fff8;
    background: rgba(2, 10, 7, .82);
    border-color: rgba(121,226,173,.25);
    border-radius: 6px;
}
select:focus, input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(121,226,173,.1); }
select option { color: #eafff3; background: #07130e; }
input::placeholder, textarea::placeholder { color: #87aa98; }
input[type="file"]::file-selector-button { color: #062017; background: var(--green-bright); border: 0; border-radius: 5px; padding: 8px 10px; font-weight: 700; }

.message-avatar { color: #062017; background: var(--green-bright); border-radius: 7px; }
.user-message .message-avatar { color: var(--green-bright); background: rgba(121,226,173,.1); border-color: var(--green-line); }
.message-bubble { color: #effff6; background: rgba(5,18,13,.9); border-color: rgba(121,226,173,.2); border-radius: 5px 10px 10px 10px; }
.user-message .message-bubble { background: rgba(121,226,173,.13); border-radius: 10px 5px 10px 10px; }
.message-source, .composer-note, #active-model-label { color: #a3c7b3; }
.typing-bubble i { background: var(--green-bright); }
.composer-wrap { background: linear-gradient(180deg, transparent, rgba(1,8,5,.97) 30%); }
.source-badge { color: var(--green-bright); background: var(--green-soft); border-color: var(--green-line); border-radius: 6px; }
.modal-content { color: #effff6; background: rgba(4,14,10,.98); border-color: var(--green-line); border-radius: 8px; }
.modal-content h3 { color: #fff; }
.modal-content a { color: var(--green-bright) !important; }
.modal-content button { color: #062017 !important; background: var(--green-bright) !important; border-radius: 6px; }
.modal-content button[onclick="closeModal()"] { color: #c6e7d5 !important; background: transparent !important; }
.book-toolbar { color: #effff6 !important; background: rgba(5,16,12,.94) !important; border: 1px solid var(--green-line) !important; border-radius: 7px !important; }
.book-toolbar label { color: #dffbed !important; }
.toolbar-btn { color: #eafff3 !important; background: rgba(121,226,173,.1) !important; border-color: var(--green-line) !important; border-radius: 5px !important; }
.toolbar-btn:hover { background: rgba(121,226,173,.2) !important; }
#editable-outline-container > div:first-child,
#book-actions > div,
#intro-refine-section { background: rgba(121,226,173,.06) !important; border-color: var(--green-line) !important; border-radius: 6px !important; }
#refine-btn, #write-intro-btn, #refine-intro-btn, #continue-writing-btn, #start-auto-btn, #new-book-btn,
#prev-page-btn, #next-page-btn {
    color: #f4fff9 !important;
    background: #176244 !important;
    border: 1px solid rgba(165,243,205,.4) !important;
    border-radius: 6px !important;
}
#page-indicator, #remaining-pages-display { color: var(--green-bright) !important; }

.small-primary-btn, .art-primary-btn, .checkout-btn {
    color: #062017 !important;
    background: var(--green-bright) !important;
    border: 1px solid var(--green-bright) !important;
    border-radius: 6px !important;
    font-weight: 700;
}
.small-primary-btn:hover, .art-primary-btn:hover { background: #c1f9dd !important; }
.library-book-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    text-align: right;
    color: #eafff3 !important;
    background: rgba(5,18,13,.88) !important;
    border: 1px solid var(--green-line) !important;
    border-radius: 6px !important;
}
.library-book-btn:hover { background: rgba(121,226,173,.12) !important; }
.library-book-btn strong { color: var(--token-orange) !important; }
.library-book-card {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(121,226,173,.045);
    border: 1px solid rgba(121,226,173,.12);
    border-radius: 7px;
}
.book-to-landing-btn {
    width: 100%;
    padding: 9px 11px;
    color: #062017;
    background: var(--green-bright);
    border: 1px solid var(--green-bright);
    border-radius: 6px;
    font-weight: 800;
}
.book-to-landing-btn:hover { background: #c1f9dd; }
/* Ù†Ø§ÙØ°Ø© Ø§Ù„Ø£Ø¹Ù…Ø§Ù„ Ø§Ù„Ø¬Ø§Ù†Ø¨ÙŠØ© */
/* Ù†Ø§ÙØ°Ø© Ø§Ù„Ø£Ø¹Ù…Ø§Ù„ Ø§Ù„Ø¬Ø§Ù†Ø¨ÙŠØ© */
.library-drawer {
    position: fixed;
    z-index: 80;
    top: 72px;
    right: 220px;
    width: min(410px, calc(100vw - 220px));
    height: calc(100vh - 72px);
    padding: 20px;
    overflow-y: auto;
    color: #effff6;
    background: rgba(3, 11, 8, .97);
    border-left: 1px solid var(--green-line);
    box-shadow: -26px 0 70px rgba(0,0,0,.42);
    backdrop-filter: blur(24px);
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading h3 { margin: 5px 0 0; }
.library-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 20px 0; padding: 5px; background: rgba(121,226,173,.055); border: 1px solid var(--line); border-radius: 7px; }
.library-tab { padding: 9px 6px; color: #b9d5c6; background: transparent; border: 1px solid transparent; border-radius: 5px; font-weight: 700; }
.library-tab.active { color: var(--green-bright); background: var(--green-soft); border-color: var(--green-line); }
.artworks-library-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.artwork-library-card { padding: 8px; color: #eafff3; background: rgba(121,226,173,.06); border: 1px solid var(--line); border-radius: 7px; }
.artwork-library-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #f5f2e9; border-radius: 4px; }
.artwork-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: .76rem; }
.artwork-card-meta button, .cart-item button { color: #ffafb4; background: transparent; }
.empty-library { padding: 30px 12px; color: #a8c5b5; text-align: center; border: 1px dashed var(--green-line); border-radius: 7px; }
.cart-list { display: grid; gap: 9px; }
.cart-item { display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 10px; padding: 9px; background: rgba(121,226,173,.055); border: 1px solid var(--line); border-radius: 7px; }
.cart-item img { width: 62px; height: 52px; object-fit: cover; background: #f4f0e5; border-radius: 4px; }
.cart-item strong, .cart-item span { display: block; color: #effff6; }
.cart-item span { margin-top: 4px; color: var(--green-bright); font-size: .76rem; }
.cart-summary { display: flex; justify-content: space-between; margin: 16px 0 12px; padding-top: 14px; border-top: 1px solid var(--green-line); }
.cart-summary strong { color: var(--green-bright); }
.checkout-btn { width: 100%; padding: 11px; }

/* Ø§Ø³ØªÙˆØ¯ÙŠÙˆ Ø§Ù„Ù„ÙˆØ­Ø§Øª */
.art-studio { width: min(1180px, 100%); margin: 18px auto 40px; }
.studio-intro { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin-bottom: 14px; padding: 16px; background: rgba(5,16,12,.92); border: 1px solid var(--green-line); border-radius: 8px; }
.studio-intro-icon { width: 48px; height: 48px; display: grid; place-items: center; color: var(--green-bright); background: var(--green-soft); border: 1px solid var(--green-line); border-radius: 7px; font-size: 1.25rem; }
.studio-intro h3 { margin: 4px 0 3px; }
.studio-intro p { margin: 0; color: #b7d1c2; font-size: .82rem; }
.studio-model-badge { display: grid; grid-template-columns: auto auto; gap: 2px 8px; padding: 9px 11px; color: var(--green-bright); background: rgba(121,226,173,.08); border: 1px solid var(--green-line); border-radius: 6px; font-size: .7rem; }
.studio-model-badge i { grid-row: 1 / 3; align-self: center; }
.studio-model-badge strong { color: #fff; }
.art-studio-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 14px; direction: ltr; }
.art-stage-column, .art-editor-panel { direction: rtl; }
.art-wall-stage {
    position: relative;
    width: 100%;
    min-height: 520px;
    overflow: hidden;
    isolation: isolate;
    background-image:
        linear-gradient(180deg, rgba(7,14,11,.06), rgba(7,14,11,.12)),
        url('art-room-bg.jpg'),
        linear-gradient(180deg, #c9c4b8 0 69%, #72695d 69% 100%);
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(121,226,173,.42);
    border-radius: 8px;
    box-shadow: 0 26px 70px rgba(0,0,0,.42), inset 0 0 60px rgba(0,0,0,.12);
    touch-action: none;
}
.room-light { position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 50% 0, rgba(255,255,238,.46), transparent 45%); }
.room-floor { position: absolute; inset: 69% 0 0; z-index: -1; pointer-events: none; background: linear-gradient(105deg, rgba(255,255,255,.05), transparent 35%), repeating-linear-gradient(92deg, rgba(0,0,0,.04) 0 2px, transparent 2px 70px); transform: perspective(300px) rotateX(7deg); transform-origin: bottom; }
.art-frames-layer { position: absolute; inset: 7% 4% 25%; }
.empty-wall-hint { position: absolute; top: 33%; left: 50%; width: min(310px, 80%); display: grid; justify-items: center; gap: 6px; padding: 15px; color: #1a3c2e; background: rgba(238,255,247,.78); border: 1px dashed rgba(18,88,58,.45); border-radius: 7px; text-align: center; transform: translate(-50%,-50%); backdrop-filter: blur(6px); }
.empty-wall-hint i { color: #247553; }
.empty-wall-hint span { font-size: .73rem; }
.art-frame {
    position: absolute;
    display: grid;
    place-items: center;
    padding: 7px;
    background: #27231f;
    border: 3px solid #cbb98f;
    border-radius: 3px;
    box-shadow: 0 10px 20px rgba(0,0,0,.38), inset 0 0 0 2px #40372c;
    cursor: grab;
    user-select: none;
    touch-action: none;
}
.art-frame:active { cursor: grabbing; }
.art-frame.large { width: 29%; aspect-ratio: 4 / 3; }
.art-frame.medium { width: 23%; aspect-ratio: 4 / 3; }
.art-frame.small { width: 17%; aspect-ratio: 4 / 3; }
.art-frame.selected { outline: 3px solid var(--green-bright); outline-offset: 4px; box-shadow: 0 0 0 7px rgba(121,226,173,.14), 0 12px 24px rgba(0,0,0,.45); }
.art-frame.collision { outline: 3px solid #ff7d86; }
.art-frame-canvas { position: relative; width: 100%; height: 100%; overflow: hidden; display: grid; place-items: center; background: #f5f1e6; }
.art-frame-canvas > img { width: 100%; height: 100%; display: block; object-fit: cover; pointer-events: none; }
.art-frame-placeholder { display: grid; justify-items: center; gap: 5px; color: #436152; font-size: .68rem; text-align: center; }
.art-frame-placeholder i { font-size: 1.15rem; color: #2e7655; }
.brush-loader { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; overflow: hidden; background: rgba(5,18,13,.62); backdrop-filter: blur(3px); }
.art-frame.processing .brush-loader { display: flex; }
.brush-loader i { position: absolute; width: 60%; height: 6px; background: linear-gradient(90deg, transparent, var(--green-bright), transparent); border-radius: 2px; filter: drop-shadow(0 0 7px var(--green)); animation: brushSweep 1.15s infinite ease-in-out alternate; }
.brush-loader i:nth-child(2) { width: 45%; animation-delay: .22s; }
.brush-loader i:nth-child(3) { width: 32%; animation-delay: .44s; }
.frame-size-picker { display: grid; grid-template-columns: 1fr repeat(3, auto); align-items: center; gap: 8px; margin-top: 10px; padding: 10px; background: rgba(5,16,12,.94); border: 1px solid var(--green-line); border-radius: 7px; }
.frame-size-picker > div { display: grid; }
.frame-size-picker > div strong { color: #fff; font-size: .84rem; }
.frame-size-picker button { min-width: 76px; display: grid; justify-items: center; gap: 3px; padding: 8px; color: var(--green-bright); background: rgba(121,226,173,.07); border: 1px solid var(--green-line); border-radius: 6px; }
.frame-size-picker button:hover { color: #fff; background: rgba(121,226,173,.16); }
.frame-size-picker button span { font-size: .72rem; }
.art-editor-panel { min-height: 520px; padding: 16px; background: rgba(4,14,10,.96); border: 1px solid var(--green-line); border-radius: 8px; box-shadow: 0 20px 55px rgba(0,0,0,.32); }
.art-editor-empty { min-height: 480px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: #a9c9b8; text-align: center; }
.art-editor-empty > i { width: 48px; height: 48px; display: grid; place-items: center; color: var(--green-bright); background: var(--green-soft); border-radius: 7px; }
.art-editor-empty h4 { margin: 8px 0 0; color: #fff; }
.art-editor-empty p { max-width: 230px; margin: 0; font-size: .8rem; line-height: 1.6; }
.selected-art-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.selected-art-heading h4 { margin: 4px 0 0; color: #fff; }
.danger-icon-btn { width: 38px; height: 38px; color: #ffafb4; border-color: rgba(255,125,134,.34); }
.art-upload-box { min-height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; margin-bottom: 13px; padding: 12px; color: #d8f7e6; background: rgba(121,226,173,.055); border: 1px dashed var(--green-line); border-radius: 6px; cursor: pointer; }
.art-upload-box:hover { background: rgba(121,226,173,.1); border-color: var(--green); }
.art-upload-box i { color: var(--green-bright); font-size: 1.25rem; }
.art-upload-box span { color: #98b9a7; font-size: .7rem; }
.art-upload-box input { display: none; }
#art-prompt { width: 100%; resize: vertical; margin-bottom: 8px; padding: 10px; }
.art-prompt-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.art-prompt-chips button { padding: 5px 8px; font-size: .68rem; }
.art-action-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 7px; }
.art-primary-btn, .art-secondary-btn, .art-save-btn, .art-cart-btn { padding: 10px 8px; border-radius: 6px; font-weight: 700; }
.art-secondary-btn { color: var(--green-bright); background: rgba(121,226,173,.08); border: 1px solid var(--green-line); }
.art-secondary-btn:hover { color: #fff; background: rgba(121,226,173,.15); }
.art-save-btn, .art-cart-btn { width: 100%; margin-top: 7px; color: #e9fff3; background: rgba(5,20,14,.9); border: 1px solid var(--green-line); }
.art-save-btn:hover, .art-cart-btn:hover { color: var(--green-bright); background: var(--green-soft); }
.art-studio-status { min-height: 20px; margin-top: 8px; color: #a9c9b8; font-size: .74rem; line-height: 1.5; }
.art-studio-status.success { color: var(--green-bright); }
.art-studio-status.error { color: #ffafb4; }
.app-shell[data-action="art_studio"] #chat-stream,
.app-shell[data-action="art_studio"] .composer-wrap,
.app-shell[data-action="art_studio"] #advanced-settings { display: none !important; }

@keyframes brushSweep { from { transform: translate(-45%, -28px) rotate(-12deg); opacity: .45; } to { transform: translate(45%, 28px) rotate(-12deg); opacity: 1; } }

@media (max-width: 1100px) {
    .art-studio-layout { grid-template-columns: 1fr; }
    .art-editor-panel { min-height: auto; }
    .art-editor-empty { min-height: 180px; }
    .library-drawer { right: 88px; width: min(410px, calc(100vw - 88px)); }
}

@media (max-width: 720px) {
    .tools-sidebar { grid-template-columns: repeat(6, 1fr); }
    .cart-button-text,
    .brand-lockup small { display: none; }
    .library-drawer { top: 62px; right: 0; bottom: 68px; width: 100%; height: auto; padding: 15px; }
    .studio-intro { grid-template-columns: auto 1fr; }
    .studio-model-badge { grid-column: 1 / -1; grid-template-columns: auto auto 1fr; }
    .studio-model-badge i { grid-row: auto; }
    .art-wall-stage { min-height: 390px; }
    .art-frames-layer { inset: 7% 3% 23%; }
    .art-frame.large { width: 38%; }
    .art-frame.medium { width: 31%; }
    .art-frame.small { width: 24%; }
    .frame-size-picker { grid-template-columns: repeat(3, 1fr); }
    .frame-size-picker > div { grid-column: 1 / -1; }
    .frame-size-picker button { min-width: 0; }
    .art-action-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   ART GALLERY V2 â€” Ù…Ø¹Ø±Ø¶ ÙƒØ¨ÙŠØ±ØŒ Ù…Ø³ØªØ·ÙŠÙ„Ø§Øª Ø­Ø§Ø¯Ø© ÙˆØ£Ø¯ÙˆØ§Øª Ù„ÙƒÙ„ Ù„ÙˆØ­Ø©
   ========================================================= */
.brand-navigation { display: flex; align-items: center; gap: 8px; }
.brand-button { text-decoration: none; cursor: grab; }
.brand-button:active { cursor: grabbing; }
.home-button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--green-bright);
    background: rgba(5,19,14,.9);
    border: 1px solid var(--green-line);
    border-radius: 5px;
}
.home-button:hover { color: #fff; background: rgba(121,226,173,.16); border-color: var(--green); }

/* Ø§Ù„Ø®Ù„ÙÙŠØ© ÙÙŠ Ø·Ø¨Ù‚Ø© ÙˆØ§Ø­Ø¯Ø© Ø«Ø§Ø¨ØªØ© ÙˆÙ…Ù† Ø¯ÙˆÙ† ØªÙƒØ±Ø§Ø±Ø› ØªØªØ­Ø±Ùƒ Ø¨Ù‡Ø¯ÙˆØ¡ Ø¨ÙˆØ§Ø³Ø·Ø© transform ÙÙ‚Ø· */
body {
    background-color: #010503;
    background-image: none !important;
    background-position: center !important;
    transition: none !important;
}
body::after {
    content: '';
    position: fixed;
    inset: -5%;
    z-index: -2;
    pointer-events: none;
    background-image: url('https://static.verse.works/image/source/static%2Fuploads%2F0x7c1bd459dae8ec0bb45fe3172fd58a2b53972e5c%2F0a4c679d-d98e-4e0c-98d7-3e62f8f42fe0.gif');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    transform: translate3d(var(--parallax-x), var(--parallax-y), 0) scale(1.06);
    transition: transform .32s cubic-bezier(.2,.7,.2,1);
    will-change: transform;
    animation: cosmicBackgroundPan 70s ease-in-out infinite alternate;
}
@keyframes cosmicBackgroundPan {
    0% { background-position: 48% 48%; }
    100% { background-position: 52% 52%; }
}

.app-shell[data-action="art_studio"] #main-inputs-wrapper { width: min(1500px, 100%); }
.art-studio { width: 100%; max-width: 1500px; }
.studio-intro { border-radius: 4px; }
.art-stage-column { width: 100%; }
.art-wall-stage {
    min-height: 760px;
    background-image:
        linear-gradient(180deg, rgba(5,12,9,.02), rgba(5,12,9,.08)),
        url('https://i.ibb.co/Jw0tXBgf/93434740ef44485e986903584f4076eb.jpg'),
        linear-gradient(180deg, #d7d2c8 0 78%, #756e64 78% 100%);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    border-radius: 2px;
}
.room-floor { display: none; }
.art-frames-layer { inset: 7% 2% 9%; }
.empty-wall-hint { border-radius: 2px; }
.frame-size-picker { border-radius: 4px; }
.frame-size-picker button { border-radius: 3px; min-width: 104px; }
.art-studio-status { min-height: 24px; padding: 8px 4px; }

/* Ø§Ù„Ù„ÙˆØ­Ø© Ù†ÙØ³Ù‡Ø§ Ø¨Ù„Ø§ Ø®Ù„ÙÙŠØ© Ø£Ùˆ Ø­ÙˆØ§Ù Ø¯Ø§Ø¦Ø±ÙŠØ©Ø› Ø§Ù„Ø¥Ø·Ø§Ø± ÙŠØ·Ø¨Ù‘Ù‚ ÙÙ‚Ø· Ø¹Ù„Ù‰ Ø§Ù„Ù‚Ù…Ø§Ø´ */
.art-frame {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    cursor: default;
    overflow: visible;
    transition: left .15s ease, top .15s ease;
}
.art-frame.large { width: 44%; aspect-ratio: auto; }
.art-frame.medium { width: 36%; aspect-ratio: auto; }
.art-frame.small { width: 30%; aspect-ratio: auto; }
.art-frame.orientation-vertical.large { width: 27.5%; }
.art-frame.orientation-vertical.medium { width: 22.5%; }
.art-frame.orientation-vertical.small { width: 18.75%; }
.art-frame.selected { outline: 0; box-shadow: none; }
.art-frame.selected .art-frame-canvas { outline: 2px solid var(--green-bright); outline-offset: 3px; }
.art-frame.collision .art-frame-canvas { outline: 3px solid #ff7d86; outline-offset: 2px; }

.art-frame-canvas {
    aspect-ratio: 16 / 10;
    padding: 0;
    border-radius: 0;
    background: #f4f1e8;
    box-shadow: 0 13px 27px rgba(0,0,0,.35);
    overflow: hidden;
}
.art-frame.orientation-vertical .art-frame-canvas { aspect-ratio: 10 / 16; }
.art-frame.frame-style-classic .art-frame-canvas {
    border: 8px solid #28231d;
    box-shadow: inset 0 0 0 2px #b9a77d, 0 13px 27px rgba(0,0,0,.4);
}
.art-frame.frame-style-thin .art-frame-canvas {
    border: 2px solid #24211d;
    box-shadow: 0 12px 24px rgba(0,0,0,.34);
}
.art-frame.frame-style-frameless .art-frame-canvas {
    border: 0;
    box-shadow: 0 10px 22px rgba(0,0,0,.26);
}

.art-frame-toolbar {
    position: absolute;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 5;
    display: flex;
    gap: 4px;
    opacity: .9;
}
.art-frame-toolbar button,
.art-frame-actions button,
.frame-placeholder-actions button {
    min-width: 30px;
    min-height: 29px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 7px;
    color: #eafff3;
    background: rgba(3,14,9,.94);
    border: 1px solid rgba(121,226,173,.46);
    border-radius: 2px;
    font-size: .68rem;
    box-shadow: 0 5px 15px rgba(0,0,0,.22);
}
.art-frame-toolbar button:hover,
.art-frame-actions button:hover,
.frame-placeholder-actions button:hover { color: var(--green-bright); background: rgba(13,54,37,.96); }
.art-frame-toolbar .frame-drag-handle { cursor: grab; }
.art-frame-toolbar .frame-drag-handle:active { cursor: grabbing; }
.art-frame-toolbar .frame-delete-btn { color: #ffb6ba; border-color: rgba(255,125,134,.42); }

.frame-placeholder-actions {
    width: 78%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.frame-placeholder-actions button { min-height: 36px; color: #164e37; background: rgba(238,255,247,.9); border-color: rgba(30,105,74,.34); box-shadow: none; font-weight: 700; }
.frame-placeholder-actions button:hover { color: #082d20; background: #d9ffeb; }
.frame-placeholder-actions button span { white-space: nowrap; }

.art-frame-actions {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 100%;
}
.art-frame-actions .frame-transform-btn { color: #062017; background: var(--green-bright); font-weight: 700; }
.art-frame-actions .frame-cart-btn { color: var(--green-bright); }
.art-frame-actions .frame-save-btn.saved { color: #062017; background: #bff8dc; }

/* Ù†ÙˆØ§ÙØ° Ø§Ù„Ø¨Ø±ÙˆÙ…Ø¨Øª ÙˆØ§Ù„Ø§Ø®ØªÙŠØ§Ø± ØªØ¸Ù‡Ø± Ø¹Ù†Ø¯ Ø§Ù„Ø­Ø§Ø¬Ø© ÙÙ‚Ø· */
.studio-dialog {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0,6,3,.74);
    backdrop-filter: blur(12px);
}
.studio-dialog-card {
    width: min(570px, 100%);
    padding: 20px;
    color: #effff6;
    background: rgba(4,16,11,.98);
    border: 1px solid var(--green-line);
    border-radius: 4px;
    box-shadow: 0 30px 90px rgba(0,0,0,.62);
}
.studio-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.studio-dialog-heading h3, .compact-dialog h3 { margin: 5px 0 0; color: #fff; }
.studio-dialog-heading > button { width: 36px; height: 36px; color: var(--green-bright); background: rgba(121,226,173,.08); border: 1px solid var(--green-line); border-radius: 2px; }
.studio-dialog textarea { width: 100%; margin-bottom: 9px; }
.studio-dialog .art-primary-btn { width: 100%; margin-top: 8px; padding: 11px; }
.compact-dialog { max-width: 500px; text-align: center; }
.compact-dialog p { color: #b8d4c4; line-height: 1.7; }
.dialog-choice-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 10px; color: var(--green-bright); background: var(--green-soft); border: 1px solid var(--green-line); border-radius: 2px; }
.replace-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.replace-choice-grid button { display: grid; justify-items: center; gap: 5px; padding: 14px 10px; color: #eafff3; background: rgba(121,226,173,.07); border: 1px solid var(--green-line); border-radius: 2px; }
.replace-choice-grid button:hover { background: rgba(121,226,173,.14); border-color: var(--green); }
.replace-choice-grid button i { color: var(--green-bright); font-size: 1.1rem; }
.replace-choice-grid button span { color: #9fc1ae; font-size: .7rem; }
.dialog-cancel-btn { margin-top: 10px; padding: 7px 12px; color: #bcd8c8; background: transparent; border: 0; }

@media (max-width: 980px) {
    .art-wall-stage { min-height: 620px; }
    .art-frame.large { width: 52%; }
    .art-frame.medium { width: 44%; }
    .art-frame.small { width: 36%; }
    .art-frame.orientation-vertical.large { width: 32.5%; }
    .art-frame.orientation-vertical.medium { width: 27.5%; }
    .art-frame.orientation-vertical.small { width: 22.5%; }
}

@media (max-width: 720px) {
    .home-button { width: 34px; height: 34px; }
    .brand-navigation { gap: 5px; }
    .art-wall-stage { min-height: 530px; }
    .art-frames-layer { inset: 9% 2% 10%; }
    .art-frame.large { width: 60%; }
    .art-frame.medium { width: 52%; }
    .art-frame.small { width: 44%; }
    .art-frame.orientation-vertical.large { width: 37.5%; }
    .art-frame.orientation-vertical.medium { width: 32.5%; }
    .art-frame.orientation-vertical.small { width: 27.5%; }
    .art-frame-toolbar button, .art-frame-actions button { padding: 4px 5px; font-size: .62rem; }
    .frame-size-picker { grid-template-columns: repeat(3,1fr); }
    .replace-choice-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   UNIFIED CHAT â€” Ø§Ù„Ø´Ø§Øª ÙˆØ§Ù„ØµÙˆØ± ÙˆØ§Ø®ØªÙŠØ§Ø± Ø§Ù„Ù†Ù…ÙˆØ°Ø¬ ÙÙŠ Ù…ÙƒØ§Ù† ÙˆØ§Ø­Ø¯
   ========================================================= */
body::after {
    background-image: url('https://static.verse.works/image/source/static%2Fuploads%2F0x7c1bd459dae8ec0bb45fe3172fd58a2b53972e5c%2F0a4c679d-d98e-4e0c-98d7-3e62f8f42fe0.gif') !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-position: center center;
}

.agent-avatar {
    overflow: hidden;
    padding: 0;
    color: transparent;
    background: #07130e;
    border: 1px solid var(--green-line);
}
.agent-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.composer-wrap { position: sticky; overflow: visible; }
.composer { padding: 8px; gap: 7px; }
.composer-side-btn {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--green-bright);
    background: rgba(121,226,173,.09);
    border: 1px solid var(--green-line);
    border-radius: 6px;
}
.composer-side-btn:hover { color: #fff; background: rgba(121,226,173,.17); }
.composer-side-btn.active { color: #062017; background: var(--green-bright); }

.composer-tools {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 4px 0;
}
.composer-tools > button {
    width: auto;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    color: #c9e8d7;
    background: rgba(5,18,13,.9);
    border: 1px solid rgba(121,226,173,.22);
    border-radius: 5px;
    font-size: .72rem;
}
.composer-tools > button:hover { color: #fff; border-color: var(--green-line); }
.composer-tools > button.active { color: var(--green-bright); background: var(--green-soft); border-color: var(--green); }
.composer-shortcut { margin-right: auto; color: #8fb19f; font-size: .68rem; }

.composer-mode-banner,
.composer-attachment-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 7px;
    padding: 9px 10px;
    color: #eafff3;
    background: rgba(5,20,14,.96);
    border: 1px solid var(--green-line);
    border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0,0,0,.28);
}
.composer-mode-banner > span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    color: #062017;
    background: var(--green-bright);
    border-radius: 5px;
}
.composer-mode-banner div,
.composer-attachment-preview div { display: grid; }
.composer-mode-banner small,
.composer-attachment-preview span { color: #99beaa; font-size: .68rem; }
.composer-mode-banner > button,
.composer-attachment-preview > button {
    width: 32px;
    height: 32px;
    margin-right: auto;
    padding: 0;
    color: #d7f3e4;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 4px;
}
.composer-attachment-preview img {
    width: 54px;
    height: 45px;
    object-fit: cover;
    border: 1px solid var(--green-line);
    border-radius: 3px;
}
.composer-attachment-file-icon {
    width: 46px;
    height: 45px;
    display: grid;
    place-items: center;
    flex: 0 0 46px;
    color: var(--green-bright);
    background: rgba(121,226,173,.09);
    border: 1px solid var(--green-line);
    border-radius: 5px;
    font-size: 1.15rem;
}

.model-chooser-popover {
    position: absolute;
    z-index: 100;
    right: 0;
    bottom: calc(100% + 10px);
    width: min(520px, 100%);
    padding: 16px;
    color: #effff6;
    background: rgba(3,14,9,.985);
    border: 1px solid var(--green-line);
    border-radius: 7px;
    box-shadow: 0 24px 80px rgba(0,0,0,.62);
    backdrop-filter: blur(22px);
}
.model-chooser-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.model-chooser-heading h3 { margin: 4px 0 0; color: #fff; }
.model-chooser-heading > button {
    width: 34px;
    height: 34px;
    padding: 0;
    color: var(--green-bright);
    background: rgba(121,226,173,.08);
    border: 1px solid var(--green-line);
    border-radius: 4px;
}
#model-chooser-description { margin: 8px 0 12px; color: #a9c9b8; font-size: .78rem; }
.model-choices-list { display: grid; gap: 6px; max-height: 290px; overflow-y: auto; }
.model-choice-card {
    width: 100%;
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 9px;
    color: #def7e9;
    background: rgba(121,226,173,.045);
    border: 1px solid rgba(121,226,173,.18);
    border-radius: 5px;
    text-align: right;
}
.model-choice-card:hover { background: rgba(121,226,173,.09); border-color: var(--green-line); }
.model-choice-card.selected { background: rgba(121,226,173,.14); border-color: var(--green-bright); }
.model-choice-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: var(--green-bright);
    background: rgba(121,226,173,.1);
    border-radius: 4px;
}
.model-choice-copy { display: grid; gap: 2px; }
.model-choice-copy small { color: #92b7a2; font-size: .68rem; }
.model-choice-cost { color: var(--green-bright); font-size: .7rem; font-weight: 700; white-space: nowrap; }
.remember-model-card {
    display: grid;
    grid-template-columns: auto 36px 1fr auto;
    align-items: center;
    gap: 9px;
    margin: 11px 0;
    padding: 9px;
    color: #e9fff3;
    background: rgba(121,226,173,.055);
    border: 1px solid var(--green-line);
    border-radius: 5px;
    cursor: pointer;
}
.remember-model-card input { position: absolute; opacity: 0; pointer-events: none; }
.memory-card-icon { width: 34px; height: 34px; display: grid; place-items: center; color: var(--green-bright); background: rgba(121,226,173,.1); border-radius: 4px; }
.remember-model-card > span:nth-of-type(2) { display: grid; }
.remember-model-card small { color: #92b7a2; font-size: .67rem; }
.remember-toggle-icon { color: #82a692; font-size: 1.25rem; }
.remember-model-card:has(input:checked) { background: rgba(121,226,173,.13); border-color: var(--green); }
.remember-model-card:has(input:checked) .remember-toggle-icon { color: var(--green-bright); }
.confirm-model-choice-btn {
    width: 100%;
    padding: 10px;
    color: #062017;
    background: var(--green-bright);
    border: 0;
    border-radius: 5px;
    font-weight: 700;
}
.confirm-model-choice-btn:disabled { opacity: .45; cursor: not-allowed; }

/*** Ø§Ù„Ø¥Ø±ÙØ§Ù‚ Ø£ØµØ¨Ø­ Ø¯Ø§Ø®Ù„ Ø®Ø§Ù†Ø© Ø§Ù„Ù…Ø­Ø§Ø¯Ø«Ø©ØŒ Ù„Ø°Ù„Ùƒ Ù„Ø§ Ù†Ø¹Ø±Ø¶ Ø®Ø§Ù†Ø© Ø§Ù„Ø±ÙØ¹ Ø§Ù„Ù‚Ø¯ÙŠÙ…Ø© */
.app-shell[data-action="edit"] #image-upload-section,
.app-shell[data-action="book_outline"] .composer-mode-banner { display: none !important; }
.app-shell[data-action="book_outline"] .composer-side-btn { display: grid !important; }
.app-shell[data-action="book_outline"] .composer-attachment-preview:not(.hidden),
.app-shell[data-action="book_outline"] .composer-tools { display: flex !important; }
.app-shell[data-action="book_outline"] #composer-image-mode-btn,
.app-shell[data-action="book_outline"] .composer-shortcut { display: none !important; }

@media (max-width: 720px) {
    .tools-sidebar { grid-template-columns: repeat(4,1fr); }
    .model-chooser-popover { position: fixed; right: 10px; bottom: 78px; width: calc(100% - 20px); max-height: calc(100vh - 100px); overflow-y: auto; }
    .composer-shortcut { display: none; }
    .composer-tools { flex-wrap: wrap; }
    .composer-tools > button { flex: 1; justify-content: center; }
    .composer-mode-banner small { display: none; }
}

/* =========================================================
   FINAL UI FIXES â€” Ø§Ù„Ø®Ù„ÙÙŠØ©ØŒ Ù†Ù‚Ø§Ø· Ø§Ù„Ø§Ø³ØªØ®Ø¯Ø§Ù…ØŒ ØµÙˆØ±Ø© Ø§Ù„ÙˆÙƒÙŠÙ„ØŒ ÙˆÙ†Ù…Ø§Ø°Ø¬ Ø§Ù„Ù„ÙˆØ­Ø§Øª
   ========================================================= */

/* Ø£Ø±Ù‚Ø§Ù… Ø§Ù„Ù†Ù‚Ø§Ø· ÙˆØ±Ù…Ø²Ù‡Ø§ ÙˆØªÙƒÙ„ÙØ© ÙƒÙ„ Ù†Ù…ÙˆØ°Ø¬ Ø¨Ù„ÙˆÙ† Ø¨Ø±ØªÙ‚Ø§Ù„ÙŠ Ù…Ø±ÙŠØ­ ÙˆÙˆØ§Ø¶Ø­. */
.credit-pill { color: #d9e6de; }
.credit-pill .token-mark,
.credit-pill .token-value,
.credit-pill .token-unit,
.model-choice-cost,
.token-cost,
.studio-model-badge .token-mark {
    color: var(--token-orange) !important;
    text-shadow: 0 0 10px rgba(255, 174, 98, .24);
}
.credit-pill .token-value { font-size: 1.02rem; font-weight: 800; }
.token-cost { margin-inline-start: 3px; font-weight: 800; white-space: nowrap; }

/* ØªÙƒØ¨ÙŠØ± ØµÙˆØ±Ø© ÙˆÙƒÙŠÙ„ Ø§Ù„Ù…Ø­Ø§Ø¯Ø«Ø© Ù‚Ù„ÙŠÙ„Ù‹Ø§ Ù…Ø¹ Ø§Ù„Ø­ÙØ§Ø¸ Ø¹Ù„Ù‰ Ø­Ø¬Ù… ØµÙˆØ±Ø© Ø§Ù„Ù…Ø³ØªØ®Ø¯Ù…. */
.message-avatar.agent-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
}

/* Ø§Ù„Ø®Ù„ÙÙŠØ© Ø§Ù„Ù…ØªØ­Ø±ÙƒØ© Ø«Ø§Ø¨ØªØ© Ø¹Ù„Ù‰ Ø§Ù„Ø­Ø§Ø³ÙˆØ¨ ÙÙ‚Ø· ÙˆÙ„Ø§ ØªØªÙØ§Ø¹Ù„ Ù…Ø¹ Ø§Ù„Ù…Ø¤Ø´Ø± Ø£Ùˆ Ø§Ù„ØªÙ…Ø±ÙŠØ±. */
body::after { content: none !important; }
@media (min-width: 721px) {
    body {
        background-color: #010503 !important;
        background-image: url('https://static.verse.works/image/source/static%2Fuploads%2F0x7c1bd459dae8ec0bb45fe3172fd58a2b53972e5c%2F0a4c679d-d98e-4e0c-98d7-3e62f8f42fe0.gif') !important;
        background-repeat: no-repeat !important;
        background-position: center center !important;
        background-size: cover !important;
        background-attachment: fixed !important;
    }
}
@media (max-width: 720px) {
    body {
        background-color: #010503 !important;
        background-image: none !important;
        background-attachment: scroll !important;
    }
}

/* Ø²Ø± ÙˆØ§Ø­Ø¯ ÙŠØ¶ÙŠÙ Ù„ÙˆØ­Ø© Ù…ØªÙˆØ³Ø·Ø©Ø› Ø§Ù„Ù…Ù‚Ø§Ø³ ÙŠØªØºÙŠØ± Ø¨Ø¹Ø¯ Ø¥Ù†Ø´Ø§Ø¦Ù‡Ø§ Ù…Ù† S / M / L. */
.frame-size-picker { grid-template-columns: 1fr auto; }
.frame-size-picker .add-art-frame-btn {
    min-width: 150px;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: center;
    color: #08281c;
    background: var(--green-bright);
    border-color: var(--green-bright);
    font-weight: 800;
}
.frame-size-picker .add-art-frame-btn:hover { color: #04140e; background: #c1f9dd; }
.art-frame-toolbar .frame-size-btn { min-width: 27px; padding-inline: 6px; font-weight: 800; }
.art-frame-toolbar .frame-size-btn.active {
    color: #08281c;
    background: var(--token-orange);
    border-color: var(--token-orange);
}

/* Ø§Ø®ØªÙŠØ§Ø± Ù†Ù…ÙˆØ°Ø¬ OpenAI Ø¯Ø§Ø®Ù„ Ù†Ø§ÙØ°Ø© Ø¥Ù†Ø´Ø§Ø¡/ØªØ¹Ø¯ÙŠÙ„ Ø§Ù„Ù„ÙˆØ­Ø©. */
.art-model-selector {
    margin: 10px 0 12px;
    padding: 11px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(121,226,173,.2);
    border-radius: 5px;
}
.art-model-selector-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: #effff6;
    font-size: .78rem;
    font-weight: 700;
}
.art-model-selector-heading small { color: #8fb5a0; font-size: .66rem; font-weight: 500; }
.art-model-choices { display: grid; gap: 7px; }
.art-model-choice {
    width: 100%;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 9px;
    color: #def7e9;
    background: rgba(121,226,173,.04);
    border: 1px solid rgba(121,226,173,.18);
    border-radius: 4px;
    text-align: right;
}
.art-model-choice:hover { background: rgba(121,226,173,.09); }
.art-model-choice.selected {
    background: rgba(255,174,98,.09);
    border-color: rgba(255,174,98,.72);
    box-shadow: inset 0 0 0 1px rgba(255,174,98,.1);
}
.art-model-choice-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: var(--green-bright);
    background: rgba(121,226,173,.1);
    border-radius: 4px;
}
.art-model-choice-copy { min-width: 0; display: grid; gap: 2px; }
.art-model-choice-copy small { color: #92b7a2; font-size: .68rem; line-height: 1.4; }

@media (max-width: 720px) {
    .frame-size-picker { grid-template-columns: 1fr; }
    .frame-size-picker > div { grid-column: auto; }
    .frame-size-picker .add-art-frame-btn { width: 100%; min-width: 0; }
    .message-avatar.agent-avatar { width: 39px; height: 39px; flex-basis: 39px; }
    .art-model-choice { grid-template-columns: 34px minmax(0, 1fr) auto; padding: 8px; }
}

/* =========================================================
   LANDING LAB â€” Ù…ÙˆÙ„Ø¯ ØµÙØ­Ø§Øª Ø§Ù„Ù‡Ø¨ÙˆØ·
   ========================================================= */
.app-shell[data-action="landing_page"] #main-inputs-wrapper { width: min(1580px, 100%); }
.app-shell[data-action="landing_page"] #chat-stream,
.app-shell[data-action="landing_page"] .composer-wrap,
.app-shell[data-action="landing_page"] #advanced-settings,
.app-shell[data-action="landing_page"] #image-upload-section,
.app-shell[data-action="landing_page"] #book-settings { display: none !important; }

.landing-page-studio {
    width: 100%;
    margin: 18px auto 42px;
    color: #eef9f2;
}
.landing-studio-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(12,34,24,.92), rgba(5,14,10,.92));
    border: 1px solid rgba(121,226,173,.2);
    border-radius: 18px 18px 8px 8px;
    box-shadow: 0 22px 60px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.035);
}
.landing-title-block { min-width: 0; display: flex; align-items: center; gap: 14px; }
.landing-title-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    color: #07180f;
    background: var(--green-bright, #79e2ad);
    border-radius: 13px;
    box-shadow: 0 0 28px rgba(121,226,173,.18);
}
.landing-title-block h3 { margin: 4px 0 3px; font-size: 1.08rem; }
.landing-title-block p { margin: 0; color: #91ad9c; font-size: .77rem; line-height: 1.55; }
.landing-function-badge {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 2px 8px;
    padding: 10px 13px;
    color: #a7c7b4;
    background: rgba(0,0,0,.22);
    border: 1px solid rgba(121,226,173,.16);
    border-radius: 11px;
    font-size: .68rem;
    white-space: nowrap;
}
.landing-function-badge i { grid-row: 1 / 3; color: var(--green-bright, #79e2ad); }
.landing-function-badge strong { color: #eafff2; font-size: .73rem; }

.landing-workbench {
    min-height: 690px;
    display: grid;
    grid-template-columns: 220px minmax(330px, 390px) minmax(430px, 1fr);
    direction: rtl;
    background: rgba(3,12,8,.86);
    border: 1px solid rgba(121,226,173,.16);
    border-top: 0;
    border-radius: 0 0 18px 18px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.landing-projects-panel,
.landing-builder-panel,
.landing-output-panel { min-width: 0; padding: 18px; }
.landing-projects-panel {
    display: flex;
    flex-direction: column;
    background: rgba(2,9,6,.7);
    border-left: 1px solid rgba(121,226,173,.12);
}
.landing-panel-title,
.landing-output-toolbar,
.landing-revision-head,
.landing-code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.landing-panel-title h4,
.landing-step-heading h4,
.landing-revision-head h4 { margin: 3px 0 0; }
.landing-panel-title > button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #092117;
    background: var(--green-bright, #79e2ad);
    border-radius: 9px;
}
.landing-projects-list { display: grid; gap: 8px; margin-top: 16px; overflow-y: auto; }
.landing-project-card {
    width: 100%;
    display: grid;
    grid-template-columns: 34px minmax(0,1fr) 26px;
    align-items: center;
    gap: 9px;
    padding: 9px;
    color: #b3c9bc;
    text-align: right;
    background: rgba(255,255,255,.025);
    border: 1px solid transparent;
    border-radius: 10px;
}
.landing-project-card:hover,
.landing-project-card.active { color: #f3fff7; background: rgba(121,226,173,.085); border-color: rgba(121,226,173,.19); }
.landing-project-thumb { width: 34px; height: 34px; display: grid; place-items: center; color: var(--green-bright, #79e2ad); background: rgba(121,226,173,.08); border-radius: 8px; }
.landing-project-copy { min-width: 0; display: grid; gap: 3px; }
.landing-project-copy strong { overflow: hidden; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.landing-project-copy small { color: #6f8d7b; font-size: .61rem; }
.landing-project-delete { width: 26px; height: 26px; display: grid; place-items: center; color: #668073; border-radius: 7px; }
.landing-project-delete:hover { color: #ff9ca4; background: rgba(255,100,110,.1); }
.landing-projects-empty { min-height: 160px; display: grid; place-items: center; align-content: center; gap: 6px; padding: 18px; color: #668073; text-align: center; border: 1px dashed rgba(121,226,173,.12); border-radius: 11px; }
.landing-projects-empty i { font-size: 1.35rem; }
.landing-projects-empty strong { color: #9ab4a4; font-size: .78rem; }
.landing-projects-empty span { font-size: .66rem; }
.landing-storage-note { margin-top: auto; display: flex; align-items: flex-start; gap: 7px; padding-top: 14px; color: #587164; font-size: .62rem; line-height: 1.5; border-top: 1px solid rgba(121,226,173,.08); }

.landing-builder-panel {
    background: linear-gradient(180deg, rgba(7,20,14,.88), rgba(4,13,9,.92));
    border-left: 1px solid rgba(121,226,173,.12);
    overflow-y: auto;
}
.landing-step-heading { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 13px; }
.landing-step-heading > span { width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; color: #072016; background: var(--green-bright, #79e2ad); border-radius: 8px; font-size: .68rem; font-weight: 800; }
.landing-step-heading h4 { font-size: .9rem; }
.landing-step-heading p { margin: 3px 0 0; color: #789382; font-size: .65rem; line-height: 1.45; }
.model-step-heading { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(121,226,173,.1); }
.landing-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.landing-field { margin: 0; }
.landing-field-wide { grid-column: 1 / -1; }
.landing-field > span { display: block; margin-bottom: 6px; color: #a9c2b2; font-size: .66rem; }
.landing-field > span b { color: #ff9aa1; }
.landing-field input,
.landing-field select,
.landing-field textarea,
.landing-revision-composer textarea {
    width: 100%;
    padding: 10px 11px;
    color: #eafff2;
    background: rgba(0,0,0,.23);
    border: 1px solid rgba(121,226,173,.13);
    border-radius: 9px;
    outline: 0;
    resize: vertical;
    line-height: 1.55;
}
.landing-field input:focus,
.landing-field select:focus,
.landing-field textarea:focus,
.landing-revision-composer textarea:focus { border-color: rgba(121,226,173,.5); box-shadow: 0 0 0 3px rgba(121,226,173,.07); }
.landing-field input::placeholder,
.landing-field textarea::placeholder,
.landing-revision-composer textarea::placeholder { color: #557064; }
.landing-model-cards { display: grid; gap: 7px; }
.landing-model-card {
    width: 100%;
    display: grid;
    grid-template-columns: 34px minmax(0,1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    color: #acc5b5;
    text-align: right;
    background: rgba(0,0,0,.2);
    border: 1px solid rgba(121,226,173,.1);
    border-radius: 10px;
}
.landing-model-card:hover,
.landing-model-card.selected { color: #edfff4; background: rgba(121,226,173,.095); border-color: rgba(121,226,173,.44); }
.landing-model-card.premium.selected { border-color: rgba(255,174,98,.6); box-shadow: inset 0 0 0 1px rgba(255,174,98,.08); }
.landing-model-icon { width: 34px; height: 34px; display: grid; place-items: center; color: var(--green-bright, #79e2ad); background: rgba(121,226,173,.08); border-radius: 8px; }
.landing-model-card > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.landing-model-card strong { font-size: .73rem; }
.landing-model-card small { color: #789382; font-size: .61rem; }
.landing-model-card > b { color: var(--token-orange, #ffae62); font-size: .66rem; white-space: nowrap; }
.landing-generate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding: 12px 13px;
    color: #062016;
    background: var(--green-bright, #79e2ad);
    border-radius: 10px;
    font-weight: 800;
    box-shadow: 0 10px 30px rgba(121,226,173,.1);
}
.landing-generate-btn small { color: #1a4c35; font-size: .63rem; font-weight: 700; }
.landing-generate-btn:disabled { opacity: .55; cursor: wait; }
.landing-status { min-height: 21px; padding: 8px 2px 0; color: #789382; font-size: .66rem; line-height: 1.5; }
.landing-status.success { color: var(--green-bright, #79e2ad); }
.landing-status.error { color: #ff9da5; }
.landing-status.loading { color: #ffd0a7; }
.landing-status.info { color: #a9cbbb; }

.landing-output-panel { direction: rtl; background: rgba(2,8,5,.58); overflow: hidden; }
.landing-output-toolbar { min-height: 42px; padding-bottom: 11px; border-bottom: 1px solid rgba(121,226,173,.1); }
.landing-view-tabs,
.landing-device-switch,
.landing-code-actions,
.landing-version-nav { display: flex; align-items: center; gap: 5px; }
.landing-view-tabs button,
.landing-device-switch button,
.landing-code-actions button,
.landing-version-nav button {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 9px;
    color: #789382;
    background: rgba(255,255,255,.025);
    border: 1px solid rgba(121,226,173,.1);
    border-radius: 8px;
    font-size: .66rem;
}
.landing-view-tabs button.active,
.landing-device-switch button.active,
.landing-view-tabs button:hover,
.landing-code-actions button:hover { color: #eafff2; background: rgba(121,226,173,.1); border-color: rgba(121,226,173,.25); }
.landing-preview-view { min-height: 500px; padding: 16px 0; overflow: auto; }
.landing-empty-preview { min-height: 470px; display: grid; place-items: center; align-content: center; gap: 7px; color: #648071; text-align: center; background: radial-gradient(circle at center, rgba(121,226,173,.045), transparent 46%); border: 1px dashed rgba(121,226,173,.13); border-radius: 12px; }
.landing-empty-preview > span { width: 50px; height: 50px; display: grid; place-items: center; color: #92b8a1; background: rgba(121,226,173,.07); border-radius: 14px; font-size: 1.1rem; }
.landing-empty-preview strong { color: #aec6b6; font-size: .85rem; }
.landing-empty-preview p { max-width: 300px; margin: 0; font-size: .68rem; line-height: 1.6; }
.landing-preview-shell { width: 100%; margin: 0 auto; overflow: hidden; background: #fff; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; box-shadow: 0 22px 60px rgba(0,0,0,.35); transition: width .28s ease; }
.landing-preview-shell[data-device="mobile"] { width: min(390px, 100%); }
.landing-browser-bar { height: 29px; display: flex; align-items: center; gap: 5px; padding: 0 9px; color: #647068; background: #e8ece9; border-bottom: 1px solid #d1d8d3; direction: ltr; font: 10px Arial, sans-serif; }
.landing-browser-bar i { width: 7px; height: 7px; background: #aeb8b1; border-radius: 50%; }
.landing-browser-bar i:first-child { background: #ef7878; }
.landing-browser-bar i:nth-child(2) { background: #e8bd5c; }
.landing-browser-bar i:nth-child(3) { background: #62bf7b; }
.landing-browser-bar span { margin-left: 7px; }
#landing-preview-frame { width: 100%; height: 610px; display: block; background: #fff; border: 0; }
.landing-code-view { padding-top: 16px; }
.landing-code-head { padding: 8px 10px; color: #9db5a6; background: #07110c; border: 1px solid rgba(121,226,173,.13); border-bottom: 0; border-radius: 10px 10px 0 0; font-size: .67rem; }
.landing-code-head small { color: #587164; }
#landing-code-editor { width: 100%; min-height: 520px; display: block; padding: 16px; color: #c8f6d9; caret-color: #fff; background: #020604; border: 1px solid rgba(121,226,173,.13); border-radius: 0; outline: 0; resize: vertical; direction: ltr; text-align: left; font: 12px/1.7 Consolas, Monaco, monospace; tab-size: 2; }
#landing-code-editor:focus { border-color: rgba(121,226,173,.4); }
#landing-apply-code-btn { width: 100%; padding: 10px; color: #062016; background: var(--green-bright, #79e2ad); border-radius: 0 0 10px 10px; font-weight: 800; }
.landing-revision-panel { padding-top: 15px; border-top: 1px solid rgba(121,226,173,.1); }
.landing-revision-head h4 { font-size: .82rem; }
.landing-version-nav span { min-width: 82px; color: #8da899; font-size: .63rem; text-align: center; }
.landing-version-nav button:disabled { opacity: .28; cursor: not-allowed; }
.landing-revision-composer { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 11px; }
.landing-revision-composer textarea { min-height: 58px; resize: none; }
.landing-revision-composer button { min-width: 112px; padding: 9px 12px; color: #062016; background: var(--green-bright, #79e2ad); border-radius: 9px; font-weight: 800; }
.landing-revision-note { margin: 8px 0 0; color: #668173; font-size: .62rem; }

/* ØµÙˆØ±Ø© ÙˆÙƒÙŠÙ„ Ø§Ù„Ø´Ø§Øª Ø£ÙƒØ¨Ø± Ù‚Ù„ÙŠÙ„Ù‹Ø§ ÙƒÙ…Ø§ Ø·ÙÙ„Ø¨. */
.message-avatar.agent-avatar { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 13px; }

@media (max-width: 1250px) {
    .landing-workbench { grid-template-columns: 190px minmax(315px, 360px) minmax(380px,1fr); }
    .landing-projects-panel, .landing-builder-panel, .landing-output-panel { padding: 14px; }
}
@media (max-width: 1050px) {
    .landing-workbench { grid-template-columns: 190px minmax(0,1fr); }
    .landing-output-panel { grid-column: 1 / -1; border-top: 1px solid rgba(121,226,173,.12); }
}
@media (max-width: 720px) {
    .landing-page-studio { margin-top: 10px; }
    .landing-studio-head { align-items: flex-start; padding: 14px; border-radius: 13px 13px 0 0; }
    .landing-title-icon { width: 40px; height: 40px; flex-basis: 40px; }
    .landing-title-block p, .landing-function-badge { display: none; }
    .landing-workbench { display: block; min-height: 0; border-radius: 0 0 13px 13px; }
    .landing-projects-panel { max-height: 240px; border: 0; border-bottom: 1px solid rgba(121,226,173,.12); }
    .landing-storage-note { margin-top: 12px; }
    .landing-builder-panel { border: 0; border-bottom: 1px solid rgba(121,226,173,.12); }
    .landing-form-grid { grid-template-columns: 1fr; }
    .landing-field-wide { grid-column: auto; }
    .landing-output-toolbar { flex-wrap: wrap; }
    .landing-code-actions { margin-right: auto; }
    .landing-preview-view { min-height: 410px; }
    .landing-empty-preview { min-height: 380px; }
    #landing-preview-frame { height: 560px; }
    .landing-code-head small { display: none; }
    .landing-revision-head { align-items: flex-start; flex-direction: column; }
    .landing-revision-composer { grid-template-columns: 1fr; }
    .landing-revision-composer button { min-height: 43px; }
    .message-avatar.agent-avatar { width: 42px; height: 42px; flex-basis: 42px; }
}

/* =========================================================
   AKLAKE â€” ØªØ¨Ø³ÙŠØ· Ø£Ø¯Ø§Ø© Ø§Ù„ÙƒØªØ¨ ÙˆØ§Ù„Ø­Ø³Ø§Ø¨ (ÙˆØ§Ø¬Ù‡Ø© ÙÙ‚Ø·)
   ========================================================= */
.credit-pill {
    gap: 6px;
    min-height: 38px;
    padding: 7px 11px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.credit-pill .token-unit { display: none !important; }
.token-add-btn {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    margin-inline-start: -8px;
    color: var(--token-orange);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    transition: transform .2s ease, filter .2s ease;
}
.token-add-btn:hover { transform: translateY(-1px) scale(1.04); filter: brightness(1.05); }
.cart-header-btn {
    width: 40px;
    height: 40px;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.cart-header-btn:hover {
    color: #fff;
    background: transparent;
    border-color: transparent;
}
.cart-header-btn b {
    top: -2px;
    left: -2px;
    min-width: auto;
    height: auto;
    padding: 0;
    color: var(--green-bright);
    background: transparent;
    border-radius: 0;
}
.profile-header-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    color: #eafff1;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    transition: color .2s ease, opacity .2s ease;
}
.profile-header-btn:hover,
.profile-header-btn[aria-expanded="true"] { color: var(--green-bright); background: transparent; }
.profile-header-btn > i:first-child { color: var(--green-bright); font-size: 1rem; }
.profile-header-btn span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; font-weight: 750; }
.profile-chevron { color: #779386; font-size: .58rem; transition: transform .2s ease; }
.profile-header-btn[aria-expanded="true"] .profile-chevron { transform: rotate(180deg); }

.profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0,0,0,.48);
    backdrop-filter: blur(3px);
}
.profile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 9001;
    width: min(380px, calc(100vw - 20px));
    display: flex;
    flex-direction: column;
    padding: 22px;
    color: #e9fff2;
    background: linear-gradient(165deg, #0b1711, #050a07 74%);
    border-left: 1px solid rgba(121,226,173,.18);
    box-shadow: -24px 0 70px rgba(0,0,0,.46);
    animation: profileDrawerIn .24s ease both;
}
@keyframes profileDrawerIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.profile-drawer-head { display: grid; grid-template-columns: 48px minmax(0,1fr) 36px; align-items: center; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.profile-avatar { width: 48px; height: 48px; display: grid; place-items: center; color: #061b11; background: var(--green-bright); border-radius: 14px; font-size: 1.2rem; }
.profile-drawer-head > div:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.profile-drawer-head small { color: #719181; font-size: .62rem; }
.profile-drawer-head strong,
.profile-drawer-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-drawer-head strong { font-size: .9rem; }
.profile-drawer-head span { color: #8eaa9b; font-size: .67rem; direction: ltr; text-align: right; }
#profile-close-btn { width: 36px; height: 36px; display: grid; place-items: center; color: #9eb6a9; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.profile-drawer-list { display: grid; gap: 0; padding: 20px 0; }
.profile-menu-item {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0,1fr) 22px;
    align-items: center;
    gap: 11px;
    padding: 13px 4px;
    color: #e9fff2;
    text-align: right;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    cursor: pointer;
}
.profile-menu-item:hover { background: rgba(121,226,173,.045); border-bottom-color: var(--green-line); }
.profile-item-icon { width: 42px; height: 42px; display: grid; place-items: center; color: var(--green-bright); background: transparent; border-radius: 0; }
.profile-menu-item > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.profile-menu-item strong { font-size: .78rem; }
.profile-menu-item small { color: #8ca99a; font-size: .64rem; line-height: 1.45; }
.profile-menu-item > i { color: #678273; font-size: .66rem; }
.token-profile-item .profile-item-icon,
.token-profile-item .profile-item-plus { color: var(--token-orange); }
.token-profile-item .profile-item-icon { background: transparent; }
.profile-logout-btn { margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 11px; color: #ffb7ba; background: rgba(255,91,99,.06); border: 1px solid rgba(255,91,99,.18); border-radius: 11px; cursor: pointer; }

.book-quick-start {
    margin: 0 0 8px;
    padding: 10px;
    background: rgba(121,226,173,.045);
    border: 1px solid rgba(121,226,173,.13);
    border-radius: 13px;
}
.book-quick-controls { display: grid; grid-template-columns: minmax(180px,1fr) 130px auto; align-items: end; gap: 8px; }
.book-quick-field { min-width: 0; display: grid; gap: 5px; margin: 0; }
.book-quick-field > span { display: flex; align-items: center; gap: 6px; color: #b8d5c6; font-size: .66rem; }
.book-quick-field > span i { color: var(--green-bright); }
.book-quick-field > span b { margin-inline-start: auto; padding: 2px 5px; color: #ffd3a9; background: rgba(255,174,98,.1); border-radius: 5px; font-size: .52rem; }
.book-quick-field select,
.book-quick-field input {
    width: 100%;
    min-height: 39px;
    padding: 7px 10px;
    color: #eafff1;
    background: #07100b;
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: none;
    font-size: .71rem;
}
.book-quick-field select:focus,
.book-quick-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(121,226,173,.07); }
.book-assistant-toggle {
    min-height: 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    color: #dff8e9;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
    border-radius: 9px;
    white-space: nowrap;
    cursor: pointer;
}
.book-assistant-toggle > i:first-child { color: var(--green-bright); }
.book-assistant-toggle:hover,
.book-assistant-toggle.is-open { background: var(--green-soft); border-color: var(--green-line); }
.book-assistant-chevron { color: #779386; font-size: .55rem; transition: transform .2s ease; }
.book-assistant-toggle.is-open .book-assistant-chevron { transform: rotate(180deg); }
.book-quick-note { margin: 8px 2px 0; color: #7f9c8d; font-size: .61rem; line-height: 1.55; }
.book-quick-note i { color: var(--green); margin-inline-end: 4px; }
.app-shell[data-action="book_outline"] .composer { border-color: rgba(121,226,173,.22); }
.app-shell[data-action="book_outline"] .composer textarea { min-height: 50px; max-height: 190px; }
.app-shell[data-action="book_outline"] .composer-wrap {
    max-height: calc(100vh - 102px);
    padding-top: 8px;
}
.app-shell[data-action="book_outline"] .composer-wrap .book-fields {
    width: 100%;
    max-height: min(46vh, 420px);
    margin: 0 0 8px;
    padding: 14px;
    border-radius: 13px;
    box-shadow: 0 -18px 54px rgba(0,0,0,.3);
}
.app-shell[data-action="book_outline"] .model-chooser-popover {
    position: fixed;
    right: 50%;
    bottom: 88px;
    transform: translateX(50%);
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100vh - 190px);
    overflow-y: auto;
}

.book-outline-message .message-content { max-width: min(780px, calc(100% - 8px)); }
.book-outline-bubble { padding: 0 !important; overflow: hidden; }
.book-outline-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; background: rgba(121,226,173,.07); border-bottom: 1px solid rgba(121,226,173,.12); }
.book-outline-heading span { color: #dff9ea; font-size: .76rem; font-weight: 800; }
.book-outline-heading span i { color: var(--green-bright); margin-inline-end: 5px; }
.book-outline-heading small { color: #759485; font-size: .58rem; }
.book-outline-chat-text { padding: 14px; color: #d4e9dc; white-space: pre-wrap; line-height: 1.85; font-size: .78rem; outline: 0; }
.book-outline-chat-text.is-editing { margin: 9px; padding: 11px; background: rgba(255,255,255,.035); border: 1px solid var(--green-line); border-radius: 8px; box-shadow: 0 0 0 3px rgba(121,226,173,.05); }
.book-outline-chat-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.book-outline-chat-actions button { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px; color: #bcd8c8; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 8px; font-size: .65rem; cursor: pointer; }
.book-outline-chat-actions button:hover { color: #fff; border-color: var(--green-line); }
.book-outline-chat-actions button.primary { color: #062016; background: var(--green-bright); border-color: var(--green-bright); font-weight: 800; }
.book-outline-smart-editor { display: grid; grid-template-columns: minmax(0,1fr) 38px; gap: 7px; margin-top: 8px; }
.book-outline-smart-editor textarea { min-height: 52px; padding: 9px 10px; color: #e8fff1; background: #060e09; border: 1px solid var(--line); border-radius: 9px; outline: 0; resize: vertical; }
.book-outline-smart-editor textarea:focus { border-color: var(--green); }
.book-outline-smart-editor button { color: #062016; background: var(--green-bright); border: 0; border-radius: 9px; cursor: pointer; }

.book-stage-message .book-stage-content {
    width: min(860px, calc(100% - 8px));
    max-width: min(860px, calc(100% - 8px));
}
.book-stage-bubble {
    padding: 0 !important;
    overflow: hidden;
    background: rgba(4,15,10,.96) !important;
}
.book-stage-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    background: rgba(121,226,173,.07);
    border-bottom: 1px solid rgba(121,226,173,.12);
}
.book-stage-heading span { color: #dff9ea; font-size: .76rem; font-weight: 800; }
.book-stage-heading span i { color: var(--green-bright); margin-inline-end: 5px; }
.book-stage-heading small { color: #759485; font-size: .58rem; }
.book-intro-panel {
    width: 100%;
    gap: 12px;
    margin: 0 !important;
    padding: 14px;
}
.book-intro-panel .book-toolbar { margin: 0 auto 2px; }
.book-intro-panel #book-container {
    width: min(700px, 100%) !important;
    margin: 0 auto 4px !important;
    background: #fff;
    color: #1f2937;
    box-shadow: 0 16px 50px rgba(0,0,0,.28) !important;
}
.book-page-navigation {
    width: min(700px, 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.book-page-navigation button,
.book-intro-actions button {
    width: auto !important;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px !important;
    color: #bcd8c8 !important;
    background: rgba(255,255,255,.035) !important;
    border: 1px solid var(--line) !important;
    border-radius: 8px !important;
    font-size: .65rem !important;
    cursor: pointer;
}
.book-page-navigation button:hover,
.book-intro-actions button:hover { color: #fff !important; border-color: var(--green-line) !important; }
.book-page-navigation button:disabled { opacity: .45 !important; cursor: default; }
.book-page-navigation #page-indicator { color: #9fbcae !important; font-size: .66rem; font-weight: 750; }
.book-intro-actions {
    width: min(700px, 100%);
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.book-intro-actions button.primary {
    color: #062016 !important;
    background: var(--green-bright) !important;
    border-color: var(--green-bright) !important;
    font-weight: 800;
}
.book-intro-refine {
    width: min(700px, 100%);
    margin: 0 !important;
    padding: 12px !important;
    background: rgba(121,226,173,.045) !important;
    border: 1px solid var(--green-line) !important;
    border-radius: 9px !important;
}
.book-intro-refine > label { color: #cce9d9 !important; font-size: .7rem; }
.book-intro-refine-composer { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
.book-intro-refine-composer input { min-height: 38px; }
.book-intro-refine-composer #refine-intro-btn {
    width: auto !important;
    min-width: 124px;
    padding: 8px 11px !important;
    font-size: .68rem !important;
}
.book-viewer-heading {
    width: min(700px, 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
    padding: 9px 10px 10px 12px;
    color: #ddf8e8;
    background: rgba(121,226,173,.045);
    border: 1px solid rgba(121,226,173,.12);
    border-radius: 9px;
}
.book-viewer-heading > div { display: grid; gap: 2px; text-align: right; }
.book-viewer-heading span { font-size: .72rem; font-weight: 800; }
.book-viewer-heading span i { margin-inline-end: 5px; color: var(--green-bright); }
.book-viewer-heading small { color: #789687; font-size: .58rem; }
.book-viewer-heading button {
    width: 32px !important;
    height: 32px;
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    padding: 0 !important;
    color: #a9c8b8 !important;
    background: rgba(255,255,255,.035) !important;
    border: 1px solid var(--line) !important;
    border-radius: 8px !important;
    cursor: pointer;
}
.book-viewer-heading button:hover { color: #fff !important; border-color: var(--green-line) !important; }

#book-progress-chat-message .book-stage-content {
    width: min(450px, calc(100% - 8px));
    max-width: min(450px, calc(100% - 8px));
}
.book-stage-bubble.book-progress-bubble {
    width: 100%;
    margin-inline-start: auto;
    overflow: visible !important;
    background: transparent !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.book-progress-bubble > .book-stage-heading { display: none; }
.book-progress-bubble .book-generation-status {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none;
}

.remember-model-card { grid-template-columns: 34px minmax(0,1fr) auto; background: rgba(154,165,159,.055); border-color: rgba(154,165,159,.18); }
.remember-model-card .memory-card-icon { color: #8a9690; background: rgba(154,165,159,.08); }
.remember-model-card > span:nth-of-type(2) { align-self: center; }
.remember-toggle-icon { color: #8b9691 !important; font-size: 1.7rem !important; transition: color .2s ease, transform .2s ease; }
.remember-model-card:has(input:checked) { background: rgba(255,174,98,.09); border-color: rgba(255,174,98,.5); }
.remember-model-card:has(input:checked) .memory-card-icon,
.remember-model-card:has(input:checked) .remember-toggle-icon { color: var(--token-orange) !important; }
.remember-model-card:has(input:checked) .remember-toggle-icon { transform: scale(1.04); }

.book-generation-status {
    width: min(440px, 100%);
    margin: 34px auto 0 !important;
    padding: 15px 16px 16px !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    color: #eafff1 !important;
    text-align: center !important;
    background: linear-gradient(160deg, rgba(10,24,17,.98), rgba(4,11,7,.99)) !important;
    border: 1px solid rgba(121,226,173,.16) !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,.28);
    transition: padding .25s ease, background .25s ease;
}
.book-progress-title {
    min-width: 0;
    display: grid;
    gap: 3px;
    text-align: right;
}
.book-progress-title span {
    color: #9fbcae;
    font-size: .68rem;
    font-weight: 700;
}
.book-progress-title strong {
    color: var(--token-orange);
    font-size: .86rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.book-progress-shell {
    width: min(360px, 100%);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 0 auto;
}
.book-progress-image {
    display: block !important;
    width: min(340px, 100%) !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: contain !important;
    object-position: center !important;
    align-self: center;
    margin: 0 auto !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    clip-path: none !important;
}
.book-progress-details {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 10px 11px;
    box-sizing: border-box;
    background: rgba(121,226,173,.045);
    border: 1px solid rgba(121,226,173,.1);
    border-radius: 10px;
}
.book-progress-track {
    --progress-color-start: #f0a84e;
    --progress-color-end: #ffd36a;
    width: 100%;
    height: 10px;
    margin-top: 12px;
    position: relative;
    overflow: hidden;
    background: rgba(121,226,173,.09);
    border: 1px solid rgba(121,226,173,.12);
    border-radius: 999px;
}
.book-progress-track span {
    width: 0;
    height: 100%;
    display: block;
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, var(--progress-color-start), var(--progress-color-end));
    border-radius: inherit;
    box-shadow: 0 0 14px color-mix(in srgb, var(--progress-color-end) 45%, transparent);
    transition: width .9s cubic-bezier(.22,.8,.25,1), background .45s ease, box-shadow .45s ease;
}
.book-progress-track::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -42%;
    width: 42%;
    z-index: 2;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
    pointer-events: none;
}
.book-generation-status.is-generating .book-progress-track::after {
    animation: bookProgressSweep 1.35s ease-in-out infinite;
}
@keyframes bookProgressSweep {
    to { left: 100%; }
}
.book-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-top: 7px;
    padding-inline: 1px;
}
.book-progress-label { color: #9fbcae; font-size: .64rem; }
.book-progress-fraction { display: inline-flex; gap: 4px; direction: ltr; color: #dffbed; font-size: .78rem; }
.book-generation-status #status-title { margin: 2px 0 0; font-size: 1rem; line-height: 1.5; }
.book-waiting-copy { margin: 0; color: #a9c5b7; font-size: .68rem; line-height: 1.65; }
.book-generation-status.is-generating > #status-title,
.book-generation-status.is-generating > .book-waiting-copy,
.book-generation-status.is-generating > .book-generation-actions { display: none; }
.working-models {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 9px;
    color: #9fbcae;
    background: rgba(121,226,173,.055);
    border: 1px solid rgba(121,226,173,.12);
    border-radius: 8px;
    font-size: .64rem;
    white-space: nowrap;
}
.working-models strong { color: #dffbed; }
.book-generation-actions { width: 100%; display: flex; justify-content: center; }
.book-generation-actions #new-book-btn { width: auto !important; margin: 0; padding: 8px 14px !important; }
.book-complete-summary { display: none; }

/* عند اكتمال الكتاب تختفي واجهة الانتظار وتبقى بطاقة صغيرة فقط. */
.book-generation-status.is-complete {
    min-height: 0;
    padding: 12px !important;
    background: linear-gradient(160deg, rgba(13,37,26,.98), rgba(4,13,8,.99)) !important;
}
.book-generation-status.is-complete > .book-progress-title,
.book-generation-status.is-complete > .book-progress-shell,
.book-generation-status.is-complete > #status-title,
.book-generation-status.is-complete .book-waiting-copy,
.book-generation-status.is-complete .working-models,
.book-generation-status.is-complete .book-generation-actions { display: none; }
.book-generation-status.is-complete .book-complete-summary {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0,1fr) auto;
    align-items: center;
    gap: 10px;
    text-align: right;
}
.book-complete-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #062017;
    background: linear-gradient(145deg, #c1f9dd, var(--green-bright));
    border-radius: 11px;
    box-shadow: 0 8px 24px rgba(121,226,173,.13);
}
.book-complete-copy { min-width: 0; display: grid; gap: 1px; }
.book-complete-copy > span { color: var(--green-bright); font-size: .59rem; font-weight: 800; }
.book-complete-copy > strong { overflow: hidden; color: #f1fff6; font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.book-complete-copy > small { color: #8da99a; font-size: .56rem; }
.book-complete-copy > small b { color: #cfeadb; }
#open-completed-book-btn {
    width: auto !important;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px !important;
    color: #092117 !important;
    background: var(--green-bright) !important;
    border: 0 !important;
    border-radius: 9px !important;
    font-size: .63rem !important;
    font-weight: 850;
    cursor: pointer;
}
#open-completed-book-btn:hover { background: #aaf1cc !important; transform: translateY(-1px); }
#open-completed-book-btn:disabled { opacity: .55; cursor: wait; transform: none; }
.book-generation-status.is-failed .book-progress-track {
    --progress-color-start: #ef7373 !important;
    --progress-color-end: #ff9a9a !important;
}

@media (max-width: 620px) {
    #book-progress-chat-message .book-stage-content { width: calc(100% - 4px); max-width: calc(100% - 4px); }
    .book-generation-status {
        width: 100%;
        min-height: 0;
        padding: 12px !important;
        gap: 6px;
    }
    .book-progress-shell { width: min(320px, 100%); }
    .book-progress-image { width: min(300px, 100%) !important; }
    .book-progress-details { grid-template-columns: 1fr; gap: 7px; }
    .working-models { width: max-content; max-width: 100%; white-space: normal; }
    .book-progress-title strong { font-size: .78rem; }
    .book-generation-status #status-title { font-size: .82rem; }
    .book-waiting-copy { display: none; }
    .book-generation-status.is-complete { min-height: 0; }
    .book-complete-summary { grid-template-columns: 38px minmax(0,1fr) auto !important; gap: 8px !important; }
    .book-complete-icon { width: 38px; height: 38px; }
    #open-completed-book-btn span { display: none; }
    #open-completed-book-btn { width: 36px !important; padding: 0 !important; }
    .book-viewer-heading { padding: 8px; }
    .book-viewer-heading small { display: none; }
}

/* يجب أن تبقى هذه القواعد في نهاية الملف لتتقدم على تنسيق الاستوديو القديم. */
.app-shell[data-action="landing_page"] #main-inputs-wrapper { width: min(900px, 100%); }
.landing-page-studio { width: min(820px, 100%); margin: 0 auto; padding: 10px 0 150px; }
.landing-projects-panel {
    width: 100%;
    max-height: 300px;
    display: block;
    margin: 0 0 14px;
    padding: 13px;
    overflow: auto;
    background: rgba(4,14,9,.96);
    border: 1px solid rgba(121,226,173,.13);
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(0,0,0,.2);
}
.landing-projects-panel.hidden { display: none !important; }
.landing-projects-panel .landing-projects-list { grid-template-columns: repeat(2, minmax(0,1fr)); margin-top: 0; overflow: visible; }
.landing-page-studio .landing-output-panel { padding: 14px; border: 1px solid rgba(121,226,173,.14); border-radius: 14px; }

@media (max-width: 700px) {
    .landing-page-studio { margin: 0 auto; padding: 4px 0 135px; }
    .landing-projects-panel { max-height: 300px; padding: 11px; border: 1px solid rgba(121,226,173,.13); }
    .landing-projects-panel .landing-projects-list,
    .landing-required-row,
    .landing-assistant-panel .landing-form-grid { grid-template-columns: 1fr; }
    .landing-assistant-panel .landing-field-wide { grid-column: auto; }
}

/* =========================================================
   LANDING PAGE — مساحة تمرير مستقلة وشريط إدخال ثابت
   يجب أن تبقى هذه القواعد في نهاية الملف.
   ========================================================= */
.app-shell[data-action="landing_page"] {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}
.app-shell[data-action="landing_page"] .workspace-main {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.app-shell[data-action="landing_page"] #main-inputs-wrapper {
    min-height: 0;
    overflow: hidden;
}
.app-shell[data-action="landing_page"] .landing-page-studio {
    width: min(820px, 100%);
    height: 100%;
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
}
.landing-scroll-area {
    min-height: 0;
    flex: 1 1 auto;
    padding: 10px 4px 24px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.landing-input-dock {
    position: relative;
    bottom: auto;
    flex: 0 0 auto;
    z-index: 40;
    padding: 12px 4px 10px;
    background: linear-gradient(180deg, rgba(1,8,5,.25), rgba(1,8,5,.98) 16%, rgba(1,8,5,1));
    border-top: 1px solid rgba(121,226,173,.1);
    box-shadow: 0 -18px 42px rgba(0,0,0,.22);
}
.landing-input-dock .landing-assistant-panel {
    max-height: min(46vh, 420px);
    overflow-y: auto;
}
.landing-input-dock .landing-model-popover {
    width: min(520px, calc(100% - 8px));
    max-height: min(72vh, 610px);
    position: absolute;
    right: 4px;
    bottom: calc(100% + 8px);
    overflow-y: auto;
}
.landing-model-popover .landing-model-description {
    margin: 8px 0 12px;
    color: #a9c9b8;
    font-size: .78rem;
}
.landing-model-popover .landing-model-cards {
    max-height: 290px;
}
.landing-model-popover .landing-model-card {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    min-height: 54px;
}
.landing-model-popover .landing-model-card.selected {
    background: rgba(121,226,173,.14);
    border-color: var(--green-bright);
}
.landing-model-popover .landing-model-card.premium.selected {
    border-color: rgba(255,174,98,.72);
}
.landing-remember-model-card {
    grid-template-columns: 34px minmax(0,1fr) auto;
}
.landing-remember-toggle-icon {
    color: #8b9691;
    font-size: 1.7rem;
    transition: color .2s ease, transform .2s ease;
}
.landing-remember-model-card:has(input:checked) {
    background: rgba(255,174,98,.09);
    border-color: rgba(255,174,98,.5);
}
.landing-remember-model-card:has(input:checked) .memory-card-icon,
.landing-remember-model-card:has(input:checked) .landing-remember-toggle-icon {
    color: var(--token-orange);
}
.landing-remember-model-card:has(input:checked) .landing-remember-toggle-icon {
    transform: scale(1.04);
}

@media (max-width: 720px) {
    .app-shell[data-action="landing_page"] .workspace-main {
        padding-bottom: 0;
    }
    .app-shell[data-action="landing_page"] .landing-page-studio {
        margin: 0 auto;
        padding: 0;
    }
    .landing-scroll-area {
        padding: 4px 0 16px;
        scrollbar-gutter: auto;
    }
    .landing-input-dock {
        padding: 9px 0 6px;
    }
    .landing-input-dock .landing-model-popover {
        width: 100%;
        right: 0;
        bottom: calc(100% + 5px);
        max-height: min(68vh, 560px);
    }
}


/* =========================================================
   WEBSITE BUILDER — منشئ المواقع
   واجهة مشابهة لصفحات الهبوط من دون أدوات مساعدة
   ========================================================= */
.app-shell[data-action="website_builder"] {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}
.app-shell[data-action="website_builder"] .workspace-main,
.app-shell[data-action="website_builder"] #main-inputs-wrapper { height: 100%; min-height: 0; overflow: hidden; }
.app-shell[data-action="website_builder"] #chat-stream,
.app-shell[data-action="website_builder"] .composer-wrap { display: none !important; }
.website-builder-studio {
    width: min(900px, 100%);
    height: 100%;
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    margin: 0 auto;
    overflow: hidden;
    direction: rtl;
}
.website-scroll-area { min-height: 0; flex: 1 1 auto; padding: 10px 4px 24px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.website-chat-toolbar { display: flex; justify-content: flex-end; gap: 7px; margin-bottom: 12px; }
.website-chat-toolbar button { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; color: #a9c8b8; background: rgba(121,226,173,.045); border: 1px solid rgba(121,226,173,.12); border-radius: 9px; font-size: .67rem; cursor: pointer; }
.website-chat-toolbar button:hover { color: #edfff4; background: rgba(121,226,173,.1); border-color: rgba(121,226,173,.28); }
.website-conversation { min-height: 300px; display: flex; flex-direction: column; gap: 14px; padding: 10px 0 20px; }
.website-conversation .message-row { width: 100%; }
.website-conversation .message-content { max-width: min(650px, calc(100% - 8px)); }
.website-state-content { width: min(460px, calc(100% - 8px)); max-width: min(460px, calc(100% - 8px)) !important; }
.website-generation-bubble, .website-complete-bubble { width: 100%; box-sizing: border-box; color: #eafff2 !important; background: rgba(4,15,10,.96) !important; border: 1px solid rgba(121,226,173,.13) !important; box-shadow: 0 20px 55px rgba(0,0,0,.25); }
.website-generation-bubble { padding: 12px !important; }
.website-preview-typing { display: none; align-items: center; justify-content: center; gap: 5px; min-height: 24px; }
.website-preview-typing i,
.website-revision-waiting-dots i { width: 7px; height: 7px; display: block; background: #79e2ad; border-radius: 50%; animation: websiteRevisionDot 1s ease-in-out infinite; }
.website-preview-typing i:nth-child(2),
.website-revision-waiting-dots i:nth-child(2) { animation-delay: .14s; }
.website-preview-typing i:nth-child(3),
.website-revision-waiting-dots i:nth-child(3) { animation-delay: .28s; }
@keyframes websiteRevisionDot { 0%, 70%, 100% { transform: translateY(0); opacity: .35; } 35% { transform: translateY(-5px); opacity: 1; } }
.website-progress-image { display: block !important; width: min(290px, 100%) !important; aspect-ratio: 1/1; object-fit: contain; margin: 0 auto; border: 0 !important; background: transparent !important; }
.website-live-progress { width: 100%; height: 9px; margin-top: 10px; position: relative; overflow: hidden; background: rgba(121,226,173,.08); border: 1px solid rgba(121,226,173,.13); border-radius: 999px; }
.website-live-progress span { width: 42%; height: 100%; display: block; position: absolute; left: -42%; background: linear-gradient(90deg, transparent, #ffbd72 25%, #79e2ad 75%, transparent); border-radius: inherit; animation: websiteProgressTravel 1.3s ease-in-out infinite; }
@keyframes websiteProgressTravel { to { left: 100%; } }
.website-progress-info { display: grid; gap: 2px; margin-top: 10px; text-align: right; }
.website-progress-info > span { color: #88a797; font-size: .62rem; }
.website-progress-info > strong { color: #f1fff6; font-size: .82rem; overflow-wrap: anywhere; }
.website-progress-info > small { color: #ffbd7b; font-size: .59rem; }
.website-complete-bubble { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 12px !important; }
.website-complete-icon { width: 44px; height: 44px; display: grid; place-items: center; color: #052016; background: linear-gradient(145deg,#c8f9df,#79e2ad); border-radius: 11px; }
.website-complete-bubble > div { min-width: 0; display: grid; gap: 2px; }
.website-complete-bubble > div > span { color: #79e2ad; font-size: .61rem; font-weight: 800; }
.website-complete-bubble > div > strong { overflow: hidden; color: #f3fff7; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.website-complete-bubble > div > small { color: #839f90; font-size: .56rem; }
#website-open-result-btn { min-height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; color: #052016; background: #79e2ad; border: 0; border-radius: 9px; font-size: .64rem; font-weight: 850; cursor: pointer; }
.website-output-panel { width: 100%; margin: 10px 0 22px; padding: 14px; position: relative; box-sizing: border-box; background: rgba(3,11,7,.97); border: 1px solid rgba(121,226,173,.14); border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.website-output-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-bottom: 11px; }
.website-view-tabs, .website-device-switch, .website-code-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.website-output-toolbar button { min-height: 34px; padding: 7px 10px; color: #9bb5a7; background: rgba(255,255,255,.035); border: 1px solid rgba(121,226,173,.1); border-radius: 8px; cursor: pointer; }
.website-output-toolbar button.active, .website-output-toolbar button:hover { color: #062017; background: #79e2ad; }
.website-revision-panel { min-width: 240px; flex: 1 1 420px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 7px; }
.website-revision-panel textarea { width: 100%; height: 36px; min-height: 36px; max-height: 82px; box-sizing: border-box; padding: 8px 11px; color: #eafff2; background: rgba(3,13,8,.94); border: 1px solid rgba(121,226,173,.2); border-radius: 9px; resize: vertical; outline: 0; line-height: 1.35; }
.website-revision-panel textarea::placeholder { color: #71877b; }
.website-revision-panel textarea:focus { border-color: rgba(121,226,173,.58); box-shadow: 0 0 0 3px rgba(121,226,173,.08); }
.website-revision-panel textarea:disabled { opacity: .62; cursor: wait; }
.website-revision-panel button { min-width: 82px; height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; color: #062017; background: #79e2ad; border: 0; border-radius: 9px; font-weight: 800; }
.website-revision-panel button:disabled { opacity: .72; cursor: wait; }
.website-output-stage { min-height: 0; position: relative; }
.website-preview-shell { width: 100%; overflow: hidden; background: #fff; border: 1px solid rgba(121,226,173,.12); border-radius: 12px; transition: max-width .2s ease, filter .2s ease, transform .2s ease; margin: 0 auto; }
.website-preview-shell[data-device="mobile"] { max-width: 390px; }
.website-browser-bar { height: 38px; display: flex; align-items: center; gap: 6px; padding: 0 12px; direction: ltr; background: #111713; color: #98ae9f; font-size: .62rem; }
.website-browser-bar i { width: 8px; height: 8px; border-radius: 50%; background: #60776a; }
.website-browser-bar span { margin-left: 8px; }
.website-preview-diagnostics {
    display: none;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    direction: rtl;
    color: #ffd6d9;
    background: #201013;
    border-bottom: 1px solid rgba(255,125,134,.24);
}
.website-preview-diagnostics[data-state="error"] { display: flex; }
.website-preview-health { display: none; }
.website-preview-diagnostics > small { width: 100%; font-size: .61rem; line-height: 1.45; }
.website-preview-error-log {
    max-height: 120px;
    margin: 0;
    padding: 8px 10px;
    overflow: auto;
    color: #ffc8cc;
    background: #160b0d;
    border: 0;
    border-bottom: 1px solid rgba(255,125,134,.22);
    font: 600 .62rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
}
.website-output-panel.is-revising .website-preview-shell,
.website-output-panel.is-revising .website-project-workspace { filter: blur(4px); transform: scale(.995); pointer-events: none; user-select: none; }
.website-input-dock { position: relative; flex: 0 0 auto; z-index: 40; padding: 12px 4px 10px; background: linear-gradient(180deg,rgba(1,8,5,.25),rgba(1,8,5,.98) 16%,rgba(1,8,5,1)); border-top: 1px solid rgba(121,226,173,.1); box-shadow: 0 -18px 42px rgba(0,0,0,.22); }
.website-reference-preview { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; padding: 8px 10px; color: #dff8e9; background: rgba(121,226,173,.06); border: 1px solid rgba(121,226,173,.14); border-radius: 10px; }
.website-reference-preview > span { width: 32px; height: 32px; display: grid; place-items: center; color: #79e2ad; background: rgba(121,226,173,.08); border-radius: 8px; }
.website-reference-preview > div { min-width: 0; display: grid; gap: 2px; }
.website-reference-preview strong { font-size: .66rem; }
.website-reference-preview small { overflow: hidden; color: #8faa9b; font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
.website-reference-preview > button { width: 30px; height: 30px; margin-inline-start: auto; color: #9db8aa; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.website-chat-composer { display: grid; grid-template-columns: 42px minmax(0,1fr) 44px; align-items: end; gap: 7px; padding: 8px; background: rgba(7,24,14,.97); border: 1px solid rgba(121,226,173,.22); border-radius: 15px; box-shadow: 0 17px 50px rgba(0,0,0,.3); }
.website-chat-composer textarea { width: 100%; min-height: 42px; max-height: 180px; box-sizing: border-box; padding: 10px 7px; color: #fff; background: transparent; border: 0; outline: 0; resize: none; line-height: 1.55; }
.website-composer-side-btn, .website-generate-btn { width: 42px; height: 42px; min-height: 42px; display: grid; place-items: center; padding: 0; border-radius: 11px; cursor: pointer; }
.website-composer-side-btn { color: #b6d5c5; background: rgba(121,226,173,.08); border: 1px solid rgba(121,226,173,.14); }
.website-composer-side-btn:hover, .website-composer-side-btn.active { color: #062017; background: #79e2ad; }
.website-generate-btn { width: 44px; height: 44px; color: #062017; background: #79e2ad; border: 0; }
.website-composer-tools { display: flex; align-items: center; gap: 8px; padding: 7px 3px 0; color: #789687; font-size: .6rem; }
.website-composer-tools > button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; color: #b6d5c5; background: rgba(121,226,173,.045); border: 1px solid rgba(121,226,173,.12); border-radius: 8px; font-size: .61rem; cursor: pointer; }
.website-composer-tools > button small { color: #ffbd7b; }
.website-composer-tools > span { margin-inline-start: auto; }
.website-model-popover { width: min(520px, calc(100% - 8px)); max-height: min(72vh,610px); position: absolute; right: 4px; bottom: calc(100% + 8px); z-index: 60; padding: 12px; overflow-y: auto; background: rgba(4,14,9,.99); border: 1px solid rgba(121,226,173,.17); border-radius: 13px; box-shadow: 0 22px 65px rgba(0,0,0,.45); }
.website-model-description { margin: 8px 0 12px; color: #a9c9b8; font-size: .78rem; }
.website-model-cards { display: grid; gap: 6px; }
.website-model-card { min-height: 54px; }
.website-status { min-height: 18px; padding: 5px 7px 0; color: #8faa9b; font-size: .62rem; }
.website-status.error { color: #ff9aa3; } .website-status.success { color: #79e2ad; } .website-status.loading { color: #ffbd7b; }
@media (max-width:700px) {
    .website-scroll-area { padding-inline: 0; }
    .website-conversation { min-height: 250px; }
    .website-output-toolbar { flex-wrap: wrap; }
    .website-device-switch { margin-inline-start: 0; }
    .website-code-actions { margin-inline-start: auto; }
    .website-revision-composer { grid-template-columns: 1fr; }
    .website-composer-tools > span { display: none; }
    #website-preview-frame { height: 560px; }
}

/* =========================================================
   WEBSITE BUILDER — شجرة ملفات المشروع والمحرر متعدد الملفات
   ========================================================= */
.website-assets-tray { margin-bottom: 8px; padding: 8px; background: rgba(6,18,11,.94); border: 1px solid rgba(121,226,173,.14); border-radius: 11px; }
.website-assets-tray.hidden { display: none !important; }
.website-assets-tray-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: #a9c9b7; font-size: .62rem; }
.website-assets-tray-head span { display: inline-flex; align-items: center; gap: 6px; color: #dff8e9; font-weight: 700; }
.website-assets-tray-head small { color: #718d7e; }
.website-assets-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.website-asset-chip { min-width: 170px; max-width: 260px; display: grid; grid-template-columns: 22px minmax(0,1fr) auto 24px; align-items: center; gap: 6px; padding: 6px 7px; color: #dff8e9; background: rgba(121,226,173,.055); border: 1px solid rgba(121,226,173,.12); border-radius: 9px; cursor: pointer; }
.website-asset-chip > i { color: #79e2ad; text-align: center; }
.website-asset-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: left; font-size: .58rem; }
.website-asset-chip small { color: #6f8f7d; font-size: .52rem; white-space: nowrap; }
.website-asset-chip button { width: 24px; height: 24px; display: grid; place-items: center; padding: 0; color: #82998c; background: transparent; border: 0; border-radius: 6px; }
.website-asset-chip button:hover { color: #ff9da5; background: rgba(255,125,134,.08); }
.website-tree-folder { display: flex; align-items: center; gap: 7px; margin: 8px 4px 3px; padding-top: 8px; color: #7ea18e; border-top: 1px solid rgba(121,226,173,.09); font-size: .59rem; font-weight: 800; }
.website-tree-folder i { color: #79e2ad; }
.website-tree-asset i { color: #a8d9bd !important; }
.website-asset-viewer { min-height: 470px; display: grid; grid-template-rows: minmax(260px,1fr) auto auto; gap: 12px; padding: 12px; background: #07100b; border: 1px solid rgba(121,226,173,.12); border-radius: 10px; }
.website-asset-viewer.hidden { display: none !important; }
.website-asset-preview { min-height: 260px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at center, rgba(121,226,173,.06), transparent 60%), #030806; border: 1px dashed rgba(121,226,173,.16); border-radius: 9px; }
.website-asset-preview img, .website-asset-preview video { max-width: 100%; max-height: 460px; object-fit: contain; }
.website-asset-preview audio { width: min(540px, 92%); }
.website-asset-generic { display: grid; place-items: center; gap: 8px; color: #91b3a0; text-align: center; }
.website-asset-generic i { color: #79e2ad; font-size: 2rem; }
.website-asset-generic strong { color: #e8fff1; font-size: .78rem; }
.website-asset-generic small { font-size: .62rem; }
.website-asset-meta { display: grid; gap: 3px; direction: ltr; text-align: left; }
.website-asset-meta strong { color: #effff5; font-size: .72rem; }
.website-asset-meta small { color: #769483; font-size: .58rem; overflow-wrap: anywhere; }
.website-asset-actions { display: flex; gap: 7px; justify-content: flex-end; }
.website-asset-actions button { width: auto; min-height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; color: #cfe9da; background: rgba(121,226,173,.07); border: 1px solid rgba(121,226,173,.14); border-radius: 8px; font-size: .61rem; }
.website-asset-actions button.danger { color: #ffb6bc; background: rgba(255,125,134,.06); border-color: rgba(255,125,134,.15); }
.website-files-view { width: 100%; }
.website-project-workspace {
    display: grid;
    grid-template-columns: minmax(180px, 230px) minmax(0, 1fr);
    gap: 10px;
    min-height: 540px;
    direction: ltr;
}
.website-files-sidebar {
    min-width: 0;
    overflow: hidden;
    background: #07100b;
    border: 1px solid rgba(121,226,173,.14);
    border-radius: 10px;
    direction: rtl;
}
.website-files-sidebar-head {
    display: grid;
    gap: 3px;
    padding: 11px 12px;
    border-bottom: 1px solid rgba(121,226,173,.11);
    background: rgba(121,226,173,.035);
}
.website-files-sidebar-head > span {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #e5f9ed;
    font-size: .72rem;
    font-weight: 800;
}
.website-files-sidebar-head > span i { color: #79e2ad; }
.website-files-sidebar-head > small { color: #718e7e; font-size: .56rem; }
.website-file-tree {
    max-height: 565px;
    padding: 8px;
    overflow: auto;
    direction: ltr;
    scrollbar-width: thin;
}
.website-tree-folder { min-width: 0; }
.website-tree-folder-label {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 5px 7px;
    color: #9fbbac;
    font-size: .65rem;
    font-weight: 700;
    white-space: nowrap;
}
.website-tree-folder-label i { width: 15px; color: #ffbd7b; text-align: center; }
.website-tree-children {
    margin-left: 11px;
    padding-left: 7px;
    border-left: 1px solid rgba(121,226,173,.12);
}
.website-tree-file {
    width: 100%;
    min-height: 31px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    color: #9ab5a6;
    background: transparent;
    border: 0;
    border-radius: 7px;
    text-align: left;
    font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
    font-size: .62rem;
    cursor: pointer;
}
.website-tree-file i { width: 15px; flex: 0 0 15px; color: #7fa892; text-align: center; }
.website-tree-file span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.website-tree-file:hover { color: #eafff2; background: rgba(121,226,173,.07); }
.website-tree-file.active { color: #062017; background: #79e2ad; font-weight: 800; }
.website-tree-file.active i { color: #062017; }
.website-tree-file.changed:not(.active)::after {
    content: '';
    width: 6px;
    height: 6px;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: #ffbd7b;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255,189,123,.45);
}
.website-file-editor-panel {
    min-width: 0;
    display: grid;
    grid-template-rows: auto minmax(0,1fr) auto;
    gap: 9px;
    direction: rtl;
}
.website-file-editor-panel .website-code-head {
    min-height: 34px;
    align-items: center;
    padding: 0 2px;
}
.website-file-editor-panel .website-code-head > span {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
}
#website-active-file-path {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
    font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
#website-active-file-language {
    padding: 3px 7px;
    color: #ffbd7b;
    background: rgba(255,189,123,.07);
    border-radius: 6px;
    white-space: nowrap;
}
.website-file-editor-panel #website-code-editor {
    min-height: 500px;
    height: 100%;
    resize: vertical;
}

@media (max-width: 760px) {
    .website-project-workspace { grid-template-columns: 1fr; min-height: 0; }
    .website-files-sidebar { max-height: 220px; }
    .website-file-tree { max-height: 160px; }
    .website-file-editor-panel #website-code-editor { min-height: 430px; }
}


/* =========================================================
   WEBSITE BUILDER — LARGE PREVIEW WORKSPACE
   يطبق فقط عند فتح معاينة منشئ المواقع.
   ========================================================= */
.website-chat-panel-label,
.website-close-chat-btn { display: none; }

.app-shell.website-preview-layout[data-action="website_builder"] {
    box-sizing: border-box;
    grid-template-columns: 64px minmax(0, 1fr);
}

.app-shell.website-preview-layout[data-action="website_builder"] .tools-sidebar {
    width: auto;
    padding: 12px 7px;
    align-items: center;
    gap: 6px;
}

.app-shell.website-preview-layout[data-action="website_builder"] .sidebar-title,
.app-shell.website-preview-layout[data-action="website_builder"] .tool-button > span:not(.tool-icon) {
    display: none !important;
}

.app-shell.website-preview-layout[data-action="website_builder"] .tool-button {
    width: 48px;
    min-width: 48px;
    justify-content: center;
    gap: 0;
    padding: 7px;
    border-radius: 11px;
}

.app-shell.website-preview-layout[data-action="website_builder"] .tool-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
}

.app-shell.website-preview-layout[data-action="website_builder"] .tool-button.active::after {
    right: -8px;
}

.app-shell.website-preview-layout[data-action="website_builder"] .tool-button.secondary {
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.app-shell.website-preview-layout[data-action="website_builder"] .workspace-main {
    height: calc(100dvh - 72px);
    min-height: 0;
    padding: 0 10px 10px;
    overflow: hidden;
}

.app-shell.website-preview-layout[data-action="website_builder"] .workspace-header {
    display: none;
}

.app-shell.website-preview-layout[data-action="website_builder"] #main-inputs-wrapper {
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    overflow: hidden;
}

.website-builder-studio.is-preview-mode {
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: clamp(300px, 22vw, 350px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 10px;
    margin: 0;
    overflow: hidden;
    direction: rtl;
}

.website-builder-studio.is-preview-mode .website-scroll-area {
    display: contents;
}

.website-builder-studio.is-preview-mode .website-chat-toolbar {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    min-height: 48px;
    margin: 0;
    padding: 7px 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    background: rgba(4,14,9,.98);
    border: 1px solid rgba(121,226,173,.12);
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
}

.website-builder-studio.is-preview-mode .website-chat-panel-label {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-inline-end: auto;
    color: #eafff2;
    font-size: .72rem;
    font-weight: 800;
}

.website-builder-studio.is-preview-mode .website-chat-panel-label i {
    color: #79e2ad;
}

.website-builder-studio.is-preview-mode .website-chat-toolbar button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
}

.website-builder-studio.is-preview-mode .website-chat-toolbar button > span {
    display: none;
}

.website-builder-studio.is-preview-mode .website-close-chat-btn {
    display: inline-grid;
    place-items: center;
}

.website-builder-studio.is-preview-mode .website-conversation {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    height: auto;
    margin: 0;
    padding: 10px 8px 16px;
    gap: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    background: rgba(2,10,6,.96);
    border-inline: 1px solid rgba(121,226,173,.12);
}

.website-builder-studio.is-preview-mode .website-conversation .message-row {
    min-width: 0;
    gap: 7px;
}

.website-builder-studio.is-preview-mode .website-conversation .message-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
}

.website-builder-studio.is-preview-mode .website-conversation .message-content {
    min-width: 0;
    max-width: calc(100% - 37px);
}

.website-builder-studio.is-preview-mode .website-user-message .message-bubble {
    display: -webkit-box;
    max-height: 6.2em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    text-overflow: ellipsis;
}

.website-builder-studio.is-preview-mode .website-welcome-message .message-bubble {
    display: -webkit-box;
    max-height: 4.8em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.website-builder-studio.is-preview-mode .website-state-content {
    width: 100%;
    max-width: 100% !important;
}

.website-builder-studio.is-preview-mode .website-progress-image {
    width: min(190px, 100%) !important;
}

.website-builder-studio.is-preview-mode .website-complete-bubble {
    grid-template-columns: 34px minmax(0,1fr) 34px;
    gap: 7px;
    padding: 9px !important;
}

.website-builder-studio.is-preview-mode .website-complete-icon {
    width: 34px;
    height: 34px;
}

.website-builder-studio.is-preview-mode #website-open-result-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
}

.website-builder-studio.is-preview-mode #website-open-result-btn span {
    display: none;
}

.website-builder-studio.is-preview-mode .website-input-dock {
    grid-column: 1;
    grid-row: 3;
    min-width: 0;
    margin: 0;
    padding: 8px;
    background: rgba(4,14,9,.99);
    border: 1px solid rgba(121,226,173,.12);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    box-shadow: none;
}

.website-builder-studio.is-preview-mode .website-chat-composer {
    grid-template-columns: 36px minmax(0,1fr) 38px;
    gap: 5px;
    padding: 6px;
    border-radius: 11px;
    box-shadow: none;
}

.website-builder-studio.is-preview-mode .website-chat-composer textarea {
    min-height: 38px;
    max-height: 110px;
    padding: 8px 5px;
    font-size: .72rem;
}

.website-builder-studio.is-preview-mode .website-composer-side-btn,
.website-builder-studio.is-preview-mode .website-generate-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
}

.website-builder-studio.is-preview-mode .website-composer-tools {
    min-width: 0;
    gap: 5px;
    padding-top: 5px;
}

.website-builder-studio.is-preview-mode .website-composer-tools > span {
    display: none;
}

.website-builder-studio.is-preview-mode .website-composer-tools > button {
    min-width: 0;
    max-width: 100%;
}

.website-builder-studio.is-preview-mode .website-composer-tools > button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.website-builder-studio.is-preview-mode .website-model-popover {
    width: min(420px, calc(100vw - 100px));
    right: 0;
}

.website-builder-studio.is-preview-mode .website-output-panel {
    grid-column: 2;
    grid-row: 1 / 4;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 9px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
}

.website-builder-studio.is-preview-mode .website-output-toolbar {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 0 8px;
    flex-wrap: wrap;
}

.website-builder-studio.is-preview-mode .website-output-toolbar button {
    min-height: 32px;
    padding: 6px 9px;
}

.website-builder-studio.is-preview-mode .website-output-stage {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.website-builder-studio.is-preview-mode .website-preview-view,
.website-builder-studio.is-preview-mode .website-files-view {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.website-builder-studio.is-preview-mode .website-preview-shell {
    height: 100%;
    min-height: 0;
    max-width: none;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    border-radius: 9px;
}

.website-builder-studio.is-preview-mode .website-preview-shell[data-device="mobile"] {
    width: min(390px, 100%);
    max-width: 390px;
}

.website-builder-studio.is-preview-mode .website-browser-bar {
    flex: 0 0 34px;
    height: 34px;
}

.website-builder-studio.is-preview-mode #website-preview-frame {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
}

.website-builder-studio.is-preview-mode .website-project-workspace {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(145px, 190px) minmax(0,1fr);
}

.website-builder-studio.is-preview-mode .website-file-tree {
    max-height: none;
    height: calc(100% - 58px);
}

.website-builder-studio.is-preview-mode .website-file-editor-panel,
.website-builder-studio.is-preview-mode #website-code-editor {
    min-height: 0;
}

.website-builder-studio.is-preview-mode #website-code-editor {
    height: 100%;
    resize: none;
}

.website-builder-studio.is-preview-mode .website-revision-panel {
    display: grid;
    min-width: 220px;
}

.website-builder-studio.is-preview-mode.is-revising .website-generation-bubble {
    width: auto;
    min-width: 72px;
    display: inline-grid;
    place-items: center;
    padding: 11px 14px !important;
}

.website-builder-studio.is-preview-mode.is-revising .website-generation-bubble .website-progress-image,
.website-builder-studio.is-preview-mode.is-revising .website-generation-bubble .website-live-progress,
.website-builder-studio.is-preview-mode.is-revising .website-generation-bubble .website-progress-info {
    display: none !important;
}

.website-builder-studio.is-preview-mode.is-revising .website-preview-typing {
    display: flex;
}

/* إخفاء المحادثة يترك المعاينة ممتدة على كامل المساحة المتبقية. */
.website-builder-studio.is-preview-mode.is-chat-collapsed {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
}

.website-builder-studio.is-preview-mode.is-chat-collapsed .website-chat-toolbar,
.website-builder-studio.is-preview-mode.is-chat-collapsed .website-conversation,
.website-builder-studio.is-preview-mode.is-chat-collapsed .website-input-dock {
    display: none !important;
}

.website-builder-studio.is-preview-mode.is-chat-collapsed .website-output-panel {
    grid-column: 1;
    grid-row: 1 / 4;
}

/* لا يتأثر الوضع العادي: زر إخفاء الشات يظهر فقط مع المعاينة الكبيرة. */
.website-builder-studio:not(.is-preview-mode) .website-close-chat-btn,
.website-builder-studio:not(.is-preview-mode) .website-chat-panel-label {
    display: none !important;
}

@media (max-width: 980px) and (min-width: 721px) {
    .app-shell.website-preview-layout[data-action="website_builder"] {
        grid-template-columns: 58px minmax(0,1fr);
    }

    .website-builder-studio.is-preview-mode {
        grid-template-columns: minmax(270px, 32vw) minmax(0,1fr);
        column-gap: 7px;
    }

    .app-shell.website-preview-layout[data-action="website_builder"] .tool-button {
        width: 44px;
        min-width: 44px;
        padding: 5px;
    }
}

@media (max-width: 720px) {
    .app-shell.website-preview-layout[data-action="website_builder"] {
        display: block;
        padding: 62px 0 68px;
    }

    .app-shell.website-preview-layout[data-action="website_builder"] .workspace-main {
        height: calc(100dvh - 130px);
        padding: 0 7px 7px;
    }

    .app-shell.website-preview-layout[data-action="website_builder"] .tools-sidebar {
        width: auto;
        height: 62px;
        padding: 5px 7px;
    }

    .website-builder-studio.is-preview-mode {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0,1fr);
        height: 100%;
    }

    .website-builder-studio.is-preview-mode .website-output-panel {
        grid-column: 1;
        grid-row: 1;
    }

    .website-builder-studio.is-preview-mode .website-chat-toolbar,
    .website-builder-studio.is-preview-mode .website-conversation,
    .website-builder-studio.is-preview-mode .website-input-dock {
        position: absolute;
        right: 8px;
        z-index: 75;
        width: min(330px, calc(100vw - 28px));
        box-sizing: border-box;
    }

    .website-builder-studio.is-preview-mode .website-chat-toolbar {
        top: 8px;
    }

    .website-builder-studio.is-preview-mode .website-conversation {
        top: 56px;
        bottom: 126px;
        height: auto;
    }

    .website-builder-studio.is-preview-mode .website-input-dock {
        bottom: 8px;
    }

    .website-builder-studio.is-preview-mode.is-chat-collapsed .website-chat-toolbar,
    .website-builder-studio.is-preview-mode.is-chat-collapsed .website-conversation,
    .website-builder-studio.is-preview-mode.is-chat-collapsed .website-input-dock {
        display: none !important;
    }

    .website-builder-studio.is-preview-mode .website-view-tabs button {
        font-size: 0;
    }

    .website-builder-studio.is-preview-mode .website-view-tabs button i {
        font-size: .8rem;
    }

    .website-builder-studio.is-preview-mode .website-output-toolbar {
        gap: 5px;
    }

    .website-builder-studio.is-preview-mode .website-output-toolbar button {
        padding-inline: 7px;
    }

    .website-builder-studio.is-preview-mode .website-revision-panel {
        order: 4;
        flex-basis: 100%;
        min-width: 0;
    }

    .website-builder-studio.is-preview-mode .website-revision-panel textarea {
        min-width: 0;
    }

    .website-builder-studio.is-preview-mode .website-project-workspace {
        grid-template-columns: 115px minmax(0,1fr);
    }
}

/* =========================================================
   WEBSITE BUILDER — سجل النسخ والتحقق من استبدال الملفات
   ========================================================= */
.website-version-card {
    transition: opacity .2s ease, transform .2s ease;
}
.website-version-card .website-version-bubble {
    position: relative;
}
.website-version-card.is-active .website-version-bubble {
    border-color: rgba(121,226,173,.42) !important;
    box-shadow: 0 18px 48px rgba(0,0,0,.28), inset 0 0 0 1px rgba(121,226,173,.08);
}
.website-version-card.is-active .website-version-bubble::after {
    content: 'المفتوحة الآن';
    position: absolute;
    inset-inline-end: 10px;
    bottom: -18px;
    color: #79e2ad;
    font-size: .52rem;
    font-weight: 800;
}
.website-version-open-btn {
    width: auto;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 11px;
    color: #052016;
    background: #79e2ad;
    border: 0;
    border-radius: 9px;
    font-size: .64rem;
    font-weight: 850;
    cursor: pointer;
}
.website-version-open-btn:hover { filter: brightness(1.06); }
.website-version-proof {
    margin-top: 6px;
    padding-inline: 3px;
    color: #7f9f90 !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .5rem !important;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.website-version-card.is-active .website-version-proof { color: #94c7ad !important; }

@media (max-width: 700px) {
    .website-version-card .website-complete-bubble {
        grid-template-columns: 38px minmax(0,1fr) auto;
        gap: 8px;
    }
    .website-version-card .website-complete-icon { width: 38px; height: 38px; }
    .website-version-open-btn span { display: none; }
    .website-version-open-btn { width: 36px; min-width: 36px; padding: 0; }
}

@media (max-width: 620px) {
    .website-preview-diagnostics { align-items: flex-start; flex-direction: column; gap: 5px; padding: 7px 8px; }
    .website-preview-health { width: 100%; overflow-x: auto; }
    .website-preview-diagnostics > small { width: 100%; white-space: normal; }
}

.website-browser-bar { display: none !important; }
.website-preview-shell #website-preview-frame { min-height: 680px; }
.website-builder-studio.is-preview-mode #website-preview-frame { height: calc(100vh - 188px); min-height: 620px; }
@media (max-width: 720px) { .website-asset-chip { min-width: 150px; } .website-asset-viewer { min-height: 360px; grid-template-rows: minmax(200px,1fr) auto auto; } }


/* =========================================================
   AKLAKE WORKSPACE CHROME — دمج الهوية والحساب داخل الأدوات
   الشريط العلوي يبقى للواجهة الرئيسية فقط. داخل مساحة العمل
   نستخدم نفس عناصر DOM الأصلية حتى تبقى جميع الأحداث والعدادات سليمة.
   ========================================================= */
.nav .account-item-label { display: none; }
.nav .token-action-group { display: contents; }

.workspace-brand-slot,
.workspace-account-slot { width: 100%; }
.workspace-brand-slot:empty,
.workspace-account-slot:empty,
.sidebar-system-divider:has(+ .sidebar-title):not(body.workspace-open *) { display: none; }

body.workspace-open .nav { display: none !important; }
body.workspace-open .app-shell { padding-top: 0; }
body.workspace-open .tools-sidebar {
    top: 0;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
}
body.workspace-open .workspace-main { min-height: 100dvh; }

body.workspace-open .tools-sidebar .brand-navigation {
    width: 100%;
    display: grid;
    grid-template-columns: 38px minmax(0,1fr);
    align-items: center;
    gap: 8px;
    padding: 7px 8px 11px;
    border-bottom: 1px solid rgba(121,226,173,.12);
}
body.workspace-open .tools-sidebar .home-button {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    color: var(--green-bright);
    background: rgba(121,226,173,.08);
    border: 1px solid rgba(121,226,173,.14);
    border-radius: 7px;
}
body.workspace-open .tools-sidebar .brand-button {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 5px;
    cursor: pointer;
}
body.workspace-open .tools-sidebar .brand-orbit { display: none; }
body.workspace-open .tools-sidebar .brand-lockup { min-width: 0; }
body.workspace-open .tools-sidebar .logo { font-size: 1rem; letter-spacing: 1.8px; }
body.workspace-open .tools-sidebar .brand-lockup small { margin-top: 3px; font-size: .46rem; letter-spacing: 1.45px; }

body.workspace-open .tools-sidebar .account-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 9px 0 4px;
}
body.workspace-open .tools-sidebar .token-action-group {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0,1fr) 28px;
    align-items: center;
    gap: 3px;
    order: 2;
}
body.workspace-open .tools-sidebar #profile-header-btn,
body.workspace-open .tools-sidebar #login-btn { order: 1; }
body.workspace-open .tools-sidebar #cart-header-btn { order: 3; }
body.workspace-open .tools-sidebar .account-actions > #profile-header-btn,
body.workspace-open .tools-sidebar .account-actions > #login-btn,
body.workspace-open .tools-sidebar .account-actions > #cart-header-btn,
body.workspace-open .tools-sidebar .credit-pill {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 7px 10px;
    color: #c1dfcf;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    box-shadow: none;
    text-align: right;
}
body.workspace-open .tools-sidebar .account-actions > #profile-header-btn:hover,
body.workspace-open .tools-sidebar .account-actions > #login-btn:hover,
body.workspace-open .tools-sidebar .account-actions > #cart-header-btn:hover,
body.workspace-open .tools-sidebar .credit-pill:hover {
    color: #fff;
    background: rgba(121,226,173,.09);
    border-color: rgba(121,226,173,.18);
}
body.workspace-open .tools-sidebar .account-actions i:first-child,
body.workspace-open .tools-sidebar .credit-pill .token-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    color: var(--green-bright);
    background: rgba(121,226,173,.09);
    border-radius: 6px;
}
body.workspace-open .tools-sidebar .account-item-label {
    display: inline;
    color: #d9efe3;
    font-size: .74rem;
    font-weight: 700;
}
body.workspace-open .tools-sidebar #header-user-name {
    min-width: 0;
    margin-inline-start: auto;
    color: #87a796;
    font-size: .64rem;
    font-weight: 600;
}
body.workspace-open .tools-sidebar .profile-chevron { margin-inline-start: 0; }
body.workspace-open .tools-sidebar .token-value,
body.workspace-open .tools-sidebar #cart-count {
    margin-inline-start: auto;
    color: var(--green-bright);
    font-size: .7rem;
    font-weight: 800;
}
body.workspace-open .tools-sidebar .token-add-btn {
    width: 28px;
    height: 28px;
    margin: 0;
    align-self: center;
}
body.workspace-open .tools-sidebar .sidebar-system-divider {
    width: calc(100% - 16px);
    height: 1px;
    flex: 0 0 1px;
    margin: 5px 8px 4px;
    background: rgba(121,226,173,.12);
}

/* وضع المعاينة: كل مساحة ممكنة للمنتج، والشريط يصبح أيقونات فقط. */
.app-shell.website-preview-layout[data-action="website_builder"] .workspace-brand-slot,
.app-shell.website-preview-layout[data-action="website_builder"] .workspace-account-slot { width: 48px; }
.app-shell.website-preview-layout[data-action="website_builder"] .brand-navigation {
    width: 48px;
    display: block;
    padding: 0;
    border: 0;
}
.app-shell.website-preview-layout[data-action="website_builder"] .brand-button { display: none !important; }
.app-shell.website-preview-layout[data-action="website_builder"] .home-button {
    width: 48px;
    height: 48px;
    border-radius: 11px;
}
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions {
    width: 48px;
    padding: 0;
    gap: 6px;
}
.app-shell.website-preview-layout[data-action="website_builder"] .token-action-group {
    width: 48px;
    display: block;
}
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions > #profile-header-btn,
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions > #login-btn,
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions > #cart-header-btn,
.app-shell.website-preview-layout[data-action="website_builder"] .credit-pill {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    justify-content: center;
    gap: 0;
    padding: 7px;
    font-size: 0;
    border-radius: 11px;
}
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions i:first-child,
.app-shell.website-preview-layout[data-action="website_builder"] .credit-pill .token-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
}
.app-shell.website-preview-layout[data-action="website_builder"] .account-item-label,
.app-shell.website-preview-layout[data-action="website_builder"] #header-user-name,
.app-shell.website-preview-layout[data-action="website_builder"] .profile-chevron,
.app-shell.website-preview-layout[data-action="website_builder"] .token-value,
.app-shell.website-preview-layout[data-action="website_builder"] #cart-count,
.app-shell.website-preview-layout[data-action="website_builder"] .token-add-btn,
.app-shell.website-preview-layout[data-action="website_builder"] .sidebar-title,
.app-shell.website-preview-layout[data-action="website_builder"] .sidebar-system-divider {
    display: none !important;
}

@media (max-width: 720px) {
    body.workspace-open .app-shell { padding: 0 0 74px; }
    body.workspace-open .workspace-main { min-height: calc(100dvh - 74px); }
    body.workspace-open .tools-sidebar {
        top: auto;
        height: 68px;
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 7px 8px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }
    body.workspace-open .tools-sidebar::-webkit-scrollbar { display: none; }
    body.workspace-open .workspace-brand-slot,
    body.workspace-open .workspace-account-slot { width: auto; flex: 0 0 auto; }
    body.workspace-open .tools-sidebar .brand-navigation {
        width: auto;
        display: block;
        padding: 0;
        border: 0;
    }
    body.workspace-open .tools-sidebar .brand-button { display: none; }
    body.workspace-open .tools-sidebar .home-button { width: 48px; height: 48px; }
    body.workspace-open .tools-sidebar .account-actions {
        width: auto;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 4px;
        padding: 0;
    }
    body.workspace-open .tools-sidebar .token-action-group { width: auto; display: block; }
    body.workspace-open .tools-sidebar .account-actions > #profile-header-btn,
    body.workspace-open .tools-sidebar .account-actions > #login-btn,
    body.workspace-open .tools-sidebar .account-actions > #cart-header-btn,
    body.workspace-open .tools-sidebar .credit-pill,
    body.workspace-open .tools-sidebar .tool-button {
        width: 48px;
        min-width: 48px;
        height: 48px;
        min-height: 48px;
        flex: 0 0 48px;
        justify-content: center;
        gap: 0;
        padding: 7px;
        font-size: 0;
    }
    body.workspace-open .tools-sidebar .account-item-label,
    body.workspace-open .tools-sidebar #header-user-name,
    body.workspace-open .tools-sidebar .profile-chevron,
    body.workspace-open .tools-sidebar .token-value,
    body.workspace-open .tools-sidebar #cart-count,
    body.workspace-open .tools-sidebar .token-add-btn,
    body.workspace-open .tools-sidebar .sidebar-title,
    body.workspace-open .tools-sidebar .sidebar-system-divider,
    body.workspace-open .tools-sidebar .sidebar-spacer { display: none !important; }
}

/* تصحيح ارتفاع مساحة المعاينة بعد إزالة الشريط العلوي من مساحة العمل. */
body.workspace-open .app-shell.website-preview-layout[data-action="website_builder"] .workspace-main {
    height: 100dvh;
    min-height: 0;
}
@media (max-width: 720px) {
    body.workspace-open .app-shell.website-preview-layout[data-action="website_builder"] .workspace-main {
        height: calc(100dvh - 74px);
        min-height: 0;
    }
}

/* =========================================================
   PREVIEW POLISH — مساحة أكبر + أيقونات ثابتة + صفحات الهبوط
   يقتصر على أوضاع معاينة المواقع وصفحات الهبوط.
   ========================================================= */

/* إصلاح اختفاء أيقونات الحساب/التوكن/السلة بعد إخفاء النصوص. */
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions > #profile-header-btn > i:first-child,
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions > #login-btn > i:first-child,
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions > #cart-header-btn > i:first-child,
.app-shell.website-preview-layout[data-action="website_builder"] .credit-pill > .token-mark,
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #profile-header-btn > i:first-child,
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #login-btn > i:first-child,
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #cart-header-btn > i:first-child,
.app-shell.landing-preview-layout[data-action="landing_page"] .credit-pill > .token-mark {
    display: grid !important;
    place-items: center;
    font-size: 1rem !important;
    line-height: 1 !important;
    opacity: 1 !important;
    visibility: visible !important;
    color: var(--green-bright, #79e2ad) !important;
}

/* ---------- معاينة المواقع: إزالة الهوامش والفراغ السفلي ---------- */
body.workspace-open .app-shell.website-preview-layout[data-action="website_builder"] {
    height: 100dvh;
    min-height: 0;
}
body.workspace-open .app-shell.website-preview-layout[data-action="website_builder"] .workspace-main {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 0 !important;
    margin: 0;
    overflow: hidden;
}
.app-shell.website-preview-layout[data-action="website_builder"] #main-inputs-wrapper {
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    padding: 0;
}
.website-builder-studio.is-preview-mode {
    width: 100%;
    max-width: none;
    height: 100%;
    column-gap: 0 !important;
    padding: 0;
    margin: 0;
}
.website-builder-studio.is-preview-mode .website-chat-toolbar,
.website-builder-studio.is-preview-mode .website-conversation,
.website-builder-studio.is-preview-mode .website-input-dock {
    border-radius: 0;
}
.website-builder-studio.is-preview-mode .website-chat-toolbar {
    border-inline-end: 1px solid rgba(121,226,173,.12);
}
.website-builder-studio.is-preview-mode .website-conversation {
    border-inline-start: 0;
    border-inline-end: 1px solid rgba(121,226,173,.12);
}
.website-builder-studio.is-preview-mode .website-input-dock {
    border-inline-end: 1px solid rgba(121,226,173,.12);
}
.website-builder-studio.is-preview-mode .website-output-panel {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #000;
}
.website-builder-studio.is-preview-mode .website-output-toolbar {
    min-height: 46px;
    margin: 0;
    padding: 6px 8px !important;
    border-bottom: 1px solid rgba(121,226,173,.12);
    background: rgba(3,11,7,.99);
}
.website-builder-studio.is-preview-mode .website-output-stage,
.website-builder-studio.is-preview-mode .website-preview-view,
.website-builder-studio.is-preview-mode .website-preview-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0 !important;
    padding: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff;
}
.website-builder-studio.is-preview-mode .website-preview-view {
    display: flex;
}
.website-builder-studio.is-preview-mode .website-preview-shell[data-device="desktop"] {
    max-width: none !important;
}
.website-builder-studio.is-preview-mode #website-preview-frame {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0;
    border: 0;
    background: #fff;
}
.website-builder-studio.is-preview-mode .website-preview-shell[data-device="mobile"] {
    height: 100%;
    margin: 0 auto !important;
    border-inline: 1px solid rgba(255,255,255,.12) !important;
}

/* ---------- صفحات الهبوط: نفس تجربة المعاينة الجانبية للمواقع ---------- */
.landing-chat-panel-label,
.landing-close-chat-btn { display: none; }

.app-shell.landing-preview-layout[data-action="landing_page"] {
    box-sizing: border-box;
    grid-template-columns: 64px minmax(0,1fr);
    height: 100dvh;
    min-height: 0;
    padding-top: 0;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .tools-sidebar {
    width: auto;
    top: 0;
    height: 100dvh;
    padding: 12px 7px;
    align-items: center;
    gap: 6px;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .sidebar-title,
.app-shell.landing-preview-layout[data-action="landing_page"] .tool-button > span:not(.tool-icon),
.app-shell.landing-preview-layout[data-action="landing_page"] .sidebar-system-divider {
    display: none !important;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .tool-button {
    width: 48px;
    min-width: 48px;
    justify-content: center;
    gap: 0;
    padding: 7px;
    border-radius: 11px;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .tool-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .tool-button.active::after { right: -8px; }
.app-shell.landing-preview-layout[data-action="landing_page"] .workspace-brand-slot,
.app-shell.landing-preview-layout[data-action="landing_page"] .workspace-account-slot { width: 48px; }
.app-shell.landing-preview-layout[data-action="landing_page"] .brand-navigation {
    width: 48px;
    display: block;
    padding: 0;
    border: 0;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .brand-button { display: none !important; }
.app-shell.landing-preview-layout[data-action="landing_page"] .home-button {
    width: 48px;
    height: 48px;
    border-radius: 11px;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions {
    width: 48px;
    padding: 0;
    gap: 6px;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .token-action-group {
    width: 48px;
    display: block;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #profile-header-btn,
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #login-btn,
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #cart-header-btn,
.app-shell.landing-preview-layout[data-action="landing_page"] .credit-pill {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    justify-content: center;
    gap: 0;
    padding: 7px;
    font-size: 0;
    border-radius: 11px;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions i:first-child,
.app-shell.landing-preview-layout[data-action="landing_page"] .credit-pill .token-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .account-item-label,
.app-shell.landing-preview-layout[data-action="landing_page"] #header-user-name,
.app-shell.landing-preview-layout[data-action="landing_page"] .profile-chevron,
.app-shell.landing-preview-layout[data-action="landing_page"] .token-value,
.app-shell.landing-preview-layout[data-action="landing_page"] #cart-count,
.app-shell.landing-preview-layout[data-action="landing_page"] .token-add-btn,
.app-shell.landing-preview-layout[data-action="landing_page"] .sidebar-title,
.app-shell.landing-preview-layout[data-action="landing_page"] .sidebar-system-divider {
    display: none !important;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .workspace-main {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    margin: 0;
    padding: 0 !important;
    overflow: hidden;
}
.app-shell.landing-preview-layout[data-action="landing_page"] .workspace-header { display: none; }
.app-shell.landing-preview-layout[data-action="landing_page"] #main-inputs-wrapper {
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.landing-page-studio.is-preview-mode {
    width: 100% !important;
    max-width: none;
    height: 100%;
    min-height: 0;
    display: grid !important;
    grid-template-columns: clamp(290px, 22vw, 350px) minmax(0,1fr);
    grid-template-rows: auto minmax(0,1fr) auto;
    column-gap: 0;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    direction: rtl;
}
.landing-page-studio.is-preview-mode .landing-scroll-area { display: contents; }
.landing-page-studio.is-preview-mode .landing-chat-toolbar {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    min-height: 48px;
    margin: 0;
    padding: 7px 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    background: rgba(4,14,9,.99);
    border: 0;
    border-inline-end: 1px solid rgba(121,226,173,.12);
    border-bottom: 1px solid rgba(121,226,173,.12);
    border-radius: 0;
}
.landing-page-studio.is-preview-mode .landing-chat-panel-label {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-inline-end: auto;
    color: #eafff2;
    font-size: .72rem;
    font-weight: 800;
}
.landing-page-studio.is-preview-mode .landing-chat-panel-label i { color: #79e2ad; }
.landing-page-studio.is-preview-mode .landing-chat-toolbar button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
}
.landing-page-studio.is-preview-mode .landing-chat-toolbar button > span { display: none; }
.landing-page-studio.is-preview-mode .landing-close-chat-btn { display: inline-grid; place-items: center; }
.landing-page-studio.is-preview-mode .landing-conversation {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    height: auto;
    margin: 0;
    padding: 10px 8px 14px;
    gap: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    background: rgba(2,10,6,.97);
    border-inline-end: 1px solid rgba(121,226,173,.12);
}
.landing-page-studio.is-preview-mode .landing-conversation .message-row { min-width: 0; gap: 7px; }
.landing-page-studio.is-preview-mode .landing-conversation .message-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
}
.landing-page-studio.is-preview-mode .landing-conversation .message-content {
    min-width: 0;
    max-width: calc(100% - 37px);
}
.landing-page-studio.is-preview-mode .landing-user-message .message-bubble,
.landing-page-studio.is-preview-mode .landing-welcome-message .message-bubble {
    display: -webkit-box;
    max-height: 6.2em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
}
.landing-page-studio.is-preview-mode .landing-input-dock {
    grid-column: 1;
    grid-row: 3;
    min-width: 0;
    margin: 0;
    padding: 8px;
    background: rgba(4,14,9,.99);
    border: 0;
    border-top: 1px solid rgba(121,226,173,.12);
    border-inline-end: 1px solid rgba(121,226,173,.12);
    border-radius: 0;
    box-shadow: none;
}
/* داخل المعاينة، الشات مخصص لتعديل النسخة الحالية؛ الحقول الإعدادية تبقى في الوضع العادي فقط. */
.landing-page-studio.is-preview-mode .landing-required-row,
.landing-page-studio.is-preview-mode .landing-assistant-panel { display: none !important; }
.landing-page-studio.is-preview-mode .landing-chat-composer {
    grid-template-columns: 36px minmax(0,1fr) 38px;
    gap: 5px;
    padding: 6px;
    border-radius: 11px;
    box-shadow: none;
}
.landing-page-studio.is-preview-mode .landing-chat-composer textarea {
    min-height: 38px;
    max-height: 110px;
    padding: 8px 5px;
    font-size: .72rem;
}
.landing-page-studio.is-preview-mode .landing-composer-side-btn,
.landing-page-studio.is-preview-mode .landing-generate-btn {
    width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
}
.landing-page-studio.is-preview-mode .landing-composer-tools { gap: 5px; padding-top: 5px; }
.landing-page-studio.is-preview-mode .landing-composer-tools > span { display: none; }
.landing-page-studio.is-preview-mode .landing-output-panel {
    grid-column: 2;
    grid-row: 1 / 4;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #000;
}
.landing-page-studio.is-preview-mode .landing-output-toolbar {
    position: static;
    flex: 0 0 auto;
    min-height: 46px;
    margin: 0;
    padding: 6px 8px !important;
    border-bottom: 1px solid rgba(121,226,173,.12);
    background: rgba(3,11,7,.99);
}
.landing-page-studio.is-preview-mode .landing-output-toolbar button {
    min-height: 32px;
    padding: 6px 9px;
}
.landing-page-studio.is-preview-mode .landing-preview-view,
.landing-page-studio.is-preview-mode .landing-code-view {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    background: #fff;
}
.landing-page-studio.is-preview-mode .landing-preview-view { display: flex; }
.landing-page-studio.is-preview-mode .landing-empty-preview { margin: auto; }
.landing-page-studio.is-preview-mode .landing-preview-shell {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-width: none;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #fff;
}
.landing-page-studio.is-preview-mode .landing-browser-bar { display: none !important; }
.landing-page-studio.is-preview-mode .landing-preview-shell[data-device="mobile"] {
    width: min(390px,100%);
    max-width: 390px;
    margin: 0 auto;
    border-inline: 1px solid rgba(255,255,255,.12);
}
.landing-page-studio.is-preview-mode #landing-preview-frame {
    display: block;
    width: 100%;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0;
    border: 0;
    background: #fff;
}
.landing-page-studio.is-preview-mode .landing-code-view {
    padding: 8px;
    background: rgba(2,8,5,.98);
}
.landing-page-studio.is-preview-mode #landing-code-editor {
    height: calc(100% - 86px);
    min-height: 0;
    resize: none;
}
/* شريط تعديل مضغوط أسفل المعاينة، مع الحفاظ على التنقل بين النسخ. */
.landing-page-studio.is-preview-mode .landing-revision-panel {
    flex: 0 0 auto;
    margin: 0;
    padding: 6px 8px;
    border: 0;
    border-top: 1px solid rgba(121,226,173,.12);
    border-radius: 0;
    background: rgba(3,11,7,.99);
}
.landing-page-studio.is-preview-mode .landing-revision-head {
    min-height: 28px;
    margin: 0 0 5px;
}
.landing-page-studio.is-preview-mode .landing-revision-head > div:first-child,
.landing-page-studio.is-preview-mode .landing-revision-note { display: none; }
.landing-page-studio.is-preview-mode .landing-version-nav { margin-inline-start: auto; }
.landing-page-studio.is-preview-mode .landing-revision-composer {
    display: grid;
    grid-template-columns: minmax(0,1fr) 40px;
    align-items: end;
    gap: 6px;
}
.landing-page-studio.is-preview-mode .landing-revision-composer textarea {
    min-height: 38px;
    max-height: 72px;
    padding: 8px 9px;
    resize: none;
}
.landing-page-studio.is-preview-mode #landing-revise-btn {
    width: 40px;
    min-width: 40px;
    height: 38px;
    padding: 0;
    display: grid;
    place-items: center;
}
.landing-page-studio.is-preview-mode #landing-revise-btn span { display: none; }

/* إخفاء الشات يجعل صفحة الهبوط تملأ كل المساحة المتبقية. */
.landing-page-studio.is-preview-mode.is-chat-collapsed {
    grid-template-columns: minmax(0,1fr);
}
.landing-page-studio.is-preview-mode.is-chat-collapsed .landing-chat-toolbar,
.landing-page-studio.is-preview-mode.is-chat-collapsed .landing-conversation,
.landing-page-studio.is-preview-mode.is-chat-collapsed .landing-input-dock {
    display: none !important;
}
.landing-page-studio.is-preview-mode.is-chat-collapsed .landing-output-panel {
    grid-column: 1;
    grid-row: 1 / 4;
}
.landing-page-studio:not(.is-preview-mode) .landing-chat-panel-label,
.landing-page-studio:not(.is-preview-mode) .landing-close-chat-btn {
    display: none !important;
}

@media (max-width: 980px) and (min-width: 721px) {
    .app-shell.landing-preview-layout[data-action="landing_page"] { grid-template-columns: 58px minmax(0,1fr); }
    .landing-page-studio.is-preview-mode { grid-template-columns: minmax(270px,32vw) minmax(0,1fr); }
}

@media (max-width: 720px) {
    /* الهاتف يبقى بعرض واحد حتى لا تصبح المعاينة ضيقة جدًا. */
    body.workspace-open .app-shell.website-preview-layout[data-action="website_builder"] .workspace-main,
    body.workspace-open .app-shell.landing-preview-layout[data-action="landing_page"] .workspace-main {
        height: calc(100dvh - 68px);
        padding: 0 !important;
    }
    .app-shell.landing-preview-layout[data-action="landing_page"] {
        display: block;
        height: 100dvh;
        padding: 0 0 68px;
    }
    .app-shell.landing-preview-layout[data-action="landing_page"] .tools-sidebar {
        top: auto;
        width: 100%;
        height: 68px;
        padding: 7px 8px;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }
    .landing-page-studio.is-preview-mode {
        display: grid !important;
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0,1fr);
        height: 100%;
    }
    .landing-page-studio.is-preview-mode .landing-chat-toolbar,
    .landing-page-studio.is-preview-mode .landing-conversation,
    .landing-page-studio.is-preview-mode .landing-input-dock { display: none; }
    .landing-page-studio.is-preview-mode .landing-output-panel {
        grid-column: 1;
        grid-row: 1;
    }
    .landing-page-studio.is-preview-mode .landing-revision-panel { padding: 5px 6px; }
}

/* =========================================================
   CONTEXT HISTORY RAIL — المحادثات والمشاريع السابقة
   يظهر فقط في شاشة البدء للأدوات التي تنشئ مشاريع.
   ========================================================= */
.context-history-panel { display: none; }

body.workspace-open .app-shell.has-context-history {
    grid-template-columns: 220px minmax(0,1fr) minmax(285px, 330px);
}
body.workspace-open .app-shell.has-context-history .context-history-panel {
    min-width: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(2,10,6,.96), rgba(1,7,4,.99));
    border-inline-start: 1px solid rgba(121,226,173,.13);
    box-shadow: 18px 0 48px rgba(0,0,0,.16) inset;
}
.context-history-head {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 15px 12px;
    border-bottom: 1px solid rgba(121,226,173,.1);
}
.context-history-head > div { min-width: 0; display: grid; gap: 4px; }
.context-history-head span {
    color: #6f9b83;
    font-size: .56rem;
    font-weight: 800;
    letter-spacing: 1.35px;
}
.context-history-head strong {
    overflow: hidden;
    color: #e8fff1;
    font-size: .9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#context-history-refresh-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #8cb8a0;
    background: rgba(121,226,173,.05);
    border: 1px solid rgba(121,226,173,.12);
    border-radius: 7px;
}
#context-history-refresh-btn:hover { color: #dffff0; background: rgba(121,226,173,.1); }

.context-history-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 9px 10px;
    border-bottom: 1px solid rgba(121,226,173,.08);
}
.context-history-tabs button {
    min-width: 0;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 8px;
    color: #769987;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: .66rem;
    font-weight: 700;
}
.context-history-tabs button:hover { color: #cff4df; background: rgba(121,226,173,.05); }
.context-history-tabs button.active {
    color: #dffff0;
    background: rgba(121,226,173,.09);
    border-color: rgba(121,226,173,.16);
}

.context-history-list {
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px 9px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
.context-history-card {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 34px minmax(0,1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 9px 8px;
    color: #cde5d8;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    text-align: right;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.context-history-card:hover {
    color: #fff;
    background: rgba(121,226,173,.055);
    border-color: rgba(121,226,173,.11);
    transform: translateX(1px);
}
.context-history-card-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #79e2ad;
    background: rgba(121,226,173,.075);
    border-radius: 6px;
}
.context-history-card-copy { min-width: 0; display: grid; gap: 3px; }
.context-history-card-copy strong {
    overflow: hidden;
    color: inherit;
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.context-history-card-copy small {
    overflow: hidden;
    color: #688a78;
    font-size: .56rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.context-history-card-meta {
    max-width: 76px;
    overflow: hidden;
    color: #5f806e;
    font-size: .51rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.context-history-card.is-conversation .context-history-card-icon { color: #ffc681; background: rgba(255,174,98,.07); }
.context-history-card.is-conversation:hover { border-color: rgba(255,174,98,.11); }
.context-history-empty {
    min-height: 210px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 7px;
    padding: 24px 18px;
    color: #627e6f;
    text-align: center;
}
.context-history-empty i { color: #79e2ad; font-size: 1.25rem; opacity: .75; }
.context-history-empty strong { color: #a8c9b7; font-size: .75rem; }
.context-history-empty span { max-width: 220px; font-size: .59rem; line-height: 1.7; }
.context-history-loading {
    min-height: 150px;
    display: grid;
    place-items: center;
    color: #789988;َ
    font-size: .64rem;
}

/* في المعاينة الكبيرة لا نعرض سجل البداية حتى لا نسرق أي مساحة من المنتج. */
.app-shell.website-preview-layout .context-history-panel,
.app-shell.landing-preview-layout .context-history-panel { display: none !important; }

@media (max-width: 1380px) and (min-width: 981px) {
    body.workspace-open .app-shell.has-context-history {
        grid-template-columns: 200px minmax(0,1fr) 280px;
    }
}
@media (max-width: 980px) {
    body.workspace-open .app-shell.has-context-history {
        grid-template-columns: 180px minmax(0,1fr);
    }
    body.workspace-open .app-shell.has-context-history .context-history-panel { display: none !important; }
}
@media (max-width: 720px) {
    body.workspace-open .app-shell.has-context-history { display: block; }
}


/* =========================================================
   CV BUILDER — يستخدم نفس هندسة صفحات الهبوط مع معاينة جانبية
   ========================================================= */
.app-shell[data-action="cv_builder"] #main-inputs-wrapper { width: min(900px, 100%); }
.app-shell.landing-preview-layout[data-action="cv_builder"] {
    box-sizing: border-box;
    grid-template-columns: 64px minmax(0,1fr);
    height: 100dvh;
    min-height: 0;
    padding-top: 0;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .tools-sidebar {
    width: auto;
    top: 0;
    height: 100dvh;
    padding: 12px 7px;
    align-items: center;
    gap: 6px;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .sidebar-title,
.app-shell.landing-preview-layout[data-action="cv_builder"] .tool-button > span:not(.tool-icon),
.app-shell.landing-preview-layout[data-action="cv_builder"] .sidebar-system-divider {
    display: none !important;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .tool-button {
    width: 48px;
    min-width: 48px;
    justify-content: center;
    gap: 0;
    padding: 7px;
    border-radius: 11px;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .tool-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .tool-button.active::after { right: -8px; }
.app-shell.landing-preview-layout[data-action="cv_builder"] .workspace-brand-slot,
.app-shell.landing-preview-layout[data-action="cv_builder"] .workspace-account-slot { width: 48px; }
.app-shell.landing-preview-layout[data-action="cv_builder"] .brand-navigation {
    width: 48px;
    display: block;
    padding: 0;
    border: 0;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .brand-button { display: none !important; }
.app-shell.landing-preview-layout[data-action="cv_builder"] .home-button {
    width: 48px;
    height: 48px;
    border-radius: 11px;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions {
    width: 48px;
    padding: 0;
    gap: 6px;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .token-action-group {
    width: 48px;
    display: block;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions > #profile-header-btn,
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions > #login-btn,
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions > #cart-header-btn,
.app-shell.landing-preview-layout[data-action="cv_builder"] .credit-pill {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    justify-content: center;
    gap: 0;
    padding: 7px;
    font-size: 0;
    border-radius: 11px;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions i:first-child,
.app-shell.landing-preview-layout[data-action="cv_builder"] .credit-pill .token-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-item-label,
.app-shell.landing-preview-layout[data-action="cv_builder"] #header-user-name,
.app-shell.landing-preview-layout[data-action="cv_builder"] .profile-chevron,
.app-shell.landing-preview-layout[data-action="cv_builder"] .token-value,
.app-shell.landing-preview-layout[data-action="cv_builder"] #cart-count,
.app-shell.landing-preview-layout[data-action="cv_builder"] .token-add-btn,
.app-shell.landing-preview-layout[data-action="cv_builder"] .sidebar-title,
.app-shell.landing-preview-layout[data-action="cv_builder"] .sidebar-system-divider {
    display: none !important;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .workspace-main {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    margin: 0;
    padding: 0 !important;
    overflow: hidden;
}
.app-shell.landing-preview-layout[data-action="cv_builder"] .workspace-header { display: none; }
.app-shell.landing-preview-layout[data-action="cv_builder"] #main-inputs-wrapper {
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}


.cv-builder-studio .cv-profile-image-preview .cv-photo-thumb {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    overflow: hidden;
    padding: 0;
    background: rgba(121,226,173,.08);
    border: 1px solid rgba(121,226,173,.16);
    border-radius: 50%;
}
.cv-builder-studio .cv-profile-image-preview .cv-photo-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.cv-builder-studio.is-preview-mode #cv-preview-frame {
    display: block;
    width: 100%;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0;
    border: 0;
    background: #fff;
}
.cv-builder-studio.is-preview-mode #cv-code-editor {
    height: calc(100% - 86px);
    min-height: 0;
    resize: none;
}
.cv-builder-studio.is-preview-mode #cv-revise-btn {
    width: 40px;
    min-width: 40px;
    height: 38px;
    padding: 0;
    display: grid;
    place-items: center;
}
.cv-builder-studio.is-preview-mode #cv-revise-btn span { display: none; }

@media (max-width: 980px) and (min-width: 721px) {
    .app-shell.landing-preview-layout[data-action="cv_builder"] { grid-template-columns: 58px minmax(0,1fr); }
}

@media (max-width: 720px) {
    body.workspace-open .app-shell.landing-preview-layout[data-action="cv_builder"] .workspace-main {
        height: calc(100dvh - 68px);
        padding: 0 !important;
    }
    .app-shell.landing-preview-layout[data-action="cv_builder"] {
        display: block;
        height: 100dvh;
        padding: 0 0 68px;
    }
    .app-shell.landing-preview-layout[data-action="cv_builder"] .tools-sidebar {
        top: auto;
        width: 100%;
        height: 68px;
        padding: 7px 8px;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }
}

/* CV mode: أخفِ المحادثة العامة لأن للأداة محادثتها المستقلة مثل صفحات الهبوط. */
.app-shell[data-action="cv_builder"] #chat-stream,
.app-shell[data-action="cv_builder"] .composer-wrap,
.app-shell[data-action="cv_builder"] #advanced-settings,
.app-shell[data-action="cv_builder"] #image-upload-section,
.app-shell[data-action="cv_builder"] #book-settings,
.app-shell[data-action="cv_builder"] #book-quick-start {
    display: none !important;
}
.app-shell[data-action="cv_builder"] .workspace-main,
.app-shell[data-action="cv_builder"] #main-inputs-wrapper {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.app-shell[data-action="cv_builder"] .cv-builder-studio {
    width: min(820px, 100%);
    height: 100%;
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
}
.app-shell[data-action="cv_builder"] .cv-builder-studio.hidden { display: none !important; }

/* =========================================================
   CV STABILITY PATCH — تثبيت خانة الإدخال + لوحة مساعد مستقلة
   ========================================================= */
.app-shell[data-action="cv_builder"] .cv-builder-studio .landing-input-dock {
    position: relative;
    isolation: isolate;
    z-index: 80;
}

/* الصف الأساسي يبقى ثابت الارتفاع: الاسم + الصورة + المساعد. */
.app-shell[data-action="cv_builder"] .cv-required-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: end;
    gap: 8px;
}

.app-shell[data-action="cv_builder"] .cv-photo-input-control {
    min-height: 39px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-shell[data-action="cv_builder"] .cv-photo-picker {
    min-height: 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 11px;
    color: #b6d6c5;
    background: rgba(121,226,173,.055);
    border: 1px solid rgba(121,226,173,.15);
    border-radius: 9px;
    font: inherit;
    font-size: .65rem;
    white-space: nowrap;
    cursor: pointer;
}
.app-shell[data-action="cv_builder"] .cv-photo-picker:hover,
.app-shell[data-action="cv_builder"] .cv-photo-picker.is-selected {
    color: #edfff4;
    background: rgba(121,226,173,.11);
    border-color: rgba(121,226,173,.35);
}
.app-shell[data-action="cv_builder"] .cv-photo-picker > i { color: #79e2ad; }

/* معاينة الصورة تبقى صغيرة داخل نفس الصف ولا تدفع خانة الكتابة لأسفل. */
.app-shell[data-action="cv_builder"] .cv-inline-photo-preview {
    height: 39px;
    max-width: 190px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-sizing: border-box;
    padding: 4px 5px;
    color: #dff8e9;
    background: rgba(121,226,173,.06);
    border: 1px solid rgba(121,226,173,.14);
    border-radius: 9px;
}
.app-shell[data-action="cv_builder"] .cv-inline-photo-preview.hidden { display: none !important; }
.app-shell[data-action="cv_builder"] .cv-inline-photo-preview .cv-photo-thumb {
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    overflow: hidden;
    padding: 0;
    background: rgba(121,226,173,.08);
    border: 0;
    border-radius: 7px;
}
.app-shell[data-action="cv_builder"] .cv-inline-photo-preview .cv-photo-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.app-shell[data-action="cv_builder"] .cv-inline-photo-preview small {
    max-width: 105px;
    overflow: hidden;
    color: #98baa8;
    font-size: .55rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-shell[data-action="cv_builder"] .cv-inline-photo-preview > button {
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #9db8aa;
    background: transparent;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
}
.app-shell[data-action="cv_builder"] .cv-inline-photo-preview > button:hover {
    color: #ff9aa3;
    background: rgba(255,100,110,.08);
}

/* المساعد يفتح فوق خانة الإدخال كلوحة مستقلة؛ الإطار ثابت والحقول وحدها قابلة للتمرير. */
.app-shell[data-action="cv_builder"] .cv-builder-studio:not(.is-preview-mode) #cv-assistant-panel {
    width: calc(100% - 8px);
    max-height: min(54vh, 470px);
    position: absolute;
    right: 4px;
    bottom: calc(100% + 8px);
    z-index: 95;
    box-sizing: border-box;
    margin: 0;
    padding: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    box-shadow: 0 24px 70px rgba(0,0,0,.48);
}

/* إعدادات النموذج تستخدم نفس المرساة ولا تغيّر ارتفاع الـ dock. */
.app-shell[data-action="cv_builder"] .cv-builder-studio:not(.is-preview-mode) #cv-model-popover {
    width: min(520px, calc(100% - 8px));
    max-height: min(68vh, 590px);
    right: 4px;
    bottom: calc(100% + 8px);
    z-index: 100;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* خانة النص الكبيرة لم تعد مسؤولة عن إرفاق الصورة. */
.app-shell[data-action="cv_builder"] .cv-chat-composer {
    grid-template-columns: minmax(0,1fr) 44px;
}
.app-shell[data-action="cv_builder"] .cv-chat-composer textarea {
    grid-column: 1;
}
.app-shell[data-action="cv_builder"] .cv-chat-composer #cv-generate-btn {
    grid-column: 2;
}

/* يمنع رسائل الحالة من تغيير ارتفاع منطقة الإدخال. */
.app-shell[data-action="cv_builder"] #cv-status {
    height: 22px;
    min-height: 22px;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* في المعاينة لا نحتاج حقول الإنشاء الأولية أو زر الصورة. */
.cv-builder-studio.is-preview-mode .cv-required-row,
.cv-builder-studio.is-preview-mode #cv-assistant-panel { display: none !important; }
.cv-builder-studio.is-preview-mode .cv-chat-composer {
    grid-template-columns: minmax(0,1fr) 38px;
}

/* =========================================================
   PREVIEW SIDEBAR ICONS — نفس مظهر معاينة المواقع في كل الأدوات
   ========================================================= */
.app-shell.website-preview-layout[data-action="website_builder"] .tool-icon,
.app-shell.landing-preview-layout[data-action="landing_page"] .tool-icon,
.app-shell.landing-preview-layout[data-action="cv_builder"] .tool-icon {
    display: grid !important;
    place-items: center;
    opacity: 1 !important;
    visibility: visible !important;
}
.app-shell.website-preview-layout[data-action="website_builder"] .tool-icon > i,
.app-shell.landing-preview-layout[data-action="landing_page"] .tool-icon > i,
.app-shell.landing-preview-layout[data-action="cv_builder"] .tool-icon > i,
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions > #profile-header-btn > i:first-child,
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions > #login-btn > i:first-child,
.app-shell.website-preview-layout[data-action="website_builder"] .account-actions > #cart-header-btn > i:first-child,
.app-shell.website-preview-layout[data-action="website_builder"] .credit-pill > .token-mark,
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #profile-header-btn > i:first-child,
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #login-btn > i:first-child,
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #cart-header-btn > i:first-child,
.app-shell.landing-preview-layout[data-action="landing_page"] .credit-pill > .token-mark,
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions > #profile-header-btn > i:first-child,
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions > #login-btn > i:first-child,
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions > #cart-header-btn > i:first-child,
.app-shell.landing-preview-layout[data-action="cv_builder"] .credit-pill > .token-mark {
    display: grid !important;
    place-items: center;
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px !important;
    font-size: 1rem !important;
    line-height: 1 !important;
    opacity: 1 !important;
    visibility: visible !important;
    color: var(--green-bright, #79e2ad) !important;
}

/* يمنع الأزرار المصغرة من فقدان شكلها عند إخفاء النص في وضع المعاينة. */
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #profile-header-btn:not(.hidden),
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #login-btn:not(.hidden),
.app-shell.landing-preview-layout[data-action="landing_page"] .account-actions > #cart-header-btn:not(.hidden),
.app-shell.landing-preview-layout[data-action="landing_page"] .credit-pill:not(.hidden),
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions > #profile-header-btn:not(.hidden),
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions > #login-btn:not(.hidden),
.app-shell.landing-preview-layout[data-action="cv_builder"] .account-actions > #cart-header-btn:not(.hidden),
.app-shell.landing-preview-layout[data-action="cv_builder"] .credit-pill:not(.hidden) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

@media (max-width: 760px) {
    .app-shell[data-action="cv_builder"] .cv-required-row {
        grid-template-columns: minmax(0,1fr) auto;
    }
    .app-shell[data-action="cv_builder"] .cv-photo-input-control {
        grid-column: 1 / -1;
        order: 3;
        min-width: 0;
    }
    .app-shell[data-action="cv_builder"] .cv-inline-photo-preview { max-width: min(210px, 52vw); }
    .app-shell[data-action="cv_builder"] .cv-builder-studio:not(.is-preview-mode) #cv-assistant-panel,
    .app-shell[data-action="cv_builder"] .cv-builder-studio:not(.is-preview-mode) #cv-model-popover {
        width: calc(100% - 8px);
        max-height: min(58dvh, 500px);
        right: 4px;
    }
}

/* =========================================================
   CV EDITOR UPGRADE — مساعد أطول + محرر صورة + تعديل البيانات
   ========================================================= */
.app-shell[data-action="cv_builder"] .cv-required-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

/* إطار المساعد ثابت، والمحتوى الداخلي وحده يتحرك. */
.app-shell[data-action="cv_builder"] .cv-builder-studio:not(.is-preview-mode) #cv-assistant-panel.cv-assistant-panel {
    height: min(72vh, 660px);
    max-height: min(72vh, 660px);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.app-shell[data-action="cv_builder"] #cv-assistant-panel.hidden { display: none !important; }
.app-shell[data-action="cv_builder"] .cv-assistant-heading {
    flex: 0 0 auto;
    min-height: 58px;
    margin: 0;
    padding: 11px 12px;
    border-bottom: 1px solid rgba(121,226,173,.12);
    background: rgba(5,18,11,.99);
}
.app-shell[data-action="cv_builder"] .cv-assistant-heading > div { min-width: 0; flex: 1 1 auto; }
.app-shell[data-action="cv_builder"] .cv-assistant-close-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    margin-inline-start: auto;
    padding: 0;
    color: #9eb8ab;
    background: rgba(255,255,255,.025);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 9px;
    cursor: pointer;
}
.app-shell[data-action="cv_builder"] .cv-assistant-close-btn:hover {
    color: #fff;
    background: rgba(255,100,110,.09);
    border-color: rgba(255,120,130,.2);
}
.app-shell[data-action="cv_builder"] .cv-assistant-scroll {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* محرر الصورة الشخصية: مربع واضح يحمل رمز البروفايل. */
.cv-photo-editor-host { width: 100%; min-width: 0; }
.cv-photo-editor-block {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(3,14,9,.72);
    border: 1px solid rgba(121,226,173,.13);
    border-radius: 13px;
}
.cv-photo-field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cv-photo-field-head > div { display: grid; gap: 2px; }
.cv-photo-field-head strong { color: #eafff2; font-size: .72rem; }
.cv-photo-field-head small { color: #7f9c8d; font-size: .58rem; }
.cv-photo-workspace { display: grid; grid-template-columns: 132px minmax(0,1fr); align-items: start; gap: 12px; }
.cv-photo-upload-square {
    width: 132px;
    height: 132px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    overflow: hidden;
    padding: 10px;
    color: #bad7c8;
    background: linear-gradient(145deg, rgba(121,226,173,.075), rgba(121,226,173,.025));
    border: 1px dashed rgba(121,226,173,.32);
    border-radius: 14px;
    cursor: pointer;
}
.cv-photo-upload-square:hover { border-color: rgba(121,226,173,.68); background: rgba(121,226,173,.09); }
.cv-photo-upload-square .cv-photo-upload-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    color: #79e2ad;
    font-size: 2rem;
}
.cv-photo-upload-square strong { font-size: .67rem; }
.cv-photo-upload-square small { color: #789687; font-size: .53rem; }
.cv-photo-upload-square > img {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    display: block;
    object-fit: contain;
    background: repeating-conic-gradient(rgba(255,255,255,.045) 0 25%, transparent 0 50%) 50% / 14px 14px;
}
.cv-photo-upload-square.has-image .cv-photo-upload-icon,
.cv-photo-upload-square.has-image > strong,
.cv-photo-upload-square.has-image > small { opacity: 0; }
.cv-photo-upload-square.has-image::after {
    content: "تعديل";
    position: absolute;
    right: 7px;
    bottom: 7px;
    z-index: 2;
    padding: 4px 7px;
    color: #062017;
    background: rgba(121,226,173,.94);
    border-radius: 7px;
    font-size: .52rem;
    font-weight: 800;
}
.cv-photo-editor-panel {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(190px, 260px) minmax(0,1fr);
    gap: 10px 12px;
    padding: 10px;
    background: rgba(1,9,5,.82);
    border: 1px solid rgba(121,226,173,.14);
    border-radius: 12px;
}
.cv-photo-editor-panel.hidden { display: none !important; }
.cv-photo-canvas-wrap { grid-row: 1 / span 4; display: grid; gap: 6px; align-content: start; }
.cv-photo-canvas-wrap canvas {
    width: min(100%, 260px);
    aspect-ratio: 1 / 1;
    display: block;
    touch-action: none;
    cursor: grab;
    background: repeating-conic-gradient(rgba(255,255,255,.05) 0 25%, rgba(255,255,255,.018) 0 50%) 50% / 18px 18px;
    border: 1px solid rgba(121,226,173,.16);
    border-radius: 11px;
}
.cv-photo-canvas-wrap canvas:active { cursor: grabbing; }
.cv-photo-canvas-wrap small { color: #789687; font-size: .54rem; line-height: 1.45; }
.cv-photo-shapes { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 5px; }
.cv-photo-shapes button,
.cv-photo-tools button {
    min-width: 0;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    color: #a9c8b8;
    background: rgba(121,226,173,.045);
    border: 1px solid rgba(121,226,173,.12);
    border-radius: 8px;
    font-size: .53rem;
    cursor: pointer;
}
.cv-photo-shapes button span { display: none; }
.cv-photo-shapes button.active,
.cv-photo-shapes button:hover,
.cv-photo-tools button:hover { color: #062017; background: #79e2ad; border-color: #79e2ad; }
.cv-photo-zoom { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 8px; }
.cv-photo-zoom > span { color: #a5c2b3; font-size: .57rem; }
.cv-photo-zoom input { width: 100%; accent-color: #79e2ad; }
.cv-photo-tools { display: grid; grid-template-columns: repeat(5, 38px) minmax(110px,1fr); gap: 6px; align-items: center; }
.cv-photo-tools .cv-photo-apply-btn { color: #062017; background: #79e2ad; border-color: #79e2ad; font-weight: 850; }
.cv-photo-tools .cv-photo-apply-btn span { display: inline; }
.cv-inline-photo-preview {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 34px;
    margin-top: 9px;
    padding: 6px 8px !important;
}
.cv-inline-photo-preview > span { color: #79e2ad; }
.cv-inline-photo-preview small { max-width: none !important; flex: 1 1 auto; }

/* وضع تعديل المعلومات داخل مساحة المعاينة نفسها. */
.cv-edit-info-view {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    box-sizing: border-box;
    padding: 18px;
    overflow-x: hidden;
    overflow-y: auto;
    color: #eafff2;
    background: rgba(2,8,5,.985);
}
.cv-edit-info-view.hidden { display: none !important; }
.cv-edit-info-head { display: grid; gap: 7px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid rgba(121,226,173,.11); }
.cv-edit-info-head > div { display: flex; align-items: center; gap: 8px; }
.cv-edit-info-head h4 { margin: 0; color: #effff5; font-size: .86rem; }
.cv-edit-info-head p { max-width: 760px; margin: 0; color: #789687; font-size: .61rem; line-height: 1.65; }
.cv-photo-edit-host { margin-bottom: 14px; }
.cv-edit-form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.cv-edit-form-grid .landing-field-wide { grid-column: 1 / -1; }
.cv-edit-info-view .landing-field { display: grid; gap: 5px; }
.cv-edit-info-view .landing-field > span { color: #a7c6b6; font-size: .59rem; }
.cv-edit-info-view input,
.cv-edit-info-view select,
.cv-edit-info-view textarea,
.cv-edit-note-field textarea {
    width: 100%;
    box-sizing: border-box;
    color: #eafff2;
    background: rgba(3,13,8,.94);
    border: 1px solid rgba(121,226,173,.15);
    border-radius: 9px;
    outline: 0;
}
.cv-edit-info-view input,
.cv-edit-info-view select { min-height: 40px; padding: 8px 9px; }
.cv-edit-info-view textarea,
.cv-edit-note-field textarea { min-height: 78px; padding: 9px; resize: vertical; }
.cv-edit-info-view input:focus,
.cv-edit-info-view select:focus,
.cv-edit-info-view textarea:focus,
.cv-edit-note-field textarea:focus { border-color: rgba(121,226,173,.48); box-shadow: 0 0 0 3px rgba(121,226,173,.06); }
.cv-edit-note-field { display: grid; gap: 6px; margin-top: 14px; }
.cv-edit-note-field > span { color: #b7d4c5; font-size: .63rem; }
.cv-edit-note-field > span small { margin-inline-start: 5px; color: #708c7e; font-weight: 400; }
.cv-edit-submit-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(121,226,173,.09); }
#cv-edit-submit-btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    color: #052016;
    background: #79e2ad;
    border: 0;
    border-radius: 9px;
    font-size: .66rem;
    font-weight: 850;
    cursor: pointer;
}
#cv-edit-submit-btn:disabled { opacity: .55; cursor: wait; }
.cv-edit-submit-row small { color: #789687; font-size: .56rem; line-height: 1.5; }

/* في وضع المعاينة، المحرر يحتل نفس مساحة الـ iframe أو محرر HTML. */
.cv-builder-studio.is-preview-mode .cv-edit-info-view {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
}
.cv-builder-studio.is-preview-mode .cv-edit-info-view.hidden { display: none !important; }
.cv-builder-studio.is-preview-mode .landing-output-panel[data-cv-active-view="edit"] .landing-device-switch { visibility: hidden; pointer-events: none; }

@media (max-width: 900px) {
    .cv-photo-workspace { grid-template-columns: 118px minmax(0,1fr); }
    .cv-photo-upload-square { width: 118px; height: 118px; }
    .cv-photo-editor-panel { grid-template-columns: minmax(170px, 220px) minmax(0,1fr); }
}
@media (max-width: 700px) {
    .app-shell[data-action="cv_builder"] .cv-builder-studio:not(.is-preview-mode) #cv-assistant-panel.cv-assistant-panel {
        height: min(76dvh, 690px);
        max-height: min(76dvh, 690px);
    }
    .cv-photo-workspace { grid-template-columns: 1fr; }
    .cv-photo-upload-square { width: 132px; height: 132px; }
    .cv-photo-editor-panel { grid-template-columns: 1fr; }
    .cv-photo-canvas-wrap { grid-row: auto; justify-items: center; }
    .cv-photo-shapes { grid-template-columns: repeat(5, 1fr); }
    .cv-photo-tools { grid-template-columns: repeat(5, 38px) 1fr; }
    .cv-edit-form-grid { grid-template-columns: 1fr; }
    .cv-edit-form-grid .landing-field-wide { grid-column: auto; }
    .cv-edit-submit-row { align-items: stretch; flex-direction: column; }
}


/* =========================================================
   CV INTERACTION FIX — مربع رفع واضح + أدوات تحرير ظاهرة بعد الرفع
   ========================================================= */
.app-shell[data-action="cv_builder"] #cv-photo-assistant-host .cv-photo-upload-square,
.app-shell[data-action="cv_builder"] #cv-photo-edit-host .cv-photo-upload-square {
    width: 136px;
    height: 136px;
    aspect-ratio: 1 / 1;
    flex: 0 0 136px;
    border-radius: 10px;
}
.app-shell[data-action="cv_builder"] .cv-photo-upload-square .cv-photo-upload-icon {
    width: 54px;
    height: 54px;
    font-size: 2.35rem;
}
.app-shell[data-action="cv_builder"] .cv-photo-editor-panel:not(.hidden) {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.app-shell[data-action="cv_builder"] .cv-photo-editor-panel:not(.hidden) .cv-photo-shapes,
.app-shell[data-action="cv_builder"] .cv-photo-editor-panel:not(.hidden) .cv-photo-tools,
.app-shell[data-action="cv_builder"] .cv-photo-editor-panel:not(.hidden) .cv-photo-zoom {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}
.app-shell[data-action="cv_builder"] .cv-photo-shapes button span {
    display: inline;
}
@media (max-width: 700px) {
    .app-shell[data-action="cv_builder"] #cv-photo-assistant-host .cv-photo-upload-square,
    .app-shell[data-action="cv_builder"] #cv-photo-edit-host .cv-photo-upload-square {
        width: 124px;
        height: 124px;
        flex-basis: 124px;
    }
}
