/* Cairo (SIL OFL 1.1, see fonts/Cairo-OFL.txt), served locally because the CSP is font-src 'self'. */
@font-face { font-family: "Cairo"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("/assets/fonts/cairo-arabic-wght-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EEFF; }
@font-face { font-family: "Cairo"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("/assets/fonts/cairo-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #f3f5f9; --card: #fff; --text: #1b2434; --muted: #667089; --line: #e1e6ef;
  --navy: #1E3A5F; --navy-d: #14294A; --gold: #C9A227; --gold-l: #f6edcc;
  --accent: #1E3A5F; --accent-d: #14294A; --danger: #b3261e; --warn: #9a6700; --ok: #1a7f37;
  --shadow: 0 1px 2px rgba(20, 41, 74, .06), 0 4px 14px rgba(20, 41, 74, .06);
  font-family: "Cairo", "Segoe UI", system-ui, -apple-system, Tahoma, "Noto Naskh Arabic", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .6rem; }
.muted { color: var(--muted); font-size: .9rem; }
.grow { flex: 1; }
.bare { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.narrow { width: 100%; max-width: 420px; }

.topbar { display: flex; align-items: center; gap: 12px; background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 16px; position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { color: var(--accent); font-size: 1.2rem; }
.menu-toggle { display: none; background: none; border: 0; font-size: 1.4rem; cursor: pointer; }
.who { font-weight: 600; }
.shell { display: flex; align-items: flex-start; gap: 16px; padding: 16px; }
.side { width: 210px; flex-shrink: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; position: sticky; top: 64px; }
.side a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); }
.side a.active { background: var(--accent); color: #fff; text-decoration: none; }
.side a:hover { background: #eaf3ef; text-decoration: none; }
.side a.active:hover { background: var(--accent); }
.content { flex: 1; min-width: 0; }
.ad-banner { background: #fff7e0; border-bottom: 1px solid #f1d98a; padding: 8px 16px; font-size: .95rem; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: #e8f6ec; border-color: #b7e0c2; color: var(--ok); }
.flash.error { background: #fdecea; border-color: #f4b8b3; color: var(--danger); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat .n { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat .l { color: var(--muted); font-size: .85rem; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table-wrap { overflow-x: auto; border-radius: 10px; margin-bottom: 8px; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .92rem; }
th { background: #f0f2f6; font-weight: 600; white-space: nowrap; }
th a { color: var(--text); }
tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .8rem; background: #eceff4; }
.badge.ok { background: #e1f3e6; color: var(--ok); }
.badge.warn { background: #fff3d6; color: var(--warn); }
.badge.bad { background: #fdecea; color: var(--danger); }

form.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: 8px; }
input, select, textarea { display: block; width: 100%; padding: 8px 10px; border: 1px solid #c9cfda; border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
form.filters label { margin: 0; }
form.filters input, form.filters select { width: auto; min-width: 110px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid #c9cfda; background: #fff; color: var(--text); font: inherit; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
form.inline { display: inline; }
.inline-reason { display: flex; gap: 6px; margin: 4px 0; flex-wrap: wrap; }
.inline-reason input { flex: 1; min-width: 140px; padding: 5px 8px; }
.pager { display: flex; gap: 12px; align-items: center; margin: 8px 0 16px; color: var(--muted); }
.tabs-sub { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs-sub a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text); }
.tabs-sub a.active { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.note { background: #eef6ff; border: 1px solid #c3dcf7; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.secret { font-family: ui-monospace, Consolas, monospace; background: #fff7e0; border: 1px dashed #d4a72c; padding: 10px; border-radius: 8px; word-break: break-all; direction: ltr; text-align: left; }
.qr img { max-width: 220px; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; border-right: 3px solid var(--line); }
.timeline li { padding: 4px 14px 12px 0; position: relative; }
.timeline li::before { content: ""; position: absolute; right: -9px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: #c9cfda; }
.timeline li.done::before { background: var(--ok); }
.timeline li.bad::before { background: var(--danger); }
.timeline time { color: var(--muted); font-size: .85rem; display: block; }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal.hidden { display: none; }
.ltr { direction: ltr; unicode-bidi: embed; text-align: left; }

@media (max-width: 760px) {
  .menu-toggle { display: inline-block; }
  .shell { flex-direction: column; padding: 10px; }
  .side { display: none; width: 100%; position: static; }
  .side.open { display: block; }
  .topbar { gap: 8px; }
  th, td { padding: 6px 7px; }
}

.chk { display: inline; width: auto; }

/* client portal: mobile first */
.ptabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 52px; z-index: 4; }
.ptabs a { white-space: nowrap; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); background: #fff; }
.ptabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.pcontent { max-width: 760px; margin: 0 auto; padding: 14px; }
body.pay { align-items: start; padding-top: 24px; }
blockquote { margin: 0 0 12px; padding: 10px 14px; background: #f7f8fa; border-right: 3px solid var(--accent); border-radius: 6px; }

/* risk alerts */
.badge.crit { background: var(--danger); color: #fff; font-weight: 700; }
.risk-badge { display: inline-flex; gap: 4px; text-decoration: none; }
.alert-bar { background: #fdecea; border: 1px solid #f4b8b3; color: var(--danger); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }

/* legal footer (service file m4) */
.legal-footer { margin: 24px auto 12px; max-width: 960px; padding: 10px 16px; font-size: 12px; color: var(--muted, #667); border-top: 1px solid #dde; text-align: center; line-height: 1.7; }
.legal-footer p { margin: 4px 0; }

.attest { border: 1px solid #c9a227; border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.attest legend { font-weight: 700; padding: 0 6px; }
label.check { display: block; margin: 6px 0; }

/* ===== v2.3 look & feel ===== */
body { font-size: 15px; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.5rem; font-weight: 800; color: var(--navy); letter-spacing: -.2px; }
h2 { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.topbar { box-shadow: var(--shadow); border-bottom: 0; border-top: 3px solid var(--gold); padding: 8px 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--navy); font-weight: 800; font-size: 1.15rem; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; }
.card, .stat, table { box-shadow: var(--shadow); border-color: transparent; border-radius: 12px; }
.side { border-color: transparent; box-shadow: var(--shadow); border-radius: 12px; padding: 10px; background: var(--navy); }
.side a { color: #cfd8e8; padding: 10px 14px; border-radius: 9px; margin-bottom: 2px; transition: background .15s, color .15s; }
.side a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.side a.active, .side a.active:hover { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset -3px 0 0 var(--gold); font-weight: 700; }
.stat { padding: 14px 16px; border-top: 3px solid var(--gold); }
.stat .n { color: var(--navy); font-weight: 800; }
th { background: #eef1f7; color: var(--navy); }
tbody tr:hover td, table tr:hover td { background: #fafbfd; }
.btn { transition: background .15s, border-color .15s, box-shadow .15s; font-weight: 600; }
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--navy); border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-d); box-shadow: 0 2px 8px rgba(30, 58, 95, .3); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid rgba(201, 162, 39, .45); outline-offset: 1px; border-color: var(--gold); }
.tabs-sub a.active, .ptabs a.active { background: var(--navy); border-color: var(--navy); }
.note { border-radius: 10px; }
.alert-bar { border-radius: 10px; }

/* login */
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 14px; }
.login-brand img { border-radius: 18px; box-shadow: var(--shadow); }
.login-name { font-size: 1.5rem; font-weight: 800; color: var(--navy); }
.narrow h1 { text-align: center; font-size: 1.15rem; color: var(--muted); font-weight: 600; }
.narrow .btn.primary { width: 100%; padding: 10px; margin-top: 6px; }
body.bare { background: linear-gradient(160deg, #eaf0f8 0%, #f6f1df 100%); }

/* brand settings */
.brand-preview { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.brand-preview img { border-radius: 18px; border: 1px solid var(--line); background: #fff; object-fit: contain; }
.brand-preview-name { font-size: 1.4rem; font-weight: 800; color: var(--navy); }
.brand-card .btn { margin-inline-end: 6px; }

/* simple home mode (super_admin prototype, TECHNICAL_REVIEW.md §5) */
.simple-intro { margin-bottom: 18px; }
.simple-intro h1 { margin-bottom: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line);
  border-top: 4px solid var(--gold); border-radius: 14px; padding: 20px 18px; text-decoration: none; color: var(--text);
  box-shadow: 0 1px 2px rgba(20,41,74,.06), 0 4px 14px rgba(20,41,74,.06); transition: transform .12s, box-shadow .12s; }
.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(30,58,95,.18); border-color: var(--navy); }
.tile-icon { font-size: 1.8rem; line-height: 1; }
.tile strong { font-size: 1.05rem; color: var(--navy); }
.tile-big { font-size: 1.5rem; font-weight: 800; color: var(--navy); }
.tile-badge { position: absolute; top: 14px; inset-inline-end: 14px; background: var(--accent); color: #fff; border-radius: 999px;
  padding: 2px 10px; font-size: .8rem; font-weight: 700; }
.tile-badge.warn { background: var(--danger); }
.simple-footer { margin-top: 20px; }
