/* ==========================================================================
   المحامي الإلكتروني — نظام التصميم
   ========================================================================== */
:root {
  --ink: #0E2A3F; --ink-2: #16405F; --ink-3: #2A5A80;
  --brass: #B8893B; --brass-2: #D9AE62; --brass-soft: #F5ECDA;
  --paper: #F6F4EF; --surface: #FFFFFF; --surface-2: #FBFAF7; --line: #E6E1D6; --line-2: #EFEBE3;
  --text: #1B2430; --text-2: #3D4856; --muted: #6E7683;
  --ok: #1E7A55; --ok-soft: #E3F3EB; --warn: #9A6A07; --warn-soft: #FBF1D9; --err: #B3261E; --err-soft: #FBE7E5; --info-soft: #E6EFF7;
  --c-navy: #16405F; --c-gold: #9A6E22; --c-teal: #0F6E6E; --c-crimson: #9B2C3A; --c-green: #1E7A55; --c-amber: #A35E0C; --c-slate: #45566A; --c-purple: #5B4B8A;
  --radius: 14px; --radius-sm: 10px; --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(14,42,63,.06), 0 1px 1px rgba(14,42,63,.04);
  --shadow: 0 6px 20px -8px rgba(14,42,63,.18), 0 2px 6px rgba(14,42,63,.05);
  --shadow-lg: 0 24px 48px -16px rgba(14,42,63,.28);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-doc: "Amiri", "Traditional Arabic", "Times New Roman", serif;
  --sidebar-w: 276px; --topbar-h: 60px; --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #9CC4E4; --ink-2: #BCD7EE; --ink-3: #7FB0D8;
  --brass: #D9AE62; --brass-2: #E7C27A; --brass-soft: #2E2616;
  --paper: #0D1217; --surface: #141B22; --surface-2: #18212A; --line: #26313C; --line-2: #1E2832;
  --text: #E7EAEE; --text-2: #C3CAD3; --muted: #8C96A3;
  --ok-soft: #10281F; --warn-soft: #2B2210; --err-soft: #2E1614; --info-soft: #132433;
  --c-navy: #7FB0D8; --c-gold: #D9AE62; --c-teal: #5CC2C2; --c-crimson: #E58A96; --c-green: #6FCF9F; --c-amber: #F0A85A; --c-slate: #A7B6C6; --c-purple: #B3A4E6;
  --shadow: 0 6px 20px -8px rgba(0,0,0,.6); --shadow-lg: 0 24px 48px -16px rgba(0,0,0,.7);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 15.5px; line-height: 1.75; color: var(--text); background: var(--paper); direction: rtl; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
a { color: var(--ink-2); text-decoration: none; }
a:hover { color: var(--brass); }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .5em; color: var(--text); font-weight: 700; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
h2 { font-size: 1.3rem; } h3 { font-size: 1.12rem; } h4 { font-size: 1rem; }
p { margin: 0 0 .9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0; }
.ic { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.ic.sm { width: 16px; height: 16px; } .ic.lg { width: 26px; height: 26px; } .ic.xl { width: 34px; height: 34px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brass) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--brass) 30%, transparent); }

/* ------------------------------ الأزرار والحقول ------------------------------ */
.btn { --b: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; transition: transform .12s, background .2s, box-shadow .2s, color .2s; white-space: nowrap; user-select: none; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 6px 16px -8px rgba(14,42,63,.7); }
:root[data-theme="dark"] .btn-primary { background: #2A5A80; }
.btn-primary:hover { background: var(--ink-2); color: #fff; }
.btn-gold { background: linear-gradient(135deg, var(--brass), #9C7129); color: #fff; box-shadow: 0 8px 18px -10px rgba(184,137,59,.9); }
.btn-gold:hover { color: #fff; filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--brass-soft); color: var(--c-gold); }
.btn-danger { background: var(--err-soft); color: var(--err); }
.btn-sm { min-height: 36px; padding: .3rem .8rem; font-size: .88rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; min-height: 42px; padding: 0; border-radius: 12px; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn-mini { font: inherit; font-size: .8rem; padding: .15rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.btn-mini:hover { border-color: var(--brass); color: var(--brass); }

.field { margin-bottom: 1.05rem; }
.field > label, .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .35rem; color: var(--text-2); }
.field .req { color: var(--err); margin-inline-start: 2px; }
.field .help { font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.input, .select, .textarea { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: .65rem .85rem; transition: border-color .2s, box-shadow .2s; min-height: 46px; }
.textarea { line-height: 1.8; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink-3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink-3) 15%, transparent); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236E7683' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left .8rem center; padding-left: 2.2rem; }
.checks { display: flex; flex-wrap: wrap; gap: .5rem; }
.check-chip { position: relative; }
.check-chip input { position: absolute; opacity: 0; }
.check-chip span { display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .8rem; border: 1.5px solid var(--line); border-radius: 999px; font-size: .88rem; cursor: pointer; background: var(--surface); transition: .15s; }
.check-chip input:checked + span { border-color: var(--ink-3); background: var(--info-soft); color: var(--ink-2); font-weight: 600; }
.check-chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brass) 50%, transparent); }
.row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.attach-btn { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem; color: var(--ink-3); background: none; border: 0; cursor: pointer; padding: .25rem 0; font-family: inherit; }
.attach-btn:hover { color: var(--brass); }

/* ------------------------------ الهيكل ------------------------------ */
.app { min-height: 100vh; }
.sidebar { position: fixed; inset-block: 0; right: 0; width: var(--sidebar-w); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; }
.main { margin-right: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.2rem .9rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand .logo { width: 40px; height: 40px; border-radius: 11px; box-shadow: var(--shadow-sm); }
.brand b { display: block; font-size: 1.08rem; line-height: 1.3; }
.brand small { display: block; color: var(--muted); font-size: .76rem; line-height: 1.3; }
.side-cta { padding: .3rem 1rem .8rem; }
.nav { flex: 1; overflow-y: auto; padding: .2rem .7rem 1rem; scrollbar-width: thin; }
.nav-sec { font-size: .74rem; color: var(--muted); font-weight: 600; padding: .9rem .6rem .35rem; letter-spacing: .02em; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: .94rem; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--info-soft); color: var(--ink-2); font-weight: 600; }
:root[data-theme="dark"] .nav a.active { color: var(--ink-2); }
.nav a .dot { width: 8px; height: 8px; border-radius: 50%; margin-inline-start: auto; }
.nav .svc-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.side-foot { border-top: 1px solid var(--line); padding: .8rem 1rem; }
.quota { font-size: .78rem; color: var(--muted); }
.quota .bar { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-top: .3rem; }
.quota .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), var(--brass-2)); border-radius: 99px; }
.user-pill { display: flex; align-items: center; gap: .6rem; margin-top: .7rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brass-soft); color: var(--c-gold); font-weight: 700; flex: none; }
.user-pill .who { flex: 1; min-width: 0; line-height: 1.35; }
.user-pill .who b { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-pill .who small { color: var(--muted); font-size: .76rem; }

.topbar { display: none; }
.page { width: 100%; max-width: 1120px; margin: 0 auto; padding: 1.8rem 1.6rem 3rem; flex: 1; }
.page.narrow { max-width: 820px; }
.page.wide { max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }
.crumbs { font-size: .84rem; color: var(--muted); margin-bottom: .4rem; display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--brass); }
.tabbar { display: none; }

/* ------------------------------ البطاقات ------------------------------ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 1.3rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line-2); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.02rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .6rem; } .mt-2 { margin-top: 1.2rem; } .mt-3 { margin-top: 2rem; } .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .6rem; } .mb-2 { margin-bottom: 1.2rem; }
.flex { display: flex; align-items: center; gap: .6rem; } .flex-wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }

.svc-card { position: relative; display: flex; flex-direction: column; gap: .55rem; padding: 1.2rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); transition: transform .18s, box-shadow .18s, border-color .18s; overflow: hidden; min-height: 158px; }
.svc-card::after { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: var(--tone); opacity: .07; transition: .3s; }
.svc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--tone) 40%, var(--line)); color: var(--text); }
.svc-card:hover::after { opacity: .13; transform: scale(1.15); }
.svc-card .svc-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone) 12%, transparent); color: var(--tone); }
.svc-card h3 { margin: .2rem 0 0; font-size: 1.04rem; }
.svc-card p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.65; }
.svc-card .go { margin-top: auto; font-size: .84rem; color: var(--tone); font-weight: 600; display: flex; align-items: center; gap: .3rem; }
.tone-navy { --tone: var(--c-navy); } .tone-gold { --tone: var(--c-gold); } .tone-teal { --tone: var(--c-teal); } .tone-crimson { --tone: var(--c-crimson); }
.tone-green { --tone: var(--c-green); } .tone-amber { --tone: var(--c-amber); } .tone-slate { --tone: var(--c-slate); } .tone-purple { --tone: var(--c-purple); }
.svc-ic.tone { background: color-mix(in srgb, var(--tone) 13%, transparent); color: var(--tone); }

.stat { padding: 1.1rem 1.2rem; display: flex; align-items: center; gap: .9rem; }
.stat .n { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat .si { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brass-soft); color: var(--c-gold); }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: .8rem; padding: .85rem 1.2rem; border-bottom: 1px solid var(--line-2); color: var(--text); transition: background .15s; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); color: var(--text); }
.list-item .t { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { font-size: .8rem; color: var(--muted); }
.list-item .grow { min-width: 0; }

.badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; background: var(--line-2); color: var(--text-2); white-space: nowrap; line-height: 1.6; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.err { background: var(--err-soft); color: var(--err); } .badge.info { background: var(--info-soft); color: var(--ink-2); } .badge.gold { background: var(--brass-soft); color: var(--c-gold); }

.alert { display: flex; gap: .7rem; padding: .85rem 1rem; border-radius: 12px; font-size: .92rem; margin-bottom: 1rem; border: 1px solid transparent; align-items: flex-start; }
.alert .ic { margin-top: 3px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); } .alert.err { background: var(--err-soft); color: var(--err); } .alert.warn { background: var(--warn-soft); color: var(--warn); } .alert.info { background: var(--info-soft); color: var(--ink-2); }
.empty { text-align: center; padding: 2.6rem 1rem; color: var(--muted); }
.empty .ic { width: 44px; height: 44px; color: var(--line); margin-bottom: .6rem; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .6rem 0 1rem; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .6rem .8rem; text-align: right; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; color: var(--text-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: .6rem .9rem; color: var(--muted); font-weight: 600; border: 0; background: none; font: inherit; border-bottom: 2.5px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs .active { color: var(--ink-2); border-bottom-color: var(--brass); }
.pager { display: flex; gap: .3rem; justify-content: center; margin-top: 1.2rem; flex-wrap: wrap; }
.pager a, .pager span { min-width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: .9rem; padding: 0 .5rem; }
.pager .cur { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ------------------------------ صفحة الهبوط ------------------------------ */
.landing { background: var(--paper); }
.l-nav { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: saturate(1.2) blur(10px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.l-nav .in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: .7rem 1.2rem; gap: 1rem; }
.hero { position: relative; overflow: hidden; background: radial-gradient(1200px 500px at 85% -10%, rgba(184,137,59,.22), transparent 60%), linear-gradient(160deg, #0E2A3F 0%, #133A57 55%, #0B2233 100%); color: #EEF3F7; }
.hero::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 70%); }
.hero .in { position: relative; max-width: 1180px; margin: 0 auto; padding: 4.2rem 1.2rem 4.6rem; display: grid; grid-template-columns: 1.1fr .9fr; gap: 2.5rem; align-items: center; }
.hero h1 { color: #fff; font-size: clamp(1.9rem, 1.2rem + 2.8vw, 3.1rem); line-height: 1.3; margin-bottom: 1rem; }
.hero h1 em { font-style: normal; color: var(--brass-2); }
.hero p.lead { font-size: 1.12rem; color: #C9D6E1; max-width: 560px; }
.hero .cta { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.6rem; }
.hero .btn-ghost { color: #E6EDF3; border-color: rgba(255,255,255,.25); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.eyebrow { display: inline-flex; align-items: center; gap: .45rem; font-size: .82rem; font-weight: 600; padding: .3rem .8rem; border-radius: 99px; background: rgba(231,194,122,.12); color: var(--brass-2); border: 1px solid rgba(231,194,122,.25); margin-bottom: 1rem; }
.hero-card { background: rgba(255,255,255,.97); color: var(--text); border-radius: 20px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.55); padding: 1.1rem; transform: rotate(-1.2deg); }
:root[data-theme="dark"] .hero-card { background: #141B22; }
.hero-card .q { background: var(--info-soft); border-radius: 14px 14px 4px 14px; padding: .7rem .9rem; font-size: .92rem; margin-bottom: .7rem; }
.hero-card .a { font-size: .9rem; line-height: 1.8; }
.hero-card .cite { display: inline-flex; gap: .3rem; align-items: center; font-size: .75rem; background: var(--brass-soft); color: var(--c-gold); border-radius: 99px; padding: .1rem .55rem; margin: .15rem 0 .15rem .3rem; }
.hero-card .step { display: flex; align-items: center; gap: .45rem; font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.hero-card .step .ic { color: var(--ok); width: 16px; height: 16px; }
.stats-band { max-width: 1180px; margin: -2.2rem auto 0; position: relative; z-index: 2; padding: 0 1.2rem; }
.stats-band .card { display: grid; grid-template-columns: repeat(4, 1fr); }
.stats-band .stat { border-left: 1px solid var(--line-2); justify-content: center; }
.stats-band .stat:last-child { border-left: 0; }
.section { max-width: 1180px; margin: 0 auto; padding: 4rem 1.2rem 1rem; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 2.2rem; }
.section-head .kicker { color: var(--brass); font-weight: 700; font-size: .85rem; }
.section-head h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); margin: .3rem 0 .5rem; }
.section-head p { color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; counter-reset: s; }
.steps .card { padding: 1.4rem; position: relative; }
.steps .card::before { counter-increment: s; content: counter(s); position: absolute; top: 1rem; left: 1.1rem; font-size: 2.4rem; font-weight: 700; color: var(--line); line-height: 1; }
.sources { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.sources .card { padding: 1.2rem; display: flex; gap: .9rem; align-items: flex-start; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1.1rem; margin-bottom: .6rem; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; color: var(--brass); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: .6rem 0 0; color: var(--text-2); }
.cta-band { max-width: 1180px; margin: 3.5rem auto 0; padding: 0 1.2rem; }
.cta-band .in { background: linear-gradient(135deg, #0E2A3F, #16405F); color: #fff; border-radius: 24px; padding: 2.4rem; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin: 0 0 .3rem; }
.cta-band p { color: #C9D6E1; margin: 0; }
.footer { text-align: center; color: var(--muted); font-size: .84rem; padding: 2.4rem 1.2rem calc(2rem + var(--safe-b)); }
.footer .disc { max-width: 760px; margin: 0 auto .6rem; line-height: 1.8; }

/* ------------------------------ المصادقة ------------------------------ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(160deg, #0E2A3F, #16405F 60%, #0B2233); color: #E6EDF3; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(184,137,59,.35), transparent 65%); bottom: -120px; left: -120px; }
.auth-side h2 { color: #fff; font-size: 1.9rem; }
.auth-side ul { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.auth-side li { display: flex; gap: .6rem; align-items: center; margin-bottom: .8rem; color: #C9D6E1; }
.auth-side li .ic { color: var(--brass-2); }
.auth-main { display: grid; place-items: center; padding: 2rem 1.2rem; }
.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 { font-size: 1.6rem; }

/* ------------------------------ المحادثة ------------------------------ */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr); height: 100vh; height: 100dvh; }
.chat-layout.with-refs { grid-template-columns: minmax(0, 1fr) 330px; }
.chat-col { display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: .7rem; padding: .7rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--surface); min-height: var(--topbar-h); }
.chat-head .title { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .sub { font-size: .78rem; color: var(--muted); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 1.4rem 1rem 1rem; scroll-behavior: smooth; }
.thread { max-width: 860px; margin: 0 auto; }
.msg { display: flex; gap: .8rem; margin-bottom: 1.4rem; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg .av { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; }
.msg.user { flex-direction: row-reverse; }
.msg.user .av { background: var(--brass-soft); color: var(--c-gold); font-weight: 700; font-size: .9rem; border-radius: 50%; }
.msg.assistant .av { background: var(--ink); }
.msg.assistant .av svg { width: 34px; height: 34px; }
.msg .body { min-width: 0; max-width: calc(100% - 44px); }
.msg.user .bubble { background: var(--ink); color: #fff; border-radius: 18px 4px 18px 18px; padding: .75rem 1rem; white-space: pre-wrap; word-wrap: break-word; font-size: .96rem; box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .msg.user .bubble { background: #1F4666; }
.msg.user .bubble h3, .msg.user .bubble strong { color: #fff; }
.msg.user .bubble.long { max-height: 260px; overflow: hidden; position: relative; }
.msg.user .bubble.long.open { max-height: none; }
.msg.user .more-btn { font-size: .8rem; color: var(--muted); background: none; border: 0; cursor: pointer; font-family: inherit; margin-top: .2rem; }
.msg.assistant .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 18px 18px 18px; padding: 1rem 1.2rem; box-shadow: var(--shadow-sm); }
.prose { font-size: .98rem; line-height: 1.95; overflow-wrap: anywhere; }
.prose h2, .prose h3, .prose h4, .prose h5 { margin: 1.1em 0 .45em; color: var(--ink-2); }
.prose h2 { font-size: 1.2rem; } .prose h3 { font-size: 1.08rem; } .prose h4, .prose h5 { font-size: 1rem; }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { padding-inline-start: 1.4rem; margin: .3rem 0 .9rem; }
.prose li { margin-bottom: .25rem; }
.prose li::marker { color: var(--brass); }
.prose blockquote { margin: .8rem 0; padding: .6rem 1rem; border-inline-start: 4px solid var(--brass); background: var(--brass-soft); border-radius: 8px; color: var(--text); }
.prose blockquote p:last-child { margin: 0; }
.prose code { background: var(--line-2); padding: .05rem .35rem; border-radius: 5px; font-size: .88em; }
.prose mark.blank { background: var(--warn-soft); color: var(--warn); border-radius: 4px; padding: 0 .2rem; }
.prose strong { color: var(--text); }
.cite-chip { display: inline; background: var(--brass-soft); color: var(--c-gold); border-radius: 6px; padding: 0 .3rem; font-weight: 600; font-size: .92em; cursor: pointer; }
.msg-actions { display: flex; gap: .2rem; margin-top: .45rem; flex-wrap: wrap; opacity: .85; }
.msg-actions button, .msg-actions a { display: inline-flex; align-items: center; gap: .3rem; font: inherit; font-size: .8rem; color: var(--muted); background: none; border: 0; padding: .3rem .5rem; border-radius: 8px; cursor: pointer; }
.msg-actions button:hover, .msg-actions a:hover { background: var(--surface); color: var(--ink-2); }
.msg-meta { font-size: .74rem; color: var(--muted); margin-top: .25rem; }
.status-line { display: flex; flex-direction: column; gap: .3rem; font-size: .86rem; color: var(--muted); margin-bottom: .5rem; }
.status-line .st { display: flex; align-items: center; gap: .45rem; }
.status-line .st .ic { width: 15px; height: 15px; color: var(--ok); }
.status-line .st.cur { color: var(--ink-2); font-weight: 600; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--brass); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--brass); margin-inline-start: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.refs-inline { margin-top: .8rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.ref-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; padding: .2rem .6rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); cursor: pointer; max-width: 100%; }
.ref-chip:hover { border-color: var(--brass); color: var(--c-gold); }
.ref-chip b { font-weight: 600; }
.ref-chip.cited { background: var(--brass-soft); border-color: transparent; color: var(--c-gold); }
.composer-wrap { padding: .6rem 1rem calc(.8rem + var(--safe-b)); background: linear-gradient(to top, var(--paper) 70%, transparent); }
.composer { max-width: 860px; margin: 0 auto; background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); display: flex; align-items: flex-end; gap: .4rem; padding: .45rem .45rem .45rem .6rem; transition: border-color .2s; }
.composer:focus-within { border-color: var(--ink-3); }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; font: inherit; font-size: 16px; line-height: 1.7; background: transparent; color: var(--text); padding: .45rem .6rem; max-height: 200px; min-height: 42px; }
.composer .send { width: 42px; height: 42px; border-radius: 12px; border: 0; background: var(--ink); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; transition: .15s; }
.composer .send:disabled { background: var(--line); cursor: default; }
.composer .send.stop { background: var(--err); }
.composer-hint { max-width: 860px; margin: .35rem auto 0; font-size: .74rem; color: var(--muted); text-align: center; }
.suggests { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; max-width: 860px; margin: 0 auto .5rem; }
.suggests button { font: inherit; font-size: .82rem; padding: .35rem .8rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.suggests button:hover { border-color: var(--brass); color: var(--c-gold); }
.refs-panel { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.refs-panel .card-head { min-height: var(--topbar-h); }
.refs-body { overflow-y: auto; padding: .8rem; flex: 1; }
.ref-item { border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; margin-bottom: .6rem; background: var(--surface-2); font-size: .86rem; }
.ref-item.cited { border-color: color-mix(in srgb, var(--brass) 45%, var(--line)); background: color-mix(in srgb, var(--brass-soft) 60%, var(--surface)); }
.ref-item .law { font-weight: 700; color: var(--ink-2); font-size: .82rem; }
.ref-item .lbl { font-weight: 600; margin: .1rem 0 .25rem; }
.ref-item p { margin: 0; color: var(--text-2); line-height: 1.7; }
.ref-item .acts { margin-top: .4rem; display: flex; gap: .6rem; font-size: .8rem; }
.welcome { text-align: center; padding: 3rem 1rem 1rem; max-width: 640px; margin: 0 auto; }
.welcome .logo-big { width: 64px; height: 64px; margin-bottom: .8rem; }

/* كتلة المستند */
.doc-block { margin: 1rem 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.doc-toolbar { display: flex; align-items: center; gap: .35rem; padding: .5rem .7rem; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; position: sticky; top: 0; z-index: 1; }
.doc-label { font-size: .78rem; font-weight: 700; color: var(--c-gold); margin-inline-end: auto; display: flex; align-items: center; gap: .3rem; }
.doc-label::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--brass); }
.doc-paper { background: #fff; color: #1a1a1a; margin: .9rem; padding: 2rem 2.2rem; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 10px 30px -12px rgba(0,0,0,.15); font-family: var(--font-doc); font-size: 1.12rem; line-height: 2; }
.doc-paper h2 { text-align: center; font-size: 1.45rem; color: #0E2A3F; margin: 0 0 1rem; padding-bottom: .7rem; border-bottom: 2px double #B8893B; font-family: var(--font-doc); }
.doc-paper h3, .doc-paper h4, .doc-paper h5 { color: #0E2A3F; font-family: var(--font-doc); font-size: 1.15rem; margin: 1.1rem 0 .4rem; }
.doc-paper table { font-family: var(--font); font-size: .9rem; color: #1a1a1a; }
.doc-paper th { background: #F2F4F7; color: #1a1a1a; }
.doc-paper .table-wrap { border-color: #ddd; }
.doc-paper mark.blank { background: #FFF3C4; color: #7A5A00; }

/* المكتبة */
.search-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.2rem; box-shadow: var(--shadow-sm); margin-bottom: 1.2rem; }
.search-box { display: flex; gap: .5rem; }
.search-box .input { flex: 1; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.filters .select { width: auto; min-height: 38px; padding-block: .3rem; font-size: .88rem; }
.law-card { display: block; padding: 1rem 1.1rem; color: var(--text); }
.law-card:hover { color: var(--text); background: var(--surface-2); }
.law-card .nm { font-weight: 700; margin-bottom: .2rem; }
.law-card .sm { color: var(--muted); font-size: .86rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.7; }
.hit { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line-2); }
.hit:last-child { border-bottom: 0; }
.hit .h { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .3rem; }
.hit .h a { font-weight: 700; }
.hit p { margin: 0; color: var(--text-2); font-size: .93rem; }
.law-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.toc { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; padding: .8rem; }
.toc a { display: block; font-size: .85rem; padding: .25rem .5rem; border-radius: 6px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc a:hover { background: var(--surface-2); }
.toc .sec { font-size: .76rem; font-weight: 700; color: var(--muted); padding: .6rem .5rem .2rem; }
.article { padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line-2); scroll-margin-top: 1rem; }
.article:target { background: color-mix(in srgb, var(--brass-soft) 70%, transparent); }
.article .ah { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; flex-wrap: wrap; }
.article .ah h3 { margin: 0; font-size: 1rem; color: var(--ink-2); }
.article .at { white-space: pre-line; font-family: var(--font-doc); font-size: 1.1rem; line-height: 2.05; }
.article .path { font-size: .78rem; color: var(--muted); }
.article details { margin-top: .5rem; font-size: .9rem; }
.article details summary { cursor: pointer; color: var(--warn); font-weight: 600; }
.article details div { white-space: pre-line; background: var(--warn-soft); border-radius: 10px; padding: .6rem .8rem; margin-top: .4rem; }
.article .aacts { display: flex; gap: .8rem; margin-top: .4rem; font-size: .8rem; }
.hl { background: #FFE9A8; color: inherit; border-radius: 3px; padding: 0 1px; }
:root[data-theme="dark"] .hl { background: #6B5410; }
.law-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; }
.law-meta div { background: var(--surface-2); border-radius: 10px; padding: .5rem .7rem; font-size: .85rem; }
.law-meta b { display: block; color: var(--muted); font-size: .74rem; font-weight: 600; }

/* نموذج الخدمة */
.svc-hero { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.2rem; }
.svc-hero .svc-ic { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.svc-hero .svc-ic .ic { width: 30px; height: 30px; }
.form-card { padding: 1.4rem; }
.form-foot { display: flex; gap: .7rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-top: .6rem; border-top: 1px solid var(--line-2); margin-top: .6rem; }
.tips { padding: 1.2rem; }
.tips li { margin-bottom: .5rem; font-size: .9rem; color: var(--text-2); }

/* المحرر */
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.editor .textarea { min-height: 62vh; font-family: var(--font); font-size: 15px; }
.editor .preview { max-height: 62vh; overflow: auto; }

/* نوافذ وتنبيهات */
.toast-wrap { position: fixed; bottom: calc(1.2rem + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 2rem); }
.toast { background: #17222C; color: #fff; padding: .65rem 1rem; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .9rem; display: flex; gap: .5rem; align-items: center; animation: rise .2s; pointer-events: auto; }
.toast.err { background: var(--err); }
.toast a { color: var(--brass-2); font-weight: 600; }
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 1rem; background: rgba(8,18,26,.5); backdrop-filter: blur(2px); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal .box { background: var(--surface); border-radius: 18px; width: 100%; max-width: 440px; padding: 1.4rem; box-shadow: var(--shadow-lg); }
.modal .box h3 { margin-bottom: .4rem; }
.modal .acts { display: flex; gap: .5rem; justify-content: flex-start; margin-top: 1.2rem; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(8,18,26,.45); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .35rem; z-index: 50; display: none; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; align-items: center; gap: .55rem; padding: .55rem .7rem; border-radius: 8px; color: var(--text-2); font: inherit; font-size: .9rem; background: none; border: 0; cursor: pointer; text-align: right; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); color: var(--text); }
.dropdown-menu .danger { color: var(--err); }

/* الحاسبات */
.calc-result { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 12px; padding: 1rem; margin-top: 1rem; }
.calc-result .big { font-size: 1.7rem; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ------------------------------ الجوال والأجهزة اللوحية ------------------------------ */
@media (max-width: 1180px) {
  .chat-layout.with-refs { grid-template-columns: minmax(0, 1fr); }
  .refs-panel { position: fixed; top: 0; bottom: 0; left: 0; width: min(380px, 92vw); z-index: 70; transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-lg); border: 0; }
  .refs-panel.open { transform: none; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(105%); transition: transform .25s ease; width: min(320px, 88vw); box-shadow: var(--shadow-lg); z-index: 80; }
  .sidebar.open { transform: none; }
  .main { margin-right: 0; padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
  .main.no-tabbar { padding-bottom: 0; }
  .topbar { display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 30; height: var(--topbar-h); padding: 0 .7rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; gap: .5rem; flex: 1; min-width: 0; }
  .topbar .brand .logo { width: 34px; height: 34px; }
  .topbar .brand b { font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 35; background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; font-size: .7rem; color: var(--muted); font-weight: 600; position: relative; }
  .tabbar a .ic { width: 23px; height: 23px; }
  .tabbar a.active { color: var(--ink-2); }
  .tabbar a.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--brass); }
  .tabbar a.fab .ic { width: 46px; height: 46px; padding: 11px; border-radius: 15px; background: var(--ink); color: #fff; margin-top: -22px; box-shadow: 0 10px 20px -8px rgba(14,42,63,.7); }
  .page { padding: 1.1rem 1rem 2rem; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-layout { height: calc(100dvh - var(--topbar-h)); }
  .chat-head { min-height: 52px; padding: .45rem .8rem; position: static; }
  .law-layout { grid-template-columns: 1fr; }
  .toc { position: static; max-height: 260px; }
  .hero .in { grid-template-columns: 1fr; padding: 2.8rem 1.1rem 3.8rem; }
  .hero-card { transform: none; }
  .stats-band .card { grid-template-columns: repeat(2, 1fr); }
  .stats-band .stat:nth-child(2) { border-left: 0; }
  .stats-band .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); }
  .steps, .sources { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .editor { grid-template-columns: 1fr; }
  .editor .preview { display: none; }
  .editor.show-preview .preview { display: block; max-height: none; }
  .editor.show-preview .textarea { display: none; }
}
@media (max-width: 600px) {
  body { font-size: 15px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: .6rem; }
  .svc-card { padding: .9rem; min-height: 132px; }
  .svc-card p { display: none; }
  .svc-card .svc-ic { width: 40px; height: 40px; }
  .stat { padding: .8rem; gap: .6rem; } .stat .n { font-size: 1.25rem; } .stat .si { width: 36px; height: 36px; }
  .msg .av { display: none; }
  .msg .body { max-width: 100%; }
  .msg.user .body { max-width: 88%; }
  .msg.assistant .bubble { padding: .85rem .9rem; border-radius: 16px; }
  .chat-scroll { padding: 1rem .7rem .5rem; }
  .composer-wrap { padding: .4rem .6rem calc(.5rem + var(--safe-b)); }
  .doc-paper { margin: .5rem; padding: 1.2rem 1rem; font-size: 1.04rem; }
  .card-pad, .form-card { padding: 1rem; }
  .page-head { margin-bottom: 1rem; }
  .cta-band .in { padding: 1.6rem; }
  .l-nav .hide-sm { display: none; }
  .search-box { flex-direction: column; }
  .article .at { font-size: 1.04rem; }
}
@media print {
  .sidebar, .topbar, .tabbar, .composer-wrap, .msg-actions, .doc-toolbar, .chat-head, .refs-panel, .no-print { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* التقويم الشهري */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-h { text-align: center; font-size: .78rem; font-weight: 700; color: var(--muted); padding: .5rem 0; border-bottom: 1px solid var(--line-2); }
.cal-d { min-height: 104px; border-bottom: 1px solid var(--line-2); border-left: 1px solid var(--line-2); padding: .3rem; position: relative; overflow: hidden; }
.cal-d:nth-child(7n+7) { border-left: 0; }
.cal-d.out { background: var(--surface-2); }
.cal-d.out .cal-n { opacity: .45; }
.cal-n { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem; font-weight: 600; margin-bottom: .2rem; }
.cal-n small { color: var(--muted); font-weight: 400; font-size: .68rem; }
.cal-d.today .cal-n span { background: var(--ink); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-ev { display: block; font-size: .72rem; line-height: 1.5; padding: .1rem .35rem; border-radius: 6px; background: var(--info-soft); color: var(--ink-2); margin-bottom: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.warn { background: var(--warn-soft); color: var(--warn); } .cal-ev.done { background: var(--ok-soft); color: var(--ok); }
.cal-dot { display: none; }
@media (max-width: 700px) {
  .cal-d { min-height: 52px; padding: .2rem; }
  .cal-ev, .cal-d .small { display: none; }
  .cal-n { flex-direction: column; align-items: center; }
  .cal-dot { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--brass); margin: .1rem auto 0; }
}
.modal .box { max-height: calc(100dvh - 2rem); overflow-y: auto; }
.modal .box.wide { max-width: 620px; }

/* إصلاحات الجوال */
html, body { overflow-x: hidden; }
.app { overflow-x: clip; }
.chat-head .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1180px) {
  .refs-panel:not(.open) { visibility: hidden; transition: transform .25s ease, visibility 0s .25s; }
}
@media (max-width: 1023px) {
  .sidebar:not(.open) { visibility: hidden; transition: transform .25s ease, visibility 0s .25s; }
  body.is-chat .topbar { display: none; }
  body.is-chat .chat-layout { height: 100vh; height: 100dvh; }
  .svc-grid-dash { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 600px) {
  .hide-sm { display: none !important; }
  .chat-head { gap: .4rem; }
  .chat-head .svc-ic { display: none !important; }
  .page-head h1 { font-size: 1.35rem; }
  .tabs a, .tabs button { padding: .55rem .6rem; font-size: .9rem; }
}
.svc-grid-dash { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important; }
.svc-grid-dash .svc-card { min-height: 0; }
.svc-grid-dash .svc-card p { display: none; }
@media (max-width: 600px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head > .flex { justify-content: flex-start; }
  .law-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .law-meta div[style*="span 2"] { grid-column: 1 / -1 !important; }
  .suggests { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; padding-bottom: 2px; }
  .suggests button { white-space: nowrap; flex: none; }
  .composer-hint { display: none; }
}
.split > *, .grid > *, .law-layout > *, .row > * { min-width: 0; }
