/* لوحة الشركاء (B2B) — هوية زرقاء مؤسّسية، متميّزة عن أخضر لوحة الإدارة.
   ملاحظة: CSP الصارم يحجب style= المضمّن بصمت — كل التنسيق بكلاسات هنا. */
:root {
  --brand: #1f6feb;
  --brand-dark: #1657c4;
  --ink: #0f2942;
  --muted: #5b6b7a;
  --bg: #f4f7fa;
  --card: #ffffff;
  --border: #dbe4ec;
  --green: #1f9d63;
  --red: #b3261e;
  --soft: #eef3fb;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Tajawal", system-ui, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.6; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.err { color: var(--red); font-weight: 700; min-height: 1.3rem; margin-top: .6rem; text-align: center; }

/* ── الأزرار ── */
.btn { cursor: pointer; border: none; background: var(--brand); color: #fff; font-family: inherit; font-weight: 700; padding: .7rem 1.4rem; border-radius: 10px; font-size: .95rem; display: inline-block; text-align: center; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-block { width: 100%; padding: .85rem; margin-top: .4rem; }
.btn-sm { padding: .4rem .9rem; font-size: .85rem; border-radius: 8px; }
.btn-ghost { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
.btn-ghost:hover { background: var(--soft); }

/* ── بوّابة الدخول ── */
.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; gap: 1rem; }
.gate-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 2.2rem; width: min(560px, 100%); box-shadow: 0 10px 40px rgba(15,41,66,.08); }
.gate-brand { display: block; text-align: center; font-size: 1.7rem; font-weight: 800; color: var(--ink); }
.gate-brand span { color: var(--brand); }
.gate-lead { text-align: center; margin: .4rem 0 1.4rem; font-size: .95rem; }
.gate-foot { font-size: .9rem; }

.tabs { display: flex; gap: .5rem; background: var(--soft); padding: .35rem; border-radius: 12px; margin-bottom: 1.4rem; }
.tab { flex: 1; cursor: pointer; border: none; background: transparent; font-family: inherit; font-weight: 700; font-size: .95rem; color: var(--muted); padding: .6rem; border-radius: 9px; }
.tab.active { background: var(--card); color: var(--brand); box-shadow: 0 2px 8px rgba(15,41,66,.08); }

.gate-form { display: flex; flex-direction: column; gap: .9rem; }
.gate-form label, .form-grid-2 label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; font-weight: 500; }
.gate-form input, .gate-form textarea,
.form-grid-2 input, .form-grid-2 textarea {
  padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: .95rem; color: var(--ink); background: #fff; width: 100%;
}
.gate-form input:focus, .gate-form textarea:focus,
.form-grid-2 input:focus, .form-grid-2 textarea:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.hint { color: var(--muted); font-weight: 400; font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }

/* ── اللوحة ── */
.topbar { background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.4rem; }
.topbar .brand { font-weight: 800; font-size: 1.15rem; }
.topbar .brand span { color: #7fb0ff; }
.topbar-actions { display: flex; align-items: center; gap: .9rem; }
.who { font-size: .88rem; color: #c9d6e5; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.12); }

.container { width: min(1080px, 94%); margin: 1.6rem auto; display: flex; flex-direction: column; gap: 1.4rem; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem; }
.panel-head h2 { font-size: 1.2rem; }
.panel-lead { font-size: .88rem; margin: .3rem 0 1.2rem; }
.save-msg { font-size: .85rem; font-weight: 700; color: var(--green); min-height: 1.2rem; }
.chip { background: var(--soft); color: var(--brand); font-weight: 700; font-size: .82rem; padding: .3rem .8rem; border-radius: 999px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.form-grid-2 .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-start; }

/* ── المجالات العموديّة (رقائق فوق الكتالوج) ── */
.cat-domains { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: 1rem; }
.cat-domains:empty { display: none; }
.cat-domains-label { font-size: .85rem; font-weight: 700; color: var(--muted); }
.dom-chip { background: var(--soft); color: var(--brand-dark); font-weight: 700; font-size: .8rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border); }
.dom-chip-btn { cursor: pointer; font-family: inherit; transition: background .15s, border-color .15s, transform .1s; }
.dom-chip-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.dom-chip-btn:active { transform: scale(.96); }

/* ── كتالوج ── */
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.ds-card { border: 1px solid var(--border); border-radius: 14px; padding: 1.2rem; display: flex; flex-direction: column; gap: .7rem; transition: box-shadow .15s, border-color .15s; }
.ds-card:hover { border-color: var(--brand); box-shadow: 0 6px 20px rgba(31,111,235,.1); }
.ds-dialect { font-weight: 800; font-size: 1.05rem; color: var(--ink); direction: ltr; text-align: right; }
.ds-count { font-size: 1.8rem; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.ds-count small { font-size: .8rem; font-weight: 500; color: var(--muted); margin-inline-start: .3rem; }
.ds-card .btn { margin-top: auto; }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); background: var(--soft); border-radius: 12px; }

/* ── متطلّبات الامتثال ── */
.compliance { display: flex; flex-direction: column; gap: 1.1rem; }
.cmp-group { display: flex; flex-direction: column; gap: .5rem; }
.cmp-group-title { font-weight: 800; color: var(--ink); font-size: .95rem; padding-bottom: .2rem; border-bottom: 1px solid var(--border); }
.cmp-item { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; background: var(--soft); }
.cmp-item-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.cmp-label { font-weight: 700; font-size: .9rem; }
.cmp-why { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.cmp-badge { padding: .2rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.cmp-req { background: #fde8d0; color: #8a4b0e; }
.cmp-opt { background: #e4e9f5; color: #3a4a86; }

/* ── طلباتي ── */
.requests { display: flex; flex-direction: column; gap: .7rem; }
.req-row { border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.req-main { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.req-dialect { font-weight: 800; color: var(--ink); direction: ltr; text-align: right; }
.req-domain { margin-inline-start: 8px; font-size: .72rem; font-weight: 700; color: var(--brand-dark); background: var(--soft); border: 1px solid var(--border); padding: 1px 8px; border-radius: 999px; vertical-align: middle; direction: rtl; }
.req-meta { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.req-note { font-size: .85rem; color: var(--muted); }
.req-status { padding: .3rem .8rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.st-pending { background: #fff3cd; color: #7a5b00; }
.st-fulfilled { background: #d7f5e3; color: #1d6b46; }
.st-declined { background: #fde0de; color: #8a1c16; }

/* ── نافذة الطلب ── */
.modal { position: fixed; inset: 0; background: rgba(15,41,66,.55); display: flex; align-items: center; justify-content: center; padding: 1.5rem; z-index: 50; }
.modal-card { background: var(--card); border-radius: 16px; padding: 2rem; width: min(480px, 100%); }
.modal-card h3 { font-size: 1.25rem; margin-bottom: .8rem; }
.modal-actions { display: flex; gap: .7rem; margin-top: 1.4rem; }

/* ── جوّال ── */
@media (max-width: 560px) {
  .form-grid, .form-grid-2 { grid-template-columns: 1fr; }
  .gate-card { padding: 1.6rem; }
}

/* نافذة الطلب — حقل الملاحظة ورسالة الحالة */
.modal-note-label { display: flex; flex-direction: column; gap: .35rem; font-size: .88rem; font-weight: 500; margin: 1rem 0 .3rem; }
.modal-note-label textarea { padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; font-size: .92rem; resize: vertical; }
.modal-msg { min-height: 1.2rem; font-size: .88rem; font-weight: 700; margin: .2rem 0; }
.modal-msg.ok { color: var(--green); }
.modal-msg.err { color: var(--red); }
