:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1b2430;
  --muted: #5d6877;
  --border: #d9dee5;
  --accent: #0766d1;
  --accent-text: #ffffff;
  --error: #b42318;
  --drop: #eef4fd;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --panel: #1a2029;
    --text: #e5e9ef;
    --muted: #98a3b3;
    --border: #2c3542;
    --accent: #4c9bf0;
    --accent-text: #0b1420;
    --error: #f97066;
    --drop: #17212e;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.logo { display: block; background: #fff; border-radius: 6px; padding: 2px 4px; height: 32px; width: auto; }
.tagline { color: var(--muted); flex: 1; }
.ghost-link { color: var(--text); text-decoration: none; border: 1px solid var(--border); border-radius: 8px; padding: 7px 14px; }
.topnav { display: flex; align-items: center; gap: 8px; }
.nav-btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.nav-btn:hover { filter: brightness(1.1); }
.ghost-link { white-space: nowrap; }
.topnav a[aria-current="page"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }

main { max-width: 1500px; margin: 0 auto; padding: 24px; }

.drop {
  border: 2px dashed var(--border); border-radius: 12px; background: var(--drop);
  padding: 28px 20px; text-align: center; cursor: pointer;
}
.drop.over, .drop:focus-visible { border-color: var(--accent); outline: none; }
.drop-title { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.drop-sub { margin: 0; color: var(--muted); font-size: 13px; }
.link { color: var(--accent); text-decoration: underline; }

.file-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.file-list li {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border); font-size: 13px; max-width: 100%;
}
.file-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list button { border: 0; background: transparent; color: var(--muted); padding: 0 6px; cursor: pointer; font-size: 16px; }

.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 16px; }
.controls label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; }
select { padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }

button {
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); cursor: pointer; font-weight: 600;
}
button.ghost { background: transparent; color: var(--text); border-color: var(--border); font-weight: 500; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.privacy { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; max-width: 900px; }

.status { margin-top: 20px; padding: 14px 16px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); }
.status.error { color: var(--error); border-color: var(--error); }

.result-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 28px 0 14px; }
.result-head h1 { margin: 0; font-size: 22px; }
.actions { display: flex; gap: 8px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }

/* The diagram is always drawn on white, like the SAS reference figures. */
.diagram-wrap { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: auto; }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram-wrap.presenting {
  position: fixed; inset: 0; z-index: 50; border: 0; border-radius: 0;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.diagram-wrap.presenting .diagram { width: 100%; height: 100%; }
.diagram-wrap.presenting svg { width: 100%; height: 100%; }
.diagram-wrap:fullscreen { display: flex; align-items: center; justify-content: center; padding: 16px; }
.diagram-wrap:fullscreen .diagram { width: 100%; height: 100%; }
.diagram-wrap:fullscreen svg { width: 100%; height: 100%; }

.side { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 4px 18px 18px; align-self: start; }
.side h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.facts { margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); font-size: 12px; margin-top: 10px; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.problems { padding-left: 18px; margin: 0; color: var(--error); font-size: 13px; }

@media (max-width: 600px) {
  main { padding: 16px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .tagline { display: none; }
  .topbar .brand { flex: 1; }
}
