body { font-family: IRANSansXFaNum,Vazir, Tahoma, sans-serif; background:#f5f6fa; margin:20px; color:#222; }
    h2 { text-align:center; margin-bottom:15px; }
    .search-section { display:flex; gap:15px; align-items:flex-end; flex-wrap:wrap; margin-bottom:15px; }
    .search-block { position: relative; width:320px; }
        #searchBox { 
            width: 100%; padding: 8px 12px; font-size: 14px; box-sizing: border-box;
            font-family: IRANSansXFaNum, Vazirmatn, Vazir, Tahoma, sans-serif; font-weight: 400;
            border: 1px solid #ddd; border-radius: 4px; color: #2c3e50;
            transition: border-color 0.2s, box-shadow 0.2s; direction: rtl; text-align: right;
        }
        #searchBox:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1); }
        #searchBox::placeholder { color: #95a5a6; font-size: 13px; }
      
        #searchResults {
            position: absolute; left: 0; right: 0; top: calc(100% + 6px);
            background: #fff; border: 1px solid #ddd; display: none; z-index: 999;
            font-size: 13px; max-height: none;
        }    
        #searchResults .result-item {
            padding: 6px 10px; cursor: pointer; display: flex;
            justify-content: space-between; border-bottom: 1px solid #f0f0f0;
        }
        #searchResults .result-item:hover { background: #f9f9f9 }
        #searchResults .result-main {
            display:flex; align-items: center; width: 100%; direction: rtl;
            font-size: 14px; font-weight: 600; color:#2c3e50;
        }
        .result-name { text-align: right; flex: 1; }
        .result-afc { text-align: left; flex: 0 0 auto; color: #7f8c8d; font-size: 13px; }
        .result-sub { font-size: 12px; color:#888; margin-top: 2px; }
        .isin-block { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
        
        .card details table td { border: 1px solid #eee; padding: 4px 8px; vertical-align: top; }
        .card details table { border: 1px solid #e0e0e0; border-radius: 4px; margin: 4px 0; background: #fafafa; }
        .card details { border: none; margin-bottom: 2px; font-family: IRANSansXFaNum,Vazir, Tahoma, sans-serif; }
        .card details summary {
            background-color: #f1f8ff; padding: 6px 10px; border-radius: 4px;
            transition: background-color 0.2s; font-family: IRANSansXFaNum,Vazir, Tahoma, sans-serif;
        }
        .card details summary:hover { background-color: #e3f2fd; }
        .card details summary:focus { outline: 1px solid #3498db; }
        
    #asin { width:220px; padding:6px 8px; font-size:14px; }
    #lVal30Display { font-weight:700; min-width:160px; display:inline-block; color:#2c3e50; word-break:break-word; } 
    #lastUpdate { font-size:12px; color:#777; margin-bottom:10px; }
    .row { display:flex; gap:15px; flex-wrap:wrap; align-items:flex-start; }
    .card { background:#fff; border-radius:8px; box-shadow:0 2px 8px rgba(0,0,0,.08); overflow:visible; flex:0 0 auto; padding:8px; min-width:260px; }

    h3 { margin:0 0 6px 0; font-size:14px; background:#2980b9; color:#fff; padding:6px 10px; text-align:center; border-radius:4px 4px 0 0; }
    table { display: table; table-layout:auto; border-collapse:collapse; width:100%; font-size:12px; }
    th, td { border:1px solid #e0e0e0; padding:4px 6px; text-align:right; white-space:nowrap; }
    th { background:#3498db; color:#fff; font-size:12px; }
    tr:nth-child(even) { background:#fafafa; }
    .highlight-inc { animation: incAnim 1.4s ease; }
    .highlight-dec { animation: decAnim 1.4s ease; }
    .small { font-size:12px; color:#777; margin-top:6px; word-break:break-word; }
    .card-group { display:flex; flex-direction:column; gap:15px; }
    .card-group .card { margin-bottom:0; }
    
    #chartCard { min-width: 500px; max-width: 100%; width: 100%; box-sizing: border-box; }
    #chart_div { width: 100% !important; height: 420px !important; }
    
    @keyframes incAnim { from{background:#dff7de;} to{background:transparent;} }
    @keyframes decAnim { from{background:#fbe4e4;} to{background:transparent;} }
    @media (max-width:780px) { .search-section { flex-direction:column; align-items:stretch; } .isin-block { justify-content:flex-start; gap:6px; } #asin { width:100%; } #chartCard{position:static;width:100%;} }
    
    .tsetmc-btn {
        padding: 6px 12px; background-color: #3498db; color: white; border: none;
        border-radius: 4px; cursor: pointer; font-size: 11px; font-family: IRANSansXFaNum,Vazir, Tahoma, sans-serif;
        text-decoration: none; display: inline-flex; align-items: center; gap: 5px; transition: background-color 0.2s;
    }
    .tsetmc-btn:hover { background-color: #2980b9; }
    .tsetmc-btn:active { background-color: #1f618d; }
    .tsetmc-btn:disabled { background-color: #bdc3c7; cursor: not-allowed; }
    .codal-btn { background-color:#3498db; }
    .codal-btn:hover { background-color: #2980b9; }
    .codal-btn:active { background-color:#1f618d; }
    .codal-btn:disabled { background-color: #bdc3c7; cursor: not-allowed; }

    .sticky-header {
        position: sticky; top: 0; background: #f5f6fa; z-index: 500;
        padding: 10px 20px 8px 20px; margin: -20px -20px 0 -20px;
        border-bottom: 1px solid #dcdde1; box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    }
    .sticky-header h2 { margin-top: 0; margin-bottom: 8px; font-size: 15px; }
    .sticky-header .search-section { margin-bottom: 8px; }
    .sticky-header .small { margin-bottom: 0; }
    #cards { margin-top: 20px; }


/* ===== جداول در هدر (حقیقی/حقوقی و عمق بازار) ============================================================================ */

/* ردیف اصلی هدر */
.header-main-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

/* گروه راست: سرچ + ISIN + نام */
.header-right-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.header-right-group .search-block {
    flex: 0 0 320px;
}

.header-right-group .isin-block {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* گروه چپ: جداول */
.header-left-group {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* آخرین بروزرسانی */
#lastUpdate {
    margin: 2px 0 0 0;
    text-align: right;
    font-size: 11px;
}

/* ===== جدول حقیقی/حقوقی ===== */
                    .header-client-type {
                        flex: 0 0 auto;
                        width: 190px;
                        margin-top: 0;
                    }
                    
                    .header-client-type table {
                        border-collapse: collapse;
                        width: 100%;
                        font-size: 9px;
                        background: white;
                        border-radius: 4px;
                        overflow: hidden;
                        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
                    }
                    
                    .header-client-type th {
                        background: linear-gradient(to bottom, #f3e5f5, #e1bee7);
                        color: #6a1b9a;
                        padding: 2px 4px;
                        font-size: 8px;
                        font-weight: 600;
                        border: 1px solid #e0e0e0;
                        text-align: center;
                    }
                    
                    .header-client-type td {
                        padding: 2px 4px;
                        text-align: center;
                        border: 1px solid #eee;
                        font-size: 9px;
                        height: 15px;
                    }
                    
                    .header-client-type tr:nth-child(2) td { background-color: #e8f5e9; }
                    .header-client-type tr:nth-child(3) td { background-color: #fff3e0; }
                    .header-client-type td:nth-child(2) { color: #2e7d32; font-weight: 700; }
                    .header-client-type td:nth-child(3) { color: #e65100; font-weight: 700; }
                    .header-client-type td:nth-child(1) { font-weight: 600; color: #424242; background-color: #fafafa; }

/* ===== جدول عمق بازار ===== */
                .header-best-limits {
                    flex: 0 0 auto;
                    width: 280px;
                    margin-top: 0;
                }
                
                .header-best-limits table {
                    border-collapse: collapse;
                    width: 100%;
                    font-size: 10px;
                    background: white;
                    border-radius: 4px;
                    overflow: hidden;
                    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
                }
                
                .header-best-limits th {
                    background: linear-gradient(to bottom, #e3f2fd, #bbdefb);
                    color: #1565c0;
                    padding: 2px 4px;
                    font-size: 9px;
                    font-weight: 600;
                    border: 1px solid #e0e0e0;
                    text-align: center;
                }
                
                .header-best-limits td {
                    padding: 1px 4px;
                    text-align: center;
                    border: 1px solid #eee;
                    font-size: 10px;
                    height: 16px;
                }
                
                .header-best-limits td:nth-child(2),
                .header-best-limits td:nth-child(3) { background-color: #e8f5e9; color: #2e7d32; font-weight: 600; }
                .header-best-limits td:nth-child(4),
                .header-best-limits td:nth-child(5) { background-color: #ffebee; color: #c62828; font-weight: 600; }
                .header-best-limits td:nth-child(1) { background-color: #f5f5f5; color: #616161; font-weight: 500; }
                
                /* انیمیشن تغییر قیمت */
                .header-best-limits .highlight-inc,
                .header-client-type .highlight-inc { animation: incAnim 1.4s ease; }
                .header-best-limits .highlight-dec,
                .header-client-type .highlight-dec { animation: decAnim 1.4s ease; }

/* ===== ریسپانسیو برای جداول هدر ===== */
            @media (max-width: 1100px) {
                .header-main-row {
                    flex-direction: column;
                    align-items: stretch;
                }
                
                .header-left-group {
                    flex-direction: column;
                }
                
                .header-client-type,
                .header-best-limits {
                    width: 100%;
                    max-width: 100%;
                }
            }
            
            @media (max-width: 780px) {
                .header-right-group {
                    flex-direction: column;
                    align-items: stretch;
                }
                
                .header-right-group .search-block {
                    flex: 1 1 100%;
                    width: 100%;
                }
                
                .header-best-limits table,
                .header-client-type table {
                    font-size: 11px;
                }
                
                .header-best-limits td,
                .header-client-type td {
                    font-size: 10px;
                    padding: 3px 5px;
                }
            }







    /* ===== ردیف کارت‌های کدال (۵ کارت) ===== */
    #codalTablesRow {
        margin-top: 15px; gap: 15px; flex-wrap: wrap; justify-content: flex-start; align-items: stretch;
    }
    
    /* 🆕 عرض کمتر برای جدول گزارش ماهانه */
    #codalCard { 
        min-width: 340px;
        flex: 0 0 360px;
        max-width: 400px;
        width: 100%; box-sizing: border-box; display: flex; flex-direction: column;
    }
    
    /* بقیه کارت‌ها فضای باقی‌مانده را می‌گیرند */
    #transparencyCard, #interpretiveCard, #assembliesCard, #capitalIncreaseCard { 
        min-width: 280px;
        flex: 1 1 calc(33.333% - 10px);
        max-width: calc(33.333% - 10px);
        width: 100%; box-sizing: border-box; display: flex; flex-direction: column;
    }
    
    @media (max-width: 1100px) {
        #codalCard { max-width: 100%; flex: 1 1 100%; }
        #transparencyCard, #interpretiveCard, #assembliesCard, #capitalIncreaseCard {
            max-width: calc(50% - 10px); flex: 1 1 45%;
        }
    }
    @media (max-width: 780px) {
        #codalCard, #transparencyCard, #interpretiveCard, #assembliesCard, #capitalIncreaseCard {
            max-width: 100%; flex: 1 1 100%;
        }
    }
    
    #codalReports, #transparencyReports, #interpretiveReports, #assembliesReports, #capitalIncreaseReports {
        max-height: 500px; overflow-y: auto; padding: 5px; min-height: 300px; flex: 1;
    }

    /* دکمه بروزرسانی دستی در هدر کارت‌ها */
    .refresh-codal-btn {
        background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.5);
        color: white; border-radius: 4px; padding: 2px 8px; font-size: 12px;
        cursor: pointer; transition: all 0.3s ease; display: inline-flex; align-items: center;
        vertical-align: middle; margin-right: 5px;
    }
    .refresh-codal-btn:hover { background: rgba(255,255,255,0.4); transform: rotate(180deg); }

    /* ===== استایل‌های اصلی جداول کدال (دست‌نخورده) ===== */
    .codal-header, .codal-item {
        display: flex; align-items: center; padding: 10px 14px;
        border-bottom: 1px solid #f0f0f0; gap: 15px; transition: background 0.15s;
    }
    .codal-header {
        background: #f1f8ff; font-weight: 600; font-size: 12px; color: #2c3e50;
        position: sticky; top: 0; z-index: 10;
    }
    .codal-header span { flex: 1; }
    .codal-item:last-child { border-bottom: none; }
    .codal-item:hover { background: #fafafa; }
    .codal-period {
        flex: 1; font-weight: 600; color: #1976d2; text-decoration: none;
        font-size: 13px; direction: ltr; text-align: right; display: inline-block;
        padding: 4px 8px; border-radius: 4px; transition: all 0.2s;
    }
    .codal-period:hover { background: #e3f2fd; color: #0d47a1; }
    .codal-icons { display: flex; gap: 6px; align-items: center; min-width: 110px; justify-content: center; }
    .codal-icon {
        display: inline-flex; align-items: center; justify-content: center;
        width: 28px; height: 28px; border-radius: 5px; text-decoration: none;
        font-size: 14px; transition: all 0.2s; border: 1px solid transparent;
    }
    .codal-icon:hover { transform: translateY(-2px); box-shadow: 0 3px 6px rgba(0,0,0,0.12); }
    .codal-icon-excel { background: #e8f5e9; border-color: #c8e6c9; }
    .codal-icon-excel:hover { background: #c8e6c9; }
    .codal-icon-pdf { background: #ffebee; border-color: #ffcdd2; }
    .codal-icon-pdf:hover { background: #ffcdd2; }
    .codal-icon-xbrl { background: #f3e5f5; border-color: #e1bee7; }
    .codal-icon-xbrl:hover { background: #e1bee7; }
    .codal-icon-attachment { background: #fff3e0; border-color: #ffcc80; }
    .codal-icon-attachment:hover { background: #ffcc80; }
    .codal-no-file { color: #ccc; font-size: 12px; }
    .codal-publish-date {
        font-size: 12px; color: #7f8c8d; direction: ltr; white-space: nowrap;
        min-width: 90px; text-align: left; font-variant-numeric: tabular-nums;
    }
    .codal-loading, .codal-error, .codal-empty { text-align: center; padding: 25px 15px; color: #7f8c8d; font-size: 13px; }
    .codal-error { color: #e74c3c; }
    .codal-count {
        font-size: 11px; background: rgba(255,255,255,0.3); color: white;
        padding: 2px 10px; border-radius: 10px; margin-right: 8px; display: none;
    }

    /* استایل شفاف سازی و صورت های مالی (دست نخورده از کد اصلی) */
    .transparency-header, .transparency-item {
        display: flex; align-items: flex-start; padding: 12px 14px;
        border-bottom: 1px solid #f0f0f0; gap: 15px; transition: background 0.15s;
    }
    .transparency-header {
        background: #f1f8ff; font-weight: 600; font-size: 12px; color: #2c3e50;
        position: sticky; top: 0; z-index: 10; align-items: center;
    }
    .transparency-header span { flex: 1; }
    .transparency-item:last-child { border-bottom: none; }
    .transparency-item:hover { background: #fafafa; }
    .transparency-content { flex: 1; display: flex; flex-direction: column; gap: 6px; }
    .transparency-period {
        font-weight: 600; color: #1976d2; text-decoration: none; font-size: 13px;
        direction: ltr; text-align: right; display: inline-block; padding: 2px 0; transition: all 0.2s; align-self: flex-start;
    }
    .transparency-period:hover { color: #0d47a1; text-decoration: underline; }
    .transparency-title { font-size: 12px; color: #2c3e50; line-height: 1.6; font-weight: 400; }
    .transparency-icons { display: flex; gap: 6px; align-items: center; min-width: 140px; justify-content: center; flex-wrap: wrap; }
    .transparency-icon {
        display: inline-flex; align-items: center; justify-content: center;
        width: 28px; height: 28px; border-radius: 5px; text-decoration: none;
        font-size: 14px; transition: all 0.2s; border: 1px solid transparent;
    }
    .transparency-icon:hover { transform: translateY(-2px); box-shadow: 0 3px 6px rgba(0,0,0,0.12); }
    .transparency-icon-excel { background: #e8f5e9; border-color: #c8e6c9; }
    .transparency-icon-excel:hover { background: #c8e6c9; }
    .transparency-icon-pdf { background: #ffebee; border-color: #ffcdd2; }
    .transparency-icon-pdf:hover { background: #ffcdd2; }
    .transparency-icon-xbrl { background: #f3e5f5; border-color: #e1bee7; }
    .transparency-icon-xbrl:hover { background: #e1bee7; }
    .transparency-icon-attachment { background: #fff3e0; border-color: #ffcc80; }
    .transparency-icon-attachment:hover { background: #ffcc80; }
    .transparency-no-file { color: #ccc; font-size: 12px; }
    .transparency-publish-date {
        font-size: 12px; color: #7f8c8d; direction: ltr; white-space: nowrap;
        min-width: 90px; text-align: left; font-variant-numeric: tabular-nums;
    }
    .transparency-loading, .transparency-error, .transparency-empty { text-align: center; padding: 25px 15px; color: #7f8c8d; font-size: 13px; }
    .transparency-error { color: #e74c3c; }
    .transparency-count {
        font-size: 11px; background: rgba(255,255,255,0.3); color: white;
        padding: 2px 10px; border-radius: 10px; margin-right: 8px; display: none;
    }

    /* اسکرول بار سفارشی */
    #codalReports::-webkit-scrollbar, #transparencyReports::-webkit-scrollbar, 
    #interpretiveReports::-webkit-scrollbar, #assembliesReports::-webkit-scrollbar, 
    #capitalIncreaseReports::-webkit-scrollbar { width: 6px; }
    #codalReports::-webkit-scrollbar-track, #transparencyReports::-webkit-scrollbar-track,
    #interpretiveReports::-webkit-scrollbar-track, #assembliesReports::-webkit-scrollbar-track,
    #capitalIncreaseReports::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
    #codalReports::-webkit-scrollbar-thumb, #transparencyReports::-webkit-scrollbar-thumb,
    #interpretiveReports::-webkit-scrollbar-thumb, #assembliesReports::-webkit-scrollbar-thumb,
    #capitalIncreaseReports::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
    #codalReports::-webkit-scrollbar-thumb:hover { background: #a1a1a1; }

    /* Modal پیوست */
    .attachment-modal-overlay {
        display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0, 0, 0, 0.6); z-index: 10000; justify-content: center;
        align-items: center; backdrop-filter: blur(3px); animation: modalFadeIn 0.2s ease;
    }
    .attachment-modal-overlay.active { display: flex; }
    @keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
    .attachment-modal {
        background: #fff; border-radius: 10px; width: 90%; max-width: 900px;
        height: 50vh; max-height: 85vh; display: flex; flex-direction: column;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); overflow: hidden; animation: modalSlideIn 0.3s ease;
    }
    @keyframes modalSlideIn { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
    .attachment-modal-header {
        display: flex; justify-content: space-between; align-items: center;
        padding: 12px 18px; background: linear-gradient(135deg, #2980b9, #3498db);
        color: white; flex-shrink: 0;
    }
    .attachment-modal-title { font-size: 15px; font-weight: 600; font-family: IRANSansXFaNum, Vazir, Tahoma, sans-serif; }
    .attachment-modal-close {
        background: rgba(255, 255, 255, 0.2); border: none; color: white;
        width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
        font-size: 16px; display: flex; align-items: center; justify-content: center;
        transition: all 0.2s; font-weight: bold;
    }
    .attachment-modal-close:hover { background: rgba(255, 255, 255, 0.35); transform: rotate(90deg); }
    .attachment-modal-body { flex: 1; position: relative; overflow: hidden; background: #f5f6fa; }
    .attachment-modal-loading {
        position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
        font-size: 14px; color: #555; z-index: 1; background: white;
        padding: 12px 24px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    .attachment-modal-loading.hidden { display: none; }
    .attachment-modal-iframe { width: 100%; height: 100%; border: none; background: white; display: block; }

    /* تنظیمات ویژه صورت‌های مالی */
    #interpretiveReports .transparency-period {
        font-size: 12px; line-height: 1.6; white-space: normal; word-break: break-word;
        color: #1976d2; text-decoration: none; padding: 2px 0; flex: 1; font-weight: 500;
    }
    #interpretiveReports .transparency-period:hover { color: #0d47a1; text-decoration: underline; }
    #interpretiveReports .transparency-content { flex: 1; min-width: 0; }
    #interpretiveReports .transparency-item { align-items: flex-start; padding: 10px 14px; }
    #interpretiveReports .codal-icons { flex-shrink: 0; }
    #interpretiveReports .transparency-publish-date { flex-shrink: 0; }

    @media (max-width: 780px) {
        .sticky-header { margin: -20px -20px 0 -20px; padding-left: 15px; padding-right: 15px; }
        .transparency-header, .transparency-item { padding: 10px; gap: 8px; flex-direction: column; align-items: stretch; }
        .transparency-icons { min-width: auto; justify-content: flex-start; }
        .transparency-icon { width: 26px; height: 26px; font-size: 12px; }
        .transparency-period { font-size: 12px; }
        .transparency-title { font-size: 11px; }
        .transparency-publish-date { font-size: 11px; min-width: auto; }
        .codal-header, .codal-item { padding: 8px 10px; gap: 8px; }
        .codal-icons { min-width: 90px; }
        .codal-icon { width: 26px; height: 26px; font-size: 12px; }
        .codal-period { font-size: 12px; }
        .codal-publish-date { font-size: 11px; min-width: 80px; }
    }

/* ===== بازطراحی ظاهری؛ بدون تغییر منطق صفحه ===== */
@font-face { font-family: Vazirmatn; src: url('../font/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('../font/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('../font/Vazirmatn-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('../font/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
:root { color-scheme: light; --ui-ink:#182b45; --ui-muted:#65758b; --ui-line:#dce5ef; --ui-blue:#245a91; --ui-blue-dark:#183e68; --ui-bg:#f3f6fa; --ui-card:#fff; }
html { scroll-behavior:smooth; }
body { margin:0; padding:18px clamp(10px,2vw,28px) 30px; background:var(--ui-bg); color:var(--ui-ink); font-family:Vazirmatn,Tahoma,sans-serif; line-height:1.65; }
button,input,select,textarea { font:inherit; }
.sticky-header { position:sticky; top:0; z-index:500; margin:-18px calc(-1 * clamp(10px,2vw,28px)) 18px; padding:12px clamp(10px,2vw,28px) 14px; background:rgba(255,255,255,.97); border-bottom:1px solid var(--ui-line); box-shadow:0 5px 18px rgba(26,49,78,.07); backdrop-filter:blur(10px); }
.sticky-header h2 { text-align:right; font-size:19px; font-weight:700; color:var(--ui-blue-dark); margin:0 0 12px; }
.header-main-row { align-items:center; gap:14px 20px; }
.header-right-group { flex:1 1 540px; min-width:0; gap:12px; align-items:center; }
.header-right-group .search-block { flex:1 1 270px; width:auto; min-width:210px; }
#searchBox,#asin { min-height:39px; padding:8px 12px; border:1px solid #cbd7e5; border-radius:9px; background:#fff; color:var(--ui-ink); font-family:Vazirmatn,Tahoma,sans-serif; transition:border-color .18s,box-shadow .18s; }
#searchBox:focus,#asin:focus,#daysInput:focus { outline:none; border-color:#5486b8; box-shadow:0 0 0 3px rgba(48,104,162,.13); }
#searchResults { top:calc(100% + 5px); border:1px solid var(--ui-line); border-radius:10px; box-shadow:0 12px 30px rgba(22,43,70,.14); overflow:auto; max-height:320px; }
#searchResults .result-item { padding:9px 12px; border-bottom:1px solid #edf1f6; }
#searchResults .result-item:hover { background:#f0f6fc; }
.isin-block { gap:7px; }
.isin-block label { color:var(--ui-muted); font-size:12px; white-space:nowrap; }
#asin { width:195px; max-width:100%; }
#lVal30Display { color:var(--ui-blue-dark); font-weight:700; min-width:unset; }
#lastUpdate { color:var(--ui-muted); font-size:11px; }
.tsetmc-btn { min-height:35px; padding:6px 11px; border-radius:8px; background:var(--ui-blue); font-family:Vazirmatn,Tahoma,sans-serif; font-size:12px; font-weight:600; }
.tsetmc-btn:hover { background:var(--ui-blue-dark); }
.codal-btn { background:#536b88; }
.codal-btn:hover { background:#3e536d; }
.header-left-group { gap:10px; flex-wrap:wrap; }
.header-client-type,.header-best-limits { border:1px solid var(--ui-line); border-radius:9px; overflow:hidden; background:#fff; }
.header-client-type table,.header-best-limits table { box-shadow:none; border-radius:0; }
#cards { display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); align-items:start; gap:15px; margin-top:16px; }
#cards > .card, #cards > .card-group { grid-column:span 3; min-width:0; width:100%; box-sizing:border-box; }
#cards > .card-group { display:flex; flex-direction:column; gap:15px; }
#cards > .row { grid-column:1 / -1; min-width:0; width:100%; }
#chartCard { min-width:0; width:100%; }
.card { min-width:0; padding:12px; background:var(--ui-card); border:1px solid var(--ui-line); border-radius:12px; box-shadow:0 3px 12px rgba(24,48,78,.045); overflow:hidden; }
.card h3 { display:flex; align-items:center; justify-content:center; gap:8px; min-height:38px; margin:-1px -1px 10px; padding:7px 10px; background:#edf4fb; border:1px solid #dce8f5; border-radius:8px; color:var(--ui-blue-dark); font-size:13px; font-weight:700; }
.card table { font-family:Vazirmatn,Tahoma,sans-serif; font-size:11px; }
.card th { background:#e9f1f9; color:#244b75; font-weight:700; border-color:#dce5ef; }
.card td,.card th { padding:6px 7px; border-color:#e3eaf2; }
.card tr:nth-child(even) { background:#f7f9fc; }
.card details summary { padding:8px 10px; border:1px solid #e0e9f3; border-radius:7px; background:#f2f7fc; color:#254d78; }
.card details summary:hover { background:#e7f0fa; }
#chart_div { min-height:320px; }
#daysInput { border:1px solid #cbd7e5; border-radius:7px; background:#fff; }
#codalTablesRow { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:15px; align-items:start; }
#codalTablesRow > .card { width:100%; min-width:0; box-sizing:border-box; }
.refresh-codal-btn { border:1px solid #d5e1ee; border-radius:7px; background:#fff; color:var(--ui-blue); cursor:pointer; padding:3px 7px; }
.refresh-codal-btn:hover { background:#e4eef8; }
.codal-count { display:inline-flex; align-items:center; justify-content:center; min-width:23px; padding:1px 6px; border-radius:20px; background:#dceafa; color:#244f7e; font-size:11px; }
.attachment-modal-overlay { z-index:2000; }
.attachment-modal { border:1px solid var(--ui-line); border-radius:14px; box-shadow:0 20px 70px rgba(13,32,56,.25); overflow:hidden; }
.attachment-modal-header { background:#f0f5fb; color:var(--ui-blue-dark); }
@media (max-width:1250px) { #cards > .card, #cards > .card-group { grid-column:span 6; } .header-main-row { align-items:stretch; } .header-left-group { flex:1 1 100%; } }
@media (max-width:780px) {
 body { padding:10px 10px 22px; }
 .sticky-header { position:relative; margin:-10px -10px 14px; padding:12px 10px; }
 .sticky-header h2 { font-size:17px; }
 .header-right-group { flex-direction:column; align-items:stretch; }
 .header-right-group .search-block { flex-basis:auto; min-width:0; width:100%; }
 .isin-block { align-items:stretch; }
 #asin { flex:1 1 130px; width:auto; }
 #lVal30Display { flex:1 1 100%; }
 .header-left-group { flex-direction:row; }
 .header-client-type { width:calc(40% - 5px); }
 .header-best-limits { width:calc(60% - 5px); }
 #cards { display:flex; flex-direction:column; gap:12px; }
 #cards > .card, #cards > .card-group, #cards > .row { width:100%; min-width:0; }
 #cards > .card-group { gap:12px; }
 .card { padding:9px; }
 .card table { display:block; overflow-x:auto; max-width:100%; }
 #chart_div { height:340px !important; min-height:280px; }
 #codalTablesRow { display:flex; flex-direction:column; }
 #codalTablesRow > .card { width:100%; }
}
@media (max-width:420px) { .isin-block { gap:6px; } .tsetmc-btn { flex:1 1 auto; justify-content:center; } .header-client-type,.header-best-limits { width:100%; } .header-left-group { flex-direction:column; } }


/* ===== اصلاح چیدمان طبق بازخورد کاربر ===== */
.header-right-group .search-block {
    flex: 0 0 230px;
    width: 230px;
    max-width: 100%;
    min-width: 190px;
}

/* جهت شبکه LTR است تا نمودار در گوشه بالای چپ قرار بگیرد؛ محتوای کارت‌ها RTL می‌ماند. */
#cards {
    display: grid !important;
    direction: ltr;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
    gap: 14px;
}
#cards > .card,
#cards > .card-group {
    grid-column: span 3;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    direction: rtl;
}
#cards > #chartCard {
    grid-column: span 6;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    direction: rtl;
}
#cards > .row {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    direction: ltr;
}
#chartCard #chart_div {
    width: 100% !important;
    max-width: 100%;
    height: 350px !important;
    min-height: 280px;
}

/* چهار کارت اول گزارش کدال در یک ردیف؛ کارت پنجم در ردیف بعدی و با همان عرض */
#codalTablesRow {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    direction: ltr;
    align-items: stretch;
    gap: 14px;
}
#codalTablesRow > .card,
#codalCard,
#transparencyCard,
#interpretiveCard,
#assembliesCard,
#capitalIncreaseCard {
    min-width: 0;
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    direction: rtl;
}

/* کارت‌های جمع‌شونده */
.card h3 { position: relative; padding-left: 42px; }
.collapse-card-btn {
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    padding: 0;
    border: 1px solid #cbd9e8;
    border-radius: 7px;
    background: #fff;
    color: #244f7e;
    font: 700 17px/1 Vazirmatn, Tahoma, sans-serif;
    cursor: pointer;
}
.collapse-card-btn:hover { background: #e4eef8; }
.card.is-collapsed > :not(h3) { display: none !important; }
.card.is-collapsed { align-self: start; }
.card.is-collapsed h3 { margin-bottom: 0; }

@media (max-width: 1450px) {
    #codalTablesRow { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    #cards > #chartCard { grid-column: span 6; }
    #cards > .card,
    #cards > .card-group { grid-column: span 3; }
    #codalTablesRow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
    .header-right-group .search-block {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }
    #cards { display: flex !important; flex-direction: column; direction: rtl; }
    #cards > #chartCard,
    #cards > .card,
    #cards > .card-group,
    #cards > .row { width: 100%; min-width: 0; }
    #chartCard #chart_div { height: 320px !important; }
    #codalTablesRow { display: grid !important; grid-template-columns: 1fr; }
}

/* ===== چیدمان گزارش کدال کنار نمودار و اطلاعات نماد ===== */
.sticky-header { padding-top: 7px; padding-bottom: 9px; margin-bottom: 10px; }
.sticky-header h2 { display:flex; align-items:baseline; justify-content:flex-start; flex-wrap:wrap; gap:0 18px; margin-bottom:7px; }
#companyValueDisplay { display:inline-block; color:#16724a; font-size:13px; font-weight:600; white-space:nowrap; }
.header-main-row { flex-wrap:nowrap; gap:14px; }
.header-right-group { flex:1 1 auto; min-width:0; flex-wrap:nowrap; gap:10px; }
.header-right-group .search-block { flex:0 1 230px; width:230px; min-width:180px; }
.header-right-group .isin-block { flex:1 1 auto; min-width:0; flex-wrap:nowrap; }
#asin { width:170px; min-width:135px; }
#lVal30Display { white-space:nowrap; }
.header-left-group { flex:0 1 auto; min-width:0; }
#lastUpdate { margin:2px 0 0; }

#cards.page-content { display:block !important; margin-top:8px; }
.market-report-layout { display:grid; direction:ltr; grid-template-columns:minmax(0, 4fr) minmax(0, 6fr); gap:14px; align-items:start; }
#chartCard { grid-column:auto; width:100%; min-width:0; max-width:100%; direction:rtl; }
#chartCard #chart_div { height:350px !important; min-height:280px; }
.codal-workspace { display:grid; direction:ltr; grid-template-columns:minmax(0, 1fr) 174px; gap:10px; align-items:start; min-width:0; }
.codal-panel-host { min-width:0; direction:rtl; }
#codalTablesRow { display:block !important; width:100%; min-width:0; direction:rtl; }
#codalTablesRow > .codal-report-panel { display:none; width:100%; min-width:0; max-width:100%; margin:0; box-sizing:border-box; }
#codalTablesRow > .codal-report-panel.is-active { display:block; }
.codal-report-panel { overflow:hidden; }
.codal-report-panel h3 { justify-content:flex-start; }
.codal-sidebar { display:flex; flex-direction:column; gap:7px; direction:rtl; min-width:0; }
.codal-tab { display:flex; align-items:center; justify-content:space-between; gap:7px; width:100%; min-height:42px; padding:9px 10px; border:1px solid #dce5ef; border-radius:9px; background:#fff; color:#294967; text-align:right; font-family:Vazirmatn,Tahoma,sans-serif; font-size:12px; font-weight:600; cursor:pointer; transition:background .15s,border-color .15s,color .15s; }
.codal-tab:hover { background:#f0f6fc; border-color:#b9cfe6; }
.codal-tab.is-active { background:#e7f0fa; color:#173f69; border-color:#7fa5ce; box-shadow:inset -3px 0 #245a91; }
.codal-tab span { display:inline-flex; align-items:center; justify-content:center; min-width:23px; padding:1px 5px; border-radius:15px; background:#dceafa; color:#244f7e; font-size:10px; }
.instrument-data-layout { display:grid; direction:rtl; grid-template-columns:repeat(auto-fit, minmax(min(100%, 270px), max-content)); align-items:start; justify-content:start; gap:14px; margin-top:14px; }
.instrument-data-layout > .info-card { width:max-content; max-width:100%; min-width:0; box-sizing:border-box; }
.instrument-data-layout > .info-card table { width:auto; max-width:100%; }
.instrument-data-layout > .info-card table table { width:100%; }
.instrument-data-layout > .info-card { overflow-x:auto; }

@media (max-width:1250px) {
 .header-main-row { flex-wrap:wrap; }
 .header-right-group { flex:1 1 100%; }
 .header-left-group { flex:1 1 100%; }
 .market-report-layout { grid-template-columns:minmax(0, 1fr) minmax(0, 1.35fr); }
 .codal-workspace { grid-template-columns:minmax(0, 1fr) 150px; }
 .instrument-data-layout { grid-template-columns:repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
 .instrument-data-layout > .info-card { width:100%; }
 .instrument-data-layout > .info-card table { width:100%; }
}
@media (max-width:780px) {
 .sticky-header { padding-top:10px; }
 .sticky-header h2 { gap:4px 10px; }
 #companyValueDisplay { font-size:12px; white-space:normal; }
 .header-main-row,.header-right-group { flex-direction:column; align-items:stretch; }
 .header-right-group .search-block { width:100%; min-width:0; flex:1 1 auto; }
 .header-right-group .isin-block { flex-wrap:wrap; }
 #asin { flex:1 1 140px; width:auto; }
 .market-report-layout { display:flex; flex-direction:column; }
 #chartCard,.codal-workspace { width:100%; }
 .codal-workspace { display:flex; flex-direction:column-reverse; }
 .codal-sidebar { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:100%; }
 .codal-panel-host { width:100%; }
 .instrument-data-layout { display:grid; grid-template-columns:1fr; }
 .instrument-data-layout > .info-card { width:100%; }
 .instrument-data-layout > .info-card table { width:100%; }
}
