    /* --- Scope “Mark as found (manual)” to OVERVIEW only --- */
    /* Hide any manual-verify controls that might be injected in verification cards */
    .ref-card .manual-verify { display: none !important; }
    /* Show them in the Overview (unverified list rows) */
    #summaryReport .manual-verify { display: inline-flex !important; gap: .5rem; align-items: center; }
    /* Keep layout neat when appended to list rows/spans */
    #summaryReport .manual-verify input[type="checkbox"] { vertical-align: middle; }
    #summaryReport .manual-verify label { font-weight: 500; }
    /* Keep inline controls tight; no synthetic bullet separator. */
    #summaryReport .manual-verify::before { content: none; margin: 0; }


    :root{
      --bg:#f9f9f9; --fg:#222; --brand:#003366; --accent:#0066cc; --accent-2:#004999;
      --brand-strong:#0a4a8a;
      --muted:#5a6a85;
      --tagline-color:#1F3F4E; /* darker */
      --card:#ffffff; --border:#d9d9d9;
      --panel:#ffffff;
      --panel-soft:#f2f7ff;
      /* Pale blue ref-card styling (dyslexia-friendly) */
      --card-pale:#f6faff;        /* very light blue */
      --border-pale:#dfe8ff;      /* soft blue border */
      --header-surface:rgba(255,255,255,0.94);
      --header-border:#dbe6f3;
      --header-shadow:0 8px 24px rgba(13, 43, 73, 0.06);
      --header-control-bg:var(--panel);
      --header-control-bg-hover:var(--panel-soft);
      --header-control-border:#c7d9ed;
      --header-control-fg:var(--brand);
      --header-control-fg-strong:var(--brand-strong);
      --editor-max: 1200px;
      --mirror-gutter: 56px;
      --sidebar-w: 280px;
      --grid-gap: 24px;
      /* Split defaults */
      --paneL: 78%;   /* give the document pane more room by default */
      --split-gap: 14px;
      --sidebar-min: 320px; /* keep overview cards readable */
      --top-pill-bg:#0066cc;
      --top-pill-bg-hover:#004999;
      --top-pill-fg:#ffffff;
      --top-pill-border:transparent;
       /* Guardrail: prevent left pane shrinking so far that tabs/buttons wrap under text */
       --paneL-min: 640px;
      /* Single tuning knob for bottom spacing on the workspace page. */
      --workspace-bottom-gap: 6px;
    }
    /* Full report heading colour */
    .full-report strong{
      color: var(--accent);
    }

    /* Clickable metric cards */
    .metric.link-card{ cursor:pointer; }
    .metric.link-card:focus{ outline:2px solid var(--accent); outline-offset:2px; }
    .metric.link-card:hover .label{ text-decoration:underline; }
    /* Allow focus on anchored headings without blue outline */
    .full-report strong[tabindex="-1"]{ outline:none; }

    /* === Metrics concertina (Stage 1) — works with .sidebar .metric === */
    /* Hide icons and tighten spacing */
    .sidebar .metric .icon,
    .sidebar .metric img.icon,
    .sidebar .metric svg.icon { display: none !important; }
    .sidebar .metric { margin-bottom: 6px !important; }
    /* Helper note above list */
    /* Helper note above the metric list: styled as a subtle pill for a more professional look */
    .metric-accordion-note {
      font-size: 0.875rem;
      color: var(--brand);
      background: var(--card-pale);
      border: 1px solid var(--border-pale);
      border-radius: 8px;
      padding: 6px 8px;
      margin: 0 0 8px 0;
      user-select: none;
      cursor: pointer;
      display: inline-block;
      font-weight: 500;
    }
    .metric-accordion-note:hover{
      background: #eef5ff;
    }
    .metric-accordion-note:focus {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }
    /* Collapsed state: hide metric rows EXCEPT the always-show trio; keep the note visible */
    .sidebar.collapsed .metric:not(.always-show) { display: none; }
    .sidebar .metric-accordion-note { display: block; }

    /* Heading at the top of the sidebar summarising the section.  Styled
       similarly to other headings in the app to give clear context
       (“Reference Validity”) and separate it from the collapsible
       metrics toggle. */
    .sidebar-heading{
      font-size: 1.10rem;
      font-weight: 600;
      color: var(--brand);
      margin: 0 0 8px 0;
      line-height: 1.45;

    }

    html, body { height: 100%; }
body{
  min-height:100vh; display:grid; grid-template-rows:auto 1fr auto;
  margin:0; background:var(--bg); color:var(--fg);
  font-family: Verdana, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size:16px; line-height:1.6;
}

/*
  Workspace UI scale:
  grow the effective base size on wide viewports so controls no longer look
  under-scaled on high-resolution desktop screens.
*/
body#root.unlocked #app{
  font-size: clamp(16px, calc(0.35vw + 11px), 18px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 100%;
}
/* Workspace body uses inline grid rows, but non-app siblings can consume the
   flexible track and leave a visual gap under #app. Force #app into the fill
   row while unlocked. */
body#root.unlocked{
  grid-template-rows: auto 1fr !important;
  height: 100%;
  min-height: 100%;
  max-height: 100vh;
  overflow: hidden;
}
body#root.unlocked #gateMount{
  grid-row: 1;
}
body#root.unlocked #app{
  grid-row: 2;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
body#root.unlocked #app > .page{
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  box-sizing: border-box;
  padding-bottom: var(--workspace-bottom-gap);
  overflow: hidden;
}
body#root.unlocked #app > .page > .split{
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: 100%;
  align-items: stretch;
  overflow: hidden;
}
body#root.unlocked #app > .page > .split > .pane{
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
body#root.unlocked #app > .page > .split > .pane > .content{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
body#root.unlocked #app > .page > .split > .pane > .content > .essay-card{
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: var(--workspace-bottom-gap);
  display: flex;
  flex-direction: column;
}
body#root.unlocked #app > .page > .split > .pane > .content > .essay-card > form{
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body#root.unlocked #app > .page > .split > .pane > .content > .essay-card > form > .editor-wrap.editor-main{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}
body#root.unlocked #app > .page > .split > .pane > .content > .essay-card > form > .editor-wrap.editor-main #essay,
body#root.unlocked #app > .page > .split > .pane > .content > .essay-card > form > .editor-wrap.editor-main #previewBox{
  flex: 1 1 auto;
  min-height: 180px;
  height: auto;
  max-height: none;
}
body#root.unlocked #app > .page > .split > .pane > .content > .essay-card > form > .editor-wrap:last-of-type{
  flex: 0 0 auto;
  margin-bottom: 0;
}
body#root.unlocked > .theme-menu{
  grid-row: 1;
}
    /* Pages that render breadcrumbs directly under header need an extra auto row. */
    body.history-page{
      grid-template-rows:auto auto 1fr auto;
    }

    .logo {
      width: 198px;
      height: 64px;
      object-fit: contain;
      object-position: left center;
      display: block;
      flex: 0 0 auto;
    }
    h1 { color: var(--brand); font-size: 21px; }

    /* Main layout: split panes (essay | handle | metrics) */
    .page{
      /* Let the inner .split control the columns */
      display:block;
      /* Responsive side gutters so content grows near screen edges on larger displays */
      padding:16px clamp(6px, 0.9vw, 14px) var(--workspace-bottom-gap) clamp(10px, 1.4vw, 24px);
    }

    header{
      display:flex; align-items:center; justify-content:space-between; gap:12px;
      padding:4px 20px;
      position:relative;
      z-index:10030;
      background:var(--header-surface);
      border-bottom:1px solid var(--header-border);
      box-shadow:var(--header-shadow);
      backdrop-filter:saturate(180%) blur(10px);
    }
    .header-main{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:18px;
      width:100%;
      min-width:0;
    }
    .left-head{display:flex; align-items:center; gap:18px; min-width:0;}
    .logo-link{
      display:inline-flex;
      align-items:center;
      text-decoration:none;
      line-height:0;
    }
    /* Right side of header: style picker + info menu */
    .header-right{
      display:flex;
      flex-direction:row;
      align-items:center;
      justify-content:flex-end;
      gap:8px;
      margin-left:auto;
    }
    .desktop-nav-toggle{
      display:inline-flex;
      flex:0 0 auto;
    }
    .header-auth-link{
      display:inline-flex;
      align-items:center;
      min-height:34px;
      padding:6px 12px;
      border:1px solid var(--header-control-border);
      border-radius:999px;
      background:var(--header-control-bg);
      color:var(--header-control-fg);
      text-decoration:none;
      font-size:13px;
      font-weight:600;
      line-height:1;
    }
    .header-auth-link:hover,
    .header-auth-link:focus-visible{
      background:var(--header-control-bg-hover);
      color:var(--header-control-fg-strong);
    }
    .account-menu{
      position:relative;
    }
    .account-menu summary{
      list-style:none;
    }
    .account-menu summary::-webkit-details-marker{
      display:none;
    }
    .account-menu-trigger{
      display:inline-flex;
      align-items:center;
      gap:10px;
      min-height:38px;
      padding:4px 6px 4px 12px;
      border:1px solid var(--header-control-border);
      border-radius:999px;
      background:var(--header-control-bg);
      color:var(--header-control-fg);
      cursor:pointer;
      user-select:none;
      box-shadow:0 1px 0 rgba(11, 64, 128, 0.04);
    }
    .account-menu-trigger:hover,
    .account-menu-trigger:focus-visible{
      background:var(--header-control-bg-hover);
      color:var(--header-control-fg-strong);
    }
    .account-menu-name{
      max-width:22ch;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
      font-size:13px;
      font-weight:700;
      line-height:1.1;
    }
    .account-menu-avatar{
      display:grid;
      place-items:center;
      width:30px;
      height:30px;
      border-radius:999px;
      background:linear-gradient(135deg, #7dc0ff, #2b77c9);
      color:#07192d;
      font-size:14px;
      font-weight:800;
      flex:0 0 auto;
    }
    .account-menu-dropdown{
      position:absolute;
      top:calc(100% + 10px);
      right:0;
      min-width:220px;
      padding:10px;
      border:1px solid var(--header-control-border);
      border-radius:16px;
      background:var(--header-control-bg);
      box-shadow:0 18px 40px rgba(7, 25, 45, 0.18);
      z-index:10040;
    }
    .account-menu:not([open]) .account-menu-dropdown{
      display:none;
    }
    .account-menu-meta{
      display:grid;
      gap:4px;
      padding:6px 6px 10px;
      border-bottom:1px solid var(--header-control-border);
      margin-bottom:8px;
    }
    .account-menu-meta strong{
      color:var(--fg);
      font-size:13px;
      line-height:1.2;
    }
    .account-menu-meta span{
      color:var(--muted);
      font-size:12px;
      line-height:1.3;
      overflow-wrap:anywhere;
    }
    .account-menu-actions{
      display:flex;
      flex-direction:column;
      gap:6px;
    }
    .account-menu-link{
      display:flex;
      align-items:center;
      min-height:36px;
      padding:0 12px;
      border:1px solid var(--header-control-border);
      border-radius:12px;
      background:var(--header-control-bg-hover);
      color:var(--header-control-fg);
      text-decoration:none;
      font-size:13px;
      font-weight:700;
    }
    .account-menu-link:hover,
    .account-menu-link:focus-visible{
      background:var(--card-pale);
      color:var(--header-control-fg-strong);
    }

    .style-picker{
      margin-top:16px;
      padding-top:10px;
      border-top:1px solid var(--border);
    }

    /* Style picker placed above the document input (decluttered) */
    .style-picker-pane{
      margin-top:10px;
      padding-top:0;
      border-top:0;
      position:relative; /* keeps the dropdown anchored */
    }

    /* Single clean header row: [Search style]  Using [style] */
    .stylebar{
      display:flex;
      align-items:center;
      gap:10px;
      margin-top:10px;
      flex-wrap:wrap;
    }
    .stylebar .style-picker-pane{
      margin-top:0;
      flex:1 1 260px;
      min-width:260px;
      max-width:560px;
    }
    .workspace-context-picker{
      display:flex;
      align-items:center;
      gap:8px;
      flex:0 1 260px;
      min-width:220px;
    }
    .workspace-context-label{
      color:var(--brand);
      font-size:12px;
      font-weight:800;
      letter-spacing:.08em;
      text-transform:uppercase;
      white-space:nowrap;
    }
    .workspace-context-select{
      width:100%;
      min-height:42px;
      padding:10px 12px;
      border:1px solid var(--header-control-border);
      border-radius:14px;
      background:var(--header-control-bg);
      color:var(--header-control-fg);
      font:inherit;
      box-sizing:border-box;
      transition:border-color .18s ease, box-shadow .18s ease, background .18s ease;
    }
    .workspace-context-select:hover{
      border-color:var(--accent);
      background:var(--header-control-bg-hover);
    }
    .workspace-context-select:focus{
      outline:none;
      border-color:var(--accent);
      box-shadow:0 0 0 4px rgba(69, 145, 219, 0.18);
    }
    .stylebar #styleInput{
      width:100%;
      box-sizing:border-box; /* prevent overflow into the "Using..." text */
      max-width:none;        /* container already controls width */
    }
    .stylebar #styleStatus{
      flex:0 0 auto;
      white-space:nowrap;
      opacity:.85;
    }
    .stylebar .style-credits-chip{
      flex:0 0 auto;
      display:inline-flex;
      align-items:center;
      gap:5px;
      white-space:nowrap;
      font-size:12px;
      line-height:1.2;
      padding:5px 9px;
      font-variant-numeric:tabular-nums;
    }
    .stylebar .style-credits-chip #m-credits-needed,
    .stylebar .style-credits-chip #m-credits-available{
      font-weight:700;
    }
    .stylebar .style-credits-chip.is-hidden{
      display:none !important;
    }

    /* Keep "Using ..." visually aligned with helper/subtitle */
    .stylebar #styleStatus{
      font-size:14px;          /* match the search input text size */
      line-height:1.2;
      color:#5a6a85;
      opacity:.95;
    }

    /* push the submit button to the far right of its flex container */
    #submitBtn{ margin-left:auto; }

    /* Make the "Paste text..." line the same size as the Using... text */
    .pane-subtitle-inline{
      display:block;
      margin-top:14px;   /* clear visual separation from style selector row */
      font-size:14px;          /* match "Using..." and the search input */
      line-height:1.2;
      color:#5a6a85;
    }

    /* Style picker when placed above the document input (Option A) */
    .style-picker-pane{
      margin-top:10px;
      padding-top:0;
      border-top:0;
    }
    .style-help{
      flex-basis:100%;
      margin-top:4px;
      font-size:12.5px;
      color:#5a6a85;
      line-height:1.35;
    }

    .rc-breadcrumbs{
      width:100%;
      margin:4px 0;
      padding:0 20px 4px;
      box-sizing:border-box;
      display:flex;
      align-items:center;
      gap:8px;
      flex-wrap:wrap;
      position:relative;
    }
    .rc-breadcrumbs::after{
      content:"";
      position:absolute;
      left:0;
      right:0;
      bottom:0;
      width:auto;
      border-bottom:1px solid var(--border);
      pointer-events:none;
    }
    .rc-breadcrumbs-label{
      font-size:0.6875rem;
      font-weight:700;
      letter-spacing:.02em;
      text-transform:uppercase;
      color:#6b7d97;
    }
    .rc-breadcrumbs ol{
      margin:0;
      padding:2px 8px;
      list-style:none;
      display:flex;
      align-items:center;
      gap:6px;
      flex-wrap:wrap;
      font-size:0.75rem;
      color:#5a6a85;
      border:1px solid var(--border);
      border-radius:999px;
      background:var(--card-pale);
    }
    .rc-breadcrumbs li{
      display:inline-flex;
      align-items:center;
      gap:8px;
    }
    .rc-breadcrumbs li + li::before{
      content:"›";
      color:#8ca0bf;
      font-weight:600;
    }
    .rc-breadcrumbs a{
      color:var(--accent);
      text-decoration:none;
      font-weight:600;
    }
    .rc-breadcrumbs a:hover,
    .rc-breadcrumbs a:focus-visible{
      text-decoration:underline;
    }
    .rc-breadcrumbs [aria-current="page"]{
      color:var(--brand);
      font-weight:700;
    }


    .toggle{display:flex; align-items:center; gap:8px; font-size:14px;}

    /* Tagline (right side of header) */
    .tagline{
      color: var(--tagline-color);
      font-family: inherit;
      font-weight: 700;
      letter-spacing: .02em;
      white-space: nowrap;
      text-align: right;
      font-size: 14px;
      line-height: 1;            /* tighter line box for cleaner vertical alignment */
      position: relative;
      top: 4px;                         /* nudge a little lower */

    }
    @media (max-width: 600px){ .tagline{ display:none; } } /* optional: hide on very small screens */
    form { margin: 0 0 16px 0; }
    main form:last-of-type { margin-bottom: 0; }

    label { font-weight: bold; display: block; margin-bottom: 10px; }

textarea {
  width: 100%;
  /* Scale editor height with viewport so the workspace uses tall screens better. */
  height: clamp(220px, 56dvh, 760px);
  padding: 12px;
  font-size: 0.875rem;
  max-width: none;
  font-family: Verdana, sans-serif;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  background-color: #fff;
  color: #222;
  max-height: min(72dvh, 860px);
  overflow: auto;
  box-sizing: border-box; /* match dropzone sizing so widths align */
  /* ensure pasted Word text wraps/aligns correctly */
  text-align: left !important;
  white-space: pre-wrap;        /* preserve line breaks */
  overflow-wrap: anywhere;      /* wrap long tokens/URLs */
  word-break: break-word;       /* break very long words */
  tab-size: 2;                  /* tame tab indents */
}

    button {
      font-size: 0.9375rem; padding: 10px 18px; background-color: var(--accent); color: #fff;
      border: none; border-radius: 5px; cursor: pointer; font-family: inherit;
    }
    button:hover { background-color: var(--accent-2); }

    /* Custom heading for the essay pane */
    .pane-title{
      font-size: 20px;
      font-weight: 600;
      color: var(--brand);
      margin: 0 0 12px 0;
    }
/* Title + helper + New document button alignment */
.pane-title-wrap{
  display: flex;
  align-items: flex-start;  /* keep button aligned with top line (Document) */
  gap: 12px;
}

.pane-title-text{
  display: flex;
  flex-direction: column;
}

.pane-title{
  line-height: 1.2;
}

.pane-title-row .new-doc-inline{
  margin-left:auto;     /* pushes it right, but only within the title row */
  opacity:.9;           /* makes it feel non-primary */
}
.pane-subtitle{
  opacity: 0.75;
  font-weight: 400;
  font-size: 0.85em;
  margin-top: 0px;
}

    /* Container for the essay editor, heading and tabs. This wraps the
       entire left pane content to provide a white card with a border
       similar to the original design where the "Essay" heading and
       navigation pills sit inside the same box. */
    .essay-card{
      /* Use the pale card colour for the essay container instead of plain white
         to better integrate with the overall theme.  A soft blue tint
         provides a subtle contrast against the page background without
         overwhelming the content.  The border is softened as well. */
      background: var(--card-pale);
      border: 1px solid var(--border-pale);
      border-radius: 12px;
      padding: 18px 20px;
      margin-bottom: 20px;
    }
    /* Header row for the essay card: holds the title and optional tabs. */
    .essay-card-header{
      display: flex;
      align-items: center;
      /* We don't space items evenly; the header actions will be pushed to the right via margin-left:auto on its container */
      gap: 8px;
      margin-bottom: 12px;
    }
    /* Wrapper for tabs and the New essay button inside the header */
    .essay-card-header .header-actions{
      margin-left: auto;
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    /* Remove extra margin on the tabs when they live in the card header */
    .essay-card-header .tabs,
    .essay-card-header .header-actions .tabs{
      margin-top: 0;
    }
    /* Placeholder for header New essay button styling (see #newEssayBtn for actual styles) */

    /* --- Sidebar tabs display --- */
    /* Container for moved reference validity/overview sections on the right side */
    .sidebar .tab-container{
      margin-top: 16px;
    }
    /* Flatten tab contents inside the sidebar (no borders or backgrounds) */
    .sidebar .tab-content{
      border: none;
      border-radius: 0;
      padding: 0;
      background: transparent;
    }

    /* Restyle the tab buttons to sit visually within the card */
    .tabs{
      display:flex;
      align-items:center;
      gap:8px;
      margin-top:16px;
    }
    .tab-button{
      padding:8px 16px;
      background-color:#e9f1ff;
      border:none;
      border-radius:8px;
      cursor:pointer;
      font-weight:bold;
      color:var(--brand);
      transition: background-color .2s ease, color .2s ease;
    }
    .tab-button:hover{
      background-color:var(--accent-2);
      color:#fff;
    }
    .tab-button.active{
      background-color:var(--accent);
      color:#fff;
    }
    .tab-content{
      display:none;
    }
    .tab-content.active{
      display:block;
    }

    /* Make New essay match the tab buttons */
/* New document (title continuation): MUST match the title exactly */

.pane-title-row{
  display:flex;
  align-items:baseline;
  gap:10px;
  margin-bottom: 14px;   /* creates space before style selector */
}

.pane-title-row .pane-title{ margin:0; }

.pane-title-row #newEssayBtn{
  display:inline;
  vertical-align:baseline;
  background:transparent;
  border:0;
  padding:0;
  margin:0;
  cursor:pointer;

  /* exact match with .pane-title */
  font-size:20px;
  font-weight:600;
  color:var(--brand);
  line-height:1.2;
  font-family:inherit;
  white-space:nowrap;
}

.pane-title-row #newEssayBtn span{
  opacity:1;                 /* ensure it doesn't look 'muted' */
  padding:1px 4px;
  border-radius:6px;
  transition: background-color .15s ease;
}
.pane-title-row #newEssayBtn:hover span,
.pane-title-row #newEssayBtn:focus-visible span{
  background:#d0e7ff;
}
.pane-title-row #newEssayBtn:focus-visible{
  outline:3px solid var(--accent);
  outline-offset:2px;
}

    /* === Reusable expander icon pattern (default site-wide) === */
    :where(
      .rc-expander,
      .sidebar #tab4 .ov-card-details,
      .sidebar #tab4 .order-issue-collapse,
      #tab3 .workspace-validity-group-card,
      .history-drawer,
      .report-page .report-validity-group-card,
      .report-page .report-drawer,
      .order-issue-details,
      details.audit,
      details.foldable,
      .showme-details
    ) > summary{
      list-style:none;
      cursor:pointer;
      display:flex;
      align-items:center;
      gap:6px;
    }
    :where(
      .rc-expander,
      .sidebar #tab4 .ov-card-details,
      .sidebar #tab4 .order-issue-collapse,
      #tab3 .workspace-validity-group-card,
      .history-drawer,
      .report-page .report-validity-group-card,
      .report-page .report-drawer,
      .order-issue-details,
      details.audit,
      details.foldable,
      .showme-details
    ) > summary::-webkit-details-marker{
      display:none;
    }
    :where(
      .rc-expander,
      .sidebar #tab4 .ov-card-details,
      .sidebar #tab4 .order-issue-collapse,
      #tab3 .workspace-validity-group-card,
      .history-drawer,
      .report-page .report-validity-group-card,
      .report-page .report-drawer,
      .order-issue-details,
      details.audit,
      details.foldable,
      .showme-details
    ) > summary::before,
    .rc-expander-summary::before,
    .rc-expander-button::before{
      content:"▸";
      display:inline-block;
      flex:0 0 auto;
      color:var(--accent);
      font-size:1rem;
      line-height:1;
      width:1rem;
      text-align:center;
      transform:scale(1.32);
      transform-origin:center;
    }
    :where(
      .rc-expander,
      .sidebar #tab4 .ov-card-details,
      .sidebar #tab4 .order-issue-collapse,
      #tab3 .workspace-validity-group-card,
      .history-drawer,
      .report-page .report-validity-group-card,
      .report-page .report-drawer,
      .order-issue-details,
      details.audit,
      details.foldable,
      .showme-details
    )[open] > summary::before,
    details[open] > .rc-expander-summary::before,
    .rc-expander-button[aria-expanded="true"]::before{
      content:"▾";
    }
    .rc-expander-button{
      display:inline-flex;
      align-items:center;
      gap:6px;
    }
    /* Keep button-based expanders compact even when global detail chevrons are large. */
    .rc-expander-button::before{
      width:1rem;
      flex:0 0 1rem;
      transform:scale(1.32) translateY(0.02em);
      transform-origin:center;
    }

    /* Overview heading + first-line spacing */
    .overview-heading{
      color: #003366;
      font-weight: 600;
      font-size: 1.10rem;
      line-height: 1.45;
    }

    /* === Overview section cards (improves scanability) === */
    #summaryReport .ov-section-card{
      background: #f5f9ff;
      border: 1px solid var(--border-pale);
      border-radius: 14px;
      padding: 12px 14px;
      margin: 0 0 14px;
    }
    #summaryReport .ov-card-head{
      display:flex;
      align-items:flex-start;
      justify-content:space-between;
      gap:10px;
      margin:0 0 8px;
    }
    #summaryReport .ov-card-head strong,
    #summaryReport .ov-card-head h3,
    #summaryReport .ov-card-head h4{
      margin:0;
      flex:1 1 auto;
      min-width:0;
      word-break:normal;
      overflow-wrap:break-word;
    }
    .sidebar #tab4 .ov-card-details,
    .sidebar #tab4 .order-issue-collapse{
      margin:0;
    }
    .sidebar #tab4 .ov-card-details > summary,
    .sidebar #tab4 .order-issue-collapse > summary{
      margin:0;
    }
    .sidebar #tab4 .ov-card-details > summary .ov-card-head,
    .sidebar #tab4 .order-issue-collapse > summary .order-issue-card-head{
      margin:0;
      display:flex;
      flex:1 1 auto;
      min-width:0;
    }
    .sidebar #tab4 .ov-card-details[open] > .ov-card-body,
    .sidebar #tab4 .order-issue-collapse[open] > .order-issue-collapse-body{
      padding-top:8px;
    }
    .order-issue-card{
      background: #f5f9ff;
      border: 1px solid var(--border-pale);
      border-radius: 14px;
      padding: 12px 14px;
      margin: 0 0 14px;
      color: #223;
    }
    .order-issue-card strong{
      display: block;
      margin-top: 0;
    }
    /* Keep A-Z title spacing/size aligned with other top-level overview cards */
    .sidebar #tab4 .order-issue-card .overview-heading{
      font-size: inherit;
      line-height: 1.35;
      font-weight: 700;
      color: inherit;
    }
    .order-issue-card-head{
      display:flex;
      align-items:flex-start;
      justify-content:space-between;
      gap:12px;
      margin-bottom:8px;
    }
    .status-tag{
      display:inline-flex;
      align-items:center;
      border-radius:999px;
      padding:2px 9px;
      font-size:.75rem;
      font-weight:700;
      letter-spacing:.02em;
      white-space:nowrap;
    }
    .status-tag--warn{
      border:1px solid #f0b5b5;
      background:#6d2323;
      color:#ffdede !important;
    }
    .status-tag--caution{
      border:1px solid #e2b95e;
      background:#fff0c8;
      color:#6a4c00 !important;
    }
    .status-tag--ok{
      border:1px solid #9fcca9;
      background:#1f5f2c;
      color:#deffe5 !important;
    }
    .status-tag--neutral{
      border:1px solid #8fb3da;
      background:#d9e9fb;
      color:#0f467c !important;
    }
    .order-issue-summary{
      margin:0 0 10px;
      font-weight:600;
      color:#1f3652;
    }
    .order-issue-stats{
      display:grid;
      grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
      gap:8px;
      margin:0 0 10px;
    }
    .order-issue-stat{
      border:1px solid #bfd3f5;
      background:#e2edff;
      border-radius:10px;
      padding:8px 10px;
    }
    .order-issue-stat .k{
      font-size:.76rem;
      font-weight:600;
      color:#355777;
      margin-bottom:2px;
    }
    .order-issue-stat .v{
      font-size:1rem;
      font-weight:700;
      color:#143150;
      font-variant-numeric:tabular-nums;
    }
    .order-issue-stat .d{
      margin-top:4px;
      font-size:.76rem;
      line-height:1.35;
      color:#466587;
    }
    .order-issue-details{
      margin:0;
    }
    .order-issue-details > summary{
      cursor:pointer;
      color:var(--accent);
      font-weight:600;
    }
    .order-issue-details > div{
      margin-top:6px;
      color:#314a66;
    }
    .order-jump-block{
      margin-top:10px;
      padding:10px 11px;
      border:1px solid #bfd3f5;
      border-radius:10px;
      background:#e2edff;
    }
    .order-jump-block .k{
      margin:0 0 6px;
      font-size:.8rem;
      font-weight:600;
      color:#355777;
    }
    .order-jump-list{
      margin:0;
      padding:0;
      list-style:none;
      display:grid;
      gap:6px;
    }
    .order-jump-item{
      margin:0;
    }
    .order-jump-btn{
      width:100%;
      text-align:left;
      background:#f5f9ff;
      border:1px solid #9ac4ff;
      color:#1b3f63;
      border-radius:8px;
      padding:6px 9px;
      cursor:pointer;
      font-size:.82rem;
      line-height:1.35;
    }
    .order-jump-btn:hover,
    .order-jump-btn:focus-visible{
      background:#dceaff;
      border-color:#6aa4d9;
      outline:none;
    }
    /* Layering: nested cards/panels inside Overview cards are intentionally darker */
    #summaryReport .ov-section-card .ref-card,
    #summaryReport .ov-section-card details.audit[open]{
      background:#e2edff;
      border-color:#bfd3f5;
    }
    #summaryReport .ov-section-card .ov-subnote{
      background:#e2edff;
    }
    /* Keep headings tight at top of the card */
    #summaryReport .ov-section-card strong,
    #summaryReport .ov-section-card h3,
    #summaryReport .ov-section-card h4{
      display: block;
      margin-top: 0;
    }
    /* Slightly separate the note from the heading */
    #summaryReport .ov-section-card .ov-subnote{
      margin-top: 2px;
    }

    .overview-label{ display:block; margin:0; }
    #summaryReport{ margin-top:0; }
    #summaryReport > *:first-child{ margin-top:0 !important; }

    /* Safety: if a .ref-card ever gets nested inside another by mistake, hide inner borders/padding */
    .ref-card .ref-card{ border:0; padding:0; margin:0; }

    /* Per-reference feedback spacing */
    .ref-risk{ margin-top:4px; margin-bottom:0; }
    .hallucination-alert{ margin-top:4px; margin-bottom:0; }
    /* Keep conflict tight to the alert above it */
    .ref-card .conflict{ margin-top:4px; margin-bottom:0; }
    /* Always give a clear, single gap before the details disclosure */
    .ref-card details.audit{ margin-top:10px; }

    /* Reference validity cards */
    #tab3 .workspace-validity-group-card{
      border:1px solid var(--border-pale);
      border-radius:12px;
      background:#f5f9ff;
      margin:10px 0 14px;
    }
    #tab3 .workspace-validity-group-title{
      padding:10px 12px;
      font-weight:700;
      color:var(--brand);
    }
    #tab3 .workspace-validity-group-body{
      padding:0 10px 10px;
    }
    #tab3 .workspace-validity-group-body > .ref-card{
      margin:0 0 10px;
    }
    #tab3 .workspace-validity-group-body > .ref-card:last-child{
      margin-bottom:0;
    }

    .ref-card{
      border:1px solid var(--border-pale);
      background:var(--card-pale);
      border-radius:10px; padding:10px 12px; margin:10px 0;
      min-width: 0;
    }

    .ref-header{
      font-weight:600;
      margin-bottom:6px;
      overflow-wrap:anywhere;
      word-break:break-word;
      hyphens:auto;
    }
    .ref-status-line{
      display:flex;
      align-items:flex-start;
      flex-wrap:nowrap;
      gap:6px;
    }
    .ref-status-line .status{
      flex:0 0 auto;
      margin-right:0;
      line-height:1.4;
    }
    .ref-status-text{
      flex:1 1 auto;
      min-width:0;
      line-height:1.55;
    }
    .publication-status-badge{
      margin-left:auto;
      max-width:100%;
    }
    .publication-status-note{
      margin:10px 0 8px;
      padding:10px 12px;
      border-radius:12px;
      border:1px solid #d8c29b;
      background:#fff8ec;
    }
    .publication-status-note-head{
      margin-bottom:6px;
    }
    .publication-status-note-body{
      color:#4a3a1d;
      line-height:1.55;
    }
    .ref-inline-warning{
      color:#8a6116;
      font-weight:600;
    }
    .ref-card,
    .ref-card .ai-risk-body,
    .ref-card .ai-risk-note,
    .ref-card .ref-usage,
    .ref-card details.audit,
    .ref-card details.audit > *:not(summary){
      overflow-wrap:anywhere;
      word-break:break-word;
      hyphens:auto;
    }
    /* Safety: if a .ref-card ever nests inside another, flatten the inner box */
    .ref-card .ref-card{ border:0; background:transparent; padding:0; margin:0; }

    /* Audit disclosure + conflict strip */
    details.audit{ margin: 2px 0 6px; }
    details.audit > summary{ cursor:pointer; color: var(--accent); }

    /* --- Show more: match Show me (full filled panel, not just text) --- */
    details.audit[open]{
      background:#e9f1ff;                 /* same as .showme-example-box */
      border:1px solid var(--border);
      border-radius:12px;
      padding:8px 10px;
    }

    /* Keep the summary readable and aligned within the filled panel */
    details.audit[open] > summary{
      margin:0 0 6px 0;
    }

    /* Ensure the expanded content inherits the panel fill (no inner “striping”) */
    details.audit[open] > *:not(summary){
      background: transparent !important;
      padding: 0;
      font-size: 0.95rem;
      line-height: 1.5;
    }

    .doi-helper-line{
      display:flex;
      flex-wrap:wrap;
      align-items:flex-start;
      gap:10px 12px;
      margin-top:6px;
    }
    .audit-link{
      display:inline-flex;
      align-items:center;
      gap:6px;
      font-weight:600;
      text-decoration:none;
      transition:background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
    }
    .audit-link:focus-visible{
      outline:2px solid var(--accent);
      outline-offset:2px;
    }
    .audit-link--title-search{
      padding:6px 10px;
      border:1px solid color-mix(in srgb, var(--border-pale) 72%, var(--accent) 28%);
      border-radius:999px;
      background:color-mix(in srgb, var(--card-pale) 88%, var(--accent) 12%);
      color:color-mix(in srgb, var(--fg) 28%, var(--accent) 72%);
      box-shadow:0 1px 0 color-mix(in srgb, var(--card) 72%, transparent) inset;
    }
    .audit-link--title-search::after{
      content:"↗";
      font-size:.9em;
      line-height:1;
    }
    .audit-link--title-search:hover{
      background:color-mix(in srgb, var(--card-pale) 78%, var(--accent) 22%);
      border-color:color-mix(in srgb, var(--border-pale) 44%, var(--accent) 56%);
      color:color-mix(in srgb, var(--fg) 16%, var(--accent) 84%);
      transform:translateY(-1px);
    }
    .audit-link--title-search:active{
      transform:translateY(0);
      box-shadow:none;
    }
    :root[data-theme="dark"] .audit-link--title-search{
      background:color-mix(in srgb, var(--card-pale) 80%, var(--accent) 20%);
      border-color:color-mix(in srgb, var(--border-pale) 62%, var(--accent) 38%);
      color:#e6f3ff;
      box-shadow:0 1px 0 rgba(255,255,255,.06) inset;
    }
    :root[data-theme="dark"] .audit-link--title-search:hover{
      background:color-mix(in srgb, var(--card-pale) 68%, var(--accent) 32%);
      border-color:color-mix(in srgb, var(--border-pale) 38%, var(--accent) 62%);
      color:#f4f9ff;
    }

        /* --- AI risk: render in the SAME filled panel style as "Show more" --- */
    .ai-risk-panel{
      background:#e9f1ff;
      border:1px solid var(--border);
      border-radius:12px;
      padding:8px 10px;
      margin-top:10px; /* clear gap after details/conflict */
    }
    .ai-risk-title{
      font-weight:600;
      margin:0 0 4px 0;
    }
    .ai-risk-body{
      margin:0;
      font-size:0.95rem;
      line-height:1.5;
      color:#222;
    }

    .conflict+br{ display:none; }
    .conflict+br+details.audit{ margin-top:0; }
    .conflict{
      margin:4px 0 0; padding:6px 8px;
      background:#fff7e6; border-left:4px solid #faad14; font-size:14px;
    }

    /* Confidence badge + alert */
    .score-badge{
      display:inline-block; margin:6px 0 0; padding:4px 8px; border-radius:999px; font-size:12px; font-weight:600;
      border:1px solid var(--border); background:#f6f8fa; color:#223;
    }
    .badge-verified{ background:#e6f7e6; border-color:#b7e3b7; }
    .badge-likely{ background:#eef5ff; border-color:#c8dbff; }
    .badge-uncertain{ background:#fff7e6; border-color:#fae0a6; }
    .badge-suspected{ background:#ffecec; border-color:#ffbcbc; }

    .hallucination-alert{ margin:4px 0 0; padding:6px 8px; background:#fff2f0; border-left:4px solid #ff4d4f; font-size:14px; }
  
    .ai-risk-note{
      margin:6px 0 12px; padding:8px 10px; background:#f7f9ff; border-left:4px solid var(--accent);
      font-size:14px; line-height:1.5; color:#222;

    }
    /* Ensure all Overview sub-notes use the same font size as the AI note */
    .ov-subnote{
      display:block;
      margin:6px 0 12px;
      padding:8px 10px;
      font-size:14px;
      line-height:1.5;
      background:#f7f9ff;           /* same background as .ai-risk-note */
      border-left:4px solid var(--accent);
      color:#555;                   /* match the muted grey tone */
    }
    /* --- Hard unify both notes so they render IDENTICALLY everywhere --- */
    :root { --note-size: 14px; }
    .ai-risk-note, .ov-subnote{
      font-size: var(--note-size) !important;
      line-height: 1.5 !important;
      font-family: inherit !important;
      letter-spacing: normal !important;
    }
    details.foldable{ margin:6px 0 12px; border:1px solid var(--border); background:#fff; border-radius:8px; }
    details.foldable > summary{ padding:8px 12px; cursor:pointer; font-weight:bold; }
    details.foldable[open] > summary{ border-bottom:1px solid var(--border); }
    details.foldable .fold-content{ padding:8px 12px; }
    /* High-contrast focus ring */
    a:focus, button:focus, summary:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
    .hallucination-alert+br+.conflict{ margin-top:0; }

    /* Status icons */
    .status{ display:inline-block; font-weight:700; margin-right:6px; }
    .status.ok{ color:#1a7f37; }
    .status.bad{ color:#d32f2f; }

    /* Out-of-order reference highlight (preview) */
    .ref-order-bad{
      color:#b71c1c;
      background:#ffe8e8;
      padding: 0 2px;
      border-radius: 3px;
    }
    .ref-order-bad.flash-jump{
      outline: 3px solid var(--accent);
      outline-offset: 2px;
    }
    /* Loading rotator: fade in/out */
    #loadingMessage{
      opacity: 0;
      transition: opacity 0.5s ease;
    }
    #loadingMessage.loading-visible{
      opacity: 1;
    }

    /* Align the loading rotator message to the left and ensure it takes full width of the card */
    #loadingMessage{
      text-align: left;
      display: block;
      margin-left: 0;
    }

    /* Footer kept tight so entire page fits on first view */
    footer { margin: 8px 28px 8px; font-size: 11px; text-align: center; color: #555; }
    .license-link { display:inline-block; margin-top:2px; font-size:11px; cursor:pointer; color:var(--accent); }
    .license-link:hover { text-decoration: underline; }
    .modal:not(dialog) { display:none; position:fixed; z-index:10; left:0; top:0; width:100%; height:100%; overflow:auto; background-color:rgba(0,0,0,0.5); }

    .modal-content { background:#fff; margin:5% auto; padding:20px; border-radius:6px; width:90%; max-width:800px; }
    .close { float:right; font-size:24px; cursor:pointer; }

    /* Read-only preview */
    .essay-preview{
      white-space: pre-wrap; border:1px solid #ccc; border-radius:8px; background:#fff;
      padding:14px; font-size:15px; line-height:1.7; color:#222; max-width:none;
      max-height: min(72dvh, 860px); overflow:auto;
      overflow-wrap:anywhere;
      word-break:break-word;
    }

    /* Full report container */
    .full-report{

      white-space: pre-wrap;
      overflow-wrap:anywhere;
      word-break:break-word;
      /* Remove inner box; let the tab provide the box */
      border: 0; border-radius: 0; background: transparent; padding: 0;
      font-size: 15px; line-height:1.7; color: #222;
      /* Single scrollbar: let the page handle scrolling */
      max-height: none; overflow: visible;
    }

    .essay-preview a,
    .full-report a{
      overflow-wrap:anywhere;
      word-break:break-word;
    }

    /* Headings in the Overview: no extra top/bottom margin;
       spacing comes solely from the section divider */

    .full-report strong{ display:block; margin:0; }
    .full-report .section-divider{
      margin: 1.7em 0;  /* one line above & below */
    }

    /* (Relaxed) style for the Citations-missing note anywhere under the overview */
    #overview .ov-subnote{
      /* spacing already set above; keep it consistent here */
    }    /* Drag & drop */

    .dropzone{
      border:2px dashed var(--border);
      border-radius:4px;  /* match textarea rounding exactly */
      padding:12px;       /* match textarea padding */
      background:#f0f6ff; /* always-visible blue so it stands out */
      display:flex; align-items:center; justify-content:center; gap:8px;
      font-size:1rem; font-family:inherit; color:var(--fg);
      width:100%;
      max-width:none;     /* ensure no unintended max-width */
      box-sizing:border-box; /* consistent with textarea now */
      /* Make the upload target taller and easier to hit */
      min-height: 108px;
      transition: background 0.2s ease, border-color 0.2s ease;
    }

    .dropzone.dragover,
    .dropzone:hover {
      background:#dde9ff;          /* different blue on interaction */
      border-color:var(--accent);  /* reinforce the active state */
      cursor:pointer;
    }

    /* Visually hide file input but keep it interactable via label/programmatic click */
    .uploader{
      position:absolute; left:-9999px; width:1px; height:1px; opacity:0;
    }

    .import-summary{ font-size:12px; color:#555; margin-top:6px;}

    .dropzone button.secondary {
      margin-left: 12px;
    }

    /* Accessibility: keyboard focus */
    .dropzone:focus-visible,
    .dropzone button.secondary:focus-visible {
      outline: 3px solid var(--accent);
      outline-offset: 2px;
    }

    /* While resizing: prevent text selection + keep cursor consistent */
    .rc-resizing,
    .rc-resizing * {
      cursor: col-resize !important;
      user-select: none !important;
    }


    /* Editor container + live overlay */
    .editor-wrap{ position:relative; width:100%; }

    .editor-wrap { margin-bottom: 16px; }
    .editor-wrap .essay-preview,
    .editor-wrap textarea { margin-bottom: 0; }

    .editor-wrap textarea{ background:#fff; position:static; z-index:auto; margin-top:0; }
    #liveHighlight, .editor-wrap .essay-preview.live{ display:none !important; }
    #previewBox:empty{ display:none !important; }

    /* Sidebar metric cards */

    /* Split handle + explicit grid placement (inside .split) */
    .split > .pane{ grid-column: 1; }     /* essay on the left */
    .split > .resizer{ grid-column: 2; }  /* draggable handle */
    .split > .sidebar{ grid-column: 3; }  /* metrics on the right */
    .resizer{
      position: relative;           /* needed for absolute arrow markers */
      background: #c8d6f0;
      cursor: col-resize;
      min-width: 4px;
      width: 4px;
      height: 100%;
      border: none;
      user-select: none;
      touch-action: none;
    }

/* Common arrow styling */
.resizer::before,
.resizer::after{
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  opacity: 0.85;
  pointer-events: none;         /* don’t interfere with dragging */
}

/* Left-pointing triangle */
.resizer::before{
  left: -8px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid #003366;   /* brand blue */
}

/* Right-pointing triangle */
.resizer::after{
  right: -8px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid #003366;
}


    .sidebar{
      position: sticky;
      top: 8px;
      align-self: start;
      justify-self: stretch;       /* use the full width of the right grid column */
      width: 100%;
      min-width: var(--sidebar-min);
      padding-right: 28px;         /* align with header’s right padding under the tagline */
      max-height: calc(100vh - 24px);
      padding-bottom: 24px;        /* space after last card */
      overflow: auto;
      overscroll-behavior: contain; /* prevent scroll from bubbling to page/essay */
      -webkit-overflow-scrolling: touch; /* smooth touch scroll on iOS */
      scroll-padding-bottom: 24px; /* ensure smooth-scroll targets don’t clip */
      scrollbar-width: none;       /* keep scrollbar hidden (Firefox) */
      -ms-overflow-style: none;    /* keep scrollbar hidden (Edge/IE) */
    }

    .sidebar::-webkit-scrollbar{ width:0; height:0; }
    .metric{
      background:var(--card); border:1px solid var(--border); border-radius:12px;
      padding:8px 11px; display:grid; grid-template-columns:1fr auto; gap:8px;
      align-items:center; margin-bottom:8px;

    }
    /* Workspace-only spacing from the splitter edge */
    #split > .sidebar{
      padding-left: 0;
      padding-right: 8px;
      box-sizing: border-box;
      min-width: var(--sidebar-min);
    }

    .metric .icon{ width:24px; height:24px; display:inline-block; }
    .metric .label{
      font-size:0.8125rem; color:#444;
      white-space: nowrap;  /* stay on one line */
    }
    .metric .value{
      font-weight:700;
      color:var(--brand);
      text-align:right;
      font-variant-numeric:tabular-nums;
      min-width:2ch;
      font-size:0.875rem;
      justify-self:end;
    }
    .rc-value-chip{
      display:inline-flex;
      align-items:center;
      justify-content:center;
      min-width:3ch;
      padding:2px 9px;
      border-radius:999px;
      border:1px solid #8fb3da;
      background:#d9e9fb;
      color:#0f467c;
      line-height:1.25;
      white-space:nowrap;
    }
    .rc-value-chip--ok{
      background:#d7f3df;
      border-color:#4caf66;
      color:#0f4f24;
    }
    .rc-value-chip--warn{
      background:#fbdada;
      border-color:#d97373;
      color:#7a1717;
    }
    .rc-value-chip--neutral{
      background:#d9e9fb;
      border-color:#8fb3da;
      color:#0f467c;
    }
    .rc-value-chip--caution{
      background:#fff0c8;
      border-color:#e2b95e;
      color:#6a4c00;
    }
    .metric .note{ font-size:12px; color:#666; justify-self:end; }
    /* Disable sticky on small screens to avoid clipping in single-column layout */
    @media (max-width: 900px){
      .sidebar{
        position: static; max-height:none; padding-bottom:16px;
      }
    }


    .visually-hidden {
      position: absolute !important;
      height:1px; width:1px; overflow:hidden; clip:rect(1px, 1px, 1px, 1px);
      white-space:nowrap; border:0; padding:0; margin:-1px;
    }

    /* Dyslexia-friendly type */
    .dyslexia body, .dyslexia .essay-preview, .dyslexia textarea{ font-family:"Lexend", Verdana, system-ui, Arial, sans-serif; letter-spacing:0.02em; }
    .dyslexia .essay-preview{ font-size:16px; line-height:1.8; }
    .dyslexia textarea{ font-size:15px; line-height:1.8; }

    /* Buttons */
    /*
      Arrange the Reset and Check References buttons so that the submit
      button floats all the way to the right of the card.  Assign a
      100% width to the row so it occupies the full horizontal space
      available and allow the submit button to consume any remaining
      flex space via an auto margin.  This ensures the buttons are
      separated cleanly even as the form resizes.
    */
.btn-row{
  display:flex;
  align-items:stretch;
  gap:8px;
  flex-wrap:wrap;
  width:100%;
  margin:8px 0 0;
}

.btn-row > button,
.tabs .tab-button{
  min-height:42px;
  border-radius:10px;
  font-size:0.9375rem;
  font-weight:700;
  line-height:1.2;
  padding:10px 14px;
}

#clearBtn{
  border:1px solid #9ac4ff;
  background:#e9f1ff;
  color:var(--brand);
}
#clearBtn:hover,
#clearBtn:focus-visible{
  background:#d0e7ff;
  color:var(--accent-2);
}

#submitBtn{
  flex:1 1 auto;
  border:1px solid transparent;
}

    /*
      So-called horizontal rules (hr) appear in a few places within the
      reference validity/overview section as Markdown separators.  Without
      styling, the default browser rule draws a heavy border that can
      look jarring when the user collapses or expands the sidebar.  Tame
      these lines by removing the default border and replacing it with a
      subtle single pixel divider using the global border colour.  The
      generous vertical margin creates breathing space around the
      separator so it feels intentional rather than accidental.
    */
    hr{
      border:none;
      border-top:1px solid var(--border);
      margin:12px 0;
    }

    /* Mini action buttons used in Overview (e.g., “Manual search”, “Open link”) */
    .btn{
      display:inline-block; padding:3px 10px; border-radius:6px;
      text-decoration:none; font-size:12px; line-height:1.2;
      transition: background-color .15s ease, box-shadow .15s ease, transform .05s ease;
    }
    /* Disabled buttons (prevents duplicate submissions while a job is running) */
    button:disabled,
    .btn:disabled{
      cursor: not-allowed;
      opacity: .6;
    }
    /* Manual search — pale blue background, brand-blue border/text */
    .btn-manual{
      color:#0f5f8c; border:1px solid #0f5f8c; background:#d0e7ff;
      margin-right:8px;
    }
    /* Show-me helper button uses same look, but different class to avoid manual-verify injection */
    .btn-help{
      color:#0f5f8c; border:1px solid #0f5f8c; background:#d0e7ff;
      margin-right:8px;
    }
    /* Open link — neutral look */
    .btn-open{
      color:#555; border:1px solid #bbb; background:#fff;
    }
    /* Hover feedback (mouse) */
    .btn:hover{
      box-shadow:0 1px 4px rgba(0,0,0,.08);
      transform: translateY(-1px);
    }
    /* Keyboard/touch accessibility ring */
    .btn:focus-visible{
      outline:3px solid #9AD0FF;
      outline-offset:2px;
    }
    /* Pressed state */
    .btn:active{
      transform: translateY(0); box-shadow:none;
    }
    .inline-message{
      display:block;
      margin: 12px 0;
      padding: 10px 12px;
      background:#fff8e5;           /* subtle amber */
      border:1px solid #f0d48a;
      border-radius: 10px;
      font-size: 0.95rem;
    }

    /* Inline metrics row injected by workspace.js under the main header */
    .inline-metrics{
      display:grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap:8px;
      margin: 8px 0 12px;
    }
    .inline-metric{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
      padding:8px 10px;
      border-radius:10px;
      border:1px solid var(--border-pale);
      background:var(--card-pale);
      min-height:38px;
    }
    .inline-metric .label{
      font-size:13px;
      color:#2f4f6f;
      font-weight:600;
      white-space:nowrap;
    }
    .inline-metric .value{
      font-size:13px;
      font-weight:700;
      color:var(--brand);
      font-variant-numeric:tabular-nums;
      white-space:nowrap;
    }
    .inline-metric.metric-green{
      background:#e8f7ed;
      border-color:#b7e3c4;
    }
    .inline-metric.metric-amber{
      background:#fff7e6;
      border-color:#f1d6a8;
    }
    .inline-metric.metric-red{
      background:#ffecec;
      border-color:#f4b8b8;
    }
    @media (max-width: 900px){
      .inline-metrics{
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }
    @media (max-width: 560px){
      .inline-metrics{
        grid-template-columns: 1fr;
      }
    }

    button.secondary{ background:#e6e6e6; color:#222; }
    button.secondary:hover{ background:#d6d6d6; }
    /* Confirm action button in dialog */
    .danger{
      background:#d32f2f; color:#fff;
      border:none; border-radius:6px; padding:8px 14px; font-weight:600;
    }
    .danger:hover{ background:#b71c1c; }
    .content{ padding-right: 0; }
    @media (max-width: 1200px){ .content{ padding-right: 0; } }
    /* === Split panes: essay (left) + metrics (right) === */
    .split{
      display:grid;
      /* Keep the sidebar usable: never let it collapse below 300px */
      grid-template-columns: var(--paneL) var(--split-gap) minmax(var(--sidebar-min), 1fr);
      gap: clamp(12px, 1.1vw, 20px);
      align-items:start;
    }
    /* no extra right padding inside essay pane */
    .split > .pane{ padding-right: 0; }
    .pane{ min-width: 0; } /* allow shrinking without overflow */

    /* Responsive: stack on small screens */
    @media (max-width: 900px){
      .page{ grid-template-columns: 1fr; }
      .split{
        grid-template-columns: 1fr;
        gap: 12px;
      }
      .split > .pane,
      .split > .sidebar,
      .split > .resizer{
        grid-column: 1;
      }
      .resizer{ display:none; }
      .btn-row{ transform:none; }
    }

    /*
      Keep workspace viewport-bounded only on shorter desktop viewports.
      On tall/high-resolution displays this rigid 100dvh lock makes the UI look
      under-scaled and leaves excessive empty space, so allow natural document
      flow there.
    */
    @media (min-width: 901px) and (max-height: 950px){
      /* Workspace page: let #app own the full viewport, not body grid rows. */
      body#root.unlocked{
        display:block;
        height:100dvh;
        min-height:100dvh;
        overflow:hidden;
      }
      body#root.unlocked #app{
        height:100dvh;
        max-height:none;
        min-height:0;
        overflow:hidden;
        display:grid;
        grid-template-rows:auto auto 1fr;
      }
      body#root.unlocked .page{
        height:100%;
        min-height:0;
        overflow:hidden;
        padding-bottom:var(--workspace-bottom-gap);
        display:flex;
        flex-direction:column;
      }
      body#root.unlocked .split{
        flex:1 1 auto;
        height:100%;
        min-height:0;
        align-items:stretch;
      }
      body#root.unlocked .split > .pane{
        min-height:0;
        height:100%;
        display:flex;
        flex-direction:column;
      }
      body#root.unlocked .pane > .content{
        height:100%;
        min-height:0;
        overflow:auto;
        padding-right:10px;
        display:flex;
        flex-direction:column;
        flex:1 1 auto;
      }
      body#root.unlocked.workspace-has-results .essay-card{
        display:flex;
        flex-direction:column;
        flex:1 1 auto;
        min-height:0;
      }
      body#root.unlocked.workspace-has-results .essay-card > form{
        display:flex;
        flex-direction:column;
        flex:1 1 auto;
        min-height:0;
        gap:10px;
      }
      body#root.unlocked.workspace-has-results .essay-card > form > .editor-wrap.editor-main{
        flex:1 1 auto;
        min-height:0;
        display:flex;
        flex-direction:column;
        margin-bottom:0;
      }
      body#root.unlocked.workspace-has-results .essay-card > form > .editor-wrap.editor-main #essay,
      body#root.unlocked.workspace-has-results .essay-card > form > .editor-wrap.editor-main #previewBox{
        flex:1 1 auto;
        min-height:180px;
        height:auto;
        max-height:none;
      }
      body#root.unlocked.workspace-has-results .essay-card > form > .editor-wrap.editor-main #previewBox{
        overflow:auto;
      }
      body#root.unlocked.workspace-has-results .essay-card > form > .editor-wrap:last-of-type{
        flex:0 0 auto;
      }
      body#root.unlocked .sidebar{
        position:static;
        top:auto;
        height:100%;
        max-height:none;
        min-height:0;
        padding-bottom:12px;
      }
    }

    /* Non-intrusive bottom footer (license link only) */
    .app-footer{
      position: fixed;
      left: 0;
      right: 0;
      bottom: max(6px, calc(var(--workspace-bottom-gap) * 0.45));
      width: 100%;
      text-align: center;
      font-size: 12px;
      line-height: 1.2;
      color: rgba(0,0,0,0.55);
      pointer-events: none; /* don’t block UI like the Install button */
      z-index: 10;
    }
    .app-footer a{
      pointer-events: auto; /* make link clickable */
      text-decoration: underline;
    }
    /* Native <dialog> styling for confirmation dialogs */
    dialog.confirm-dialog{
      border:1px solid var(--border);
      background:var(--card);
      color:var(--fg);
      border-radius: 12px;
      padding: 22px 24px;
      width: min(520px, 92%); max-width: 520px;
      box-shadow:0 14px 36px rgba(0,0,0,.18);
    }
    .confirm-dialog p{
      margin:0;
    }
    .confirm-dialog p + p{
      margin-top:14px;
      color:#445571;
      line-height:1.5;
      font-size:15px;
    }
    .confirm-dialog strong{
      display:block;
      font-size:28px;
      line-height:1.2;
      color:var(--brand);
    }
    dialog.confirm-dialog::backdrop{ background: rgba(0,0,0,.5); }
    #publicationStatusDialog{
      border:none;
      padding:0;
      width:min(760px, calc(100vw - 32px));
      max-width:760px;
      max-height:80vh;
      overflow:hidden;
      border-radius:18px;
      box-shadow:0 22px 56px rgba(0,0,0,.28);
    }
    #publicationStatusDialog::backdrop{
      background: rgba(12, 19, 31, 0.62);
    }
    #publicationStatusDialog .modal-content-dialog{
      position:relative;
      display:flex;
      flex-direction:column;
      gap:18px;
      padding:24px 24px 22px;
      max-height:80vh;
      overflow:hidden;
    }
    #publicationStatusDialog h2{
      margin:0;
      padding-right:56px;
      color:var(--brand);
      line-height:1.1;
      font-size:clamp(1.8rem, 1.5rem + 0.9vw, 2.2rem);
    }
    .publication-status-dialog-body{
      display:flex;
      flex-direction:column;
      gap:14px;
      min-height:0;
      padding:0;
    }
    .publication-status-dialog-lead{
      margin:0;
      color:#445571;
      line-height:1.5;
      font-size:1.02rem;
    }
    .publication-status-dialog-heading{
      margin:2px 0 0;
      font-weight:700;
      color:#1d2b3a;
      font-size:1.02rem;
    }
    .publication-status-dialog-list{
      flex:1 1 auto;
      max-height:min(30vh, 260px);
      overflow:auto;
      padding:12px 14px;
      margin:0;
      border:1px solid #d8c29b;
      background:#fff8ec;
      border-radius:14px;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
    }
    .publication-status-issue-list{
      margin:0;
      padding-left:20px;
      display:grid;
      gap:8px;
    }
    .publication-status-issue-item{
      font-size:0.9rem;
      line-height:1.4;
      color:#1d2b3a;
      overflow-wrap:anywhere;
    }
    .publication-status-dialog-breakdown{
      display:flex;
      flex-wrap:wrap;
      gap:10px;
      align-items:stretch;
    }
    .publication-status-breakdown-item{
      min-width:120px;
      padding:10px 12px;
      border:1px solid rgba(67, 108, 155, 0.28);
      border-radius:12px;
      background:rgba(79, 147, 223, 0.08);
    }
    .publication-status-breakdown-value{
      display:block;
      font-size:1.05rem;
      font-weight:700;
      color:var(--brand);
      line-height:1.1;
    }
    .publication-status-breakdown-label{
      display:block;
      margin-top:4px;
      font-size:0.82rem;
      line-height:1.3;
      color:#445571;
    }
    .publication-status-dialog-error{
      min-height:0;
      margin:0;
      color:#a12626;
      font-weight:600;
    }
    #publicationStatusDialog .confirm-actions{
      margin-top:2px;
      padding-top:4px;
      justify-content:center;
    }
    #publicationStatusDialog .publication-status-confirm-btn{
      min-width:160px;
      border:none;
      border-radius:10px;
      background:#0066cc;
      color:#ffffff;
      font-weight:700;
      box-shadow:0 10px 24px rgba(0, 102, 204, 0.22);
    }
    #publicationStatusDialog .publication-status-confirm-btn:hover{
      background:#1a7ae0;
    }
    #publicationStatusDialog .publication-status-confirm-btn:focus-visible{
      outline:3px solid rgba(0, 102, 204, 0.28);
      outline-offset:2px;
    }
    #publicationStatusDialog .publication-status-confirm-btn:disabled{
      background:#6f86a3;
      box-shadow:none;
      cursor:wait;
    }
    #publicationStatusDialog .close-dialog-btn{
      position:absolute;
      top:18px;
      right:18px;
      margin:0;
      width:40px;
      height:40px;
      padding:0;
      border-radius:12px;
      background:rgba(255,255,255,0.08);
    }
    @media (max-width: 640px){
      #publicationStatusDialog .modal-content-dialog{
        gap:16px;
        padding:20px 18px 18px;
      }
      #publicationStatusDialog h2{
        padding-right:48px;
        font-size:1.55rem;
      }
      .publication-status-dialog-lead,
      .publication-status-dialog-heading{
        font-size:0.98rem;
      }
      .publication-status-dialog-list{
        max-height:min(32vh, 220px);
      }
    }
    dialog.content-dialog{
      border:none;
      padding:0;
      width:min(900px, 92%);
      max-width:900px;
      max-height:90vh;
      overflow:hidden;
      border-radius:8px;
    }
    dialog.content-dialog::backdrop{ background: rgba(0,0,0,.5); }
    .modal-content-dialog{
      margin:0;
      width:100%;
      max-width:none;
      box-sizing:border-box;
      max-height:90vh;
      overflow:auto;
    }
    .close-dialog-btn{
      position:sticky;
      top:8px;
      z-index:3;
      display:block;
      margin-left:auto;
      border:0;
      background:rgba(255,255,255,0.92);
      color:inherit;
      line-height:1;
      padding:2px 4px;
      border-radius:6px;
    }
    dialog#jobProgressDialog{
      border:1px solid var(--border);
      background:var(--card);
      color:var(--fg);
      border-radius:12px;
      padding:22px 24px;
      width:min(560px, 92%);
      max-width:560px;
      box-sizing:border-box;
      max-height:90vh;
      overflow-x:hidden;
      overflow-y:auto;
      box-shadow:0 14px 36px rgba(0,0,0,.18);
    }
    dialog#jobProgressDialog::backdrop{ background: rgba(0,0,0,.5); }
    #jobProgressTitle{
      margin:0 0 8px;
      color:var(--brand);
    }
    #jobProgressStatus{
      margin:0 0 10px;
      color:#445571;
      font-size:14px;
    }
    .job-progress-wrap{
      width:100%;
      height:12px;
      border-radius:999px;
      background:#e3e9f4;
      border:1px solid #cdd8ea;
      overflow:hidden;
    }
    .job-progress-bar{
      width:0%;
      height:100%;
      background:linear-gradient(90deg, #4f93df, #2f6db0);
      transition:width .25s ease;
    }
    dialog#jobProgressDialog.progress-cancelling .job-progress-bar{
      background:linear-gradient(90deg, #ef8a45, #cd5f2a);
      animation:job-cancel-pulse 1.1s ease-in-out infinite;
    }
    dialog#jobProgressDialog.progress-cancelled .job-progress-bar{
      background:linear-gradient(90deg, #cc4e4e, #a73535);
      animation:none;
    }
    dialog#jobProgressDialog.progress-cancelled #jobProgressStatus{
      color:#983131;
      font-weight:600;
    }
    dialog#jobProgressDialog.progress-failed .job-progress-bar{
      background:linear-gradient(90deg, #cc4e4e, #a73535);
      animation:none;
    }
    .job-progress-percent{
      margin:8px 0 0;
      font-size:13px;
      font-weight:700;
      color:var(--brand);
      font-variant-numeric:tabular-nums;
    }
    .job-progress-note{
      margin:10px 0 0;
      color:#5a6a85;
      font-size:12px;
      line-height:1.45;
    }
    @keyframes job-cancel-pulse{
      0%, 100%{ opacity:1; }
      50%{ opacity:.65; }
    }

    /* --- Back-to-top button on each verification card --- */
    /* Ensure cards can anchor absolutely-positioned children */
    .ref-card{ position: relative; }
    /* Give a little space so the button doesn't overlap card content */
    .ref-card.has-top-btn{ padding-bottom: 42px; }

    .to-top-btn{
      position:absolute; right:10px; bottom:10px;
      border:1px solid var(--border);
      background:#c7ddf6; color:var(--brand);
      width:30px;
      height:30px;
      padding:0;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      font-size:12px; line-height:1; border-radius:999px;
      cursor:pointer; box-shadow:0 1px 3px rgba(0,0,0,.08);
    }

    .to-top-btn:hover{ background:#b0cdec; }
    .to-top-btn:focus{ outline:3px solid var(--accent); outline-offset:2px; }
    /* Visually-hidden text for screen readers */
    .vh{
      position:absolute; width:1px; height:1px; padding:0; margin:-1px;
      overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
    }

    /* === Floating back-to-top (Overview only) === */
    .float-top-btn{
      position: fixed;
      right: 18px;
      bottom: 56px;                 /* sits just above your footer link */
      z-index: 20;                  /* above .app-footer (z:10) */
      border:1px solid var(--border);
      background:#c7ddf6; color:var(--brand);
      width:36px;
      height:36px;
      padding:0;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      font-size:14px; line-height:1; border-radius:999px;
      cursor:pointer; box-shadow:0 1px 6px rgba(0,0,0,.12);
      display:none;                 /* JS toggles this */
    }
    /* Ensure SVG icons inside back-to-top buttons are neatly centred */
    .to-top-btn svg,
    .float-top-btn svg{
      display:block;
      margin:0 auto;
    }
    .float-top-btn:hover{ background:#b0cdec; }
    .float-top-btn:focus{ outline:3px solid var(--accent); outline-offset:2px; }
/* --- Workspace sign-in gate --- */
#gate,
.auth-gate-shell{
  display: grid;
  place-items: center;
  min-height: calc(100vh - 150px);
  background: radial-gradient(circle at top left, #f5fbff 0, #ffffff 55%, #f7f8fc 100%);
  font-family: Verdana, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  padding: 24px 16px 40px;
}

.gate-card{
  background: #ffffff;
  border: 1px solid #d3d8e4;
  border-radius: 18px;
  padding: 26px 26px 22px;
  width: min(520px, 92%);
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
  text-align: center;
}

.gate-pill{
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e3f0ff;
  color: #00539a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 4px auto 10px;
}

.gate-card h2{
  margin: 8px 0 6px;
  color: var(--brand);
  font-size: 22px;
}

.gate-desc{
  margin: 0 auto 12px;
  color: #445;
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 52ch;
}

.gate-links{
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: #667;
  margin: 6px 0 14px;
}

.gate-link{
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: #0077cc;
  cursor: pointer;
  text-decoration: underline;
}

.gate-link:hover{ color:#005ba0; }
.gate-link:focus-visible{
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.gate-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  justify-content: center;
}

.gate-cta{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:42px;
  padding:10px 18px;
  border:1px solid #0f5ea6;
  border-radius:999px;
  background:#0f5ea6;
  color:#ffffff;
  font-size:14px;
  font-weight:700;
  text-decoration:none;
}

.gate-cta:hover,
.gate-cta:focus-visible{
  background:#0b4f8d;
  border-color:#0b4f8d;
  color:#ffffff;
}


#gateForm label{
  display: block;
  margin: 14px 0 6px;
  font-weight: 600;
}

#gatePassword{
  display: block;
  margin: 0 auto;
  width: min(360px, 100%);
  padding: 11px;
  font-size: 16px;
  border: 1px solid #d3d8e4;
  border-radius: 10px;
  text-align: center;
  background: #ffffff;
}

#gatePassword:focus{
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

#gateBtn{
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
}

.gate-error{
  color: #d32f2f;
  font-size: 14px;
  display: none;
  margin-top: 8px;
}


    /* Manual-check links (Validity → Unverified cards) */
    .manual-links{
      margin-top:6px;
      font-size:0.92rem;
      opacity:.9;
    }

    /* Show the manual-verify control only in the Overview (tab4) */
    /* Hide in validity cards by default */
    #tab3 .manual-verify { display: none !important; }
    #tab4 .manual-verify {
      display: inline-flex !important;
      gap: 4px;
      align-items: center;
      margin-left: 8px;
    }
    #tab4 .manual-verify input[type="checkbox"]{ vertical-align: middle; }
    #tab4 .manual-verify label{
      font-weight: 500;
    }

    /* Manual verify tick UI */
    .manual-verify{
      display:inline-flex; 
      align-items:center;       /* vertical align text with checkbox */
      gap:4px;                  /* slightly smaller gap */
      margin-left:8px;
      font-size:0.92rem;
    }

    /* Visually de-emphasise ignored overview items */
    .ov-ignored{
      opacity:.55;
    }

    /* Make “Citations missing” bullets feel interactive */
    .ov-label.clickable-citation{
      cursor: pointer;
      transition: background-color 0.15s ease;
    }

    /* Hover highlight so users know ANY clickable citation is interactive */
    .ov-label.clickable-citation:hover,
    .clickable-citation:hover{
      background-color: #d0e7ff !important;  /* same soft blue */
      border-radius: 3px;
      cursor: pointer;
    }

    /* Brief flash on the jumped-to citation span (if present) */

    /* Soft pink / light red pulsing highlight for dyslexia-friendly visibility */
    .jump-flash{
      background-color: #ffeaf1;      /* gentle light pink */
      border-radius: 4px;
      padding: 2px;
      animation: rc-jump-pulse 2.5s ease-out 0s 2; /* slightly slower, softer */
    }

    @keyframes rc-jump-pulse{
      0%   { background-color: #ffeaf1; }  /* soft pink */
      50%  { background-color: #ffd0dd; }  /* slightly stronger pink */
      100% { background-color: #ffeaf1; }  /* return to soft pink */
    }
    /* Theme colour for manual-verify + ignore labels */
    .manual-verify label{
      color:#0066cc !important;           /* force theme blue on labels */
      font-weight:500;
    }


    /* Style the actual checkbox tick/outline in theme blue */
    .manual-verify input[type="checkbox"]{
      accent-color:#0066cc !important;    /* modern browsers */
    }

    /* -------- Fallback: custom checkbox if accent-color is not taking -------- */
    /* We scope tightly to .manual-verify so nothing else is affected. */
    @supports not (accent-color: #000) {
      .manual-verify input[type="checkbox"]{
        appearance:none;
        -webkit-appearance:none;
        width:1.05em;
        height:1.05em;
        margin:0;
        border:2px solid #0066cc;
        border-radius:4px;
        display:inline-grid;
        place-content:center;
        background:#fff;
        vertical-align:-2px; /* optically align with label text */
      }
      .manual-verify input[type="checkbox"]::after{
        content:"";
        width:0.35em;
        height:0.65em;
        border-right:3px solid transparent;
        border-bottom:3px solid transparent;
        transform:rotate(45deg);
      }
      .manual-verify input[type="checkbox"]:checked{
        background:#eaf4ff;                /* subtle fill */
        border-color:#0066cc;
      }
      .manual-verify input[type="checkbox"]:checked::after{
        border-color:#0066cc;               /* tick stroke */
      }
      .manual-verify input[type="checkbox"]:focus{
        outline:2px solid #0066cc;
        outline-offset:2px;
      }
    }


    /* Darker theme blue for Overview section headings */
 #summaryReport strong,
 #summaryReport b,
 #summaryReport h3,
 #summaryReport h4 {
   color: #003366;
   font-size: inherit;
   line-height: inherit;
  }

  /* Workspace results text: keep size consistent with essay preview */
  .sidebar #tab3,
  .sidebar #tab4,
  .sidebar #tab3 .full-report,
  .sidebar #tab4 .full-report{
    font-size: 15px;
    line-height: 1.7;
  }

  /* Normalize previously mixed sizing in result cards/notes/details */
  .sidebar #tab3 .ref-header,
  .sidebar #tab3 .ai-risk-note,
  .sidebar #tab3 .ov-subnote,
  .sidebar #tab3 .conflict,
  .sidebar #tab3 .hallucination-alert,
  .sidebar #tab3 .ai-risk-body,
  .sidebar #tab3 details.audit[open] > *:not(summary),
  .sidebar #tab4 .ov-subnote,
  .sidebar #tab4 .showme-intro,
  .sidebar #tab4 .showme-warn,
  .sidebar #tab4 .showme-alt,
  .sidebar #tab4 .showme-note,
  .sidebar #tab4 .showme-missing-example,
  .sidebar #tab4 .showme-example-label,
  .sidebar #tab4 .showme-example-content,
  .sidebar #tab4 .showme-missing-title,
  .sidebar #tab4 .showme-missing-label,
  .sidebar #tab4 .showme-missing-render{
    font-size: inherit;
    line-height: inherit;
  }


    .manual-verify input[type="checkbox"]{
      width:14px; height:14px; cursor:pointer;
      vertical-align:middle;    /* make sure box baseline matches text */
    }
    .manual-verify label{
      display:inline;           /* override global 'label { display:block }' */
      margin:0;                 /* override global bottom margin */
      font-weight:600;          /* keep it bold-ish without relying on global */
      cursor:pointer; 
      color:#333; line-height:1.2;

    }
    .ref-card.manually-verified{ outline:2px solid #b7e3b7; outline-offset:2px; }
    .manual-links a{ margin-right:.5rem; }

     /* Remove divider line but keep spacing between Overview sections */
     .section-divider {
       border-bottom: none;
       margin: 1.5em 0;
     }
    .showme-links{ margin:.25rem 0; }
    .showme-links .btn{ margin-right:.25rem; }
    .showme{ margin:.5rem 0 1rem; }


    /* Style the referencing style dropdown to match theme */
    #styleInput {
      height: 40px;            /* ensures placeholder/text fits cleanly */
      padding: 10px 34px 10px 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background-color: #e9f1ff;
      color: var(--brand);
      font-weight: bold;
      font-size: 14px;
      line-height: 1.2;
      width: 100%;             /* allow the .stylebar container to size it */
      max-width: none;
      box-sizing: border-box;
    }
    #styleInput:focus { outline: 3px solid var(--accent); outline-offset: 2px; }

    .style-clear-btn{
      position:absolute;
      top:1px;
      bottom:1px;
      right:6px;
      margin:0;
      transform:none;
      display:none;
      align-items:center;
      justify-content:center;
      width:24px;
      height:auto;
      border:none;
      border-radius:50%;
      background:transparent;
      color:#5a6a85;
      cursor:pointer;
      font-size:0;
      line-height:0;
      font-family:inherit;
      padding:0;
      z-index:2;
    }
    .style-clear-btn::before,
    .style-clear-btn::after{
      content:"";
      position:absolute;
      left:50%;
      top:50%;
      width:10px;
      height:1.8px;
      background:currentColor;
      border-radius:2px;
      transform-origin:center;
    }
    .style-clear-btn::before{
      transform:translate(-50%, -50%) rotate(45deg);
    }
    .style-clear-btn::after{
      transform:translate(-50%, -50%) rotate(-45deg);
    }
    .style-clear-btn.visible{ display:inline-flex; }
    .style-clear-btn:hover,
    .style-clear-btn:focus-visible{
      background: color-mix(in srgb, var(--border) 70%, transparent);
      color: var(--fg);
    }

    /* Dropdown list under the type-ahead */
    .style-list{
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      right: 0;
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 6px 18px rgba(0,0,0,0.08);
      max-height: 280px;
      overflow: auto;
      display: none;
      z-index: 9999;
    }
    .style-item{
      padding: 10px 12px;
      cursor: pointer;
      font-weight: 600;
      color: #003366;
    }
    .style-item:hover,
    .style-item.active,
    .style-item[aria-selected="true"]{
      background: #d0e7ff;
    }
    .style-item-empty{
      color:#5a6a85;
      cursor:default;
      font-weight:500;
    }

/* --- Show me panel --- */
.showme-wrap{ margin-top:.35rem; }
.showme-head{ display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }
.showme-badge{
  display:inline-block;
  padding:0 .45rem;
  border-radius:999px;
  font-size:.82rem;
  line-height:1.4;
  border:1px solid rgba(0,0,0,.15);
}
.showme-badge.ok{ opacity:.9; }
.showme-badge.low{ font-weight:600; }
.showme-warn{ margin-top:.35rem; font-size:.92rem; }
.showme-alt{ margin-top:.25rem; font-size:.92rem; opacity:.95; }
.showme-note{ margin-top:.25rem; font-size:.92rem; opacity:.9; }
.showme-missing-example{ margin-top:.25rem; font-size:.92rem; opacity:.95; }
.showme-intro{ margin-top:.15rem; font-size:.95rem; line-height:1.55; }
.showme-example{ margin-top:.55rem; }
.showme-example-label{ font-size:.92rem; font-weight:600; margin-bottom:.25rem; }
.showme-example-box{
  background:#e9f1ff;
  border:1px solid var(--border);
  border-radius:12px;
  padding:.55rem .65rem;
  line-height:1.55;
  font-size:.95rem;
}
.showme-added{
  background:#d0e7ff;
  border-radius:6px;
  padding:0 .18rem;
  box-decoration-break:clone;
  -webkit-box-decoration-break:clone;
}
.showme-example-ref{
  margin-top:.25rem;
  font-size:.95rem;
  line-height:1.5;
}
.showme-details{ margin-top:.45rem; }
.showme-details summary{ cursor:pointer; font-weight:600; }
.showme-details summary:focus{ outline:2px solid var(--accent); outline-offset:3px; border-radius:8px; }
.showme-details ul{ margin:.35rem 0 0 1.2rem; }
.showme-confidence{ display:none; }
.showme-missing{ margin-top:.45rem; padding:.45rem .6rem; border:1px dashed var(--border); border-radius:12px; background:#fafcff; }
.showme-missing-title{ font-size:.92rem; margin-bottom:.25rem; }
.showme-missing-list{ margin:.15rem 0 0; padding-left:1.1rem; }
.showme-missing-label{ font-size:.9rem; font-weight:600; margin-bottom:.15rem; }
.showme-missing-render{ font-size:.92rem; opacity:.95; }
/* --- Gate logo: centred and slightly larger --- */
.gate-logo-wrap{
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
}

.gate-logo{
  display:block;
  width:min(340px, 82vw);
  max-width:100%;
  max-height:72px;
  height:auto;
  object-fit:contain;
  object-position:center;
}

/* === Shared utility classes === */
.u-hidden{ display:none !important; }
.pane-title-grow{ flex:1 1 auto; min-width:0; }
.summary-text-raw{ display:none !important; }
.dropzone-label{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  text-align:center;
  cursor:pointer;
}
.dropzone-link{
  color:var(--accent);
  font-weight:700;
  text-decoration:underline;
}
.third-party-title{ margin-top:18px; }
.third-party-note{ margin-top:8px; }
.confirm-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  align-items:center;
  flex-wrap:wrap;
  margin-top:18px;
}
.confirm-actions button{
  min-height:40px;
  padding:8px 14px;
}
@media (max-width: 560px){
  .confirm-actions{
    justify-content:stretch;
  }
  .confirm-actions button{
    flex:1 1 100%;
  }
}
.anchor-hidden{ display:none !important; }

/* === Submission history pages === */
.history-page .wrap{
  max-width:1280px;
  margin:20px auto;
  padding:0 28px 24px;
}
.history-page h1{
  margin:0 0 8px;
  color:var(--brand);
  font-size:28px;
}
.history-page .meta{
  margin:0 0 14px;
  color:#5a6a85;
  font-size:14px;
}
.history-page .note{
  margin:0 0 16px;
  color:#5a6a85;
  font-size:13px;
}
.history-toolbar{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin:0 0 10px;
}
.history-toolbar input,
.history-toolbar select{
  border:1px solid var(--border);
  border-radius:8px;
  padding:7px 10px;
  background:var(--card);
  color:inherit;
  font-size:13px;
}
.history-toolbar input{
  min-width:260px;
  flex:1 1 320px;
}

.history-loading{
  display:flex;
  align-items:center;
  gap:10px;
  margin:0;
  color:#5a6a85;
  font-size:13px;
}
.history-loading-row td{
  padding:12px 8px;
}
.history-spinner{
  width:14px;
  height:14px;
  border:2px solid #c9d8f4;
  border-top-color:#1a73e8;
  border-radius:50%;
  animation:history-spin 0.8s linear infinite;
}
@keyframes history-spin{
  to{ transform:rotate(360deg); }
}
.history-page .card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
}
.history-page #historyPagination,
.history-page #batchPagination{
  margin-top:12px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--card-pale);
  justify-content:center;
  gap:12px;
}
.history-page #historyPageStatus,
.history-page #batchPageStatus{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:210px;
  padding:6px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--card);
  color:#4f627d;
  font-weight:600;
}
.history-page #historyPagination button,
.history-page #batchPagination button{
  min-width:92px;
  padding:7px 14px;
  border:1px solid #9ac4ff;
  border-radius:10px;
  background:#e9f1ff;
  color:var(--brand);
  font-weight:700;
  font-size:13px;
  line-height:1.2;
  transition:background-color .15s ease, color .15s ease, border-color .15s ease;
}
.history-page #historyPagination button:hover:not(:disabled),
.history-page #historyPagination button:focus-visible:not(:disabled),
.history-page #batchPagination button:hover:not(:disabled),
.history-page #batchPagination button:focus-visible:not(:disabled){
  background:#d0e7ff;
  border-color:#6aa7ff;
  color:var(--accent-2);
}
.history-page #historyPagination button:disabled,
.history-page #batchPagination button:disabled{
  background:#eef1f6;
  border-color:#c8d0dc;
  color:#8a99af;
  cursor:not-allowed;
  opacity:1;
}
.history-page .alert{
  margin:0 0 16px;
  padding:10px 12px;
  background:#fff8e5;
  border:1px solid #f0d48a;
  border-radius:10px;
  font-size:14px;
}
.history-page .status{
  font-weight:700;
  text-transform:capitalize;
}
.history-page .status.done{ color:#137333; }
.history-page .status.error{ color:#b3261e; }
.history-page .status.queued,
.history-page .status.received,
.history-page .status.running{ color:#1a73e8; }
.history-page table{
  width:100%;
  border-collapse:collapse;
}
.history-page th,
.history-page td{
  text-align:left;
  vertical-align:top;
  padding:9px 8px;
  border-bottom:1px solid var(--border);
}
.history-page .actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
  white-space:nowrap;
}
.row-actions-menu{
  position:relative;
  display:inline-block;
}
.row-actions-trigger{
  list-style:none;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  border:1px solid #9ac4ff;
  border-radius:9px;
  background:#e9f1ff;
  color:var(--brand);
  font-weight:700;
  font-size:20px;
  line-height:1;
}
.row-actions-trigger::-webkit-details-marker{
  display:none;
}
.row-actions-menu[open] .row-actions-trigger,
.row-actions-trigger:hover,
.row-actions-trigger:focus-visible{
  background:#d0e7ff;
  border-color:#6aa7ff;
  color:var(--accent-2);
}
.row-actions-list{
  position:absolute;
  right:0;
  top:calc(100% + 6px);
  min-width:168px;
  padding:8px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--card);
  box-shadow:0 10px 24px rgba(0,0,0,.18);
  z-index:60;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.row-actions-list .btn-link-btn,
.row-actions-list .btn-link{
  width:100%;
  justify-content:center;
}
.row-actions-inline{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:nowrap;
  white-space:nowrap;
}
.row-actions-menu-compact{
  display:none;
}

@media (max-width: 900px){
  .row-actions-inline{
    display:none;
  }
  .history-page .actions.row-actions-inline{
    display:none;
  }
  .row-actions-menu-compact{
    display:inline-block;
  }
}
.history-page .btn-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:96px;
  padding:5px 10px;
  border-radius:8px;
  border:1px solid #9ac4ff;
  background:#e9f1ff;
  color:var(--brand);
  text-decoration:none;
  font-weight:600;
  font-size:13px;
  line-height:1.2;
}
.history-page .btn-link-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:96px;
  padding:5px 10px;
  border-radius:8px;
  border:1px solid #9ac4ff;
  background:#e9f1ff;
  color:var(--brand);
  text-decoration:none;
  font-weight:600;
  font-size:13px;
  line-height:1.2;
}
.history-page .btn-link-btn.rc-expander-button{
  position:relative;
  justify-content:flex-start;
  padding-left:28px;
}
.history-page .btn-link-btn.rc-expander-button::before{
  position:absolute;
  left:10px;
  top:50%;
  width:.95rem;
  flex:0 0 .95rem;
  transform:translateY(-50%) scale(1.32);
}
.history-page .btn-link.disabled,
.history-page .btn-link-btn:disabled{
  background:#eef1f6;
  border-color:#c8d0dc;
  color:#6e7e96;
  cursor:not-allowed;
  pointer-events:none;
}
.history-page .btn-link:hover,
.history-page .btn-link:focus-visible,
.history-page .btn-link-btn:hover,
.history-page .btn-link-btn:focus-visible{
  background:#d0e7ff;
  color:var(--accent-2);
}
.history-page .history-detail-row td{
  padding:0 8px 8px;
  background:transparent;
}
.history-inline-details{
  margin:2px 0 6px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--card-pale);
}
.history-drawer{
  margin:0 0 10px;
  border:1px solid var(--border-pale);
  border-radius:10px;
  background:var(--card);
  overflow:hidden;
}
.history-drawer:last-child{
  margin-bottom:0;
}
.history-drawer > summary{
  padding:10px 12px;
  font-size:14px;
  font-weight:700;
  color:var(--brand);
  background:var(--card-pale);
  border-bottom:1px solid transparent;
}
.history-drawer[open] > summary{
  border-bottom-color:var(--border-pale);
}
.history-drawer > .history-inline-kv,
.history-drawer > .history-inline-metrics{
  padding:10px 12px;
}
.history-inline-metrics{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:7px;
  margin:0;
}
.history-inline-metrics-extended{
  grid-template-columns:repeat(3, minmax(0, 1fr));
  margin:0;
}
.history-inline-metric{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-start;
  gap:4px;
  padding:10px 10px;
  border:1px solid var(--border-pale);
  border-radius:10px;
  background:var(--card-pale);
  min-height:62px;
}
.history-inline-metric .label{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:#5a6a85;
  font-weight:600;
}
.history-inline-metric .value{
  font-size:22px;
  line-height:1.1;
  color:var(--brand);
  font-weight:700;
}
.history-inline-metric .value.rc-value-chip{
  font-size:1.1rem;
  line-height:1.25;
  padding:4px 10px;
}
.history-inline-kv{
  display:grid;
  grid-template-columns:220px 1fr;
  gap:6px 10px;
  font-size:13px;
}
.history-inline-kv .k{ color:#5a6a85; font-weight:600; }
.history-inline-kv .v{ color:inherit; }
.history-detail .grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.history-detail .card h2{
  margin:0 0 10px;
  color:var(--brand);
  font-size:18px;
}
.history-detail .kv{
  display:grid;
  grid-template-columns:220px 1fr;
  gap:8px;
  font-size:14px;
}
.history-detail .k{ color:#5a6a85; }
.history-detail .v code{ font-size:12px; }
.history-detail pre{
  margin:0;
  white-space:pre-wrap;
  word-break:break-word;
  background:#f6faff;
  border:1px solid #dfe8ff;
  border-radius:8px;
  padding:10px;
  font-size:12px;
  line-height:1.45;
  max-height:280px;
  overflow:auto;
}
.report-page .report-grid{
  display:grid;
  grid-template-columns:320px minmax(0, 1fr);
  gap:16px;
  align-items:start;
  width:100%;
  flex:1 1 auto;
  min-height:0;
}
.report-page .report-grid > *{
  min-width:0;
  min-height:0;
}
.report-page .wrap{
  max-width:1320px;
  width:min(1320px, calc(100vw - 56px));
  margin:20px auto;
  padding:0 28px 24px;
  box-sizing:border-box;
  height:100%;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.report-page h1{
  margin:0 0 8px;
  color:var(--brand);
  font-size:32px;
  line-height:1.2;
}
.report-page .meta{
  margin:0 0 14px;
  color:#5a6a85;
  font-size:14px;
}
.report-page .card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  padding:14px;
}
.report-page .report-summary{
  position:relative;
  align-self:start;
  width:100%;
  min-width:320px;
  max-width:320px;
  height:auto;
  max-height:none;
  overflow:visible;
  box-sizing:border-box;
  scrollbar-gutter:stable;
}
.report-page .report-summary h2,
.report-page .report-main h2,
.report-page .report-preview h2{
  margin:0 0 10px;
  color:var(--brand);
  font-size:22px;
}
.report-page .report-summary .kv{
  display:grid;
  grid-template-columns:1fr auto;
  gap:10px 8px;
  font-size:14px;
}
.report-page .report-summary .k{ color:#5a6a85; }
.report-page .report-summary .v{
  font-weight:700;
  color:var(--brand);
  justify-self:end;
  align-self:center;
}
.report-page .report-main{
  min-height:0;
  height:100%;
  max-height:none;
  min-width:0;
  width:100%;
  overflow:hidden;
  box-sizing:border-box;
  scrollbar-gutter:stable;
  display:flex;
  flex-direction:column;
}
.report-page .report-tabs{
  margin-top:0;
  margin-bottom:12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.report-page .report-tabs-left,
.report-page .report-tabs-right{
  display:flex;
  align-items:center;
  gap:8px;
}
.report-page .tab-button-ghost{
  background:transparent;
  border:1px solid var(--border);
  color:var(--brand);
}
.report-page .tab-button-ghost:hover{
  background:var(--card-pale);
  color:var(--accent-2);
}
.report-page .report-tab-content{ display:none; }
.report-page .report-tab-content.active{
  display:block;
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-gutter:stable;
}
.report-page{
  --report-depth-0:#edf4ff;
  --report-depth-1:#e4efff;
  --report-depth-2:#d9e8ff;
  --report-depth-3:#cfe0fb;
  --report-depth-border-1:#c2d7f4;
  --report-depth-border-2:#acc8ee;
  --report-depth-border-3:#97bae7;
}
.report-page .tab-content{
  border:1px solid var(--border);
  border-radius:10px;
  padding:12px 14px;
  background:var(--report-depth-0);
}
.report-page .report-tab-content .full-report{
  font-size:15px;
  line-height:1.7;
  color:inherit;
}
.report-page .report-tab-content .full-report > *:first-child{
  margin-top:0 !important;
}
.report-page #report-validity{
  color:inherit;
}
.report-page #report-validity p{
  margin:0 0 .6rem;
  line-height:1.55;
}
.report-page #report-validity p:last-child{
  margin-bottom:0;
}
.report-page #report-validity a,
.report-page #summaryReport a{
  color:var(--accent);
  text-decoration:underline;
}
.report-page #report-validity a:visited,
.report-page #summaryReport a:visited{
  color:#5c7cff;
}
.report-page #report-validity a:hover,
.report-page #summaryReport a:hover{
  color:var(--accent-2);
}
.report-page #report-validity a:focus-visible,
.report-page #summaryReport a:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
  border-radius:4px;
}
.report-page #report-validity br + br{
  display:none;
}
.report-page #report-validity .ref-card{
  margin:0 0 10px;
}
.report-page #report-validity .ai-risk-panel{
  margin-top:8px;
}
.report-page .report-validity-group-card{
  margin:0 0 12px;
  border:1px solid var(--report-depth-border-1);
  border-radius:10px;
  background:var(--report-depth-1);
  overflow:hidden;
  display:block;
  width:100%;
  box-sizing:border-box;
}
.report-page .report-validity-group-card > summary{
  padding:10px 12px;
  font-size:14px;
  color:var(--brand);
  font-weight:700;
}
.report-page .report-validity-group{
  padding:0 10px 10px;
}
.report-page .report-drawer{
  margin:0 0 10px;
  border:1px solid var(--report-depth-border-2);
  border-radius:10px;
  background:var(--report-depth-2);
  overflow:hidden;
  padding:0 10px;
}
.report-page .report-drawer[open]{
  padding:0 10px 10px;
}
.report-page .report-drawer > summary{
  padding:10px 0;
  color:var(--brand);
  font-weight:700;
  line-height:1.2;
  min-height:24px;
}
.report-page .report-drawer-label{
  min-width:0;
}
.report-page .report-drawer-chip{
  margin-left:auto;
  align-self:center;
}
.report-page .report-drawer-chip.status-tag{
  font-size:.8rem;
}
.report-page #report-validity .ref-card{
  padding:0;
  overflow:hidden;
  border:1px solid var(--report-depth-border-3);
  border-radius:10px;
  background:var(--report-depth-3);
}
.report-page #report-validity .ref-card > .report-drawer{
  margin:0;
  border:0;
  border-radius:inherit;
  background:transparent;
  padding:0 12px;
}
.report-page #report-validity .ref-card > .report-drawer[open]{
  padding:0 12px 12px;
}
.report-page #summaryReport .ov-section-card{
  background:var(--report-depth-1);
  border-color:var(--report-depth-border-1);
}
.report-page #summaryReport .ov-section-card .ref-card,
.report-page #summaryReport .ov-section-card details.audit[open],
.report-page #summaryReport .ov-section-card .ov-subnote{
  background:var(--report-depth-2);
  border-color:var(--report-depth-border-2);
}
.report-page #summaryReport .ov-section-card .ref-card .ov-subnote,
.report-page #summaryReport .ov-section-card details.audit[open] .ov-subnote,
.report-page #summaryReport .ov-section-card .ref-card details.audit[open]{
  background:var(--report-depth-3);
  border-color:var(--report-depth-border-3);
}
.report-page .report-preview{ margin-top:14px; }
.report-page .report-details-link{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:10020;
  font-size:12px;
  font-weight:600;
  color:var(--accent);
  text-decoration:underline;
  text-underline-offset:2px;
  background:transparent;
  border:0;
  padding:0;
}
.report-page .report-details-link:hover{
  color:var(--accent-2);
}
.report-details-dialog{
  width:min(740px, 92vw);
  max-height:80vh;
  border:1px solid var(--border);
  border-radius:12px;
  padding:0;
  background:var(--card);
  color:var(--fg);
}
.report-details-dialog::backdrop{
  background:rgba(0,0,0,.45);
}
.report-details-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
}
.report-details-head h3{
  margin:0;
  font-size:18px;
  color:var(--brand);
}
.report-details-close{
  padding:6px 10px;
  border-radius:8px;
  font-size:13px;
}
.report-details-note{
  margin:10px 14px 0;
  font-size:13px;
  color:#5a6a85;
}
.report-details-json{
  margin:10px 14px 14px;
  padding:10px;
  max-height:56vh;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--card-pale);
  font-size:12px;
  line-height:1.45;
}
@media (max-width: 980px){
  .rc-breadcrumbs{
    width:min(1320px, calc(100vw - 32px));
    padding:0 16px;
  }
  .history-page .wrap{ padding:0 16px 24px; }
  .history-toolbar{ margin:0 0 8px; }
  .history-toolbar input{ min-width:200px; }
  .history-page #historyPagination,
  .history-page #batchPagination{
    justify-content:space-between;
    gap:8px;
  }
  .history-page #historyPageStatus,
  .history-page #batchPageStatus{
    min-width:0;
    flex:1 1 auto;
    font-size:12px;
    padding:6px 8px;
  }
  .history-page #historyPagination button,
  .history-page #batchPagination button{
    min-width:84px;
    padding:7px 10px;
  }
  .history-detail .grid{ grid-template-columns:1fr; }
  .history-detail .kv{ grid-template-columns:1fr; gap:2px; }
  .history-inline-metrics{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .history-inline-metrics-extended{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .report-page .report-grid{ grid-template-columns:1fr; }
  .report-page .wrap{ height:auto; overflow:visible; display:block; }
  .report-page .report-summary{ position:static; }
  .report-page .report-summary{ width:auto; }
  .report-page .report-summary{ max-height:none; overflow:visible; }
  .report-page .report-main{ height:auto; max-height:none; overflow:visible; }
  .report-page .report-tab-content.active{ height:auto; overflow:visible; }
  .report-page .wrap{ padding:0 16px 24px; }
  .report-page h1{ font-size:28px; }
  .report-page .report-summary h2,
  .report-page .report-main h2,
  .report-page .report-preview h2{ font-size:22px; }
  .report-page .report-details-link{
    right:12px;
    bottom:12px;
    font-size:12px;
  }
}

/* === Report/overview helper blocks === */
.unverified-note{
  font-size:12px;
  color:#555;
  margin:4px 0 10px;
  line-height:1.45;
}
.unverified-actions{
  margin:6px 0 10px 18px;
}

/* Overview: show unverified references as plain rows (not individual cards) */
#summaryReport .ov-section-card[data-section="sec-unverified-refs"] .ov-unverified-ref-card{
  background:transparent !important;
  border:0 !important;
  border-radius:0 !important;
  box-shadow:none !important;
  padding:0 !important;
  margin:10px 0 0;
}
#summaryReport .ov-section-card[data-section="sec-unverified-refs"] .ov-unverified-ref-card + .ov-unverified-ref-card{
  border-top:1px solid var(--border) !important;
  padding-top:10px !important;
}
#summaryReport .ov-section-card[data-section="sec-unverified-refs"] .ov-unverified-ref-card .ref-line{
  margin:0;
}
#summaryReport .ov-section-card[data-section="sec-unverified-refs"] .ov-unverified-ref-card .unverified-actions{
  margin:8px 0 0;
}

/* Overview: mirror unverified row spacing for formatting/show-me entries */
#summaryReport .ov-section-card[data-section="sec-formatting-issues"] .ov-formatting-issue-card{
  margin:10px 0 0;
}
#summaryReport .ov-section-card[data-section="sec-formatting-issues"] .ov-formatting-issue-card + .ov-formatting-issue-card{
  border-top:1px solid var(--border);
  padding-top:10px;
}
#summaryReport .ov-section-card[data-section="sec-formatting-issues"] .ov-formatting-issue-card .showme-links{
  margin:8px 0 0;
}
.doi-helper-line{
  display:flex;
  align-items:center;
  gap:.5rem;
  flex-wrap:wrap;
}

/* === Citation highlighting === */
.citation-highlight,
.essay-preview .citation-highlight,
.full-report .citation-highlight,
.live-blue{
  color:#0f5fdd !important;
  font-weight:600;
}

/* === Timeout page === */
body.timeout-page{
  margin:0;
  background:#f9f9f9;
  color:#1f3f4e;
}
.timeout-wrap{
  max-width:640px;
  margin:5rem auto;
  background:#fff;
  border:1px solid #ddd;
  border-radius:12px;
  box-shadow:0 2px 8px rgba(0,0,0,0.05);
  padding:2rem;
  text-align:center;
}
.timeout-page h1{
  margin-top:0;
  color:#1971a9;
}
.timeout-page p{ line-height:1.6; }
.timeout-button{
  display:inline-block;
  margin-top:1rem;
  padding:.6rem 1.2rem;
  border-radius:8px;
  background:#1971a9;
  color:#fff;
  text-decoration:none;
  font-weight:700;
}
.timeout-button:hover{ background:#145b82; }

/* === Theme selector (top bar icon + dropdown) === */
.theme-menu{
  position:fixed;
  top:12px;
  right:12px;
  z-index:10001;
}
.theme-menu.in-header{
  position:relative;
  top:auto;
  right:auto;
  z-index:10040;
}
.theme-menu-button{
  width:34px;
  height:34px;
  border-radius:50%;
  padding:0;
  display:inline-grid;
  place-items:center;
  line-height:0;
  vertical-align:middle;
  border:1px solid var(--header-control-border);
  background:var(--header-control-bg);
  color:var(--header-control-fg);
  box-shadow:0 1px 0 rgba(11, 64, 128, 0.04);
}
.theme-menu-button:hover{
  background:var(--header-control-bg-hover);
  color:var(--header-control-fg-strong);
}
.theme-menu-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:19px;
  height:19px;
  line-height:0;
  color:currentColor;
}
.theme-menu-icon [data-icon]{
  display:none;
  width:100%;
  height:100%;
  align-items:center;
  justify-content:center;
}
#themeMenu[data-theme-icon="system"] .theme-menu-icon [data-icon="system"]{
  display:inline-flex;
}
#themeMenu[data-theme-icon="light"] .theme-menu-icon [data-icon="light"]{
  display:inline-flex;
}
#themeMenu[data-theme-icon="dark"] .theme-menu-icon [data-icon="dark"]{
  display:inline-flex;
}
.theme-menu-icon svg,
.theme-option-icon svg{
  width:100%;
  height:100%;
  display:block;
}
.theme-menu-button:focus-visible{
  outline:3px solid rgba(0, 102, 204, 0.22);
  outline-offset:2px;
}

.theme-menu-dropdown{
  position:absolute;
  top:42px;
  right:0;
  min-width:170px;
  border:1px solid var(--header-control-border);
  border-radius:10px;
  background:var(--header-control-bg);
  box-shadow:0 8px 20px rgba(0,0,0,0.18);
  padding:6px;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.theme-menu-dropdown[hidden]{
  display:none !important;
}
.theme-menu.in-header .theme-menu-dropdown{
  right:0;
  z-index:10070;
}
.theme-menu-dropdown button{
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
  text-align:left;
  border-radius:8px;
  border:1px solid transparent;
  background:transparent;
  color:inherit;
  padding:7px 10px;
  font-size:13px;
}
.theme-option-icon{
  width:1.1em;
  height:1.1em;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 1.1em;
}
.theme-menu-dropdown button:hover,
.theme-menu-dropdown button:focus-visible{
  background:var(--header-control-bg-hover);
  color:var(--header-control-fg);
}
.theme-menu-dropdown button[aria-checked="true"]{
  background:var(--card-pale);
  color:var(--header-control-fg);
  font-weight:700;
}
.theme-menu-separator{
  height:1px;
  margin:4px 2px;
  background:var(--border);
  opacity:.8;
}
@media (max-width: 900px){
  .theme-menu{ top:8px; right:8px; }
  .theme-menu-button{ width:34px; height:34px; }
  .theme-menu-dropdown{ top:40px; min-width:155px; }
}

/* === Dark mode compatibility (manual + persistent) === */
:root[data-theme="dark"]{
  --bg:#0b1624;
  --fg:#eaf3ff;
  --brand:#86c1ff;
  --accent:#5aa8ff;
  --accent-2:#87c3ff;
  --top-pill-bg:#2a5f8a;
  --top-pill-bg-hover:#3478af;
  --top-pill-fg:#ffffff;
  --top-pill-border:#5f90bb;
  --card:#122233;
  --border:#2d4b68;
  --card-pale:#162b40;
  --border-pale:#345779;
  --tagline-color:#c9def5;
  --brand-strong:#eef6ff;
  --muted:#b4cbe4;
  --panel:#18324a;
  --panel-soft:#224666;
  --header-surface:rgba(14,29,44,0.94);
  --header-border:#2d4b68;
  --header-shadow:0 10px 28px rgba(0,0,0,0.28);
  --header-control-bg:#18324a;
  --header-control-bg-hover:#224666;
  --header-control-border:#315676;
  --header-control-fg:#eaf3ff;
  --header-control-fg-strong:#ffffff;
}

:root[data-theme="dark"] body{ background:var(--bg); color:var(--fg); }
:root[data-theme="dark"] header{ background:var(--header-surface); border-bottom-color:var(--header-border); box-shadow:var(--header-shadow); }
:root[data-theme="dark"] .essay-preview,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .tab-content,
:root[data-theme="dark"] .metric,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .history-page .card,
:root[data-theme="dark"] .history-detail pre{
  background:#15293d;
  color:var(--fg);
  border-color:var(--border);
}
:root[data-theme="dark"] textarea::placeholder,
:root[data-theme="dark"] input::placeholder{
  color:#a6c3df;
}
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="search"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] select{
  background:#15293d;
  color:var(--fg);
  border-color:var(--border);
}
:root[data-theme="dark"] .dropzone{
  background:#15293d;
  border-color:var(--border);
}
:root[data-theme="dark"] .dropzone.dragover,
:root[data-theme="dark"] .dropzone:hover{
  background:#1b3650;
}
:root[data-theme="dark"] .metric .label,
:root[data-theme="dark"] .muted,
:root[data-theme="dark"] .history-page .meta,
:root[data-theme="dark"] .history-page .note,
:root[data-theme="dark"] .history-detail .k,
:root[data-theme="dark"] .unverified-note{
  color:#b4cbe4 !important;
}
:root[data-theme="dark"] .metric .note,
:root[data-theme="dark"] .import-summary,
:root[data-theme="dark"] footer{
  color:#b4cbe4 !important;
}
:root[data-theme="dark"] .rc-value-chip{
  background:#1f3e5d;
  border-color:#4b79a3;
  color:#d8eaff;
}
:root[data-theme="dark"] .rc-value-chip--ok{
  background:#214b33;
  border-color:#5aa078;
  color:#ddffe8;
}
:root[data-theme="dark"] .rc-value-chip--warn{
  background:#5a2424;
  border-color:#a75f5f;
  color:#ffe4e4;
}
:root[data-theme="dark"] .rc-value-chip--neutral{
  background:#1f3e5d;
  border-color:#4b79a3;
  color:#d8eaff;
}
:root[data-theme="dark"] .rc-value-chip--caution{
  background:#5b4a1f;
  border-color:#d5b062;
  color:#fff1cd;
}
:root[data-theme="dark"] .overview-heading,
:root[data-theme="dark"] .overview-label{
  color:#cfe4ff !important;
}
:root[data-theme="dark"] #summaryReport strong,
:root[data-theme="dark"] #summaryReport b,
:root[data-theme="dark"] #summaryReport h3,
:root[data-theme="dark"] #summaryReport h4{
  color:#cfe4ff !important;
}
:root[data-theme="dark"] .ov-label.clickable-citation,
:root[data-theme="dark"] .clickable-citation{
  color:#8dc7ff !important;
}
:root[data-theme="dark"] .ov-label.clickable-citation:hover,
:root[data-theme="dark"] .clickable-citation:hover{
  background:#234564 !important;
}
:root[data-theme="dark"] .manual-verify label{
  color:#8dc7ff !important;
}
:root[data-theme="dark"] .full-report{
  color:var(--fg);
}
:root[data-theme="dark"] .full-report [style*="color:"]{
  color:var(--fg) !important;
}
:root[data-theme="dark"] .ov-subnote,
:root[data-theme="dark"] .ai-risk-note,
:root[data-theme="dark"] .ai-risk-panel{
  background:#1c3c58 !important;
  color:#e1edff !important;
  border-color:#557ca1 !important;
}
:root[data-theme="dark"] .showme,
:root[data-theme="dark"] .showme .ref-body,
:root[data-theme="dark"] .showme-wrap,
:root[data-theme="dark"] .showme-intro,
:root[data-theme="dark"] .showme-example-label,
:root[data-theme="dark"] .showme-example-ref,
:root[data-theme="dark"] .showme-note,
:root[data-theme="dark"] .showme-missing-title,
:root[data-theme="dark"] .showme-missing-label,
:root[data-theme="dark"] .showme-missing-render{
  color:#eaf3ff !important;
}
:root[data-theme="dark"] .showme-example-box{
  background:#19344f !important;
  border-color:#4f7091 !important;
  color:#eaf3ff !important;
}
:root[data-theme="dark"] .showme-added{
  background:#2a4a66 !important;
  color:#eef6ff !important;
}
:root[data-theme="dark"] .showme-missing{
  background:#17314a !important;
  border-color:#557ca1 !important;
}
:root[data-theme="dark"] .ai-risk-panel .ai-risk-title,
:root[data-theme="dark"] .ai-risk-panel .ai-risk-body{
  color:#eaf3ff !important;
}
:root[data-theme="dark"] #summaryReport .ov-section-card,
:root[data-theme="dark"] .order-issue-card,
:root[data-theme="dark"] .ref-card,
:root[data-theme="dark"] details.audit[open]{
  background:#1c3c58 !important;
  border-color:#557ca1 !important;
  box-shadow:0 2px 10px rgba(0,0,0,0.18);
}
:root[data-theme="dark"] #summaryReport .ov-section-card{
  background:#122e45 !important;
  border-color:#426a8e !important;
}
:root[data-theme="dark"] :where(
  .rc-expander > summary,
  .sidebar #tab4 .ov-card-details > summary,
  .sidebar #tab4 .order-issue-collapse > summary,
  #tab3 .workspace-validity-group-card > summary,
  .history-drawer > summary,
  .report-page .report-validity-group-card > summary,
  .report-page .report-drawer > summary,
  .order-issue-details > summary,
  details.audit > summary,
  details.foldable > summary,
  .showme-details > summary
)::before,
:root[data-theme="dark"] .rc-expander-summary::before,
:root[data-theme="dark"] .rc-expander-button::before{
  color:#8dc7ff !important;
}
:root[data-theme="dark"] #summaryReport .ov-section-card .ref-card,
:root[data-theme="dark"] #summaryReport .ov-section-card details.audit[open],
:root[data-theme="dark"] #summaryReport .ov-section-card .ov-subnote{
  background:#214766 !important;
  border-color:#618cb3 !important;
}
:root[data-theme="dark"] .publication-status-note{
  background:rgba(123, 89, 22, 0.18) !important;
  border-color:rgba(223, 185, 109, 0.38) !important;
}
:root[data-theme="dark"] .publication-status-note-body{
  color:#f4e6c8 !important;
}
:root[data-theme="dark"] .ref-inline-warning{
  color:#f0cd84 !important;
}
:root[data-theme="dark"] #tab3 .workspace-validity-group-card{
  background:#122e45 !important;
  border-color:#426a8e !important;
}
:root[data-theme="dark"] #tab3 .workspace-validity-group-title{
  color:#cfe4ff !important;
}
:root[data-theme="dark"] .order-issue-card{
  background:#122e45 !important;
  border-color:#426a8e !important;
}
:root[data-theme="dark"] .status-tag--warn{
  background:#6d2323;
  border-color:#c77f7f;
  color:#ffe8e8;
}
:root[data-theme="dark"] .status-tag--caution{
  background:#5b4a1f;
  border-color:#d5b062;
  color:#fff1cd !important;
}
:root[data-theme="dark"] .status-tag--ok{
  background:#1f5f2c;
  border-color:#74b184;
  color:#e7ffec;
}
:root[data-theme="dark"] .status-tag--neutral{
  background:#1f3e5d;
  border-color:#4b79a3;
  color:#d8eaff !important;
}
:root[data-theme="dark"] .order-issue-summary{
  color:#d0e6ff;
}
:root[data-theme="dark"] .order-issue-stat{
  background:#214766;
  border-color:#618cb3;
}
:root[data-theme="dark"] .order-issue-stat .k{
  color:#b8d7f2;
}
:root[data-theme="dark"] .order-issue-stat .v{
  color:#eef7ff;
}
:root[data-theme="dark"] .order-issue-stat .d{
  color:#b8d7f2;
}
:root[data-theme="dark"] .order-issue-details > div{
  color:#cae1f8;
}
:root[data-theme="dark"] .order-jump-block{
  background:#214766;
  border-color:#618cb3;
}
:root[data-theme="dark"] .order-jump-block .k{
  color:#b8d7f2;
}
:root[data-theme="dark"] .order-jump-btn{
  background:#1f3e5d;
  border-color:#4b79a3;
  color:#d8eaff;
}
:root[data-theme="dark"] .order-jump-btn:hover,
:root[data-theme="dark"] .order-jump-btn:focus-visible{
  background:#2a4a66;
  border-color:#6aa4d9;
}
/* Keep Overview unverified rows flat in dark mode (no per-item card backgrounds) */
:root[data-theme="dark"] #summaryReport .ov-section-card[data-section="sec-unverified-refs"] .ov-unverified-ref-card{
  background:transparent !important;
  border:0 !important;
  border-radius:0 !important;
  box-shadow:none !important;
}
:root[data-theme="dark"] #summaryReport .ov-section-card[data-section="sec-unverified-refs"] .ov-unverified-ref-card + .ov-unverified-ref-card{
  border-top:1px solid #426a8e !important;
}
/* Avoid odd dark-mode strips between stacked cards in the right column */
:root[data-theme="dark"] .sidebar .tab-content{
  background:transparent;
  border-color:transparent;
}
:root[data-theme="dark"] .btn-help,
:root[data-theme="dark"] .btn-manual,
:root[data-theme="dark"] .history-page .btn-link{
  background:#1f3e5d !important;
  color:#c6e2ff !important;
  border-color:#4b79a3 !important;
}
:root[data-theme="dark"] .btn-open{
  background:#19344f;
  color:#d7e9ff;
  border-color:#4b79a3;
}
:root[data-theme="dark"] .history-page .btn-link-btn{
  background:#1f3e5d !important;
  color:#c6e2ff !important;
  border-color:#4b79a3 !important;
}
:root[data-theme="dark"] .history-page .btn-link.disabled,
:root[data-theme="dark"] .history-page .btn-link-btn:disabled{
  background:#24364a !important;
  color:#8aa3bf !important;
  border-color:#3b536d !important;
}
:root[data-theme="dark"] .row-actions-trigger{
  background:#19314a;
  border-color:#3b6a95;
  color:#cde6ff;
}
:root[data-theme="dark"] .row-actions-menu[open] .row-actions-trigger,
:root[data-theme="dark"] .row-actions-trigger:hover,
:root[data-theme="dark"] .row-actions-trigger:focus-visible{
  background:#234564;
  border-color:#4c81b2;
  color:#e6f3ff;
}
:root[data-theme="dark"] .row-actions-list{
  background:#102133;
  border-color:#2b445d;
  box-shadow:0 10px 24px rgba(0,0,0,.42);
}
:root[data-theme="dark"] .history-inline-details{
  background:#19344f;
  border-color:var(--border);
}
:root[data-theme="dark"] .history-toolbar input,
:root[data-theme="dark"] .history-toolbar select{
  background:#15293d;
  border-color:#355777;
  color:var(--fg);
}
:root[data-theme="dark"] .history-page #historyPagination,
:root[data-theme="dark"] .history-page #batchPagination{
  background:#15293d;
  border-color:#355777;
}
:root[data-theme="dark"] .history-page #historyPageStatus,
:root[data-theme="dark"] .history-page #batchPageStatus{
  background:#19344f;
  border-color:#355777;
  color:#c7daee;
}
:root[data-theme="dark"] .history-page #historyPagination button,
:root[data-theme="dark"] .history-page #batchPagination button{
  background:#1f3e5d;
  border-color:#4b79a3;
  color:#c6e2ff;
}
:root[data-theme="dark"] .history-page #historyPagination button:hover:not(:disabled),
:root[data-theme="dark"] .history-page #historyPagination button:focus-visible:not(:disabled),
:root[data-theme="dark"] .history-page #batchPagination button:hover:not(:disabled),
:root[data-theme="dark"] .history-page #batchPagination button:focus-visible:not(:disabled){
  background:#2a4a66;
  border-color:#6aa4d9;
  color:#eef6ff;
}
:root[data-theme="dark"] .history-page #historyPagination button:disabled{
  background:#24364a;
  border-color:#3b536d;
  color:#8aa3bf;
  opacity:1;
}
:root[data-theme="dark"] .history-drawer{
  background:#15293d;
  border-color:#355777;
}
:root[data-theme="dark"] .history-drawer > summary{
  background:#19344f;
  color:#cfe4ff;
}
:root[data-theme="dark"] .history-drawer[open] > summary{
  border-bottom-color:#355777;
}
:root[data-theme="dark"] .history-inline-metric{
  background:#19344f;
  border-color:#355777;
}
:root[data-theme="dark"] .history-inline-metric .label{
  color:#b4cbe4;
}
:root[data-theme="dark"] .history-inline-metric .value{
  color:#eaf3ff;
}
:root[data-theme="dark"] .history-inline-kv .k{
  color:#b4cbe4;
}
:root[data-theme="dark"] .report-page .report-summary .k{
  color:#b4cbe4;
}
:root[data-theme="dark"] .report-page .report-summary .v{
  color:#eaf3ff;
}
:root[data-theme="dark"] .report-page .tab-button-ghost{
  background:#19344f;
  border-color:#355777;
  color:#cfe4ff;
}
:root[data-theme="dark"] .report-page .tab-button-ghost:hover{
  background:#2a4a66;
  color:#eef6ff;
}
:root[data-theme="dark"] .report-page .report-details-link{
  color:#8dc7ff;
}
:root[data-theme="dark"] .report-page .report-details-link:hover{
  color:#c6e2ff;
}
:root[data-theme="dark"] .report-details-note{
  color:#b4cbe4;
}
:root[data-theme="dark"] .report-details-json{
  background:#15293d;
  border-color:#355777;
  color:var(--fg);
}
:root[data-theme="dark"] .report-page #report-validity{
  color:var(--fg);
}
:root[data-theme="dark"] .report-page{
  --report-depth-0:#10263a;
  --report-depth-1:#163553;
  --report-depth-2:#1d4770;
  --report-depth-3:#255a8b;
  --report-depth-border-1:#345b84;
  --report-depth-border-2:#4974a6;
  --report-depth-border-3:#6391c5;
}
:root[data-theme="dark"] .report-page .report-drawer{
  background:var(--report-depth-2);
  border-color:var(--report-depth-border-2);
}
:root[data-theme="dark"] .report-page .report-drawer > summary{
  color:#cfe4ff;
}
:root[data-theme="dark"] .report-page .report-validity-group-card{
  background:var(--report-depth-1);
  border-color:var(--report-depth-border-1);
}
:root[data-theme="dark"] .report-page .report-validity-group-card > summary{
  color:#cfe4ff;
}
:root[data-theme="dark"] .report-page .tab-content{
  background:var(--report-depth-0);
}
:root[data-theme="dark"] .report-page #report-validity .ref-card{
  background:var(--report-depth-3);
  border-color:var(--report-depth-border-3);
}
:root[data-theme="dark"] .report-page #summaryReport .ov-section-card{
  background:var(--report-depth-1) !important;
  border-color:var(--report-depth-border-1) !important;
}
:root[data-theme="dark"] .report-page #summaryReport .ov-section-card .ref-card,
:root[data-theme="dark"] .report-page #summaryReport .ov-section-card details.audit[open],
:root[data-theme="dark"] .report-page #summaryReport .ov-section-card .ov-subnote{
  background:var(--report-depth-2) !important;
  border-color:var(--report-depth-border-2) !important;
}
:root[data-theme="dark"] .report-page #summaryReport .ov-section-card .ref-card .ov-subnote,
:root[data-theme="dark"] .report-page #summaryReport .ov-section-card details.audit[open] .ov-subnote,
:root[data-theme="dark"] .report-page #summaryReport .ov-section-card .ref-card details.audit[open]{
  background:var(--report-depth-3) !important;
  border-color:var(--report-depth-border-3) !important;
}
:root[data-theme="dark"] .report-page #report-validity a,
:root[data-theme="dark"] .report-page #summaryReport a{
  color:#8dc7ff;
}
:root[data-theme="dark"] .report-page #report-validity a:visited,
:root[data-theme="dark"] .report-page #summaryReport a:visited{
  color:#b8a7ff;
}
:root[data-theme="dark"] .report-page #report-validity a:hover,
:root[data-theme="dark"] .report-page #summaryReport a:hover{
  color:#c6e2ff;
}
:root[data-theme="dark"] .report-page #report-validity [style*="color:"]{
  color:var(--fg) !important;
}
:root[data-theme="dark"] .report-page .overview-heading,
:root[data-theme="dark"] .report-page .overview-label{
  color:#cfe4ff !important;
}
:root[data-theme="dark"] details.foldable{
  background:#19344f;
  border-color:var(--border);
}
:root[data-theme="dark"] .score-badge{
  background:#1f3e5d;
  border-color:#4b79a3;
  color:#d7e9ff;
}
:root[data-theme="dark"] .badge-verified{
  background:#204735;
  border-color:#3e7c5d;
  color:#ddf4e6;
}
:root[data-theme="dark"] .badge-likely{
  background:#1f3e5d;
  border-color:#4b79a3;
  color:#d7e9ff;
}
:root[data-theme="dark"] .badge-uncertain{
  background:#514022;
  border-color:#8a6d3f;
  color:#ffecc8;
}
:root[data-theme="dark"] .badge-suspected{
  background:#5a2b2b;
  border-color:#925050;
  color:#ffdede;
}
:root[data-theme="dark"] .conflict{
  background:#514022;
  border-left-color:#8a6d3f;
  color:#ffecc8;
}
:root[data-theme="dark"] .hallucination-alert{
  background:#5a2b2b;
  border-left-color:#925050;
  color:#ffdede;
}
:root[data-theme="dark"] .ref-order-bad{
  color:#ffdede;
  background:#5a2b2b;
}
:root[data-theme="dark"] .status.ok{ color:#8ed8a8; }
:root[data-theme="dark"] .status.bad{ color:#ff9c9c; }
:root[data-theme="dark"] dialog.confirm-dialog,
:root[data-theme="dark"] dialog#jobProgressDialog{
  background:#122233;
  color:var(--fg);
  border:1px solid var(--border);
}
:root[data-theme="dark"] #publicationStatusDialog{
  background:#122233;
  color:var(--fg);
}
:root[data-theme="dark"] .publication-status-dialog-lead{
  color:#c3cfdd;
}
:root[data-theme="dark"] .publication-status-dialog-heading{
  color:#e5edf6;
}
:root[data-theme="dark"] .publication-status-dialog-list{
  background:rgba(123, 89, 22, 0.18);
  border-color:rgba(223, 185, 109, 0.38);
}
:root[data-theme="dark"] .publication-status-issue-item{
  color:#e5edf6;
}
:root[data-theme="dark"] .publication-status-breakdown-item{
  background:rgba(79, 147, 223, 0.12);
  border-color:rgba(96, 155, 223, 0.34);
}
:root[data-theme="dark"] .publication-status-breakdown-value{
  color:#8fc2ff;
}
:root[data-theme="dark"] .publication-status-breakdown-label{
  color:#c3cfdd;
}
:root[data-theme="dark"] .publication-status-dialog-error{
  color:#ff9b9b;
}
:root[data-theme="dark"] #publicationStatusDialog .publication-status-confirm-btn{
  background:#3a86d1;
  box-shadow:0 10px 24px rgba(0, 0, 0, 0.24);
}
:root[data-theme="dark"] #publicationStatusDialog .publication-status-confirm-btn:hover{
  background:#5a9ee0;
}
:root[data-theme="dark"] #publicationStatusDialog .publication-status-confirm-btn:focus-visible{
  outline-color:rgba(143, 194, 255, 0.35);
}
:root[data-theme="dark"] #publicationStatusDialog .publication-status-confirm-btn:disabled{
  background:#506782;
}
:root[data-theme="dark"] .confirm-dialog p + p,
:root[data-theme="dark"] #jobProgressStatus,
:root[data-theme="dark"] .job-progress-note{
  color:#b7cee4;
}
:root[data-theme="dark"] .job-progress-wrap{
  background:#20364d;
  border-color:#375a7e;
}
:root[data-theme="dark"] dialog#jobProgressDialog.progress-cancelled #jobProgressStatus{
  color:#ffb3b3;
}
:root[data-theme="dark"] button.secondary{
  background:#27435f;
  border:1px solid #3f6487;
  color:#eaf3ff;
}
:root[data-theme="dark"] button.secondary:hover{
  background:#33597b;
}
:root[data-theme="dark"] .danger{
  background:#c74747;
  border:1px solid #e07a7a;
  color:#fff;
}
:root[data-theme="dark"] .danger:hover{
  background:#b53a3a;
}
:root[data-theme="dark"] .modal-content{
  background:#122233;
  color:var(--fg);
  border:1px solid var(--border);
}
:root[data-theme="dark"] .close-dialog-btn{
  background:rgba(18,34,51,0.92);
}
:root[data-theme="dark"] .modal-content a,
:root[data-theme="dark"] .modal-content-dialog a{
  color:#8dc7ff;
  text-decoration:underline;
  text-underline-offset:2px;
}
:root[data-theme="dark"] .modal-content a:visited,
:root[data-theme="dark"] .modal-content-dialog a:visited{
  color:#b8a7ff;
}
:root[data-theme="dark"] .modal-content a:hover,
:root[data-theme="dark"] .modal-content-dialog a:hover{
  color:#c6e2ff;
}
:root[data-theme="dark"] .modal-content a:focus-visible,
:root[data-theme="dark"] .modal-content-dialog a:focus-visible{
  outline:2px solid #8dc7ff;
  outline-offset:2px;
  border-radius:4px;
}
:root[data-theme="dark"] .style-list{ background:#0f2235; border-color:var(--border); }
:root[data-theme="dark"] .style-item{ color:#cde6ff; }
:root[data-theme="dark"] .style-item:hover,
:root[data-theme="dark"] .style-item[aria-selected="true"]{ background:#234564; }
:root[data-theme="dark"] .rc-breadcrumbs::after{
  border-bottom-color:#355777;
}
:root[data-theme="dark"] .rc-breadcrumbs ol{
  color:#a7bfd8;
  border-color:#355777;
  background:#19344f;
}
:root[data-theme="dark"] .rc-breadcrumbs-label{
  color:#97b2cf;
}
:root[data-theme="dark"] .rc-breadcrumbs li + li::before{
  color:#7f9fbe;
}
:root[data-theme="dark"] .rc-breadcrumbs a{
  color:#8dc3ff;
}
:root[data-theme="dark"] .rc-breadcrumbs [aria-current="page"]{
  color:#eaf3ff;
}
:root[data-theme="dark"] .tab-button{
  background:#1f3e5d;
  color:#cfe4ff;
  border:1px solid #4b79a3;
}
:root[data-theme="dark"] .tab-button:hover{
  background:#2a4a66;
  color:#eef6ff;
}
:root[data-theme="dark"] .tab-button.active{
  background:#2f7fd3;
  color:#eef6ff;
  border-color:#8dc7ff;
}
:root[data-theme="dark"] #clearBtn{
  background:#1f3e5d;
  border-color:#4b79a3;
  color:#cfe4ff;
}
:root[data-theme="dark"] #clearBtn:hover,
:root[data-theme="dark"] #clearBtn:focus-visible{
  background:#2a4a66;
  border-color:#6a97bf;
  color:#eef6ff;
}
:root[data-theme="dark"] #submitBtn{
  border-color:#8dc7ff;
}
:root[data-theme="dark"] #styleInput{
  background:#1b3650;
  color:#eaf3ff;
  border-color:#3f6386;
}
:root[data-theme="dark"] #styleInput::placeholder{
  color:#a6c3df;
}
:root[data-theme="dark"] #styleStatus{
  color:#b4cbe4 !important;
}
:root[data-theme="dark"] .style-clear-btn{
  color:#a6c3df;
}
:root[data-theme="dark"] .inline-metric{
  background:#19344f;
  border-color:#355777;
}
:root[data-theme="dark"] .inline-metric .label{ color:#c0d9f1; }
:root[data-theme="dark"] .inline-metric .value{ color:#e9f3ff; }
:root[data-theme="dark"] .inline-metric.metric-green{
  background:#204735;
  border-color:#3e7c5d;
}
:root[data-theme="dark"] .inline-metric.metric-amber{
  background:#514022;
  border-color:#8a6d3f;
}
:root[data-theme="dark"] .inline-metric.metric-red{
  background:#5a2b2b;
  border-color:#925050;
}
:root[data-theme="dark"] .jump-flash{
  background-color:#4f3d22;
  color:#ffe9bf !important;
  animation-name:rc-jump-pulse-dark;
}
:root[data-theme="dark"] .jump-flash .citation-highlight,
:root[data-theme="dark"] .jump-flash .live-blue{
  color:#ffe9bf !important;
}
@keyframes rc-jump-pulse-dark{
  0%   { background-color:#4f3d22; }
  50%  { background-color:#6a5230; }
  100% { background-color:#4f3d22; }
}
:root[data-theme="dark"] .citation-highlight,
:root[data-theme="dark"] .essay-preview .citation-highlight,
:root[data-theme="dark"] .full-report .citation-highlight,
:root[data-theme="dark"] .live-blue{
  color:#66b3ff !important;
  font-weight:700;
}
:root[data-theme="dark"] .theme-menu-button{
  background:var(--header-control-bg);
  color:var(--header-control-fg);
  border-color:var(--header-control-border);
}
:root[data-theme="dark"] .theme-menu-button:hover{
  background:var(--header-control-bg-hover);
  color:var(--header-control-fg-strong);
}
:root[data-theme="dark"] .to-top-btn,
:root[data-theme="dark"] .float-top-btn{
  background:#2a5479;
  color:#eff7ff;
  border-color:#6f98bf;
}
:root[data-theme="dark"] .to-top-btn:hover,
:root[data-theme="dark"] .float-top-btn:hover{
  background:#376792;
}
:root[data-theme="dark"] .theme-menu-dropdown{
  background:var(--header-control-bg);
  border-color:var(--header-control-border);
}
:root[data-theme="dark"] .theme-menu-dropdown button{
  color:#d4e9ff;
}
:root[data-theme="dark"] .theme-menu-dropdown button:hover,
:root[data-theme="dark"] .theme-menu-dropdown button:focus-visible{
  background:var(--header-control-bg-hover);
  color:#eef6ff;
}
:root[data-theme="dark"] .theme-menu-dropdown button[aria-checked="true"]{
  background:#2b5378;
  color:#eef6ff;
}
:root[data-theme="dark"] .theme-menu-separator{
  background:var(--header-control-border);
}
:root[data-theme="dark"] .account-menu-trigger{
  background:var(--header-control-bg);
  color:var(--header-control-fg);
  border-color:var(--header-control-border);
}
:root[data-theme="dark"] .account-menu-trigger:hover,
:root[data-theme="dark"] .account-menu-trigger:focus-visible{
  background:var(--header-control-bg-hover);
  color:var(--header-control-fg-strong);
}
:root[data-theme="dark"] .account-menu-dropdown{
  background:var(--header-control-bg);
  border-color:var(--header-control-border);
  box-shadow:0 18px 40px rgba(0,0,0,0.42);
}
:root[data-theme="dark"] .account-menu-meta{
  border-color:var(--header-control-border);
}
:root[data-theme="dark"] .account-menu-meta strong{
  color:#eef6ff;
}
:root[data-theme="dark"] .account-menu-meta span{
  color:#cde2f5;
}
:root[data-theme="dark"] .account-menu-link{
  background:var(--header-control-bg-hover);
  color:var(--header-control-fg);
  border-color:var(--header-control-border);
}
:root[data-theme="dark"] .account-menu-link:hover,
:root[data-theme="dark"] .account-menu-link:focus-visible{
  background:#2b5378;
  color:var(--header-control-fg-strong);
}
:root[data-theme="dark"] body.timeout-page{
  background:#0b1624;
  color:#d7e8fb;
}
:root[data-theme="dark"] .timeout-wrap{
  background:#122233;
  border-color:#2d4b68;
}
:root[data-theme="dark"] .timeout-page h1{ color:#86c1ff; }
:root[data-theme="dark"] .timeout-button{
  background:#2f7fd3;
  color:#eef6ff;
}
:root[data-theme="dark"] .timeout-button:hover{ background:#3c8ee5; }
:root[data-theme="dark"] #gate{
  background: radial-gradient(circle at top left, #0f1f30 0, #0b1624 55%, #0a1421 100%);
}
:root[data-theme="dark"] .gate-card{
  background:#122233;
  border-color:#2d4b68;
  box-shadow:0 12px 34px rgba(0,0,0,.45);
}
:root[data-theme="dark"] .gate-pill{
  background:#1f3e5d;
  color:#c6e2ff;
}
:root[data-theme="dark"] .gate-card h2{
  color:#86c1ff;
}
:root[data-theme="dark"] .gate-desc{
  color:#c0d7ef;
}
:root[data-theme="dark"] .gate-links{
  color:#a9c2dc;
}
:root[data-theme="dark"] .gate-link{
  color:#66b3ff;
}
:root[data-theme="dark"] .gate-link:hover{
  color:#8dc7ff;
}
:root[data-theme="dark"] #gatePassword{
  background:#15293d;
  color:#eaf3ff;
  border-color:#3f6386;
}
:root[data-theme="dark"] #gatePassword::placeholder{
  color:#a6c3df;
}
:root[data-theme="dark"] #gateBtn{
  background:#2f7fd3;
  color:#eef6ff;
}
:root[data-theme="dark"] #gateBtn:hover{
  background:#3c8ee5;
}

/* === Generic server-table objects (shared by history + batch) === */
.table-page .table-wrap{
  max-width:1280px;
  margin:20px auto;
  padding:0 28px 24px;
}
.table-toolbar{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin:0 0 10px;
}
.table-toolbar input,
.table-toolbar select{
  border:1px solid var(--border);
  border-radius:10px;
  min-height:42px;
  padding:9px 12px;
  background:var(--card);
  color:inherit;
  font-size:14px;
}
.table-toolbar input{
  min-width:260px;
  flex:1 1 320px;
}
.table-toolbar .btn-link-btn,
.table-toolbar button{
  min-height:42px;
  border-radius:10px;
  padding:9px 14px;
  font-size:14px;
  font-weight:700;
}
.table-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  box-shadow:0 6px 18px rgba(0,0,0,0.05);
}
.table-pagination{
  margin-top:12px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--card-pale);
  justify-content:center;
  gap:12px;
}
.table-page-status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:210px;
  padding:6px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--card);
  color:#4f627d;
  font-weight:600;
}
.table-pagination button{
  min-width:92px;
  padding:7px 14px;
  border:1px solid #9ac4ff;
  border-radius:10px;
  background:#e9f1ff;
  color:var(--brand);
  font-weight:700;
  font-size:13px;
  line-height:1.2;
  transition:background-color .15s ease, color .15s ease, border-color .15s ease;
}
.table-pagination button:hover:not(:disabled),
.table-pagination button:focus-visible:not(:disabled){
  background:#d0e7ff;
  border-color:#6aa7ff;
  color:var(--accent-2);
}
.table-pagination button:disabled{
  background:#eef1f6;
  border-color:#c8d0dc;
  color:#8a99af;
  cursor:not-allowed;
  opacity:1;
}
.data-table{
  width:100%;
  border-collapse:collapse;
}
.data-table th,
.data-table td{
  text-align:left;
  vertical-align:top;
  padding:11px 10px;
  border-bottom:1px solid var(--border);
}
.data-table th{
  position:sticky;
  top:0;
  z-index:1;
  background:color-mix(in srgb, var(--card) 92%, var(--card-pale) 8%);
  color:var(--brand);
  font-size:13px;
  font-weight:700;
  letter-spacing:.01em;
}
.data-table tbody tr:hover td{
  background:color-mix(in srgb, var(--card-pale) 62%, transparent);
}
.data-table td code{
  font-size:12px;
  overflow-wrap:anywhere;
}
:root[data-theme="dark"] .table-toolbar input,
:root[data-theme="dark"] .table-toolbar select{
  background:#102133;
  border-color:#2b445d;
  color:#cde6ff;
}
:root[data-theme="dark"] .table-card{
  box-shadow:0 8px 22px rgba(0,0,0,0.35);
}
:root[data-theme="dark"] .table-pagination{
  background:#102133;
  border-color:#2b445d;
}
:root[data-theme="dark"] .table-page-status{
  background:#0f1f30;
  border-color:#2b445d;
  color:#a6bdd7;
}
:root[data-theme="dark"] .table-pagination button{
  background:#19314a;
  border-color:#3b6a95;
  color:#cde6ff;
}
:root[data-theme="dark"] .table-pagination button:hover:not(:disabled),
:root[data-theme="dark"] .table-pagination button:focus-visible:not(:disabled){
  background:#234564;
  border-color:#4c81b2;
  color:#e6f3ff;
}
:root[data-theme="dark"] .table-pagination button:disabled{
  background:#132538;
  border-color:#24384d;
  color:#7f98b2;
}
:root[data-theme="dark"] .data-table th{
  background:color-mix(in srgb, #102133 88%, #19344f 12%);
  color:#cde6ff;
}
:root[data-theme="dark"] .data-table tbody tr:hover td{
  background:color-mix(in srgb, #19344f 68%, transparent);
}

@media (max-width: 900px){
  .table-card{
    border-radius:12px;
    padding:8px;
  }
  .table-toolbar{
    gap:8px;
  }
  .table-toolbar input,
  .table-toolbar select,
  .table-toolbar .btn-link-btn,
  .table-toolbar button{
    width:100%;
    font-size:14px;
  }
  .data-table th,
  .data-table td{
    padding:10px 8px;
  }
}

/* === Mobile nav drawer + responsive hardening === */
:root{
  --nav-surface: var(--card);
  --nav-surface-alt: var(--card-pale);
  --nav-border: var(--border);
  --nav-title: var(--brand);
  --nav-section-separator: rgba(11, 64, 128, 0.12);
  --nav-link-bg: #ffffff;
  --nav-link-fg: var(--brand);
  --nav-link-border: #bfd3ea;
  --nav-link-hover: #eef5ff;
  --nav-link-shadow: 0 6px 14px rgba(10, 55, 104, 0.06);
  --nav-link-active-bg: var(--accent);
  --nav-link-active-fg: #ffffff;
  --nav-link-active-border: var(--accent);
}
.nav-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:4px;
  width:40px;
  height:40px;
  border:1px solid var(--top-pill-border);
  border-radius:6px;
  background:var(--top-pill-bg);
  color:var(--top-pill-fg);
  cursor:pointer;
}
.nav-toggle[aria-expanded="true"]{
  background:var(--top-pill-bg-hover);
}
.nav-toggle:hover,
.nav-toggle:focus-visible{
  background:var(--top-pill-bg-hover);
}
.nav-toggle-bar{
  width:20px;
  height:2px;
  border-radius:2px;
  background:currentColor;
}
.nav-backdrop{
  position:fixed;
  inset:0;
  z-index:10070;
  background:rgba(4, 14, 26, 0.45);
}
.nav-backdrop[hidden]{
  display:none !important;
}
.nav-drawer{
  position:fixed;
  top:0;
  right:0;
  bottom:0;
  width:min(370px, calc(100vw - 16px));
  background:var(--nav-surface);
  color:var(--fg);
  border-left:1px solid var(--nav-border);
  box-shadow:-8px 0 28px rgba(0,0,0,0.2);
  z-index:10080;
  display:flex;
  flex-direction:column;
  padding:max(12px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  overflow:auto;
}
.nav-drawer[hidden]{
  display:none !important;
}
.nav-drawer-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
  padding-bottom:8px;
  border-bottom:1px solid var(--nav-border);
}
.nav-drawer-title{
  margin:0;
  font-size:14px;
  font-weight:700;
  letter-spacing:.02em;
  text-transform:uppercase;
  color:var(--nav-title);
}
.nav-close{
  min-height:34px;
  border:1px solid var(--nav-link-active-border);
  border-radius:12px;
  background:var(--nav-link-active-bg);
  color:var(--nav-link-active-fg);
  padding:4px 12px;
  font-weight:700;
  font-size:.875rem;
  line-height:1.2;
  cursor:pointer;
  box-shadow:var(--nav-link-shadow);
}
.nav-close:hover,
.nav-close:focus-visible{
  background:var(--accent-2);
  color:#ffffff;
}
.nav-sections{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.nav-section{
  border:1px solid var(--nav-border);
  border-radius:12px;
  background:var(--nav-surface-alt);
  padding:0;
  overflow:hidden;
}
.nav-section + .nav-section{
  position:relative;
}
.nav-section + .nav-section::before{
  content:"";
  position:absolute;
  top:-7px;
  left:14px;
  right:14px;
  height:1px;
  background:var(--nav-section-separator);
}
.nav-section summary{
  list-style:none;
}
.nav-section summary::-webkit-details-marker{
  display:none;
}
.nav-section-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  font-size:.6875rem;
  font-weight:700;
  letter-spacing:.02em;
  text-transform:uppercase;
  color:var(--tagline-color);
  margin:0;
  cursor:pointer;
}
.nav-section-title::after{
  content:"+";
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:20px;
  height:20px;
  border-radius:999px;
  background:rgba(0, 102, 204, 0.08);
  color:var(--accent);
  font-size:14px;
  line-height:1;
  font-weight:800;
  flex:0 0 auto;
}
.nav-section[open] > .nav-section-title{
  border-bottom:1px solid var(--nav-border);
}
.nav-section[open] > .nav-section-title::after{
  content:"-";
}
.nav-section-body{
  padding:10px;
}
.nav-links,
.nav-actions{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.nav-link,
.nav-action{
  min-height:40px;
  border:1px solid var(--nav-link-border);
  border-radius:12px;
  background:var(--nav-link-bg);
  color:var(--nav-link-fg);
  text-decoration:none;
  padding:8px 12px;
  display:flex;
  align-items:center;
  font-size:.875rem;
  line-height:1.2;
  font-weight:700;
  box-sizing:border-box;
  box-shadow:var(--nav-link-shadow);
  transition:background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.nav-action{
  width:100%;
  text-align:left;
  cursor:pointer;
  font-family:inherit;
}
.nav-link:hover,
.nav-link:focus-visible,
.nav-action:hover,
.nav-action:focus-visible{
  background:var(--nav-link-hover);
  color:var(--brand-strong);
  border-color:var(--accent);
  transform:translateY(-1px);
}
.nav-link[aria-current="page"]{
  border-color:var(--nav-link-active-border);
  background:var(--nav-link-active-bg);
  color:var(--nav-link-active-fg);
  box-shadow:0 8px 18px rgba(0, 102, 204, 0.18);
}
body.nav-open{
  overflow:hidden;
}

.mobile-form-toggle{
  display:none;
}

@media (max-width: 900px){
  .essay-card-header{
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:8px;
  }
  .essay-card-header .header-actions{
    margin-left:0;
    width:100%;
    display:flex;
    align-items:center;
    justify-content:flex-start;
    flex-wrap:nowrap;
    gap:8px;
    overflow-x:auto;
    padding-bottom:2px;
  }
  .essay-card-header .header-actions .tabs{
    margin-top:0;
    display:flex;
    align-items:center;
    flex-wrap:nowrap;
    gap:8px;
  }
  .essay-card-header .header-actions .tab-button,
  .essay-card-header .header-actions .mobile-form-toggle{
    flex:0 0 auto;
    white-space:nowrap;
  }
  header{
    align-items:flex-start;
    padding:6px 12px;
    gap:10px;
  }
  .header-main{
    gap:10px;
  }
  .header-right{
    margin-left:auto;
  }
  .account-menu-name{
    display:none;
  }
  .logo{
    width:172px;
    height:58px;
  }
  .rc-breadcrumbs{
    padding:0 12px 4px;
    margin-top:2px;
  }
  .page{
    padding:12px 12px var(--workspace-bottom-gap);
  }
  .pane-title-row{
    flex-wrap:wrap;
    gap:6px;
    margin-bottom:10px;
  }
  .pane-title-row #newEssayBtn{
    white-space:normal;
  }
  .stylebar{
    gap:8px;
  }
  .stylebar .style-picker-pane{
    flex:1 1 100%;
    min-width:0;
    max-width:none;
  }
  .workspace-context-picker{
    flex:1 1 100%;
    min-width:0;
  }
  .stylebar #styleStatus{
    flex:1 1 100%;
    white-space:normal;
  }
  .stylebar .style-credits-chip{
    flex:0 0 auto;
  }
  #submitBtn{
    margin-left:0;
    width:auto;
    min-height:44px;
  }
  .tab-button{
    min-height:44px;
    padding:10px 12px;
  }
  .mobile-form-toggle{
    display:none;
  }
  body.workspace-has-results .mobile-form-toggle{
    display:inline-flex;
  }
  body#root.unlocked .essay-card.mobile-form-collapsed > form{
    display:none;
  }
  .essay-card.mobile-form-collapsed .stylebar{
    margin-bottom:4px;
  }
  .metric .label{
    white-space:normal;
  }
  .btn-row{
    flex-wrap:nowrap;
  }
  .btn-row #clearBtn{
    flex:0 0 auto;
  }
  .btn-row #submitBtn{
    flex:1 1 auto;
  }

  /* Unlock mobile viewport behavior for workspace pages. */
  body#root.unlocked{
    height:auto;
    min-height:100%;
    max-height:none;
    overflow:auto;
    grid-template-rows:auto auto 1fr auto !important;
  }
  body#root.unlocked #app{
    height:auto;
    min-height:0;
    max-height:none;
    overflow:visible;
    grid-template-rows:auto auto auto;
  }
  body#root.unlocked #app > .page{
    height:auto;
    max-height:none;
    overflow:visible;
    padding-bottom:16px;
  }
  body#root.unlocked #app > .page > .split{
    height:auto;
    max-height:none;
    overflow:visible;
    gap:12px;
  }
  body#root.unlocked #app > .page > .split > .pane{
    height:auto;
    min-height:0;
  }
  body#root.unlocked #app > .page > .split > .pane > .content{
    overflow:visible;
    height:auto;
    max-height:none;
  }
  .split > .pane,
  .split > .sidebar,
  .split > .resizer{
    grid-column:1;
  }
  .sidebar,
  #split > .sidebar{
    position:static;
    top:auto;
    max-height:none;
    min-width:0;
    width:100%;
    padding:0;
    overflow:visible;
  }
  .table-page .table-wrap,
  .history-page .wrap,
  .report-page .wrap{
    padding:0 12px 20px;
    width:min(1320px, calc(100vw - 24px));
  }
  .table-toolbar input,
  .table-toolbar select,
  .history-toolbar input,
  .history-toolbar select{
    min-width:0;
    flex:1 1 100%;
  }
  .table-card,
  .batch-card,
  .history-page .card{
    overflow-x:hidden;
  }
  .batch-table.data-table,
  .history-page #historyTable.data-table{
    min-width:0;
    table-layout:fixed;
  }
  .history-page #historyTable th:nth-child(2),
  .history-page #historyTable td:nth-child(2){
    display:none;
  }
  .history-page #historyTable th:nth-child(1),
  .history-page #historyTable td:nth-child(1){
    width:31%;
  }
  .history-page #historyTable th:nth-child(5),
  .history-page #historyTable td:nth-child(5){
    width:60px;
    text-align:right;
  }
  .history-page #historyTable td:nth-child(1),
  .history-page #historyTable td:nth-child(3),
  .history-page #historyTable td code{
    overflow-wrap:anywhere;
    word-break:break-word;
  }
.history-page #historyTable .actions{
    justify-content:flex-end;
    gap:6px;
  }
}

body[data-table-density="compact"] .data-table th,
body[data-table-density="compact"] .data-table td{
  padding-top:10px;
  padding-bottom:10px;
}

body[data-table-density="compact"] .history-inline-metric,
body[data-table-density="compact"] .report-page .kv .k,
body[data-table-density="compact"] .report-page .kv .v{
  font-size:.94rem;
}

@media (max-width: 600px){
  .nav-drawer{
    width:min(336px, calc(100vw - 10px));
    padding:max(10px, env(safe-area-inset-top)) 9px max(12px, env(safe-area-inset-bottom));
  }
  .nav-link,
  .nav-action{
    font-size:.875rem;
    min-height:34px;
  }
  .rc-breadcrumbs ol{
    border-radius:12px;
    width:100%;
  }
  .report-page h1,
  .history-page h1{
    font-size:24px;
  }
}

@media (max-width: 420px){
  .nav-drawer{
    width:calc(100vw - 6px);
  }
  .nav-section{
    padding:7px;
  }
  .tab-button{
    width:100%;
  }
}

:root[data-theme="dark"] .nav-backdrop{
  background:rgba(0, 0, 0, 0.56);
}
:root[data-theme="dark"]{
  --nav-surface:#102133;
  --nav-surface-alt:#15293d;
  --nav-border:#2d4b68;
  --nav-title:#cde6ff;
  --nav-section-separator:rgba(143, 194, 255, 0.18);
  --nav-link-bg:#18324a;
  --nav-link-fg:#eaf3ff;
  --nav-link-border:#315676;
  --nav-link-hover:#224666;
  --nav-link-shadow:0 1px 0 rgba(255,255,255,0.03);
  --nav-link-active-bg:#2d78c8;
  --nav-link-active-fg:#f5fbff;
  --nav-link-active-border:#4f99e4;
}
:root[data-theme="dark"] .nav-drawer{
  box-shadow:-8px 0 28px rgba(0,0,0,0.5);
}
:root[data-theme="dark"] .nav-section-title{
  color:#a6bdd7;
}
:root[data-theme="dark"] .nav-section-title::after{
  background:rgba(143, 194, 255, 0.14);
  color:#8dc7ff;
}
