/* RC56: the Results Saved History entry point shares the heading row,
   and wraps without pushing the numbered heading/divider out of alignment. */
#results-panel>.major-section-heading .results-history-button{flex:0 0 auto;max-width:100%;white-space:normal;text-align:center}
@media(max-width:560px){#results-panel>.major-section-heading .results-history-button{font-size:12px;padding:8px 10px}}

/* RC59: Saved History sort glyphs belong to their individual header cells,
   not the far edge of the modal. DataTables 1.13 renders a ::before/::after
   pair with position:absolute; position:static caused both to float. */
.dialog[data-modal="saved-users"] .saved-users-table-wrap thead th {
  position:relative;
  padding-right:24px;
}
.dialog[data-modal="saved-users"] .saved-users-table-wrap thead th.sorting_disabled::before,
.dialog[data-modal="saved-users"] .saved-users-table-wrap thead th.sorting_disabled::after {
  content:none!important;
  display:none!important;
}
/* Launchers share the title's first-row center, with no relative offsets. */
.scan-mode-heading > #saved-users,
#results-panel > .major-section-heading > .results-history-button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  align-self:flex-start;
  min-height:36px;
  margin:0;
  line-height:1.25;
  text-align:center;
}
/* The Scan Setup launcher belongs to this heading even when Baseline History is hidden.
   Let it wrap cleanly rather than forcing page-wide horizontal scrolling. */
.scan-mode-heading > #saved-users {max-width:100%;white-space:normal;overflow-wrap:anywhere;}
@media(max-width:560px){
  .scan-mode-heading > #saved-users,
  #results-panel > .major-section-heading > .results-history-button{min-height:44px}
}
@media(max-width:480px){.scan-mode-heading > #saved-users{font-size:12px;padding:7px 9px}}

/* Keep the manual/automatic save state from resizing neighboring controls. */
#save-baseline {
  min-width:236px;
  min-height:36px;
}


/* RC61: compact Simple ratings are three readable source-labelled tiles.
   The period-start tile is highlighted in green; labels wrap safely for
   long scanned usernames without resizing neighboring cards. */
.simple-results-list .simple-rating,
.rating-tooltip-compact .simple-rating,
.older-game .simple-rating{display:block;min-width:0;width:100%;line-height:1.3}
.simple-rating-type{display:block;margin:2px 0 5px;font-weight:800;font-size:12px;color:var(--ink)}
.simple-rating-tiles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;min-width:0}
.simple-rating-tile{display:flex;flex-direction:column;justify-content:center;min-width:0;min-height:64px;padding:7px 4px;border:1px solid var(--edge);border-radius:7px;background:var(--fill)}
.simple-rating-tile strong{font-size:17px;line-height:1.1;font-weight:850;font-variant-numeric:tabular-nums;color:var(--ink)}
.simple-rating-tile span{font-size:10px;line-height:1.28;font-weight:650;color:var(--muted);overflow-wrap:anywhere;word-break:normal;hyphens:auto}
.simple-rating-start{background:color-mix(in srgb,var(--green) 16%,var(--fill));border-color:var(--green)}
.simple-rating-start strong{color:var(--green)}
.simple-rating-start span{color:var(--ink)}
@media(max-width:430px){.simple-rating-tiles{gap:4px}.simple-rating-tile{padding:6px 3px}.simple-rating-tile strong{font-size:15px}}

/* RC65: three Simple rating tiles share a fixed visual number row and a
   centered caption row, with the observation date anchored to the bottom.
   Red status highlighting is reserved for explicitly flagged/closed types. */
.simple-rating-tiles{align-items:stretch}
.simple-rating-tile{
  display:grid;
  grid-template-rows:24px minmax(0,1fr) 18px;
  align-items:center;
  justify-items:center;
  gap:4px;
  min-height:116px;
  height:100%;
  padding:8px 4px 7px;
  text-align:center;
}
.simple-rating-tile .simple-rating-value{align-self:center;line-height:24px;font-variant-numeric:tabular-nums}
.simple-rating-tile .simple-rating-caption{align-self:center;font-size:10px;line-height:1.23}
.simple-rating-tile .simple-rating-date{
  align-self:end;
  font-size:9px;
  line-height:16px;
  font-weight:500;
  color:var(--muted);
  white-space:nowrap;
  max-width:100%;
  letter-spacing:-0.02em;
}
.simple-rating-tile.simple-rating-latest.is-status-red{
  background:color-mix(in srgb,var(--red) 18%,var(--fill));
  border-color:var(--red);
}
.simple-rating-tile.simple-rating-latest.is-status-red .simple-rating-value{color:var(--red)}
/* Verified-open profiles are blue; unverified observations remain neutral. */
.simple-rating-tile.simple-rating-latest.is-status-blue{
  background:color-mix(in srgb,var(--blue) 15%,var(--fill));
  border-color:var(--blue);
}
.simple-rating-tile.simple-rating-latest.is-status-blue .simple-rating-value,
.simple-rating-tile.simple-rating-latest.is-status-blue .simple-rating-caption,
.simple-rating-tile.simple-rating-latest.is-status-blue .simple-rating-date{color:var(--blue)}
@media(max-width:430px){.simple-rating-tile .simple-rating-date{font-size:8px}}

/* Keep rating, description, and observation date close together.  Earlier
   fixed row/minimum heights left empty bands inside short cards.  Let content
   determine height, including long usernames that wrap on small screens. */
.simple-rating-tile{
  min-height:0;
  height:auto;
  grid-template-rows:auto auto auto;
  align-content:center;
  gap:1px;
  padding:4px;
}
.simple-rating-tile .simple-rating-value{line-height:20px}
.simple-rating-tile .simple-rating-caption{line-height:1.15}
.simple-rating-tile .simple-rating-date{align-self:center;line-height:13px}
/* Modern browsers share the three content-sized rows across all tiles, so
   caption wrapping does not cause dates or rating numbers to misalign. */
@supports (grid-template-rows:subgrid){
  .simple-rating-tiles{grid-template-rows:repeat(3,auto);row-gap:0}
  .simple-rating-tile{grid-row:span 3;grid-template-rows:subgrid;align-content:normal}
}

/* RC64: one stable tab edge for Results and all Saved History tabs.
   Older negative bottom margins and active padding offsets caused overlapping
   strokes at the strip baseline and inconsistent tab bottoms. */
.results-view-tabs, .tabs {
  align-items:flex-end;
  gap:6px;
  border-bottom:1px solid var(--edge);
}
.results-view-tabs > button, .tabs > button,
.results-view-tabs > button:not([aria-selected=true]), .tabs > button:not([aria-selected=true]) {
  position:relative;
  box-sizing:border-box;
  height:44px;
  min-height:44px;
  margin:0;
  padding:10px 17px 11px;
  border:1px solid var(--edge);
  border-radius:9px 9px 0 0;
  transform:none;
  box-shadow:none;
}
.results-view-tabs > button[aria-selected=true], .tabs > button[aria-selected=true] {
  height:44px;
  min-height:44px;
  margin:0;
  padding:10px 17px 11px;
  border:1px solid var(--blue);
  border-bottom-color:var(--paper);
  background:var(--paper);
  box-shadow:inset 0 3px var(--blue);
  z-index:1;
}
.results-view-tabs > button[aria-selected=true]::after,
.tabs > button[aria-selected=true]::after {
  content:"";
  position:absolute;
  height:1px;
  bottom:-1px;
  left:1px;
  right:1px;
  background:var(--paper);
  pointer-events:none;
}
/* The encounter reference rating is deliberately neutral grey: the starting
   rating remains blue and the terminal rating remains red. */
.simple-spark-encounter-rating {
  fill:var(--muted);
  font-size:11px;
}

/* RC66: The editorial “hmm” video opens on demand in a floating in-page player. */
.hmm-video-link{display:inline;border:0;padding:0;margin:0;background:none;color:var(--blue);font:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer}
.hmm-video-link:hover{filter:none;color:var(--ink)}
.hmm-video-link:focus-visible{outline:2px solid var(--blue);outline-offset:3px;border-radius:2px}
.hmm-video-window{position:fixed;right:18px;bottom:18px;z-index:520;width:min(420px,calc(100vw - 24px));height:295px;min-width:min(280px,calc(100vw - 24px));min-height:240px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);display:flex;flex-direction:column;overflow:auto;resize:both;border:1px solid var(--edge);border-radius:11px;background:var(--paper);color:var(--ink);box-shadow:0 13px 48px #0009}
.hmm-video-titlebar{display:flex;align-items:center;gap:8px;flex:0 0 auto;min-height:38px;padding:5px 8px 5px 12px;background:var(--fill);border-bottom:1px solid var(--edge);user-select:none;cursor:move;touch-action:none}
.hmm-video-title{font-weight:700;font-size:12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1}
.hmm-video-external{font-size:11px;color:var(--blue);white-space:nowrap;cursor:pointer}
.hmm-video-close{flex:0 0 auto;padding:3px 7px;min-width:29px;min-height:27px;line-height:1}
.hmm-video-content{flex:1 1 auto;min-height:0;background:#000}
.hmm-video-content iframe{display:block;width:100%;height:100%;border:0}
.hmm-video-hint{flex:0 0 auto;font-size:10px;line-height:17px;padding:0 8px;color:var(--muted);text-align:right}
@media(max-width:560px){.hmm-video-window{right:10px;bottom:10px;width:min(360px,calc(100vw - 20px));height:262px}}

/* RC67: Keep existing Simple status categories visible when filters exclude
   their matches, instead of removing buttons from the rail. Dim only the
   unavailable category control, never the website toggles or dividers. */
.simple-category-rail button[data-simple-filter][data-simple-availability="site-filtered"],
.simple-category-rail button[data-simple-filter][data-simple-availability="empty"]{
  opacity:.4;
}
.simple-category-rail button[data-simple-filter][data-simple-availability="site-filtered"][aria-pressed="true"],
.simple-category-rail button[data-simple-filter][data-simple-availability="empty"][aria-pressed="true"]{
  opacity:.62;
}
.simple-category-rail button[data-simple-filter][data-simple-availability="site-filtered"]:hover,
.simple-category-rail button[data-simple-filter][data-simple-availability="empty"]:hover,
.simple-category-rail button[data-simple-filter][data-simple-availability="site-filtered"]:focus-visible,
.simple-category-rail button[data-simple-filter][data-simple-availability="empty"]:focus-visible{
  opacity:.83;
}


/* RC70: make rating-history authorization limits visible near scan usernames. */
.field > .lichess-rating-history-warning {
  display:block;
  margin:8px 0 0;
  font-size:11px;
  font-family:"Alegreya Sans SC",system-ui,sans-serif;
  font-variant-caps:all-small-caps;
  font-weight:800;
  letter-spacing:.035em;
  line-height:1.45;
  color:var(--amber);
}
.field > .lichess-rating-history-warning[hidden]{display:none!important}

/* b2: non-sensitive, per-run diagnostic of experimental Lichess cookie fetch. */
.field > .lichess-cookie-test-status{display:block;color:var(--muted);font-size:11px;line-height:1.4;margin-top:5px}
.field > .lichess-cookie-test-status[hidden]{display:none!important}

/* 2.0.1-rc.1: real small-cap forms from Alegreya Sans SC where requested.
   Local system sans-serif remains legible if external font hosting is blocked. */
/* User-supplied black Lichess artwork is shown as white on dark themes.
   Keep the SVG file byte-identical; only CSS affects its presentation. */
.provider-brand-icon[src$="lichess-svgrepo-com.svg"],
.site-toggle-icon[src$="lichess-svgrepo-com.svg"],
.oauth-brand-icon[src$="lichess-svgrepo-com.svg"],
.provider-api-button-logo[src$="lichess-svgrepo-com.svg"]{filter:invert(1)}
:root:is([data-theme="light"],[data-theme="github-light"],[data-theme="catppuccin-latte"],[data-theme="nord-light"],[data-theme="dracula-alucard"],[data-theme="rose-pine-dawn"],[data-theme="tokyo-light"],[data-theme="solarized-light"],[data-theme="gruvbox-light"],[data-theme="everforest-light"],[data-theme="everforest-light-soft"],[data-theme="everforest-light-hard"],[data-theme="ayu-light"]) :is(.provider-brand-icon,.site-toggle-icon,.oauth-brand-icon,.provider-api-button-logo)[src$="lichess-svgrepo-com.svg"]{filter:none}
@media(prefers-color-scheme:light){
  :root[data-theme="system"] :is(.provider-brand-icon,.site-toggle-icon,.oauth-brand-icon,.provider-api-button-logo)[src$="lichess-svgrepo-com.svg"]{filter:none}
}

/* RC3: use freed space from the range dropdown for wider scan buttons. */
@media(min-width:1080px){
  .scan-grid{grid-template-columns:minmax(255px,1.6fr) max-content minmax(265px,1.15fr)}
  .scan-grid>.field:nth-child(2){width:max-content;max-width:100%}
  #scope{width:max-content;min-width:0;max-width:100%;padding-right:32px}
  .scan-actions button{white-space:nowrap}
  .scan-actions button>span{white-space:nowrap}
}
@media(min-width:561px) and (max-width:1079px){
  .scan-grid{grid-template-columns:minmax(0,1fr) max-content}
  .scan-grid>.scan-actions{grid-column:1/-1;display:flex;padding-top:0}
  #scope{width:max-content;max-width:100%}
}
.setup-bottom-actions{display:flex;align-items:center;gap:8px}
.setup-bottom-actions>.setup-lichess-auth{margin-left:auto;white-space:nowrap;font-weight:700}
.setup-lichess-auth.authorized{color:var(--green);border-color:var(--green);background:color-mix(in srgb,var(--green) 10%,var(--fill))}
.setup-lichess-auth.authorization-needed{color:var(--red);border-color:var(--red);background:color-mix(in srgb,var(--red) 9%,var(--fill))}
@media(max-width:560px){.setup-bottom-actions>.setup-lichess-auth{margin-left:0}}

.hmm-video-hint{height:auto;line-height:1.3;padding:6px 8px;text-align:left}
.hmm-video-hint a{color:var(--blue)}

/* RC3: Advanced rating hover shows game type and encounter count on one
   compact heading row; do not repeat the type in parentheses or above it. */
.rating-chip-tooltip .rating-tooltip-inline-heading{
  display:flex;flex-direction:row;align-items:baseline;justify-content:flex-start;
  flex-wrap:wrap;column-gap:11px;row-gap:2px;min-width:0;line-height:1.3;
  margin-bottom:5px;
}
.rating-chip-tooltip .rating-tooltip-inline-heading strong{flex:0 0 auto;font-size:12px}
.rating-chip-tooltip .rating-tooltip-count{font-size:11px;overflow-wrap:anywhere;color:var(--muted)}
.rating-chip-tooltip .rating-tooltip-compact .simple-rating-type{display:none}

/* RC4: Keep the editorial footer line in the same compact signature column
   as the contact name and address instead of spanning the full-width panel. */
.main-contact .contact-legal{inline-size:100%;max-inline-size:390px;margin-inline-start:0;line-height:1.5}


/* RC8: Desktop actions remain in the header; mobile uses a single disclosure.
   Footer buttons are semantic buttons, visually presented as compact site links. */
.mobile-header-menu{display:none;position:relative;z-index:15}
.mobile-header-menu>summary{list-style:none;display:inline-flex;align-items:center;gap:8px;padding:9px 12px;border:1px solid var(--edge);border-radius:8px;background:var(--fill);color:var(--ink);font-weight:650;cursor:pointer;min-height:40px}
.mobile-header-menu>summary::-webkit-details-marker{display:none}
.mobile-header-menu[open]>summary{border-color:var(--blue);color:var(--blue)}
.mobile-header-menu nav{position:absolute;top:calc(100% + 5px);right:0;width:min(250px,calc(100vw - 24px));max-height:min(65vh,440px);overflow:auto;display:flex;flex-direction:column;gap:3px;background:var(--paper);border:1px solid var(--edge);border-radius:10px;padding:7px;box-shadow:0 12px 35px #0007;text-align:left}
.mobile-header-menu nav button{display:block;width:100%;text-align:left;background:transparent;border:1px solid transparent;padding:11px 12px;min-height:42px;white-space:normal}
.mobile-header-menu nav button:hover,.mobile-header-menu nav button:focus-visible{background:var(--fill);border-color:var(--edge)}
.footer-action-nav{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:5px 0;margin:5px 0 0;padding:8px 10px 12px;color:var(--muted);font-size:12px}
.footer-action-nav button{background:transparent;border:0;border-radius:2px;box-shadow:none;padding:4px 9px;color:var(--muted);font-size:12px;font-weight:500;min-height:30px;white-space:nowrap;text-decoration:none}
.footer-action-nav button:hover{color:var(--blue);text-decoration:underline;filter:none}
.footer-action-nav button+button:before{content:'·';position:relative;left:-9px;color:var(--muted);pointer-events:none}
@media(max-width:980px){
  .header-right nav.header-desktop-nav{display:none}
  .mobile-header-menu{display:block}
  .top-bar{display:flex;justify-content:space-between;gap:10px}
  .brand{min-width:0;flex-wrap:wrap;row-gap:3px}
  .brand b{font-size:19px}
  .brand img{width:70px;height:30px;flex-basis:70px}
  .header-right{margin-top:0;text-align:right;flex:0 0 auto}
  .header-right>small{font-size:10px;max-width:150px;line-height:1.35}
  .footer-action-nav{padding-inline:3px}
  .footer-action-nav button{padding:7px 8px;min-height:36px}
  .footer-action-nav button+button:before{left:-8px}
}
/* RC8 visual polish: avoid orphaned separators when footer links wrap. */
.footer-action-nav{gap:3px 18px}
.footer-action-nav button{padding-left:0;padding-right:0}
.footer-action-nav button+button:before{content:none}
@media(max-width:760px){
  .brand{flex-wrap:nowrap}
  .brand>div{min-width:0}
  .brand b{white-space:nowrap}
  .brand small{white-space:normal}
  .footer-action-nav{gap:1px 16px}
}
@media(max-width:500px){.header-right>small{display:none}}

/* RC9: Keep both start/finish criteria checkboxes on the same left guide.
   Reserve a fixed gutter for the help icon before flex items wrap. */
.range-criteria{position:relative;padding-inline-start:28px;align-items:center;min-width:0}
.range-criteria .date-criteria-help{position:absolute;inset-inline-start:0;top:0}
.range-criteria .checkbox{min-width:0;max-width:100%;flex:0 1 auto;align-items:center}
.range-criteria .checkbox input[type=checkbox]{flex:0 0 auto;margin:0}

/* RC9: medium desktop widths need the 2-row scan controls. The previous
   900px 3-column threshold exceeded the available content width. */
/* Provider-specific OAuth expiry fields: compact even on narrow settings dialogs. */
.authorization-controls input[type=number]{width:96px;min-width:85px;flex:0 1 96px}
.authorization-controls select{width:93px;min-width:78px;flex:0 1 93px}
.authorization-controls .authorization-status{flex:1 1 145px}

/* RC13: a compact, two-choice mode rail below the header logo and title.
   The banner owns the selector; Scan Setup keeps its own heading and busy state. */
.top-bar{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:16px;row-gap:5px;align-items:center}
.top-bar>.brand{grid-column:1;grid-row:1;min-width:0}
.top-bar>.header-right{grid-column:2;grid-row:1 / span 2;align-self:center;min-width:0}
.header-mode-row{grid-column:1;grid-row:2;display:flex;align-items:center;min-width:0}
.scan-mode-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.scan-mode-toggle{display:inline-grid;grid-template-columns:1fr 1fr;align-items:stretch;min-width:174px;border:1px solid var(--edge);border-radius:8px;overflow:hidden;white-space:nowrap;background:var(--fill)}
.scan-mode-toggle button{border:0;border-radius:0;margin:0;padding:3px 12px;min-height:30px;line-height:1.25;font-size:12px;color:var(--ink);background:transparent;font-weight:650;touch-action:manipulation}
.scan-mode-toggle button+button{border-left:1px solid var(--edge)}
.scan-mode-toggle button[aria-pressed="true"]{background:var(--blue);color:var(--paper);box-shadow:inset 0 -2px 0 color-mix(in srgb,var(--ink) 15%,transparent)}
.scan-mode-toggle button:focus-visible{outline:2px solid var(--blue);outline-offset:-3px;position:relative;z-index:1}
@media(max-width:980px){
 .top-bar{grid-template-columns:minmax(0,1fr) auto;row-gap:9px;align-items:center}
 .top-bar>.header-right{grid-column:2;grid-row:1;align-self:center}
 .header-mode-row{grid-column:1/-1;grid-row:2;justify-content:center;border-top:1px solid var(--edge);padding-top:7px}
 .scan-mode-toggle{width:min(100%,360px);min-width:0}
 .scan-mode-toggle button{min-height:36px;font-size:13px;padding:6px 12px}
}
@media(max-width:360px){.top-bar{padding-left:11px;padding-right:11px;column-gap:6px}.brand{gap:6px}.brand small{font-size:10px}.brand b{font-size:17px}}
.simple-history-status{margin:12px 0 4px;color:var(--muted);overflow-wrap:anywhere}
.simple-history-status[data-kind="error"]{color:var(--danger,var(--red,#d56c5c))}
.simple-history-status[data-kind="warning"]{color:var(--warn,var(--orange,#b58a42))}
.simple-text-search{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:10px 0 14px}
.simple-text-search label{font-weight:600;font-size:13px}
.simple-text-search input{width:min(100%,480px);min-width:0;flex:1 1 220px}
/* The Simple results scope uses the same compact segmented treatment as the header. */
.simple-scope-toggle{width:min(100%,420px);min-width:0;grid-template-columns:minmax(0,.65fr) minmax(0,1.7fr);margin:5px 0 12px;white-space:normal}
.simple-scope-toggle button{min-height:36px;line-height:1.2;padding:6px 10px;overflow-wrap:anywhere}
@media(max-width:560px){.simple-scope-toggle{width:100%}.simple-scope-toggle button{font-size:12px;padding:7px 8px}}
html[data-ui-mode="advanced"] #simple-scope-toggle{display:none!important}
html[data-ui-mode="advanced"] .simple-text-search,html[data-ui-mode="advanced"] .simple-history-status{display:none!important}
html[data-ui-mode="simple"] #baseline-history-panel,
html[data-ui-mode="simple"] .setup-bottom-actions,
html[data-ui-mode="simple"] #saved-summary,
html[data-ui-mode="simple"] #lichess-rating-history-warning,
html[data-ui-mode="simple"] .active-status:not(.is-scan-important),
html[data-ui-mode="simple"] .active-status .inline-actions,
html[data-ui-mode="simple"] #results-view-tabs,
html[data-ui-mode="simple"] #results-panel .results-history-button,
html[data-ui-mode="simple"] #results-panel .results-users-field,
html[data-ui-mode="simple"] #results-panel #ai-report-empty,
html[data-ui-mode="simple"] #results-panel #sql-global-warning,
html[data-ui-mode="simple"] #results-panel #results-advanced,
html[data-ui-mode="simple"] #results-panel #results-sql,
html[data-ui-mode="simple"] #results-panel #ai-report-button,
html[data-ui-mode="simple"] #results-panel #simple-category-rail,
html[data-ui-mode="simple"] #results-panel #simple-filter-note,
html[data-ui-mode="simple"] #results-panel #scan-evidence-summary,
html[data-ui-mode="simple"] #results-panel .results-pane-heading h2,
html[data-ui-mode="simple"] #troubleshooting{display:none!important}
html[data-ui-mode="simple"] #results-panel .simple-results-layout{display:block;min-width:0}
html[data-ui-mode="simple"] #results-panel #results-simple{display:block}
html[data-ui-mode="simple"] #results-panel #results-empty{overflow-wrap:anywhere}
@media(max-width:560px){.simple-text-search{align-items:stretch;flex-direction:column}.simple-text-search input{width:100%;flex:auto}}

/* Keep safety/error access available in Simple, not advanced retry switches. */
html[data-ui-mode="simple"] .active-status .inline-actions{display:flex;gap:8px}
html[data-ui-mode="simple"] .active-status .inline-actions > :not([data-action="errors"]){display:none!important}
html[data-ui-mode="simple"] #results-panel #sql-global-warning:not([hidden]){display:block!important}
html[data-ui-mode="simple"] .header-desktop-nav [data-action="queues"],
html[data-ui-mode="simple"] .header-desktop-nav [data-action="settings"],
html[data-ui-mode="simple"] .mobile-header-menu [data-action="queues"],
html[data-ui-mode="simple"] .mobile-header-menu [data-action="settings"],
html[data-ui-mode="simple"] .footer-action-nav [data-action="queues"],
html[data-ui-mode="simple"] .footer-action-nav [data-action="settings"]{display:none!important}
html[data-ui-mode="advanced"] #simple-resume-scan{display:none!important}
html[data-ui-mode="simple"] #simple-resume-scan:not([hidden]){display:inline-flex}

/* Simple uses the existing compact-rating/graph switch, but never an Advanced pacing warning. */
html[data-ui-mode="simple"] #network-settings-warning{display:none!important}

/* RC13: reduced Simple text load, preserving safety and accessible detail. */
html[data-ui-mode="advanced"] .simple-username-help,html[data-ui-mode="simple"] .advanced-username-help{display:none!important}
.simple-results-caution{margin:0 0 10px;color:var(--muted);line-height:1.45}
html[data-ui-mode="advanced"] .simple-results-caution{display:none!important}
.sql-workspace-help{margin:4px 0 12px;border:1px solid var(--edge);border-radius:7px;padding:8px 12px}
.sql-workspace-help>summary{font-size:12px;font-weight:650}
.sql-workspace-help[open]>summary{margin-bottom:10px}
.sql-workspace-short-help{margin-bottom:6px}
@media(max-width:760px){.simple-username-help{line-height:1.5}.simple-results-caution{max-width:100%}}

/* Absent saved progress is not a third disabled action in the Simple workflow. */
#simple-resume-scan[hidden]{display:none!important}
html[data-ui-mode="simple"] .active-status #current-task,
html[data-ui-mode="simple"] .active-status #network-task{display:none!important}

/* RC15: tabbed options, provider dialogs, and consistent number controls. */
.header-history-meta{display:flex;flex-direction:column;align-items:flex-end;gap:2px;margin-top:5px;min-width:0}
.header-history-meta>small{display:block;color:var(--muted);font-size:11px;line-height:1.35;white-space:normal}
.header-history-meta>.version{margin-left:0;font-size:11px}
.settings-tabbar{display:flex;gap:4px;overflow-x:auto;overscroll-behavior-inline:contain;border-bottom:1px solid var(--edge);padding:0 0 3px;scrollbar-width:thin}
.settings-tabbar button{flex:0 0 auto;white-space:nowrap;border-radius:6px 6px 0 0;border-bottom:0;padding:9px 12px;min-height:37px;font-size:13px;font-weight:650;color:var(--muted)}
.settings-tabbar button[aria-selected="true"]{color:var(--blue);border-color:var(--blue);background:color-mix(in srgb,var(--blue) 12%,var(--paper))}
.settings-tab-panel{padding:8px 1px 10px;min-width:0}
.settings-tab-panel[hidden],.settings-provider-panel[hidden]{display:none!important}
.settings-tab-panel .settings-grid{margin-bottom:12px}
.settings-provider-veil{z-index:115;background:#020a16cf}
.settings-provider-dialog{width:min(760px,100%)}
.settings-provider-dialog .settings-provider-back{display:none}
/* Native spinners differ markedly across engines. Keep keyboard and wheel behavior
   on the native number input; supply visually matching increment controls. */
.number-control{display:inline-flex;position:relative;max-width:100%;min-width:0;vertical-align:middle;flex:1 1 auto}
.number-control>input[type=number]{appearance:textfield;-moz-appearance:textfield;width:100%;min-width:0;padding-inline-end:32px}
.number-control>input[type=number]::-webkit-inner-spin-button,.number-control>input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.number-control-steppers{position:absolute;right:1px;top:1px;bottom:1px;width:25px;border-left:1px solid var(--edge);display:flex;flex-direction:column;overflow:hidden;border-radius:0 6px 6px 0;background:var(--fill)}
.number-control-step{flex:1 1 50%;display:flex;align-items:center;justify-content:center;min-height:0!important;border:0;border-radius:0;padding:0;background:transparent;color:var(--muted);font-size:11px;line-height:1;touch-action:manipulation}
.number-control-step+.number-control-step{border-top:1px solid var(--edge)}
.number-control-step:hover:not(:disabled){background:color-mix(in srgb,var(--blue) 15%,var(--fill));color:var(--blue);filter:none}
.number-control-step:focus-visible{outline:2px solid var(--blue);outline-offset:-2px;z-index:1}
.settings-grid>.number-control{width:100%;min-width:0}
.authorization-controls>.number-control{flex:0 1 96px;width:96px;min-width:85px}
.authorization-controls>.number-control input[type=number]{width:100%;min-width:0}
/* Compact Simple Results filter row: same rail height as the banner selector. */
.simple-results-toolbar{display:flex;align-items:center;gap:12px;margin:5px 0 12px;flex-wrap:wrap}
.simple-results-toolbar .simple-scope-toggle{flex:0 1 420px;width:auto;min-width:0;margin:0;align-self:center}
.simple-results-toolbar .simple-scope-toggle button{min-height:30px;padding:3px 10px;line-height:1.25}
.simple-results-toolbar .simple-text-search{display:flex;flex:1 1 220px;min-width:165px;align-items:center;flex-direction:row;gap:8px;margin:0}
.simple-results-toolbar .simple-text-search label{font-size:12px;white-space:nowrap}
.simple-results-toolbar .simple-text-search input{flex:1 1 auto;width:100%;min-width:0;height:32px;padding:4px 9px}
@media(max-width:980px){.header-history-meta>small{font-size:10px}}
@media(max-width:560px){
 .header-history-meta{align-items:flex-end;max-width:170px}
 .simple-results-toolbar{align-items:stretch;gap:9px}
 .simple-results-toolbar .simple-scope-toggle{flex:1 1 100%;width:100%}
 .simple-results-toolbar .simple-scope-toggle button{min-height:36px;padding:6px 8px}
 .simple-results-toolbar .simple-text-search{flex:1 1 100%;min-width:0;flex-direction:column;align-items:stretch;gap:5px}
 .simple-results-toolbar .simple-text-search input{height:36px}
 .settings-tabbar{margin:0 -6px;padding-inline:6px}
 .settings-tabbar button{font-size:12px;}
 .settings-provider-veil{padding:8px}
}

/* Keep the version below the history meter at mobile widths, too. */
.header-history-meta>.version{display:block}

/* RC15 Options entry points and contextual plain-language help. */
.section-options-gear{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;vertical-align:middle;width:28px;height:28px;min-height:28px;padding:0;font:normal 17px/1 inherit;color:var(--muted);border:1px solid var(--edge);border-radius:7px;background:var(--fill);cursor:pointer}
.section-options-gear:hover,.section-options-gear:focus-visible{color:var(--blue);border-color:var(--blue);background:color-mix(in srgb,var(--blue) 9%,var(--paper))}
.major-section-heading .section-options-gear{margin-inline-end:2px;align-self:flex-start}
.results-pane-heading .section-options-gear{margin:0 -4px 0 0}
.settings-help-value{min-width:0;width:100%;display:flex;align-items:center;gap:8px}
.settings-help-value>input:not([type=checkbox]),.settings-help-value>select,.settings-help-value>.number-control,.settings-help-value>.inline-actions{flex:1 1 auto;width:100%;min-width:0}
.settings-help-value>input[type=checkbox]{width:auto;flex:0 0 auto}
.settings-help-value>.inline-actions{flex-wrap:wrap}
.settings-help-button{flex:0 0 22px!important;width:22px!important;height:22px;min-height:22px!important;padding:0!important;border:1px solid var(--edge);border-radius:50%;background:var(--fill);color:var(--blue);font-size:12px;font-weight:800;line-height:1;display:inline-flex;align-items:center;justify-content:center}
.settings-help-button:hover,.settings-help-button:focus-visible,.settings-help-button[aria-expanded="true"]{outline-offset:2px;border-color:var(--blue);background:color-mix(in srgb,var(--blue) 16%,var(--paper))}
.settings-help-popup{position:fixed;z-index:130;background:var(--paper);color:var(--ink);border:1px solid var(--blue);border-radius:9px;padding:12px 14px;box-shadow:0 12px 32px #0005;font-size:13px;line-height:1.5;overflow-wrap:anywhere;max-height:min(45vh,320px);overflow:auto;pointer-events:none}
.settings-help-preview{display:flex;align-items:center;gap:6px;flex-wrap:wrap;background:var(--fill);border:1px solid var(--edge);border-radius:7px;padding:7px 9px;margin-top:9px;font-size:11px;color:var(--blue);line-height:1.35}
.settings-help-preview svg{width:124px;height:31px;max-width:100%;display:block}
.settings-help-preview .preview-swatch{width:19px;height:19px;border-radius:4px;border:1px solid var(--edge);background:var(--blue)}
.settings-help-preview .preview-swatch:nth-child(2){background:var(--paper)}
.settings-help-preview .preview-swatch:nth-child(3){background:var(--amber)}
.settings-technical-notes{margin-top:14px;border-top:1px solid var(--edge);padding:10px 1px}
.settings-technical-notes summary{font-size:12px;font-weight:650;color:var(--muted);cursor:pointer}
.settings-technical-notes .note{line-height:1.55;margin:9px 0}
@media(max-width:560px){.section-options-gear{height:30px;width:30px}.settings-help-popup{font-size:12px}.settings-help-value{gap:7px}}

/* RC16 SQL editor and insert palette. Scoped to the workspace; no global CM overrides. */
.sql-insert-toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:8px 0}
.sql-editor-region{position:relative;min-width:0}
#sql-workspace-query{width:100%;min-height:176px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;tab-size:2}
#sql-workspace-query[hidden],#sql-insert-palette[hidden],#sql-editor-fallback[hidden]{display:none!important}
.sql-codemirror-host{min-width:0}
.sql-insert-palette{position:absolute;right:0;top:0;width:min(430px,95%);max-height:min(610px,75vh);z-index:85;display:flex;flex-direction:column;overflow:hidden;padding:10px;background:var(--paper);border:1px solid var(--blue);box-shadow:0 12px 40px #0007;border-radius:10px;color:var(--ink)}
.sql-palette-header{display:flex;align-items:center;gap:8px;margin-bottom:9px;cursor:grab;touch-action:none;user-select:none}
.sql-palette-header:active{cursor:grabbing}
.sql-insert-palette.dragged:not(.pinned){position:fixed!important;right:auto!important;bottom:auto!important;z-index:130}
.sql-palette-header strong{flex:1}.sql-palette-header button{font-size:12px;padding:5px 8px}
.sql-palette-search{width:100%;flex:0 0 auto;margin-bottom:8px}
.sql-palette-tabs{display:flex;gap:5px;overflow-x:auto;padding:2px 0 7px;flex:0 0 auto}
.sql-palette-tab{white-space:nowrap;font-size:11px;padding:5px 9px;flex:0 0 auto}
.sql-palette-note{margin:3px 0 7px;flex:0 0 auto}
.sql-palette-body{overflow:auto;overscroll-behavior:contain;min-height:0;padding-right:3px;flex:1}
.sql-palette-section{font-size:12px;color:var(--blue);margin:12px 0 5px}
.sql-palette-item{display:flex;align-items:center;gap:4px;min-width:0;padding:4px 0;border-bottom:1px solid var(--edge)}
.sql-palette-item .sql-palette-insert{flex:1;min-width:0;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sql-palette-item button{font-size:11px;padding:6px 7px}
.sql-palette-detail{min-width:0;max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:11px}
.sql-palette-copy,.sql-palette-fav{flex:0 0 auto}
.sql-palette-table-details{border-bottom:1px solid var(--edge);padding:4px 8px}
.sql-palette-table-details summary{cursor:pointer;font-size:12px;color:var(--blue)}
.sql-palette-child{padding-left:9px}
.sql-palette-qualify{white-space:nowrap}
/* Pinned palette occupies the LEFT column; editor is to its RIGHT.
   CSS variable is a high-water mark maintained by app.js and never lowered. */
#sql-workspace-query{min-height:var(--sql-editor-min-height,176px)}
.sql-codemirror-host .cm-scroller{min-height:var(--sql-editor-min-height,170px)!important;max-height:max(55vh,var(--sql-editor-min-height,170px))!important}
@media(min-width:760px){
  .sql-editor-region:has(.sql-insert-palette.pinned:not([hidden])){display:grid;grid-template-columns:minmax(265px,360px) minmax(0,1fr);gap:12px;align-items:start}
  .sql-insert-palette.pinned{position:static;width:100%;max-height:min(610px,72dvh);height:min(610px,72dvh);grid-column:1;grid-row:1}
  .sql-editor-region:has(.sql-insert-palette.pinned:not([hidden]))>.sql-codemirror-host,
  .sql-editor-region:has(.sql-insert-palette.pinned:not([hidden]))>#sql-workspace-query{grid-column:2;grid-row:1}
}
@media(max-width:759px){
  .sql-editor-region:has(.sql-insert-palette.pinned:not([hidden])){display:flex;flex-direction:column;gap:12px}
  .sql-insert-palette.pinned{position:relative;inset:auto;width:100%;max-height:min(55dvh,510px);height:min(55dvh,510px);order:-1}
  .sql-insert-palette:not(.pinned):not(.dragged){position:fixed;top:auto;right:0;bottom:0;left:0;width:100%;max-height:min(72dvh,660px);border-radius:16px 16px 0 0;z-index:125;padding-bottom:max(14px,env(safe-area-inset-bottom))}
  .sql-palette-item button{min-height:38px}
  .sql-palette-header button{min-height:36px}
  .sql-palette-tabs{padding-bottom:10px}
}

/* RC18: Simple Mode hides the complete troubleshooting panel, not just its
   contents, and offers a single Results Options shortcut per section. */
html[data-ui-mode="simple"] .troubleshooting-panel{display:none!important}
html[data-ui-mode="simple"] #results-panel .results-pane-heading>.section-options-gear{display:none!important}

/* RC18: compact icon tabs. Management actions sit at the far end only when
   room exists; on narrow screens the whole tab strip scrolls horizontally. */
.settings-tabbar button{display:inline-flex;align-items:center;justify-content:center;gap:6px}
.settings-tabbar button svg{width:15px;height:15px;flex:0 0 15px;stroke:currentColor}
.settings-tabbar .settings-data-tab{margin-inline-start:auto}
.settings-tabbar button:focus-visible{outline:2px solid var(--blue);outline-offset:-2px;position:relative;z-index:1}
.settings-tab-panel .data-history-content{padding:4px 0 12px}
.settings-tab-panel .data-history-danger{margin-bottom:6px}
@media(max-width:560px){
 .settings-tabbar button{gap:5px;padding:9px 10px}
 .settings-tabbar button svg{width:14px;height:14px;flex-basis:14px}
}

/* RC19: content-height opponent cards. Grid rows no longer stretch shorter
   cards to the height of the tallest card in the entire grid. */
.simple-results-list,
.simple-results-list.simple-graph-mode{grid-auto-rows:max-content;align-items:start;align-content:start}
.simple-results-list .simple-result-row,
.simple-graph-mode .simple-result-row{height:auto;min-height:0;max-height:none;align-self:start;overflow:visible}
/* RC19: the observation timestamp always starts on line two, indented to
   distinguish time provenance from the account's current/verified status. */
.simple-results-list .simple-status-context{display:block;width:100%;line-height:1.3}
.simple-results-list .simple-observed-context{
  display:block;max-width:100%;padding-inline-start:1.5rem;
  color:var(--muted);font-size:11px;line-height:1.25;
  overflow-wrap:anywhere;
}
/* Provider identification and session metadata in authorization settings. */
.oauth-provider-label{display:inline-flex;align-items:center;gap:7px;min-width:0}
.oauth-brand-icon{display:inline-block;width:22px;height:22px;object-fit:contain;flex:0 0 22px;vertical-align:middle}
.oauth-heading-icon{width:25px;height:25px;flex-basis:25px;margin-inline:4px 5px}
.oauth-dialog-intro{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.authorization-controls .authorization-status{display:flex;flex-direction:column;align-items:flex-start;min-width:180px;gap:3px;line-height:1.3}
.authorization-controls .authorization-status .oauth-connected-state{font-weight:700;color:var(--ink)}
.authorization-controls .oauth-settings-expiry,
.authorization-controls .oauth-settings-lifetime{display:block;color:var(--muted);font-size:11px;line-height:1.4}
.oauth-expiry-details{border-inline-start:3px solid var(--blue);padding:5px 12px;margin:10px 0;background:color-mix(in srgb,var(--blue) 5%,var(--paper));border-radius:0 6px 6px 0}
.oauth-expiry-details p{margin:6px 0;line-height:1.45}
.oauth-expiry-details .oauth-time-left{color:var(--blue);font-weight:650}
.settings-oauth-dialog{width:min(720px,100%)}
@media(max-width:560px){.authorization-controls .authorization-status{flex:1 1 100%}}

/* RC19 Network API launcher: brand mark belongs inside the button at left. */
.settings-provider-launch button{display:flex;align-items:center;justify-content:flex-start;gap:12px}
.settings-provider-launch .provider-api-button-logo{display:block;width:29px;height:29px;flex:0 0 29px;object-fit:contain}
.settings-provider-launch .provider-api-button-copy{display:block;min-width:0;flex:1 1 auto;text-align:left;line-height:1.35}
.settings-provider-launch .provider-api-button-copy small{margin-top:5px}
@media(max-width:500px){.settings-provider-launch button{gap:10px;padding:11px 12px}.settings-provider-launch .provider-api-button-logo{width:26px;height:26px;flex-basis:26px}}

/* RC19: persistent, fully opaque application banner. Making the banner
   full-bleed avoids content peeking through its sides or rounded corners as
   the page scrolls; the former bottom margin moves into main's top padding. */
.top-bar{
  position:sticky;top:0;z-index:80;width:100%;max-width:none;
  margin:0;border-radius:0;border-inline:0;border-top:0;
  border-bottom:1px solid var(--edge);
  background:var(--paper);background-clip:border-box;
  box-shadow:0 5px 18px #0003;
  padding-inline:max(19px,calc((100vw - 1420px)/2 + 19px));
}
main{padding-top:14px}
html{scroll-padding-top:var(--cass-header-offset,115px)}
main section[id],main h2[id]{scroll-margin-top:var(--cass-header-offset,115px)}
