:root {
  color-scheme: light;
  --navy: #101d31;
  --navy-deep: #0d182a;
  --ink: #17253b;
  --muted: #586981;
  --line: #e1e8ef;
  --surface: #fff;
  --bg: #f2f5f9;
  --teal: #047a70;
  --bright: #49dfc1;
  --radius: 16px;
  font-family: "IBM Plex Sans Arabic", "Geeza Pro", "Segoe UI", Tahoma, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font-size: 1rem; line-height: 1.65; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid #128f82; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.35; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
small { font-size: .875rem; }
.skip { position: fixed; inset-inline-start: 1rem; top: -100px; z-index: 5; padding: .6rem 1rem; border-radius: 8px; background: white; }
.skip:focus { top: 1rem; }
.shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy-deep); color: #afbdd0; display: flex; flex-direction: column; height: 100dvh; position: sticky; top: 0; padding: 0 16px 18px; z-index: 3; }
.brand { display: grid; gap: 7px; padding: 24px 7px 22px; border-bottom: 1px solid #253145; margin-bottom: 22px; }
.brand:hover { text-decoration: none; }
.brand img { display: block; width: 100%; max-width: 190px; height: auto; border-radius: 6px; background: #fff; }
.brand small { color: #9eafc4; font-size: .77rem; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; color: #b6c4d8; border: 1px solid transparent; border-radius: 9px; padding: 8px 10px; font-size: .93rem; min-height: 43px; }
.nav-item:hover { background: #172840; color: #fff; text-decoration: none; }
.nav-item.active { color: #75f0d5; border-color: #285350; background: #163539; font-weight: 700; }
.icon { display: inline-grid; place-items: center; min-width: 1.3em; font-family: system-ui, sans-serif; font-size: 1.12em; line-height: 1; }
.side-bottom { margin-top: auto; border-top: 1px solid #253145; padding-top: 10px; }
.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 67px; padding: 0 clamp(16px, 2.5vw, 36px); display: flex; align-items: center; justify-content: space-between; gap: 14px; background: #fff; border-bottom: 1px solid var(--line); }
.top-title, .top-actions { display: flex; align-items: center; gap: 13px; }
.top-title { font-weight: 700; white-space: nowrap; }
.quick-search { display: flex; align-items: center; gap: 7px; color: var(--muted); border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 0 10px; }
.quick-search input { background: transparent; border: 0; width: clamp(100px, 13vw, 190px); height: 36px; padding: 0; font-size: .9rem; color: var(--ink); }
.quick-search:focus-within { outline: 2px solid var(--teal); }
.quick-search input:focus { outline: none; }
.login { border: 1px solid #cfd9e3; padding: 5px 12px; border-radius: 8px; color: var(--ink); font-size: .88rem; font-weight: 700; white-space: nowrap; }
.login:hover { background: var(--bg); text-decoration: none; }
.menu-button { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; color: var(--ink); }
.content { width: min(100%, 1600px); margin-inline: auto; padding: 24px clamp(16px, 2.5vw, 36px) 34px; flex-grow: 1; }
footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 15px; color: var(--muted); font-size: .875rem; padding: 15px clamp(16px, 2.5vw, 36px); }
.hero { background: linear-gradient(270deg, #0d1e34 4%, #102139ee 34%, #10213943 72%), url("/static/refinery.jpg") center 55% / cover no-repeat; color: #fff; border-radius: var(--radius); overflow: hidden; }
.hero-content { padding: clamp(24px, 3.3vw, 51px); max-width: 780px; }
.hero-date { color: #8cf1db; font-size: .87rem; display: flex; align-items: center; gap: 5px; margin-bottom: 9px; }
.hero h1 { font-size: clamp(2rem, 4.25vw, 4rem); letter-spacing: -.055em; }
.hero-copy { color: #e2ebf7; max-width: 40rem; margin-top: 10px; font-size: clamp(1rem, 1.37vw, 1.22rem); }
.hero-actions, .article-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 21px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 15px; border: 1px solid transparent; border-radius: 9px; min-height: 41px; font-weight: 700; font-size: .925rem; }
.button:hover { text-decoration: none; }
.primary { background: var(--teal); color: white; }
.primary:hover { background: #07675f; }
.hero .primary { background: var(--bright); color: #102929; }
.hero .primary:hover { background: #80ecd7; }
.secondary { background: #fff; border-color: #cbd7e2; color: var(--ink); }
.secondary:hover { background: #edf3f8; }
.glass { background: #172740b5; border-color: #63758b; color: #fff; }
.glass:hover { background: #2a3d58; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.market-section { margin: 24px 0 20px; }
.section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading { margin-bottom: 12px; }
.section-heading h2, .panel-heading h2 { font-size: clamp(1.15rem, 1.75vw, 1.45rem); }
.section-heading p, .panel-heading p { color: var(--muted); margin-top: 3px; font-size: .875rem; }
.section-heading > a, .panel-heading > a { font-size: .875rem; font-weight: 700; flex-shrink: 0; }
.market-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.market-card { min-width: 0; padding: 12px 13px 10px; color: var(--ink); display: block; transition: box-shadow .15s, border-color .15s; }
.market-card:hover { text-decoration: none; border-color: #79bdb6; box-shadow: 0 5px 13px #18334a0c; }
.market-top, .market-value, .market-bottom { display: flex; align-items: center; }
.market-top { gap: 6px; }
.market-icon { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; border-radius: 7px; color: var(--teal); background: #e6f5f1; font-size: .75rem; }
.ticker, .market-status { font-size: .75rem; color: var(--muted); }
.ticker { font-family: system-ui, sans-serif; font-weight: 700; letter-spacing: .025em; }
.market-status { margin-inline-start: auto; white-space: nowrap; }
.market-card h3 { margin-top: 8px; font-size: .96rem; }
.market-value { gap: .45rem; }
.market-value b, .chart-stat b { font: 700 clamp(1.3rem, 2.3vw, 2rem)/1.25 system-ui, sans-serif; letter-spacing: -.06em; }
.market-bottom { justify-content: space-between; gap: 6px; color: var(--muted); min-height: 25px; font-size: .75rem; }
.sparkline { width: 62px; height: 24px; flex: 0 0 62px; }
.change { font: 650 .75rem/1.5 system-ui, sans-serif; padding: 2px 5px; border-radius: 5px; white-space: nowrap; }
.rise { background: #e6f6ef; color: #087351; }
.fall { background: #fcecee; color: #a33448; }
.flat { background: #edf2f7; color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.chart-panel, .latest, .news-feed, .settings { padding: clamp(14px, 1.55vw, 23px); }
.segments, .filters { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.segments { background: #eef3f8; border-radius: 8px; padding: 3px; }
.segments a, .filters a { padding: 4px 10px; color: var(--muted); font-weight: 700; border-radius: 6px; font-size: .875rem; white-space: nowrap; }
.segments a[aria-current], .segments a:hover { background: white; color: var(--teal); text-decoration: none; }
.filters { gap: 8px; margin-bottom: 17px; }
.filters a { border: 1px solid var(--line); background: #fff; }
.filters a[aria-current], .filters a:hover { color: #066b60; border-color: #a7d2c9; background: #e7f5f1; text-decoration: none; }
.chart-stat { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-block: 13px 4px; }
.chart-stat > :last-child { margin-inline-start: auto; }
.demo { display: inline-block; background: #fdf1d7; color: #775012; border-radius: 6px; padding: 2px 7px; font-size: .8rem; white-space: nowrap; }
.chart-wrap { position: relative; min-width: 0; }
.line-chart { display: block; width: 100%; height: 255px; }
.chart-tooltip { position: absolute; top: 4px; border-radius: 6px; padding: 4px 8px; background: var(--navy); color: #fff; pointer-events: none; white-space: nowrap; font: .75rem/1.4 system-ui, sans-serif; }
.chart-data { color: var(--muted); font-size: .875rem; margin-top: 4px; }
.chart-data summary { cursor: pointer; color: var(--teal); width: fit-content; }
.chart-data .table-scroll { max-height: 270px; margin-top: 8px; }
.news-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.news-row:last-child { border-bottom: 0; padding-bottom: 0; }
.news-symbol { display: grid; place-items: center; width: 35px; height: 35px; background: #e6f4f1; border-radius: 8px; color: var(--teal); }
.news-row h3 { font-size: 1rem; }
.news-row h3 a { color: var(--ink); }
.news-row p { margin: 6px 0; color: var(--muted); }
.topic { color: var(--teal); font-size: .8rem; font-weight: 700; }
.metadata { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; margin-top: 4px; color: var(--muted); font-size: .8rem; }
.verified { border-radius: 6px; padding: 2px 5px; background: #e7f5f1; color: #08695d; }
.page-intro { padding-block: 5px 20px; }
.page-intro h1 { font-size: clamp(1.85rem, 3.4vw, 3rem); }
.page-intro p { margin-top: 5px; color: var(--muted); }
.market-note { font-size: .92rem; color: var(--muted); margin-bottom: 15px; }
.article, .form-panel, .answer, .report-controls, .printable { padding: clamp(16px, 2.4vw, 28px); }
.article, .form-panel, .answer { max-width: 850px; }
.article h1 { font-size: clamp(1.7rem, 3.25vw, 2.8rem); }
.article > .topic { margin-top: 20px; }
.article-summary { margin-top: 16px; }
form label { color: var(--ink); font-weight: 700; }
.form-panel { display: grid; gap: 15px; justify-items: start; max-width: 560px; }
.form-panel label { width: 100%; display: grid; gap: 5px; }
.form-panel label small { color: var(--muted); font-weight: 400; }
input, textarea, select { width: 100%; border: 1px solid #cbd7e2; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); }
select { appearance: none; padding-inline-end: 2.1rem; background: linear-gradient(45deg, transparent 52%, #586981 53%) left 15px center / 6px 6px no-repeat,
  linear-gradient(-45deg, transparent 52%, #586981 53%) left 9px center / 6px 6px no-repeat, #fff; }
textarea { resize: vertical; }
.inline-search, .report-controls, .indicator-select { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 15px; }
.inline-search input[type="search"] { width: min(100%, 350px); }
.report-controls select, .indicator-select select { width: auto; max-width: 100%; }
.indicator-select { margin-top: 15px; }
.report-controls .print-button { margin-inline-start: auto; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: start; font-size: .9rem; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); }
thead th { background: #edf3f8; }
th small { display: block; font-weight: 400; color: var(--muted); }
.printable h3 { margin-block: 19px 8px; }
.report-news { margin: 0; padding-inline-start: 22px; }
.report-news li { margin-bottom: 11px; }
.report-news a { font-weight: 700; }
.muted, .empty { color: var(--muted); }
.notice, .form-error { padding: 9px 12px; border-radius: 8px; width: 100%; }
.notice { background: #def4ee; color: #075b50; margin-bottom: 15px; }
.form-error { background: #fcecee; color: #a33448; }
.ask-form { max-width: 850px; }
.prompt-list { display: flex; flex-wrap: wrap; gap: 7px; }
.prompt-chip { background: #e7f5f1; border: 1px solid #b6dad1; border-radius: 8px; color: #08695d; padding: 4px 8px; font-size: .875rem; }
.prompt-chip:hover { background: #d9f1eb; }
.answer { margin-top: 14px; }
.answer-text { white-space: pre-line; margin-block: 10px; }
.answer ol { margin-block: 4px 0; }
.logout { margin-top: 15px; }
@media (max-width: 1150px) {
  .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 940px) {
  .shell { grid-template-columns: 188px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .shell { display: block; }
  .sidebar { display: none; position: absolute; top: 58px; inset-inline-start: 0; width: min(270px, 88vw); height: auto; min-height: 440px; box-shadow: 0 15px 22px #0d182a44; }
  .sidebar.open { display: flex; }
  .brand { margin-bottom: 11px; padding: 14px 6px; }
  .side-bottom { margin-top: 12px; }
  .topbar { height: 58px; }
  .menu-button { display: grid; place-items: center; width: 34px; height: 34px; }
  .quick-search { display: none; }
  .content { padding-top: 16px; }
  .hero { background-position: 37% 55%; }
  .hero-actions { margin-top: 16px; }
  .market-grid { gap: 8px; }
  .market-card { padding-inline: 9px; }
  .sparkline { width: 40px; flex-basis: 40px; }
  .panel-heading { flex-wrap: wrap; }
  .line-chart { height: 215px; }
}
@media print {
  @page { size: A4; margin: 14mm; }
  :root, body { background: #fff; color: #000; }
  .shell, .workspace { display: block; }
  .sidebar, .topbar, .report-controls, .page-intro, footer, .skip, .notice { display: none !important; }
  .content, .printable { padding: 0; width: 100%; max-width: none; border: 0; }
  .table-scroll { overflow: visible; }
  th, td { padding: 4px 5px; }
  th small, table { font-size: .78rem; }
  tr, .report-news li { break-inside: avoid; }
}

/* Public site */
.public-site {
  --purple: #6438e6;
  --purple-dark: #5125c5;
  background: #f7f8fb;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-header-inner {
  width: min(100%, 1320px);
  margin-inline: auto;
  padding: 14px clamp(16px, 3vw, 42px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(14px, 2vw, 31px);
}
.site-logo img { display: block; width: clamp(116px, 12vw, 162px); height: auto; }
.site-nav, .site-header-actions { display: flex; align-items: center; gap: clamp(12px, 1.7vw, 24px); }
.site-nav { justify-content: center; }
.site-nav a, .site-header-actions > a:first-child { color: var(--ink); font-size: .925rem; font-weight: 700; white-space: nowrap; }
.site-nav a[aria-current] { color: var(--purple-dark); text-decoration: underline; text-underline-offset: 5px; }
.site-cta { background: var(--purple); color: #fff; white-space: nowrap; }
.site-cta:hover { background: var(--purple-dark); }
.site-main { width: min(100%, 1320px); margin-inline: auto; padding: 29px clamp(16px, 3vw, 42px) 45px; flex: 1; }
.site-footer { display: block; background: #fff; }
.site-footer > div {
  width: min(100%, 1320px);
  padding-inline: clamp(0px, calc(3vw - 36px), 15px);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.public-hero { min-height: 360px; display: grid; align-items: center; background-position: center 62%; }
.public-hero .hero-content { max-width: 740px; padding-block: clamp(30px, 5vw, 66px); }
.public-hero h1 { font-size: clamp(2.15rem, 4.9vw, 4.35rem); line-height: 1.2; }
.public-hero .hero-copy { max-width: 34rem; }
.site-section { margin-top: 28px; }
.site-section .section-heading { margin-bottom: 13px; }
.story-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.story-card { padding: clamp(14px, 1.75vw, 22px); display: flex; flex-direction: column; gap: 8px; }
.story-card h3 { font-size: 1.15rem; }
.story-card h3 a { color: var(--ink); }
.story-card p { color: var(--muted); font-size: .95rem; }
.story-meta { display: flex; flex-wrap: wrap; gap: 5px 10px; align-items: center; justify-content: space-between; font-size: .815rem; color: var(--muted); }
.story-meta .topic { padding: 1px 7px; background: #eee8ff; color: #552ab8; border-radius: 5px; }
.story-source { margin-top: auto; padding-top: 7px; color: var(--muted); font-size: .83rem; }
.story-source .icon { color: var(--teal); }
.newsletter-band { margin-top: 28px; background: #f0ebfc; border-radius: var(--radius); padding: 18px 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.newsletter-band h2 { font-size: 1.2rem; }
.newsletter-band p { color: var(--muted); }

/* Editorial dashboard */
.admin-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; margin-bottom: 12px; }
.admin-heading .page-intro { padding-bottom: 8px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-block: 10px 17px; }
.admin-stat { padding: 14px; color: var(--ink); display: grid; gap: 7px; }
.admin-stat:hover { border-color: #79bdb6; text-decoration: none; }
.admin-stat-title { display: flex; gap: 8px; align-items: center; }
.admin-stat-title h2 { font-size: .95rem; }
.admin-stat > strong { width: fit-content; font: 700 clamp(1.55rem, 2.5vw, 2.2rem)/1.25 system-ui, sans-serif; letter-spacing: -.045em; }
.admin-stat > .muted { font-size: .85rem; }
.admin-overview { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; }
.admin-section { padding: clamp(12px, 1.65vw, 22px); }
.admin-table { min-width: 580px; }
.admin-overview .admin-table { min-width: 0; }
.admin-table td { overflow-wrap: anywhere; }
.admin-table td small { display: block; color: var(--muted); }
.admin-empty { padding-block: 8px; color: var(--muted); }
.status-pill { white-space: nowrap; display: inline-block; border-radius: 6px; font-size: .85rem; padding: 1px 7px; }
.status-pill.published { background: #e6f6ef; color: #087351; }
.status-pill.draft { background: #fdf1d7; color: #775012; }
.pagination { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.admin-section .inline-search select { width: auto; max-width: 100%; }
.editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 68rem; padding: clamp(14px, 2.5vw, 26px); }
.editor label, .editor-value { display: grid; gap: 5px; align-content: start; }
.editor-wide, .editor .form-error { grid-column: 1 / -1; }
.editor-value span { padding-block: 8px; }

@media (max-width: 1000px) {
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .site-header-inner { grid-template-columns: 1fr auto; gap: 10px 14px; }
  .site-nav { grid-row: 2; grid-column: 1 / -1; justify-content: start; flex-wrap: wrap; }
  .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-overview { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .site-main { padding-top: 16px; }
  .site-header-actions { gap: 8px; }
  .site-header-actions .button, .site-header-actions > a:first-child { font-size: .8rem; }
  .site-header-actions .button { padding-inline: 8px; }
  .site-nav { gap: 7px 14px; }
  .public-hero { min-height: 300px; background-position: 38% 62%; }
  .story-grid, .editor { grid-template-columns: 1fr; }
}
@media print {
  .site-header, .site-footer { display: none !important; }
  .site-main { width: 100%; max-width: none; padding: 0; }
  .public-site { display: block; background: #fff; }
}
