/* البشرى للأخبار — light by default, after the reference design: a brand band
   across the top, white rounded cards, icon tabs, a phone tab bar. Colours
   come from the logo (navy and gold on a warm paper tone). Logical properties
   throughout so RTL and LTR share one sheet. */
/* IBM Plex Sans Arabic (SIL Open Font License, see fonts/LICENSE-OFL.txt), served locally. */
@font-face { font-family: "Plex"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/plex-arabic-400.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: "Plex"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/plex-arabic-600.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: "Plex"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/plex-arabic-700.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: "Plex"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/plex-latin-400.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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Plex"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/plex-latin-600.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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Plex"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/plex-latin-700.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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --brand-1: #102347;
  --brand-2: #1b3a6b;
  --brand-accent: #c9a14a;
  --brand-ink: #ffffff;
  --bg: #f6f2ea;
  --surface: #ffffff;
  --surface-2: #f5f1e9;
  --border: #e4ddd0;
  --text: #12202f;
  --muted: #5b6b7d;
  --accent: #1d4a8a;
  --accent-soft: #e8eef8;
  --accent-ink: #ffffff;
  --coral: #e2553c;
  --t-verified: #0b7a72;
  --t-reported: #9a6a00;
  --t-estimated: #2d62c4;
  --t-projected: #6f46c9;
  --ok: #157a4f;
  --danger: #b8361f;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(18, 32, 47, .05), 0 6px 18px rgba(18, 32, 47, .06);
  --font: "Plex", system-ui, "Segoe UI", "Noto Sans Arabic", Tahoma, sans-serif;
  --fs: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"], :root:not([data-theme]) {
    --brand-1: #0b1a36; --brand-2: #16305a;
    --bg: #070b14; --surface: #0f1a2e; --surface-2: #15233d; --border: #233452;
    --text: #e8eef6; --muted: #9aabc2; --accent: #d6b260; --accent-soft: #2b2515; --accent-ink: #1a1408;
    --coral: #ff7a62; --t-verified: #19c3b6; --t-reported: #f2b544; --t-estimated: #7fb2ff;
    --t-projected: #c3a6ff; --ok: #3ccf91; --danger: #ff7a62;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-1: #0b1a36; --brand-2: #16305a;
  --bg: #070b14; --surface: #0f1a2e; --surface-2: #15233d; --border: #233452;
  --text: #e8eef6; --muted: #9aabc2; --accent: #d6b260; --accent-soft: #2b2515; --accent-ink: #1a1408;
  --coral: #ff7a62; --t-verified: #19c3b6; --t-reported: #f2b544; --t-estimated: #7fb2ff;
  --t-projected: #c3a6ff; --ok: #3ccf91; --danger: #ff7a62;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
:root[data-font="s"] { --fs: 14px; }
:root[data-font="l"] { --fs: 19px; }

* { box-sizing: border-box; }
html { font-size: var(--fs); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6;
  -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
bdi { unicode-bidi: isolate; }
.icon { flex: none; vertical-align: middle; }
.flag { flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); vertical-align: middle; object-fit: cover; }
.flag-sm { width: 18px; height: 13.5px; }
.flag-lg { width: 28px; height: 21px; border-radius: 3px; }

/* --- shell --- */
header { position: sticky; top: 0; z-index: 10; }
.brandbar { background: linear-gradient(110deg, var(--brand-1) 0%, var(--brand-2) 100%); color: var(--brand-ink);
  border-block-end: 3px solid var(--brand-accent, #c9a14a); }
.bar, .sections-inner, main, .footer-inner { max-width: 1240px; margin-inline: auto; padding-inline: 16px; }
.bar { display: flex; align-items: center; gap: 16px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--brand-ink); text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 22%; box-shadow: 0 0 0 1px rgba(201, 161, 74, .55); }
.brand-text { display: grid; line-height: 1.2; }
.brand-text strong { font-size: 1.15rem; }
.brand-text small { font-size: .72rem; opacity: .85; }
.header-search { flex: 1; max-width: 460px; }
.header-search input { width: 100%; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .95); color: #12202f; padding-inline: 18px; }
.header-search input::placeholder { color: #6a7a8c; }
.tools { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; white-space: nowrap; }
.tool { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-ink); text-decoration: none; padding: 6px 10px; border-radius: 10px; font-size: .9rem; }
.tool:hover { background: rgba(255, 255, 255, .15); }
.lang-switch { color: var(--brand-ink) !important; border-color: rgba(255, 255, 255, .5) !important; }
.lang-switch:hover { background: rgba(255, 255, 255, .15) !important; }
.sections { background: var(--surface); border-block-end: 1px solid var(--border); box-shadow: 0 2px 8px rgba(18, 32, 47, .04); }
.sections-inner { display: flex; gap: 4px; overflow-x: auto; padding-block: 8px; scrollbar-width: none; }
.sections a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; color: var(--muted);
  text-decoration: none; white-space: nowrap; font-weight: 600; font-size: .92rem; }
.sections a:hover { background: var(--surface-2); color: var(--text); }
.sections a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.sections a[aria-current="page"] .flag { box-shadow: 0 0 0 1px rgba(255, 255, 255, .7); }
.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 20; }
.demo-banner { background: color-mix(in srgb, var(--coral) 14%, var(--surface)); color: var(--text);
  border-block-end: 1px solid var(--coral); text-align: center; padding: 6px 16px; font-size: .88rem; }
main { padding-block: 24px 48px; min-height: 60vh; }
main:focus { outline: none; }
footer { margin-block-start: 32px; }
.tabbar { display: none; }

/* --- controls --- */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; min-height: 40px; }
textarea { width: 100%; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 18px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn[aria-pressed="true"] svg { fill: currentColor; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.segmented a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 16px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 700; }
.segmented a.active { background: var(--accent); color: var(--accent-ink); }

/* --- home --- */
.home-head { display: grid; grid-template-columns: 1fr auto; gap: 12px 24px; align-items: end; margin-block-end: 20px; }
.home-head .segmented { grid-column: 1 / -1; justify-self: start; }
.home-head p { margin: 0; }
.updated { text-align: end; }
.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.trends { grid-template-columns: 1fr; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.columns { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; margin-block-start: 24px; }
.block { margin-block: 24px; }
.block > h2 { display: flex; align-items: center; gap: 10px; }
.block > h2::before { content: ""; width: 4px; height: 1.1em; border-radius: 4px; background: var(--accent); }
.block > h2.group-title::before { display: none; }
.humanitarian { background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--t-estimated);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.humanitarian > h2::before { display: none; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.quick-link { display: flex; align-items: center; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); text-decoration: none; font-weight: 700; box-shadow: var(--shadow); }
.quick-link .icon { color: var(--accent); }
.quick-link:hover { border-color: var(--accent); }
.how-link { margin-block: 12px 0; }

/* --- cards --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.narrow { max-width: 420px; display: grid; gap: 10px; }
.card.metric { display: flex; flex-direction: column; gap: 6px; border-block-start: 4px solid var(--accent); }
.card.metric.status-stale, .card.metric.status-no_data { border-block-start-color: var(--border); }
.card-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card-title { margin: 4px 0 0; font-size: 1.05rem; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.alt-name { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); }
.value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.value .num { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.value.big .num { font-size: 2.3rem; letter-spacing: -.01em; }
.value .unit { font-weight: 600; }
.value .compact { color: var(--muted); font-size: .9rem; }
.range { flex-basis: 100%; font-size: .85rem; color: var(--muted); }
.change { margin: 0; font-weight: 600; }
.change.up bdi { color: var(--coral); }
.change.down bdi { color: var(--ok); }
.change.none { font-weight: 400; }
.no-data { font-size: 1.12rem; font-weight: 700; margin: 8px 0 0; color: var(--muted); }
.more { margin-block-start: auto; padding-block-start: 8px; font-weight: 600; }
.facts { margin: 6px 0 0; display: grid; gap: 4px; }
.fact { display: grid; grid-template-columns: minmax(90px, 32%) 1fr; gap: 8px; font-size: .86rem; }
.fact dt { color: var(--muted); }
.fact dd { margin: 0; overflow-wrap: anywhere; }
.with-avatar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.type-verified { color: var(--t-verified); }
.type-reported { color: var(--t-reported); }
.type-estimated { color: var(--t-estimated); }
.type-projected { color: var(--t-projected); }
.badge.demo { color: var(--coral); border-style: dashed; }
.badge.ctype { color: var(--t-estimated); }
.ext { overflow-wrap: anywhere; }
.ext-mark { font-size: .8em; }

/* --- publisher badges --- */
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; color: #fff; font-weight: 800; letter-spacing: -.02em; }
.avatar-sm { width: 24px; height: 24px; font-size: .62rem; }
.avatar-md { width: 40px; height: 40px; font-size: .85rem; }
.hue-0 { background: #0b7a72; } .hue-1 { background: #2d62c4; } .hue-2 { background: #c4432c; } .hue-3 { background: #6f46c9; }
.hue-4 { background: #9a6a00; } .hue-5 { background: #0a5d7a; } .hue-6 { background: #b02a6b; } .hue-7 { background: #3f6f1f; }

/* --- articles --- */
ul.articles { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
ul.grid-articles { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card-article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column; }
.card-article:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.thumb { display: block; aspect-ratio: 16 / 9; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* In a single-column list on a wide screen the picture sits beside the text. */
@media (min-width: 700px) {
  ul.articles:not(.grid-articles) .card-article.has-image { display: grid; grid-template-columns: minmax(0, 1fr) 260px; }
  ul.articles:not(.grid-articles) .card-article.has-image .thumb { order: 2; aspect-ratio: auto; height: 100%; min-height: 160px; }
}
.article-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-article.humanitarian_report { border-inline-start: 4px solid var(--t-estimated); }
.article-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: .8rem; color: var(--muted); }
.publisher { font-weight: 700; color: var(--text); }
.lang-tag { padding: 0 6px; border: 1px solid var(--border); border-radius: 6px; }
.article-title { margin: 4px 0; font-size: 1.05rem; line-height: 1.45; }
.article-title a { color: var(--text); text-decoration: none; }
.article-title a:hover { color: var(--accent); }
.article-desc { margin: 0 0 4px; color: var(--muted); font-size: .92rem; }
.article-foot { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .82rem; margin-block-start: auto; padding-block-start: 6px; }
.spacer { flex: 1; }
.topic-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; background: var(--surface-2); border-radius: 999px; color: var(--text); margin-inline-end: 4px; }
.article-page { max-width: 800px; }
.article-page h1 { font-size: 1.6rem; margin-block-start: 8px; }
.lede { font-size: 1.1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 16px; }

/* --- page heads, filters --- */
.page-title { display: flex; align-items: center; gap: 12px; }
.page-title .icon { color: var(--accent); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.flag-strip { display: flex; flex-wrap: wrap; gap: 5px; margin-block: 4px 10px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-items: end;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-block: 16px; box-shadow: var(--shadow); }
.filter { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); }
.filter input, .filter select { width: 100%; color: var(--text); }
.definition { margin-block: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.definition summary { cursor: pointer; font-weight: 600; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-block: 20px; }
.searchbar { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 12px 20px; }
.searchbar input { flex: 1; min-width: 200px; }

/* --- sources & topics, for you --- */
.hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(120deg, var(--brand-1), var(--brand-2)); color: var(--brand-ink); border: 0; }
.hero .muted { color: rgba(255, 255, 255, .85); margin: 0; }
.hero .btn { background: #fff; color: var(--brand-1); }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.topic-tile { display: grid; justify-items: center; gap: 6px; padding: 16px 8px; border-radius: var(--radius); border: 2px solid var(--border);
  background: var(--surface); color: var(--muted); font-weight: 700; cursor: pointer; }
.topic-tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.list-card { padding: 4px 0; }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; position: relative; }
.toggle-row + .toggle-row { border-block-start: 1px solid var(--border); }
.toggle-label { display: grid; flex: 1; min-width: 0; }
.toggle-label .muted { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { flex: none; width: 46px; height: 26px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: inset-inline-start .15s; }
.switch-input:checked + .switch { background: var(--accent); }
.switch-input:checked + .switch::after { inset-inline-start: 23px; }
.switch-input:focus-visible + .switch { outline: 3px solid var(--accent); outline-offset: 2px; }
.empty-hero { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 20px; max-width: 520px; margin-inline: auto; }
.empty-hero > .icon { color: var(--accent); }

/* --- chart --- */
.chart-wrap { margin: 0; }
.chart { width: 100%; max-width: 720px; height: auto; display: block; }
.chart .axis { stroke: var(--border); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.chart .tick { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .tick.strong { fill: var(--text); font-weight: 700; }

/* --- tables --- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 8px 10px; text-align: start; border-block-end: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
tr.superseded td { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
tr.superseded td:last-child { text-decoration: none; }

/* --- prose, settings, admin --- */
.prose { max-width: 760px; }
.prose h2 { margin-block-start: 1.6em; }
fieldset { border: 1px solid var(--border); border-radius: 12px; margin-block: 14px; padding: 12px 16px; background: var(--surface); }
legend { font-weight: 600; padding-inline: 6px; }
.radio { display: inline-flex; align-items: center; gap: 6px; margin-inline-end: 18px; min-height: 36px; }
ul.plain { list-style: none; padding: 0; }
ul.plain li { padding-block: 6px; border-block-end: 1px solid var(--border); }
.alts { padding-inline-start: 18px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin .segmented { margin-block-end: 16px; }
.admin .card { margin-block: 12px; }
.stat .value { font-size: 1.6rem; font-weight: 800; }
.form { display: grid; gap: 10px; max-width: 640px; }
.field { display: grid; gap: 4px; font-size: .86rem; color: var(--muted); }
.field input, .field select { color: var(--text); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.row > .field { flex: 1; min-width: 140px; }
.ok { color: var(--ok); }
.error, .error-text { color: var(--danger); }
.error { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border: 1px solid var(--danger); border-radius: 12px; padding: 10px 14px; }
.empty, .loading { color: var(--muted); padding: 16px 0; }

/* --- phones: tab bar at the bottom, as in the reference --- */
@media (max-width: 860px) {
  .columns { grid-template-columns: 1fr; gap: 0; }
  .home-head { grid-template-columns: 1fr; }
  .updated { text-align: start; }
  .bar { flex-wrap: wrap; gap: 10px; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; }
  .tool span { display: none; }
  .grid.cards { grid-template-columns: 1fr; }
  .value.big .num { font-size: 2rem; }
  h1 { font-size: 1.4rem; }
  .fact { grid-template-columns: 1fr; gap: 0; }
  body { padding-block-end: 72px; }
  header { position: static; }
  .tabbar { display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 10; background: var(--surface);
    border-block-start: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(18, 32, 47, .08);
    padding-block-end: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 8px 2px 6px; color: var(--muted);
    text-decoration: none; font-size: .7rem; font-weight: 700; }
  .tabbar a .icon { width: 22px; height: 22px; }
  .tabbar a .flag { width: 22px; height: 16.5px; margin-block: 3px 2px; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* --- formal front page: ticker, lead story, footer, sign-in --- */
h1, h2, .brand-text strong, .lead-title { letter-spacing: -.01em; }
h1 { font-weight: 700; }
.block > h2 { font-size: 1.25rem; font-weight: 700; }
.ticker { display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; margin-block-end: 22px; box-shadow: var(--shadow); }
.ticker-label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--coral);
  color: #fff; font-weight: 700; white-space: nowrap; }
.ticker-track { overflow: hidden; flex: 1; position: relative; }
.ticker-track ul { display: flex; gap: 32px; list-style: none; margin: 0; padding: 8px 16px; white-space: nowrap;
  width: max-content; animation: ticker 70s linear infinite; }
.ticker-track:hover ul, .ticker-track:focus-within ul { animation-play-state: paused; }
[dir="rtl"] .ticker-track ul { animation-name: ticker-rtl; }
.ticker li { display: inline-flex; gap: 8px; align-items: baseline; }
.ticker li time { color: var(--coral); font-size: .8rem; font-weight: 700; }
.ticker li a { color: var(--text); text-decoration: none; font-weight: 600; }
.ticker li a:hover { color: var(--accent); }
.ticker-pub { color: var(--muted); font-size: .8rem; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes ticker-rtl { from { transform: translateX(0); } to { transform: translateX(50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { overflow-x: auto; } .ticker-track ul { animation: none; } }

.numbers > h2 { margin-block-end: 14px; }
.top-stories { display: grid; gap: 14px; }
.lead-story { display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); border-inline-start: 5px solid var(--brand-accent, #c9a14a); }
.lead-story.has-image { grid-template-columns: 1.1fr 1fr; border-inline-start: 1px solid var(--border); }
.lead-thumb img { width: 100%; height: 100%; min-height: 240px; object-fit: cover; display: block; }
.lead-body { padding: 22px 24px; display: grid; gap: 10px; align-content: start; }
.kicker { justify-self: start; font-size: .78rem; font-weight: 700; color: var(--coral); text-transform: uppercase;
  letter-spacing: .04em; border-block-end: 2px solid var(--coral); padding-block-end: 2px; }
.lead-title { font-size: 1.6rem; line-height: 1.35; margin: 0; }
.lead-title a { color: var(--text); text-decoration: none; }
.lead-title a:hover { color: var(--accent); }
.lead-desc { color: var(--muted); margin: 0; font-size: 1.02rem; }

footer { background: var(--brand-1); color: rgba(255, 255, 255, .82); border-block-start: 3px solid var(--brand-accent, #c9a14a); }
.footer-inner { padding-block: 32px 20px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 32px; }
.footer-brand p { max-width: 46ch; font-size: .92rem; }
footer .brand { color: #fff; }
footer h3 { color: #fff; font-size: .95rem; margin-block-end: 10px; }
footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
footer a { color: rgba(255, 255, 255, .85); text-decoration: none; }
footer a:hover { color: #fff; text-decoration: underline; }
.footer-rights { border-block-start: 1px solid rgba(255, 255, 255, .15); margin-block: 24px 0; padding-block-start: 14px;
  font-size: .8rem; color: rgba(255, 255, 255, .6); }

.login-wrap { min-height: 60vh; display: grid; place-items: center; }
.login-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 28px; border-block-start: 4px solid var(--brand-accent, #c9a14a); }
.login-head { display: grid; justify-items: center; text-align: center; gap: 6px; }
.login-head img { border-radius: 22%; box-shadow: var(--shadow); }
.login-head h1 { margin: 6px 0 0; }
.login-head p { margin: 0; }
.btn.wide { justify-content: center; width: 100%; }
.admin-user { display: flex; align-items: center; gap: 12px; }

@media (max-width: 860px) {
  .lead-story.has-image { grid-template-columns: 1fr; }
  .lead-title { font-size: 1.3rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  footer { padding-block-end: 70px; }
  .ticker-label span { display: none; }
}

.waiting { margin-block-start: 14px; padding: 12px 18px; }
.waiting summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.waiting-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 0; }
.waiting-list li { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 12px; align-items: center; padding: 8px 0;
  border-block-start: 1px solid var(--border); font-size: .9rem; }
.waiting-list li > a:first-child { color: var(--text); font-weight: 600; text-decoration: none; }
@media (max-width: 860px) { .waiting-list li { grid-template-columns: 1fr; gap: 2px; } }

.static-banner { background: color-mix(in srgb, var(--brand-accent, #c9a14a) 14%, var(--surface)); color: var(--text);
  border-block-end: 1px solid var(--brand-accent, #c9a14a); text-align: center; padding: 6px 16px; font-size: .86rem; }

/* Machine translation */
.translate-btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.translate-btn[aria-pressed="true"] { color: var(--accent); }
.mt-note { margin: 4px 0 0; color: var(--muted); font-size: .78rem; }
.mt-note a { color: var(--accent); }
.mt-note .icon { vertical-align: -2px; }
.mt-note[hidden] { display: none; }

/* A published figure no editor has approved yet */
.unreviewed { display: block; margin: 8px 0 0; padding: 6px 10px; border-radius: 8px; font-size: .8rem; line-height: 1.5;
  background: color-mix(in srgb, #d97706 12%, transparent); color: var(--text); border-inline-start: 3px solid #d97706; }
.unreviewed .icon { vertical-align: -3px; color: #d97706; }

/* Sources tab: on/off and images switches side by side */
.source-row { cursor: default; flex-wrap: wrap; }
.source-row .toggle-label { flex: 1 1 180px; }
.source-switches { display: flex; gap: 14px; flex-wrap: wrap; }
.mini-switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; position: relative; }

/* Add-story form: fetch details from the link */
.preview-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-block: -4px 4px; }
.preview-out p { margin: 4px 0; }
.preview-img { display: block; max-width: 320px; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); margin-block: 4px 8px; }
.preview-img[hidden] { display: none; }

/* The style switch and the newspaper date line; the print edition itself is in paper.css. */
.dateline { display: none; }
.style-switch { color: var(--brand-ink) !important; border-color: rgba(255, 255, 255, .5) !important; }
.style-switch:hover { background: rgba(255, 255, 255, .15) !important; }
@media (max-width: 860px) { .style-switch span { display: none; } }

/* Story card preview */
.share-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.share-dialog::backdrop { background: rgba(10, 14, 22, .55); }
.share-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-block-end: 1px solid var(--border); }
.share-body { padding: 14px; overflow: auto; max-height: calc(100vh - 90px); }
.share-preview { display: block; max-width: 100%; max-height: 56vh; width: auto; height: auto; margin-inline: auto; border: 1px solid var(--border); }
.share-caption { white-space: pre-line; color: var(--muted); overflow-wrap: anywhere; }
.share-body .actions { margin-block: 8px; }

/* Today's conditions: weather, rates, earthquakes */
.extras-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.small-btn { min-height: 34px; padding: 4px 12px; font-size: .85rem; }
.wx-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 10px; overflow-x: auto; padding-block-end: 4px; }
.wx-card { display: grid; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.wx-card.loading-card { min-height: 110px; opacity: .6; }
.wx-now { display: flex; align-items: center; gap: 8px; color: var(--accent); }
.wx-temp { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.wx-cond { font-weight: 600; }
.tiny { font-size: .75rem; }
.source-line { margin-block: 6px 0; }
.city-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 10px; margin-block: 8px; }
.rates-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.rates-table th, .rates-table td { padding: 6px 4px; border-block-end: 1px solid var(--border); background: none; font-weight: 600; }
.rates-table td { text-align: end; font-variant-numeric: tabular-nums; }
.quake-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.quake-list li { display: flex; gap: 10px; align-items: baseline; font-size: .9rem; }
.mag { flex: none; min-width: 42px; text-align: center; font-weight: 800; padding: 2px 6px; border-radius: 6px; background: #f2b544; color: #1d1b17; }
.mag.m6, .mag.m7 { background: #c4432c; color: #fff; }
.mag.m5 { background: #e88a2e; color: #1d1b17; }
.today-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; margin-block: 8px 24px; }
.today-row > .block { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.today-row h2 { font-size: 1.1rem; margin: 0; }
.today-row .extras-head { margin-block-end: 8px; }
.prayer-city { min-height: 34px; padding: 2px 8px; font-size: .9rem; max-width: 55%; }
.hijri { margin: 0 0 6px; font-weight: 600; color: var(--muted); }
.prayer-table { width: 100%; border-collapse: collapse; }
.prayer-table th, .prayer-table td { padding: 5px 4px; border-block-end: 1px solid var(--border); background: none; font-weight: 600; }
.prayer-table td { text-align: end; font-variant-numeric: tabular-nums; }
.prayer-table tr.next th, .prayer-table tr.next td { color: var(--accent); font-weight: 800; }
.next-tag { font-size: .7rem; margin-inline-start: 6px; padding: 0 6px; border: 1px solid currentColor; border-radius: 999px; }
@media (max-width: 960px) { .today-row { grid-template-columns: 1fr; } }
