/* atima's one stylesheet. Hand-written; there is no build step. */

:root {
  --navy:        #001e40;
  --navy-2:      #003366;
  --navy-3:      #1f477b;
  --accent:      #1f6feb;
  --accent-soft: #d5e3ff;
  --bg:          #f4f6f9;
  --card:        #ffffff;
  --line:        #d5d9e0;
  --line-soft:   #e7eaef;
  --text:        #191c1e;
  --text-soft:   #586069;
  --danger:      #b3261e;
  --danger-soft: #fbe9e7;
  --warn:        #8a5300;
  --warn-soft:   #fff1d6;
  --ok:          #1a6b38;
  --radius:      6px;
  --nav-width:      200px;
  --controls-width: 292px;
  --bar-height:  52px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  grid-template-rows: var(--bar-height) minmax(0, 1fr);
  grid-template-areas: "nav bar" "nav main";
  overflow: hidden;
}

/* A page the server writes itself (a failed sign-in), without the app around it. */
body.plain { display: block; overflow: auto; padding-top: 10vh; }
body.plain .card > * + * { margin-top: 12px; }

h1 { font-size: 22px; margin: 0; font-weight: 700; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 650; }
p  { margin: 0 0 10px; }
a  { color: var(--accent); }
code, pre { font-family: var(--mono); font-size: 12.5px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Navigation ---------------------------------------------------------- */

#nav {
  grid-area: nav; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; min-height: 0;
}
.nav-logo { display: block; text-align: center; padding: 16px 0 12px; border-bottom: 1px solid rgb(255 255 255 / 12%); }
.nav-logo img { height: 64px; }
#nav-links { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-foot { margin: 0; padding: 8px 14px; font-size: 11px; color: rgb(255 255 255 / 45%); border-top: 1px solid rgb(255 255 255 / 12%); }

.nav-link, .nav-group > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius);
  color: rgb(255 255 255 / 78%); text-decoration: none; cursor: pointer; font-size: 13.5px;
}
.nav-link > span, .nav-group > summary > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link:hover, .nav-group > summary:hover { background: rgb(255 255 255 / 10%); color: #fff; }
.nav-link.active { background: var(--navy-3); color: #fff; font-weight: 600; }
.nav-link i, .nav-group > summary > i:first-child { width: 16px; text-align: center; font-size: 13px; }
.nav-group > summary { list-style: none; font-weight: 600; margin-top: 4px; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary > span { flex: 1; }
.nav-outside { font-size: 9px !important; width: auto !important; opacity: .55; margin-left: auto; }
.nav-arrow { font-size: 10px !important; transition: transform .15s; opacity: .7; }
.nav-group[open] > summary .nav-arrow { transform: rotate(180deg); }
.nav-group > .nav-link { margin-left: 17px; padding-left: 16px; border-left: 2px solid rgb(255 255 255 / 12%); border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; }
.nav-group > .nav-link.active { border-left-color: var(--accent-soft); }

/* The button in the top bar folds the navigation away. In a narrow window it
   starts folded and opens over the page. */
body.nav-closed { grid-template-columns: 0 minmax(0, 1fr); }
body.nav-closed #nav { display: none; }
#nav-backdrop { display: none; }
.nav-toggle { flex: none; border: 0; background: none; color: #fff; font-size: 16px; width: 32px; height: 32px; border-radius: var(--radius); cursor: pointer; margin-left: -8px; }
.nav-toggle:hover { background: rgb(255 255 255 / 12%); }

/* ---- Top bar ------------------------------------------------------------- */

#topbar {
  grid-area: bar; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  border-left: 1px solid rgb(255 255 255 / 12%); min-width: 0;
}
.project-title { color: #fff; text-decoration: none; font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.project-title:hover { text-decoration: underline; }
button.project-title { display: flex; align-items: center; gap: 8px; font-family: inherit; background: none; border: 0; padding: 4px 6px; margin-left: -6px; border-radius: var(--radius); cursor: pointer; }
button.project-title > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
button.project-title:hover { text-decoration: none; background: rgb(255 255 255 / 12%); }
.project-title-edit { flex: none; font-size: 11px; opacity: .55; }
button.project-title:hover .project-title-edit, button.project-title:focus-visible .project-title-edit { opacity: 1; }
.topbar-space { flex: 1; }
#topbar select { width: auto; background: var(--navy-2); color: #fff; border-color: rgb(255 255 255 / 25%); }
.account { display: flex; align-items: center; gap: 8px; min-width: 0; }
.btn.signin { background: #fff; border-color: #fff; color: var(--navy-2); font-weight: 650; }
.btn.signin:hover { background: var(--accent-soft); }

/* A button that opens a short list: the account, in the top right corner. */
.menu { position: relative; flex: none; min-width: 0; }
.menu-button { display: inline-flex; align-items: center; gap: 7px; font: inherit; cursor: pointer; border: 1px solid transparent; background: none; color: inherit; border-radius: 999px; padding: 3px 8px 3px 3px; max-width: 100%; }
.menu-button:hover, .menu-button[aria-expanded="true"] { background: rgb(255 255 255 / 12%); border-color: rgb(255 255 255 / 25%); }
.menu-caret { font-size: 10px; opacity: .7; }
.avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--navy-2); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.menu-popup { position: absolute; z-index: 70; right: 0; top: calc(100% + 6px); width: max-content; min-width: 220px; max-width: min(300px, 92vw); background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgb(0 0 0 / 25%); overflow: hidden; }
.menu-header { display: flex; flex-direction: column; gap: 3px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; color: var(--text-soft); overflow-wrap: anywhere; }
.menu-header strong { font-size: 14px; color: var(--text); }
.menu-header .tag { align-self: flex-start; }
.account-about { display: flex; flex-direction: column; gap: 2px; }
.account-about:empty { display: none; }
.menu-items { display: flex; flex-direction: column; padding: 5px; }
.menu-items [role="menuitem"] { display: flex; align-items: center; gap: 10px; font: inherit; font-size: 13.5px; text-align: left; text-decoration: none; color: var(--text); background: none; border: 0; border-radius: var(--radius); padding: 7px 9px; cursor: pointer; }
.menu-items [role="menuitem"]:hover, .menu-items [role="menuitem"]:focus-visible { background: #eef2f8; }
.menu-items [role="menuitem"] > i:first-child { width: 16px; text-align: center; color: var(--navy-3); font-size: 13px; }
.menu-outside { margin-left: auto; font-size: 10px; opacity: .55; }
.menu-divider { height: 1px; background: var(--line-soft); margin: 5px 0; }
#topbar .btn, #topbar select, #topbar .tag { flex: none; }
.account-name { font-size: 13px; color: rgb(255 255 255 / 90%); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-link { font-size: 12px; color: rgb(255 255 255 / 75%); white-space: nowrap; }
.topbar-link:hover { color: #fff; }

/* ---- Main ---------------------------------------------------------------- */

#main { grid-area: main; overflow: auto; min-width: 0; min-height: 0; }
#main[data-page="plot"], #main[data-page="table"] { overflow: hidden; }

.page { max-width: 1180px; margin: 0 auto; padding: 22px 26px 60px; }
.page.narrow { max-width: 760px; }
.terms h1 { margin-bottom: 12px; }
.reference { display: flex; align-items: flex-start; gap: 12px; }
.reference p { flex: 1; margin: 0; overflow-wrap: anywhere; }
.terms ul { margin: 0 0 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.terms .card > :last-child { margin-bottom: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-head .btn { padding: 4px 10px; font-size: 12.5px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card > .card-actions { margin-top: 12px; }

.hint    { color: var(--text-soft); font-size: 12.5px; }
.empty   { color: var(--text-soft); padding: 18px; text-align: center; }
.warning { color: var(--warn); background: var(--warn-soft); border-radius: var(--radius); padding: 8px 10px; font-size: 13px; }

.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line-soft); color: var(--text-soft); border: 0; white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
button.tag { cursor: pointer; font-family: inherit; }
.badge { font-size: 11px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; }
.badge:empty { display: none; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 0 0 6px; }
dl.facts dt { color: var(--text-soft); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

.description { overflow-wrap: anywhere; }
.description p:last-child { margin-bottom: 0; }

/* ---- Buttons and inputs -------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13px; font-weight: 550; line-height: 1.2;
  padding: 6px 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f0f3f7; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn.primary:hover { background: var(--navy-3); }
.btn.danger { color: var(--danger); border-color: #e3b5b1; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.on-dark { background: transparent; border-color: rgb(255 255 255 / 30%); color: #fff; }
.btn.on-dark:hover { background: rgb(255 255 255 / 12%); }
.btn.large { font-size: 15px; padding: 10px 18px; }

input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="password"], select, .picker-face, .rich-text {
  font: inherit; font-size: 13px; color: var(--text);
  width: 100%; min-height: 30px; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
input.invalid { border-color: var(--danger); background: var(--danger-soft); }
input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--navy-2); }
input[type="color"] { width: 34px; height: 26px; padding: 1px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
label { font-weight: 600; font-size: 12.5px; }
label.inline { display: flex; align-items: center; gap: 7px; font-weight: 400; font-size: 13px; }

/* ---- Picker -------------------------------------------------------------- */

.picker { position: relative; min-width: 0; }
.picker-face { display: flex; align-items: center; gap: 6px; text-align: left; cursor: pointer; }
.picker-face > .picker-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-caret { margin-left: auto; font-size: 10px; color: var(--text-soft); }
.picker-placeholder { color: var(--text-soft); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-popup {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px); min-width: 200px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
}
.picker-popup.up { top: auto; bottom: calc(100% + 2px); }
.picker-popup.left { left: auto; right: 0; }
.picker-search { border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: var(--radius) var(--radius) 0 0 !important; }
.picker-list { list-style: none; margin: 0; padding: 4px; max-height: 240px; overflow-y: auto; }
.picker-list li { display: flex; align-items: center; gap: 7px; padding: 4px 7px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.picker-list li.cursor, .picker-list li:hover { background: #eef2f8; }
.picker-list li.on { font-weight: 600; }
.picker-list li.picker-group { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); cursor: default; background: none; padding-top: 7px; }
.picker-list li.picker-none { color: var(--text-soft); cursor: default; background: none; }
.picker-check { color: var(--navy-3); width: 14px; }
.picker-note { margin-left: auto; font-size: 11px; color: var(--text-soft); }
.picker-image { width: 18px; height: 18px; object-fit: contain; }
.swatch { display: inline-flex; height: 12px; width: 72px; flex: none; border-radius: 2px; overflow: hidden; border: 1px solid rgb(0 0 0 / 15%); }
.swatch i { flex: 1; }
.picker-face .swatch { width: 44px; }
.picker.icon-only .picker-face { padding: 1px 4px; gap: 3px; }
.picker.icon-only .picker-caret { font-size: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 3px; min-width: 0; }
.picker > .chips { margin-top: 3px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); border-radius: 4px; padding: 0 2px 0 6px; font-size: 12px; line-height: 20px; max-width: 100%; min-width: 0; }
.chip .picker-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chip .swatch { width: 36px; }
.chip-x { flex: none; border: 0; background: none; color: inherit; cursor: pointer; opacity: .6; font-size: 10px; padding: 2px 3px; border-radius: 3px; }
.chip-x:hover { opacity: 1; }

/* ---- Controls ------------------------------------------------------------ */

/* One control is one line: label left, value right, a slot for reset at the
   edge. Lines of its own (.control-more) only for what holds several values;
   .control-kids holds the controls that belong to this one. The 16px on the
   left of every line is a gutter for the mark of a control that picks a
   metadata field; .controls sits that far into its
   container's padding, so labels line up with the text around them. */

.controls { display: flex; flex-direction: column; margin-left: -16px; }
.control { min-width: 0; }
.control-row { position: relative; display: grid; grid-template-columns: minmax(0, 45%) minmax(0, 1fr) 18px; align-items: center; column-gap: 6px; min-height: 28px; padding-left: 16px; }
.control-name { display: flex; align-items: center; gap: 4px; min-width: 0; }
.control-label { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 12.5px; }
.control-kind { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); font-size: 9px; color: var(--navy-3); opacity: .7; }
.control-help { flex: none; color: #8f98a3; font-size: 11px; cursor: help; opacity: .4; border-radius: 50%; }
.control-row:hover .control-help, .control-help:focus-visible, .control.inactive > .control-row .control-help { opacity: 1; }
/* A note on choosing (guides.js): beside a control's label, and beside the depth. */
.control-guide { flex: none; border: 0; background: none; padding: 0 2px; color: #b8860b; font-size: 11px; cursor: pointer; opacity: .6; border-radius: 4px; }
.control-guide:hover, .control-guide:focus-visible, .control-row:hover .control-guide { opacity: 1; }
.plot-tools .control-guide { align-self: center; margin: 0 8px 0 -4px; font-size: 12px; }
.guide-link { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 2px 4px 6px 0; color: var(--navy-3); font-size: 12px; cursor: pointer; text-align: left; }
.guide-link:hover span { text-decoration: underline; }
.guide-link .fa-lightbulb { color: #b8860b; }
.guide-more { font-size: 13px; }
.control-body { min-width: 0; display: flex; align-items: center; gap: 5px; }
.control-body > * { flex: 1 1 auto; min-width: 0; }
.control-body > input[type="checkbox"], .control-body > .unit { flex: none; }
.control-reset { justify-self: end; border: 0; background: none; color: var(--text-soft); cursor: pointer; font-size: 10px; width: 18px; height: 20px; padding: 0; border-radius: 4px; }
.control-reset:hover { background: var(--line-soft); color: var(--text); }
.control-pair > .control-several { flex: none; border: 1px solid var(--line); background: #fff; color: var(--text-soft); cursor: pointer; font-size: 10px; width: 22px; height: 24px; padding: 0; border-radius: var(--radius); }
.control-several:hover { background: var(--line-soft); color: var(--text); }

.control input[type="text"], .control input[type="number"], .control select, .control .picker-face { min-height: 24px; padding: 1px 6px; font-size: 12.5px; }
.control select { text-overflow: ellipsis; padding-right: 2px; }

/* Changed from the default: the reset button at the row's edge shows; nothing else. */

/* No effect at the moment (a `when` rule): greyed out; the help icon says why. */
.control.inactive > .control-row .control-label { color: #9aa3ad; }
.control.inactive > .control-row .control-body, .control.inactive > .control-more { opacity: .45; }
.control.inactive > .control-row .control-help { color: var(--warn); }

.control-more > * { margin: 1px 18px 5px 16px; }
.control-more > .control-extra:empty { display: none; }
.control-extra { display: flex; flex-direction: column; }
.control-row.sub { padding-left: 0; min-height: 26px; grid-template-columns: minmax(0, 45%) minmax(0, 1fr); }
.control-row.sub .control-label { color: var(--text-soft); }
.control-problem { color: var(--danger); font-size: 12px; }
.control-missing { color: var(--warn); font-size: 12.5px; }
.control-pair { display: flex; align-items: center; gap: 5px; }
.control-pair > * { flex: 1; min-width: 0; }
.control-pair > .unit, .unit { flex: none; color: var(--text-soft); font-size: 12px; white-space: nowrap; }

.control-kids { margin-left: 22px; border-left: 2px solid var(--line-soft); }
.control-kids:empty { display: none; }
.control-kids .control-row { padding-left: 8px; }
.control-kids .control-more > * { margin-left: 8px; }

.toggles { display: flex; flex-wrap: wrap; gap: 3px; }
.toggles button { font: inherit; font-size: 11.5px; line-height: 18px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--text-soft); }
.toggles button.on { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }

/* The look of each value: its color, shape and pattern side by side. */
.look { margin: 1px 18px 5px 8px; display: flex; flex-direction: column; gap: 2px; }
.look-row { display: flex; align-items: center; gap: 4px; min-height: 24px; min-width: 0; }
.look-row input[type="color"] { width: 26px; height: 22px; flex: none; cursor: pointer; }
.look-row .picker, .look-gap { width: 40px; flex: none; }
.look-row .picker-face { min-height: 22px; }
.look-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }

.section { border-top: 1px solid var(--line-soft); }
.section > summary { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; font-weight: 650; font-size: 13px; list-style: none; }
.section > summary::-webkit-details-marker { display: none; }
.section-arrow { font-size: 10px; transition: transform .15s; color: var(--text-soft); }
.section[open] > summary .section-arrow { transform: rotate(90deg); }
.section-title { flex: 1; }
.section-body { padding: 0 0 8px; }

.problems { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 6px 8px; font-size: 12.5px; }
.problems p { margin: 0; }

/* ---- Plot page ----------------------------------------------------------- */

.plot-page { display: grid; grid-template-columns: minmax(0, 1fr) var(--controls-width); height: 100%; }
.plot-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.plot-controls { background: var(--card); border-left: 1px solid var(--line); padding: 8px 6px 40px 16px; overflow-y: auto; overflow-x: hidden; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.plot-controls-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 4px; }
.plot-controls-head h2 { margin: 0; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plot-controls-head .btn { padding: 4px 7px; font-size: 11px; flex: none; }
.plot-controls .hint { margin: 0 4px 4px 0; font-size: 12px; }
.subset > .picker { margin: 4px 18px 0 0; }
.subset > .picker .picker-face { min-height: 24px; padding: 1px 6px; font-size: 12.5px; }

.tabbed { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.tabs { display: flex; align-items: center; gap: 2px; min-width: 0; padding: 8px 14px 0; border-bottom: 1px solid var(--line); background: var(--card); }
.tabs > button[role="tab"] { font: inherit; font-size: 13px; font-weight: 600; display: inline-flex; gap: 7px; align-items: center; padding: 8px 14px; border: 0; background: none; cursor: pointer; color: var(--text-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs > button[aria-selected="true"] { color: var(--navy-2); border-bottom-color: var(--navy-2); }
.tabs > button[role="tab"] { white-space: nowrap; }
.plot-tools { margin-left: auto; display: flex; gap: 6px; padding-bottom: 6px; flex: none; }
.plot-tools select { width: auto; }
.plot-tools label.depth { align-self: center; font-size: 12px; font-weight: 500; color: var(--text-soft); }
.plot-tools #depth { margin-right: 8px; }
.pane { flex: 1; min-height: 0; overflow: auto; padding: 14px; }
.figure-pane { display: flex; flex-direction: column; overflow: hidden; }
.figure-box { position: relative; flex: 1; min-height: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; display: flex; align-items: center; justify-content: center; }
.figure-box.fitted { overflow: hidden; }
img.figure { display: block; max-width: none; margin: auto; }
img.figure.stale, .figure-box.busy img.figure, .figure-box.old img.figure { opacity: .35; }
.figure-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgb(255 255 255 / 55%); }
/* The render box, in the middle while a figure is drawn or waits to be.
   Once the figure is there it stays for as long as the mouse is over it
   (`held`), without the veil, and lets the rest of the figure be used. */
.figure-overlay.held { background: none; pointer-events: none; }
.figure-overlay.held .render-box { pointer-events: auto; }
.render-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; max-width: calc(100% - 16px); padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 10px rgb(0 30 64 / 12%); }
.render-status { display: flex; align-items: center; gap: 10px; color: var(--text-soft); }
.render-status:has(> .render-heading[hidden]) { display: none; }
.render-heading { font-weight: 600; color: var(--text); }
.render-box .hint { margin: 0; max-width: 340px; text-align: center; }
.render-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; }
.render-auto { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.stale-note { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 6px 10px; background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); font-size: 13px; }
.figure-message { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--warn); }
.figure-message > i { font-size: 22px; }
.figure-message p { max-width: 560px; margin: 0; color: var(--text); white-space: pre-wrap; }
.figure-caption { margin: 8px 2px 0; font-size: 12px; color: var(--text-soft); height: 18px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: none; }

.stats-title { font-weight: 650; margin-bottom: 4px; }
.stats-note { background: var(--accent-soft); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; }
.stats-model { font-family: var(--mono); font-size: 12.5px; color: var(--text-soft); }

.code-block { position: relative; }
.code-block > .btn { position: absolute; top: 8px; right: 8px; }
.code-block pre { margin: 0; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; white-space: pre; }
.code-block code.hljs, .code-block code { background: none; padding: 0; }

.methods { max-width: 820px; }
.methods-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.methods-head .hint { margin: 0; }
.methods-text { line-height: 1.55; overflow-wrap: anywhere; }
.methods h3 { font-size: 13px; margin: 16px 0 6px; }
.methods-refs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.methods-refs li { padding-left: 2em; text-indent: -2em; overflow-wrap: anywhere; }

.spinner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; color: var(--text-soft); }
.spin { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--navy-3); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Tables -------------------------------------------------------------- */

.table-tools { display: flex; gap: 8px; margin-bottom: 8px; }
.table-tools input { max-width: 260px; }
.table-tools select { width: auto; }
.table-scroll { overflow-x: auto; }
.table-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.table-status { flex: 1; color: var(--text-soft); font-size: 12.5px; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 5px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.data thead th { border-bottom: 2px solid var(--line); background: #fafbfc; position: sticky; top: 0; }
table.data thead td { background: #fafbfc; font-size: 12px; color: var(--text-soft); }
table.data thead td select { width: auto; min-height: 24px; padding: 1px 4px; font-size: 12px; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th[aria-sort="ascending"]::after  { content: " \25B2"; font-size: 9px; color: var(--accent); }
table.data th[aria-sort="descending"]::after { content: " \25BC"; font-size: 9px; color: var(--accent); }
table.data td.num { font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: #f6f8fb; }
table.people td { white-space: normal; vertical-align: middle; }
table.people select { width: auto; }

/* ---- Projects ------------------------------------------------------------ */

.projects { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.projects .tabbed { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; min-height: 320px; }
.projects .pane { padding: 8px; max-height: 62vh; }
.tree { min-height: 200px; }
.tree.drop { background: #f1f6ff; }
.tree-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--radius); cursor: pointer; }
.tree-row:hover { background: #f1f4f8; }
.tree-row.selected { background: var(--accent-soft); }
.tree-row.drop { outline: 2px dashed var(--accent); }
.tree-row.open .tree-text { font-weight: 650; }
.tree-icon { color: var(--navy-3); width: 16px; text-align: center; }
.tree-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-meta { font-size: 11.5px; color: var(--text-soft); white-space: nowrap; }
.details h2 { font-size: 17px; }

/* ---- Summary, sharing, home ---------------------------------------------- */

/* The summary page: a head with the title and what can be done with the
   project, a strip of numbers, then two columns: about the project on the
   left, downloads on the right. */
.summary-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.summary-head h1 { min-width: 0; overflow-wrap: anywhere; }
.summary-head .card-actions { margin-left: auto; }
.summary .warning { margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; display: flex; flex-direction: column; min-width: 0; }
.tile strong { font-size: 19px; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile span { font-size: 12px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.summary-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.summary-grid .card { margin: 0; padding: 13px 16px; min-width: 0; }
.summary-grid h3 { font-size: 12px; font-weight: 650; color: var(--text-soft); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 6px; }
.summary-grid h3:first-of-type { margin-top: 0; }
.fields { display: flex; flex-wrap: wrap; gap: 5px; }
.field-chip { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 5px; padding: 2px 8px; font-size: 12.5px; }
.field-chip b { font-weight: 550; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-chip i { flex: none; font-style: normal; font-size: 11px; color: var(--text-soft); white-space: nowrap; }
.links { display: flex; flex-direction: column; gap: 10px; }
/* The import page: a short form, and a list of projects to tick. */
.form-grid { display: grid; grid-template-columns: max-content minmax(0, 340px); gap: 8px 14px; align-items: center; margin: 14px 0 4px; }
.form-grid label { font-size: 13px; font-weight: 600; }
.form-problem { color: var(--danger); font-size: 13px; margin: 8px 0 0; }
table.data.wrap td:nth-child(2) { white-space: normal; width: 100%; }
.hint.problem { color: var(--danger); }

.link-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.link-row code { background: var(--bg); padding: 3px 7px; border-radius: 4px; overflow-wrap: anywhere; }
.link-row .hint { flex-basis: 100%; margin: 0; }
.link-label { font-weight: 600; font-size: 12.5px; }
.downloads .hint { margin-bottom: 6px; }
.download-row { display: flex; align-items: center; justify-content: flex-end; gap: 6px 8px; padding: 5px 0; border-top: 1px solid var(--line-soft); flex-wrap: wrap; font-size: 13px; }
.download-name { flex: 1 1 150px; min-width: 0; }
.download-row select, .download-row .picker { width: 150px; flex: 0 1 auto; min-width: 0; }
.download-row select, .download-row .picker-face { min-height: 28px; padding: 2px 8px; }
.download-row .btn { padding: 5px 10px; }
.button-pair { display: inline-flex; }
.button-pair .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.button-pair .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }

.person { display: flex; flex-direction: column; font-size: 13px; }
.person span { color: var(--text-soft); font-size: 12.5px; }
.search-results { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.search-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius); }

.hero { background: linear-gradient(135deg, var(--navy-2), var(--navy)); color: #fff; border-radius: 14px; padding: 44px 32px; text-align: center; margin-bottom: 26px; }
.hero h1 { font-size: 32px; margin-bottom: 10px; }
.hero p { max-width: 640px; margin: 0 auto 22px; color: #cfdcf2; font-size: 15.5px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero p.upload-help { max-width: 620px; margin: 18px auto 0; font-size: 12.5px; }
.hero .upload-help a { color: #fff; }
.page > .upload-help { margin: -6px 0 14px; max-width: 900px; }
.hero .btn.primary { background: #fff; color: var(--navy-2); border-color: #fff; }
.hero .btn:not(.primary) { background: transparent; color: #fff; border-color: rgb(255 255 255 / 40%); }
.two-col { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; margin-bottom: 26px; }
.two-col .logo { max-width: 300px; width: 100%; }
.features { padding-left: 18px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.gallery img { width: 100%; height: 170px; object-fit: contain; background: #fff; display: block; padding: 8px; }
.gallery figcaption { padding: 10px 12px; display: flex; flex-direction: column; font-size: 12.5px; color: var(--text-soft); border-top: 1px solid var(--line-soft); }
.gallery figcaption strong { color: var(--text); font-size: 13.5px; }

/* ---- Dialogs and notices ------------------------------------------------- */

dialog { border: 0; border-radius: 10px; padding: 20px 22px; width: min(460px, 92vw); box-shadow: 0 20px 60px rgb(0 0 0 / 35%); color: var(--text); }
dialog.wide { width: min(640px, 94vw); }
dialog::backdrop { background: rgb(0 20 45 / 45%); }
dialog h2 { font-size: 17px; margin-bottom: 12px; }
.dialog-body { display: flex; flex-direction: column; gap: 6px; }
.dialog-body p { margin: 0 0 6px; white-space: pre-wrap; }
.dialog-body label { margin-top: 6px; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog-problem { color: var(--danger); font-size: 13px; margin: 10px 0 0; }

.rich { border: 1px solid var(--line); border-radius: var(--radius); }
.rich-bar { display: flex; gap: 4px; padding: 4px; border-bottom: 1px solid var(--line-soft); background: #fafbfc; }
.rich-bar .btn { padding: 4px 8px; }
.rich-text { border: 0; min-height: 110px; max-height: 260px; overflow: auto; padding: 8px 10px; }
.rich-text:focus { outline: none; }

#notices { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(440px, 90vw); }
.notice { display: flex; gap: 10px; align-items: flex-start; background: #20262d; color: #fff; padding: 10px 12px; border-radius: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / 30%); font-size: 13px; }
.notice > div { flex: 1; overflow-wrap: anywhere; white-space: pre-wrap; }
.notice.error { background: #7a1c16; }
.notice.ok > i { color: #7ee2a0; }
.notice.working > i { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.notice-detail { opacity: .75; font-size: 12px; margin-top: 2px; }
.notice-close { background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 2px; }

/* A file is being dragged over the page. */
body.dropping::after {
  content: "Drop a file to upload it as a new project";
  position: fixed; inset: 12px; z-index: 200; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 650; color: var(--navy-2);
  background: rgb(213 227 255 / 85%); border: 3px dashed var(--navy-3); border-radius: 14px;
}

/* ---- Window sizes --------------------------------------------------------
   Supported: 850px to 2560px wide (850 is a 1280px laptop at 150% zoom),
   with no sideways scrolling of the page. The controls keep a fixed narrow
   column and the figure takes the rest. Below 1100px the navigation is
   folded away and opens over the page; below 760px the controls go under
   the figure. Narrower still (tablets upright, phones) gets that stacked
   layout and works, but is not tuned. */

@media (min-width: 1700px) {
  :root { --controls-width: 320px; }
}

@media (max-width: 1199px) {
  /* The bar above the figure keeps its controls and drops some words. */
  .plot-tools .btn > span, .plot-tools label.depth { display: none; }
}

@media (max-width: 1099px) {
  body, body.nav-closed { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "main"; }
  #nav, body.nav-closed #nav { display: none; }
  body.nav-open #nav { display: flex; position: fixed; inset: 0 auto 0 0; width: min(232px, 86vw); z-index: 60; box-shadow: 0 0 40px rgb(0 0 0 / 45%); }
  body.nav-open #nav-backdrop { display: block; position: fixed; inset: 0; z-index: 59; background: rgb(0 20 45 / 45%); }
  #topbar { border-left: 0; }
}

@media (max-width: 1000px) {
  .summary-grid, .projects, .two-col { grid-template-columns: minmax(0, 1fr); }
  .summary-head .card-actions { margin-left: 0; flex-basis: 100%; }
}

@media (max-width: 899px) {
  /* The top bar keeps its icons and drops their words. */
  #topbar { gap: 8px; padding: 0 10px; }
  #topbar .btn:has(> i):not(.signin) > span, .account-name { display: none; }
  .page { padding: 16px 14px 48px; }
  .tabs > button[role="tab"][aria-selected="false"] > span { display: none; }
}

@media (max-width: 759px) {
  #main[data-page="plot"], #main[data-page="table"] { overflow: auto; }
  .plot-page { display: block; height: auto; }
  .plot-main { height: min(72vh, 560px); min-height: 320px; }
  .plot-controls { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .tabs { padding: 6px 8px 0; }
  .tabs > button[role="tab"] { padding: 8px 9px; }
  .plot-tools .btn > span, .plot-tools label.depth { display: none; }
  .pane { padding: 8px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .download-row select, .download-row .picker { width: 100%; }
  .hero { padding: 28px 16px; }
}

@media (max-width: 520px) {
  .tabs > button[role="tab"] > span { display: none; }
  .topbar-link { display: none; }
}

/* The approval page for an AI app (served by R/oauth.R as plain HTML), and
   the Connected apps page. */
.consent h1 { margin-top: 0; }
.consent fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0; }
.consent legend { font-weight: 650; padding: 0 6px; }
.consent-choice { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; cursor: pointer; }
.consent-choice input { margin-top: 3px; flex: none; }
.consent-choice > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.consent .card-actions { justify-content: flex-end; }
table.data.apps td, table.data.changes td { vertical-align: top; }
table.data.changes td:nth-child(2) { white-space: normal; min-width: 220px; width: 100%; }
.deleted > .hint { margin: 4px 6px 10px; }

/* The Usage page (js/pages/usage.js), for administrators. Cards sit two
   abreast where there is room; a chart or table that is wider than its card
   scrolls inside it. */
.usage-controls { max-width: 420px; padding-top: 8px; padding-bottom: 8px; }
.usage-controls [hidden] { display: none; }
.usage-part { margin: 26px 0 10px; font-size: 16px; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; align-items: start; }
.usage-grid > .card { margin: 0; min-width: 0; }
.usage .card > .hint { margin: 0 0 8px; }
.usage-body > .card { margin-top: 14px; }
.verdict { margin: 14px 0 4px; padding: 10px 14px; border-radius: var(--radius); background: var(--line-soft); font-weight: 600; }
.verdict.ok { background: #e3f3e8; color: var(--ok); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.stat { display: flex; flex-direction: column; min-width: 96px; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.stat strong { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--text-soft); }
table.data th.num, table.data td.num { text-align: right; }
table.data.cohorts td.shade { background: color-mix(in srgb, var(--series-1) calc(var(--share, 0) * 55%), transparent); }
.link-button { border: 0; background: none; padding: 4px 0; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; }
.link-button:hover { text-decoration: underline; }

/* Charts (js/charts.js). Series colors are given in this order and never by
   rank; text is always in the page's own text colors. */
:root {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-muted: #9aa3ad;
}
.chart-box { overflow-x: auto; }
svg.chart { display: block; width: 100%; min-width: 320px; height: auto; }
svg.chart.heat { max-width: 600px; }
svg.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
svg.chart .axis { stroke: var(--line); stroke-width: 1; }
svg.chart .tick { font-size: 10.5px; fill: var(--text-soft); font-family: var(--font); font-variant-numeric: tabular-nums; }
svg.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .dot { stroke: var(--card); stroke-width: 1.5; }
svg.chart .hit { fill: transparent; }
svg.chart .hit:hover { fill: rgba(0, 30, 64, .06); }
svg.chart .bar:hover, svg.chart .cell:hover { opacity: .8; }
svg.chart .cell { fill: var(--series-1); }
svg.chart .cell.none { fill: var(--line-soft); }
svg.chart .line.s1, .rank-bar { stroke: var(--series-1); }
svg.chart .line.s2 { stroke: var(--series-2); }
svg.chart .line.s3 { stroke: var(--series-3); }
svg.chart .line.s4 { stroke: var(--series-4); }
svg.chart .line.muted { stroke: var(--series-muted); stroke-dasharray: 4 3; }
svg.chart .bar.s1, svg.chart .dot.s1, .swatch.s1 { fill: var(--series-1); background: var(--series-1); }
svg.chart .bar.s2, svg.chart .dot.s2, .swatch.s2 { fill: var(--series-2); background: var(--series-2); }
svg.chart .bar.s3, svg.chart .dot.s3, .swatch.s3 { fill: var(--series-3); background: var(--series-3); }
svg.chart .bar.s4, svg.chart .dot.s4, .swatch.s4 { fill: var(--series-4); background: var(--series-4); }
svg.chart .dot.muted, .swatch.muted { fill: var(--series-muted); background: var(--series-muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 4px; font-size: 12px; color: var(--text-soft); }
.chart-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.rank { display: flex; flex-direction: column; gap: 3px; }
.rank-row { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 13px; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-track { height: 12px; }
.rank-bar { display: block; height: 100%; min-width: 2px; border-radius: 0 3px 3px 0; background: var(--series-1); }
.rank-value { font-variant-numeric: tabular-nums; color: var(--text-soft); min-width: 3ch; text-align: right; }

/* The order of a categorical field's values (the metadata page). */
table.data thead td .btn.level-order,
table.data thead td .btn.group-colors { padding: 1px 7px; font-size: 12px; min-height: 24px; margin-left: 4px; }
ol.level-order { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
ol.level-order li { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-bottom: 1px solid var(--line-soft); }
ol.level-order li:last-child { border-bottom: 0; }
ol.level-order .level-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
ol.level-order .btn { padding: 2px 8px; }
ol.level-order .btn[aria-disabled="true"] { opacity: .4; cursor: default; }
ul.group-colors { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
ul.group-colors li { border-bottom: 1px solid var(--line-soft); }
ul.group-colors li:last-child { border-bottom: 0; }
ul.group-colors label { display: flex; align-items: center; gap: 8px; padding: 4px 8px; cursor: pointer; }
ul.group-colors input[type="color"] { width: 36px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; flex: none; }
ul.group-colors .level-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
