/**
 * استایل مینیمال و استاندارد کدیکا نسخه ۱.۰.۰ (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: rgba(201, 100, 66, 0.12);
    --focus-ring: rgba(201, 100, 66, 0.22);
    --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"],
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,
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.75;
    word-break: break-word;
}

.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; padding: 10px 0 2px; background: linear-gradient(to top, var(--bg-surface) 70%, transparent); margin-top: 12px; }
.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 { 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-empty { margin: auto; padding: 24px; max-width: 320px; text-align: center; color: var(--text-muted); font-size: 13px; }
.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;
    display: grid;
    grid-template-columns: minmax(360px, 1fr) 6px minmax(280px, var(--cc-viewer)) 6px minmax(200px, var(--cc-rail));
    height: calc(100dvh - 140px);
    min-height: 520px;
    min-width: 0;
    gap: 0;
}
.cc-ws.viewer-closed { grid-template-columns: minmax(360px, 1fr) 0 0 6px minmax(200px, var(--cc-rail)); }
.cc-ws.viewer-closed .cc-viewer, .cc-ws.viewer-closed .cc-split[data-resize="viewer"] { 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-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; } }

/* ---------- 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; } }
