/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --bg-tint: #eef2f8;
  --text: #1c2024;
  --muted: #5b6470;
  --border: #d9dde3;
  --brand: #1f3a5f;
  --brand-text: #ffffff;
  --link: #0b57a4;
  --link-visited: #5b3f9e;
  --danger: #b3261e;
  --danger-bg: #fdeceb;
  --success: #1c6b3d;
  --success-bg: #e7f4ec;
  --info-bg: #e8f0fb;
  --warn: #7a5200;
  --warn-bg: #fff4d6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Latin Modern Roman", "STIX Two Text", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 6px;
  /* chrome modelled on arxiv.org: near-black bar, light-gray footer, classic blue links on the home page */
  --hdr-bg: #1c1a17;
  --hdr-text: #ffffff;
  --hdr-font: "IBM Plex Sans", -apple-system, system-ui, "Segoe UI", sans-serif;
  --foot-bg: #f6f6f6;
  --foot-border: #dddddd;
  --foot-text: #555555;
  --foot-link: #0b57a4;
  --ax-text: #000000;
  --ax-link: #0000ee;
  --ax-visited: #551a8b;
  --ax-box-bg: #f4f4f4;
  --ax-box-border: #c8c8c8;
  --ax-btn-bg: #efefef;
  --ax-btn-text: #000000;
  --ax-btn-border: #767676;
  --ax-font: "Lucida Grande", helvetica, arial, verdana, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b; --bg-soft: #1b1f25; --bg-tint: #1d2633; --text: #e6e8eb; --muted: #9aa4b1;
    --border: #2f3640; --brand: #0f1d33; --link: #7db4f0; --link-visited: #b79df0;
    --danger: #ff8a80; --danger-bg: #3a1f1d; --success: #7fd8a1; --success-bg: #18301f;
    --info-bg: #1b2a40; --warn: #f0c36a; --warn-bg: #3a2f14; --shadow: none;
    --foot-bg: #1b1f25; --foot-border: #2f3640; --foot-text: #9aa4b1; --foot-link: #7db4f0;
    --ax-text: #e6e8eb; --ax-link: #8ab4f8; --ax-visited: #c4a8f5; --ax-box-bg: #1b1f25; --ax-box-border: #3a424d;
    --ax-btn-bg: #353a42; --ax-btn-text: #eceff3; --ax-btn-border: #7b838f;
  }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--sans);
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 1.4em 0 .5em; }
h1 { font-size: 1.6rem; margin-top: .6em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: .6em 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
code, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--bg-soft); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--bg-soft); padding: .8em 1em; border-radius: var(--radius); overflow-x: auto; }
pre code { background: none; padding: 0; }
blockquote { margin: .8em 0; padding: .1em 1em; border-left: 3px solid var(--border); color: var(--muted); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .45em .6em; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; font-size: .85rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--bg); padding: .5em 1em; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 8px; padding-bottom: 48px; min-height: 60vh; }

/* ------------------------------------------------------------------ header */
.site-header { position: relative; z-index: 50; background: var(--hdr-bg); color: var(--hdr-text); font: 14.4px/1.3 var(--hdr-font); }
.site-header a { color: var(--hdr-text); }
.site-header :focus-visible { outline: 2px solid var(--hdr-text); outline-offset: 3px; border-radius: 2px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 20px; min-height: 52px; padding: 0 24px; }
.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 36px; width: auto; }
.header-nav { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 0 22px; }
.header-nav a, .header-nav .linklike { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; }
.header-nav .nav-strong { font-weight: 700; }
.header-nav .linklike { color: var(--hdr-text); font: inherit; font-weight: 700; }
.header-nav form { display: flex; margin: 0; }
.nav-icon { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.nav-sep { width: 1px; height: 22px; background: rgba(255, 255, 255, .32); }
.search-panel { position: absolute; left: 0; right: 0; top: 100%; background: #2b2824; border-top: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 8px 18px rgba(0, 0, 0, .28); }
.search-panel[hidden] { display: none; }
.search-panel form { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; max-width: 1080px; margin: 0 auto; padding: 12px 24px; }
.search-panel input[type=search] { flex: 1 1 260px; min-width: 0; width: auto; }
.search-panel select { flex: 0 0 auto; width: auto; }
.search-panel input, .search-panel select, .search-panel button { font: inherit; padding: 7px 10px; border-radius: 4px; border: 1px solid transparent; background: #fff; color: #1c1a17; }
.search-panel button { font-weight: 700; cursor: pointer; }
.search-panel .panel-link { align-self: center; font-size: .9em; text-decoration: underline; }
.subbar { background: var(--bg-soft); border-bottom: 1px solid var(--border); font-size: .85rem; }
.subbar .container { display: flex; gap: 18px; padding-top: 7px; padding-bottom: 7px; flex-wrap: wrap; }
.subbar a.active { font-weight: 600; color: var(--text); }

/* ------------------------------------------------------------------ flashes */
.flashes { margin-top: 14px; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; border: 1px solid transparent; }
.flash.success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.flash.error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.flash.info { background: var(--info-bg); }
.notice { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: var(--radius); margin: 12px 0; }
.notice.danger { background: var(--danger-bg); color: var(--danger); }
.notice.info { background: var(--info-bg); color: var(--text); }
.notice.success { background: var(--success-bg); color: var(--success); }

/* ------------------------------------------------------------------ forms & buttons */
.btn, button.btn {
  display: inline-block; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  padding: 7px 14px; border-radius: 5px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
}
.btn:hover { text-decoration: none; background: var(--bg-tint); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand); filter: brightness(1.2); }
.btn-danger { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn-small { padding: 3px 9px; font-size: .8rem; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; }
.linklike:hover { text-decoration: underline; }
form.inline { display: inline; }

.field { margin: 0 0 16px; }
.field > label, .field > .label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .help { color: var(--muted); font-size: .85rem; margin: 3px 0 0; }
.field .error-text, .error-text { color: var(--danger); font-size: .88rem; margin: 4px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number],
input[type=url], select, textarea {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg); color: var(--text);
}
textarea { min-height: 120px; resize: vertical; }
textarea.mono { font-family: var(--mono); font-size: .9rem; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }
.checkbox { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; }
.checkbox input { margin-top: 4px; }
.radio-list label { display: block; padding: 8px 10px; border: 1px solid var(--border); border-radius: 5px; margin-bottom: 6px; cursor: pointer; }
.radio-list label:hover { background: var(--bg-soft); }
.radio-list .summary { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; }
.form-narrow { max-width: 460px; }
.form-medium { max-width: 720px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 18px; }

.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; background: var(--bg); box-shadow: var(--shadow); margin: 14px 0; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card.soft { background: var(--bg-soft); box-shadow: none; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }

/* ------------------------------------------------------------------ home (mirrors the arxiv.org front page) */
.archive-list { list-style: none; padding: 0; margin: 0; }
.archive-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.archive-list .name { font-weight: 600; font-size: 1.05rem; }
.archive-list .links a + a::before { content: " | "; color: var(--muted); }
.arx-home { font: 14.4px/normal var(--ax-font); color: var(--ax-text); padding-top: 4px; }
.arx-home a { text-decoration: none; }
.arx-home a:hover { text-decoration: underline; }
.arx-home a:link { color: var(--ax-link); }
.arx-home a:visited { color: var(--ax-visited); }
.arx-intro { max-width: 50%; margin: 0; padding: 12px; }
.arx-search { width: 770px; max-width: calc(100% - 24px); margin: 0 12px; padding: 5px; border: 1px solid var(--ax-box-border); background: var(--ax-box-bg); }
.arx-search form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; }
.arx-search select { width: 283px; max-width: 100%; padding: 1px 2px; border: 1px solid var(--ax-btn-border); border-radius: 0; background: var(--bg); color: var(--ax-text); font: 13.333px Arial, sans-serif; }
.arx-home .arx-btn, .arx-home .arx-btn:link, .arx-home .arx-btn:visited {
  display: inline-block; padding: 1px 6px; border: 2px outset var(--ax-btn-border); border-radius: 0;
  background: var(--ax-btn-bg); color: var(--ax-btn-text); font: 13.333px Arial, sans-serif; text-align: center; text-decoration: none; cursor: pointer;
}
.arx-home .arx-btn:hover { text-decoration: none; }
.arx-home .arx-btn:active { border-style: inset; }
.arx-home h2 { margin: 17.928px 0; padding-left: 12px; font-size: 21.6px; font-weight: bold; line-height: normal; color: var(--ax-text); }
.arx-home ul { margin: 14.4px 0 14.4px 12px; padding-left: 40px; list-style: disc; font-size: 14.4px; }
@media (max-width: 800px) { .arx-intro { max-width: none; } }
@media (max-width: 600px) {
  .arx-home li { margin-bottom: 6px; }
  .arx-search select { width: 100%; }
  .arx-search label { width: 100%; }
}

/* ------------------------------------------------------------------ listings */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .2em; }
.period-nav { margin: 6px 0 14px; display: flex; gap: 14px; flex-wrap: wrap; font-size: .9rem; }
ol.entries { list-style: none; margin: 0; padding: 0; counter-reset: entry; }
ol.entries > li { padding: 14px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 2.6em 1fr; gap: 0 8px; }
ol.entries > li::before { counter-increment: entry; content: "[" counter(entry) "]"; color: var(--muted); font-size: .85rem; padding-top: 2px; }
ol.entries[start] { counter-reset: none; }
.entry-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.entry-id { font-weight: 700; }
.entry-links { font-size: .85rem; color: var(--muted); }
.entry-links a { margin-right: 2px; }
.entry-title { font-size: 1.05rem; font-weight: 600; margin: 3px 0; }
.entry-authors { color: var(--text); font-size: .92rem; }
.entry-authors a { color: var(--link); }
.entry-abstract { font-family: var(--serif); font-size: .95rem; margin: 6px 0; color: color-mix(in srgb, var(--text) 88%, var(--muted)); max-width: 60em; }
.entry-abstract p { margin: .3em 0; }
.entry-meta { color: var(--muted); font-size: .82rem; display: flex; gap: 14px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: .74rem; padding: 1px 7px; border-radius: 10px; background: var(--bg-tint); border: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.tag.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.pager { display: flex; gap: 14px; justify-content: space-between; margin: 18px 0; font-size: .92rem; }
.month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0 24px; }
.month-grid a, .month-grid span { display: block; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.month-grid span { color: var(--muted); }
.day-strip { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; font-size: .85rem; color: var(--muted); }
.section-label { font-size: 1.1rem; border-bottom: 2px solid var(--brand); padding-bottom: 3px; margin-top: 2em; }

/* ------------------------------------------------------------------ abstract page */
.abs-grid { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 32px; align-items: start; }
@media (max-width: 820px) { .abs-grid { grid-template-columns: 1fr; gap: 6px; } }
.mobile-only { display: none; }
.abs-header { color: var(--muted); font-size: .9rem; margin-top: 14px; }
.abs-header .idline { font-weight: 700; color: var(--text); }
.abs-title { font-family: var(--serif); font-size: 1.85rem; font-weight: 600; margin: .15em 0 .35em; line-height: 1.22; }
.abs-authors { font-size: 1.02rem; margin-bottom: 14px; }
.abs-authors .affil, .entry-authors .affil { color: var(--muted); font-size: .88em; }
.abs-abstract { font-family: var(--serif); font-size: 1.07rem; line-height: 1.6; max-width: 46em; }
.abs-abstract h3 { font-family: var(--sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 4px; }
.abs-abstract p { margin: .5em 0; }
table.meta { margin: 18px 0; font-size: .92rem; max-width: 46em; }
table.meta th { width: 9.5em; color: var(--muted); font-weight: 600; text-align: left; border: 0; padding: 4px 8px 4px 0; font-size: .88rem; }
table.meta td { border: 0; padding: 4px 0; }
.history { font-size: .88rem; color: var(--muted); }
.history li { margin: 2px 0; }
.sidebar-box { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; font-size: .9rem; }
.sidebar-box h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--bg-soft); border-radius: var(--radius) var(--radius) 0 0; }
.sidebar-box .body { padding: 10px 12px; }
.sidebar-box ul { list-style: none; margin: 0; padding: 0; }
.sidebar-box li { padding: 3px 0; }
.btn-pdf { display: block; text-align: center; background: var(--brand); color: #fff; border-radius: 5px; padding: 8px 10px; font-weight: 700; }
.btn-pdf:hover { text-decoration: none; filter: brightness(1.2); }
.banner { padding: 10px 14px; border-radius: var(--radius); margin: 14px 0 0; font-size: .92rem; }
.banner.withdrawn { background: var(--warn-bg); color: var(--warn); }
.banner.removed { background: var(--danger-bg); color: var(--danger); }
.banner.old { background: var(--info-bg); }
.owner-tools { display: flex; gap: 10px; flex-wrap: wrap; font-size: .85rem; margin-top: 10px; }

/* ------------------------------------------------------------------ comments */
.comments-section { margin-top: 34px; border-top: 2px solid var(--brand); padding-top: 6px; max-width: 52em; }
.comment { margin: 14px 0 0; }
.comment > .comment-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; background: var(--bg); }
.comment-meta { font-size: .85rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.comment-meta strong { color: var(--text); font-size: .95rem; }
.comment-body { margin: 6px 0 4px; overflow-wrap: anywhere; }
.comment-body p { margin: .4em 0; }
.comment-actions { display: flex; gap: 14px; font-size: .82rem; align-items: center; flex-wrap: wrap; }
.comment-actions details { display: inline; }
.comment-actions summary { cursor: pointer; color: var(--link); list-style: none; }
.comment-actions summary::-webkit-details-marker { display: none; }
.comment-actions details[open] { display: block; width: 100%; margin-top: 8px; }
.comment-actions details[open] form { margin-top: 6px; }
.comment.tombstone > .comment-card { background: var(--bg-soft); color: var(--muted); font-style: italic; }
.replies { margin-left: 18px; padding-left: 14px; border-left: 2px solid var(--border); }
.replies.deep { margin-left: 0; padding-left: 8px; }
.comment-form textarea { min-height: 110px; }
.badge-inst { font-size: .74rem; padding: 0 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-tint); color: var(--muted); }
.badge-author { font-size: .74rem; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; }
.badge-mod { font-size: .74rem; padding: 0 6px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); }
:target > .comment-card { box-shadow: 0 0 0 2px var(--link); }

/* ------------------------------------------------------------------ wizard */
.steps { display: flex; list-style: none; padding: 0; margin: 14px 0 22px; gap: 6px; flex-wrap: wrap; counter-reset: s; }
.steps li { flex: 1 1 140px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: .88rem; color: var(--muted); counter-increment: s; }
.steps li::before { content: counter(s) ". "; font-weight: 700; }
.steps li.current { border-color: var(--brand); color: var(--text); background: var(--bg-tint); font-weight: 600; }
.steps li.done { color: var(--success); }
.steps li.done::after { content: " \2713"; }
.steps a { color: inherit; }
.quota-card { display: flex; gap: 16px; align-items: center; }
.quota-card .big { font-size: 2rem; font-weight: 700; line-height: 1; }
.pdf-preview { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: var(--radius); }
.preview-frame { border: 2px dashed var(--border); border-radius: var(--radius); padding: 4px 18px 18px; margin: 16px 0; }
ul.problems { color: var(--danger); }

/* ------------------------------------------------------------------ admin / tables */
.table-wrap { overflow-x: auto; }
table.data td, table.data th { font-size: .88rem; }
table.data form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
table.data input[type=text], table.data select { width: auto; padding: 3px 6px; font-size: .82rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ------------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--foot-border); background: var(--foot-bg); color: var(--foot-text); font-size: 12.5px; line-height: 1.6; }
.footer-inner { padding-top: 14px; padding-bottom: 18px; }
.footer-inner p { margin: 0 0 4px; }
.footer-inner a { color: var(--foot-link); }
.footer-links a { white-space: nowrap; }
.footer-links .sep { margin: 0 .35em; }

/* KaTeX: keep display math from overflowing small screens */
.katex-display { overflow-x: auto; overflow-y: hidden; }
.math-scope .katex { font-size: 1.05em; }

@media (max-width: 640px) {
  .header-inner { gap: 0 12px; padding: 3px 12px; }
  .brand img { height: 30px; }
  .header-nav { flex: 1 1 auto; gap: 0 14px; }
  .header-nav a, .header-nav .linklike { min-height: 36px; }
  .header-nav .nav-name { display: block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 36px; }
  .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .search-panel form { padding: 10px 12px; }
  .footer-links a { display: inline-block; padding: 4px 0; }
  .mobile-only { display: inline-block; }
  .btn-pdf.mobile-only { display: block; margin: 10px 0 14px; }
  .abs-title { font-size: 1.45rem; }
  ol.entries > li { grid-template-columns: 1fr; }
  ol.entries > li::before { display: none; }
}
@media print { .site-header, .site-footer, .subbar, .abs-side, .comment-form, .owner-tools { display: none; } }
