:root {
  --ink: #0c1612;
  --ink-2: #15241e;
  --ink-3: #2a4038;
  --paper: #f3eee4;
  --paper-2: #e6dfd0;
  --card: #fffcf6;
  --white: #fffdf8;
  --line: rgba(12, 22, 18, 0.08);
  --line-2: rgba(12, 22, 18, 0.15);
  --teal: #1a7a62;
  --teal-2: #0d5647;
  --teal-soft: #d5efe6;
  --gold: #c9a15b;
  --gold-2: #a07c38;
  --amber: #c9842a;
  --amber-soft: #f8e6c7;
  --clay: #c24e28;
  --clay-soft: #f5d6cc;
  --sage: #5b7c6e;
  --good: #2f6f4e;
  --warn: #b5791f;
  --bad: #a33b24;
  --info: #2c5f73;
  --shadow: 0 1px 2px rgba(12, 22, 18, 0.05), 0 16px 44px rgba(12, 22, 18, 0.07);
  --radius: 18px;
  --font: "Segoe UI", "Avenir Next", system-ui, -apple-system, sans-serif;
  --serif: "Palatino Linotype", Palatino, "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
/* ISSUE 1: keep the document from growing past the viewport on phones. */
html {
  overflow-x: hidden;
  max-width: 100%;
  height: 100%;
}
html, body { margin: 0; max-width: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(900px 420px at 0% -8%, rgba(231, 194, 122, 0.12), transparent 50%),
    var(--paper);
  color: var(--ink);
  line-height: 1.45;
  overflow-x: hidden;
  width: 100%;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: #cfe8dc; color: var(--ink); }
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
/* App chrome: lock the window. Only .content / .rte-workspace scroll. */
body.app-shell,
body:has(.shell) {
  height: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
img, video, canvas {
  max-width: 100%;
  height: auto;
}
iframe { max-width: 100%; }
a { color: var(--teal-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 80;
}
.skip:focus { left: 12px; }
.shell {
  display: flex;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  max-width: 100%;
  overflow: hidden; /* app-like: no full-page scroll; panes scroll inside */
}
.rail {
  width: 92px;
  background:
    linear-gradient(180deg, #141f1b 0%, var(--ink) 28%, #0a120f 100%);
  color: #e8efe9;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px 8px;
  position: relative; /* flex child of the locked shell — does not move with the document */
  top: 0;
  align-self: stretch;
  height: auto;
  max-height: none;
  min-height: 0;
  overflow: hidden; /* logo + footer stay put; .rail-nav is the only scroller */
  flex-shrink: 0;
  z-index: 20;
  overscroll-behavior: contain;
  box-shadow: 8px 0 28px rgba(12, 22, 18, 0.12);
}
.mark {
  color: #e7c27a;
  margin-bottom: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 100%;
}
.mark img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}
.mark:hover { text-decoration: none; color: #fff; }
.rail-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto; /* 19 items: scroll the list instead of shrinking/overlapping */
  padding: 0 0 6px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #3a5248 transparent;
}
.rail-nav::-webkit-scrollbar { width: 6px; }
.rail-nav::-webkit-scrollbar-thumb {
  background: #3a5248;
  border-radius: 99px;
}
.rail-nav a {
  color: #c9d6cf;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding: 7px 4px 6px;
  border-radius: 12px;
  font-size: 9px;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  flex: 0 0 auto; /* never shrink — shrinking painted labels over the next item */
  width: 100%;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  line-height: 1.15;
  transition: background .18s var(--ease), color .18s;
}
.rail-nav a svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
  stroke: none;
  overflow: visible;
}
.rail-nav a span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  width: 100%;
  max-height: 2.3em;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.15;
}
.rail-nav a[data-nav="search"] svg { fill: none; }
.rail-nav a:hover, .rail-nav a.active {
  background: #24352e;
  color: #fff;
}
.rail-nav a.active {
  box-shadow: inset 0 0 0 1px rgba(231, 194, 122, 0.28);
  color: #f4e3b2;
}
.rail-foot {
  font-size: 10px;
  color: #8aa396;
  flex: 0 0 auto;
  text-align: center;
  width: 100%;
  padding: 8px 2px 10px;
  background: transparent;
  border-top: 1px solid #2a3c35;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.anon {
  border: 1px solid #3a5248;
  border-radius: 999px;
  padding: 5px 8px;
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #c9d6cf;
  text-decoration: none;
}
.anon:hover { background: #24352e; color: #fff; text-decoration: none; }
.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: transparent;
}
.top {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 12;
  position: relative;
}
.brand {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: .2em;
  font-weight: 650;
}
.tag { color: var(--sage); font-size: 12px; margin-top: 2px; letter-spacing: .02em; }
.top-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.top-actions .chip { text-decoration: none; }
body[data-lite="1"] .paper-page { box-shadow: none; }
.rail-foot { text-align: center; }
.content {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  padding: 22px 28px 36px;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-wrap: break-word;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #8a8378 var(--paper-2);
}
.content::-webkit-scrollbar { width: 12px; height: 12px; }
.content::-webkit-scrollbar-thumb {
  background: #8a8378;
  border-radius: 8px;
  border: 2px solid var(--paper-2);
}
.content::-webkit-scrollbar-track { background: var(--paper-2); }
.grid { display: grid; gap: 16px; max-width: 100%; }
.grid > * { min-width: 0; max-width: 100%; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow-x: auto; /* ISSUE 1: wide tables scroll inside the card */
  transition: transform .24s var(--ease), box-shadow .24s var(--ease), border-color .24s;
}
a.card { color: inherit; text-decoration: none; display: block; }
a.card:hover {
  transform: translateY(-3px);
  text-decoration: none;
  border-color: rgba(26, 122, 98, 0.22);
  box-shadow: 0 22px 48px rgba(12, 22, 18, 0.12);
  color: inherit;
}
.card h2, .card h3 { margin: 0 0 8px; font-family: var(--serif); font-weight: 600; }
.muted { color: var(--sage); font-size: 13px; }
.stat .num { font-size: 32px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--sage); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: #f4efe6; border: 0;
  border-radius: 999px; padding: 10px 16px; cursor: pointer;
  font-weight: 650; font-size: 14px;
  box-shadow: 0 10px 22px rgba(12, 22, 18, 0.12);
  transition: transform .18s var(--ease), background .18s, box-shadow .18s;
}
.btn:hover { background: var(--ink-2); text-decoration: none; color: #fff; transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); box-shadow: none; }
.btn.ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn.teal { background: var(--teal); }
.btn.teal:hover { background: var(--teal-2); }
.btn.clay { background: var(--clay); }
.btn.sm { padding: 6px 12px; font-size: 12px; box-shadow: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.trash-form { display: inline-flex; margin: 0; vertical-align: middle; }
.btn-del {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid #e4cfc4; background: #fff8f5; color: #8a3a22;
  border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 12px; line-height: 1;
}
.btn-del:hover { background: #c24e28; color: #fff; border-color: #c24e28; }
.btn-del svg { width: 14px; height: 14px; fill: currentColor; flex: 0 0 auto; }
.btn-del-lab { font-weight: 600; }
.table td .trash-form, .source-item .trash-form, .row .trash-form { margin-left: 6px; }
.scan-lock {
  position: fixed;
  inset: 0;
  background: rgba(12, 22, 18, 0.55);
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}
.scan-lock[hidden] { display: none !important; }
.scan-lock-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 26px 20px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 30px 70px rgba(12, 22, 18, 0.28);
}
.scan-pct {
  font-size: clamp(2rem, 6vw, 40px);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 4px;
}
.scan-msg { font-size: 15px; margin: 0 0 4px; }
.scan-busy textarea, .scan-busy input, .scan-busy select { pointer-events: none; }
.input, select, textarea.input {
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--white);
  border-radius: 12px;
  padding: 11px 13px;
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
.input:focus, select:focus, textarea.input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(26, 122, 98, 0.14);
}
textarea.input { min-height: 180px; resize: vertical; }
label.lbl { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--sage); margin: 0 0 6px; font-weight: 700; }
.hero {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 18px;
  margin-bottom: 18px;
  max-width: 100%;
}
.hero > * { min-width: 0; max-width: 100%; }
.hero-copy h1 {
  font-family: var(--serif);
  font-size: clamp(1.55rem, 5vw, 40px); /* ISSUE 1: 40px heading overflowed 320px */
  line-height: 1.15;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  letter-spacing: -0.02em;
}
.kicker { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--amber); font-weight: 700; }
.drop {
  border: 1.5px dashed #c9bea8;
  border-radius: 18px;
  padding: 28px;
  text-align: center;
  background: linear-gradient(180deg, #fffdf8, #f6f0e4);
}
.drop.drag { border-color: var(--teal); background: var(--teal-soft); }
.card.drop { text-align: left; padding: 20px; }
.convert-file-list {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.convert-file-list[hidden] { display: none !important; }
.convert-file-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 8px; background: var(--paper, #fffdf8);
}
.convert-file-item.drag-over { border-color: var(--teal); background: var(--teal-soft); }
.convert-file-item.dragging { opacity: .45; }
.convert-file-grip {
  cursor: grab; color: var(--sage); user-select: none; padding: 0 2px; font-size: 14px; line-height: 1;
  touch-action: none;
}
.convert-file-grip:active { cursor: grabbing; }
.convert-file-idx {
  flex: 0 0 auto; min-width: 20px; text-align: center; font-size: 11px; font-weight: 700;
  color: var(--teal-2); background: var(--teal-soft); border-radius: 999px; padding: 2px 6px;
}
.convert-file-name { flex: 1 1 auto; font-size: 13px; overflow-wrap: anywhere; }
.convert-file-size { flex: 0 0 auto; font-size: 11px; color: var(--sage); }
.convert-file-move, .convert-file-remove {
  flex: 0 0 auto; border: 1px solid var(--line-2); background: transparent; border-radius: 8px;
  width: 24px; height: 24px; line-height: 1; cursor: pointer; font-size: 13px; color: inherit;
}
.convert-file-move:disabled { opacity: .35; cursor: default; }
.convert-file-remove { color: #c24e28; border-color: rgba(194, 78, 40, 0.35); }
.convert-file-remove:hover { background: rgba(194, 78, 40, 0.08); }
.small { font-size: 12px; }
.table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--sage); padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: rgba(213, 239, 230, 0.35); }
.badge {
  display: inline-flex; align-items: center;
  border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700;
  background: var(--paper-2); color: var(--ink-3);
}
.badge.ok { background: var(--teal-soft); color: var(--teal-2); }
.badge.warn { background: var(--amber-soft); color: #7a4e10; }
.badge.bad { background: var(--clay-soft); color: var(--clay); }
.progress {
  height: 8px; background: var(--paper-2); border-radius: 99px; overflow: hidden;
}
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #2ea885); }
.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
  max-width: 100%;
}
.workspace > * { min-width: 0; max-width: 100%; }
.paper-page {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px 18px 18px 18px;
  min-height: 70vh;
  padding: 36px 40px 64px;
  box-shadow: var(--shadow);
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.paper-page mark {
  border-radius: 3px;
  padding: 0 1px;
  cursor: pointer;
}
mark.exact { background: #f3c1b0; }
mark.near_exact { background: #f3d3a6; }
mark.phrase { background: #f6e2a8; }
mark.paraphrase { background: #cfe8dc; }
mark.semantic { background: #d5e4f2; }
mark.quotation { background: transparent; box-shadow: inset 0 -2px 0 #8aa396; }
mark.active { outline: 2px solid var(--ink); }
.side-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.side-tabs button {
  border: 1px solid var(--line-2); background: transparent; border-radius: 999px;
  padding: 5px 10px; cursor: pointer; font-size: 12px;
}
.side-tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.gauge {
  width: 140px; height: 140px; margin: 0 auto 8px;
}
.source-item {
  border-top: 1px solid var(--line);
  padding: 10px 0;
  cursor: pointer;
}
.source-item:hover { color: var(--teal-2); }
.split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-height: 60vh; max-width: 100%;
}
.split pre {
  white-space: pre-wrap; font-family: var(--serif); font-size: 14px;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; overflow: auto; min-height: 240px; margin: 0;
}
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--ink); color: #f4efe6; padding: 10px 14px; border-radius: 12px;
  box-shadow: var(--shadow); max-width: 320px; font-size: 13px;
}
.toast.err { background: var(--bad); }
.modal {
  position: fixed; inset: 0; background: rgba(16,25,22,.45);
  display: grid; place-items: center; z-index: 40; padding: 20px;
}
.modal[hidden] { display: none !important; pointer-events: none; }
.modal-card {
  background: var(--card); border-radius: 18px; max-width: 920px; width: 100%;
  max-height: 86vh; overflow: auto; padding: 22px; position: relative;
  box-shadow: var(--shadow);
}
.modal-x {
  position: absolute; top: 10px; right: 12px; border: 0; background: transparent;
  font-size: 24px; cursor: pointer;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.chip {
  border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; background: transparent;
  text-decoration: none; color: var(--ink);
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.matrix { border-collapse: collapse; font-variant-numeric: tabular-nums; max-width: 100%; }
.matrix th, .matrix td { border: 1px solid var(--line); padding: 8px 10px; text-align: center; min-width: 64px; }
.matrix td.hot { background: #f3c1b0; }
.matrix td.warm { background: #f8e6c7; }
.matrix td.cool { background: #d7efe7; }
.empty {
  padding: 40px 20px; text-align: center; color: var(--sage);
}
.editor {
  min-height: 52vh; font-family: var(--serif); font-size: 18px; line-height: 1.7;
  border: 1px solid var(--line); border-radius: 16px; padding: 28px; background: var(--white);
  outline: none;
}
.counts { display: flex; gap: 16px; flex-wrap: wrap; color: var(--sage); font-size: 13px; margin: 8px 0 14px; }
.flag { border-left: 3px solid var(--amber); padding: 8px 10px; margin: 8px 0; background: #fffaf1; border-radius: 0 10px 10px 0; }
.flag.high { border-color: var(--clay); background: #fff1ec; }
.flag.medium { border-color: var(--amber); }
.flag.low, .flag.info { border-color: var(--info); background: #f3f7f8; }
.timeline { border-left: 2px solid var(--paper-2); margin-left: 8px; padding-left: 16px; }
.timeline .ev { margin: 0 0 12px; }
.timeline .ev time { color: var(--sage); font-size: 12px; }
.warnbox {
  background: var(--amber-soft); border-radius: 12px; padding: 12px 14px; font-size: 13px; margin: 10px 0;
  border: 1px solid rgba(201, 132, 42, 0.25);
}
.list-reset { list-style: none; margin: 0; padding: 0; }
.list-reset li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: min(160px, 100%); }
.hidden { display: none !important; }
.doc-nav a { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13px; }
.doc-nav a:hover { color: var(--teal-2); }
.layer-row { display: flex; justify-content: space-between; font-size: 13px; margin: 6px 0; }
.layer-row b { font-variant-numeric: tabular-nums; }
ins { background: #d7efe7; text-decoration: none; padding: 0 2px; }
del { background: #f5d6cc; text-decoration: line-through; padding: 0 2px; }
.diff-view { line-height: 1.85; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--paper-2); padding: 1px 6px; border-radius: 6px; }
.origo-report { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-top: 16px; align-items: start; max-width: 100%; }
.report-side { position: sticky; top: 12px; max-height: 88vh; overflow: auto; }
.src-no {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 99px;
  background: var(--ink); color: #fff; font-size: 10px; font-weight: 700;
  margin-right: 6px; vertical-align: super; font-family: var(--font);
}
.source-item.numbered { display: block; }
mark.src-1 { background: #f3c1b0; }
mark.src-2 { background: #f3d3a6; }
mark.src-3 { background: #cfe8dc; }
mark.src-4 { background: #d5e4f2; }
mark.src-5 { background: #e4d5f2; }
mark.src-6 { background: #f2e4d5; }
mark.src-7 { background: #d5f2ea; }
mark.src-8 { background: #f2d5e4; }
.rail-nav a[data-nav="web"] svg { fill: none; }
.rail-nav a[data-nav="discover"] svg { fill: none; }
.rail-nav a[data-nav="publish"] svg { fill: none; }
.rail-nav a[data-nav="lab"] svg { fill: none; }
.rail-nav a[data-nav="stats"] svg { fill: none; }
.rail-nav a[data-nav="convert"] svg { fill: none; }
.rail-nav a[data-nav="editor"] svg { fill: none; }
.chart-svg { overflow: auto; display: block; max-width: 100%; }
.chart-svg svg { display: block; }
.heat-svg { max-width: 100%; height: auto; }
@media (max-width: 1100px) {
  .origo-report { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .hero, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .rail { width: 80px; }
}
/* ISSUE 1 + 2: below 768px the rail becomes a bottom strip (not a clipped desktop sidebar). */
@media (max-width: 768px) {
  .rail {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    height: 64px;
    max-height: 64px;
    width: 100%;
    flex-direction: row;
    align-items: stretch;
    padding: 4px 6px;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 30;
  }
  .rail-nav {
    flex-direction: row;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    min-height: 0;
    padding: 0;
    gap: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .rail-nav a {
    flex: 0 0 auto;
    min-width: 58px;
    max-width: 92px;
    width: auto;
    padding: 4px 6px;
    justify-content: center;
  }
  .rail-nav a span {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-height: none;
    overflow: hidden;
  }
  .rail-foot, .mark { display: none; }
  .shell {
    flex-direction: column;
    padding-bottom: 64px;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
  }
  .main {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }
  .split { grid-template-columns: 1fr; }
  .top { padding: 14px 16px 8px; flex-wrap: wrap; gap: 8px; }
  .top-actions { justify-content: flex-start; }
  .content { padding: 12px 12px 24px; }
  .paper-page { padding: 18px 14px 40px; }
  .card { padding: 14px; }
  .row { max-width: 100%; }
  .btn { max-width: 100%; }
  .input, select, textarea.input { max-width: 100%; }
  .toasts { right: 8px; left: 8px; }
  .toast { max-width: 100%; }
  .modal { padding: 12px; }
  .reading-meter .num { font-size: clamp(2rem, 14vw, 56px); }
}
.reading-meter .num { font-size: clamp(2.2rem, 10vw, 56px); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; font-weight: 700; }
.reading-meter.hot .num { color: var(--clay); }
.reading-meter.warm .num { color: var(--amber); }
.reading-meter.cool .num { color: var(--teal); }
.reading-meter .progress { height: 10px; }
.reading-meter.hot .progress > span { background: var(--clay); }
.reading-meter.warm .progress > span { background: var(--amber); }
/* Stats interpretation + verification (plain-language layer under raw PHP results) */
.interp-card h4, .verify-card h4 { margin: 14px 0 6px; font-family: var(--serif); }
.interp-conf { padding: 8px 12px; border-radius: 10px; margin: 8px 0 12px; font-size: 14px; }
.interp-good, .interp-conf.interp-good { background: #d7efe7; color: var(--teal-2); }
.interp-bad, .interp-conf.interp-bad { background: #f5d6cc; color: var(--clay); }
.interp-warn, .interp-conf.interp-warn { background: #f8e6c7; color: #7a4e10; }
.interp-info { background: transparent; }
.interp-metrics { list-style: none; margin: 0; padding: 0; }
.interp-metrics li { padding: 8px 10px; border-radius: 8px; margin: 6px 0; }
.verify-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.verify-pre {
  max-width: 100%;
  overflow-x: auto;
  background: #1e2420;
  color: #e7eee8;
  padding: 12px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre;
}

/* Eduzix evidence instrument */
.instrument .pair-pane pre { white-space: pre-wrap; font-size: 13px; max-height: 220px; overflow: auto; }
.instrument .split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
mark.tax-unexpected { box-shadow: inset 0 -2px 0 #c24e28; }
mark.tax-expected { box-shadow: inset 0 -2px 0 #1b7a64; }
mark.tax-quoted { box-shadow: inset 0 -2px 0 #8aa396; }
mark.tax-cited { box-shadow: inset 0 -2px 0 #2b4c7e; }
mark.tax-common { box-shadow: inset 0 -2px 0 #b8860b; }
mark.tax-bibliography { box-shadow: inset 0 -2px 0 #7a7468; }
tr.hot td { background: #f8e6c7; }
tr.warm td { background: #f4efe6; }
@media (max-width: 900px) {
  .instrument .split { grid-template-columns: 1fr; }
}

/* Presentation polish */
.page-head { margin: 0 0 18px; max-width: 820px; }
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.2vw, 34px);
  letter-spacing: -0.02em;
  margin: 6px 0 8px;
  line-height: 1.18;
}
.page-head .muted { font-size: 14.5px; line-height: 1.5; }
.metric {
  position: relative;
  overflow: hidden;
}
.metric::after {
  content: "";
  position: absolute;
  right: -12px; top: -18px;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(231,194,122,.28), transparent 70%);
  pointer-events: none;
}
.tool-tile h3 { font-size: 18px; }
.tool-tile p { margin: 0; }
.engine-live {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.engine-dot {
  display: inline-flex; align-items: center; gap: 8px;
}
.engine-dot::before {
  content: "";
  width: 8px; height: 8px; border-radius: 99px;
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}
.dash-actions .btn { margin: 0; }
.file-input {
  display: block;
  width: 100%;
  padding: 14px;
  border: 1.5px dashed #c9bea8;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf8, #f6f0e4);
  margin: 12px 0;
}
.content > h1, .content > h2 { font-family: var(--serif); }
.hint {
  font-size: 12.5px;
  color: var(--sage);
  margin: 8px 0 0;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  background: var(--white);
  font-size: 12px;
  font-weight: 650;
}
.user-chip:hover { text-decoration: none; border-color: var(--teal); }
.user-ava {
  width: 24px; height: 24px; border-radius: 99px;
  background: var(--ink); color: #e7c27a;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Stats pictorials drawn on this host */
.chart-host { margin: 12px 0 4px; }
.chart-caption { font-size: 12px; color: var(--sage); margin: 0 0 8px; }
.chart-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 8px 0 4px;
}
.chart-svg svg, .chart-board svg, svg.chart-pictorial {
  display: block;
  width: 100%;
  height: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
@media (max-width: 700px) {
  .chart-board { grid-template-columns: 1fr; }
}

/* Network: directory, connections, circles */
.net-ava {
  width: 36px; height: 36px; border-radius: 99px; flex: 0 0 auto;
  background: var(--ink); color: #e7c27a;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700;
}
.net-ava.lg { width: 56px; height: 56px; font-size: 22px; }
.net-card {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line);
  color: inherit; text-decoration: none;
}
.net-card:first-of-type { border-top: 0; }
.net-card:hover { text-decoration: none; color: var(--teal-2); }
.net-me h1, .net-me h2 { overflow-wrap: anywhere; }
svg.net-graph { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.dash-role[data-family="student"] .kicker { color: var(--teal); }
.dash-role[data-family="lecturer"] .kicker { color: var(--amber); }
.dash-role[data-family="reviewer"] .kicker { color: var(--info); }
.dash-role[data-family="admin"] .kicker { color: var(--gold-2); }
.dash-mods a.card h3 { margin-bottom: 6px; }

/* Academic Q&A — scholarly feed (not a Quora clone) */
.qa-shell {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: start;
  max-width: 100%;
}
.qa-shell > * { min-width: 0; }
.qa-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 8px;
}
.qa-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink-3);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 650;
}
.qa-nav a:hover, .qa-nav a.on {
  background: var(--teal-soft);
  color: var(--teal-2);
  text-decoration: none;
}
.qa-nav a.qa-ask-link {
  margin-top: 8px;
  background: var(--ink);
  color: #f4efe6;
  text-align: center;
}
.qa-nav a.qa-ask-link:hover { background: var(--ink-2); color: #fff; }
.qa-search { margin: 0; }
.qa-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  padding: 16px 18px;
}
.qa-score { text-align: center; color: var(--sage); }
.qa-score-n {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  color: var(--ink);
  line-height: 1.1;
}
.qa-score-l { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.qa-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 650;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.25;
  display: inline-block;
}
.qa-title:hover { color: var(--teal-2); }
.qa-excerpt { margin: 6px 0 0; color: var(--ink-3); font-size: 14.5px; line-height: 1.45; }
.qa-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
}
.net-ava.sm { width: 22px; height: 22px; font-size: 11px; }
.qa-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
  margin: 8px 0;
}
.qa-stats strong { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.qa-stats span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--sage); }
.qa-q-grid {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.qa-vote { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.qa-vote form { margin: 0; }
.qa-chev {
  border: 1px solid var(--line-2);
  background: var(--white);
  width: 36px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--sage);
  font-size: 12px;
}
.qa-chev:hover, .qa-chev.on { background: var(--teal-soft); color: var(--teal-2); border-color: var(--teal); }
.qa-vote-n { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 18px; }
.qa-h { font-family: var(--serif); font-size: clamp(1.4rem, 3vw, 30px); line-height: 1.2; }
.qa-prose { font-size: 16px; line-height: 1.6; }
.qa-ans-h { font-family: var(--serif); margin: 22px 0 8px; font-size: 1.25rem; }
.qa-answer.accepted { border-color: rgba(26, 122, 98, 0.35); box-shadow: 0 0 0 1px rgba(26, 122, 98, 0.12); }
.qa-actions { margin-top: 12px; gap: 8px; }
.qa-edit { margin-top: 12px; font-size: 14px; }
.qa-edit summary, .qa-comments summary { cursor: pointer; color: var(--teal-2); font-weight: 650; }
.qa-comment { border-top: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.qa-comment-form { margin-top: 8px; }
.qa-composer { padding: 14px 16px; }
.qa-side .card h3 { margin-bottom: 6px; }
@media (max-width: 1100px) {
  .qa-shell { grid-template-columns: 1fr; }
  .qa-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .qa-nav a.qa-ask-link { margin-top: 0; }
}

.voice-hit { border-top: 1px solid var(--line); padding: 10px 0; }
.voice-hit .badge { margin-right: 8px; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.voice-hit p { margin: 6px 0 0; }
.voice-meter .num { font-size: 28px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.voice-meter .row { gap: 24px; }
.voice-obs { max-height: 320px; overflow: auto; margin: 8px 0 0; padding-left: 18px; }
.voice-obs li { margin: 4px 0; font-size: 13px; }
.voice-studio textarea[readonly] { background: var(--white, #fff); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.lang-select { max-width: 168px; min-width: 108px; width: 168px; font-size: 12px; padding: 4px 8px; height: 34px; }
html[dir="rtl"] .rail { right: 0; left: auto; }
html[dir="rtl"] .main { margin-inline-start: 0; }
html[dir="rtl"] .lang-panel { right: auto; left: 0; }
body.rtl { direction: rtl; }
mark.ai-span, mark.ai-typical, mark.tax-ai-typical {
  background: #f8c98a;
  color: inherit;
  box-shadow: inset 0 -3px 0 #b86a12;
  border-radius: 2px;
  padding: 0 2px;
}
ul.ai-suggest { list-style: none; padding: 0; margin: 10px 0 0; }
ul.ai-suggest li { border-top: 1px solid var(--line, #e8e1d2); padding: 8px 0; }
ul.ai-suggest .ai-apply { margin-top: 6px; }
#aiLivePaper mark { cursor: help; }
.lang-menu { position: relative; display: inline-flex; align-items: center; }
form.lang-menu { margin: 0; gap: 6px; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper, #fffdf8);
  color: inherit; font: inherit; font-size: 13px; font-weight: 650;
  cursor: pointer; max-width: 148px; white-space: nowrap;
}
.lang-btn:hover, .lang-btn[aria-expanded="true"] { border-color: var(--teal, #1a7a62); }
.lang-btn-ico { display: inline-flex; color: var(--teal-2, #1a7a62); }
.lang-btn-lab { overflow: hidden; text-overflow: ellipsis; max-width: 92px; }
.lang-panel {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 80;
  width: min(280px, 86vw); max-height: min(360px, 70vh);
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border-radius: 12px;
  background: var(--paper, #fffdf8); border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(12, 22, 18, 0.14);
}
.lang-panel[hidden] { display: none !important; }
.lang-filter { font-size: 13px; }
.lang-list { overflow-y: auto; max-height: 280px; display: flex; flex-direction: column; gap: 2px; }
.lang-opt {
  display: flex; gap: 8px; align-items: baseline; justify-content: space-between;
  padding: 7px 8px; border-radius: 8px; text-decoration: none; color: inherit; font-size: 13px;
}
.lang-opt:hover, .lang-opt.on { background: var(--teal-soft, #e7f3ee); }
.lang-opt.on { font-weight: 700; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line);
  color: inherit; text-decoration: none; background: var(--paper, #fffdf8);
}
.icon-btn:hover { border-color: var(--teal, #1a7a62); }
.note-bell { flex: 0 0 auto; }
.note-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #c24e28; color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.note-unread { background: rgba(194, 78, 40, 0.06); }
.note-menu { position: relative; flex: 0 0 auto; }
.note-panel {
  position: absolute; top: 100%; right: 0; z-index: 90;
  width: min(340px, 90vw); max-height: min(420px, 70vh);
  padding-top: 10px; /* visually offsets the panel without a hover dead-zone */
  opacity: 0; transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.note-panel.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.note-panel[hidden] { display: block !important; visibility: hidden; }
.note-panel.show[hidden] { visibility: visible; }
.note-panel {
  display: flex; flex-direction: column;
}
.note-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: 12px 12px 0 0;
  background: var(--paper, #fffdf8); border: 1px solid var(--line); border-bottom: none;
  font-size: 13px;
}
.note-panel-markread {
  border: 1px solid var(--line-2); background: transparent; border-radius: 999px;
  padding: 3px 9px; font-size: 11px; cursor: pointer; color: inherit;
}
.note-panel-markread:hover { border-color: var(--teal); color: var(--teal-2); }
.note-panel-list {
  overflow-y: auto; max-height: 300px;
  background: var(--paper, #fffdf8); border: 1px solid var(--line); border-top: none; border-bottom: none;
}
.note-panel-list .note-row {
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 12px; border-top: 1px solid var(--line);
  text-decoration: none; color: inherit; font-size: 12.5px;
}
.note-panel-list .note-row:first-child { border-top: none; }
.note-panel-list .note-row:hover { background: var(--teal-soft, #e7f3ee); }
.note-panel-list .note-row.note-unread strong::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 999px;
  background: #c24e28; margin-right: 6px; vertical-align: middle;
}
.note-empty { padding: 14px 12px; margin: 0; font-size: 12.5px; }
.note-panel-foot {
  display: block; text-align: center; padding: 9px 12px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 0 0 12px 12px;
  background: var(--paper, #fffdf8); box-shadow: 0 12px 32px rgba(12, 22, 18, 0.14);
  color: var(--teal-2); text-decoration: none;
}
.note-panel-head, .note-panel-list { box-shadow: 0 12px 32px rgba(12, 22, 18, 0.14); }
html[dir="rtl"] .note-panel { right: auto; left: 0; }
.site-nav .lang-menu { margin: 0 4px; }
.site-nav .lang-btn { height: 32px; }
html[dir="rtl"] .top-actions { flex-direction: row-reverse; }
html[dir="rtl"] .lang-panel { right: auto; left: 0; }
@media print {
  .rail, .top, .skip, .toasts, .modal, #statsForm, .verify-card, .stats-export, .no-print, .site-nav, .site-foot { display: none !important; }
  body.app-shell, .shell, .main, .content { overflow: visible !important; height: auto !important; max-height: none !important; display: block !important; }
  .stats-print { box-shadow: none; }
}


/* 1.23 — advanced module chrome (Eduzix, not a Word/Turnitin clone) */
.adv-head { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end; justify-content: space-between; margin: 0 0 16px; }
.adv-head .page-head { margin: 0; flex: 1 1 280px; max-width: none; }
.adv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.adv-nav {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.adv-nav a.chip { text-decoration: none; }
.adv-kpi { margin-bottom: 16px; }
.adv-opt { margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--white); }
.adv-opt > summary { cursor: pointer; font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--sage); }
.adv-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.adv-filter .input { max-width: 100%; }
.adv-side h3 { margin-top: 0; }
.adv-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, .8fr);
  gap: 16px;
  align-items: start;
}
.studio-write {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 240px;
  gap: 14px;
  align-items: start;
}
.studio-write .studio-main textarea.input { min-height: 56vh; }
.studio-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 10px;
}
.studio-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--sage); font-size: 12px; margin: 6px 0 10px; }
.studio-outline { font-size: 13px; }
.studio-outline a { display: block; padding: 4px 0; color: var(--ink-3); text-decoration: none; }
.studio-outline a:hover { color: var(--teal-2); }
.cov-list { list-style: none; margin: 8px 0 0; padding: 0; }
.cov-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.cov-list li:last-child { border-bottom: 0; }
.course-card h3 { margin: 0 0 4px; }
.course-card .muted { margin: 0; }
.tool-tile[hidden] { display: none !important; }
.adv-search-hit mark { background: #f6e2a8; padding: 0 1px; }
body.studio-focus .rail, body.studio-focus .top { display: none !important; }
body.studio-focus .shell { padding: 0; height: 100dvh; }
body.studio-focus .content { padding: 12px 16px 24px; }
@media (max-width: 1100px) {
  .adv-split, .studio-write { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .studio-bar {
    position: sticky;
    bottom: 72px;
    z-index: 15;
    background: rgba(255,252,247,.94);
    backdrop-filter: blur(10px);
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
  }
  .studio-write .studio-main textarea.input { min-height: 48vh; }
  .adv-head { align-items: stretch; }
}

.studio-mobile-tabs { display: none; gap: 6px; margin: 0 0 12px; flex-wrap: wrap; }
.studio-goalbar { height: 6px; margin: 0 0 10px; }
.studio-goalbar span { display: block; height: 100%; background: var(--teal, #1a7a62); border-radius: 99px; }
.adv-sens { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; }
.survey-preview { padding-left: 1.2em; }
.survey-preview li { margin: 0 0 10px; }
.compare-legend .badge { margin-right: 4px; }
.course-card { color: inherit; text-decoration: none; display: block; }
.course-card:hover { border-color: var(--teal, #1a7a62); }
@media (max-width: 1100px) {
  .studio-mobile-tabs { display: flex; }
  .studio-write .studio-drafts,
  .studio-write .studio-process { display: none; }
  .studio-write.show-drafts .studio-drafts { display: block; }
  .studio-write.show-drafts .studio-main,
  .studio-write.show-drafts .studio-process { display: none; }
  .studio-write.show-process .studio-process { display: block; }
  .studio-write.show-process .studio-main,
  .studio-write.show-process .studio-drafts { display: none; }
}
@media print {
  .studio-mobile-tabs, .studio-bar, .adv-actions, .adv-nav { display: none !important; }
}

.integrity-report { margin-top: 24px; max-width: 100%; }
.integrity-report h2 { font-family: var(--serif); font-size: 22px; margin: 22px 0 8px; }
.integrity-report h3 { font-size: 16px; margin: 14px 0 6px; }
.layer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.card.stat.risk-low .num { color: #1b7a64; }
.card.stat.risk-moderate .num { color: #b8860b; }
.card.stat.risk-high .num { color: #c24e28; }
.card.stat.risk-critical .num { color: #8b1e12; }
#detectLayers .cov-list { margin-top: 8px; }
@media print {
  .integrity-report { break-inside: avoid; }
}

.convert-drop {
  display: block;
  padding: 18px;
  border: 1.5px dashed #c9bea8;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf8, #f6f0e4);
  cursor: pointer;
  margin: 0 0 12px;
}
.convert-drop.drag { border-color: var(--teal); background: var(--teal-soft); }
.convert-drop strong { display: block; margin-bottom: 4px; }
.convert-bins .badge { margin: 0 6px 6px 0; }

/* Generated-text artifact findings: confidence must be visually ranked, so a
   punctuation nudge is never mistaken for an unambiguous invisible-character
   hit. Red/amber/grey, not a single "AI" colour. */
.artifact-block .badge-high{background:#f8d4cc;color:#6b1d0b;border-color:#e8a894}
.artifact-block .badge-medium{background:#fbeccd;color:#6b4a0b;border-color:#e8d094}
.artifact-block .badge-low{background:#eceae7;color:#5a5450;border-color:#d6d2cd}
.artifact-block .voice-hit{border-left:3px solid #d6d2cd;padding-left:12px;margin:12px 0}
.artifact-block .voice-hit code{font-size:12px;word-break:break-all}
