/* BHD Ads design foundation. One file for the public site, the console and the operations console.
   Tokens follow the BHD language used on Reach Screens: warm paper, charcoal ink, one amber accent.
   Rules: one accent; status is always a word, never colour alone; logical properties only, so Arabic
   (dir="rtl") mirrors with no extra CSS; numbers are tabular. */

@import url('https://fonts.bhd.om/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=DM+Serif+Display&family=DM+Mono:wght@400;500&family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  --paper: #FAFAF7; --surface: #FFFFFF; --sunk: #F3F2EC; --line: #E6E3DA; --line-strong: #CFCBBF;
  --ink: #1A1814; --ink-2: #4A463E; --ink-3: #7A756A;
  --accent: #C4872A; --accent-ink: #8A5C12; --accent-soft: #FBF1DF;
  --ok: #1F7A4D; --ok-soft: #E6F4EC; --warn: #9A6400; --warn-soft: #FFF3D6; --bad: #B3261E; --bad-soft: #FCE9E7; --info: #2B5FA8; --info-soft: #E8F0FB;
  --r-s: 8px; --r: 12px; --r-l: 18px;
  --sh-1: 0 1px 2px rgba(26,24,20,.06); --sh-2: 0 6px 20px rgba(26,24,20,.08); --sh-3: 0 18px 50px rgba(26,24,20,.16);
  --font: 'DM Sans', 'Noto Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'DM Serif Display', 'Noto Sans Arabic', Georgia, serif;
  --mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --touch: 44px; --content: 1120px;
}
:root[dir='rtl'] { --font: 'Noto Sans Arabic', 'DM Sans', system-ui, sans-serif; --display: 'Noto Sans Arabic', 'DM Serif Display', serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
:root[dir='rtl'] h1, :root[dir='rtl'] h2, :root[dir='rtl'] h3 { letter-spacing: 0; line-height: 1.45; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
.display { font-family: var(--display); font-weight: 400; font-size: clamp(34px, 5.2vw, 60px); line-height: 1.08; letter-spacing: -0.015em; }
p { margin: 0; } a { color: var(--accent-ink); text-underline-offset: 3px; }
.muted { color: var(--ink-3); } .small { font-size: 13px; } .num { font-variant-numeric: tabular-nums; } .mono { font-family: var(--mono); font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* layout */
.wrap { max-width: var(--content); margin-inline: auto; padding-inline: var(--s4); }
.stack { display: flex; flex-direction: column; gap: var(--s4); } .stack-s { display: flex; flex-direction: column; gap: var(--s2); } .stack-l { display: flex; flex-direction: column; gap: var(--s6); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; } .row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.grid { display: grid; gap: var(--s4); } .grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } .grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } .grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grow { flex: 1 1 auto; min-width: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--touch); padding: 0 var(--s4); border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 600 15px/1 var(--font); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--sunk); } .btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; } .btn-primary:hover { background: #2c2923; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; } .btn-accent:hover { background: #b0771f; }
.btn-danger { color: var(--bad); border-color: #e7b9b5; } .btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { border-color: transparent; background: transparent; } .btn-ghost:hover { background: var(--sunk); }
.btn-s { min-height: 34px; padding: 0 var(--s3); font-size: 13px; border-radius: var(--r-s); }
.btn-l { min-height: 52px; padding: 0 var(--s5); font-size: 16px; }
.btn[disabled], .btn[aria-busy='true'] { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 13px; color: var(--ink-3); } .error { font-size: 13px; color: var(--bad); }
.input, .select, .textarea { width: 100%; min-height: var(--touch); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 400 15px/1.4 var(--font); }
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.input[aria-invalid='true'] { border-color: var(--bad); }
.check { display: flex; align-items: flex-start; gap: var(--s2); cursor: pointer; } .check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--ink); }
.choice { display: block; border: 1px solid var(--line-strong); border-radius: var(--r); padding: var(--s4); background: var(--surface); cursor: pointer; text-align: start; font: inherit; color: inherit; width: 100%; }
.choice:hover { border-color: var(--ink-3); } .choice[aria-pressed='true'], .choice[aria-checked='true'] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #fffdf8; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--r); padding: var(--s5); text-align: center; background: var(--surface); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: var(--s5); box-shadow: var(--sh-1); }
.card-flat { box-shadow: none; } .card-tight { padding: var(--s4); }
.banner { border-radius: var(--r); padding: var(--s3) var(--s4); border: 1px solid var(--line); background: var(--sunk); display: flex; gap: var(--s3); align-items: flex-start; }
.banner-warn { background: var(--warn-soft); border-color: #f0dba4; } .banner-bad { background: var(--bad-soft); border-color: #f1c4c0; } .banner-ok { background: var(--ok-soft); border-color: #bfe0cd; } .banner-info { background: var(--info-soft); border-color: #c5d8f3; }
.test-ribbon { background: repeating-linear-gradient(135deg, #fff3d6 0 12px, #ffe9b5 12px 24px); color: #5c3d00; font-weight: 700; font-size: 13px; text-align: center; padding: 6px var(--s4); letter-spacing: .04em; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* status: always a word, the dot only repeats it */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); } .badge-warn { background: var(--warn-soft); color: var(--warn); } .badge-bad { background: var(--bad-soft); color: var(--bad); } .badge-info { background: var(--info-soft); color: var(--info); } .badge-test { background: #ffe9b5; color: #5c3d00; }

/* numbers */
.stat { display: flex; flex-direction: column; gap: 4px; } .stat-label { font-size: 13px; color: var(--ink-3); font-weight: 500; } .stat-value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.1; } .stat-sub { font-size: 13px; color: var(--ink-3); }
.bar { height: 8px; border-radius: 999px; background: var(--sunk); overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--ink); border-radius: 999px; }

/* tables: become stacked cards on phones */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 12px var(--s4); border-bottom: 1px solid var(--line); background: var(--paper); white-space: nowrap; }
:root[dir='rtl'] .table th { letter-spacing: 0; }
.table td { padding: 14px var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; } .table tr:last-child td { border-bottom: 0; }
.table tbody tr[tabindex]:hover, .table tbody tr[tabindex]:focus-visible { background: #fffdf8; cursor: pointer; }
.table .end { text-align: end; }
@media (max-width: 720px) {
  .table.stackable thead { display: none; } .table.stackable tr { display: block; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
  .table.stackable td { display: flex; justify-content: space-between; gap: var(--s4); padding: 4px 0; border: 0; text-align: end; } .table.stackable td::before { content: attr(data-label); color: var(--ink-3); font-size: 13px; text-align: start; }
}
.empty { text-align: center; padding: var(--s7) var(--s4); color: var(--ink-3); } .empty h3 { color: var(--ink); margin-bottom: var(--s2); }
.skeleton { background: linear-gradient(90deg, var(--sunk), #ebe9e1, var(--sunk)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: var(--r-s); min-height: 16px; } @keyframes sk { to { background-position: -200% 0; } }

/* app shell: sidebar on desktop, top bar + drawer on phones */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-inline-end: 1px solid var(--line); padding: var(--s4); display: flex; flex-direction: column; gap: var(--s4); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; } .brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: var(--accent); display: grid; place-items: center; font: 400 17px var(--display); }
.nav { display: flex; flex-direction: column; gap: 2px; } .nav-group { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: var(--s3) var(--s3) 6px; } :root[dir='rtl'] .nav-group { letter-spacing: 0; font-size: 12px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 40px; padding: 0 var(--s3); border-radius: var(--r-s); color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--sunk); } .nav a[aria-current='page'] { background: var(--ink); color: #fff; } .nav .count { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.main { min-width: 0; padding: var(--s5) var(--s5) var(--s8); } .main-inner { max-width: 1180px; margin-inline: auto; }
.topbar { display: none; }
.crumbs { font-size: 13px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .crumbs a { color: var(--ink-3); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); z-index: 40; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--sh-3); } :root[dir='rtl'] .side { transform: translateX(105%); } .side.open, :root[dir='rtl'] .side.open { transform: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .main { padding: var(--s4) var(--s4) var(--s8); }
}
.scrim { position: fixed; inset: 0; background: rgba(26,24,20,.45); z-index: 35; }

/* overlays */
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(560px, 100vw); background: var(--surface); z-index: 50; box-shadow: var(--sh-3); overflow-y: auto; padding: var(--s5); }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--s4); } .modal > .card { width: min(480px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--sh-3); }
.toasts { position: fixed; inset-block-end: var(--s4); inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: var(--s2); z-index: 60; pointer-events: none; padding-inline: var(--s4); }
.toast { background: var(--ink); color: #fff; padding: 12px var(--s4); border-radius: var(--r); box-shadow: var(--sh-2); font-size: 14px; pointer-events: auto; max-width: 520px; } .toast-bad { background: var(--bad); }

/* stepper for the campaign wizard */
.steps { display: flex; gap: var(--s2); list-style: none; padding: 0; margin: 0; overflow-x: auto; }
.steps li { flex: 1 1 0; min-width: 84px; font-size: 12px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
/* the progress rail is its own bar above the label, not a border on the item */
.steps li::before { content: ''; display: block; height: 3px; margin-bottom: 8px; background: var(--line); }
.steps li[aria-current='step'] { color: var(--ink); } .steps li[aria-current='step']::before { background: var(--accent); }
.steps li.done { color: var(--ink-2); } .steps li.done::before { background: var(--ink); }

/* the ad itself, as people see it (also used for previews) */
.adcard { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; max-width: 360px; box-shadow: var(--sh-1); }
.adcard-top { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.adcard-img { width: 100%; aspect-ratio: 1.91; object-fit: cover; display: block; background: var(--sunk); }
.adcard-body { padding: 12px; display: flex; flex-direction: column; gap: 4px; } .adcard-title { font-weight: 700; font-size: 16px; line-height: 1.3; } .adcard-text { font-size: 14px; color: var(--ink-2); } .adcard-cta { align-self: flex-start; margin-top: 8px; }
.phone { width: 280px; border: 10px solid var(--ink); border-radius: 36px; background: var(--paper); padding: 14px 10px; box-shadow: var(--sh-2); }

/* code, for the docs and the developer portal */
pre.code { background: #17150f; color: #f3efe4; border-radius: var(--r); padding: var(--s4); overflow-x: auto; font: 400 13px/1.6 var(--mono); direction: ltr; text-align: left; margin: 0; }
code.inline { font-family: var(--mono); font-size: .9em; background: var(--sunk); padding: 2px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }
.copy { position: relative; } .copy > .btn { position: absolute; inset-block-start: 8px; inset-inline-end: 8px; }

/* simple chart bars (no library) */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; } .chart > i { flex: 1 1 0; background: var(--ink); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; } .chart > i:hover { opacity: 1; background: var(--accent); }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 6px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .side, .topbar, .btn, .toasts { display: none !important; } .shell { display: block; } body { background: #fff; } .card { box-shadow: none; } }
