:root {
  color-scheme: dark;
  --background: #09090b;
  --foreground: #fafafa;
  --card: #0d0d10;
  --muted: #27272a;
  --muted-foreground: #a1a1aa;
  --border: #27272a;
  --input: #27272a;
  --buy: #fafafa;
  --sell: #71717a;
  --good: #4ade80;
  --good-bg: #052e16;
  --good-border: #14532d;
  --bad: #f87171;
  --bad-bg: #450a0a;
  --bad-border: #7f1d1d;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--background);
  color: var(--foreground);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  min-height: 100vh;
}
html[lang="ar"] body { font-family: "IBM Plex Sans Arabic", "Inter", ui-sans-serif, system-ui, sans-serif; }
.num { font-variant-numeric: tabular-nums; }

.wrap { max-width: 960px; margin: 0 auto; padding: 40px 24px 56px; }

header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
h1 .slash { color: var(--muted-foreground); font-weight: 400; }
.sub { margin: 4px 0 0; color: var(--muted-foreground); font-size: 13px; }
.meta { text-align: end; font-size: 12px; color: var(--muted-foreground); }
.meta .links { margin-top: 6px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.meta a { color: var(--muted-foreground); text-decoration: none; transition: color 120ms ease; }
.meta a:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }
.meta a[aria-current="page"] { color: var(--foreground); font-weight: 600; }
.meta .sep { color: var(--border); }

.lead {
  margin: 0 0 20px; font-size: 14px; line-height: 1.7; max-width: 78ch;
}
.lead strong { font-weight: 600; white-space: nowrap; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.5); padding: 16px;
}
.card .label {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted-foreground); font-size: 12px; font-weight: 500;
}
.card .label .dim { color: var(--muted-foreground); font-weight: 400; }
.swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.card.buy .swatch { background: var(--buy); }
.card.sell .swatch { background: var(--sell); }
.value { margin-top: 10px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.value .unit { font-size: 13px; font-weight: 400; color: var(--muted-foreground); margin-inline-start: 5px; }
.foot-line {
  margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted-foreground);
}
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px;
  font-size: 11.5px; font-weight: 500; background: var(--muted); color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.badge.up { background: var(--good-bg); border-color: var(--good-border); color: var(--good); }
.badge.down { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad); }

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.5); padding: 16px;
}
.panel.block { margin-top: 16px; }
.panel h2 { margin: 0 0 14px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }

.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.segmented { display: inline-flex; background: var(--muted); border-radius: 7px; padding: 2px; gap: 2px; }
.segmented button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  border-radius: 5px; padding: 4px 10px; font: inherit; font-size: 12px; font-weight: 500;
  color: var(--muted-foreground); font-variant-numeric: tabular-nums;
  transition: color 120ms ease, background 120ms ease;
}
.segmented button:hover { color: var(--foreground); }
.segmented button.on {
  background: var(--background); color: var(--foreground);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.04);
}
.hint { color: var(--muted-foreground); font-size: 12px; font-variant-numeric: tabular-nums; }
.canvas-box { position: relative; height: 340px; }
.empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted-foreground); font-size: 13px; text-align: center; padding: 0 32px; max-width: 460px; margin: 0 auto;
}
.empty[hidden] { display: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: start; }
th { color: var(--muted-foreground); font-weight: 500; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
td.n { text-align: end; font-variant-numeric: tabular-nums; }

.qa { padding: 14px 0; border-bottom: 1px solid var(--border); }
.qa:first-of-type { padding-top: 2px; }
.qa:last-child { border-bottom: 0; padding-bottom: 2px; }
.qa h3 { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; }
.qa p { margin: 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.65; }

footer {
  margin-top: 20px; color: var(--muted-foreground); font-size: 12px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; line-height: 1.6;
}
footer .note { max-width: 620px; }

@media (max-width: 720px) {
  .cards { grid-template-columns: 1fr; }
  .wrap { padding: 24px 16px 40px; }
  .canvas-box { height: 280px; }
  .meta { text-align: start; }
  .meta .links { justify-content: flex-start; }
}
