/* ============================
   Global
============================ */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background-color: #f7f8fc;
    color: #2d2d3a;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ============================
   Navbar
============================ */
.navbar {
    width: 95%;
    max-width: 1100px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 10px;
    border-bottom: 1px solid #eee;
}

.logo {
    font-weight: 900;
    color: #e91e63;
    font-size: 1.2rem;
}

.nav-left a, .nav-left button {
    text-decoration: none;
    color: #555;
    margin-right: 18px;
    font-size: 0.9rem;
    transition: color .2s;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}
.nav-left a:hover, .nav-left button:hover { color: #e91e63; }

/* ============================
   Dashboard Cards
============================ */
.dashboard {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0;
    width: 95%;
    max-width: 1100px;
}

.card {
    flex: 1;
    min-width: 150px;
    background: #fff;
    padding: 16px 14px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    text-align: center;
    border-top: 3px solid #e91e63;
}
.card h3 { font-size: 0.78rem; color: #888; margin: 0 0 6px; font-weight: 500; }
.card p  { font-size: 1.1rem; font-weight: 700; color: #2d2d3a; margin: 0; }

/* ============================
   Chart box
============================ */
.show-box {
    width: 95%;
    max-width: 1100px;
    margin: 10px 0;
    padding: 20px 25px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    text-align: center;
    font-weight: 700;
    color: #e91e63;
}
#portfolioChart {
    width: 240px !important;
    height: 240px !important;
    margin: 10px auto 0;
    display: block;
}

/* ============================
   Container
============================ */
.container {
    width: 95%;
    max-width: 1100px;
    margin: 20px 0;
    padding: 20px 25px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

/* ============================
   Headings
============================ */
h1, h2, h3 {
    font-weight: 700;
    margin-bottom: 10px;
    color: #e91e63;
    font-size: 1.05rem;
}

/* ============================
   Forms
============================ */
form {
    margin-bottom: 0;
    background: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
}

label {
    font-size: 0.82rem;
    color: #666;
    display: block;
    margin-bottom: 2px;
    margin-top: 8px;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
select {
    width: 100%;
    padding: 8px 10px;
    margin: 3px 0 8px;
    border: 1px solid #ddd;
    border-radius: 7px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
    background: #fafafa;
    color: #1a1a2e;
}
input:focus, select:focus {
    border-color: #e91e63;
    box-shadow: 0 0 0 3px rgba(233,30,99,0.12);
    outline: none;
    background: #fff;
}

button {
    background: linear-gradient(135deg, #e91e63, #c2185b);
    color: #fff;
    padding: 9px 22px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    transition: opacity .2s, transform .1s;
}
button:hover  { opacity: .9; }
button:active { transform: scale(.97); }

/* ============================
   Tables - portfolio only
============================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 0.85rem;
}
table th, table td {
    padding: 9px 10px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}
table th {
    background: #e91e63;
    color: #fff;
    font-weight: 600;
}
table tr:nth-child(even) { background: #fdf2f6; }
table tr:hover           { background: #ffe6f0; }

/* ============================
   Colours
============================ */
.pos  { color: #1aa558; font-weight: 700; }
.neg  { color: #e53935; font-weight: 700; }
.disc { color: #7c3aed; font-weight: 700; }
.div-highlight { color: #d97706; }

/* ============================
   Modal
============================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0; right: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.45);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}
.modal-content {
    background: #fff;
    width: 90%;
    max-width: 480px;
    margin: 60px auto;
    padding: 24px 22px;
    border-radius: 14px;
    position: relative;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
    max-height: 85vh;
    overflow-y: auto;
}
.modal-wide {
    width: 740px;
    max-width: 96vw;
    max-height: 88vh;
    overflow-y: auto;
}
.close {
    position: absolute;
    top: 12px;
    left: 16px;
    font-size: 22px;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
    transition: color .2s;
}
.close:hover { color: #e91e63; }

/* ============================
   Form helpers
============================ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}
@media(max-width:600px){ .form-grid { grid-template-columns: 1fr; } }

.inline-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.inline-row select { flex: 1; margin: 3px 0 8px; }
.inline-row input  { margin: 3px 0 8px; }

.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}
.toggle-row input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: #e91e63;
    margin: 0;
}
.toggle-row label { margin: 0; font-size: 0.88rem; cursor: pointer; }

/* ============================
   Tooltip
============================ */
.col-tooltip {
    position: fixed;
    background: #1a1a2e;
    color: #f0f0f0;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    max-width: 260px;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    line-height: 1.4;
}

/* ============================
   Report wrapper
============================ */
.report-wrapper {
    width: 95%;
    max-width: 1200px;
    margin: 24px 0 40px;
}

.report-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-edit {
    background: #fff;
    color: #e91e63;
    border: 2px solid #e91e63;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
}
.btn-edit:hover { background: #e91e63; color: #fff; }

.export-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.export-group span { font-size: 0.85rem; color: #888; }
.export-group button {
    background: #fff;
    color: #444;
    border: 1.5px solid #ddd;
    padding: 7px 16px;
    font-size: 0.83rem;
    border-radius: 7px;
    font-weight: 600;
    transition: .2s;
}
.export-group button:hover { border-color: #e91e63; color: #e91e63; background: #fff5f8; }

/* ============================
   Report Header Card
============================ */
.report-header-card {
    background: linear-gradient(135deg, #e91e63 0%, #880e4f 100%);
    color: #fff;
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 20px;
    box-shadow: 0 6px 24px rgba(233,30,99,0.28);
}
.rhc-title {
    font-size: 0.72rem;
    font-weight: 500;
    opacity: .75;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.rhc-stock {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.rhc-reinvest-badge {
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 20px;
}
.rhc-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.rhc-stat {
    background: rgba(255,255,255,0.14);
    border-radius: 10px;
    padding: 10px 16px;
    min-width: 140px;
    flex: 1;
}
.rhc-label { font-size: 0.7rem; opacity: .8; display: block; margin-bottom: 3px; }
.rhc-val   { font-size: 1rem; font-weight: 700; display: block; }
.rhc-val.pos  { color: #afffca; }
.rhc-val.disc { color: #d8b4fe; }
.rhc-sub   { font-size: 0.72rem; opacity: .85; display: block; margin-top: 4px; }

.rhc-goal { border: 1.5px solid rgba(255,255,255,0.3); }
.goal-met     { background: rgba(16,185,129,0.25) !important; }
.goal-pending { background: rgba(251,191,36,0.2)  !important; }

/* ============================
   Year blocks
============================ */
.year-block {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    margin-bottom: 20px;
    overflow: hidden;
}
.year-block-header {
    background: linear-gradient(90deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.year-label { font-size: 1rem; font-weight: 800; }
.year-meta  { font-size: 0.76rem; opacity: .85; }
.year-meta strong { color: #f9a8d4; }
.goal-pct { color: #fde68a; font-size: 0.72rem; }

/* ============================
   Monthly table
============================ */
.monthly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.79rem;
}

/* flat single-colour header — no alternating tones */
.monthly-table thead tr:first-child th {
    background: #1a1a2e;
    color: #e2e8f0;
    padding: 9px 10px;
    font-weight: 600;
    white-space: nowrap;
    border: none;
}

/* grouped column sub-headers */
.monthly-table thead tr.th-sub th {
    background: #16213e;
    color: #cbd5e1;
    padding: 5px 10px;
    font-size: 0.72rem;
    border-bottom: 1px solid #0f3460;
}

/* column group labels in first header row */
.th-group-main {
    background: #1a1a2e !important;
    border-left: 2px solid #e91e63 !important;
    border-right: 2px solid #e91e63 !important;
}
.th-group-reinvest {
    background: #1a1a2e !important;
    border-left: 2px solid #7c3aed !important;
    border-right: 2px solid #7c3aed !important;
}

.monthly-table td {
    padding: 7px 10px;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
    white-space: nowrap;
    color: #374151;
}
.monthly-table tr:nth-child(even) td { background: #f9fafb; }
.monthly-table tr:hover td           { background: #fff5f8; }

/* dividend rows */
.monthly-table tr.div-row td        { background: #fff8e1 !important; }
.monthly-table tr.div-row:hover td  { background: #fff3cd !important; }

.div-cell { color: #d97706; font-weight: 700; }
.div-cell small { font-weight: 400; color: #92400e; display: block; font-size: 0.7rem; }

/* year totals footer row */
.monthly-table tfoot tr.year-totals td {
    background: #1a1a2e !important;
    color: #f1f5f9;
    font-size: 0.8rem;
    border-top: 2px solid #e91e63;
    padding: 9px 10px;
}

/* source badge */
.source-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    background: #f3f4f6;
    color: #6b7280;
}
.source-badge.active {
    background: #fce7f3;
    color: #be185d;
    font-weight: 600;
}

/* goal row highlight in yearly table */
.goal-row td { background: #ecfdf5 !important; }
.goal-row:hover td { background: #d1fae5 !important; }

/* ============================
   Goal progress bar
============================ */
.goal-bar-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 80px;
}
.goal-bar {
    height: 6px;
    background: linear-gradient(90deg, #e91e63, #f59e0b);
    border-radius: 3px;
    transition: width .3s;
    min-width: 2px;
}
.goal-bar-wrap span { font-size: 0.72rem; white-space: nowrap; }

/* ============================
   Responsive
============================ */
@media(max-width: 768px) {
    .container, .report-wrapper,
    .dashboard, .show-box, .navbar { width: 98%; }
    .modal-wide   { width: 97vw; }
    .rhc-stats    { gap: 8px; }
    .rhc-stat     { min-width: 120px; }
    .report-actions { flex-direction: column; align-items: flex-start; }
    .year-block-header { flex-direction: column; align-items: flex-start; }
}

/* ============================
   Monthly table — group headers
============================ */
.th-group {
    background: #e91e63 !important;
    color: #fff !important;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.th-group-alt {
    background: #1565c0 !important;
}
.th-sub-cell {
    background: #2d2d3a !important;
    color: #cbd5e1 !important;
    font-size: 0.7rem !important;
    font-weight: 500 !important;
}

/* Year total footer row */
.year-total-row td {
    background: #1a1a2e !important;
    color: #f1f5f9 !important;
    font-size: 0.8rem;
    border-top: 2px solid #e91e63;
}
.year-total-row td strong { color: #fde68a; }
.year-total-row td strong.pos { color: #86efac; }

/* Tooltip */
.tooltip-box {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #1a1a2e;
    color: #f1f5f9;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    max-width: 260px;
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    pointer-events: none;
}
.th-tip {
    cursor: help;
    border-bottom: 1px dashed rgba(255,255,255,0.4);
    padding-bottom: 1px;
}

/* Summary card passive goal states */
.rhc-stat.goal-reached { background: rgba(134,239,172,0.15); border: 1px solid rgba(134,239,172,0.4); }
.rhc-stat.goal-pending { background: rgba(251,191,36,0.1);  border: 1px solid rgba(251,191,36,0.3); }
.rhc-sub { display: block; font-size: 0.75rem; margin-top: 4px; opacity: .85; }
.rhc-reinvest-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 2px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 8px;
    vertical-align: middle;
}

/* ============================
   imexc.php - Goal progress
============================ */
.imagine-form {
    background: #fff;
    padding: 24px 28px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-bottom: 30px;
}

.goal-progress-wrap {
    margin-top: 12px;
    width: 100%;
}
.goal-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    margin-bottom: 6px;
    opacity: 0.9;
}
.goal-progress-bars {
    display: flex;
    gap: 4px;
    height: 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    overflow: hidden;
}
.goal-bar-current {
    background: #f59e0b;
    transition: width 0.3s;
}
.goal-bar-projected {
    background: #10b981;
    transition: width 0.3s;
}

/* Monthly table styles */
.table-scroll { overflow-x: auto; }
.monthly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.monthly-table th {
    background: #1a1a2e;
    color: #e2e8f0;
    padding: 9px 10px;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.75rem;
}
.monthly-table td {
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
    white-space: nowrap;
    color: #374151;
}
.monthly-table tr:nth-child(even) td { background: #f9fafb; }
.monthly-table tr:hover td           { background: #fff5f8; }

.div-row td { background: #fff8e1 !important; }
.div-row:hover td { background: #fff3cd !important; }
.div-cell { color: #d97706; font-weight: 700; }
.div-cell small { font-weight: 400; color: #92400e; display: block; font-size: 0.7rem; }

.source-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    background: #f3f4f6;
    color: #6b7280;
}
.source-badge.active {
    background: #fce7f3;
    color: #be185d;
    font-weight: 600;
}

.th-group {
    background: #e91e63 !important;
    color: #fff !important;
    font-weight: 700;
}
.th-group-alt {
    background: #1565c0 !important;
}
.th-sub-cell {
    background: #2d2d3a !important;
    color: #cbd5e1 !important;
    font-size: 0.7rem !important;
    font-weight: 500 !important;
}

.year-total-row td {
    background: #1a1a2e !important;
    color: #f1f5f9 !important;
    font-size: 0.8rem;
}
.year-total-row td strong { color: #fde68a; }
.year-total-row td strong.pos { color: #86efac; }

.goal-row td { background: #ecfdf5 !important; }
.goal-row:hover td { background: #d1fae5 !important; }

/* ============================
   imexc.php - Step Form
============================ */
.form-wrapper {
    background: #fff;
    padding: 30px 35px;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    margin-bottom: 30px;
    transition: all 0.4s ease;
    max-height: 10000px;
    overflow: visible;
}

.form-wrapper.collapsed {
    max-height: 0;
    padding: 0 35px;
    margin-bottom: 0;
    overflow: hidden;
    opacity: 0;
}

.step-section {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-title {
    color: #e91e63;
    font-size: 1.15rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.form-row {
    margin-bottom: 16px;
}

.step-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-primary {
    background: linear-gradient(135deg, #e91e63, #c2185b);
    color: #fff;
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-secondary {
    background: #fff;
    color: #e91e63;
    border: 2px solid #e91e63;
    padding: 10px 26px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-secondary:hover { background: #fff5f8; }

.edit-btn-wrapper {
    text-align: center;
    margin: 20px 0 30px;
}

.btn-edit-main {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: #fff;
    padding: 14px 40px;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(76,175,80,0.3);
    transition: 0.2s;
}
.btn-edit-main:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(76,175,80,0.4); }

/* Stock form blocks */
#stocksContainer {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.stock-form-block {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px 24px;
    position: relative;
}

.stock-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.stock-form-header h4 {
    margin: 0;
    color: #1a1a2e;
    font-size: 1rem;
}

.btn-remove {
    background: #ef4444;
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: 0.2s;
}
.btn-remove:hover { background: #dc2626; transform: scale(1.1); }

/* Goal progress bars */
.goal-stat {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.goal-bars {
    margin-top: 12px;
}

.goal-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 6px;
    color: #78350f;
}

.goal-bar-track {
    height: 14px;
    background: rgba(120,53,15,0.15);
    border-radius: 8px;
    overflow: hidden;
}

.goal-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #10b981);
    border-radius: 8px;
    transition: width 0.5s ease;
}

/* Stock section */
.stock-section {
    margin-bottom: 40px;
}

.stock-section h3 {
    color: #1a1a2e;
    font-size: 1.2rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 3px solid #e91e63;
}

/* Reinvest column */
.reinvest-cell {
    background: #f0fdf4 !important;
}
.reinvest-badge {
    display: inline-block;
    background: #10b981;
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}
.reinvest-source {
    color: #059669;
    font-size: 0.7rem;
}

/* Goal reminder in step 2 */
.goal-reminder {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid #f59e0b;
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1rem;
}
.goal-reminder strong {
    color: #92400e;
    font-size: 1.3rem;
    margin: 0 6px;
}

.remainder-text {
    color: #dc2626;
    font-size: 0.68rem;
}

/* ============================
   imexc.php - unified table styles
============================ */
.unified-table {
    font-size: 0.78rem;
    min-width: 100%;
}

.th-stock-group {
    background: #e91e63 !important;
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    border-right: 3px solid #fff;
    text-align: center;
}
.th-stock-group-alt {
    background: #1565c0 !important;
}

.th-sub {
    background: #2d3748 !important;
    color: #cbd5e1 !important;
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    padding: 6px 8px !important;
}

.th-totals {
    background: #fbbf24 !important;
    color: #78350f !important;
    font-weight: 700 !important;
}

.month-cell {
    background: #f3f4f6;
    font-weight: 600;
    color: #1a1a2e;
}

.bought-detail {
    color: #6b7280;
    font-size: 0.7rem;
    font-weight: 400;
}

.reinvest-detail {
    color: #059669;
    font-weight: 600;
}

.year-stock-summary {
    display: inline-block;
    margin: 0 10px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    font-size: 0.85rem;
}
.year-stock-summary strong { color: #fbbf24; }

.rhc-stocks-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
    justify-content: center;
}
.stock-pill {
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
}

.btn-mini {
    margin-right: 12px;
    padding: 4px 12px;
    background: rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #78350f;
}
.btn-mini:hover { background: rgba(0,0,0,0.2); }

.btn-reset {
    display: inline-block;
    margin-right: 10px;
    padding: 12px 24px;
    background: #fff;
    color: #ef4444;
    border: 2px solid #ef4444;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s;
}
.btn-reset:hover { background: #fef2f2; }

.goal-row td {
    background: #ecfdf5 !important;
    font-weight: 600;
}

/* ============================
   imexc.php - Hero Goal Card
============================ */
.hero-goal-card {
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 50%, #f43f5e 100%);
    border-radius: 24px;
    padding: 40px 36px;
    margin-bottom: 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(124,58,237,0.3);
}

.hero-bg-pattern {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(251,191,36,0.15) 0%, transparent 50%);
    pointer-events: none;
}

.hero-goal-content {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.hero-goal-circle-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    flex-shrink: 0;
}

.hero-goal-svg {
    width: 100%;
    height: 100%;
}

.progress-circle {
    transition: stroke-dashoffset 1.2s ease-out;
}

.hero-goal-percent {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-percent-num {
    font-size: 3.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #fbbf24, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.hero-percent-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 6px;
}

.hero-goal-info {
    flex: 1;
    min-width: 280px;
}

.hero-goal-title {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 10px;
    font-weight: 500;
}

.hero-goal-amount {
    margin-bottom: 24px;
}

.hero-amount-num {
    display: block;
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -1px;
    color: #fff;
    text-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.hero-amount-currency {
    display: block;
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 8px;
    font-weight: 500;
}

.hero-goal-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hero-stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.15);
    padding: 10px 16px;
    border-radius: 10px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 0.9rem;
}

.hero-stat-row.reached {
    background: rgba(16,185,129,0.3);
    border: 1px solid rgba(16,185,129,0.5);
}

.hero-stat-row.pending {
    background: rgba(251,191,36,0.2);
}

.hero-stat-icon { font-size: 1.1rem; }
.hero-stat-text { opacity: 0.95; }
.hero-stat-row strong { font-size: 1.1rem; }
.hero-stat-extra { opacity: 0.8; font-size: 0.85rem; margin-right: 4px; }

/* Journey */
.hero-journey {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.2);
    position: relative;
    z-index: 1;
}

.hero-journey-title {
    font-size: 0.95rem;
    margin-bottom: 14px;
    font-weight: 600;
    opacity: 0.95;
}

.hero-journey-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.journey-row {
    display: grid;
    grid-template-columns: 60px 1fr 80px;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}

.journey-year {
    font-weight: 700;
    opacity: 0.95;
}

.journey-bar-wrap {
    height: 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    overflow: hidden;
}

.journey-bar {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #fff);
    border-radius: 6px;
    transition: width 1s ease-out;
    box-shadow: 0 0 8px rgba(255,255,255,0.4);
}

.journey-row.journey-reached .journey-bar {
    background: linear-gradient(90deg, #10b981, #34d399);
    box-shadow: 0 0 12px rgba(16,185,129,0.6);
}

.journey-pct {
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ============================
   Compact Summary Cards
============================ */
.compact-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.compact-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #f3f4f6;
    transition: 0.2s;
}

.compact-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.cc-icon {
    font-size: 1.8rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fce7f3, #fbcfe8);
    border-radius: 10px;
    flex-shrink: 0;
}

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

.cc-label {
    font-size: 0.78rem;
    color: #6b7280;
    margin-bottom: 4px;
}

.cc-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: -0.5px;
}

.cc-value.pos { color: #059669; }
.cc-value.neg { color: #dc2626; }

/* Stocks list row */
.stocks-list-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: #fff;
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.stocks-list-label {
    font-weight: 700;
    color: #1a1a2e;
}

.stocks-list-row .stock-pill {
    background: linear-gradient(135deg, #e91e63, #c2185b);
    color: #fff;
    padding: 5px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* New tags */
.lump-tag {
    display: inline-block;
    color: #7c3aed;
    font-weight: 600;
    margin-top: 2px;
    font-size: 0.7rem;
}

.rem-detail {
    color: #6b7280;
    font-size: 0.7rem;
    font-weight: 400;
}

/* Mobile */
@media (max-width: 768px) {
    .hero-goal-card { padding: 24px 18px; }
    .hero-goal-content { gap: 20px; }
    .hero-goal-circle-wrap { width: 160px; height: 160px; margin: 0 auto; }
    .hero-percent-num { font-size: 2.5rem; }
    .hero-amount-num { font-size: 2.5rem; }
    .compact-summary { grid-template-columns: repeat(2, 1fr); }
    .cc-value { font-size: 1.1rem; }
}

/* ============================
   Export Buttons - Premium
============================ */
.report-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.export-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #fff;
    padding: 12px 18px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.export-label {
    font-weight: 700;
    color: #1a1a2e;
    margin-left: 4px;
    font-size: 0.95rem;
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}

.btn-export:active {
    transform: translateY(0);
}

.btn-excel { background: linear-gradient(135deg, #10b981, #059669); }
.btn-pdf   { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-image { background: linear-gradient(135deg, #f59e0b, #d97706); }
.btn-print { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.btn-share { background: linear-gradient(135deg, #ec4899, #be185d); }

/* ============================
   Loading Overlay
============================ */
.export-loading-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background: rgba(26, 26, 46, 0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.export-loading-box {
    background: #fff;
    padding: 36px 50px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
    min-width: 280px;
}

.export-spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border: 5px solid #fce7f3;
    border-top-color: #e91e63;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.export-loading-msg {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
}

/* ============================
   Export Mode (for image/pdf)
============================ */
.export-mode {
    background: #f9fafb;
    padding: 30px;
}
.export-mode .report-actions {
    display: none !important;
}

/* ============================
   Print Mode
============================ */
@media print {
    body * {
        visibility: hidden;
    }
    .report-wrapper, .report-wrapper * {
        visibility: visible;
    }
    .report-wrapper {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .report-actions {
        display: none !important;
    }
    .navbar, .container > h2, .form-wrapper, .edit-btn-wrapper {
        display: none !important;
    }
    .year-block {
        page-break-inside: avoid;
    }
    .hero-goal-card {
        page-break-after: always;
    }
    .compact-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}

@page {
    size: A4 portrait;
    margin: 10mm;
}

/* Mobile adjustments for export buttons */
@media (max-width: 600px) {
    .export-group {
        justify-content: center;
        width: 100%;
    }
    .btn-export {
        flex: 1;
        min-width: 80px;
        padding: 10px 8px;
        font-size: 0.78rem;
    }
    .export-label {
        flex: 1 1 100%;
        text-align: center;
        margin-bottom: 6px;
    }
}

/* ============================
   Auth pages (login/register/install)
============================ */
.auth-wrapper {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
}

.auth-card {
    background: #fff;
    border-radius: 18px;
    padding: 40px 36px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 440px;
}
.install-card { max-width: 540px; }

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-icon {
    display: inline-block;
    font-size: 3rem;
    margin-bottom: 8px;
}

.auth-header h2 {
    color: #1a1a2e;
    margin: 8px 0 4px;
    font-size: 1.5rem;
}

.auth-sub {
    color: #6b7280;
    font-size: 0.9rem;
    margin: 0;
}

.auth-form .form-row {
    margin-bottom: 18px;
}

.auth-form label {
    display: block;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input[type="email"],
.auth-form input[type="number"],
.auth-form input[type="tel"] {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    transition: border 0.2s;
    box-sizing: border-box;
    color: #1a1a2e !important;
    background: #fff !important;
}

.auth-form input::placeholder {
    color: #9ca3af;
}

.auth-form input:focus {
    outline: none;
    border-color: #e91e63;
}

.form-hint {
    display: block;
    color: #9ca3af;
    font-size: 0.78rem;
    margin-top: 4px;
}

.form-row-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-row-checkbox label {
    margin-bottom: 0 !important;
    font-weight: 500 !important;
    cursor: pointer;
}

.btn-auth-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #e91e63, #c2185b);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: 0.2s;
}
.btn-auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(233,30,99,0.3);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
    color: #6b7280;
    font-size: 0.9rem;
}
.auth-footer a {
    color: #e91e63;
    font-weight: 700;
    text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-weight: 500;
    font-size: 0.9rem;
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-right: 4px solid #ef4444;
}
.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-right: 4px solid #f59e0b;
}
.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-right: 4px solid #10b981;
}
.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-right: 4px solid #3b82f6;
}

.install-info {
    background: #fffbeb;
    padding: 12px 16px;
    border-radius: 10px;
    color: #92400e;
    margin-bottom: 18px;
    font-size: 0.9rem;
    border-right: 4px solid #f59e0b;
}
.install-success {
    text-align: center;
}
.install-success h3 {
    color: #059669;
    margin-bottom: 12px;
}
.install-steps {
    text-align: right;
    margin: 16px 0;
    line-height: 2;
    color: #1a1a2e;
}
.install-steps li {
    padding: 6px 0;
}

/* Navbar additions */
.nav-user {
    color: #e91e63;
    font-weight: 700;
    padding: 6px 12px;
    background: #fce7f3;
    border-radius: 20px;
    font-size: 0.88rem;
}
.nav-logout {
    color: #ef4444 !important;
}
.nav-left a.nav-login {
    background: #e91e63 !important;
    color: #fff !important;
    padding: 6px 16px !important;
    border-radius: 8px !important;
    font-weight: 700;
}
.nav-left a.nav-login:hover {
    background: #c2185b !important;
    color: #fff !important;
}
.nav-left a.nav-admin {
    background: #1a1a2e !important;
    color: #fbbf24 !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
}
.nav-left a.nav-admin:hover {
    background: #2a2a4e !important;
    color: #fbbf24 !important;
}
.logo-link {
    text-decoration: none;
}

/* ============================
   Admin Dashboard
============================ */
.admin-header {
    margin-bottom: 24px;
}
.admin-header h2 {
    color: #1a1a2e;
    margin-bottom: 4px;
}
.admin-subtitle {
    color: #6b7280;
    margin: 0;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 30px;
}

.admin-stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
    border: 1px solid #f3f4f6;
    transition: 0.2s;
}
.admin-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
.admin-stat-wide {
    grid-column: span 2;
    background: linear-gradient(135deg, #e91e63, #c2185b);
    color: #fff;
}

.ascat-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}
.ascat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 4px;
}
.admin-stat-wide .ascat-value { color: #fff; }

.ascat-label {
    color: #6b7280;
    font-size: 0.85rem;
}
.admin-stat-wide .ascat-label { color: rgba(255,255,255,0.9); }

.admin-section {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.admin-section h3 {
    color: #1a1a2e;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 3px solid #e91e63;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.admin-table th {
    background: #1a1a2e;
    color: #fff;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
}
.admin-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
}
.admin-table tr:hover td { background: #fdf2f6; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
}
.badge-admin {
    background: #1a1a2e;
    color: #fbbf24;
}
.badge-user {
    background: #e0e7ff;
    color: #3730a3;
}
.badge-info {
    background: #fef3c7;
    color: #78350f;
    margin-right: 4px;
}

.admin-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

.btn-mini-action {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-toggle    { background: #6366f1; color: #fff; }
.btn-reset-pwd { background: #f59e0b; color: #fff; }
.btn-delete    { background: #ef4444; color: #fff; }
.btn-mini-action:hover { transform: translateY(-1px); }

.text-muted {
    color: #9ca3af;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .admin-stat-wide { grid-column: span 1; }
    .admin-actions { flex-direction: column; }
    .admin-actions .btn-mini-action { width: 100%; }
}

/* Install page section titles */
.install-section-title {
    color: #e91e63;
    margin: 24px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #fce7f3;
    font-size: 1.05rem;
}
.install-section-title:first-of-type { margin-top: 16px; }

.install-success p {
    color: #6b7280;
    margin: 12px 0;
}

.install-success code,
.install-info code {
    background: #fce7f3;
    color: #be185d;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85em;
}

/* ============================
   Smart Stock Search (SAHMK)
============================ */
.stock-search-wrap {
    position: relative;
    margin-bottom: 14px;
}

#stockSearch {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #fce7f3;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23e91e63"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>') no-repeat 12px center;
    background-size: 18px;
    padding-left: 38px;
    box-sizing: border-box;
}

#stockSearch:focus {
    outline: none;
    border-color: #e91e63;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: #fff;
    border: 1px solid #fce7f3;
    border-radius: 10px;
    margin-top: 4px;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    display: none;
}

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f9fafb;
    transition: 0.15s;
}
.search-result-item:hover {
    background: #fdf2f6;
}
.search-result-item:last-child { border-bottom: none; }

.srt-name {
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.srt-meta {
    display: flex;
    gap: 8px;
    font-size: 0.78rem;
}

.srt-symbol {
    background: #e91e63;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-family: monospace;
}

.srt-market {
    background: #e0e7ff;
    color: #3730a3;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.search-loading,
.search-empty {
    padding: 14px;
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
}

/* ============================
   Update Prices Button & Result
============================ */
.nav-update-btn {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #fff !important;
    padding: 8px 16px !important;
    border-radius: 8px;
    font-weight: 700 !important;
}
.nav-update-btn:hover {
    transform: translateY(-1px);
}

.update-result {
    background: #fff;
    margin: 16px 0;
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.update-loading {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-size: 1.05rem;
}

.update-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}
.update-table th {
    background: #1a1a2e;
    color: #fff;
    padding: 10px;
    font-weight: 600;
    font-size: 0.88rem;
}
.update-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
}
.update-table tr:hover td {
    background: #fdf2f6;
}

.update-failed {
    margin: 8px 0;
    padding-right: 24px;
    color: #6b7280;
    font-size: 0.88rem;
}
.update-failed li {
    padding: 4px 0;
}

.btn-reload {
    margin-top: 16px;
    padding: 10px 20px;
    background: #e91e63;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}
.btn-reload:hover {
    background: #c2185b;
}

/* ============================
   Admin Tabs
============================ */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid #f3f4f6;
    flex-wrap: wrap;
}

.admin-tab {
    padding: 12px 22px;
    color: #6b7280;
    text-decoration: none;
    font-weight: 700;
    border-bottom: 3px solid transparent;
    transition: 0.2s;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.admin-tab:hover {
    color: #1a1a2e;
    background: #fdf2f6;
    border-radius: 8px 8px 0 0;
}

.admin-tab.active {
    color: #e91e63;
    border-bottom-color: #e91e63;
}

.tab-badge {
    background: #fce7f3;
    color: #be185d;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

.admin-tab.active .tab-badge {
    background: #e91e63;
    color: #fff;
}

.tab-badge-warn {
    background: #f59e0b !important;
    color: #fff !important;
    font-size: 0.85rem !important;
    width: 22px;
    height: 22px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
}

/* ============================
   Status List (Overview)
============================ */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 10px;
    background: #f9fafb;
    border-right: 4px solid #e5e7eb;
}

.status-item.status-ok {
    background: #ecfdf5;
    border-right-color: #10b981;
}
.status-item.status-warn {
    background: #fffbeb;
    border-right-color: #f59e0b;
}

.status-icon {
    font-size: 1.4rem;
}

.status-info {
    flex: 1;
}
.status-info strong {
    display: block;
    color: #1a1a2e;
    margin-bottom: 2px;
}
.status-info small {
    color: #6b7280;
    font-size: 0.85rem;
}

.status-action {
    padding: 6px 14px;
    background: #e91e63;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    transition: 0.2s;
}
.status-action:hover {
    background: #c2185b;
}

/* ============================
   Settings Cards
============================ */
.setting-card {
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: 0.2s;
}
.setting-card:hover {
    border-color: #fce7f3;
    background: #fff;
}

.setting-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.setting-header h4 {
    color: #1a1a2e;
    margin: 0 0 4px;
    font-size: 1.05rem;
}
.setting-header small {
    color: #6b7280;
    font-size: 0.85rem;
}

.btn-link {
    padding: 6px 14px;
    background: #fce7f3;
    color: #be185d;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    transition: 0.2s;
    white-space: nowrap;
}
.btn-link:hover {
    background: #e91e63;
    color: #fff;
}

.setting-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.setting-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.95rem;
    direction: ltr;
    text-align: left;
    background: #fff;
}
.setting-input:focus {
    outline: none;
    border-color: #e91e63;
}

.btn-icon {
    padding: 0 14px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 1rem;
}
.btn-icon:hover {
    border-color: #e91e63;
    background: #fdf2f6;
}

.setting-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn-save {
    padding: 10px 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}
.btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.btn-test {
    padding: 10px 20px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}
.btn-test:hover {
    background: #4f46e5;
}

.test-result {
    font-size: 0.88rem;
    padding-right: 8px;
    flex: 1;
    min-width: 100%;
    margin-top: 4px;
}
.test-ok      { color: #059669; font-weight: 700; }
.test-fail    { color: #dc2626; font-weight: 700; }
.test-loading { color: #6b7280; }

/* Settings list */
.settings-list {
    margin: 16px 0;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
}

.setting-row-info {
    flex: 1;
}
.setting-row-info strong {
    display: block;
    color: #1a1a2e;
    font-family: monospace;
}
.setting-row-info small {
    color: #6b7280;
    font-size: 0.82rem;
}

.setting-row-value code {
    background: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #be185d;
    border: 1px solid #fce7f3;
}

.empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 24px;
    font-style: italic;
}

.add-setting-details {
    margin-top: 20px;
}

.btn-add-setting {
    cursor: pointer;
    padding: 12px 18px;
    background: #fdf2f6;
    color: #e91e63;
    border-radius: 8px;
    font-weight: 700;
    list-style: none;
    transition: 0.2s;
    user-select: none;
    border: 2px dashed #fce7f3;
}
.btn-add-setting:hover {
    background: #fce7f3;
    border-color: #e91e63;
}
.btn-add-setting::-webkit-details-marker { display: none; }

/* Form row inside settings */
.setting-form .form-row {
    margin-bottom: 12px;
}
.setting-form .form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #1a1a2e;
    font-size: 0.9rem;
}
.setting-form .form-row input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    box-sizing: border-box;
}
.setting-form .form-row input:focus {
    outline: none;
    border-color: #e91e63;
}

@media (max-width: 600px) {
    .setting-header { flex-direction: column; }
    .admin-tab { flex: 1; justify-content: center; padding: 12px 8px; font-size: 0.85rem; }
}

/* ============================
   Code Input (verification)
============================ */
.code-input {
    text-align: center !important;
    font-size: 2rem !important;
    font-weight: 900 !important;
    letter-spacing: 12px !important;
    direction: ltr !important;
    font-family: 'Courier New', monospace !important;
}

.resend-form {
    text-align: center;
    margin: 20px 0;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.btn-resend {
    background: transparent;
    color: #e91e63;
    border: 2px solid #fce7f3;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}
.btn-resend:hover {
    background: #fdf2f6;
    border-color: #e91e63;
}

.resend-hint {
    display: block;
    color: #9ca3af;
    margin-top: 8px;
    font-size: 0.78rem;
}

/* ============================
   SMTP Settings Grid
============================ */
.smtp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.smtp-grid .form-row-full {
    grid-column: span 2;
}

.smtp-grid .form-row {
    margin-bottom: 0;
}

.smtp-grid select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    background: #fff;
    box-sizing: border-box;
}

.smtp-grid select:focus {
    outline: none;
    border-color: #e91e63;
}

@media (max-width: 600px) {
    .smtp-grid {
        grid-template-columns: 1fr;
    }
    .smtp-grid .form-row-full {
        grid-column: span 1;
    }
}

/* ============================
   Stock Details Modal
============================ */
.modal-large {
    max-width: 900px !important;
    width: 95% !important;
    max-height: 90vh;
    overflow-y: auto;
}

.btn-details {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}
.btn-details:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.stock-name-cell {
    font-weight: 700;
    color: #1a1a2e;
}

.details-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f3f4f6;
}

.details-title h2 {
    color: #1a1a2e;
    margin: 0 0 4px;
    font-size: 1.5rem;
}

.details-sub {
    color: #6b7280;
    margin: 0 0 16px;
}

.details-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.ds-card {
    background: linear-gradient(135deg, #fdf2f6, #fce7f3);
    padding: 14px;
    border-radius: 10px;
    text-align: center;
}

.ds-card span {
    display: block;
    color: #be185d;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.ds-card strong {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    flex-direction: row;
    flex-wrap: nowrap;
    color: #1a1a2e;
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.2;
}

/* تأكد من عدم انكسار الرمز إلى سطر جديد */
.ds-card strong .cur-amount {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: baseline !important;
    color: #1a1a2e !important;
}

.ds-card strong .cur-num,
.ds-card strong .cur-symbol {
    color: #1a1a2e !important;
    display: inline !important;
}

.ds-card strong .riyal-symbol {
    fill: #1a1a2e !important;
    display: inline-block !important;
    width: 0.85em !important;
    height: 0.85em !important;
}

.details-section {
    margin-top: 24px;
}

.details-section h3 {
    color: #1a1a2e;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 3px solid #e91e63;
    font-size: 1.05rem;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.details-table th {
    background: #1a1a2e;
    color: #fff;
    padding: 10px 8px;
    font-weight: 600;
    font-size: 0.82rem;
    text-align: center;
}

.details-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
}

.details-table tr:hover td {
    background: #fdf2f6;
}

.badge-tx-new {
    background: #d1fae5;
    color: #065f46;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-tx-div {
    background: #dbeafe;
    color: #1e40af;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.btn-edit-mini {
    background: #6366f1;
    color: #fff;
    margin-left: 4px;
}
.btn-edit-mini:hover { background: #4f46e5; }

.btn-delete-mini {
    background: #ef4444;
    color: #fff;
}
.btn-delete-mini:hover { background: #dc2626; }

.empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 24px;
    font-style: italic;
    background: #f9fafb;
    border-radius: 10px;
    margin: 0;
}

/* ============================
   Edit Form Overlay
============================ */
.edit-form-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.edit-form-card {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.edit-form-card h3 {
    margin: 0 0 20px;
    color: #1a1a2e;
    text-align: center;
    padding-bottom: 14px;
    border-bottom: 2px solid #fce7f3;
}

.edit-form-card .form-row {
    margin-bottom: 16px;
}

.edit-form-card label {
    display: block;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.edit-form-card input,
.edit-form-card select {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    box-sizing: border-box;
    background: #fff;
}

.edit-form-card input:focus,
.edit-form-card select:focus {
    outline: none;
    border-color: #e91e63;
}

.edit-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.edit-form-actions .btn-save {
    flex: 1;
    padding: 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.95rem;
    transition: 0.2s;
}
.edit-form-actions .btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}

.btn-cancel {
    padding: 12px 22px;
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}
.btn-cancel:hover {
    background: #e5e7eb;
    color: #1a1a2e;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .modal-large { 
        width: 100% !important; 
        max-width: 100% !important;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    .details-table {
        font-size: 0.78rem;
    }
    .details-table th,
    .details-table td {
        padding: 8px 4px;
    }
    .details-summary {
        grid-template-columns: 1fr;
    }
}

/* ============================
   مزايا التثبيت
============================ */
.install-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0;
}

.install-feature-item {
    background: linear-gradient(135deg, #fdf2f6, #fce7f3);
    padding: 14px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #fce7f3;
}

.install-feature-item strong {
    display: block;
    color: #be185d;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.install-feature-item span {
    color: #6b7280;
    font-size: 0.85rem;
}

@media (max-width: 500px) {
    .install-features {
        grid-template-columns: 1fr;
    }
}

/* بطاقات المعلومات */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.info-card-item {
    background: #f9fafb;
    padding: 14px 16px;
    border-radius: 10px;
    border-right: 3px solid #ec4899;
}

.info-card-item strong {
    display: block;
    color: #374151;
    font-size: 0.88rem;
    margin-bottom: 4px;
}

.info-card-item span {
    color: #1a1a2e;
    font-weight: 700;
}

.info-card-item a {
    color: #ec4899;
    text-decoration: none;
}

/* badges في جدول التعلم */
.badge-success {
    background: #d1fae5;
    color: #065f46;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-warn {
    background: #fef3c7;
    color: #92400e;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

/* ============================
   Modal بشكل أحلى — للإضافة
   (يطابق ستايل تعديل المعاملة)
============================ */
.modal-content.modal-form-styled {
    max-width: 520px;
    padding: 28px 26px;
}

.modal-form-styled h3 {
    margin: 0 0 20px;
    color: #1a1a2e;
    font-size: 1.25rem;
    border-bottom: 2px solid #fce7f3;
    padding-bottom: 12px;
}

.modal-form-styled .form-row {
    margin-bottom: 16px;
}

.modal-form-styled label {
    display: block;
    font-weight: 700 !important;
    color: #1a1a2e !important;
    margin-bottom: 6px !important;
    font-size: 0.9rem !important;
}

.modal-form-styled input[type="text"],
.modal-form-styled input[type="number"],
.modal-form-styled input[type="datetime-local"],
.modal-form-styled select {
    width: 100% !important;
    padding: 11px 14px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 10px !important;
    font-family: 'Tajawal', sans-serif !important;
    font-size: 0.95rem !important;
    box-sizing: border-box !important;
    background: #fff !important;
    color: #1a1a2e !important;
    margin: 0 !important;
}

.modal-form-styled input:focus,
.modal-form-styled select:focus {
    outline: none !important;
    border-color: #e91e63 !important;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1) !important;
}

.modal-form-styled .form-hint {
    display: block;
    color: #9ca3af;
    font-size: 0.78rem;
    margin-top: 4px;
}

/* صف فيه عمودين */
.modal-form-styled .form-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-form-styled .form-row-grid .form-row {
    margin-bottom: 16px;
}

/* أزرار الحفظ والإلغاء */
.modal-form-styled .edit-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.modal-form-styled .btn-save,
.modal-form-styled .btn-cancel {
    flex: 1;
    padding: 12px 16px !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    cursor: pointer !important;
    border: none !important;
    transition: all 0.2s !important;
}

.modal-form-styled .btn-save {
    background: linear-gradient(135deg, #e91e63, #c2185b) !important;
    color: #fff !important;
}

.modal-form-styled .btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.modal-form-styled .btn-cancel {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
}

.modal-form-styled .btn-cancel:hover {
    background: #e5e7eb !important;
}

/* استجابة للموبايل */
@media (max-width: 500px) {
    .modal-form-styled .form-row-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ============================
   تنسيق حقل التاريخ والوقت
   (datetime-local) — للأشكال الحلوة
============================ */
input[type="datetime-local"],
input[type="date"],
input[type="time"] {
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    direction: ltr;
    text-align: right;
}

/* أيقونة التقويم — تعطيها لون جميل */
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    filter: invert(20%) sepia(80%) saturate(2000%) hue-rotate(310deg);
}

input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator,
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
}

/* تركيز جميل عند الضغط */
input[type="datetime-local"]:focus,
input[type="date"]:focus,
input[type="time"]:focus {
    border-color: #e91e63;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12);
    outline: none;
    background: #fff;
}

/* داخل الـ modals — تأكد من التنسيق */
.modal-content input[type="datetime-local"],
.modal-content input[type="date"],
.modal-content input[type="time"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.92rem;
    background: #fafafa;
    margin: 3px 0 10px;
    box-sizing: border-box;
    color: #1a1a2e;
}

.modal-content input[type="datetime-local"]:focus,
.modal-content input[type="date"]:focus,
.modal-content input[type="time"]:focus {
    border-color: #e91e63;
    background: #fff;
}

/* داخل edit-form-card (التعديل) */
.edit-form-card input[type="datetime-local"],
.edit-form-card input[type="date"],
.edit-form-card input[type="time"] {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    box-sizing: border-box;
    background: #fff;
    color: #1a1a2e;
}

/* ============================
   جدول قابل للترتيب (Sortable)
============================ */
.sortable-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    position: relative;
}

.sortable-table th.sortable:hover {
    background: #fce7f3;
    color: #be185d;
}

.sort-icon {
    display: inline-block;
    font-size: 0.85rem;
    margin-right: 4px;
    color: #9ca3af;
    transition: color 0.2s;
    font-weight: 700;
}

.sort-icon.active {
    color: #e91e63;
    font-size: 1rem;
}

.sortable-table th.sortable:hover .sort-icon {
    color: #be185d;
}

/* ============================
   مؤشر الرمز المختار (Symbol Badge)
============================ */
.symbol-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 1px solid #6ee7b7;
    color: #065f46;
    padding: 8px 12px;
    border-radius: 8px;
    margin: 8px 0 16px;
    font-size: 0.88rem;
}

.symbol-badge strong {
    color: #047857;
    font-weight: 700;
}

.symbol-badge-clear {
    margin-right: auto;
    background: transparent !important;
    border: none !important;
    padding: 0 6px !important;
    color: #047857 !important;
    cursor: pointer;
    font-size: 1.4rem !important;
    line-height: 1;
    font-weight: 700;
}

.symbol-badge-clear:hover {
    color: #be185d !important;
}

/* ============================
   تنبيه Lookup التلقائي
============================ */
.lookup-notice {
    padding: 12px 14px;
    border-radius: 8px;
    margin: 10px 0 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.lookup-notice strong {
    font-weight: 700;
}

.lookup-notice em {
    font-style: italic;
    color: #92400e;
    font-size: 0.85rem;
}

.lookup-notice-success {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.lookup-notice-warn {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.lookup-notice-info {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

/* ============================
   قسم البحث السريع — في الصفحة الرئيسية
============================ */
.quick-add-section {
    background: linear-gradient(135deg, #fdf2f6, #f5f3ff);
    border: 2px solid #fce7f3;
    border-radius: 14px;
    padding: 20px 24px;
    margin: 20px 0;
    width: 95%;
    max-width: 1100px;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.06);
}

.quick-add-header {
    margin-bottom: 14px;
}

.quick-add-header h3 {
    color: #be185d;
    margin: 0 0 4px;
    font-size: 1.15rem;
}

.quick-add-sub {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 0;
}

.quick-add-search-wrap {
    position: relative;
}

#quickAddSearch {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #fce7f3;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    background: #fff;
    color: #1a1a2e;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

#quickAddSearch:focus {
    outline: none;
    border-color: #e91e63;
    box-shadow: 0 0 0 4px rgba(233, 30, 99, 0.1);
}

#quickAddSearch::placeholder {
    color: #9ca3af;
}

/* القائمة المنسدلة بنفس ستايل البحث الموجود */
#quickAddResults {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: none;
}

/* ============================
   Quick Add Modal — معلومات السهم
============================ */
.quick-add-info {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 2px solid #6ee7b7;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 18px;
}

.qai-name {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.qai-name strong {
    font-size: 1.1rem;
    color: #047857;
}

.qai-symbol {
    background: #047857;
    color: #fff;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
}

.qai-price {
    color: #065f46;
    font-size: 0.92rem;
}

.qai-price strong {
    color: #047857;
    font-size: 1.05rem;
}

/* ملاحظة في modal اليدوي */
.modal-sub {
    color: #6b7280;
    font-size: 0.88rem;
    margin: -8px 0 18px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 8px;
    border-right: 3px solid #fbbf24;
}

@media (max-width: 600px) {
    .quick-add-section {
        padding: 16px;
        width: 92%;
    }
    .quick-add-header h3 {
        font-size: 1rem;
    }
}

/* ============================
   زر "إضافة سهم يدوياً" في رسالة "لا توجد نتائج"
============================ */
.search-empty {
    padding: 20px;
    text-align: center;
    color: #6b7280;
}

.search-empty p {
    margin: 0 0 12px;
}

.search-empty strong {
    color: #1a1a2e;
}

.btn-manual-add {
    display: inline-block;
    padding: 10px 18px;
    background: linear-gradient(135deg, #e91e63, #c2185b);
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-manual-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

/* ============================
   زر "💸 توزيع" بجنب زر "📋 عرض" في الجدول
============================ */
.btn-quick-div {
    display: inline-block;
    padding: 6px 12px;
    margin-right: 4px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff !important;
    border: none;
    border-radius: 6px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.btn-quick-div:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}

@media (max-width: 600px) {
    .btn-details, .btn-quick-div {
        font-size: 0.78rem;
        padding: 5px 9px;
    }
}

/* ============================
   📈 تبويب بيانات السوق (Admin)
============================ */
.market-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.market-stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.market-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.market-stat-card-wide {
    grid-column: span 2;
}

.ms-label {
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 500;
}

.ms-value {
    font-size: 1.6rem;
    color: #1a1a2e;
    font-weight: 800;
}

.ms-value-success {
    color: #059669;
}

.ms-value-info {
    color: #2563eb;
}

.ms-value-time {
    color: #6b7280;
    font-size: 0.92rem;
    font-weight: 600;
}

/* أزرار الإجراءات */
.market-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 16px;
}

.market-action-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.mac-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.market-action-card h4 {
    color: #1a1a2e;
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.market-action-card p {
    color: #6b7280;
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 0 0 8px;
}

.mac-cost {
    color: #d97706;
    font-size: 0.82rem !important;
    font-weight: 600;
    background: #fef3c7;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 12px !important;
}

.btn-mac {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    color: #fff;
}

.btn-mac:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-mac:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn-mac-primary {
    background: linear-gradient(135deg, #e91e63, #c2185b);
}

.btn-mac-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.btn-mac-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.btn-mac-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.mac-result {
    margin-top: 12px;
    min-height: 0;
}

.mac-loading,
.mac-success,
.mac-error {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
}

.mac-loading {
    background: #dbeafe;
    color: #1e40af;
}

.mac-success {
    background: #d1fae5;
    color: #065f46;
}

.mac-success small {
    display: block;
    font-weight: 400;
    margin-top: 4px;
    opacity: 0.85;
}

.mac-error {
    background: #fee2e2;
    color: #991b1b;
}

/* التوصيات */
.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.rec-card {
    background: linear-gradient(135deg, #fdf2f6, #f5f3ff);
    border: 1px solid #fce7f3;
    border-radius: 10px;
    padding: 16px;
}

.rec-card strong {
    display: block;
    color: #be185d;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.rec-card ul {
    margin: 0;
    padding-right: 20px;
    color: #4b5563;
    font-size: 0.88rem;
    line-height: 1.8;
}

.rec-card ul li {
    margin-bottom: 4px;
}

.admin-section-desc {
    color: #6b7280;
    font-size: 0.92rem;
    line-height: 1.7;
    margin: 8px 0 0;
}

@media (max-width: 600px) {
    .market-stat-card-wide {
        grid-column: span 1;
    }
    .market-actions-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================
   شعار الموقع + الـ tagline
============================ */
.logo-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-decoration: none;
    line-height: 1.1;
}

.logo-tagline {
    font-size: 0.7rem;
    color: #9ca3af;
    font-weight: 400;
    margin-top: 2px;
    max-width: 320px;
    line-height: 1.4;
    /* السماح بسطرين كحد أقصى */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================
   Toggle Rows في الإعدادات
============================ */
.toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 10px;
}

.toggle-row:hover {
    background: #f9fafb;
}

.toggle-row input[type="checkbox"] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-row span {
    flex: 1;
    color: #374151;
    font-size: 0.92rem;
    line-height: 1.6;
}

.toggle-row span small {
    display: block;
    color: #6b7280;
    font-size: 0.82rem;
    margin-top: 4px;
    font-weight: normal;
}

.toggle-row-prominent {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 14px;
}

.toggle-row-prominent strong {
    font-size: 1.02rem;
    color: #1a1a2e;
}

/* بطاقة إعداد خطر */
.setting-card-danger {
    border-left: 4px solid #ef4444 !important;
}

.setting-card-danger h4 {
    color: #b91c1c;
}

/* فورم الإعدادات */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-form .setting-card {
    margin-bottom: 0;
}

.settings-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
}

.settings-form textarea:focus {
    outline: none;
    border-color: #e91e63;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

/* ============================
   🔑 تبويب API: شبكة المزودين
============================ */
.apis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.apis-header h3 {
    margin: 0;
}

.apis-header p {
    margin: 4px 0 0;
}

.providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.provider-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.provider-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    border-color: #e91e63;
}

.provider-inactive {
    opacity: 0.6;
    background: #f9fafb;
}

.provider-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.provider-header h4 {
    margin: 0;
    color: #1a1a2e;
    font-size: 1.1rem;
}

.provider-code {
    color: #6b7280;
    font-family: monospace;
    font-size: 0.78rem;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 4px;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
}

.provider-desc {
    color: #4b5563;
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 8px 0 12px;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 6px;
}

.provider-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 0.85rem;
}

.pmeta-row {
    display: flex;
    justify-content: space-between;
    color: #6b7280;
}

.pmeta-row strong {
    color: #1a1a2e;
}

.provider-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.btn-edit-prov,
.btn-toggle-prov,
.btn-delete-prov {
    padding: 7px 12px;
    border: none;
    border-radius: 6px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    flex: 1;
    min-width: 80px;
}

.btn-edit-prov {
    background: #3b82f6;
    color: #fff;
}

.btn-toggle-prov {
    background: #f59e0b;
    color: #fff;
}

.btn-delete-prov {
    background: #ef4444;
    color: #fff;
}

.btn-edit-prov:hover,
.btn-toggle-prov:hover,
.btn-delete-prov:hover {
    opacity: 0.85;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: #f9fafb;
    border-radius: 12px;
    color: #6b7280;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.empty-state h4 {
    color: #1a1a2e;
    margin: 8px 0;
}

/* Required indicator */
.req {
    color: #dc2626;
    font-weight: bold;
}

/* Form 2-column grid */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 600px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
    .providers-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================
   🔄 قسم Sync داخل تعديل المزوّد
============================ */
.provider-sync-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px dashed #e5e7eb;
}

.provider-sync-title {
    color: #1a1a2e;
    margin: 0 0 6px;
    font-size: 1.05rem;
}

.sync-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.sync-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.sync-action-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sync-action-info strong {
    color: #1a1a2e;
    font-size: 0.95rem;
}

.sync-action-info small {
    color: #6b7280;
    font-size: 0.8rem;
}

.sync-last {
    color: #9ca3af !important;
    font-style: italic;
}

.btn-sync {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    transition: opacity 0.15s, transform 0.15s;
    white-space: nowrap;
}

.btn-sync:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sync:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn-sync-primary { background: linear-gradient(135deg, #e91e63, #c2185b); }
.btn-sync-success { background: linear-gradient(135deg, #10b981, #059669); }
.btn-sync-info    { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.btn-sync-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }

.sync-button-group {
    display: flex;
    gap: 6px;
}

.sync-result {
    margin-top: 14px;
}

.sync-loading,
.sync-success,
.sync-error {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
}

.sync-loading {
    background: #dbeafe;
    color: #1e40af;
}

.sync-success {
    background: #d1fae5;
    color: #065f46;
}

.sync-error {
    background: #fee2e2;
    color: #991b1b;
}

.sync-not-supported {
    background: #fef3c7;
    color: #92400e;
    padding: 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.sync-not-supported small {
    display: block;
    margin-top: 6px;
    color: #b45309;
}

/* بانر معلومات */
.market-info-banner {
    background: linear-gradient(135deg, #fdf2f6, #f5f3ff);
    border: 1px solid #fce7f3;
    border-right: 4px solid #e91e63;
    padding: 14px 18px;
    border-radius: 10px;
    margin-top: 18px;
    font-size: 0.92rem;
    line-height: 1.7;
    color: #4b5563;
}

.market-info-banner strong {
    color: #be185d;
}

.info-banner {
    background: linear-gradient(135deg, #eff6ff, #f5f3ff);
    border: 1px solid #dbeafe;
    border-right: 4px solid #3b82f6;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.8;
    color: #4b5563;
}

.info-banner strong {
    color: #1e40af;
    margin-left: 8px;
}

.info-banner .btn-link {
    margin-right: 12px;
    font-weight: 700;
    color: #e91e63;
}

@media (max-width: 600px) {
    .sync-action-row {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-sync, .sync-button-group {
        width: 100%;
    }
    .sync-button-group .btn-sync {
        flex: 1;
    }
}

/* ====================================================================
   🆕 v3 — Sync Cards (تبويب بيانات السوق) — تصميم احترافي
==================================================================== */

.sync-section {
    background: linear-gradient(135deg, #f5f3ff 0%, #fce7f3 100%);
    border: 1px solid rgba(124, 58, 237, 0.15);
}

/* 🎯 الـ 3 كروت دائماً بجنب بعض */
.sync-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 18px;
}

.sync-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0; /* مهم: يسمح بالـ shrink */
}

.sync-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.sync-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sync-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    flex-shrink: 0;
}

.sync-icon-blue   { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.sync-icon-green  { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }
.sync-icon-purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }

.sync-card-title {
    flex: 1;
    min-width: 0;
}

.sync-card-title h4 {
    margin: 0 0 1px 0;
    font-size: 0.98rem;
    color: #1f2937;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sync-card-title small {
    color: #6b7280;
    font-size: 0.74rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sync-card-status {
    flex-shrink: 0;
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-idle      { background: #f3f4f6; color: #6b7280; }
.status-running   { background: #fef3c7; color: #92400e; animation: statusPulse 1.5s infinite; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-failed    { background: #fee2e2; color: #991b1b; }
.status-paused    { background: #fed7aa; color: #9a3412; }

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
}

.sync-card-meta {
    background: #f9fafb;
    border-radius: 9px;
    padding: 9px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sync-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    gap: 6px;
}

.sync-meta-row span {
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sync-meta-row strong {
    color: #1f2937;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.sync-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sync-progress-bar {
    height: 10px;
    background: #f3f4f6;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.sync-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #ec4899);
    border-radius: 999px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sync-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%
    );
    background-size: 18px 18px;
    animation: progressStripes 1s linear infinite;
}

.progress-complete {
    background: linear-gradient(90deg, #10b981, #059669) !important;
}

.progress-complete::after {
    animation: none;
}

@keyframes progressStripes {
    0%   { background-position: 0 0; }
    100% { background-position: 18px 0; }
}

.sync-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: #4b5563;
    font-weight: 500;
    gap: 6px;
}

.sync-progress-text span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sync-progress-text span:last-child {
    color: #7c3aed;
    font-weight: 700;
    flex-shrink: 0;
}

.sync-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}

.btn-sync-action {
    flex: 1;
    min-width: 0; /* يسمح بالـ shrink */
    padding: 9px 10px;
    border: none;
    border-radius: 9px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-sync-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sync-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

.btn-sync-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.btn-sync-purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
}

.btn-sync-resume {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.btn-sync-cancel {
    background: #f3f4f6;
    color: #4b5563;
}

.btn-sync-reset {
    background: #fff;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.btn-sync-action:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.sync-error-msg {
    background: #fee2e2;
    color: #991b1b;
    padding: 9px 12px;
    border-radius: 9px;
    font-size: 0.8rem;
    border-right: 3px solid #dc2626;
    word-break: break-word;
}

/* رابط الإحالة في تبويب apis */
.sync-redirect-banner {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fcd34d;
    border-radius: 14px;
    padding: 18px;
    display: flex;
    gap: 16px;
    align-items: center;
}

.sync-redirect-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.sync-redirect-text strong {
    display: block;
    color: #92400e;
    font-size: 1rem;
    margin-bottom: 6px;
}

.sync-redirect-text p {
    margin: 0;
    color: #78350f;
    font-size: 0.9rem;
    line-height: 1.6;
}

.sync-redirect-link {
    color: #b45309;
    text-decoration: underline;
    font-weight: 700;
}

.sync-redirect-link:hover {
    color: #78350f;
}

/* ============== Responsive ============== */

/* للشاشات المتوسطة: عمودين */
@media (max-width: 900px) {
    .sync-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* للجوال: عمود واحد */
@media (max-width: 600px) {
    .sync-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .sync-card {
        padding: 14px;
    }
    .sync-card-actions {
        gap: 5px;
    }
}

/* ====================================================================
   🆕 v3.1 — Sync Summary Modal + Delisted Badges
==================================================================== */

.sync-summary-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: summaryFadeIn 0.2s ease;
}

@keyframes summaryFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sync-summary-modal {
    background: #fff;
    border-radius: 18px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: summaryScaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes summaryScaleIn {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.sync-summary-header {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
}

.sync-summary-icon {
    font-size: 2rem;
}

.sync-summary-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
}

.sync-summary-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sync-summary-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.sync-summary-body {
    padding: 24px;
}

.sync-summary-intro {
    margin: 0 0 16px 0;
    color: #4b5563;
    font-size: 0.95rem;
}

.sync-summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.sync-stat {
    background: #f9fafb;
    border-radius: 12px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    border: 1px solid #e5e7eb;
}

.sync-stat-icon {
    font-size: 1.4rem;
}

.sync-stat-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1.2;
}

.sync-stat-label {
    font-size: 0.78rem;
    color: #6b7280;
    line-height: 1.3;
}

.sync-stat-added       { background: #ecfdf5; border-color: #a7f3d0; }
.sync-stat-added .sync-stat-num       { color: #059669; }

.sync-stat-updated     { background: #eff6ff; border-color: #bfdbfe; }
.sync-stat-updated .sync-stat-num     { color: #2563eb; }

.sync-stat-unchanged   { background: #f9fafb; border-color: #e5e7eb; }
.sync-stat-unchanged .sync-stat-num   { color: #6b7280; }

.sync-stat-delisted    { background: #fef2f2; border-color: #fecaca; }
.sync-stat-delisted .sync-stat-num    { color: #dc2626; }

.sync-stat-reactivated { background: #fffbeb; border-color: #fde68a; }
.sync-stat-reactivated .sync-stat-num { color: #d97706; }

.sync-stat-failed      { background: #fef2f2; border-color: #fecaca; }
.sync-stat-failed .sync-stat-num      { color: #dc2626; }

.sync-summary-note {
    margin: 16px 0 0 0;
    padding: 12px;
    background: #f0f9ff;
    border-radius: 10px;
    color: #0369a1;
    font-size: 0.88rem;
    text-align: center;
}

.sync-summary-footer {
    padding: 16px 24px;
    background: #f9fafb;
    text-align: center;
    border-top: 1px solid #e5e7eb;
}

.btn-sync-summary-ok {
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    color: #fff;
    border: none;
    padding: 11px 32px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sync-summary-ok:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.3);
}

@media (max-width: 480px) {
    .sync-summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ====================================================================
   🆕 v3.2 — Delisted Stocks Modal + Clickable Stat Card
==================================================================== */

.market-stat-card-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.market-stat-card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.15);
    border-color: #fca5a5;
}

.ms-value-danger {
    color: #dc2626 !important;
}

/* Stat card تفسيري */
.market-stat-note {
    grid-column: 1 / -1;
    background: #f0f9ff;
    color: #0c4a6e;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    line-height: 1.7;
    border-right: 3px solid #38bdf8;
    margin-top: 4px;
}

.market-stat-note strong {
    color: #075985;
}

.market-stat-note small {
    color: #0c4a6e;
    opacity: 0.85;
    font-size: 0.8rem;
}

/* ============== Delisted Modal ============== */
.delisted-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: summaryFadeIn 0.2s ease;
}

.delisted-modal {
    background: #fff;
    border-radius: 18px;
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: summaryScaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.delisted-header {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: #fff;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.delisted-icon { font-size: 1.6rem; }
.delisted-header h3 { margin: 0; font-size: 1.15rem; flex: 1; font-weight: 700; }

.delisted-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
}

.delisted-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.delisted-body {
    padding: 18px 22px;
    overflow-y: auto;
    flex: 1;
}

.delisted-loading,
.delisted-empty {
    text-align: center;
    padding: 30px;
    color: #6b7280;
    font-size: 0.95rem;
}

.delisted-intro {
    margin: 0 0 14px 0;
    color: #4b5563;
    font-size: 0.9rem;
}

.delisted-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-right: 4px solid #f59e0b;
    padding: 12px 14px;
    border-radius: 10px;
    color: #92400e;
    font-size: 0.88rem;
    margin-bottom: 14px;
    line-height: 1.6;
}

.delisted-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.delisted-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.delisted-table thead {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.delisted-table th {
    padding: 10px 12px;
    text-align: right;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.delisted-table td {
    padding: 10px 12px;
    border-top: 1px solid #f3f4f6;
    color: #1f2937;
    text-align: right;
}

.delisted-table tbody tr:hover {
    background: #fafafa;
}

.badge-warning {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-muted {
    color: #9ca3af;
    font-size: 0.8rem;
}

@media (max-width: 600px) {
    .delisted-modal { max-height: 95vh; }
    .delisted-table th,
    .delisted-table td { padding: 8px 6px; font-size: 0.78rem; }
}

/* ====================================================================
   🆕 v3.3 — رسالة خطأ السنك المُحسَّنة (تبقى حتى يغلقها المستخدم)
==================================================================== */

.sync-error-msg {
    position: relative;
    padding: 8px 10px;
    padding-inline-end: 30px; /* مساحة لزر الإغلاق */
}

.sync-err-close {
    position: absolute;
    top: 4px;
    background: transparent;
    border: none;
    color: #991b1b;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s;
    opacity: 0.6;
}

[dir="rtl"] .sync-err-close { left: 4px; right: auto; }
[dir="ltr"] .sync-err-close { right: 4px; left: auto; }

.sync-err-close:hover {
    background: #dc2626;
    color: #fff;
    opacity: 1;
}

.sync-err-title {
    font-size: 0.82rem;
    margin-bottom: 2px;
    line-height: 1.4;
}

.sync-err-meta {
    font-size: 0.72rem;
    color: #7c2d12;
    margin-bottom: 4px;
    font-family: monospace;
}

.sync-err-detail {
    font-size: 0.76rem;
    margin-bottom: 6px;
    line-height: 1.5;
}

.sync-err-raw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 3px;
    font-size: 0.7rem;
    color: #7c2d12;
}

.btn-copy-raw {
    background: #fff;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 2px 8px;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.btn-copy-raw:hover {
    background: #991b1b;
    color: #fff;
    border-color: #991b1b;
}

.sync-err-raw {
    display: block;
    background: #fef2f2;
    color: #1f2937;
    padding: 7px 9px;
    border-radius: 6px;
    font-size: 0.7rem;
    direction: ltr;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid #fecaca;
    font-family: 'Courier New', monospace;
    line-height: 1.45;
}

.sync-err-raw::-webkit-scrollbar {
    width: 8px;
}
.sync-err-raw::-webkit-scrollbar-thumb {
    background: #fca5a5;
    border-radius: 4px;
}

/* ====================================================================
   🆕 v3.3 — Mode selector (الكل / الموزّعة فقط)
==================================================================== */
.sync-mode-selector {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    padding: 8px 10px;
}

.sync-mode-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #4b5563;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s;
}

.sync-mode-label:hover {
    background: #f9fafb;
}

.sync-mode-label input[type="radio"] {
    accent-color: #7c3aed;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin: 0;
}

.sync-mode-label small {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-right: 2px;
}

/* ====================================================================
   🚀 v3.4 — السيناريو السريع (Quick Scenario Modal)
==================================================================== */

.btn-quick-scenario {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff;
    border: none;
    padding: 12px 22px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.25);
}

.btn-quick-scenario:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
}

/* ============== Overlay ============== */
.qs-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: qsFadeIn 0.2s ease;
}

@keyframes qsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.qs-modal {
    background: #fff;
    border-radius: 20px;
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: qsScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes qsScaleIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ============== Header ============== */
.qs-header {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff;
    padding: 22px 26px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.qs-header-text {
    flex: 1;
}

.qs-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff !important;
}

.qs-header small {
    display: block;
    margin-top: 3px;
    font-size: 0.85rem;
    opacity: 0.95;
    color: #fff !important;
}

.qs-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.qs-close:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.05);
}

/* ============== Body ============== */
.qs-body {
    padding: 22px 26px;
    overflow-y: auto;
    flex: 1;
}

.qs-loading,
.qs-empty {
    text-align: center;
    padding: 50px 20px;
    color: #6b7280;
    font-size: 1rem;
}

.qs-empty strong {
    display: block;
    color: #374151;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.qs-empty p {
    color: #6b7280;
    line-height: 1.7;
    font-size: 0.9rem;
}

.qs-intro {
    background: linear-gradient(135deg, #f5f3ff, #fce7f3);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #5b21b6;
    font-size: 0.92rem;
    line-height: 1.6;
}

.qs-intro strong {
    color: #4c1d95;
}

/* ============== Table ============== */
.qs-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.qs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    min-width: 900px;
}

.qs-table thead {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    position: sticky;
    top: 0;
    z-index: 1;
}

.qs-table th {
    padding: 12px 10px;
    text-align: right;
    color: #fff !important;
    font-weight: 700;
    font-size: 0.8rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.qs-th-check { width: 40px; text-align: center !important; }

/* checkbox الـ "الكل" في رأس الجدول — على خلفية بنفسجية */
.qs-th-check input[type="checkbox"] {
    accent-color: #fff;
    background: #fff;
    border-radius: 4px;
}

.qs-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
    vertical-align: middle;
}

.qs-table tbody tr {
    transition: background 0.15s;
}

.qs-table tbody tr:hover:not(.qs-row-disabled) {
    background: #fafaff;
}

.qs-row-disabled {
    opacity: 0.45;
}

.qs-row-disabled td {
    color: #9ca3af;
}

.qs-td-check {
    text-align: center;
}

.qs-td-check input[type="checkbox"],
.qs-th-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #8b5cf6;
    cursor: pointer;
}

.qs-td-name strong {
    display: block;
    color: #111827;
    font-weight: 700;
}

.qs-td-name small {
    display: block;
    color: #9ca3af;
    font-size: 0.72rem;
    margin-top: 2px;
    direction: ltr;
}

.qs-annual-income {
    display: block;
    color: #6b7280;
    font-size: 0.72rem;
    margin-top: 2px;
}

/* Yield badges */
.qs-yield-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.qs-yield-cost {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #047857;
}

.qs-yield-price {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
}

/* Reinvest dropdown */
.qs-reinvest {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 0.82rem;
    color: #374151;
    cursor: pointer;
    width: 100%;
    min-width: 140px;
    transition: all 0.15s;
}

.qs-reinvest:hover:not(:disabled) {
    border-color: #8b5cf6;
}

.qs-reinvest:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.qs-reinvest:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============== Footer ============== */
.qs-footer {
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    padding: 12px 20px;
    flex-shrink: 0;
}

/* الملخّص: سطر واحد متراص مع separators بدل بطاقات منفصلة */
.qs-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.qs-sum-item {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 4px 14px;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    border-inline-end: 1px solid #f3f4f6;
}

.qs-sum-item:last-child {
    border-inline-end: none;
}

.qs-sum-item span {
    color: #6b7280;
    font-size: 0.78rem;
    font-weight: 500;
    display: inline !important;
    margin: 0 !important;
}

.qs-sum-item span::after {
    content: ":";
    margin-inline-end: 4px;
    color: #d1d5db;
}

.qs-sum-item strong {
    color: #5b21b6;
    font-size: 0.95rem;
    font-weight: 700;
    display: inline !important;
    margin: 0 !important;
}

.qs-sum-item:hover {
    transform: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.qs-sum-item.qs-sum-extra {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 8px;
    padding: 4px 10px;
    margin: 0 4px;
}

.qs-sum-item.qs-sum-extra span,
.qs-sum-item.qs-sum-extra strong {
    color: #92400e;
}

.qs-summary-empty {
    display: block;
    color: #92400e;
    background: #fef3c7;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 10px;
}

.qs-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .qs-modal { max-height: 95vh; border-radius: 14px; }
    .qs-header { padding: 16px 18px; }
    .qs-header h3 { font-size: 1.1rem; }
    .qs-body { padding: 16px 18px; }
    .qs-footer { padding: 10px 14px; }
    /* الـ summary يصير قابل للسحب أفقياً */
    .qs-summary { padding: 6px 8px; }
    .qs-sum-item { padding: 4px 10px; }
    .qs-sum-item span { font-size: 0.72rem; }
    .qs-sum-item strong { font-size: 0.85rem; }
    .qs-actions { flex-direction: column; }
    .qs-actions button { width: 100%; }
}

/* ====================================================================
   🚀 v3.4.1 — تحسينات السيناريو السريع
==================================================================== */

/* فاصلة الآلاف الصغيرة */
.qs-annual-income {
    display: block;
    color: #6b7280;
    font-size: 0.7rem !important;  /* أصغر */
    margin-top: 3px;
    font-weight: 500;
    direction: ltr;
    text-align: right;
    letter-spacing: -0.3px;
}

/* التوزيع/سهم الرئيسي */
.qs-table td strong {
    font-size: 0.95rem;
    color: #111827;
}

/* زر الحساب الرئيسي - بارز أكثر */
.qs-btn-calc {
    background: linear-gradient(135deg, #8b5cf6, #ec4899) !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 28px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3) !important;
    transition: all 0.2s ease !important;
}

.qs-btn-calc:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.45) !important;
}

/* ============== Loading Overlay (بعد ضغط احسب) ============== */
.qs-loading-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: qsFadeIn 0.2s ease;
}

.qs-loading-content {
    text-align: center;
    color: #fff;
}

.qs-loading-content h3 {
    font-size: 1.4rem;
    margin: 16px 0 6px 0;
    font-weight: 700;
}

.qs-loading-content p {
    font-size: 0.95rem;
    opacity: 0.85;
    margin: 0;
}

.qs-loading-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ec4899;
    border-radius: 50%;
    margin: 0 auto;
    animation: qsSpin 0.8s linear infinite;
}

@keyframes qsSpin {
    to { transform: rotate(360deg); }
}

/* ============== جعل الجدول أكثر تفاعلية ============== */
.qs-table tbody tr:not(.qs-row-disabled) {
    cursor: pointer;
}

/* صف نشط (محدد) */
.qs-table tbody tr:not(.qs-row-disabled) .qs-td-check input:checked ~ * {
    /* placeholder for future styling */
}

/* تأثير hover أوضح */
.qs-table tbody tr:not(.qs-row-disabled):hover {
    background: linear-gradient(90deg, #faf5ff, #fdf2f8);
}

/* badge العائد - حواف أكثر نعومة */
.qs-yield-badge {
    transition: transform 0.15s;
}

.qs-table tbody tr:hover .qs-yield-badge {
    transform: scale(1.05);
}

/* ====================================================================
   🚀 v3.4.2 — شاشة نتيجة السيناريو السريع
==================================================================== */

.qs-result-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: qsFadeIn 0.3s ease;
}

.qs-result-overlay.qs-result-closing {
    animation: qsFadeOut 0.25s ease forwards;
}

@keyframes qsFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.qs-result-modal {
    background: #fff;
    border-radius: 24px;
    max-width: 880px;
    width: 100%;
    max-height: 92vh;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: qsScaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============== Header ============== */
.qs-result-header {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff;
    padding: 22px 26px;
    position: relative;
    flex-shrink: 0;
}

.qs-result-header h2 {
    margin: 0 0 4px 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff !important;
}

.qs-result-header small {
    font-size: 0.9rem;
    opacity: 0.95;
    color: #fff !important;
}

.qs-result-header .qs-close {
    position: absolute;
    top: 16px;
    inset-inline-end: 16px;
}

/* ============== Body ============== */
.qs-result-body {
    padding: 26px;
    overflow-y: auto;
    flex: 1;
}

/* ============== Hero Card ============== */
.qs-hero-card {
    display: flex;
    align-items: center;
    gap: 24px;
    background: linear-gradient(135deg, #faf5ff, #fdf2f8);
    border-radius: 18px;
    padding: 22px;
    margin-bottom: 22px;
    border: 1px solid #e9d5ff;
}

.qs-hero-circle-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    flex-shrink: 0;
}

.qs-hero-circle {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
}

.qs-hero-center {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.qs-hero-pct {
    font-size: 2.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
}

.qs-hero-pct-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 4px;
    font-weight: 500;
}

.qs-hero-amount {
    flex: 1;
    min-width: 0;
}

.qs-hero-amount-num {
    font-size: 2.6rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1;
    letter-spacing: -0.5px;
    direction: ltr;
    text-align: right;
}

.qs-hero-amount-label {
    font-size: 1rem;
    color: #6b7280;
    margin-top: 6px;
    font-weight: 500;
}

.qs-hero-goal {
    margin-top: 12px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 10px;
    font-size: 0.88rem;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.qs-hero-goal strong {
    color: #6b21a8;
}

/* ============== Stats Grid ============== */
.qs-result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.qs-stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px 14px;
    text-align: center;
    transition: all 0.2s;
}

.qs-stat-card:hover {
    transform: translateY(-2px);
    border-color: #c4b5fd;
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.12);
}

.qs-stat-icon {
    font-size: 1.6rem;
    margin-bottom: 4px;
}

.qs-stat-label {
    font-size: 0.78rem;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 500;
}

.qs-stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1.2;
    direction: ltr;
}

.qs-stat-value.qs-stat-pos {
    color: #059669;
}

.qs-stat-unit {
    font-size: 0.72rem;
    color: #9ca3af;
    margin-top: 2px;
}

/* ============== Footer ============== */
.qs-result-footer {
    background: #fafafa;
    border-top: 1px solid #e5e7eb;
    padding: 16px 26px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.qs-result-btn-secondary,
.qs-result-btn-primary {
    padding: 11px 22px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.qs-result-btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.qs-result-btn-secondary:hover {
    background: #e5e7eb;
}

.qs-result-btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.qs-result-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.45);
}

@media (max-width: 640px) {
    .qs-result-modal { max-height: 95vh; border-radius: 18px; }
    .qs-result-header { padding: 18px 20px; }
    .qs-result-header h2 { font-size: 1.25rem; }
    .qs-result-body { padding: 18px; }
    
    .qs-hero-card { 
        flex-direction: column; 
        text-align: center;
        gap: 16px;
        padding: 18px;
    }
    .qs-hero-circle-wrap { width: 160px; height: 160px; }
    .qs-hero-pct { font-size: 1.9rem; }
    .qs-hero-amount-num { 
        font-size: 2rem; 
        text-align: center;
    }
    
    .qs-result-stats { grid-template-columns: repeat(2, 1fr); }
    .qs-result-footer { 
        padding: 14px 18px; 
        flex-direction: column;
    }
    .qs-result-btn-secondary,
    .qs-result-btn-primary { width: 100%; }
}

/* ====================================================================
   ⚙️ v3.5 — الحقول المتقدّمة في السيناريو السريع
==================================================================== */

/* عمود الإعدادات (gear) */
.qs-th-gear {
    width: 50px;
    text-align: center !important;
}

.qs-td-gear {
    text-align: center;
    padding: 8px 4px !important;
}

/* زر الترس */
.qs-gear-btn {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    padding: 0;
}

.qs-gear-btn:hover:not(:disabled) {
    background: #faf5ff;
    border-color: #c4b5fd;
    color: #7c3aed;
    transform: rotate(20deg);
}

.qs-gear-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.qs-gear-active {
    background: linear-gradient(135deg, #8b5cf6, #ec4899) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.3);
    transform: rotate(45deg);
}

.qs-gear-active:hover {
    transform: rotate(45deg) !important;
}

/* badge على زر الترس (عدد الإعدادات النشطة) */
.qs-gear-badge {
    position: absolute;
    top: -5px;
    inset-inline-end: -5px;
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    color: #fff !important;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    line-height: 1;
}

/* ============== صف الـ Panel المتقدّم ============== */
.qs-advanced-row {
    background: linear-gradient(135deg, #faf5ff, #fdf2f8) !important;
    animation: qsSlideDown 0.3s ease;
}

@keyframes qsSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.qs-advanced-td {
    padding: 0 !important;
    border-bottom: 2px solid #e9d5ff;
}

.qs-advanced-panel {
    padding: 18px 22px;
    background: linear-gradient(135deg, #faf5ff, #fdf2f8);
}

/* Header للـ panel */
.qs-adv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9d5ff;
}

.qs-adv-header span {
    color: #6b21a8;
    font-size: 0.92rem;
    font-weight: 600;
}

.qs-adv-header strong {
    color: #5b21b6;
}

.qs-adv-reset {
    background: #fff;
    border: 1px solid #d8b4fe;
    color: #7c3aed;
    padding: 5px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
}

.qs-adv-reset:hover {
    background: #f5f3ff;
    border-color: #a78bfa;
}

/* شبكة الكروت */
.qs-adv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
}

/* كرت لكل حقل — مدمج */
.qs-adv-card {
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.2s;
}

.qs-adv-card:hover {
    border-color: #c4b5fd;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.08);
}

.qs-adv-card-wide {
    grid-column: 1 / -1;
}

.qs-adv-icon {
    font-size: 1.05rem;
    line-height: 1;
    margin-bottom: 0;
}

.qs-adv-label {
    color: #4b5563;
    font-size: 0.76rem;
    font-weight: 600;
    margin: 0;
}

/* Toggle row في الكرت */
.qs-adv-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #4b5563;
    font-size: 0.78rem;
    font-weight: 600;
    margin: 0;
}

.qs-adv-toggle input[type="checkbox"] {
    accent-color: #8b5cf6;
    width: 14px;
    height: 14px;
    cursor: pointer;
    margin: 0;
}

/* تسمية صغيرة فوق input داخلي */
.qs-adv-mini-label {
    color: #6b7280;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 4px;
    margin-bottom: -2px;
    display: block;
}

/* الحقول داخل الكرت */
.qs-adv-input {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 5px 8px;
    font-family: inherit;
    font-size: 0.82rem;
    color: #1f2937;
    transition: all 0.15s;
    width: 100%;
    direction: ltr;
    text-align: right;
}

.qs-adv-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.12);
}

.qs-adv-input-sm {
    margin-top: 2px;
}

.qs-adv-hint {
    color: #6b7280;
    font-size: 0.72rem;
    line-height: 1.4;
}

.qs-adv-disabled {
    color: #9ca3af !important;
    font-style: italic;
}

/* شبكة المبلغ المنقطع (4 حقول) */
.qs-adv-lump-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 4px;
}

.qs-adv-lump-grid > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qs-adv-lump-grid small {
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 500;
}

/* بطاقات الـ summary الإضافية: التعريفات الموحّدة في v3.6 (سطر مدمج) */

@media (max-width: 768px) {
    .qs-advanced-panel { padding: 14px; }
    .qs-adv-grid { grid-template-columns: 1fr; }
    .qs-adv-lump-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ====================================================================
   🚀 v3.6 — Wizard Launcher + Stepper + Step 1 (Goal)
==================================================================== */

/* ====== شاشة البداية (الـ Launcher) ====== */
.qs-launcher {
    background: linear-gradient(135deg, #faf5ff, #fdf2f8);
    border: 1px solid #e9d5ff;
    border-radius: 24px;
    padding: 50px 30px;
    text-align: center;
    margin: 30px auto;
    max-width: 600px;
}

.qs-launcher-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: qsBounce 2s ease-in-out infinite;
}

@keyframes qsBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.qs-launcher h3 {
    color: #5b21b6 !important;
    font-size: 1.6rem;
    margin: 0 0 10px 0;
    font-weight: 800;
}

.qs-launcher p {
    color: #6b21a8;
    font-size: 1rem;
    line-height: 1.7;
    margin: 0 0 24px 0;
}

.btn-launcher {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff;
    border: none;
    padding: 14px 36px;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}

.btn-launcher:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5);
}

/* ====== شريط الـ Stepper ====== */
.qs-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 26px;
    background: linear-gradient(180deg, #faf5ff, #fff);
    border-bottom: 1px solid #e9d5ff;
    gap: 6px;
    flex-shrink: 0;
}

.qs-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.qs-step-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
}

.qs-step-label {
    font-size: 0.78rem;
    color: #9ca3af;
    font-weight: 600;
    transition: color 0.3s;
    white-space: nowrap;
}

.qs-step-line {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    margin: 0 4px;
    margin-bottom: 22px;  /* لمحاذاة مع منتصف الدائرة */
    transition: all 0.4s ease;
    max-width: 80px;
}

.qs-step-line-done {
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
}

.qs-step-active .qs-step-circle {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff;
    border-color: transparent;
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.qs-step-active .qs-step-label {
    color: #6b21a8;
    font-weight: 700;
}

.qs-step-done .qs-step-circle {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border-color: transparent;
}

.qs-step-done .qs-step-circle::before {
    content: '✓';
    font-size: 1.1rem;
}

.qs-step-done .qs-step-circle {
    font-size: 0;
}

.qs-step-done .qs-step-label {
    color: #059669;
}

/* ====== الخطوة ١: الهدف ====== */
.qs-step-content {
    padding: 14px 6px;
}

.qs-goal-card {
    background: linear-gradient(135deg, #faf5ff, #fdf2f8);
    border: 1px solid #e9d5ff;
    border-radius: 18px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 540px;
    margin: 0 auto;
}

.qs-goal-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qs-goal-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #5b21b6;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
}

.qs-goal-icon {
    font-size: 1.2rem;
}

.qs-goal-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e9d5ff;
    border-radius: 12px;
    transition: all 0.2s;
}

.qs-goal-input-wrap:focus-within {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}

.qs-goal-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 16px;
    font-family: inherit;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2937;
    direction: ltr;
    text-align: right;
    outline: none;
    width: 100%;
}

.qs-goal-suffix {
    padding: 0 16px;
    color: #9ca3af;
    font-size: 0.88rem;
    border-inline-start: 1px solid #e9d5ff;
    background: #faf5ff;
    align-self: stretch;
    display: flex;
    align-items: center;
    border-radius: 0 10px 10px 0;
    font-weight: 500;
}

[dir="rtl"] .qs-goal-suffix {
    border-radius: 10px 0 0 10px;
}

.qs-goal-hint {
    color: #6b7280;
    font-size: 0.8rem;
    line-height: 1.5;
}

/* عداد السنوات (مع أزرار +/-) */
.qs-years-control {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 2px solid #e9d5ff;
    border-radius: 12px;
    overflow: hidden;
    width: fit-content;
}

.qs-years-control:focus-within {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}

.qs-years-btn {
    background: #faf5ff;
    border: none;
    color: #7c3aed;
    width: 44px;
    font-family: inherit;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.qs-years-btn:hover {
    background: #ede9fe;
}

.qs-years-input {
    border: none;
    width: 80px;
    text-align: center;
    font-family: inherit;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2937;
    outline: none;
    background: #fff;
    -moz-appearance: textfield;
}

.qs-years-input::-webkit-inner-spin-button,
.qs-years-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ====== الخطوة ٣: تنويه + Panel لكل سهم ====== */
.qs-intro-info {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fcd34d;
    color: #78350f;
    line-height: 1.8;
}

.qs-intro-info strong {
    color: #92400e;
}

.qs-stock-panel {
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

/* ألوان متناوبة لكل سهم — تمييز بصري واضح */
.qs-stock-panel:nth-child(5n+2) {
    background: linear-gradient(135deg, #faf5ff, #fff);
    border-color: #ddd6fe;
}
.qs-stock-panel:nth-child(5n+3) {
    background: linear-gradient(135deg, #fdf2f8, #fff);
    border-color: #fbcfe8;
}
.qs-stock-panel:nth-child(5n+4) {
    background: linear-gradient(135deg, #ecfeff, #fff);
    border-color: #a5f3fc;
}
.qs-stock-panel:nth-child(5n+5) {
    background: linear-gradient(135deg, #f0fdf4, #fff);
    border-color: #bbf7d0;
}
.qs-stock-panel:nth-child(5n+6),
.qs-stock-panel:nth-child(5n+1):not(:first-child) {
    background: linear-gradient(135deg, #fff7ed, #fff);
    border-color: #fed7aa;
}

.qs-stock-panel:hover {
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.1);
}

.qs-stock-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    flex-wrap: wrap;
    gap: 6px;
}

.qs-stock-panel-title {
    font-size: 0.92rem;
}

.qs-stock-panel-title strong {
    font-size: 0.95rem;
}

.qs-stock-panel-title {
    color: #5b21b6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qs-stock-panel-title strong {
    color: #4c1d95;
    font-weight: 700;
}

.qs-stock-panel-title small {
    color: #9ca3af;
    font-size: 0.72rem;
    direction: ltr;
}

.qs-stock-badge {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff !important;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
}

@media (max-width: 600px) {
    .qs-stepper { padding: 14px 12px; }
    .qs-step-circle { width: 32px; height: 32px; font-size: 0.85rem; }
    .qs-step-label { font-size: 0.7rem; }
    .qs-step-line { max-width: 40px; }
    .qs-goal-card { padding: 18px; }
    .qs-goal-input { font-size: 1.2rem; }
    .qs-launcher { padding: 36px 20px; }
    .qs-launcher h3 { font-size: 1.3rem; }
}

/* ====================================================================
   🚀 v3.7 — تحسينات شاشة النتيجة
==================================================================== */

/* جملة فوق الرقم في الـ Hero */
.qs-hero-amount-label-top {
    font-size: 0.88rem;
    color: #6b7280;
    margin-bottom: 8px;
    line-height: 1.5;
    font-weight: 500;
}

/* الإحصائيات تتسع لـ 5 بطاقات */
.qs-result-stats {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
}

/* تقليل padding البطاقة عشان تخش 5 */
.qs-stat-card {
    padding: 14px 10px;
}

.qs-stat-value {
    font-size: 1.15rem;
}

.qs-stat-label {
    font-size: 0.74rem;
}

/* ============== تفصيل الأسهم ============== */
.qs-stocks-breakdown {
    margin-top: 22px;
    background: linear-gradient(135deg, #faf5ff, #fdf2f8);
    border: 1px solid #e9d5ff;
    border-radius: 14px;
    padding: 16px;
}

.qs-breakdown-title {
    color: #5b21b6 !important;
    font-size: 1rem !important;
    margin: 0 0 12px 0 !important;
    font-weight: 700 !important;
}

.qs-stock-row {
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.qs-stock-row:last-child {
    margin-bottom: 0;
}

.qs-stock-row:hover {
    border-color: #c4b5fd;
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.1);
}

.qs-stock-row-name {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f3e8ff;
}

.qs-stock-row-name strong {
    color: #4c1d95 !important;
    font-size: 1rem;
    font-weight: 700;
}

.qs-stock-row-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.qs-stock-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.qs-stock-stat span {
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 500;
}

.qs-stock-stat strong {
    color: #1f2937;
    font-size: 0.95rem;
    font-weight: 700;
}

.qs-stock-stat-pos {
    color: #059669 !important;
}

@media (max-width: 768px) {
    .qs-stock-row-stats { grid-template-columns: repeat(2, 1fr); }
    .qs-result-stats { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ====================================================================
   🆕 v3.8 — زر "+ كمية" + Modal إضافة معاملة
==================================================================== */

.btn-add-tx {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-inline-end: 4px;
}

.btn-add-tx:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

/* عرض اسم السهم المحدّد في modal */
.add-tx-stock-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #6ee7b7;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.add-tx-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.add-tx-stock-info strong {
    display: block;
    color: #065f46;
    font-size: 1.05rem;
}

.add-tx-stock-info small {
    display: block;
    color: #047857;
    font-size: 0.78rem;
    margin-top: 2px;
    direction: ltr;
}

/* ====================================================================
   🆕 v3.8 — قسم التوزيعات القادمة
==================================================================== */

.upcoming-divs-section {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin: 24px 0;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.upcoming-divs-header {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #fcd34d;
}

.upcoming-divs-header h3 {
    margin: 0;
    color: #78350f !important;
    font-size: 1.1rem;
    font-weight: 800;
}

.btn-refresh-upcoming {
    background: #fff;
    border: 1px solid #fbbf24;
    color: #92400e;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-refresh-upcoming:hover {
    background: #fbbf24;
    color: #fff;
    transform: rotate(180deg);
}

.upcoming-divs-content {
    padding: 16px 20px;
}

.upcoming-divs-loading,
.upcoming-divs-empty {
    text-align: center;
    padding: 30px 20px;
    color: #6b7280;
}

.upcoming-divs-empty strong {
    display: block;
    color: #374151;
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.upcoming-divs-empty p {
    color: #6b7280;
    font-size: 0.88rem;
    line-height: 1.7;
    max-width: 480px;
    margin: 0 auto;
}

.upcoming-empty-icon {
    font-size: 2.8rem;
    margin-bottom: 10px;
}

/* ====== ملخّص (3 بطاقات) ====== */
.upcoming-divs-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.ud-sum-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 14px;
    text-align: center;
}

.ud-sum-item span {
    display: block;
    color: #6b7280;
    font-size: 0.78rem;
    margin-bottom: 4px;
}

.ud-sum-item strong {
    display: block;
    color: #1f2937;
    font-size: 1.15rem;
    font-weight: 800;
}

.ud-sum-highlight {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #fcd34d;
}

.ud-sum-highlight strong {
    color: #78350f;
}

.ud-sum-highlight span {
    color: #92400e;
}

/* ====== قائمة التوزيعات ====== */
.upcoming-divs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upcoming-div-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
    transition: all 0.2s;
}

.upcoming-div-card:hover {
    border-color: #fbbf24;
    box-shadow: 0 4px 14px rgba(251, 191, 36, 0.15);
}

/* تصنيفات حسب القرب */
.upcoming-div-card.ud-today {
    background: linear-gradient(135deg, #fef2f2, #fff);
    border-color: #fecaca;
}

.upcoming-div-card.ud-soon {
    background: linear-gradient(135deg, #fff7ed, #fff);
    border-color: #fed7aa;
}

.upcoming-div-card.ud-near {
    background: linear-gradient(135deg, #fefce8, #fff);
    border-color: #fde68a;
}

.upcoming-div-card.ud-past {
    background: linear-gradient(135deg, #f0fdf4, #fff);
    border-color: #bbf7d0;
    opacity: 0.85;
}

.ud-card-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.ud-card-body {
    flex: 1;
    min-width: 0;
}

.ud-card-name {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.ud-card-name strong {
    color: #111827;
    font-size: 0.95rem;
    font-weight: 700;
}

.ud-symbol {
    color: #6b7280;
    font-size: 0.72rem;
    direction: ltr;
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 4px;
}

.ud-period {
    color: #5b21b6;
    font-size: 0.7rem;
    background: #f5f3ff;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #ddd6fe;
}

.ud-card-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.ud-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ud-stat span {
    color: #1f2937;
    font-size: 0.92rem;
    font-weight: 700;
}

.ud-stat small {
    color: #9ca3af;
    font-size: 0.7rem;
}

.ud-stat-amount span {
    color: #047857 !important;
    font-size: 1rem !important;
}

.ud-card-time {
    text-align: center;
    flex-shrink: 0;
    min-width: 100px;
}

.ud-days-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
}

.ud-today .ud-days-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    animation: udPulse 1.5s ease-in-out infinite;
}

@keyframes udPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

.ud-soon .ud-days-badge {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

.ud-past .ud-days-badge {
    background: linear-gradient(135deg, #10b981, #059669);
}

.ud-card-time small {
    display: block;
    color: #6b7280;
    font-size: 0.7rem;
    margin-top: 2px;
}

@media (max-width: 768px) {
    .upcoming-div-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .ud-card-time {
        width: 100%;
        text-align: start;
    }
    .ud-card-stats {
        gap: 10px;
    }
}

/* ====================================================================
   🌐 شريط متحرك للتوزيعات القادمة (مدمج، شفاف)
==================================================================== */

.market-upcoming-ribbon {
    display: flex;
    align-items: center;
    width: 95%;
    max-width: 1100px;
    margin: 12px auto;
    background: transparent;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    border-top: 1px solid #e5e7eb;
    padding: 0;
    overflow: hidden;
    box-shadow: none;
    border-radius: 0;
}

/* اللصيقة الجانبية: العنوان (شفافة، بسيطة) */
.mur-label {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: transparent;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.82rem;
    border-inline-end: 1px solid #e5e7eb;
}

.mur-label span {
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.7;
}

.mur-label strong {
    color: #374151 !important;
    white-space: nowrap;
    font-weight: 600;
}

/* حاوية المسار المتحرك — تحدّ العرض بشكل صارم */
.mur-marquee-wrap {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    position: relative;
    padding: 6px 0;
    /* ارتفاع أدنى لضمان المرئية حتى لو الأطفال طولهم متفاوت */
    min-height: 32px;
    display: flex;
    align-items: center;
}

/* الشريط المتحرك */
.mur-marquee {
    display: flex;
    gap: 6px;
    white-space: nowrap;
    width: max-content;
    animation: murScroll 60s linear infinite;
    will-change: transform;
}

.mur-marquee-wrap:hover .mur-marquee {
    animation-play-state: paused;
}

/* في RTL: نبدأ من اليمين ونتحرك ليساراً */
@keyframes murScroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

/* عنصر واحد (chip ملوّن حسب القرب) */
.mur-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    flex-shrink: 0;
    transition: transform 0.15s;
    cursor: default;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.mur-item:hover {
    transform: translateY(-1px);
}

.mur-item-name {
    font-weight: 600;
    color: #374151;
}

.mur-item-value {
    color: #6b7280;
    direction: ltr;
    font-weight: 500;
    font-size: 0.74rem;
}

.mur-item-days {
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
}

/* تصنيف حسب القرب — chips ملوّنة بالكامل */
.mur-item.mur-today {
    background: #fef2f2;
    border-color: #fecaca;
}
.mur-item.mur-today .mur-item-days,
.mur-item.mur-today .mur-item-name {
    color: #b91c1c;
}

.mur-item.mur-soon {
    background: #fff7ed;
    border-color: #fed7aa;
}
.mur-item.mur-soon .mur-item-days,
.mur-item.mur-soon .mur-item-name {
    color: #c2410c;
}

.mur-item.mur-near {
    background: #fefce8;
    border-color: #fde68a;
}
.mur-item.mur-near .mur-item-days,
.mur-item.mur-near .mur-item-name {
    color: #a16207;
}

.mur-item.mur-future {
    background: #f0f9ff;
    border-color: #bae6fd;
}
.mur-item.mur-future .mur-item-name {
    color: #0369a1;
}

.mur-item.mur-past {
    background: #f0fdf4;
    border-color: #bbf7d0;
    opacity: 0.65;
}
.mur-item.mur-past .mur-item-days,
.mur-item.mur-past .mur-item-name {
    color: #15803d;
}

/* رسائل (فارغ، خطأ) */
.mur-msg {
    padding: 8px 14px;
    font-size: 0.8rem;
    line-height: 1.6;
    width: 100%;
    white-space: normal;
}

.mur-msg-empty {
    color: #9ca3af;
}

.mur-msg-err {
    color: #991b1b;
}

@media (max-width: 768px) {
    .mur-label { padding: 8px 10px; font-size: 0.74rem; gap: 4px; }
    .mur-label span { font-size: 0.85rem; }
    .mur-label strong { font-size: 0.74rem; }
    .mur-item { padding: 3px 8px; font-size: 0.72rem; gap: 4px; }
    .mur-item-value { font-size: 0.68rem; }
    .mur-item-days { font-size: 0.66rem; }
}

/* ====================================================================
   🛡️ v4.0 — تبويب الأمان في لوحة الإدارة
==================================================================== */

.security-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.security-section h3 {
    color: #1f2937 !important;
    margin: 0 0 18px 0 !important;
    font-size: 1.15rem !important;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 12px;
}

.security-intro {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 18px 22px;
}

.security-intro h3 {
    color: #1e40af !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 8px !important;
}

.security-intro p {
    color: #1e3a8a;
    line-height: 1.7;
    margin: 0;
}

/* مربّع الشرح */
.security-explain {
    background: #f9fafb;
    border-inline-start: 4px solid #6366f1;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 18px;
}

.security-explain h4 {
    color: #4338ca !important;
    margin: 12px 0 6px 0 !important;
    font-size: 0.92rem !important;
    font-weight: 700;
}

.security-explain h4:first-child {
    margin-top: 0 !important;
}

.security-explain p {
    color: #4b5563;
    line-height: 1.7;
    margin: 0 0 8px 0;
    font-size: 0.9rem;
}

.security-explain ul {
    margin: 6px 0;
    padding-inline-start: 22px;
}

.security-explain li {
    color: #4b5563;
    line-height: 1.7;
    font-size: 0.88rem;
    margin-bottom: 4px;
}

.security-explain code {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #7c3aed;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    direction: ltr;
    display: inline-block;
}

/* جدول Rate Limits */
.rate-limits-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 0.88rem;
}

.rate-limits-table th {
    background: #f3f4f6;
    color: #374151;
    padding: 10px 12px;
    text-align: start;
    font-weight: 700;
    border-bottom: 2px solid #e5e7eb;
}

.rate-limits-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.rate-limits-table code {
    background: #1f2937;
    color: #fbbf24;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.82em;
}

.rate-limits-table input[type="number"] {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
}

.rate-desc {
    color: #6b7280;
    font-size: 0.82rem;
}

/* تلوين الصفوف حسب المستوى */
.rate-row-red {
    background: linear-gradient(90deg, #fef2f2, transparent 300px);
}
.rate-row-yellow {
    background: linear-gradient(90deg, #fefce8, transparent 300px);
}
.rate-row-green {
    background: linear-gradient(90deg, #f0fdf4, transparent 300px);
}

/* فورم الأمان */
.security-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.security-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.security-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.security-field label {
    color: #374151;
    font-size: 0.88rem;
    font-weight: 700;
}

.security-field input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
}

.security-field input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.security-field small {
    color: #6b7280;
    font-size: 0.78rem;
    line-height: 1.5;
}

/* بطاقة الـ Quota */
.quota-card {
    border-radius: 14px;
    padding: 20px;
}

.quota-good {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #86efac;
}
.quota-warn {
    background: linear-gradient(135deg, #fefce8, #fef3c7);
    border: 1px solid #fbbf24;
}
.quota-danger {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #ef4444;
}

.quota-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.quota-stat {
    text-align: center;
}

.quota-stat span {
    display: block;
    color: #6b7280;
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.quota-stat strong {
    display: block;
    color: #1f2937;
    font-size: 1.4rem;
    font-weight: 800;
}

.quota-bar-wrap {
    height: 12px;
    background: rgba(0,0,0,0.08);
    border-radius: 6px;
    overflow: hidden;
}

.quota-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

.quota-good .quota-bar {
    background: linear-gradient(90deg, #10b981, #059669);
}
.quota-warn .quota-bar {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}
.quota-danger .quota-bar {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* جداول الأمان */
.security-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.88rem;
}

.security-table th {
    background: #f3f4f6;
    color: #374151;
    padding: 10px 12px;
    text-align: start;
    font-weight: 700;
    border-bottom: 2px solid #e5e7eb;
}

.security-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.security-table code {
    background: #1f2937;
    color: #fbbf24;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.82em;
    direction: ltr;
    display: inline-block;
}

.att-count {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.att-low { background: #f3f4f6; color: #4b5563; }
.att-mid { background: #fef3c7; color: #92400e; }
.att-high { background: #fee2e2; color: #991b1b; }

.badge-locked {
    background: #fee2e2;
    color: #991b1b;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-unlocked {
    background: #dcfce7;
    color: #166534;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
}

.security-empty {
    text-align: center;
    padding: 30px 20px;
    background: #f9fafb;
    border-radius: 10px;
    color: #6b7280;
    font-size: 0.95rem;
}

.security-headers-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.security-headers-list li {
    background: #f9fafb;
    padding: 10px 14px;
    margin-bottom: 6px;
    border-radius: 8px;
    border-inline-start: 3px solid #10b981;
    font-size: 0.88rem;
    color: #4b5563;
    line-height: 1.6;
}

.security-headers-list strong {
    color: #1f2937;
    font-family: monospace;
    direction: ltr;
    display: inline-block;
}

@media (max-width: 768px) {
    .rate-limits-table { font-size: 0.78rem; }
    .rate-limits-table input[type="number"] { width: 65px; }
    .rate-desc { display: none; }
    .quota-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ====================================================================
   📊 لوحة المعلومات الجديدة (Layout مدمج: ملخص + رسم + توزيعات)
==================================================================== */

.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    width: 95%;
    max-width: 1100px;
    margin: 16px auto;
}

/* ===== العمود الأيسر ===== */
.dl-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

/* البطاقات (٥ بطاقات) */
.dl-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.dl-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.15s, box-shadow 0.15s;
}

.dl-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.dl-card-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.dl-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 100%;
}

.dl-card-label {
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 500;
}

.dl-card-num {
    color: #1f2937;
    font-size: 1.15rem;
    font-weight: 800;
    direction: ltr;
    text-align: center;
}

/* ألوان البطاقات (حد علوي بدل جانبي) */
.dl-card-value { border-top: 3px solid #3b82f6; }
.dl-card-pos   { border-top: 3px solid #10b981; }
.dl-card-pos .dl-card-num   { color: #047857; }
.dl-card-neg   { border-top: 3px solid #ef4444; }
.dl-card-neg .dl-card-num   { color: #b91c1c; }
.dl-card-div   { border-top: 3px solid #f59e0b; }
.dl-card-reinv { border-top: 3px solid #8b5cf6; }
.dl-card-cash  { border-top: 3px solid #06b6d4; }

/* ===== التوزيعات القادمة (chips مدمج) ===== */
.dl-upcoming {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.dl-upcoming-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.dl-upcoming-header h4 {
    margin: 0;
    color: #1f2937 !important;
    font-size: 0.92rem !important;
    font-weight: 700;
}

.dl-upcoming-total {
    color: #6b7280;
    font-size: 0.82rem;
}

.dl-upcoming-total strong {
    color: #047857;
    font-weight: 700;
    direction: ltr;
    display: inline-block;
}

.dl-upcoming-content {
    min-height: 32px;
}

.dl-upcoming-loading,
.dl-upcoming-empty {
    color: #9ca3af;
    font-size: 0.85rem;
    text-align: center;
    padding: 14px;
}

.dl-upcoming-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* chip التوزيع */
.dl-up-chip {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    min-width: 130px;
    transition: transform 0.15s;
    cursor: default;
}

.dl-up-chip:hover {
    transform: translateY(-2px);
}

.dl-up-chip-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.dl-up-chip-amount {
    font-size: 0.92rem;
    font-weight: 800;
    color: #047857;
    direction: ltr;
    text-align: start;
}

.dl-up-chip-amount small {
    font-size: 0.62rem;
    color: #9ca3af;
    font-weight: 500;
    margin-inline-start: 3px;
}

.dl-up-chip-days {
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    margin-top: 2px;
    background: #f3f4f6;
    color: #4b5563;
}

/* تصنيفات الـ chip */
.dl-up-chip.dl-up-today {
    background: linear-gradient(135deg, #fef2f2, #fff);
    border-color: #fca5a5;
}
.dl-up-chip.dl-up-today .dl-up-chip-days {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    animation: dlUpPulse 1.5s infinite;
}

.dl-up-chip.dl-up-soon { border-color: #fdba74; }
.dl-up-chip.dl-up-soon .dl-up-chip-days {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
}

.dl-up-chip.dl-up-near { border-color: #fde68a; }
.dl-up-chip.dl-up-near .dl-up-chip-days {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.dl-up-chip.dl-up-past { opacity: 0.65; }
.dl-up-chip.dl-up-past .dl-up-chip-days {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

@keyframes dlUpPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

/* ===== العمود الأيمن (الرسم البياني) ===== */
.dl-side {
    display: flex;
    flex-direction: column;
}

.dl-chart-wrap {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dl-chart-title {
    color: #1f2937;
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.dl-chart-canvas-wrap {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    position: relative;
}

.dl-chart-canvas-wrap canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    height: 100% !important;
}

.dl-chart-top {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 14px;
}

.dl-chart-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 0.78rem;
}

.dl-chart-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dl-chart-name {
    flex: 1;
    color: #1f2937;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dl-chart-pct {
    color: #6b7280;
    font-weight: 700;
    direction: ltr;
}


/* ====================================================================
   📱 Bottom Nav — مخفي على الكمبيوتر، يظهر على الجوال فقط
==================================================================== */
.mobile-bottom-nav {
    display: none;
}

/* البحث الذكي المضغوط (سطر واحد فوق الداشبورد) */
.quick-add-compact {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 95%;
    max-width: 1100px;
    margin: 14px auto 0;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.qac-title {
    flex-shrink: 0;
    color: #1f2937;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.qac-search-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
}

.qac-search-wrap input {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: inherit;
    background: #f9fafb;
    transition: all 0.15s;
    box-sizing: border-box;
}

.qac-search-wrap input:focus {
    outline: none;
    border-color: #1d4ed8;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

/* dropdown النتائج (نفس التصميم القديم) */
.qac-search-wrap .search-results-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    z-index: 100;
}

/* ====================================================================
   📊 رمز السهم تحت الاسم + نسبة التغيّر اليومية
==================================================================== */

.stock-name-cell strong {
    display: block;
    color: #1f2937;
    font-weight: 700;
}

.stock-symbol-sub {
    display: block;
    color: #9ca3af;
    font-size: 0.78rem;
    font-weight: 500;
    direction: ltr;
    margin-top: 2px;
}

/* السعر والقيمة السوقية: الرقم فوق + النسبة تحته */
.container > table tbody td strong + .day-change {
    display: block;
    margin-top: 3px;
}

.day-change {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    direction: ltr;
    margin-top: 3px;
}

.change-pos {
    color: #047857;
}

.change-neg {
    color: #b91c1c;
}

.change-zero {
    color: #1f2937;
}

/* نسبة الربح/الخسارة تحت الرقم (في عمود الربح) */
.profit-pct {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 3px;
    direction: ltr;
}

.profit-pct.pos { color: #047857; }
.profit-pct.neg { color: #b91c1c; }

/* تأكد إن الـ strong يطلع كـ block فوق الـ small */
.container > table tbody td strong {
    display: block;
}

/* تأكد إن الـ td يحاذي للأعلى */
.container > table tbody td {
    vertical-align: top;
}

/* ====================================================================
   💰 نظام العملات (الريال السعودي SVG + بقية العملات)
==================================================================== */

.cur-amount {
    display: inline-flex;
    align-items: baseline;
    gap: 0.15em;
    direction: ltr;
    white-space: nowrap;
    flex-direction: row;
}

.cur-num {
    font-family: inherit;
    direction: ltr;
}

.cur-symbol {
    font-size: 0.85em;
    color: inherit;
    opacity: 0.85;
    font-weight: inherit;
}

/* رمز الريال السعودي - SVG */
/* رمز الريال السعودي - SVG (محصّن ضد أي صفحة) */
.riyal-symbol {
    /* الحجم نسبي لحجم الخط في العنصر الأب */
    width: 0.85em !important;
    height: 0.85em !important;
    min-width: 0.85em;
    max-width: 0.85em;
    /* اللون من النص حواليه */
    fill: currentColor;
    /* عدم الانكماش داخل flex */
    flex-shrink: 0;
    /* محاذاة بصرية مع الأرقام */
    vertical-align: -0.08em;
    /* منع أي تأثيرات display خارجية */
    display: inline-block;
}

/* ====================================================================
   ⚙️ الخطوة ٣ (تصميم مدمج): قائمة الأسهم بـ chips + collapsible
==================================================================== */

.qs-step3-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

/* صف السهم (مدمج) */
.qs-step3-row {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
}

.qs-step3-row.qs-step3-row-open {
    border-color: #c026d3;
    box-shadow: 0 4px 12px rgba(192, 38, 211, 0.08);
}

.qs-step3-header {
    display: grid;
    grid-template-columns: minmax(180px, auto) 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.qs-step3-header:hover {
    background: #fafafa;
}

.qs-step3-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.92rem;
    color: #1f2937;
}

.qs-step3-title strong {
    color: #1f2937;
    font-weight: 700;
}

.qs-step3-title small {
    color: #9ca3af;
    font-size: 0.75rem;
    direction: ltr;
}

.qs-step3-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    min-height: 24px;
}

.qs-step3-chips-empty {
    color: #9ca3af;
    font-size: 0.78rem;
    font-style: italic;
}

.qs-chip {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid;
    white-space: nowrap;
}

.qs-chip-monthly  { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.qs-chip-discount { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.qs-chip-increase { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.qs-chip-delay    { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }
.qs-chip-lump     { background: #fce7f3; color: #be185d; border-color: #fbcfe8; }

.qs-step3-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.qs-step3-reset-btn,
.qs-step3-toggle-btn {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 0.78rem;
    color: #4b5563;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.qs-step3-toggle-btn {
    background: #c026d3;
    color: #fff;
    border-color: #c026d3;
    font-weight: 600;
}

.qs-step3-toggle-btn:hover {
    background: #a21caf;
    border-color: #a21caf;
}

.qs-step3-reset-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.qs-step3-row-open .qs-step3-toggle-btn {
    background: #6b7280;
    border-color: #6b7280;
}

.qs-step3-body {
    padding: 14px;
    border-top: 1px solid #f3f4f6;
    background: #fafafa;
}

/* في الجوال */
@media (max-width: 768px) {
    .qs-step3-header {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .qs-step3-actions {
        justify-content: flex-end;
    }
}

/* ====================================================================
   📋 صف السهم قابل للنقر (يفتح تفاصيل المحفظة)
==================================================================== */

.stock-row-clickable {
    cursor: pointer;
    transition: background 0.15s;
}

.stock-row-clickable:hover {
    background: #f8fafc;
}

.stock-row-clickable:hover td {
    background: #f8fafc;
}

/* الأزرة في الخلية الأخيرة لا تنقل النقر للـ row */
.stock-actions-cell {
    cursor: default;
}

/* ====================================================================
   📊 أداء السهم اليومي (في modal التفاصيل)
==================================================================== */

.daily-perf-loading,
.daily-perf-error {
    text-align: center;
    padding: 24px 16px;
    color: #6b7280;
    font-size: 0.9rem;
}

.daily-perf-error {
    color: #b91c1c;
    background: #fef2f2;
    border-radius: 8px;
}

.daily-perf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.dp-card {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
    transition: background 0.15s;
}

.dp-card:hover {
    background: #f3f4f6;
}

.dp-card-main {
    grid-column: 1 / -1;
    background: #fff;
    border: 2px solid #e5e7eb;
    padding: 14px;
}

.dp-card-label {
    font-size: 0.72rem;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 500;
}

.dp-card-value {
    font-size: 0.95rem;
    color: #1f2937;
    font-weight: 700;
    direction: ltr;
}

.dp-card-main .dp-card-value {
    font-size: 1.4rem;
}

.dp-card-sub {
    font-size: 0.78rem;
    margin-top: 3px;
    font-weight: 600;
    direction: ltr;
}

/* ===== شريط النطاق ===== */
.dp-range-section {
    margin-bottom: 12px;
}

.dp-range-title {
    font-size: 0.78rem;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 600;
}

.dp-range-bar-wrap {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    direction: ltr;
}

.dp-range-low,
.dp-range-high {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4b5563;
    direction: ltr;
}

.dp-range-low { color: #b91c1c; }
.dp-range-high { color: #047857; }

.dp-range-bar {
    position: relative;
    height: 10px;
    background: linear-gradient(to right, #fee2e2 0%, #fef3c7 50%, #d1fae5 100%);
    border-radius: 999px;
    overflow: visible;
}

.dp-range-bar-52 {
    background: linear-gradient(to right, #fecaca 0%, #fde68a 50%, #a7f3d0 100%);
}

.dp-range-marker {
    position: absolute;
    top: -3px;
    width: 16px;
    height: 16px;
    background: #1f2937;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transform: translateX(50%);
    transition: right 0.4s ease-out;
}

.dp-range-marker-52 {
    background: #6b21a8;
}

/* ===== وقت آخر تحديث ===== */
.dp-update-time {
    text-align: center;
    color: #9ca3af;
    font-size: 0.74rem;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;
}

/* الجوال */
@media (max-width: 700px) {
    .daily-perf-grid {
        grid-template-columns: 1fr 1fr;
    }
    .dp-card-main {
        grid-column: 1 / -1;
    }
    .dp-card-main .dp-card-value {
        font-size: 1.2rem;
    }
}

/* ====================================================================
   🎯 خطة هذا الشهر — لنسعى معاً
==================================================================== */

.goal-plan-container {
    max-width: 1100px;
    margin: 0 auto 24px;
    width: 95%;
}

.goal-plan-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fcd34d 100%);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
    position: relative;
    overflow: hidden;
}

.goal-plan-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 60%);
    pointer-events: none;
}

.gp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.gp-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gp-emoji {
    font-size: 1.3rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.gp-title h3 {
    margin: 0;
    color: #78350f;
    font-size: 1.05rem;
    font-weight: 800;
}

.gp-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.gp-stat-badge {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid;
}

.gp-stat-current {
    background: #fff;
    color: #92400e;
    border-color: #fbbf24;
}

.gp-stat-late {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.gp-subtitle {
    color: #78350f;
    font-size: 0.85rem;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.gp-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.gp-item {
    background: #fff;
    border-radius: 9px;
    padding: 9px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    transition: all 0.2s;
    border: 2px solid transparent;
}

.gp-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.gp-item-late {
    border-color: #fca5a5;
    background: #fef9f9;
}

.gp-item-main {
    flex: 1;
    min-width: 0;
}

.gp-item-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 5px;
}

.gp-item-name strong {
    color: #1f2937;
    font-size: 0.9rem;
    font-weight: 700;
}

.gp-item-symbol {
    color: #9ca3af;
    font-size: 0.72rem;
    direction: ltr;
}

.gp-late-tag {
    background: #fee2e2;
    color: #b91c1c;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
}

.gp-item-detail {
    color: #4b5563;
    font-size: 0.8rem;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.gp-item-detail strong {
    color: #1f2937;
    font-weight: 700;
}

.gp-discount-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    border: 1px solid #fde68a;
}

.gp-item-total {
    color: #6b7280;
    font-size: 0.74rem;
}

.gp-item-total strong {
    color: #047857;
    font-weight: 700;
}

.gp-item-actions {
    flex-shrink: 0;
}

.gp-btn-done {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    transition: all 0.15s;
    white-space: nowrap;
}

.gp-btn-done:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

.gp-btn-done:active {
    transform: translateY(0);
}

.gp-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(120, 53, 15, 0.25);
    text-align: center;
    color: #78350f;
    position: relative;
    z-index: 1;
}

.gp-footer small {
    color: #78350f;
    font-size: 0.72rem;
}

/* Modal تأكيد الإنجاز */
.gc-stock-info {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.gc-stock-info strong {
    display: block;
    font-size: 1.2rem;
    color: #1f2937;
    margin-bottom: 4px;
}

.gc-stock-info small {
    color: #6b7280;
}

.gc-suggested-box {
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.gc-suggested-box small {
    color: #92400e;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

.gc-row {
    color: #78350f;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.gc-row strong {
    color: #1f2937;
    font-weight: 700;
}

.gc-discount-row {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #fde68a;
    color: #92400e;
    font-weight: 600;
}

.gc-hint {
    margin-top: 8px !important;
    color: #78350f !important;
    font-style: italic;
    font-weight: normal !important;
}

/* رسالة الاحتفال */
.gp-celebration-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    padding: 16px 28px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
    z-index: 10000;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.gp-celebration-show {
    transform: translateX(-50%) translateY(0);
}

/* الجوال */
@media (max-width: 700px) {
    .goal-plan-card {
        padding: 16px;
    }
    .gp-title h3 {
        font-size: 1.15rem;
    }
    .gp-emoji {
        font-size: 1.5rem;
    }
    .gp-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .gp-item-actions {
        width: 100%;
    }
    .gp-btn-done {
        width: 100%;
    }
    .gp-celebration-toast {
        left: 16px;
        right: 16px;
        transform: translateY(-100px);
        font-size: 0.95rem;
        padding: 14px 20px;
    }
    .gp-celebration-show {
        transform: translateY(0);
    }
}

/* ====================================================================
   ✅ البنود المنجزة + زر التراجع
==================================================================== */

.gp-stat-done {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

.gp-completed-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed rgba(120, 53, 15, 0.3);
    position: relative;
    z-index: 1;
}

.gp-completed-summary {
    cursor: pointer;
    color: #065f46;
    font-weight: 700;
    font-size: 0.92rem;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    list-style: none;
    user-select: none;
}

.gp-completed-summary::-webkit-details-marker {
    display: none;
}

.gp-completed-summary:hover {
    background: rgba(16, 185, 129, 0.2);
}

.gp-completed-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gp-completed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.6);
    padding: 8px 12px;
    border-radius: 8px;
    flex-wrap: wrap;
}

.gp-completed-icon {
    font-size: 1rem;
}

.gp-completed-name {
    font-weight: 700;
    color: #065f46;
    flex: 1;
    min-width: 0;
}

.gp-completed-period {
    color: #6b7280;
    font-size: 0.82rem;
}

.gp-undo-btn {
    background: #fff;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    padding: 5px 12px;
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.gp-undo-btn:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

@media (max-width: 700px) {
    .gp-completed-item {
        font-size: 0.85rem;
    }
}


/* ====================================================================
   🎯 شريط التقدّم نحو الهدف (مدمج، RTL، قابل للطي)
==================================================================== */

.gp-progress {
    background: rgba(255, 255, 255, 0.65);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

/* الصف المختصر: أيقونة + شريط + نسبة + زر طي */
.gp-progress-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gp-progress-stage-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    line-height: 1;
}

.gp-progress-track {
    flex: 1;
    min-width: 0;
}

.gp-progress-bar-bg {
    height: 8px;
    background: rgba(120, 53, 15, 0.15);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    /* RTL: التعبئة من اليمين لليسار */
    direction: rtl;
}

.gp-progress-fill {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #059669 0%, #10b981 100%);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
    transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gp-progress-pct {
    font-size: 0.82rem;
    font-weight: 700;
    color: #047857;
    flex-shrink: 0;
    min-width: 40px;
    text-align: center;
}

.gp-progress-toggle {
    background: rgba(120, 53, 15, 0.1);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #78350f;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.15s;
    padding: 0;
    font-family: inherit;
}

.gp-progress-toggle:hover {
    background: rgba(120, 53, 15, 0.2);
}

.gp-toggle-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* التفاصيل (قابلة للطي) */
.gp-progress-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(120, 53, 15, 0.2);
    overflow: hidden;
    max-height: 200px;
    transition: max-height 0.3s ease, opacity 0.2s, margin-top 0.3s, padding-top 0.3s;
    opacity: 1;
}

.gp-progress-details.gp-details-collapsed {
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    border-top-color: transparent;
    opacity: 0;
}

.gp-progress-message {
    font-size: 0.82rem;
    color: #78350f;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
}

.gp-progress-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gp-stat-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: #4b5563;
    padding: 3px 0;
}

.gp-stat-line span {
    color: #6b7280;
    font-weight: 600;
}

.gp-stat-line strong {
    color: #1f2937;
    font-weight: 700;
}

.gp-stat-line strong small {
    color: #9ca3af;
    font-weight: 500;
    margin-right: 3px;
}

.gp-stat-actual strong {
    color: #047857;
}

/* الجوال */
@media (max-width: 700px) {
    .gp-progress {
        padding: 7px 10px;
    }
    .gp-progress-mini {
        gap: 8px;
    }
    .gp-progress-stage-icon {
        font-size: 1.1rem;
    }
    .gp-progress-pct {
        font-size: 0.75rem;
        min-width: 36px;
    }
    .gp-progress-toggle {
        width: 22px;
        height: 22px;
    }
    .gp-stat-line,
    .gp-progress-message {
        font-size: 0.78rem;
    }
}

/* ====================================================================
   🎯 شريط تواريخ الأحقية (تمييز لوني عن شريط التوزيعات)
==================================================================== */

.mur-eligibility {
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    border-color: #fbbf24;
}

.mur-eligibility .mur-label {
    background: #fbbf24;
    color: #78350f;
}

.mur-eligibility .mur-label strong {
    color: #78350f;
}

/* عنصر الأحقية فيه تاريخ إضافي */
.mur-item.mur-elig {
    background: rgba(255, 255, 255, 0.85);
    border-color: #fcd34d;
}

.mur-item.mur-elig .mur-item-date {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #fde68a;
    direction: ltr;
}

/* الجوال */
@media (max-width: 700px) {
    .mur-item.mur-elig .mur-item-date {
        font-size: 0.7rem;
        padding: 1px 6px;
    }
}

/* dashboard layout بدون أسهم — عمود واحد */
.dashboard-layout-empty {
    grid-template-columns: 1fr !important;
}

/* ====================================================================
   💡 بانر الضيف في تخيّل ونفّذ
==================================================================== */

.qs-guest-banner {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    border: 1px solid #c4b5fd;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.qs-gb-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.qs-gb-text {
    flex: 1;
}

.qs-gb-text strong {
    display: block;
    color: #5b21b6;
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.qs-gb-text small {
    display: block;
    color: #5b21b6;
    font-size: 0.82rem;
    line-height: 1.6;
}

.qs-gb-text a {
    color: #5b21b6;
    font-weight: 700;
    text-decoration: underline;
}

.qs-gb-text a:hover {
    color: #4c1d95;
}

@media (max-width: 700px) {
    .qs-guest-banner {
        padding: 10px 12px;
    }
    .qs-gb-text strong {
        font-size: 0.88rem;
    }
    .qs-gb-text small {
        font-size: 0.78rem;
    }
}

/* ====================================================================
   📭 حالة فارغة: لا توجد أسهم في المحفظة
==================================================================== */

.empty-portfolio {
    text-align: center;
    padding: 50px 30px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 16px;
    border: 2px dashed #d1d5db;
}

.empty-portfolio .ep-icon {
    font-size: 4rem;
    margin-bottom: 14px;
    opacity: 0.7;
}

.empty-portfolio h3 {
    color: #1f2937;
    font-size: 1.4rem;
    margin: 0 0 10px;
    font-weight: 700;
}

.empty-portfolio p {
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.7;
    max-width: 480px;
    margin: 0 auto 20px;
}

.empty-portfolio .ep-arrow {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #fde68a;
    animation: ep-bounce 2s ease-in-out infinite;
}

@keyframes ep-bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

@media (max-width: 700px) {
    .empty-portfolio {
        padding: 35px 20px;
    }
    .empty-portfolio .ep-icon {
        font-size: 3rem;
    }
    .empty-portfolio h3 {
        font-size: 1.15rem;
    }
    .empty-portfolio p {
        font-size: 0.9rem;
    }
    .empty-portfolio .ep-arrow {
        font-size: 0.8rem;
        padding: 8px 14px;
    }
}

/* ====================================================================
   📱 إصلاحات iOS Safari للـ Wizard
==================================================================== */

/* iOS Safari: scroll smooth داخل modal طويل */
.qs-modal,
.qs-body {
    -webkit-overflow-scrolling: touch;
}

/* iOS Safari: منع الـ zoom التلقائي على inputs */
.qs-modal input[type="text"],
.qs-modal input[type="number"],
.qs-modal input[type="email"],
.qs-modal select,
.qs-modal textarea {
    font-size: 16px !important; /* أقل من 16px يسبب zoom في iOS */
}

/* iOS Safari: إصلاح viewport على iPhone notch */
@supports (padding: max(0px)) {
    .qs-overlay {
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* iOS Safari: إصلاح position fixed bug */
@supports (-webkit-touch-callout: none) {
    .qs-overlay {
        /* Safari iOS لا يدعم position: fixed داخل scroll element */
        position: fixed;
        height: 100vh;
        height: -webkit-fill-available;
    }
    
    .qs-modal {
        max-height: 85vh;
        max-height: calc(100vh - 80px);
    }
}

/* iOS Safari: animations smooth */
.qs-overlay,
.qs-modal {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* ====================================================================
   Backfill Toast Stack (مكدّس + قابل للإغلاق منفرداً)
==================================================================== */
/* ====================================================================
   🆕 v3.2 — Backfill Toast Stack (مكدّس + قابل للإغلاق منفرداً)
==================================================================== */
.backfill-stack {
    position: fixed;
    bottom: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse; /* أحدث toast فوق */
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100vw - 40px);
}

/* RTL — اليمين، LTR — اليسار */
[dir="rtl"] .backfill-stack {
    right: 20px;
    left: auto;
}
[dir="ltr"] .backfill-stack {
    left: 20px;
    right: auto;
}

.bf-toast {
    pointer-events: auto;
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-right: 4px solid #6366f1;
    position: relative;
    animation: bfSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 0;
    word-wrap: break-word;
}

.bf-toast.bf-toast-closing {
    animation: bfSlideOut 0.25s ease forwards;
}

@keyframes bfSlideIn {
    from { transform: translateX(0) translateY(20px); opacity: 0; }
    to   { transform: translateX(0) translateY(0); opacity: 1; }
}

@keyframes bfSlideOut {
    from { transform: scale(1); opacity: 1; max-height: 200px; margin: 0; padding: 12px 14px; }
    to   { transform: scale(0.95); opacity: 0; max-height: 0; margin: 0; padding: 0; }
}

.bf-toast-loading  { border-right-color: #6366f1; }
.bf-toast-success  { border-right-color: #10b981; background: #f0fdf4; }
.bf-toast-info     { border-right-color: #3b82f6; background: #eff6ff; }
.bf-toast-error    { border-right-color: #ef4444; background: #fef2f2; }

.bf-content {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding-left: 22px; /* مساحة لزر × */
}

[dir="rtl"] .bf-content {
    padding-left: 0;
    padding-right: 22px;
}

.bf-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    line-height: 1.2;
}

.bf-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: bfSpin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes bfSpin {
    to { transform: rotate(360deg); }
}

.bf-text {
    flex: 1;
    min-width: 0;
}

.bf-title {
    font-weight: 700;
    color: #1f2937;
    font-size: 0.9rem;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bf-msg {
    color: #4b5563;
    font-size: 0.82rem;
    line-height: 1.5;
}

.bf-msg strong {
    color: #111827;
}

.bf-refresh {
    display: inline-block;
    margin-top: 6px;
    color: #059669;
    text-decoration: underline;
    font-size: 0.82rem;
    font-weight: 600;
}

.bf-refresh:hover {
    color: #047857;
}

.bf-close {
    position: absolute;
    top: 8px;
    background: transparent;
    border: none;
    color: #9ca3af;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}

[dir="rtl"] .bf-close {
    left: 8px;
    right: auto;
}

[dir="ltr"] .bf-close {
    right: 8px;
    left: auto;
}

.bf-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1f2937;
}

@media (max-width: 480px) {
    .backfill-stack {
        max-width: none;
        bottom: 10px;
    }
    [dir="rtl"] .backfill-stack { right: 10px; left: 10px; }
    [dir="ltr"] .backfill-stack { left: 10px; right: 10px; }
}

/* ════════════════════════════════════════════════════════════════
   🆕 توزيعات السوق آخر 12 شهر + عوائد التوزيع
   ════════════════════════════════════════════════════════════════
   يظهر في modal تفاصيل السهم */
.md12-section {
    background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 18px;
    margin: 16px 0;
}

.md12-section h3 {
    color: #0c4a6e;
    margin: 0 0 14px 0;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* بطاقات العوائد */
.md12-yields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.md12-yield-card {
    background: #ffffff;
    border: 1px solid #e0f2fe;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.md12-yield-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.md12-yield-label {
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 500;
}

.md12-yield-value {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.2;
    color: #0f172a;
}

.md12-yield-value.md12-yield-cost {
    color: #059669;
}

.md12-yield-value.md12-yield-price {
    color: #2563eb;
}

.md12-yield-hint {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 4px;
    direction: ltr;
}

.md12-total-card {
    background: linear-gradient(135deg, #fef3c7 0%, #ffffff 100%);
    border-color: #fde68a;
}

.md12-total-card .md12-yield-value {
    color: #92400e;
}

/* جدول التوزيعات */
.md12-table-wrap {
    background: #ffffff;
    border: 1px solid #e0f2fe;
    border-radius: 10px;
    overflow: hidden;
}

.md12-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.md12-table thead {
    background: #e91e63;
}

.md12-table thead th {
    padding: 12px;
    text-align: center;
    font-weight: 700;
    color: #ffffff;
    font-size: 0.88rem;
    border-bottom: none;
    background: #e91e63;
}

.md12-table th {
    padding: 12px;
    text-align: center;
    font-weight: 700;
    color: #ffffff;
    font-size: 0.88rem;
    border-bottom: none;
}

.md12-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    color: #0f172a;
}

.md12-table tbody tr:last-child td {
    border-bottom: none;
}

.md12-table tbody tr:hover {
    background: #f8fafc;
}

/* تجاوز الـ zebra striping العام للجدول */
.md12-table tbody tr,
.md12-table tbody tr:nth-child(even) {
    background: #ffffff;
}

.md12-table tbody tr.md12-row-upcoming,
.md12-table tbody tr.md12-row-upcoming:nth-child(even) {
    background: #fffbeb;
}

.md12-table tbody tr.md12-row-upcoming {
    background: #fffbeb;
}

.md12-table tbody tr.md12-row-upcoming:hover {
    background: #fef3c7;
}

/* ─── Mobile (cards layout للجدول + grid عمود واحد) ─── */
@media (max-width: 600px) {
    .md12-section {
        padding: 14px;
    }
    
    .md12-yields {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .md12-yield-card {
        padding: 12px;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: start;
        gap: 10px;
    }
    
    .md12-yield-label {
        margin-bottom: 0;
        flex: 1 1 auto;
        font-size: 0.85rem;
    }
    
    .md12-yield-value {
        font-size: 1.3rem;
        flex: 0 0 auto;
    }
    
    .md12-yield-hint {
        display: none;
    }
    
    /* جدول → cards */
    .md12-table-wrap {
        background: transparent;
        border: none;
    }
    
    .md12-table {
        display: block;
        border: none;
        color: inherit;
    }
    
    .md12-table thead {
        display: none;
    }
    
    .md12-table tbody,
    .md12-table tr {
        display: block;
        width: 100%;
    }
    
    .md12-table tbody tr {
        background: #ffffff;
        border: 1px solid #e0f2fe;
        border-radius: 10px;
        padding: 10px 12px;
        margin-bottom: 8px;
    }
    
    .md12-table tbody tr:hover {
        background: #ffffff;
    }
    
    .md12-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
        border: none;
        font-size: 0.9rem;
        color: #0f172a;
        text-align: end;
    }
    
    .md12-table tbody td strong {
        color: #0f172a;
    }
    
    .md12-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 0.82rem;
    }
    
    .md12-table tbody tr.md12-row-upcoming {
        background: #fffbeb;
        border-color: #fde68a;
    }
}

/* ─── md12 badges (مدفوع/معلن) ─── */
.md12-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.md12-badge-paid {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.md12-badge-upcoming {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* تنبيه info أسفل الجدول */
.md12-info-hint {
    margin: 12px 0 0 0;
    padding: 10px 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    color: #92400e;
    font-size: 0.82rem;
    line-height: 1.6;
}

@media (max-width: 600px) {
    /* في وضع الجوال، البادج يطلع أمام القيمة */
    .md12-table tbody tr.md12-row-upcoming {
        background: #fffbeb;
        border-color: #fde68a;
    }
}

