/* مرصد التمويل: نفس شكل الرسومات المعتمدة (أرضية دافية، لون أساسي أخضر مزرق، ألوان الأولويات). */
:root {
    --bg: #F5F3EE; --surface: #FFFFFF; --ink: #1F1D1A; --muted: #5E5A53; --line: #E4E0D8; --line2: #D6D1C7;
    --soft: #F0EDE6; --col: #ECE9E2; --accent: #0B5E5B; --accent-ink: #073F3D; --accent-soft: #E3EFEE;
    --p1: #8E1B1B; --p1-ink: #FFFFFF; --p2: #F4B860; --p2-ink: #3D2600; --p3: #D9D4CA; --p3-ink: #1F1D1A;
    --urgent: #8E1B1B; --urgent-soft: #FBF1F1; --star: #9A6412; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6; }
a { color: var(--accent); } a:hover { color: var(--accent-ink); }
h1 { font-size: 26px; margin: 0; line-height: 1.3; } h2 { font-size: 18px; margin: 0; } h3 { font-size: 15px; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { border: 1px solid var(--line2); border-radius: 10px; padding: 8px 12px; background: #FBFAF7; min-height: 44px; width: 100%; }
textarea { resize: vertical; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
:focus-visible { outline: 3px solid #5FA8A3; outline-offset: 2px; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.ltr { direction: ltr; text-align: right; unicode-bidi: plaintext; }
.muted { color: var(--muted); } .small { font-size: 13px; } .strong { font-weight: 600; }
.grow { flex-grow: 1; } .h-sub { font-size: 15px; font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: 14px; } .stack-tight { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 8px; } .wrap { flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.empty { color: var(--muted); text-align: center; }
.lbl { font-size: 14px; color: var(--muted); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 8px; } label.inline select, label.inline input { width: auto; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; min-height: 44px; }

.btn { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; }
.btn:hover { border-color: var(--accent); } .btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: #FFF; border-color: var(--accent); } .btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-link { border: none; background: none; color: var(--accent); padding: 8px 0; cursor: pointer; font-weight: 600; }
.btn-block { width: 100%; min-height: 50px; font-size: 16px; }
.btn.small { min-height: 34px; font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line2); background: var(--surface); font-size: 14px; cursor: pointer; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.b-p1 { background: var(--p1); color: var(--p1-ink); } .b-p2 { background: var(--p2); color: var(--p2-ink); } .b-p3 { background: var(--p3); color: var(--p3-ink); }
.b-p0, .b-watch, .b-ask, .b-new { background: var(--accent-soft); color: var(--accent); }
.b-skip { background: #3A3833; color: #FFF; } .b-soft { background: var(--soft); color: var(--ink); font-weight: 500; } .b-draft { background: #FFF3D6; color: #5C3D00; }

/* الهيدر */
.topbar { min-height: 64px; padding: 8px 24px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 20px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.brand-lg { font-size: 26px; justify-content: center; } .brand-lg svg { width: 34px; height: 34px; }
.tabs { display: flex; gap: 4px; flex-grow: 1; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; border-radius: 8px; color: #3A3833; text-decoration: none; }
.tabs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.me { display: flex; align-items: center; gap: 8px; }
.avatar { width: 36px; height: 36px; border-radius: 18px; background: var(--accent); color: #FFF; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.page { padding: 24px; display: flex; flex-direction: column; gap: 16px; max-width: 1600px; margin: 0 auto; }
.flash { margin: 12px 24px 0; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* الدخول */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; padding: 28px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--urgent-soft); color: var(--urgent); font-size: 14px; }
.auth-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); }
.otp { font-size: 26px; letter-spacing: 8px; text-align: center; }
.qr { align-self: center; border: 1px solid var(--line); border-radius: 12px; background: #FFF; }
.secret { font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; text-align: center; color: var(--muted); margin: 0; }
.steps { margin: 0; padding-right: 20px; }

/* الفرص */
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.filters { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 18px; max-height: calc(100vh - 100px); overflow: auto; }
.opp { display: flex; flex-direction: column; gap: 12px; }
.opp-main { display: flex; gap: 18px; align-items: flex-start; }
.score { width: 72px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.score b { font-size: 28px; line-height: 1.1; } .stars { color: var(--star); letter-spacing: 1px; font-size: 13px; }
.opp-body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.opp-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.opp-title a { font-size: 18px; font-weight: 700; color: var(--ink); text-decoration: none; } .opp-title a:hover { color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; } .tags span { padding: 3px 10px; border-radius: 6px; background: var(--soft); }
.dl { width: 170px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; }
.urgent { color: var(--urgent); font-weight: 700; }
.opp-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid #EFECE5; padding-top: 12px; flex-wrap: wrap; }
.decisions { display: flex; flex-wrap: wrap; gap: 6px; }
.dbtn { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--surface); color: #3A3833; font-weight: 600; font-size: 14px; cursor: pointer; }
.dbtn:hover { border-color: var(--accent); }
.d-p1.on { background: var(--p1); color: var(--p1-ink); border-color: var(--p1); }
.d-p2.on { background: var(--p2); color: var(--p2-ink); border-color: #D9962E; }
.d-p3.on { background: var(--p3); color: var(--p3-ink); border-color: #A8A197; }
.d-watch.on, .d-ask.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.d-skip.on { background: #3A3833; color: #FFF; border-color: #3A3833; }

/* التفاصيل */
.head { display: flex; gap: 24px; align-items: flex-start; }
.dl-box { min-width: 200px; display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 12px; background: var(--bg); }
.urgent-box { background: var(--urgent-soft); }
.score-box { width: 120px; display: flex; flex-direction: column; align-items: center; padding: 12px 0; border-radius: 12px; background: var(--bg); }
.score-box b { font-size: 36px; line-height: 1.1; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.crit { display: grid; grid-template-columns: 150px 50px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 14px; }
.bar { height: 8px; border-radius: 4px; background: var(--col); overflow: hidden; } .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar.big { height: 10px; }
.prose p { margin: 0; line-height: 1.8; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.kv { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.req { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #EFECE5; flex-wrap: wrap; }
.req select { width: auto; min-height: 36px; padding: 4px 8px; font-size: 13px; }
.req-title { font-size: 15px; font-weight: 500; }
.req.done .req-title { color: var(--muted); text-decoration: line-through; font-weight: 400; }
.tick { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; border: 1.5px solid #A8A197; background: #FFF; color: #FFF; font-weight: 700; cursor: pointer; }
.req.done .tick { background: var(--accent); border-color: var(--accent); }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.grid-form .span2 { grid-column: span 2; }
.note { padding: 12px; border-radius: 10px; background: var(--bg); } .note p { margin: 4px 0 0; white-space: pre-wrap; }

/* اللوحة */
.kanban { display: grid; grid-template-columns: repeat(9, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kcol { background: var(--col); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 240px; }
.kcol.over { outline: 2px dashed var(--accent); }
.khead { padding: 2px 4px 4px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; cursor: grab; }
.kcard.dragging { opacity: .5; }
.kcard select { width: auto; min-height: 32px; padding: 2px 6px; font-size: 12px; max-width: 130px; }
.ktitle { font-size: 15px; font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.4; }
.lead-pill { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.kempty { border: 1.5px dashed #C9C3B8; border-radius: 10px; padding: 16px 8px; text-align: center; font-size: 13px; color: var(--muted); }

/* المواعيد والأرشيف والجداول */
.drow { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #EFECE5; flex-wrap: wrap; }
.card.drow { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: right; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid #EFECE5; vertical-align: middle; }
td input, td select { min-height: 36px; padding: 4px 8px; }

/* لوحة الشريك */
.stepper { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.stepper div { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.stepper i { height: 8px; border-radius: 4px; background: var(--col); }
.stepper .past i { background: var(--accent); } .stepper .now i { background: #5FA8A3; } .stepper .now span { color: var(--accent); font-weight: 700; }

@media (max-width: 980px) {
    .layout, .two-col { grid-template-columns: minmax(0, 1fr); }
    .filters { position: static; max-height: none; }
    .head { flex-direction: column; }
    .kanban { grid-template-columns: repeat(9, minmax(240px, 80vw)); }
}
@media (max-width: 640px) {
    body { font-size: 15px; }
    .topbar { padding: 8px 16px; gap: 10px; }
    .page { padding: 16px; }
    .opp-main { flex-direction: column; gap: 10px; }
    .score { flex-direction: row; width: auto; gap: 10px; align-items: baseline; }
    .dl { width: auto; }
    .crit { grid-template-columns: minmax(0, 1fr) 44px; }
    .crit .bar, .crit > span:nth-child(2) { display: none; }
    .grid-form, .kv-grid { grid-template-columns: minmax(0, 1fr); }
    .grid-form .span2 { grid-column: auto; }
    .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .me .muted { display: none; }
    .row, .row-between { flex-wrap: wrap; }
    .table-wrap { max-width: calc(100vw - 32px); }
}
