/* Approved design: "The Executive Desk" (graphite and champagne, light display headings, compact technical labels). */
:root {
  --graphite: #111418; --carbon: #191E24; --slate: #20262D; --line: #2C333C; --line-soft: #242A32;
  --champagne: #C8B28B; --white: #F3F2EF; --blue: #7E9EB8; --muted: #9AA3AD; --alu: #C3C9D0;
  --good: #8FC79F; --warn: #E1B866; --crit: #E58A7E;
  --display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --label: "Barlow Semi Condensed", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 6px;
  color-scheme: dark;
}
html[lang="ar"] { --display: "IBM Plex Sans Arabic", system-ui, sans-serif; --label: "IBM Plex Sans Arabic", system-ui, sans-serif; --body: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif; }
* { box-sizing: border-box; }
body { background: var(--graphite); color: var(--white); font: 15px/1.6 var(--body); margin: 0; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--champagne); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.eyebrow, .lbl { font-family: var(--label); font-size: 11.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--champagne); margin: 0 0 8px; }
html[lang="ar"] * { letter-spacing: 0 !important; text-transform: none !important; }
html[lang="ar"] .eyebrow, html[lang="ar"] .lbl { font-size: 13px; }
h1, h2, h3 { font-family: var(--display); }
h1 { font-weight: 300; font-size: clamp(28px, 4vw, 44px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -.01em; }
.lede { font-size: 17px; font-weight: 300; margin: 0 0 22px; color: var(--alu); max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top { position: sticky; top: 0; z-index: 10; background: rgba(17, 20, 24, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); height: 58px; max-width: 1180px; margin: 0 auto; }
.wordmark { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--white); }
.wm-brand { font-family: "Barlow Semi Condensed", "Inter", sans-serif; font-weight: 600; letter-spacing: .34em !important; font-size: 14px; text-transform: uppercase !important; }
.wm-sep { width: 1px; height: 18px; background: var(--champagne); }
#brand-name { font-family: var(--label); font-weight: 600; letter-spacing: .2em; font-size: 12px; text-transform: uppercase; color: var(--champagne); }

main { padding: 34px max(16px, env(safe-area-inset-right)) 56px max(16px, env(safe-area-inset-left)); max-width: 1180px; margin: 0 auto; }
.foot { max-width: 1180px; margin: 0 auto; padding: 18px 16px 40px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }

.btn { background: transparent; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 16px; cursor: pointer; color: var(--white); min-height: 42px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { border-color: var(--champagne); }
.btn.primary { background: var(--champagne); color: var(--graphite); border-color: var(--champagne); font-weight: 600; }
.btn.primary:hover { background: #d6c39f; }
.btn.ghost { border-color: var(--line); color: var(--alu); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn.big { min-height: 54px; padding: 12px 26px; font-size: 16px; }
.btn:disabled { opacity: .65; cursor: wait; }

.askbox { display: flex; gap: 10px; max-width: 900px; }
.askbox input { flex: 1; min-width: 0; background: var(--carbon); border: 1px solid var(--champagne); border-radius: var(--r); padding: 14px 16px; font-size: 17px; color: var(--white); min-height: 54px; }
.askbox input::placeholder { color: var(--muted); }
.try { margin-top: 22px; }
.examples { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin-bottom: 26px; }
.topic { background: var(--carbon); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.chip { background: transparent; border: 1px solid var(--line-soft); border-radius: 4px; padding: 7px 10px; text-align: start; color: var(--alu); cursor: pointer; font-size: 13.5px; line-height: 1.35; width: 100%; }
.chip:hover { border-color: var(--champagne); color: var(--white); }

.card { background: var(--carbon); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.answer { display: flex; flex-direction: column; gap: 16px; }
.asked { margin: 0; color: var(--alu); }
.headline { font-size: clamp(19px, 2.2vw, 24px); font-weight: 500; line-height: 1.35; margin: 0; color: var(--white); }
.period { margin: 0; font-size: 13px; color: var(--alu); }
.period .lbl, .asked .lbl { margin: 0; }
.block h3 { margin: 0 0 8px; }
.points { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; }
.notes .points { color: var(--alu); font-size: 14px; }
.sources { margin: 0; padding-inline-start: 20px; font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }
.sources .url { color: var(--muted); font-size: 12px; word-break: break-all; }
.actions { display: flex; gap: 10px; margin: 14px 0 24px; flex-wrap: wrap; }
#result { scroll-margin-top: 70px; margin-bottom: 26px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; padding: 12px; border: 1px solid var(--line-soft); border-radius: var(--r); }
.filters > .lbl { width: 100%; margin: 0; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 130px; flex: 1 1 130px; max-width: 220px; }
.filters select { background: var(--graphite); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; color: var(--white); min-height: 40px; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; white-space: nowrap; background: var(--slate); }
td.nw { white-space: nowrap; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:nth-child(even) td { background: rgba(32, 38, 45, .4); }

figure.chart { margin: 0; }
figcaption { margin-bottom: 8px; font-size: 14px; }
svg { width: 100%; height: auto; display: block; }
svg text { fill: var(--alu); font-family: var(--body); }
svg .bl { font-size: 13px; }
svg .bv { font-size: 12.5px; fill: var(--white); font-variant-numeric: tabular-nums; }
svg .bar { fill: #7C7361; } /* champagne 55% over slate; plain colour so the PDF renderer can read it */
svg .bar.first { fill: var(--champagne); }
svg .grid { stroke: var(--line-soft); }
svg .ax { font-size: 12px; fill: var(--muted); }
svg .pl { fill: none; stroke: var(--champagne); stroke-width: 2.5; }
svg .pt { fill: var(--graphite); stroke: var(--champagne); stroke-width: 2; }
svg .pv { font-size: 12px; fill: var(--white); }
.about { margin-top: 10px; }
.about summary { cursor: pointer; color: var(--alu); }

/* PDF capture: fixed width, no horizontal scroll, everything visible. */
.answer.printing { width: 1060px; }
.answer.printing .tablewrap { overflow: visible; }
.answer.printing table { font-size: 12.5px; }

@media (max-width: 640px) {
  .askbox { flex-direction: column; }
  .askbox .btn { width: 100%; }
  main { padding-top: 22px; }
  .card { padding: 14px; }
  .filters label { max-width: none; }
  th, td { padding: 7px 8px; }
}
