/*
 * OI Debug documentation shell
 *
 * This layer deliberately follows rustdoc's visual language: a quiet grey
 * navigation rail, thin rules, square controls, a compact mono breadcrumb,
 * and one warm accent.  It is kept separate from style.css so the existing
 * page behaviour and page-specific components remain intact.
 */
:root {
  color-scheme: light;
  --rd-bg: #f6f7f9;
  --rd-surface: #ffffff;
  --rd-sidebar: #eef0f2;
  --rd-sidebar-hover: #e3e6e9;
  --rd-border: #d7dce1;
  --rd-text: #293038;
  --rd-muted: #68737d;
  --rd-subtle: #8a949d;
  --rd-orange: #e66f2e;
  --rd-orange-hover: #d95f1e;
  --rd-orange-soft: rgba(230, 111, 46, .12);
  --rd-code: #f1f3f5;
  --rd-focus: #a6cdeb;
  --rd-mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", "Fira Code", Consolas, "Liberation Mono", monospace;
  --rd-shadow: 0 4px 14px rgba(31, 39, 46, .08);

  /* aliases consumed by the original page styles */
  --bg: var(--rd-bg);
  --panel: var(--rd-surface);
  --panel-solid: var(--rd-surface);
  --text: var(--rd-text);
  --muted: var(--rd-muted);
  --line: var(--rd-border);
  --soft: var(--rd-sidebar);
  --accent: var(--rd-orange);
  --accent2: var(--rd-orange-hover);
  --shadow: var(--rd-shadow);
}

html.dark, .dark {
  color-scheme: dark;
  --rd-bg: #1b1e21;
  --rd-surface: #202428;
  --rd-sidebar: #25292d;
  --rd-sidebar-hover: #30353a;
  --rd-border: #454c53;
  --rd-text: #e3e7ea;
  --rd-muted: #a3adb6;
  --rd-subtle: #7f8a94;
  --rd-orange: #f09a63;
  --rd-orange-hover: #ffb27e;
  --rd-orange-soft: rgba(240, 154, 99, .16);
  --rd-code: #282d32;
  --rd-focus: #628daf;
  --rd-shadow: 0 8px 22px rgba(0, 0, 0, .22);
  --bg: var(--rd-bg);
  --panel: var(--rd-surface);
  --panel-solid: var(--rd-surface);
  --text: var(--rd-text);
  --muted: var(--rd-muted);
  --line: var(--rd-border);
  --soft: var(--rd-sidebar);
  --accent: var(--rd-orange);
  --accent2: var(--rd-orange-hover);
  --shadow: var(--rd-shadow);
}

html.ayu, .ayu {
  color-scheme: dark;
  --rd-bg: #0f1419;
  --rd-surface: #141a20;
  --rd-sidebar: #171d23;
  --rd-sidebar-hover: #222a32;
  --rd-border: #343e47;
  --rd-text: #d9dee5;
  --rd-muted: #97a1ab;
  --rd-subtle: #73808c;
  --rd-orange: #e6b450;
  --rd-orange-hover: #f2c866;
  --rd-orange-soft: rgba(230, 180, 80, .16);
  --rd-code: #151c23;
  --rd-focus: #76663c;
  --rd-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  --bg: var(--rd-bg);
  --panel: var(--rd-surface);
  --panel-solid: var(--rd-surface);
  --text: var(--rd-text);
  --muted: var(--rd-muted);
  --line: var(--rd-border);
  --soft: var(--rd-sidebar);
  --accent: var(--rd-orange);
  --accent2: var(--rd-orange-hover);
  --shadow: var(--rd-shadow);
}

html.blue, .blue {
  color-scheme: light;
  --rd-bg: #f4f8fd;
  --rd-surface: #ffffff;
  --rd-sidebar: #eaf3fb;
  --rd-sidebar-hover: #dcebf8;
  --rd-border: #d7e3ef;
  --rd-text: #0f172a;
  --rd-muted: #5c6b7f;
  --rd-subtle: #8a99ab;
  --rd-orange: #0ea5e9;
  --rd-orange-hover: #0284c7;
  --rd-orange-soft: rgba(14, 165, 233, .12);
  --rd-code: #f1f5f9;
  --rd-focus: #a6cdeb;
  --rd-shadow: 0 4px 14px rgba(15, 23, 42, .08);
  --bg: var(--rd-bg);
  --panel: var(--rd-surface);
  --panel-solid: var(--rd-surface);
  --text: var(--rd-text);
  --muted: var(--rd-muted);
  --line: var(--rd-border);
  --soft: var(--rd-sidebar);
  --accent: var(--rd-orange);
  --accent2: var(--rd-orange-hover);
  --shadow: var(--rd-shadow);
}

html, body { background: var(--rd-bg); color: var(--rd-text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--rd-bg);
}
button, input, textarea, select { font-family: inherit; }
.app-shell { background: var(--rd-bg); }

/* Navigation rail */
.sidebar {
  width: 270px;
  padding: 25px 19px 18px;
  background: var(--rd-sidebar);
  border-color: var(--rd-border);
  box-shadow: none;
  backdrop-filter: none;
}
.brand {
  padding: 0 10px 22px;
  color: var(--rd-text);
  font-family: var(--rd-mono);
  font-size: 16px;
  letter-spacing: -.02em;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  color: #fff;
  background: var(--rd-orange);
  box-shadow: none;
}
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy strong { font-size: 16px; font-weight: 700; }
.brand-copy small {
  color: var(--rd-muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}
.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0 9px;
  min-height: 35px;
  border: 1px solid var(--rd-border);
  border-radius: 4px;
  background: var(--rd-bg);
  color: var(--rd-muted);
}
.sidebar-search:focus-within,
.top-search:focus-within {
  border-color: var(--rd-orange);
  box-shadow: 0 0 0 2px var(--rd-orange-soft);
}
.sidebar-search input {
  min-width: 0;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--rd-text);
  font-size: 12px;
  box-shadow: none;
}
.sidebar-search input:focus, .top-search input:focus { box-shadow: none; }
.sidebar-search kbd, .top-search kbd {
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid var(--rd-border);
  border-radius: 3px;
  color: var(--rd-muted);
  background: var(--rd-sidebar);
  font: 10px var(--rd-mono);
  white-space: nowrap;
}
.search-clear { padding: 2px; border: 0; color: var(--rd-muted); background: transparent; cursor: pointer; }
.search-status { min-height: 14px; margin: 0 10px 4px; color: var(--rd-muted); font-size: 10px; }
.nav-list { gap: 1px; overflow-y: auto; scrollbar-width: thin; }
.nav-section-title {
  margin: 13px 10px 5px;
  color: var(--rd-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.nav-section-spacer { margin-top: 19px; }
.nav-item {
  gap: 10px;
  padding: 8px 10px;
  border-radius: 3px;
  color: var(--rd-muted);
  font-size: 13px;
}
.nav-item i { width: 16px; color: inherit; font-size: 12px; }
.nav-item:hover { color: var(--rd-text); background: var(--rd-sidebar-hover); }
.nav-item.active {
  color: var(--rd-orange);
  background: var(--rd-orange-soft);
  box-shadow: inset 3px 0 var(--rd-orange);
  font-weight: 650;
}
.nav-search-empty { display: block; margin: 18px 10px; color: var(--rd-muted); font-size: 12px; }
.sidebar-footer { gap: 5px; }
.user-chip { padding: 10px; border-color: var(--rd-border); color: var(--rd-muted); }
.avatar { width: 28px; height: 28px; border-radius: 4px; background: var(--rd-orange); }
.theme-toggle strong { margin-left: auto; color: var(--rd-muted); font-size: 11px; font-weight: 500; }
.theme-chevron { margin-left: 3px; width: auto !important; font-size: 9px !important; transition: transform .15s; }
.theme-picker.open .theme-chevron { transform: rotate(90deg); }
.theme-menu {
  margin: 2px 0 5px;
  padding: 4px;
  border: 1px solid var(--rd-border);
  border-radius: 4px;
  background: var(--rd-surface);
  box-shadow: var(--rd-shadow);
}
.theme-menu[hidden] { display: none; }
.theme-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 3px;
  color: var(--rd-muted);
  background: transparent;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}
.theme-option:hover, .theme-option.selected { color: var(--rd-text); background: var(--rd-sidebar-hover); }
.theme-option .fa-check { margin-left: auto; color: var(--rd-orange); opacity: 0; }
.theme-option.selected .fa-check { opacity: 1; }

/* rustdoc-like top bar and content column */
.main-content {
  width: calc(100% - 270px);
  margin-left: 270px;
  padding: 0 44px 60px;
}
.rust-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  border-bottom: 1px solid var(--rd-border);
}
.rust-breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--rd-muted);
  font: 13px var(--rd-mono);
}
.rust-breadcrumb a { color: var(--rd-orange); text-decoration: none; }
.rust-breadcrumb a:hover { text-decoration: underline; }
.rust-breadcrumb span { color: var(--rd-border); }
.rust-header-tools { display: flex; align-items: center; gap: 12px; }
.top-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(300px, 30vw);
  padding: 0 9px;
  min-height: 33px;
  border: 1px solid var(--rd-border);
  border-radius: 4px;
  color: var(--rd-muted);
  background: var(--rd-bg);
}
.top-search input {
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--rd-text);
  font-size: 12px;
}
.version-chip { color: var(--rd-muted); font: 10px var(--rd-mono); }
.page-wrap { max-width: 1280px; }
.page-wrap.narrow { max-width: 1120px; }
.hero-row, .page-title-row { margin: 36px 0 28px; }
.hero-row h1, .page-title-row h1 { color: var(--rd-text); font-weight: 700; letter-spacing: -.03em; }
.eyebrow { color: var(--rd-orange); font-family: var(--rd-mono); letter-spacing: .08em; }
.subtitle, .hint, .microcopy { color: var(--rd-muted); }

/* Existing cards and controls, reduced to rustdoc's compact rhythm. */
.panel, .quota-card, .stat-card, .record-card, .empty-card {
  border: 1px solid var(--rd-border);
  border-radius: 4px;
  background: var(--rd-surface);
  box-shadow: none;
  backdrop-filter: none;
}
.panel { padding: 25px; }
.panel-heading { border-bottom: 1px solid var(--rd-border); padding-bottom: 15px; }
.panel-heading h2 { font-family: var(--rd-mono); font-size: 15px; }
.step { border-radius: 3px; color: var(--rd-orange); background: var(--rd-orange-soft); font-family: var(--rd-mono); }
.model-card { border-color: var(--rd-border); border-radius: 4px; background: var(--rd-surface); }
.model-card:hover { border-color: var(--rd-orange); transform: none; box-shadow: none; }
.model-card.selected { border-color: var(--rd-orange); box-shadow: 0 0 0 2px var(--rd-orange-soft); }

input, textarea, select {
  border-color: var(--rd-border);
  border-radius: 4px;
  background: var(--rd-surface);
  color: var(--rd-text);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--rd-orange);
  box-shadow: 0 0 0 2px var(--rd-orange-soft);
}
input::placeholder, textarea::placeholder { color: var(--rd-subtle); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--rd-orange); }

/* A single stable code stack is used by editors, markdown, and streamed output. */
textarea, .code-input, .stream-output, pre, pre code,
.markdown-body pre, .markdown-body pre code, code, .hljs {
  font-family: var(--rd-mono);
}
.code-input { font-size: 13px; line-height: 1.65; tab-size: 4; }
.code-input, .stream-output, pre, .markdown-body pre { color: var(--rd-text); }
.markdown-body code:not(pre code) {
  padding: .12em .35em;
  border: 1px solid var(--rd-border);
  border-radius: 3px;
  background: var(--rd-code);
  color: var(--rd-text);
  font-size: .9em;
}
.markdown-body pre, pre {
  border: 1px solid var(--rd-border);
  border-radius: 4px;
  background: var(--rd-code);
  color: var(--rd-text);
}
.markdown-body pre code, pre code, .hljs { background: transparent; }

.btn-primary { border-radius: 4px; background: var(--rd-orange); box-shadow: none; }
.btn-primary:hover { background: var(--rd-orange-hover); filter: none; transform: none; }
.btn-secondary, .btn-quiet { border-radius: 4px; border-color: var(--rd-border); background: var(--rd-surface); color: var(--rd-text); }
.service-alert, .terms-update-banner { border-radius: 4px; }
.mobile-header { background: var(--rd-sidebar); border-color: var(--rd-border); backdrop-filter: none; }
.mobile-title { display: flex; flex-direction: column; gap: 1px; font-family: var(--rd-mono); font-size: 13px; }
.mobile-title small { color: var(--rd-muted); font: 10px inherit; }
.hidden { display: none !important; }
.nav-item.search-hidden { display: none !important; }

@media (max-width: 1024px) {
  .main-content { width: 100%; margin-left: 0; padding: 76px 24px 44px; }
  .rust-header { display: none; }
}
@media (max-width: 600px) {
  .main-content { padding: 70px 14px 34px; }
  .panel { padding: 17px 14px; }
  .top-search { width: 46vw; }
}
