/**
 * استایل مینیمال و استاندارد کدیکا نسخه ۱.۰.۰ (Claude Code & ChatGPT Minimal Design System)
 * فونت سراسری و اجباری: یکان‌بخ (YekanBakh) روی تمامی عناوین، منوها، زیرعنوان‌ها، تب‌ها و فرم‌ها
 * توسعه‌دهنده: سلطان وب (WebSoltan - websoltan.com)
 */

@font-face {
    font-family: 'YekanBakh';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('../fonts/YekanBakh/YekanBakh-Light.woff') format('woff'),
         url('../fonts/YekanBakh/YekanBakh-Light.ttf') format('truetype');
}
@font-face {
    font-family: 'YekanBakh';
    font-style: normal;
    font-weight: normal;
    font-display: swap;
    src: url('../fonts/YekanBakh/YekanBakh-Regular.woff') format('woff'),
         url('../fonts/YekanBakh/YekanBakh-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'YekanBakh';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/YekanBakh/YekanBakh-Regular.woff') format('woff'),
         url('../fonts/YekanBakh/YekanBakh-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'YekanBakh';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/YekanBakh/YekanBakh-Medium.woff') format('woff'),
         url('../fonts/YekanBakh/YekanBakh-Medium.ttf') format('truetype');
}
@font-face {
    font-family: 'YekanBakh';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/YekanBakh/YekanBakh-Bold.woff') format('woff'),
         url('../fonts/YekanBakh/YekanBakh-Bold.ttf') format('truetype');
}
@font-face {
    font-family: 'YekanBakh';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/YekanBakh/YekanBakh-Bold.woff') format('woff'),
         url('../fonts/YekanBakh/YekanBakh-Bold.ttf') format('truetype');
}
@font-face {
    font-family: 'YekanBakh';
    font-style: normal;
    font-weight: bold;
    font-display: swap;
    src: url('../fonts/YekanBakh/YekanBakh-Bold.woff') format('woff'),
         url('../fonts/YekanBakh/YekanBakh-Bold.ttf') format('truetype');
}
@font-face {
    font-family: 'YekanBakh';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../fonts/YekanBakh/YekanBakh-Heavy.woff') format('woff'),
         url('../fonts/YekanBakh/YekanBakh-Heavy.ttf') format('truetype');
}

@font-face {
    font-family: 'IRANSansWeb';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/IRANSansWeb/IRANSansWeb.woff2') format('woff2'),
         url('../fonts/IRANSansWeb/IRANSansWeb.woff') format('woff');
}
@font-face {
    font-family: 'IRANSansWeb';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/IRANSansWeb/IRANSansWeb_Bold.woff2') format('woff2'),
         url('../fonts/IRANSansWeb/IRANSansWeb_Bold.woff') format('woff');
}

:root {
    --font-ui: 'YekanBakh', 'IRANSansWeb', Tahoma, sans-serif;
    --bg-app: #FAF9F5;
    --bg-surface: #FFFFFF;
    --bg-subtle: #F3F2ED;
    --bg-hover: #EAE8E1;
    --bg-sidebar: #F2F0E8;
    --border-color: #E5E4DD;
    --border-strong: #D1CFC7;
    --text-main: #141413;
    --text-secondary: #52514E;
    --text-muted: #787772;
    --accent-primary: #18181B;
    --accent-primary-hover: #27272A;
    --accent-primary-text: #FFFFFF;
    --accent-brand: #C96442;
    --accent-brand-soft: color-mix(in srgb, var(--accent-brand) 12%, transparent);
    --focus-ring: color-mix(in srgb, var(--accent-brand) 22%, transparent);
    --success-bg: #ECFDF5;
    --success-text: #065F46;
    --success-border: #A7F3D0;
    --danger-bg: #FEF2F2;
    --danger-text: #991B1B;
    --danger-border: #FECACA;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.05);
}

body.dark-chat-mode {
    --bg-app: #121214;
    --bg-surface: #1A1A1E;
    --bg-subtle: #222227;
    --bg-hover: #2B2B31;
    --bg-sidebar: #0E0E10;
    --border-color: #2B2B30;
    --border-strong: #3E3E46;
    --text-main: #F4F4F6;
    --text-secondary: #B4B4BC;
    --text-muted: #7E7E88;
    --accent-primary: #F4F4F6;
    --accent-primary-hover: #E4E4E7;
    --accent-primary-text: #121214;
    --accent-brand: #D97757;
    --accent-brand-soft: rgba(217, 119, 87, 0.16);
    --focus-ring: rgba(217, 119, 87, 0.28);
    --success-bg: rgba(16, 185, 129, 0.14);
    --success-text: #6EE7B7;
    --success-border: rgba(16, 185, 129, 0.3);
    --danger-bg: rgba(239, 68, 68, 0.14);
    --danger-text: #FCA5A5;
    --danger-border: rgba(239, 68, 68, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
    box-sizing: border-box;
    font-family: var(--font-ui) !important;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
}
body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: clip;
    direction: rtl;
    text-align: right;
    font-family: var(--font-ui) !important;
    background-color: var(--bg-app);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* اعمال قطعی فونت یکان‌بخ روی تمامی عناوین تنظیمات، منوها، زیرعنوان‌ها، فرم‌ها و دکمه‌ها */
h1, h2, h3, h4, h5, h6,
.panel-header h2, .panel-header h3, .panel-header p,
.questionnaire-box h3, .questionnaire-box h4, .provider-config-box h4,
.chat-sidebar, .chat-sidebar-nav a, .chat-sidebar-section-label, .chat-brand strong, .chat-brand small,
.chat-topbar, .chat-topbar-title, .chat-topbar-title span,
.workspace-header h2, .workspace-tabs a, .type-tab, .mode-switch-card, .mode-switch-card strong, .mode-switch-card span,
.stat-title, .stat-value, .stat-sub,
label, p, a, span, small, strong, b, em, summary, details, li, ul, ol,
input, select, option, textarea, button, .btn, .chip-btn, .badge-ok, .badge-type, .badge-err {
    font-family: 'YekanBakh', 'IRANSansWeb', Tahoma, sans-serif !important;
}

input::placeholder, textarea::placeholder {
    font-family: 'YekanBakh', 'IRANSansWeb', Tahoma, sans-serif !important;
    color: var(--text-muted);
    opacity: 0.85;
}

code, pre, .code-editor-textarea, .code-artifact-card pre, .code-artifact-card code {
    font-family: 'JetBrains Mono', Consolas, Monaco, 'Courier New', monospace !important;
}

svg.icon {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    flex-shrink: 0;
    vertical-align: middle;
}

/* =========================================================================
   چیدمان اصلی به سبک Claude Code
   ========================================================================= */
body.claude-chat-layout {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    position: relative;
}

.chat-sidebar {
    width: var(--sb-w, 264px);
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
    /* Exactly one screen tall and pinned while the page scrolls: header and user footer stay,
       the projects + menu body scrolls on its own so every item (درباره ما too) is reachable. */
    align-self: flex-start;
    height: 100vh;
    height: 100dvh;
    position: sticky;
    top: 0;
    z-index: 200;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-sidebar-top-group {
    flex: 1 1 auto;
    min-height: 0;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
}

.chat-sidebar-scroll-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 8px;
}

.chat-sidebar-header {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.chat-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
}

.chat-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    object-fit: contain;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    background: #FAF9F5;
}

.chat-brand strong {
    display: block;
    font-size: 15.5px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.chat-brand small {
    font-size: 11px;
    color: var(--text-muted);
}

.chat-new-btn-wrap {
    padding: 12px 12px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-new-project-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    background: var(--accent-primary);
    color: var(--accent-primary-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    transition: opacity 0.15s;
}

.chat-new-project-btn.secondary-mode {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-strong);
}

.chat-new-project-btn:hover {
    opacity: 0.9;
}

.chat-sidebar-section-label {
    padding: 12px 16px 4px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.chat-recent-threads {
    padding: 4px 10px;
}

.chat-thread-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12.5px;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
}

.chat-thread-item:hover, .chat-thread-item.active {
    background: var(--bg-hover);
    color: var(--text-main);
    font-weight: 600;
}

.thread-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 175px;
}

.thread-prog {
    font-size: 10.5px;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 1px 6px;
    border-radius: 99px;
    border: 1px solid var(--border-color);
}

.chat-empty-threads {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.chat-sidebar-nav {
    padding: 4px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.chat-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
}

.chat-sidebar-nav a:hover, .chat-sidebar-nav a.active {
    background: var(--bg-hover);
    color: var(--text-main);
    font-weight: 700;
}

.chat-sidebar-footer {
    flex-shrink: 0;
    background: var(--bg-sidebar);
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.sidebar-user-info {
    min-width: 0;
    flex: 1;
}

.sidebar-user-info strong {
    display: block;
    font-size: 12.5px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* بخش اصلی */
.chat-main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
    min-height: 100vh;
}

.chat-topbar {
    height: 54px;
    background: var(--bg-app);
    border-bottom: 1px solid var(--border-color);
    padding: 0 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.chat-topbar-right, .chat-topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.topbar-logo-img {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    object-fit: contain;
    flex-shrink: 0;
}

.chat-topbar-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-topbar-title span {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 13px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    padding: 0;
    flex-shrink: 0;
}

/* A single icon button wrapped in a POST form (delete, logout) sits inline like a link. */
.inline-form {
    display: inline-flex;
    margin: 0;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    border-color: var(--border-strong);
}

.icon-btn.primary {
    background: var(--accent-primary);
    color: var(--accent-primary-text);
    border-color: var(--accent-primary);
}

.icon-btn.danger:hover {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-border);
}

.hamburger-btn, .mobile-close-btn {
    display: none;
}

.chat-main-content {
    /* Full width: content runs from under the logo to under the theme toggle. */
    padding: 12px 14px;
    width: 100%;
    min-width: 0;
}

/* =========================================================================
   کارت‌های انتخاب حالت شروع کار (۱. ساخت از صفر | ۲. ویرایش و رفع خطای کدهای موجود)
   ========================================================================= */
.workflow-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.mode-switch-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.16s ease;
    cursor: pointer;
}

.mode-switch-card:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    border-color: var(--border-strong);
}

.mode-switch-card.active {
    background: var(--bg-surface);
    color: var(--text-main);
    border-color: var(--accent-brand);
    box-shadow: 0 0 0 2px var(--accent-brand-soft);
}

.mode-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-brand);
    flex-shrink: 0;
}

.mode-switch-card.active .mode-card-icon {
    background: var(--accent-brand);
    color: #ffffff;
    border-color: var(--accent-brand);
}

.mode-card-body strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.mode-card-body span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* =========================================================================
   کارت‌ها، فرم‌ها و فیلدهای ورودی
   ========================================================================= */
.panel-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    max-width: 100%;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2, .panel-header h3 {
    margin: 0;
    font-size: 16.5px;
    font-weight: 700;
    color: var(--text-main);
}

.questionnaire-box, .provider-config-box, .summary-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 14px;
    min-width: 0;
}

.questionnaire-box h3, .questionnaire-box h4, .provider-config-box h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.form-row {
    display: flex;
    gap: 14px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.form-row > .form-group {
    flex: 1 1 220px;
    min-width: 0;
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 14px;
    min-width: 0;
}

.form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.req {
    color: #DC2626;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="search"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea,
input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="date"],
input[type="time"],
input:not([type]),
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 9px 12px;
    font-size: 13.5px;
    color: var(--text-main);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input:not([type]):focus,
select:focus,
textarea:focus {
    border-color: var(--accent-brand);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

input[type="color"] {
    width: 42px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    cursor: pointer;
    flex-shrink: 0;
}

.file-upload-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    flex-wrap: wrap;
}

.file-upload-zone:hover {
    border-color: var(--accent-brand);
    background: var(--bg-hover);
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    margin: 0 !important;
}

.attachment-chips-area {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.att-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 100%;
}

.att-chip img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.att-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.att-chip button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 2px;
    font-size: 14px;
    line-height: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 15px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    transition: all 0.15s;
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg-hover);
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--accent-primary-text);
    border-color: var(--accent-primary);
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    opacity: 0.94;
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-success {
    background: #059669;
    color: #ffffff;
    border-color: #059669;
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-border);
}

.btn-sm {
    padding: 6px 11px;
    font-size: 12px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.type-selector-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 18px;
    background: var(--bg-subtle);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.type-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: all 0.15s;
}

.type-tab:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.type-tab.active {
    background: var(--bg-surface);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.stat-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
}

.stat-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.resume-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.resume-project-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
}

.progress-bar-wrap {
    height: 5px;
    background: var(--border-color);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-brand);
}

.badge-ok, .badge-type, .badge-err {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-ok {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.badge-type {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.badge-err {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.alert {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 600;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

/* =========================================================================
   محیط میزکار، چت و پیش‌نمایش کاملاً ریسپانسیو (Sandbox & Live Preview)
   ========================================================================= */
.workspace-header {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.workspace-header h2 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 700;
}

.workspace-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ide-chat-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

/* پیش‌نمایش و شبیه‌ساز کاملاً ریسپانسیو */
.sim-preview-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--bg-surface);
    max-width: 100%;
}

.sim-preview-toolbar {
    background: var(--bg-subtle);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
}

.sim-preview-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.sim-iframe-wrap {
    background: var(--bg-app);
    padding: 12px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    text-align: center;
}

.sim-iframe-el {
    width: 100%;
    max-width: 100%;
    height: 500px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #ffffff;
    display: block;
    margin: 0 auto;
    transition: max-width 0.22s ease;
}

.panel-subbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 700;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-messages-box {
    max-height: 460px;
    min-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 2px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    line-height: 1.7;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.user-bubble {
    background: var(--bg-subtle);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    width: 100%;
}

.ai-bubble {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    width: 100%;
}

.bubble-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.code-artifact-card {
    margin: 8px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    overflow: hidden;
    max-width: 100%;
}

.code-artifact-card summary {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    direction: ltr;
    text-align: left;
}

.code-artifact-card pre {
    margin: 0;
    padding: 12px;
    background: #0D0D0F;
    color: #E4E4E7;
    font-size: 12px;
    line-height: 1.55;
    overflow-x: auto;
    max-width: 100%;
    direction: ltr;
    text-align: left;
}

.quick-prompts-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 0;
    margin: 6px 0;
}

.chip-btn {
    padding: 5px 11px;
    border-radius: 99px;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.chip-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    border-color: var(--border-strong);
}

.claude-composer-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.claude-composer-box:focus-within {
    border-color: var(--accent-brand);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.claude-composer-box textarea {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 4px 6px !important;
    resize: vertical;
    min-height: 68px;
}

.composer-ActionBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.composer-tools-right, .composer-tools-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.composer-select {
    width: auto !important;
    padding: 4px 8px !important;
    font-size: 11.5px !important;
    border-radius: 6px !important;
    height: 30px;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    flex-wrap: wrap;
    font-size: 12px;
}

.code-editor-textarea {
    width: 100%;
    min-height: 380px;
    background: #0E0E10 !important;
    color: #E4E4E7 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
    padding: 14px !important;
    font-size: 12.5px !important;
    line-height: 1.6 !important;
    direction: ltr;
    text-align: left;
}

.version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    flex-wrap: wrap;
}

.version-item:last-child {
    border-bottom: none;
}

.table-scroll-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th, .data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.data-table th {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 12px;
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.mobile-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 990;
}

/* =========================================================================
   ریسپانسیو کامل موبایل و تبلت (شامل پیش‌نمایش، فرم‌ها و سایدبار)
   ========================================================================= */
@media (max-width: 1024px) {
    /* The closed off-canvas menu waits past the right edge; clip it so the page never scrolls sideways. */
    html, body.claude-chat-layout { overflow-x: clip; }
    .chat-main-wrapper {
        margin-right: 0 !important;
        width: 100% !important;
    }
    .chat-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 272px;
        height: 100dvh;
        z-index: 1000;
        transform: translateX(102%);
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.25);
    }

    .chat-sidebar.open {
        transform: translateX(0);
    }

    .mobile-sidebar-backdrop.show {
        display: block;
    }

    .hamburger-btn, .mobile-close-btn {
        display: inline-flex;
    }

    .hide-on-mobile {
        display: none !important;
    }

    .stats-grid, .workflow-mode-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .resume-cards-grid {
        grid-template-columns: 1fr;
    }

    .type-selector-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .chat-main-content {
        padding: 12px;
    }

    .panel-card {
        padding: 14px;
    }

    .questionnaire-box, .provider-config-box {
        padding: 12px;
    }

    .stats-grid, .type-selector-bar, .workflow-mode-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        flex-wrap: nowrap; /* a wrapping column inside a flex column splits the fields side by side */
        gap: 10px;
    }

    .form-row > .form-group {
        flex: 1 1 100%;
    }

    .chat-topbar {
        padding: 0 12px;
        height: 50px;
    }

    .workspace-header {
        padding: 10px 12px;
    }

    .sim-iframe-wrap {
        padding: 6px;
    }

    .sim-iframe-el {
        height: 400px;
    }
}


/* =========================================================================
   ارتقای کامپوزر چت (رفع کامل بهم‌ریختگی بخش ارسال پیام) و تایم‌لاین Claude Code
   ========================================================================= */
.composer-context-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.composer-target-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 220px;
    min-width: 0;
}

.composer-target-wrap label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--accent-brand);
    white-space: nowrap;
    margin: 0;
}

.composer-target-select {
    flex: 1;
    min-width: 0;
    padding: 4px 8px !important;
    font-size: 12px !important;
    height: 30px;
    border-radius: 6px !important;
    background: var(--bg-subtle) !important;
}

.composer-memory-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--success-text);
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

.btn-send-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    background: var(--accent-primary);
    color: var(--accent-primary-text);
    border: 1px solid var(--accent-primary);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-send-chat:hover {
    opacity: 0.92;
}

/* گرید دو ستونه لایسنس‌گذاری راست‌چین و لیست فایل‌های قابل اینکد */
.rtl-license-split-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 16px;
    align-items: stretch;
    margin-top: 12px;
}

.rtl-license-col {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    min-width: 0;
}

.licensable-files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
    max-height: 230px;
    overflow-y: auto;
}

.licensable-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    flex-wrap: wrap;
}

/* تایم‌لاین تفکیک‌شده خروجی‌های پروژه به سبک Claude Code */
.claude-timeline-wrap {
    position: relative;
    padding-right: 26px;
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.claude-timeline-wrap::before {
    content: '';
    position: absolute;
    top: 12px;
    bottom: 12px;
    right: 9px;
    width: 2px;
    background: var(--border-strong);
}

.timeline-node-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.timeline-node-card:hover {
    border-color: var(--accent-brand);
    box-shadow: var(--shadow-sm);
}

.timeline-node-dot {
    position: absolute;
    right: -24px;
    top: 20px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-brand);
    border: 3px solid var(--bg-surface);
    box-shadow: 0 0 0 1px var(--accent-brand);
}

.timeline-node-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.timeline-node-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.timeline-node-title h5 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--text-main);
}

.timeline-node-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.7;
}

.timeline-node-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}

.timeline-visual-preview {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin: 10px 0;
    padding: 10px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.timeline-visual-preview img {
    max-height: 92px;
    width: auto;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    object-fit: contain;
}

@media (max-width: 900px) {
    .rtl-license-split-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================================
   استایل کامل ویزارد نصب گام‌به‌گام (install.php) و صفحات ورود
   ========================================================================= */
body.light-chat-mode {
    background-color: var(--bg-app);
    color: var(--text-main);
}

body.installer-body {
    margin: 0;
    padding: 32px 16px 48px;
    min-height: 100vh;
    background: var(--bg-app);
    color: var(--text-main);
    direction: rtl;
    text-align: right;
    line-height: 1.7;
}

.installer-wrapper {
    max-width: 880px;
    margin: 0 auto;
    width: 100%;
}

.installer-header {
    text-align: center;
    margin-bottom: 22px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    box-shadow: var(--shadow-sm);
}

.brand-badge {
    display: inline-block;
    background: var(--accent-brand);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 999px;
    margin-bottom: 10px;
    direction: ltr;
}

.installer-header h1 {
    margin: 0 0 8px;
    font-size: 21px;
    font-weight: 800;
    color: var(--text-main);
}

.installer-header p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.stepper {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 20px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 10px;
}

.step-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    text-align: center;
}

.step-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    font-weight: 700;
    flex-shrink: 0;
}

.step-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-item.active {
    background: var(--bg-surface);
    color: var(--text-main);
    font-weight: 700;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.step-item.active .step-circle {
    background: var(--accent-primary);
    color: var(--accent-primary-text);
}

.step-item.done {
    color: var(--success-text);
}

.step-item.done .step-circle {
    background: #059669;
    color: #FFFFFF;
}

.installer-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
}

.installer-card h2 {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 18px 0;
}

.feature-item {
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.feature-item strong {
    display: block;
    font-size: 13.5px;
    color: var(--text-main);
    margin-bottom: 4px;
}

.feature-item p {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.65;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-top: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.check-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0 18px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.check-table th, .check-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.check-table th {
    background: var(--bg-subtle);
    font-weight: 700;
    color: var(--text-main);
}

.alert-info {
    background: var(--bg-subtle);
    color: var(--text-main);
    border: 1px solid var(--border-strong);
    border-right: 4px solid var(--accent-brand);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
}

.installer-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.bubble-text {
    line-height: 1.9;
    word-break: break-word;
}
/* Formatted replies (App\Support\ChatMarkdown / assets/js/chat-markdown.js): calm spacing like a document. */
.bubble-text > * { margin: 0 0 10px; }
.bubble-text > :last-child { margin-bottom: 0; }
.bubble-text h3, .bubble-text h4, .bubble-text h5, .bubble-text h6 { margin: 14px 0 6px; font-size: 14px; font-weight: 800; line-height: 1.7; }
.bubble-text h3 { font-size: 15px; }
.bubble-text > :first-child { margin-top: 0; }
.bubble-text ul, .bubble-text ol { padding-inline-start: 22px; }
.bubble-text li { margin: 0 0 4px; }
.bubble-text li::marker { color: var(--text-muted); }
.bubble-text strong { font-weight: 800; }
.bubble-text code { padding: 1px 6px; border-radius: 6px; background: var(--bg-subtle); border: 1px solid var(--border-color); font-size: 12px; }
.bubble-text pre code { padding: 0; border: 0; background: none; }
.bubble-text blockquote { margin-inline: 0; padding: 6px 12px; border-inline-start: 3px solid var(--accent-brand); background: var(--bg-subtle); border-radius: var(--radius-sm); color: var(--text-secondary); }
.bubble-text hr { border: 0; border-top: 1px solid var(--border-color); }
.bubble-text a { color: var(--accent-brand); }
.bubble-text .md-table { overflow-x: auto; }
.bubble-text table { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.bubble-text th, .bubble-text td { padding: 6px 10px; border: 1px solid var(--border-color); text-align: start; }
.bubble-text th { background: var(--bg-subtle); font-weight: 700; }
.chat-img-attachment img { display: block; max-width: 220px; max-height: 160px; border-radius: 8px; border: 1px solid var(--border-color); }
/* Files a turn changed, under its reply. */
.turn-files { margin-top: 10px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-subtle); font-size: 12.5px; }
.turn-files > summary { cursor: pointer; padding: 7px 10px; display: flex; align-items: center; gap: 8px; }
.turn-file { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--border-color); color: inherit; text-decoration: none; }
.turn-file:hover { background: var(--bg-hover); }
.turn-file code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; padding: 0; }

.chat-img-attachment {
    margin: 8px 0;
}

@media (max-width: 768px) {
    .stepper {
        grid-template-columns: repeat(2, 1fr);
    }
    .feature-grid {
        grid-template-columns: 1fr;
    }
    .installer-card {
        padding: 18px;
    }
}

/* ---------------------------------------------------------------------------
   Sign-in, registration, password reset and invitation screens (views/auth.php)
   --------------------------------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    margin: 0;
}
.auth-brand {
    text-align: center;
    margin-bottom: 18px;
}
.auth-brand img {
    display: block;
    margin: 0 auto 10px;
    border-radius: 14px;
}
.auth-brand h1 {
    margin: 0 0 4px;
    font-size: 19px;
}
.auth-brand p,
.auth-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.9;
}
.auth-hint {
    margin-bottom: 12px;
}
.auth-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    margin-bottom: 16px;
    background: var(--bg-subtle);
    border-radius: 12px;
}
.auth-tabs a {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    border-radius: 9px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}
.auth-tabs a.active {
    background: var(--bg-surface);
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.auth-submit {
    width: 100%;
    margin-top: 6px;
}
.auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    font-size: 13px;
}
.auth-links a:not(.btn) {
    color: var(--accent-brand);
    text-decoration: none;
}

/* ---------------------------------------------------------------------------
   Accounts: settings (mode, SMS), team, users, roles, profile
   --------------------------------------------------------------------------- */
.field-hint {
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.9;
}
/* Help bubble: hover on desktop, tap/focus on touch screens. */
.tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 11px;
    cursor: help;
    vertical-align: middle;
}
/* The bubble itself is placed by assets/js/tooltips.js, always inside the window. */
.tip-bubble {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 3000;
    width: max-content;
    padding: 8px 10px;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity .12s;
    box-shadow: var(--shadow-md);
    overflow-wrap: anywhere;
    border-radius: 10px;
    background: var(--text-main);
    color: var(--bg-surface);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.8;
    white-space: normal;
    text-align: start;
    direction: rtl;
}
.tip-bubble.is-open { visibility: visible; opacity: 1; }
.table-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
}
.inline-test,
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.inline-test input,
.inline-test select,
.filter-bar input,
.filter-bar select {
    flex: 1 1 140px;
    min-width: 0;
}
.filter-bar {
    margin: 0 0 12px;
}
.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
/* Radio at the start of the line, title beside it, description under the title. */
.mode-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 4px;
    align-items: start;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
}
.mode-card > input[type="radio"],
.mode-card > input[type="checkbox"] {
    grid-row: 1 / span 4;
    width: 18px;
    height: 18px;
    min-height: 0;
    margin: 3px 0 0;
    padding: 0;
    accent-color: var(--accent-brand);
}
.mode-card > :not(input) { grid-column: 2; }
.mode-card > span[dir="ltr"] { text-align: end; overflow-wrap: anywhere; }
.mode-card.selected,
.mode-card:has(input:checked) {
    border-color: var(--accent-brand);
    background: var(--accent-brand-soft);
}
.mode-card span {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.8;
}
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}
.module-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 400;
}
.module-item small {
    flex-basis: 100%;
    color: var(--text-muted);
    font-size: 11.5px;
}
.ws-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ws-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.ws-list li.active {
    border-color: var(--accent-brand);
}
.ws-list a {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}
.ws-list small {
    color: var(--text-muted);
    font-size: 12px;
}
.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}
.pager a {
    min-width: 32px;
    padding: 5px 8px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}
.pager a.active {
    background: var(--accent-brand);
    border-color: var(--accent-brand);
    color: #fff;
}
.roles-table td:not(:first-child),
.roles-table th:not(:first-child) {
    text-align: center;
}
.copy-text {
    word-break: break-all;
    user-select: all;
}
.ws-switcher {
    display: flex;
    gap: 6px;
    align-items: center;
}
.ws-switcher select {
    max-width: 180px;
}

/* ---------------------------------------------------------------------------
   AI core: live chat activity, settings tabs, rule lessons, project brief
   --------------------------------------------------------------------------- */
.agent-activity { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.agent-activity:empty { display: none; }
.agent-step {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 5px 10px; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
    background: var(--bg-subtle); color: var(--text-secondary); font-size: 12.5px; min-width: 0;
}
.agent-step a { color: inherit; overflow-wrap: anywhere; }
.agent-step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex: none; }
.agent-step.is-running .dot { background: var(--accent-brand); animation: agentPulse 1s ease-in-out infinite; }
.agent-step.is-ok .dot { background: var(--success-text); }
.agent-step.is-fail { border-color: var(--danger-border); }
.agent-step.is-fail .dot { background: var(--danger-text); }
.agent-step.is-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.agent-step.is-limit { background: var(--accent-brand-soft); border-color: var(--accent-brand); color: var(--text-main); }
.agent-step.is-file .diff-add { color: var(--success-text); direction: ltr; }
.agent-step.is-file .diff-del { color: var(--danger-text); direction: ltr; }
.agent-meta { margin-top: 6px; font-size: 11.5px; color: var(--text-muted); }
.agent-meta:empty { display: none; }
.agent-code { background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 8px 10px; overflow-x: auto; font-size: 12px; text-align: left; }
@keyframes agentPulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .agent-step.is-running .dot { animation: none; } }

.settings-tabs {
    display: flex; gap: 6px; overflow-x: auto; flex-wrap: nowrap; margin-bottom: 14px;
    padding-bottom: 2px; scrollbar-width: thin;
}
.settings-tabs a {
    flex: none; padding: 7px 14px; border: 1px solid var(--border-color); border-radius: 999px;
    color: var(--text-secondary); background: var(--bg-surface); text-decoration: none; font-size: 13px; white-space: nowrap;
}
.settings-tabs a.active { background: var(--accent-primary); color: var(--accent-primary-text); border-color: var(--accent-primary); }

.lesson-card { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 12px; margin-bottom: 10px; background: var(--bg-subtle); }
.sticky-save { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; padding: 10px 0 2px; margin-top: 12px; background: transparent; pointer-events: none; }
.sticky-save .btn { pointer-events: auto; box-shadow: 0 8px 22px -10px rgba(0, 0, 0, .35); }
.brief-summary { font-size: 13px; line-height: 2; color: var(--text-secondary); max-height: 70vh; overflow-y: auto; }

/* ---------------------------------------------------------------------------
   Workspace internals: file tree, editor, diff, preview browser, console, Ctrl+K search
   --------------------------------------------------------------------------- */

.live-code-bar, .live-preview-bar { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; padding: 8px; border-bottom: 1px solid var(--border-color); min-width: 0; }
.live-tree-filter { flex: 1; min-width: 0; height: 32px; font-size: 12.5px; }
.live-new-file { display: flex; gap: 4px; align-items: center; min-width: 0; }
.live-new-file input { width: 140px; height: 32px; font-size: 12px; }
.live-code-body { display: grid; grid-template-columns: minmax(150px, 30%) minmax(0, 1fr); flex: 1; min-height: 0; }
.live-tree { overflow: auto; border-inline-end: 1px solid var(--border-color); padding: 6px; font-size: 12px; background: var(--bg-subtle); }
.live-tree-folder { color: var(--text-muted); font-size: 11px; margin: 8px 4px 2px; text-align: left; overflow-wrap: anywhere; }
.live-tree-file {
    display: block; padding: 4px 8px; border-radius: var(--radius-sm); color: var(--text-secondary);
    text-decoration: none; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.live-tree-file:hover { background: var(--bg-hover); }
.live-tree-file.active { background: var(--accent-primary); color: var(--accent-primary-text); }
.live-tree-file.is-new { box-shadow: inset -3px 0 0 var(--success-text); }
.live-editor { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: auto; }
.live-editor-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.live-editor-toolbar { border-radius: 0; border-inline: 0; flex-wrap: wrap; }
/* One line with an ellipsis; when space runs out the other toolbar items wrap, never the file name. */
.live-file-label { font-size: 12px; flex: 1 1 160px; min-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.live-commit { width: 170px; max-width: 40%; height: 30px; font-size: 12px; }
.live-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-hover); color: var(--text-secondary); }
.live-badge.is-error { background: var(--danger-bg); color: var(--danger-text); }
.live-badge.is-dirty { background: var(--accent-brand-soft); color: var(--accent-brand); }
.live-editor-frame { display: grid; grid-template-columns: auto minmax(0, 1fr); flex: 1; min-height: 260px; background: #0E0E10; direction: ltr; }
.live-gutter {
    margin: 0; padding: 14px 8px; overflow: hidden; color: #6B6B72; background: #141417; text-align: right;
    font-size: 12.5px; line-height: 1.6; user-select: none; border: 0; border-radius: 0;
}
.live-textarea { min-height: 0 !important; height: 100%; resize: none; border: 0 !important; border-radius: 0 !important; white-space: pre; overflow: auto; tab-size: 4; }
.live-textarea[readonly] { opacity: .85; }
.live-versions { padding: 8px 10px; border-top: 1px solid var(--border-color); font-size: 12px; }
.live-versions summary { cursor: pointer; color: var(--text-secondary); }
.live-version-actions { display: inline-flex; gap: 4px; }
.live-diff { border-top: 1px solid var(--border-color); max-height: 45%; display: flex; flex-direction: column; min-height: 0; }
.live-diff-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12px; background: var(--bg-subtle); }
.live-diff-head [data-close] { margin-inline-start: auto; }
.live-diff-body { overflow: auto; font-size: 12px; background: #0E0E10; color: #E4E4E7; }
.diff-row { display: grid; grid-template-columns: 40px 40px 16px minmax(0, 1fr); white-space: pre; padding: 0 6px; }
.diff-row code { background: none; color: inherit; overflow: hidden; text-overflow: ellipsis; }
.diff-no { color: #6B6B72; text-align: right; padding-right: 6px; }
.diff-add { background: rgba(34, 197, 94, .14); }
.diff-del { background: rgba(239, 68, 68, .16); }
.diff-fold { display: block; color: #8A8A92; background: #18181B; text-align: center; padding: 2px; }
.diff-add-count { color: var(--success-text); direction: ltr; }
.diff-del-count { color: var(--danger-text); direction: ltr; }

.live-address { flex: 1; min-width: 0; height: 32px; font-size: 12px; }
.live-viewports { display: inline-flex; border: 1px solid var(--border-color); border-radius: 999px; overflow: hidden; flex: none; }
.live-viewports button { border: 0; background: none; padding: 4px 9px; font-size: 11.5px; color: var(--text-secondary); cursor: pointer; }
.live-viewports button.active { background: var(--accent-primary); color: var(--accent-primary-text); }
.live-autoreload { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; flex: none; }
.live-preview-stage { position: relative; flex: 1; min-height: 0; overflow: auto; background: var(--bg-subtle); display: flex; justify-content: center; }
.live-preview-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; transition: width .2s; }
.live-preview-stage iframe[hidden] { display: none; }
.live-preview-empty { margin: auto; padding: 24px; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--text-muted); font-size: 13px; line-height: 1.9; }
.live-preview-empty[hidden] { display: none; }
.live-preview-empty .icon { width: 36px; height: 36px; color: var(--text-muted); }
.live-preview-empty b { color: var(--text-main); font-size: 14px; }
.live-preview-empty p { margin: 0; }
.live-preview-empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
/* «Applying changes» veil while an AI turn runs. */
.live-preview-busy { position: absolute; inset-block-start: 10px; inset-inline-start: 50%; transform: translateX(50%); display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--accent-primary); color: var(--accent-primary-text); font-size: 12px; box-shadow: var(--shadow-md); z-index: 2; }
.live-preview-busy[hidden] { display: none; }
.live-preview-busy .spin, .sim-status[data-state="busy"] i { width: 12px; height: 12px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: out-spin .8s linear infinite; }
/* Simulator connection pill + play/stop in the preview bar. */
.sim-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--bg-subtle); border: 1px solid var(--border-color); font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.sim-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex: none; }
.sim-status[data-state="connected"] i { background: var(--success-text); box-shadow: 0 0 0 3px var(--success-bg); }
.sim-status[data-state="idle"] i { background: #d4a72c; }
.sim-status[data-state="none"] i { background: var(--danger-text); }
.live-preview-bar [hidden], .live-preview-empty-actions [hidden] { display: none !important; }
.sim-play { color: var(--success-text); }
.sim-stop { color: var(--danger-text); }
@media (prefers-reduced-motion: reduce) { .live-preview-busy .spin, .sim-status[data-state="busy"] i { animation: none; } }
.live-console { border-top: 1px solid var(--border-color); font-size: 12px; max-height: 40%; display: flex; flex-direction: column; }
.live-console summary { padding: 6px 10px; cursor: pointer; color: var(--text-secondary); }
.live-console-actions { display: flex; gap: 6px; padding: 0 10px 6px; flex-wrap: wrap; }
.live-console-list { margin: 0; padding: 0 10px 8px; list-style: none; overflow: auto; font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; text-align: left; }
.live-console-list li { padding: 2px 0; border-bottom: 1px dashed var(--border-color); overflow-wrap: anywhere; }
.live-console-list .console-error { color: var(--danger-text); }
.live-console-list .console-warn { color: var(--accent-brand); }
.live-console-list .console-info { color: var(--text-muted); }
.agent-step .step-time { margin-inline-start: auto; color: var(--text-muted); font-size: 11px; }

.live-toast {
    position: fixed; inset-block-end: 20px; left: 50%; transform: translate(-50%, 20px); z-index: 1000;
    max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: var(--radius-md);
    background: var(--accent-primary); color: var(--accent-primary-text); font-size: 13px; box-shadow: var(--shadow-md);
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.live-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.live-toast.is-error { background: var(--danger-text); }

@media (max-width: 1023px) {
    .live-code-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
    .live-tree { max-height: 130px; border-inline-end: 0; border-bottom: 1px solid var(--border-color); }
    .live-preview-bar { flex-wrap: wrap; }
    .live-new-file input { width: 110px; }
}
@media (prefers-reduced-motion: reduce) { .live-preview-stage iframe, .live-toast { transition: none; } }

.gsearch {
    width: min(720px, calc(100vw - 32px)); max-height: min(78vh, 720px); padding: 0; border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); background: var(--bg-surface); color: var(--text-main); box-shadow: var(--shadow-md);
    margin-block-start: 10vh;
}
.gsearch::backdrop { background: rgba(0, 0, 0, .4); }
.gsearch-bar { display: flex; gap: 8px; align-items: center; padding: 10px; border-bottom: 1px solid var(--border-color); }
.gsearch-input { flex: 1; min-width: 0; height: 38px; font-size: 14px; }
.gsearch-scope { width: auto; height: 38px; font-size: 12.5px; }
.gsearch-here { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; }
.gsearch-results { overflow-y: auto; max-height: calc(min(78vh, 720px) - 62px); padding: 6px 10px 12px; }
.gsearch-hint { color: var(--text-muted); font-size: 12px; margin: 6px 2px; }
.gsearch-group h4 { margin: 12px 2px 4px; font-size: 13px; }
.gsearch-hit {
    display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 10px; align-items: baseline;
    padding: 6px 8px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text-secondary); font-size: 12.5px;
}
.gsearch-hit:hover, .gsearch-hit:focus { background: var(--bg-hover); outline: none; }
.gsearch-hit code { font-size: 11.5px; overflow-wrap: anywhere; }
.gsearch-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsearch-tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--bg-hover); white-space: nowrap; }
@media (max-width: 600px) {
    .gsearch-bar { flex-wrap: wrap; }
    .gsearch-hit { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------------------------------------------------------------------------
   Simulator: environment wizard (settings) and project tab (workspace)
   --------------------------------------------------------------------------- */
.sim-wizard h4 { margin: 16px 0 8px; font-size: 13.5px; }
.sim-wizard .mode-cards { margin-bottom: 8px; }
.sim-env-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; margin-bottom: 12px; }
.sim-env-summary > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-subtle); min-width: 0; }
.sim-env-summary span { font-size: 11.5px; color: var(--text-muted); }
.sim-env-summary code { overflow-wrap: anywhere; font-size: 12px; }
.sim-rebuild { margin-top: 14px; }
.sim-rebuild > summary { cursor: pointer; color: var(--text-secondary); font-size: 13px; }
.sim-guide { margin: 6px 0 10px; padding: 8px 12px; border: 1px dashed var(--border-color); border-radius: var(--radius-sm); font-size: 12.5px; }
.sim-guide summary { cursor: pointer; }
.sim-guide ol { margin: 8px 0; padding-inline-start: 20px; line-height: 2; }
.sim-report { margin-top: 14px; padding: 12px; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-subtle); }
.sim-report.is-ok { border-color: var(--success-border); }
.sim-report.is-error { border-color: var(--danger-border); background: var(--danger-bg); }
.sim-report h4 { margin: 0 0 8px; font-size: 13px; }
.sim-line { font-size: 12.5px; padding: 2px 0; overflow-wrap: anywhere; }
.sim-line.is-error { color: var(--danger-text); font-weight: 600; }
.sim-log { max-height: 220px; overflow: auto; font-size: 11.5px; background: #0E0E10; color: #E4E4E7; padding: 8px; border-radius: var(--radius-sm); text-align: left; white-space: pre-wrap; }

/* ---------------------------------------------------------------------------
   Shell: collapsible + resizable sidebar (Claude Code style)
   --------------------------------------------------------------------------- */
.sidebar-resizer {
    position: absolute; inset-block: 0; inset-inline-end: -3px; width: 6px; cursor: col-resize; z-index: 5; touch-action: none;
}
.sidebar-resizer:hover, html.sb-resizing .sidebar-resizer { background: var(--accent-brand-soft); }
html.sb-resizing { cursor: col-resize; user-select: none; }
html.sb-resizing iframe { pointer-events: none; }
.sidebar-collapse-btn { margin-inline-start: auto; }
html.sb-collapsed .chat-sidebar { width: 64px; }
html.sb-collapsed .chat-sidebar .chat-brand > div,
html.sb-collapsed .chat-sidebar .chat-sidebar-section-label,
html.sb-collapsed .chat-sidebar .chat-recent-threads,
html.sb-collapsed .chat-sidebar .chat-sidebar-nav a span,
html.sb-collapsed .chat-sidebar .sidebar-user-info,
html.sb-collapsed .sidebar-resizer { display: none; }
html.sb-collapsed .chat-sidebar-header { flex-direction: column; gap: 8px; padding-inline: 8px; }
html.sb-collapsed .sidebar-collapse-btn { margin-inline-start: 0; }
html.sb-collapsed .chat-sidebar-nav a { justify-content: center; padding-inline: 0; }
html.sb-collapsed .chat-sidebar-footer { flex-direction: column; align-items: center; gap: 6px; }
html.sb-collapsed .sidebar-footer-actions { flex-direction: column; }
.chat-brand-logo { width: 34px; height: 34px; object-fit: contain; }
@media (max-width: 1024px) {
    .sidebar-resizer, .sidebar-collapse-btn { display: none; }
    html.sb-collapsed .chat-sidebar { width: 272px; }
    html.sb-collapsed .chat-sidebar .chat-brand > div,
    html.sb-collapsed .chat-sidebar .chat-sidebar-section-label,
    html.sb-collapsed .chat-sidebar .chat-recent-threads,
    html.sb-collapsed .chat-sidebar .chat-sidebar-nav a span,
    html.sb-collapsed .chat-sidebar .sidebar-user-info { display: revert; }
}
/* ---------------------------------------------------------------------------
   Workspace like Claude Code: chat (main) · viewer (preview/code) · info rail
   --------------------------------------------------------------------------- */
.cc-ws {
    --cc-viewer: 560px;
    --cc-rail: 280px;
    /* Every child has an explicit column, so a hidden pane (display:none) can never
       shift its neighbours into a collapsed track. Columns: 1 chat · 2 split · 3 viewer · 4 split · 5 rail.
       All shown = 3 columns; one of viewer/rail = 2 columns; none = chat alone (1 column). */
    --cc-col-viewer: 6px minmax(240px, min(var(--cc-viewer), 52%));
    --cc-col-rail: 6px minmax(180px, min(var(--cc-rail), 34%));
    display: grid;
    grid-template-columns: minmax(300px, 1fr) var(--cc-col-viewer) var(--cc-col-rail);
    height: calc(100dvh - 140px);
    min-height: 520px;
    min-width: 0;
    gap: 0;
}
.cc-ws > .cc-chat { grid-column: 1; }
.cc-ws > .cc-split[data-resize="viewer"] { grid-column: 2; }
.cc-ws > .cc-viewer { grid-column: 3; }
.cc-ws > .cc-split[data-resize="rail"] { grid-column: 4; }
.cc-ws > .cc-rail { grid-column: 5; }
.cc-ws > .cc-tabs { grid-column: 1 / -1; }
.cc-ws.viewer-closed { grid-template-columns: minmax(300px, 1fr) 0 0 var(--cc-col-rail); }
.cc-ws.rail-closed { grid-template-columns: minmax(300px, 1fr) var(--cc-col-viewer) 0 0; }
.cc-ws.viewer-closed.rail-closed { grid-template-columns: minmax(0, 1fr) 0 0 0 0; }
.cc-ws.viewer-closed .cc-viewer, .cc-ws.viewer-closed .cc-split[data-resize="viewer"] { display: none; }
.cc-ws.rail-closed .cc-rail, .cc-ws.rail-closed .cc-split[data-resize="rail"] { display: none; }
/* Show/hide bar under the header (inline end = left in RTL), like the Claude Code app. */
.cc-toggles { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin: -4px 0 8px; }
.cc-toggle { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text-muted); cursor: pointer; transition: background .15s, color .15s; }
.cc-toggle .icon { width: 17px; height: 17px; }
.cc-toggle:hover { background: var(--bg-hover); color: var(--text-main); }
.cc-toggle[aria-pressed="true"] { background: var(--bg-surface); border-color: var(--border-color); color: var(--text-main); }
.cc-toggles-sep { width: 1px; height: 18px; background: var(--border-color); margin-inline: 4px; }
@media (max-width: 1023px) { .cc-toggles { display: none; } }
.cc-ws.is-resizing { user-select: none; cursor: col-resize; }
.cc-ws.is-resizing iframe { pointer-events: none; }
.cc-tabs { display: none; }
.cc-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.cc-split { cursor: col-resize; position: relative; touch-action: none; }
.cc-split::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 2.5px; width: 1px; background: var(--border-color); }
.cc-split:hover::after, .cc-split:focus-visible::after { width: 3px; inset-inline-start: 1.5px; background: var(--accent-brand); }

/* chat: no box, the conversation is the page */
.cc-chat .ide-chat-panel { background: none; border: 0; padding: 0 4px 0 12px; display: flex; flex-direction: column; min-height: 0; height: 100%; }
.cc-chat .panel-subbar { display: none; }
.cc-chat .chat-messages-box { flex: 1; min-height: 0; max-height: none; overflow-y: auto; padding-inline: 4px; }
.cc-chat .quick-prompts-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }

/* viewer */
.cc-viewer { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); margin-inline: 4px; }
.cc-viewer-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--border-color); }
.cc-viewer-tabs { display: inline-flex; gap: 4px; flex: 1; }
.cc-viewer-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text-secondary); font: inherit; font-size: 13px; cursor: pointer; }
.cc-viewer-tabs button.active { background: var(--bg-hover); color: var(--text-main); font-weight: 600; }
.cc-view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.cc-view.is-active { display: flex; }
.cc-view .live-code-body { flex: 1; min-height: 0; }
.cc-adv-only { display: none !important; }
.cc-ws.is-advanced .cc-adv-only { display: revert !important; }
.cc-readonly-note { font-size: 11.5px; color: var(--text-muted); }

/* info rail */
.cc-rail { padding: 0 4px 0 8px; overflow-y: auto; gap: 8px; }
.cc-card { border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-surface); padding: 8px 10px; }
.cc-card > summary { cursor: pointer; font-size: 13px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; }
.cc-card > summary::-webkit-details-marker { display: none; }
.cc-card > summary::after { content: "⌄"; margin-inline-start: auto; color: var(--text-muted); transition: transform .15s; }
.cc-card:not([open]) > summary::after { transform: rotate(90deg); }
.cc-card[open] > summary { margin-bottom: 8px; }
.cc-count { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.cc-kv { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 3px 0; }
.cc-kv span { color: var(--text-muted); }
.cc-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cc-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.cc-list li { min-width: 0; }
.cc-file, .cc-page {
    width: 100%; border: 0; background: none; text-align: left; font: inherit; font-size: 12px; color: var(--text-secondary);
    padding: 4px 6px; border-radius: var(--radius-sm); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.cc-page { text-align: right; }
.cc-file:hover, .cc-page:hover { background: var(--bg-hover); }
.cc-file.is-new { box-shadow: inset -3px 0 0 var(--success-text); }
.cc-empty { font-size: 12px; color: var(--text-muted); padding: 2px 6px; }
.cc-task { display: flex; flex-direction: column; gap: 1px; padding: 5px 6px 5px 8px; border-inline-start: 3px solid var(--border-color); font-size: 12px; }
.cc-task small { color: var(--text-muted); font-size: 11px; }
.cc-task-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-task.is-running, .cc-task.is-queued { border-color: var(--accent-brand); }
.cc-task.is-done { border-color: var(--success-text); }
.cc-task.is-error { border-color: var(--danger-text); }
.cc-task.is-paused { border-color: #d4a72c; }
.cc-meter { height: 6px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; margin: 4px 0; }
.cc-meter span { display: block; height: 100%; background: var(--accent-brand); }

@media (max-width: 1023px) {
    .cc-ws, .cc-ws.viewer-closed { display: flex; flex-direction: column; height: calc(100dvh - 130px); }
    .cc-split { display: none !important; }
    .cc-pane { display: none !important; flex: 1; }
    .cc-pane.is-active { display: flex !important; }
    .cc-viewer { margin: 0; }
    .cc-tabs {
        display: flex; order: 10; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-surface); margin-top: 6px;
    }
    .cc-tabs button { flex: 1; padding: 10px; border: 0; background: none; font: inherit; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
    .cc-tabs button.active { background: var(--accent-primary); color: var(--accent-primary-text); }
    .cc-chat .ide-chat-panel { padding: 0; }
    .cc-rail { padding: 0; }
}

/* ---------- Release outputs (workspace release tab) ---------- */
.outputs { display: flex; flex-direction: column; gap: 14px; }
.out-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.out-head h3 { margin: 0 0 4px; }
.out-grid-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: start; }
/* Card title with its icon actions on the same row (actions at the inline end). */
.out-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.out-card-head h4 { margin: 0; }
.out-card-head .out-links { margin-top: 0; }
.out-card-head .out-upload { display: contents; }
.out-card { border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-surface); padding: 14px; min-width: 0; }
.out-card h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; }
.out-tagline { margin: 0 0 6px; font-size: 13px; }
.out-mini { margin: 0 0 10px; padding-inline-start: 18px; font-size: 12.5px; color: var(--text-secondary); }
.out-ai { display: flex; gap: 8px; align-items: center; }
.out-ai input[type="text"] { flex: 1; min-width: 0; }
.out-edit { margin-top: 10px; }
.out-edit > summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.out-group { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 8px 12px 4px; margin: 0 0 12px; }
.out-group > legend { padding: 0 6px; font-size: 13px; font-weight: 700; }
.out-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 12px; }
.out-fields .is-wide { grid-column: 1 / -1; }
.out-status { margin: 0 0 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--accent-brand-soft); color: var(--text-main); font-size: 12.5px; }
.shot-toast { position: fixed; inset-block-end: 18px; inset-inline-start: 18px; z-index: 900; max-width: 360px; padding: 10px 14px; border-radius: var(--radius-md); background: var(--accent-primary); color: var(--accent-primary-text); font-size: 13px; box-shadow: var(--shadow-md); }
.out-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 10px; }
.out-shots figure { position: relative; margin: 0; border: 1px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-subtle); }
.out-shot-img { display: block; aspect-ratio: 16 / 10; overflow: hidden; }
.out-shots img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.out-shots figcaption { display: flex; flex-direction: column; gap: 4px; padding: 6px; }
.out-shots figcaption input { width: 100%; font-size: 12px; padding: 4px 8px; min-height: 0; }
.out-shot-del { position: absolute; inset-block-start: 4px; inset-inline-end: 4px; width: 28px; height: 28px; padding: 5px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; border: 0; }
.out-shot-del svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.out-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.out-actions .btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.out-upload { margin: 0; }
/* Icon-only actions with a tooltip (title) and an accessible name. */
.out-ib { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.out-ib:hover, .out-ib:focus-visible { background: var(--accent-brand-soft); color: var(--accent-brand); border-color: var(--accent-brand); }
.out-ib.is-primary { background: var(--accent-primary); color: var(--accent-primary-text); border-color: var(--accent-primary); }
.out-ib.is-busy svg { animation: out-spin 1s linear infinite; }
.out-ib.is-done { color: var(--success-text); border-color: var(--success-border); background: var(--success-bg); }
.out-ib.is-failed { color: var(--danger-text); border-color: var(--danger-border); background: var(--danger-bg); }
@keyframes out-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .out-ib.is-busy svg { animation: none; } }
.out-ib svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.out-ib input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.out-hero { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 8px 10px; padding-top: 10px; border-top: 1px dashed var(--border-color); }
.out-hero-actions { grid-column: 1 / -1; }
.out-hero small { display: block; color: var(--text-muted); font-size: 11.5px; }
.out-hero b { font-size: 12.5px; }
.out-hero-thumb { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border-color); }
.out-hero-thumb img { width: 100%; height: 100%; object-fit: contain; }
.out-hero-thumb svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.out-hero-actions { display: flex; gap: 6px; }
.out-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.out-kind { display: flex; flex-direction: column; gap: 10px; }
.out-kind-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.out-kind-head h4 { margin: 0; min-width: 0; }
.out-kind-head > span { flex-shrink: 0; white-space: nowrap; }
.out-thumb { position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-subtle); border: 1px solid var(--border-color); display: grid; place-items: center; }
/* Absolutely placed so the image takes the box size, not its own height. */
.out-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
/* Physical right/top on purpose: the iframe is scaled from its top-right corner in this RTL layout. */
.out-thumb iframe { position: absolute; top: 0; right: 0; width: 400%; height: 400%; border: 0; transform: scale(.25); transform-origin: top right; pointer-events: none; background: #fff; }
.out-thumb img.is-top { object-fit: cover; object-position: top; }
.out-thumb-empty { color: var(--text-muted); }
.out-thumb-empty svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.out-kind-form { display: flex; gap: 6px; align-items: center; }
.out-kind-form select { flex: 1; min-width: 0; }
.out-kind-form select.out-theme { flex: 0 0 auto; width: auto; }
.out-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 34px; margin-top: auto; }
/* Word outputs have no picture to preview: a short strip keeps their cards as tall as the rest. */
.out-kind[data-kind="description"] .out-thumb, .out-kind[data-kind="buyer_guide"] .out-thumb, .out-kind[data-kind="dev_guide"] .out-thumb { aspect-ratio: 16 / 6; }
/* Product pictures (cover image, site logo) sit in one row above the output cards. */
.out-assets { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 20px; }
.out-assets .out-hero { grid-template-columns: 52px minmax(0, 1fr) auto; padding-top: 0; border-top: 0; }
.out-assets .out-hero-actions { grid-column: auto; }
@media (max-width: 900px) { .out-grid-top { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
    .out-kinds { grid-template-columns: 1fr; }
    .out-assets .out-hero { grid-template-columns: 52px minmax(0, 1fr); }
    .out-assets .out-hero-actions { grid-column: 1 / -1; }
    .licensable-file-item { align-items: flex-start; }
    .licensable-file-item code { overflow-wrap: anywhere; }
}

/* ---------- Settings → update (بروزرسانی کدیکا) ---------- */
.update-card { display: flex; flex-direction: column; gap: 16px; }
.update-card .panel-header { margin-bottom: 0; }
.update-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; counter-reset: upd; }
.update-steps li { counter-increment: upd; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 2px 10px; align-items: start; padding: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-subtle); }
.update-steps li::before { content: counter(upd, persian); grid-row: span 2; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-brand-soft); color: var(--accent-brand); font-weight: 700; }
.update-steps b { font-size: 13.5px; }
.update-steps small { color: var(--text-muted); font-size: 12px; line-height: 1.8; }
.update-upload { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.file-pick { position: relative; flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; }
.file-pick:hover, .file-pick:focus-within { border-color: var(--accent-brand); color: var(--text-main); }
.file-pick .icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.file-pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-pick input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.update-staged { padding: 14px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-subtle); display: flex; flex-direction: column; gap: 8px; }
.update-staged-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.update-staged .field-hint { margin: 0; }
.update-actions, .update-rollback { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.update-rollback { justify-content: space-between; padding-top: 12px; border-top: 1px dashed var(--border-color); }
.update-rollback .field-hint { margin: 0; }
@media (max-width: 700px) { .update-steps { grid-template-columns: 1fr; } }

/* ---------- Settings → web services, brief picker ---------- */
.svc-cat-title { margin: 18px 0 8px; font-size: 14px; }
.svc-list { display: flex; flex-direction: column; gap: 8px; }
.svc-card { border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-surface); padding: 10px 14px; }
.svc-card > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.svc-card[open] > summary { margin-bottom: 8px; }
.svc-card code { font-size: 12px; color: var(--text-muted); }
.svc-ver { font-size: 11.5px; color: var(--text-muted); }
.svc-form { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.svc-code { font-family: var(--font-mono); font-size: 12px; }
.svc-new { margin-top: 16px; border-style: dashed; }
.svc-pick-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.svc-pick-cat { min-width: 110px; font-size: 12.5px; color: var(--text-muted); }
.svc-pick { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border-color); border-radius: 999px; font-size: 12.5px; cursor: pointer; background: var(--bg-surface); }
.svc-pick:has(input:checked) { border-color: var(--accent-brand); background: var(--accent-brand-soft); }

/* ---------- Version 2: notifications, tickets, billing ---------- */
.seg-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-subtle); }
.seg-tabs a { padding: 5px 12px; border-radius: 8px; font-size: 12.5px; color: var(--text-secondary); text-decoration: none; }
.seg-tabs a.active { background: var(--bg-surface); color: var(--text-main); font-weight: 700; box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.06)); }
.nav-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-inline-start: 4px; border-radius: 999px; background: var(--accent-brand); color: #fff; font-size: 10.5px; font-weight: 700; }
.notify-bell { position: relative; }
.notify-dot { position: absolute; inset-block-start: 2px; inset-inline-end: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger-text); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
.notify-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.notify-item { margin: 0; }
.notify-item button { width: 100%; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "kind title time" "body body body"; gap: 4px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-surface); font: inherit; text-align: start; cursor: pointer; color: inherit; }
.notify-list li.is-new .notify-item button { border-color: var(--accent-brand); background: var(--accent-brand-soft); }
.notify-kind { grid-area: kind; font-size: 11px; color: var(--text-muted); }
.notify-item b { grid-area: title; font-size: 13.5px; }
.notify-item small { grid-area: time; font-size: 11px; color: var(--text-muted); }
.notify-body { grid-area: body; font-size: 12.5px; color: var(--text-secondary); line-height: 1.8; }
.ticket-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.ticket-msg { max-width: 82%; padding: 10px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-surface); }
.ticket-msg.is-staff { align-self: flex-end; background: var(--accent-brand-soft); border-color: transparent; }
.ticket-msg header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; font-size: 12.5px; }
.ticket-msg header small { color: var(--text-muted); }
.ticket-reply { margin-top: 14px; }
.ticket-composer { border: 1px solid var(--border-color); border-radius: var(--radius-md, 12px); background: var(--bg-surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.ticket-composer:focus-within { border-color: var(--accent-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-brand) 14%, transparent); }
.ticket-composer textarea { display: block; width: 100%; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: transparent; padding: 12px 14px; resize: vertical; min-height: 96px; }
.ticket-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-top: 1px solid var(--border-color); background: var(--bg-subtle); }
.ticket-attach { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; flex: 1; }
.ticket-attach-list { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.attachment-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-subtle); font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-attach-list .attachment-chip button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0 2px; }
.ticket-voice-preview { height: 32px; max-width: 220px; }
.out-ib.is-recording { color: #fff; background: var(--danger-text); border-color: var(--danger-text); animation: agentPulse 1s ease-in-out infinite; }
.ticket-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.ticket-files audio { height: 34px; max-width: 100%; }
.ticket-thumb img { display: block; width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-color); }
.ticket-file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-surface); color: inherit; text-decoration: none; font-size: 12.5px; max-width: 100%; }
.ticket-file-chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.ticket-file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-file-chip small { color: var(--text-muted); }
.ticket-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-inline-start: auto; }
.billing-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 14px; }
.billing-stat { display: flex; flex-direction: column; gap: 4px; }
.billing-stat > span { color: var(--text-muted); font-size: 12.5px; }
.billing-stat b { font-size: 22px; }
.billing-stat b small { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.billing-stat > small { color: var(--text-muted); font-size: 12px; }
.billing-title { margin: 6px 0 10px; font-size: 15px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.plan-card { display: flex; flex-direction: column; gap: 8px; }
.plan-card .plan-price { font-size: 20px; font-weight: 800; }
.plan-card .plan-price small { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.plan-card ul { margin: 0; padding-inline-start: 18px; font-size: 13px; color: var(--text-secondary); line-height: 1.9; flex: 1; }
.plan-card form button { width: 100%; }
.auth-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
@media (max-width: 640px) { .ticket-msg { max-width: 100%; } }

/* ---------- Tasks: kanban, calendar ---------- */
.tasks-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.tasks-toolbar .btn { margin-inline-start: auto; }
.tasks-filter select { min-width: 160px; }
.kanban { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.kanban-col { background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: 14px; padding: 10px; min-height: 260px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s; }
.kanban-col.is-over { border-color: var(--accent-brand); }
.kanban-col > header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; }
.kanban-list { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 60px; }
.task-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-inline-start: 4px solid var(--border-color); border-radius: 10px; padding: 10px 12px; cursor: grab; }
.task-card.is-dragging { opacity: .45; }
.task-card.prio-high { border-inline-start-color: #F59E0B; }
.task-card.prio-urgent { border-inline-start-color: #EF4444; }
.task-card.prio-low { border-inline-start-color: #94A3B8; }
.task-title { display: block; font-weight: 700; color: var(--text-main); text-decoration: none; margin-bottom: 6px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11.5px; color: var(--text-secondary); }
.task-meta span { background: var(--bg-subtle); border-radius: 6px; padding: 1px 7px; }
.task-due.is-late { background: var(--danger-bg) !important; color: var(--danger-text); }
.task-prio.prio-urgent { color: #EF4444; font-weight: 700; }
.task-prio.prio-high { color: #D97706; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: 12px; color: var(--text-secondary); padding: 6px 0; }
.cal-day { min-height: 96px; border: 1px solid var(--border-color); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day.is-blank { border-style: dashed; opacity: .4; }
.cal-day.is-today { border-color: var(--accent-brand); box-shadow: inset 0 0 0 1px var(--accent-brand); }
.cal-num { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.cal-task { display: block; font-size: 11.5px; padding: 2px 6px; border-radius: 6px; background: var(--bg-subtle); color: var(--text-main); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-task.st-doing { background: color-mix(in srgb, var(--accent-brand) 14%, transparent); }
.cal-task.st-done { text-decoration: line-through; opacity: .6; }
.cta-row-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.data-table tr.is-new td { background: color-mix(in srgb, var(--accent-brand) 6%, transparent); }
@media (max-width: 760px) { .kanban { grid-template-columns: repeat(3, 82%); } .cal-day { min-height: 64px; } .cal-task { font-size: 10px; } }
/* ---------- Billing → finance report ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-tile { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat-tile small { color: var(--text-secondary); font-size: 12px; }
.stat-tile b { font-size: 22px; line-height: 1.4; }
.stat-tile span { color: var(--text-muted); font-size: 11.5px; }
.chart-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-start: 8px; }
.sw-rev, .bar.rev { background: var(--accent-brand); }
.sw-ai, .bar.ai { background: #94A3B8; }
.bar-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 220px; padding-top: 8px; border-bottom: 1px solid var(--border-color); }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.bar-col .bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bar-col .bar { width: 40%; max-width: 18px; min-height: 2px; border-radius: 4px 4px 0 0; }
.bar-col small { font-size: 10.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* ---------- Settings → public site editor ---------- */
.site-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.site-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 14px; }
.site-fields .is-wide { grid-column: 1 / -1; }
.rep-list { display: flex; flex-direction: column; gap: 10px; }
.rep-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-subtle); }
.rep-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 180px; min-width: 0; font-size: 12.5px; color: var(--text-secondary); }
.rep-field.rep-wide { flex: 2 1 300px; }
.rep-field.rep-icon { flex: 0 1 140px; }
.rep-field input, .rep-field select, .rep-field textarea { width: 100%; }
.rep-tools { display: flex; gap: 4px; }
.soft-rule { border: 0; border-top: 1px solid var(--border-color); margin: 16px 0; }
.plan-card { position: relative; }
.plan-card.is-featured { border-color: var(--accent-brand); box-shadow: 0 0 0 2px var(--accent-brand-soft, color-mix(in srgb, var(--accent-brand) 20%, transparent)); }
.plan-flag { position: absolute; top: -10px; inset-inline-start: 14px; background: var(--accent-brand); color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.plan-bullets { padding-inline-start: 18px; }

/* ---------- Dashboard overview (team and commercial modes) ---------- */
.ov-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.ov-card { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-surface); color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.ov-card:hover { border-color: var(--accent-brand); transform: translateY(-1px); }
.ov-icon { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-brand-soft); color: var(--accent-brand); }
.ov-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ov-body { display: flex; flex-direction: column; min-width: 0; }
.ov-body small { color: var(--text-secondary); font-size: 12px; }
.ov-body b { font-size: 21px; line-height: 1.4; }
.ov-body em { font-style: normal; color: var(--text-muted); font-size: 11.5px; }
.ov-blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 14px; }
.ov-block { margin: 0; }
.ov-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ov-list li + li { border-top: 1px solid var(--border-color); }
.ov-list a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 2px; color: inherit; text-decoration: none; }
.ov-list a:hover b { color: var(--accent-brand); }
.ov-list span { display: flex; flex-direction: column; min-width: 0; }
.ov-list b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-list small { color: var(--text-muted); font-size: 11.5px; }
.ov-list em { flex: none; font-style: normal; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-subtle); color: var(--text-secondary); }
.ov-list em.is-hot { background: var(--danger-bg); color: var(--danger-text); }
/* ---------- Teams section: tabs and compact one-line forms ---------- */
.team-tabs { margin-bottom: 12px; }
.ws-inline { display: flex; align-items: flex-end; gap: 8px; flex-wrap: nowrap; margin-bottom: 12px; }
.ws-inline > * { min-width: 0; }
.ws-inline .is-grow { flex: 1 1 0; }
.ws-inline .is-mid { flex: 0 1 150px; }
.ws-inline .is-narrow { flex: 0 0 84px; }
.ws-inline .is-auto { flex: 0 0 auto; white-space: nowrap; }
.ws-inline > select { flex: 0 1 130px; }
.ws-field { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 12.5px; color: var(--text-secondary); }
.ws-field input, .ws-field select { width: 100%; min-width: 0; }
.ws-inline .module-item { margin: 0 0 8px; }
@media (max-width: 640px) { .ws-inline { flex-wrap: wrap; } .ws-inline .is-grow { flex-basis: 100%; } }
/* ---------- Mobile: cards in a row take the full width; icon buttons stay centred ---------- */
@media (max-width: 760px) {
    .form-row { align-items: stretch !important; }
    .form-row > .panel-card { flex: 0 0 auto !important; width: 100%; min-width: 0; }
}
.form-group label.out-ib, .ticket-attach .out-ib { display: inline-grid; place-items: center; margin: 0; padding: 0; }
.out-ib svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.save-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.badge-theme { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--text-main); border: 1px solid var(--border-color); background: linear-gradient(90deg, rgba(30, 28, 36, .16) 50%, rgba(255, 255, 255, .7) 50%); }

.team-stats .rate { width: 90px; height: 6px; border-radius: 99px; background: var(--bg-subtle); overflow: hidden; margin-bottom: 3px; }
.team-stats .rate span { display: block; height: 100%; background: var(--accent-brand); }
.team-stats td.is-late { color: var(--danger-text); font-weight: 700; }

/* ---------- About (درباره ما) ---------- */
.about-page { display: flex; flex-direction: column; gap: 14px; }
.about-hero { display: flex; align-items: center; gap: 14px; }
.about-hero h2 { margin: 0 0 4px; }
.about-hero h2 small { color: var(--text-muted); font-size: 13px; font-weight: 400; }
.about-hero p { margin: 0; color: var(--text-secondary); }
.about-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.about-product { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-main); text-decoration: none; transition: border-color .15s, background .15s; }
.about-product:hover, .about-product:focus-visible { border-color: var(--accent-brand); background: var(--accent-brand-soft); }
.about-product small { display: block; color: var(--text-muted); font-size: 12px; line-height: 1.8; margin-top: 2px; }
.about-avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-brand-soft); color: var(--accent-brand); font-weight: 800; font-size: 18px; }
.about-roadmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.about-step { position: relative; padding: 14px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-subtle); }
.about-step.is-done { border-color: var(--success-border); background: var(--success-bg); }
.about-step b { display: block; font-size: 15px; }
.about-step small { color: var(--text-muted); }
.about-step ul { margin: 8px 0 0; padding-inline-start: 18px; font-size: 12.5px; line-height: 1.9; }
.about-step-badge { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-secondary); }

/* ---------- Settings → output templates ---------- */
.tpl-kind-title { margin: 16px 0 8px; font-size: 14px; }
.tpl-kind-title small { color: var(--text-muted); font-weight: 400; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tpl-card { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 12px; background: var(--bg-subtle); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tpl-card.is-off { opacity: .65; }
.tpl-card-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tpl-card .field-hint { margin: 0; }
.tpl-meta { margin: 0 0 4px; font-size: 11.5px; color: var(--text-muted); }
.tpl-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tpl-files-title { margin: 14px 0 8px; font-size: 14px; }
.tpl-file { border: 1px solid var(--border-color); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--bg-subtle); }
.tpl-file > summary { cursor: pointer; padding: 8px 10px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.tpl-file > summary small { color: var(--text-muted); }
.tpl-file > :not(summary) { margin: 0 10px 10px; }
.tpl-file .code-area { width: calc(100% - 20px); box-sizing: border-box; }
.code-area { font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.55; text-align: left; tab-size: 4; white-space: pre; overflow: auto; }
.tpl-actions { position: sticky; inset-block-end: 0; padding: 10px 0; background: var(--bg-surface); }
.tpl-preview { position: sticky; inset-block-start: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-subtle); }
.tpl-preview-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 13px; border-block-end: 1px solid var(--border-color); }
.tpl-preview iframe { display: block; width: 100%; height: 72vh; border: 0; background: #fff; }
@media (max-width: 1100px) { .tpl-editor { grid-template-columns: 1fr; } .tpl-preview { position: static; } }

/* ---------- Team AI usage: daily bars ---------- */

/* ---------- Composer: web-service / SMS picker ---------- */
.composer-services { position: relative; }
.composer-services > summary { cursor: pointer; font-size: 12px; padding: 4px 10px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-surface); list-style: none; white-space: nowrap; }
.composer-services > summary::-webkit-details-marker { display: none; }
.composer-services-pop { position: absolute; z-index: 30; inset-inline-start: 0; bottom: calc(100% + 6px); width: min(420px, 92vw); max-height: 320px; overflow: auto; padding: 10px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-surface); box-shadow: 0 8px 30px rgba(0,0,0,.18); }

/* ---- Team AI usage page (3.0.0) ---- */
.team-ai .panel-card + .panel-card, .team-ai .form-row { margin-top: 16px; }
.team-ai .team-ai-filter { margin: 4px 0 18px; padding: 12px 14px; background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: 12px; display: flex; align-items: center; gap: 10px; }
.team-ai .team-ai-filter select { min-width: 220px; max-width: 100%; }
.team-ai .stat-tiles { margin: 18px 0 26px; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .team-ai .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.team-ai .stat-tile { padding: 14px 16px; gap: 6px; }
.team-ai .stat-tile span { font-size: 12px; color: var(--text-secondary); }
.team-ai .stat-tile b { font-size: 24px; }
.team-ai h3 { margin: 6px 0 12px; font-size: 15px; }
.team-ai .table-wrap { border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-surface); }
.team-ai .data-table { min-width: 0; font-size: 13.5px; }
.team-ai .data-table th, .team-ai .data-table td { padding: 12px 16px; vertical-align: middle; }
.team-ai .data-table thead th { position: sticky; top: 0; background: var(--bg-subtle); }
.team-ai .data-table tbody tr:nth-child(even) td { background: rgba(127,127,127,.045); }
.team-ai .data-table tbody tr:hover td { background: color-mix(in srgb, var(--accent-brand) 7%, transparent); }
.team-ai .data-table tbody tr:last-child td { border-bottom: 0; }
.team-ai .data-table td:not(:first-child), .team-ai .data-table th:not(:first-child) { text-align: center; font-variant-numeric: tabular-nums; }
.team-ai .data-table tr.is-total td { background: var(--bg-subtle); font-weight: 700; border-top: 2px solid var(--border-color); }
.team-ai .panel-card .panel-header { margin-bottom: 14px; }
.team-ai .form-row > .panel-card { flex: 1 1 460px; min-width: 0; margin-top: 0; }
.usage-chart { display: flex; align-items: stretch; gap: 3px; height: 200px; padding: 10px 6px 0; border-bottom: 1px solid var(--border-color); background: linear-gradient(var(--border-color) 1px, transparent 1px) 0 0 / 100% 50px; }
.usage-chart .bar { flex: 1 1 0; min-width: 2px; display: flex; align-items: flex-end; }
.usage-chart .bar > span { display: block; width: 100%; background: var(--accent-brand); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .9; }
.usage-chart .bar:hover > span { opacity: 1; }
.usage-chart-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

/* ---- 4.0.0: mobile header, work-mode badges, simple chat ---- */
@media (max-width: 768px) {
    .chat-topbar .topbar-logo-img { display: none; }
}
.mode-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.7; white-space: nowrap; }
.mode-badge.mode-create { background: color-mix(in srgb, var(--accent-brand) 14%, transparent); color: #a14a2a; }
.mode-badge.mode-edit { background: rgba(59,130,246,.14); color: #1d4ed8; }
.mode-badge.mode-chat { background: rgba(16,185,129,.16); color: #047857; }
:root[data-theme="dark"] .mode-badge.mode-create { color: #f0a58a; }
:root[data-theme="dark"] .mode-badge.mode-edit { color: #93c5fd; }
:root[data-theme="dark"] .mode-badge.mode-chat { color: #6ee7b7; }
.simple-chat { display: flex; flex-direction: column; gap: 14px; }
.sc-messages { display: flex; flex-direction: column; gap: 12px; min-height: 240px; max-height: 60vh; overflow-y: auto; padding: 4px 2px; }
.sc-msg { display: flex; }
.sc-msg.is-user { justify-content: flex-start; }
.sc-msg.is-ai { justify-content: flex-end; }
.sc-body { max-width: min(760px, 92%); padding: 10px 14px; border-radius: 14px; line-height: 1.9; overflow-wrap: anywhere; font-size: 14px; }
.sc-msg.is-user .sc-body { background: var(--accent-brand); color: #fff; border-end-start-radius: 4px; }
.sc-msg.is-ai .sc-body { background: var(--bg-subtle); border: 1px solid var(--border-color); border-end-end-radius: 4px; }
.sc-body pre { margin: 8px 0; padding: 10px 12px; background: rgba(0,0,0,.08); border-radius: 8px; overflow-x: auto; font-size: 12.5px; white-space: pre; }
.sc-body code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.sc-error { padding: 10px 14px; border-radius: 10px; background: rgba(220,38,38,.1); color: #b91c1c; font-size: 13px; }
.sc-form textarea { width: 100%; resize: vertical; min-height: 56px; }
.sc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.sc-tools .sc-usage { flex: 1 1 auto; color: var(--text-muted); font-size: 12px; }
@media (max-width: 640px) { .sc-body { max-width: 100%; } .sc-messages { max-height: 52vh; } }

/* ---- 4.0.0 (round 2): compact header ---- */
.ws-switcher.ws-icon { position: relative; display: inline-flex; width: 36px; height: 36px; }
.ws-switcher.ws-icon .icon-btn { pointer-events: none; }
.ws-switcher.ws-icon select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
@media (max-width: 768px) { .chat-topbar-title { display: none; } }

/* single-row icon composer, icon tabs, scrollable sub-tabs */
.composer-ActionBar { flex-wrap: nowrap; }
.composer-tools-right, .composer-tools-left { flex-wrap: nowrap; min-width: 0; }
.composer-tools-right { flex: 1 1 auto; overflow: hidden; }
.composer-select { max-width: 104px; min-width: 0; text-overflow: ellipsis; }
.btn-send-chat { width: 38px; padding: 0; flex: none; }
.btn-send-chat[hidden] { display: none; }
.btn-send-chat.is-stop { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.workspace-tabs { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.workspace-tabs::-webkit-scrollbar { display: none; }
.workspace-tabs .icon-btn { flex: none; }
.seg-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg-tabs::-webkit-scrollbar { display: none; }
.seg-tabs > * { flex: none; white-space: nowrap; }

/* ---- گفتگوی ساده: پیوست، کارت دانلود، توقف/تلاش دوباره داخل چت ---- */
.sc-col { display: flex; flex-direction: column; gap: 8px; max-width: min(760px, 92%); min-width: 0; }
.sc-msg.is-user .sc-col { align-items: flex-start; }
.sc-msg.is-ai .sc-col { align-items: flex-end; }
.sc-col .sc-body { max-width: 100%; }
.sc-chips, .sc-attached { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-attached { margin-bottom: 6px; }
.sc-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 220px; padding: 3px 9px; border-radius: 999px; background: var(--bg-subtle); border: 1px solid var(--border-color); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sc-chip .icon { width: 13px; height: 13px; flex: none; }
.sc-chip-x { border: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; color: inherit; }
.sc-file { display: flex; align-items: center; gap: 12px; width: min(420px, 100%); padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-card, #fff); }
.sc-file-ico { flex: none; width: 40px; height: 40px; border-radius: 9px; color: #fff; display: grid; place-items: center; font: 700 12px/1 system-ui, sans-serif; direction: ltr; }
.sc-file-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sc-file-meta b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-file-meta small { color: var(--text-muted); font-size: 11.5px; }
.sc-dl { display: inline-flex; align-items: center; gap: 5px; flex: none; }
.sc-dl .icon, .sc-retry .icon { width: 15px; height: 15px; }
.sc-error { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.sc-retry { display: inline-flex; align-items: center; gap: 5px; }
.sc-form .sc-tools { flex-wrap: nowrap; gap: 6px; }
.sc-form .sc-tools .composer-select { flex: 0 1 auto; }
.sc-form .sc-usage { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sc-form .btn-send-chat[hidden] { display: none; }
@media (max-width: 640px) { .sc-col { max-width: 100%; } .sc-file { width: 100%; } .sc-dl span { display: none; } }

/* گفتگوی ساده: تصویر، اقدام‌های پیام، مارک‌داون */
.sc-img { margin: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; max-width: min(460px, 100%); }
.sc-img img { display: block; max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border-color); }
.sc-actions { display: flex; gap: 4px; opacity: .75; }
.sc-actions .icon-btn { width: 28px; height: 28px; }
.sc-actions .icon { width: 15px; height: 15px; }
.sc-copy-msg.is-done, .sc-copy-code.is-done { color: #16a34a; }
.sc-code { position: relative; }
.sc-copy-code { position: absolute; top: 6px; inset-inline-end: 6px; width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 6px; background: rgba(0,0,0,.12); cursor: pointer; color: inherit; }
.sc-copy-code .icon { width: 14px; height: 14px; }
.sc-body h3, .sc-body h4, .sc-body h5, .sc-body h6 { margin: 10px 0 4px; line-height: 1.5; }
.sc-body ul, .sc-body ol { margin: 6px 0; padding-inline-start: 22px; }
.sc-body blockquote { margin: 6px 0; padding: 2px 10px; border-inline-start: 3px solid var(--accent-brand); opacity: .9; }
.sc-body a { color: inherit; text-decoration: underline; }
.sc-tbl { overflow-x: auto; margin: 8px 0; }
.sc-tbl table { border-collapse: collapse; font-size: 13px; }
.sc-tbl th, .sc-tbl td { border: 1px solid var(--border-color); padding: 4px 9px; text-align: start; }
.sc-tbl th { background: rgba(0,0,0,.06); }
#scImgMode.is-on { background: var(--accent-brand); color: #fff; }
.sc-suggest { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }

/* ویرایشگر فیلد‌محور (جایگزین متن‌های خطی) */
.rep-wrap { display: flex; flex-direction: column; gap: 10px; }
.rep-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rep-field.rep-check { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 6px; padding-bottom: 8px; }
.rep-field.rep-check input { width: auto; }
.rep-row .rep-field[style*="display: none"] { display: none !important; }
.rep-tools .out-ib { min-width: 30px; }

/* منبع‌های جستجوی وب در گفتگو */
.sc-sources { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-source { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 999px; border: 1px solid var(--border-color); background: var(--bg-subtle); font-size: 11.5px; text-decoration: none; color: inherit; direction: ltr; max-width: 190px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sc-source b { display: inline-grid; place-items: center; min-width: 16px; height: 16px; border-radius: 50%; background: var(--accent-brand); color: #fff; font-size: 10px; direction: rtl; }
#scWeb.is-on { background: var(--accent-brand); color: #fff; }

/* 5.0 — Android WebView projects: no browser preview / simulator */
.mode-badge.mode-android { background: rgba(61,220,132,.16); color: #166534; }
:root[data-theme="dark"] .mode-badge.mode-android, body.dark-chat-mode .mode-badge.mode-android { color: #86efac; }
.android-note { margin: 14px; padding: 14px 16px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-subtle); line-height: 1.9; font-size: 13px; }
.android-note b { display: block; margin-bottom: 4px; }
.cc-viewer[data-kind="android"] .live-preview-bar,
.cc-viewer[data-kind="android"] .live-preview-stage,
.cc-viewer[data-kind="android"] .live-console { display: none !important; }
