/* ==========================================================================
   GEODE design system
   --------------------------------------------------------------------------
   One tokenised presentation layer for the GEODE browser application. Same
   product family as GEODE Mine (neutral surfaces, indigo accent, pill status)
   but tuned for dense desktop geoscience work: a navigation rail, a fluid
   page and compact tables.

   Loaded AFTER the legacy inline block in base.html, so rules here restyle
   the established class names (.card, .btn, .secondary, .page-header, ...)
   without any template having to change its markup or hooks.

   Structure
     01 Tokens          07 Tables & grids      13 Dashboard
     02 Base            08 Status & feedback   14 Dialogs & menus
     03 App shell       09 Navigation          15 Auth & error pages
     04 Typography      10 Settings            16 Quick navigation
     05 Surfaces        11 Wizards & imports   17 Responsive, motion, print
     06 Buttons/forms   12 Domain components

   Theming: every colour is a custom property on :root. A product skin is a
   token override block; no rule below hard-codes a brand colour.
   ========================================================================== */

/* == 01 Tokens ============================================================ */

:root {
  --canvas: #f6f7f9;
  --surface: #ffffff;
  --surface-sunken: #f2f4f7;
  --surface-hover: #f7f8fa;
  --surface-inverse: #14161f;

  --border: #e4e7ee;
  --border-strong: #cfd4e0;

  --ink: #131722;
  --ink-secondary: #5b6478;
  --ink-muted: #868fa2;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-active: #3730a3;
  --accent-ink: #3d35b8;
  --accent-soft: #eef0fe;
  --accent-border: #c8ccf8;
  --accent-ring: rgba(79, 70, 229, .28);

  --ok-ink: #0f6b47;     --ok-bg: #e7f6ee;     --ok-border: #b4e2cb;
  --warn-ink: #855400;   --warn-bg: #fdf3da;   --warn-border: #f0dcab;
  --danger-ink: #a8271f; --danger-bg: #fdecea; --danger-border: #f4c7c2;
  --info-ink: #24557f;   --info-bg: #e9f1fa;   --info-border: #c2d9ef;
  --idle-ink: #525c70;   --idle-bg: #eef0f4;   --idle-border: #dde1e9;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 48px;

  --r-xs: 4px; --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-pill: 999px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --t-xs: .75rem; --t-sm: .8125rem; --t-base: .875rem; --t-md: 1rem;
  --t-lg: 1.125rem; --t-xl: 1.375rem; --t-2xl: 1.625rem;

  --shadow-xs: 0 1px 2px rgba(19, 23, 34, .05);
  --shadow-md: 0 2px 4px rgba(19, 23, 34, .04), 0 8px 20px rgba(19, 23, 34, .06);
  --shadow-lg: 0 12px 34px rgba(19, 23, 34, .14);

  --ease: cubic-bezier(.2, .6, .3, 1);
  --dur-fast: 120ms;
  --dur: 180ms;

  --rail-w: 232px;
  --rail-w-collapsed: 60px;
  --page-max: 1600px;
  --page-gutter: var(--s-7);

  /* Legacy hook kept for templates that read it. */
  --geode-info-color: var(--info-ink);

  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font);
  color-scheme: light;
}

/* == 02 Base ============================================================== */

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: var(--t-base)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); }

:where(main a) { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:where(main a):hover { color: var(--accent-active); }

:focus-visible,
.icon-button:focus-visible, .drag-handle:focus-visible, button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed; z-index: 200; left: var(--s-3); top: var(--s-3);
  width: auto; height: auto; margin: 0; padding: var(--s-2) var(--s-4); clip: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg); color: var(--ink);
}

/* == 03 App shell ========================================================= */

body.has-rail { padding-left: var(--rail-w); transition: padding-left var(--dur) var(--ease); }
html[data-rail="collapsed"] body.has-rail { padding-left: var(--rail-w-collapsed); }

header.app-rail {
  position: fixed; z-index: 60; inset: 0 auto 0 0;
  width: var(--rail-w);
  display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  border-right: 1px solid var(--border);
  transition: width var(--dur) var(--ease);
}
html[data-rail="collapsed"] header.app-rail { width: var(--rail-w-collapsed); }

.rail-head {
  display: flex; align-items: center; gap: var(--s-2);
  min-height: 60px; padding: 0 var(--s-3) 0 var(--s-4);
  border-bottom: 1px solid var(--border);
}
header.app-rail .rail-brand {
  display: inline-flex; align-items: center; gap: var(--s-2);
  margin-right: auto; min-width: 0;
  font-size: var(--t-md); font-weight: 650; letter-spacing: -.015em;
}
header.app-rail .rail-brand .geode-icon { width: 22px; height: 22px; color: var(--accent); flex: none; }
header.app-rail .rail-brand a { color: var(--ink); text-decoration: none; }

.rail-toggle, .rail-search {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; min-height: 0; padding: 0; flex: none;
  background: transparent; color: var(--ink-muted);
  border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer;
}
.rail-toggle:hover, .rail-search:hover { background: var(--surface-sunken); color: var(--ink); }
.rail-toggle .geode-icon, .rail-search .geode-icon { width: 17px; height: 17px; }

.rail-nav { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-3) var(--s-2); scrollbar-width: thin; }
.rail-group {
  display: block; margin: var(--s-4) var(--s-2) var(--s-1);
  color: var(--ink-muted); font-size: 11px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; white-space: nowrap;
}
.rail-group:first-child { margin-top: var(--s-1); }

header.app-rail .rail-nav a {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 36px; padding: 0 var(--s-3); margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--ink-secondary); font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
header.app-rail .rail-nav a .geode-icon { width: 18px; height: 18px; flex: none; opacity: .85; }
header.app-rail .rail-nav a:hover { background: var(--surface-sunken); color: var(--ink); }
header.app-rail .rail-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
header.app-rail .rail-nav a[aria-current="page"] .geode-icon { opacity: 1; }

.rail-quick {
  display: flex; align-items: center; gap: var(--s-2); width: calc(100% - var(--s-4));
  margin: var(--s-3) var(--s-2) 0; padding: 0 var(--s-3); min-height: 34px;
  background: var(--surface-sunken); color: var(--ink-muted);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font: var(--t-sm) var(--font); text-align: left; justify-content: flex-start; cursor: pointer;
}
.rail-quick:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--ink-secondary); }
.rail-quick .geode-icon { width: 15px; height: 15px; flex: none; }
.rail-quick kbd {
  margin-left: auto; padding: 1px 5px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-xs);
  font: 11px var(--font); color: var(--ink-muted);
}

.rail-foot {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
}
.rail-user { min-width: 0; flex: 1; line-height: 1.3; }
.rail-user strong { display: block; font-size: var(--t-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user small { display: block; color: var(--ink-muted); font-size: var(--t-xs); }

/* Instance context + drop-up switcher (0.10.0.5): the current Organization / Instance above the account section. */
.rail-context { padding: var(--s-2) var(--s-2) 0; border-top: 1px solid var(--border); }
.instance-switcher { position: relative; }
.instance-switcher > summary { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2); border-radius: var(--r-sm); cursor: pointer; list-style: none; color: var(--ink); }
.instance-switcher > summary::-webkit-details-marker { display: none; }
.instance-switcher > summary:hover, .instance-switcher[open] > summary { background: var(--surface-sunken); }
.instance-switcher > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.instance-switcher > summary .geode-icon { width: 18px; height: 18px; flex: none; color: var(--ink-secondary); }
.rail-context__text { min-width: 0; flex: 1; line-height: 1.25; }
.rail-context__text small, .rail-context__text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-context__text small { color: var(--ink-muted); font-size: var(--t-xs); }
.rail-context__text strong { font-size: var(--t-sm); font-weight: 600; }
.rail-context__caret { color: var(--ink-muted); font-size: var(--t-xs); }
.instance-switcher__panel { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 100; width: max(100%, 250px); max-width: 85vw; max-height: min(60vh, 420px); overflow-y: auto;
  padding: var(--s-2); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: 0 8px 24px rgb(0 0 0 / .18); display: grid; gap: 2px; }
.instance-switcher__panel [data-switcher-status]:empty { display: none; }
.instance-switcher__panel [data-switcher-status] { margin: 0; padding: var(--s-1) var(--s-2); font-size: var(--t-xs); }
.instance-switcher__filter { width: 100%; margin-bottom: var(--s-1); }
.instance-switcher__group { margin: var(--s-2) 0 2px; padding: 0 var(--s-2); color: var(--ink-muted); font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.instance-switcher__group:first-child { margin-top: 0; }
.instance-switcher__item { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2); padding-left: var(--s-4); border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-size: var(--t-sm); }
.instance-switcher__item:hover, .instance-switcher__item:focus-visible { background: var(--surface-sunken); }
.instance-switcher__item[aria-current="true"] { font-weight: 600; }
.instance-switcher__check { width: 1em; flex: none; color: var(--accent-ink); }
.instance-switcher__item[aria-disabled="true"] { color: var(--ink-muted); cursor: not-allowed; }
.instance-switcher__item small { margin-left: auto; color: var(--ink-muted); font-size: var(--t-xs); }
.instance-switcher__all { margin-top: var(--s-1); padding: var(--s-2); border-top: 1px solid var(--border); color: var(--accent-ink); font-size: var(--t-sm); text-decoration: none; }
.instance-switcher__all:hover { background: var(--surface-sunken); }
html[data-rail="collapsed"] .rail-context__text, html[data-rail="collapsed"] .rail-context__caret { display: none; }
html[data-rail="collapsed"] .rail-context { padding: var(--s-2) 0 0; }
html[data-rail="collapsed"] .instance-switcher > summary { justify-content: center; }

html[data-rail="collapsed"] .rail-label,
html[data-rail="collapsed"] .rail-group,
html[data-rail="collapsed"] .rail-user,
html[data-rail="collapsed"] .rail-brand a,
html[data-rail="collapsed"] .rail-quick span,
html[data-rail="collapsed"] .rail-quick kbd { display: none; }
html[data-rail="collapsed"] .rail-head { flex-direction: column; justify-content: center; gap: var(--s-1); padding: var(--s-3) 0; min-height: 0; }
html[data-rail="collapsed"] header.app-rail .rail-brand { margin: 0; }
html[data-rail="collapsed"] header.app-rail .rail-nav a { justify-content: center; padding: 0; }
html[data-rail="collapsed"] .rail-quick { justify-content: center; padding: 0; }
html[data-rail="collapsed"] .rail-foot { justify-content: center; padding: var(--s-3) 0; }
html[data-rail="collapsed"] .rail-nav { padding-top: var(--s-2); }
html[data-rail="collapsed"] .rail-nav a + .rail-group + a { margin-top: var(--s-3); }

/* Signed-out pages (login, bootstrap, recovery): brand strip only. */
body.no-rail header.app-rail {
  position: static; width: auto; flex-direction: row; border-right: 0;
  border-bottom: 1px solid var(--border);
}
body.no-rail .rail-head { border-bottom: 0; }

main {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s-6) var(--page-gutter) var(--s-8);
}
footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s-4) var(--page-gutter) var(--s-6);
  border-top: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: var(--t-xs);
}

/* == 04 Typography ======================================================== */

h1, h2, h3, h4 { color: var(--ink); font-weight: 600; letter-spacing: -.018em; }
h1 { margin: 0 0 var(--s-2); font-size: var(--t-2xl); line-height: 1.2; }
h2 { margin: 0 0 var(--s-3); font-size: var(--t-lg); line-height: 1.3; }
h3 { margin: 0 0 var(--s-2); font-size: var(--t-md); line-height: 1.35; }
h4 { margin: 0 0 var(--s-2); font-size: var(--t-base); }
p { margin: 0 0 var(--s-3); }

.muted, small { color: var(--ink-secondary); }
small { font-size: var(--t-xs); }
.subtle { color: var(--ink-muted); font-size: var(--t-sm); }
.eyebrow { margin: 0 0 var(--s-1); color: var(--ink-muted); font-size: var(--t-xs); font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.lede, .intro { max-width: 80ch; color: var(--ink-secondary); }
.num, .number { font-variant-numeric: tabular-nums; }
code, pre, kbd, .mono { font-family: var(--mono); font-size: .92em; }
code { padding: .1em .35em; background: var(--surface-sunken); border-radius: var(--r-xs); color: var(--ink-secondary); overflow-wrap: anywhere; }
pre { padding: var(--s-4); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r); font-size: var(--t-xs); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Page header ------------------------------------------------------------- */
.page-header, .page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--s-4); margin: 0 0 var(--s-5); min-height: 0;
}
.page-header h1, .page-head h1 { margin: 0; }
.page-header p, .page-head p { margin: var(--s-1) 0 0; max-width: 80ch; color: var(--ink-secondary); }
.page-head__text { min-width: 0; }
.page-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.page-head__tags { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }

.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.section-head h2, .section-head h3 { margin: 0; }
.section-head p { margin: var(--s-1) 0 0; color: var(--ink-secondary); font-size: var(--t-sm); }

/* == 05 Surfaces ========================================================== */

.card {
  padding: var(--s-5);
  margin-bottom: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card > :last-child { margin-bottom: 0; }
.card .card { box-shadow: none; border-radius: var(--r); background: var(--surface); }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); color: inherit; }
.card.warn, .warn.card { background: var(--warn-bg); border-color: var(--warn-border); }
.card--flush { padding: 0; overflow: hidden; }
.card--flush > .card__head { padding: var(--s-4) var(--s-5); margin: 0; border-bottom: 1px solid var(--border); }
.card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.card__head h2, .card__head h3 { margin: 0; }
.card__head p { margin: var(--s-1) 0 0; color: var(--ink-secondary); font-size: var(--t-sm); }

.grid, .form-grid { gap: var(--s-4); }
.stack { display: grid; gap: var(--s-4); }
.stack > * { min-width: 0; margin-bottom: 0; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--s-5); align-items: start; }
.split > * { min-width: 0; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
.cols-2 > *, .cols-3 > * { min-width: 0; margin-bottom: 0; }
.cols-2, .cols-3 { margin-bottom: var(--s-4); }

.stats { font-size: var(--t-2xl); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.module { border-top-color: var(--border); }

/* Definition lists -------------------------------------------------------- */
.facts, .connection-details, .setup-ui .detail-facts {
  display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: var(--s-2) var(--s-5); margin: 0;
}
.facts dt, .connection-details dt, .setup-ui .detail-facts dt { color: var(--ink-secondary); font-weight: 400; font-size: var(--t-base); }
.facts dd, .connection-details dd, .setup-ui .detail-facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.facts--inline { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s-4) var(--s-5); }
.facts--inline > div { min-width: 0; }
.facts--inline dt { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); margin-bottom: 2px; }

/* == 06 Buttons & forms =================================================== */

button, .btn {
  --b: var(--accent); --bh: var(--accent-hover); --i: #fff; --bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 34px; padding: 0 var(--s-4);
  background: var(--b); color: var(--i);
  border: 1px solid var(--bd); border-radius: var(--r-sm);
  font: 500 var(--t-base)/1.2 var(--font);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
button:hover, .btn:hover { background: var(--bh); color: var(--i); }
button:disabled, .btn.disabled, .disabled { opacity: .45; cursor: not-allowed; }
button .geode-icon, .btn .geode-icon { width: 16px; height: 16px; }

.secondary, .btn.secondary, button.secondary {
  --b: var(--surface); --bh: var(--surface-hover); --i: var(--ink); --bd: var(--border-strong);
  background: var(--b); color: var(--i); box-shadow: var(--shadow-xs);
}
.secondary:hover { border-color: var(--ink-muted); }
.danger, .btn.danger, button.danger {
  --b: var(--surface); --bh: var(--danger-bg); --i: var(--danger-ink); --bd: var(--danger-border);
  background: var(--b); color: var(--i);
}
.danger:hover { border-color: var(--danger-ink); }
.btn--ghost { --b: transparent; --bh: var(--surface-sunken); --i: var(--ink-secondary); background: var(--b); color: var(--i); }
.btn--sm { min-height: 28px; padding: 0 var(--s-3); font-size: var(--t-sm); }

.icon-button { gap: var(--s-2); }
.icon-button.icon-only { width: 32px; height: 32px; min-height: 32px; padding: 0; }
.icon-button.icon-only .geode-icon { width: 16px; height: 16px; }
.geode-icon { flex: none; }

.button-group, .actions { gap: var(--s-2); }
.row-actions { display: inline-flex; align-items: center; gap: var(--s-1); }
.row-actions form { margin: 0; display: inline-flex; }

/* Buttons that are really list items / inline affordances keep their own look. */
.combobox-option, .password-toggle, .rail-toggle, .rail-search, .rail-quick, .quicknav__item { box-shadow: none; }
.combobox-option { min-height: 32px; justify-content: flex-start; font-weight: 400; border: 0; }

label, .field label { color: var(--ink); font-size: var(--t-sm); font-weight: 500; }
input, select, textarea {
  min-height: 34px; padding: 6px var(--s-3);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font: var(--t-base)/1.4 var(--font);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--surface-sunken); color: var(--ink-secondary); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; accent-color: var(--accent); flex: none; box-shadow: none; }
input[type="file"] { padding: 5px; }
textarea { min-height: 96px; line-height: 1.55; resize: vertical; }
.field > small, .field > .helper { color: var(--ink-muted); }
.check-row { gap: var(--s-2); font-weight: 400; }

.invalid { border-color: var(--danger-ink); background: var(--danger-bg); }
.validation-message { color: var(--danger-ink); font-size: var(--t-xs); }

.filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
}
.filter-bar .field { min-width: 160px; flex: 1 1 160px; }
.filter-bar .actions { margin-left: auto; }

.combobox-list, .lookup-popup { border-color: var(--border-strong); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); }
.combobox-option:hover, .combobox-option.active { background: var(--accent-soft); color: var(--accent-ink); }
.lookup-value-input:focus { border-color: var(--accent); outline: 2px solid var(--accent-ring); }
.drag-item { border-color: var(--border); border-radius: var(--r-sm); }
.drag-handle { color: var(--ink-muted); }

/* Common form rhythm inside cards ------------------------------------------ */
.check-row + .table-scroll, .table-scroll + button, .table-scroll + .button-group, .table-scroll + .actions { margin-top: var(--s-3); }
form > label + input, form > label + select, form > label + textarea { margin-top: var(--s-1); }
.card > form > label { margin-top: var(--s-3); }
.card dl:not([class]) { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: var(--s-2) var(--s-5); margin: 0 0 var(--s-3); }
.card dl:not([class]) dt { color: var(--ink-secondary); }
.card dl:not([class]) dd { margin: 0; overflow-wrap: anywhere; }

/* == 07 Tables & grids ==================================================== */

table { font-size: var(--t-sm); }
th, td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border); vertical-align: middle; font-size: var(--t-sm); }
th { color: var(--ink-secondary); font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
table thead th,
.table-scroll table > tbody:first-child > tr:first-child > th,
.geode-grid thead th, .sticky-header thead th {
  background: var(--surface-sunken);
  box-shadow: 0 1px 0 var(--border);
}
tbody tr { transition: background var(--dur-fast) var(--ease); }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child > td { border-bottom: 0; }
td small { display: inline; color: var(--ink-muted); }
/* Dense tables: links read as data until hovered. */
td a:not(.btn) { text-decoration: none; }
td a:not(.btn):hover { text-decoration: underline; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions-cell, th.actions-cell { width: 1%; white-space: nowrap; text-align: right; }
.cell-primary, .cell-primary a { font-weight: 550; color: var(--ink); text-decoration: none; }
.cell-primary a:hover { color: var(--accent-ink); text-decoration: underline; }
td.is-empty { padding: var(--s-8) var(--s-4); color: var(--ink-muted); text-align: center; }

.table-scroll, .table-wrap, .geode-grid-scroll { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.card > .table-scroll:only-child, .card--flush > .table-scroll { border: 0; border-radius: 0; }
.geode-grid td:first-child.sticky-id { background: var(--surface); }
.geode-grid thead th:first-child.sticky-id { background: var(--surface-sunken); }
.geode-grid tr.selected, tr.selected { background: var(--accent-soft); }
.geode-grid th[aria-sort=ascending]::after, .geode-grid th[aria-sort=descending]::after { color: var(--accent-ink); }
.grid-cell-error { outline-color: var(--danger-ink); background: var(--danger-bg); }
.grid-save-state[data-state=error] { color: var(--danger-ink); }
.grid-save-state[data-state=saved] { color: var(--ok-ink); }
.grid-save-state[data-state=dirty] { color: var(--warn-ink); }
.export-field-row.included { border-left-color: var(--accent); background: var(--accent-soft); }
.export-field-row:hover { background: var(--surface-hover); }
.export-field-settings { background: var(--surface-sunken); border-color: var(--border); border-radius: var(--r); }

/* == 08 Status & feedback ================================================= */

.pill, .badge, .status-pill, .setup-ui .status-pill {
  display: inline-flex; align-items: center; gap: var(--s-1);
  margin: 1px; padding: 2px var(--s-2);
  background: var(--idle-bg); border: 1px solid var(--idle-border); border-radius: var(--r-pill);
  color: var(--idle-ink); font-size: var(--t-xs); font-weight: 600; line-height: 1.45; white-space: nowrap;
}
.badge .geode-icon, .pill .geode-icon { width: 12px; height: 12px; }
.badge--ok, .status-pill.active, .setup-ui .status-pill.active { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-ink); }
.badge--warn, .status-pill.warning, .setup-ui .status-pill.warning { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); }
.badge--danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-ink); }
.badge--info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-ink); }
.badge--accent, .wizard-current { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-ink); }

.good { color: var(--ok-ink); font-weight: 600; }
.warn-text { color: var(--warn-ink); }
.inactive { opacity: .6; }

.callout, .notice, p.warn, div.warn:not(.card), .error-inline {
  display: block; margin: 0 0 var(--s-4); padding: var(--s-3) var(--s-4);
  background: var(--info-bg); border: 1px solid var(--info-border); border-radius: var(--r);
  color: var(--info-ink); font-size: var(--t-sm); line-height: 1.55;
}
.callout { display: flex; align-items: flex-start; gap: var(--s-3); }
.callout > .geode-icon { width: 18px; height: 18px; margin-top: 1px; }
.callout__body { min-width: 0; }
.callout__body strong { display: block; }
.callout__body p:last-child { margin: 0; }
.callout--warn, p.warn, div.warn:not(.card) { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); }
.callout--danger, .error-inline { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-ink); }
.callout--ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-ink); }
.callout--quiet { background: var(--surface-sunken); border-color: var(--border); color: var(--ink-secondary); }
.callout a, .notice a { color: inherit; font-weight: 600; }
aside.notice { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
aside.notice form { margin-left: auto; }

.empty-state, .setup-ui .empty-state {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  padding: var(--s-8) var(--s-5); color: var(--ink-secondary); text-align: center;
}
.empty-state__icon {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  background: var(--surface-sunken); border-radius: var(--r-pill); color: var(--ink-muted);
}
.empty-state__icon .geode-icon { width: 20px; height: 20px; }
.empty-state h3 { margin: var(--s-1) 0 0; }
.empty-state p { margin: 0; max-width: 56ch; }
.empty-state .actions { margin-top: var(--s-2); justify-content: center; }

/* == 09 Navigation ======================================================== */

.breadcrumbs, nav.back {
  display: block; margin: 0 0 var(--s-4);
  color: var(--ink-muted); font-size: var(--t-sm);
}
/* Slash-style trails end in a bare text node: that is the current page. */
nav.back { color: var(--ink); font-weight: 550; }
nav.back a, nav.back span { font-weight: 400; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { display: flex; align-items: center; gap: 2px; min-width: 0; }
.breadcrumbs li + li::before { content: "/"; padding: 0 var(--s-1); color: var(--border-strong); }
.breadcrumbs a, nav.back a {
  padding: 2px var(--s-1); border-radius: var(--r-xs);
  color: var(--ink-secondary); text-decoration: none;
}
.breadcrumbs a:hover, nav.back a:hover { background: var(--surface-sunken); color: var(--ink); }
.breadcrumbs [aria-current="page"] { padding: 2px var(--s-1); color: var(--ink); font-weight: 550; }

a.back, .back-link {
  display: inline-flex; align-items: center; gap: var(--s-2);
  margin-bottom: var(--s-3); padding: 2px var(--s-2) 2px var(--s-1);
  border-radius: var(--r-sm); color: var(--ink-secondary);
  font-size: var(--t-sm); font-weight: 500; text-decoration: none;
}
a.back:hover, .back-link:hover { background: var(--surface-sunken); color: var(--ink); }

.tabs {
  display: flex; align-items: center; gap: var(--s-1);
  margin: 0 0 var(--s-5); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
}
.tabs a {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3); margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-secondary); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.tabs a .geode-icon { width: 16px; height: 16px; }
.tabs a:hover { color: var(--ink); border-bottom-color: var(--border-strong); }
.tabs a[aria-current="page"] { color: var(--accent-ink); font-weight: 600; border-bottom-color: var(--accent); }
.tabs .tabs__count { padding: 0 6px; background: var(--surface-sunken); border-radius: var(--r-pill); color: var(--ink-secondary); font-size: var(--t-xs); font-weight: 600; }

/* == 10 Settings ========================================================== */

.settings-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5) var(--s-5); align-items: start; }
.settings-group { min-width: 0; }
.settings-group__label {
  display: flex; align-items: center; gap: var(--s-2);
  margin: 0 0 var(--s-2) var(--s-1);
  color: var(--ink-muted); font-size: var(--t-xs); font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
}
.settings-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.settings-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); color: inherit; text-decoration: none;
  transition: background var(--dur-fast) var(--ease);
}
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-row:hover { background: var(--surface-hover); color: inherit; }
.settings-row:focus-visible { outline-offset: -2px; }
.settings-row__icon {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none;
  background: var(--accent-soft); border-radius: var(--r-sm); color: var(--accent-ink);
}
.settings-row__icon .geode-icon { width: 18px; height: 18px; }
.settings-row__text { flex: 1; min-width: 0; }
.settings-row__text strong { display: block; color: var(--ink); font-weight: 550; }
.settings-row__text > span { display: block; color: var(--ink-secondary); font-size: var(--t-sm); }
.settings-row__value { color: var(--ink-secondary); font-size: var(--t-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.settings-row__chevron { color: var(--ink-muted); display: inline-flex; }
.settings-row__chevron .geode-icon { width: 16px; height: 16px; }

/* == 11 Wizards & imports ================================================= */

.wizard-steps { gap: var(--s-2); margin-bottom: var(--s-5); }
.wizard-steps .pill { padding: 4px var(--s-3); }
.wizard-nav { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.drop-zone { border: 2px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--ink-secondary); transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.drop-zone:hover { border-color: var(--ink-muted); }
.drop-zone.drop-active { border-color: var(--accent); background: var(--accent-soft); }

details > summary { cursor: pointer; }
details.card > summary, .module > summary { font-weight: 550; }

/* == 12 Domain components ================================================= */

.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-3); }
.metric {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: var(--s-4); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); color: inherit; text-decoration: none;
}
a.metric:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); color: inherit; }
.metric__label { color: var(--ink-secondary); font-size: var(--t-sm); }
.metric__value { font-size: var(--t-xl); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.metric__note { color: var(--ink-muted); font-size: var(--t-xs); }

.entity-list { margin: 0; padding: 0; list-style: none; }
.entity-list > li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-top: 1px solid var(--border); min-width: 0; }
.entity-list > li:first-child { border-top: 0; padding-top: 0; }
.entity-list > li:last-child { padding-bottom: 0; }
.entity-list__main { flex: 1; min-width: 0; }
.entity-list__main > a, .entity-list__main > strong { display: block; font-weight: 550; color: var(--ink); text-decoration: none; }
.entity-list__main > a:hover { color: var(--accent-ink); text-decoration: underline; }
.entity-list__main small a { color: inherit; text-decoration: none; }
.entity-list__main small a:hover { color: var(--accent-ink); text-decoration: underline; }
.entity-list__main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Help affordance: explanation lives in a tooltip, not in a narrow cell ------- */
.help-tip {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: var(--s-1);
  border-radius: var(--r-pill); color: var(--info-ink); cursor: help; vertical-align: middle; flex: none;
}
.help-tip .geode-icon { width: 14px; height: 14px; }
.help-tip:hover, .help-tip:focus-visible { background: var(--info-bg); }
.cell-with-help { display: inline-flex; align-items: center; gap: 2px; }
/* The tooltip belongs to the whole label, not only the "i"; the "i" stays for keyboard and screen readers. */
.tip-scope { display: inline-flex; align-items: center; cursor: help; }
.tip-scope:hover .help-tip { background: var(--info-bg); }

/* One-row inline add form (toggle opens it; the submit stays a labelled primary) */
.inline-add-row {
  display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(120px, 160px) minmax(220px, 2.4fr) auto;
  gap: var(--s-3); align-items: end; margin: 0 0 var(--s-4); padding: var(--s-3) var(--s-4);
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r);
}
.inline-add-row label { display: grid; gap: var(--s-1); margin: 0; min-width: 0; }
.inline-add-row input, .inline-add-row select { width: 100%; margin: 0; }
.inline-add-row > button { min-height: 34px; }

/* Compact vocabulary grid with click-to-edit labels --------------------------- */
/* Narrow by design: opt out of the 720px minimum the shell gives scrolling grids. */
table.vocab-grid, table.vocab-grid.geode-grid { min-width: 0; }
.vocab-grid td, .vocab-grid th { padding-top: 6px; padding-bottom: 6px; vertical-align: middle; }
.vocab-grid .control-col { width: 1%; white-space: nowrap; text-align: center; }
.vocab-grid td form { margin: 0; display: inline-flex; }
.inline-edit__text {
  --b: transparent; --bh: var(--surface-sunken); --i: var(--ink); --bd: transparent;
  min-height: 28px; padding: 0 var(--s-2); margin-left: calc(var(--s-2) * -1);
  background: var(--b); color: var(--i); box-shadow: none; font-weight: 500; justify-content: flex-start; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; cursor: text;
}
.inline-edit__text:hover { border-color: var(--border-strong); }
.inline-edit__input { width: 100%; max-width: 260px; min-height: 28px; padding: 3px var(--s-2); }

/* Expert Import: find / add a coordinate system on one aligned row ------------ */
.epsg-add-row {
  display: grid; grid-template-columns: minmax(240px, 1.4fr) minmax(120px, 160px) minmax(180px, 1.6fr) auto;
  gap: var(--s-3); align-items: end; margin: 0 0 var(--s-4);
}
.epsg-add-row .field { position: relative; margin: 0; gap: var(--s-1); min-width: 0; }
.epsg-add-row .field > label { margin: 0; }
.epsg-add-row input { width: 100%; margin: 0; }
#expert-epsg-status { align-self: end; display: flex; align-items: center; min-height: 34px; margin: 0; font-size: var(--t-sm); overflow-wrap: anywhere; }
#expert-epsg-status.success { color: var(--ok-ink); }
#expert-epsg-status.error { color: var(--danger-ink); }
.epsg-add-row > button { min-height: 34px; }
.epsg-options { margin: 2px 0 0; padding: var(--s-1); list-style: none; max-height: 260px; background: var(--surface); }
.epsg-options [role="option"] { display: flex; align-items: baseline; gap: var(--s-3); padding: 6px var(--s-2); border-radius: var(--r-xs); cursor: pointer; }
.epsg-options [role="option"] small { margin-left: auto; color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.epsg-options [role="option"]:hover, .epsg-options [role="option"]:focus { background: var(--accent-soft); color: var(--accent-ink); outline: none; }
.epsg-options__empty { padding: var(--s-3) var(--s-2); color: var(--ink-muted); font-size: var(--t-sm); }

/* Expert Import: related CSV staging zone ------------------------------------- */
.related-drop-zone { min-height: 96px; gap: var(--s-3); margin-bottom: var(--s-2); padding: var(--s-4); }
.related-drop-zone .geode-icon { width: 22px; height: 22px; color: var(--accent-ink); }
.related-drop-zone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.related-drop-zone:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.related-drop-zone.is-busy { opacity: .6; pointer-events: none; }
.related-upload-names { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 var(--s-3); padding: 0; list-style: none; }
.related-upload-names li { padding: 2px var(--s-2); background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: var(--r-pill); color: var(--accent-ink); font-size: var(--t-xs); font-weight: 600; }
.related-upload-names li.error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-ink); }

.filter-bar > button { align-self: flex-end; }
.filter-bar__count { align-self: center; margin-left: auto; white-space: nowrap; }

/* Drill holes: compact form grids and one-row add forms --------------------- */
.drill-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s-3) var(--s-4); margin-bottom: var(--s-4); align-items: start; }
.drill-form-grid .field { margin: 0; gap: var(--s-1); }
.drill-form-grid input, .drill-form-grid select { width: 100%; }
.survey-add-row, .interval-add-row {
  display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; margin: 0 0 var(--s-4); padding: var(--s-3) var(--s-4);
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r);
}
.survey-add-row label, .interval-add-row label { display: grid; gap: var(--s-1); margin: 0; flex: 0 1 130px; min-width: 110px; }
.survey-add-row label.grow, .interval-add-row label.grow { flex: 1 1 220px; }
.survey-add-row input, .interval-add-row input, .interval-add-row select { width: 100%; margin: 0; }
.survey-add-row > button, .interval-add-row > button { min-height: 34px; }
.interval-add-row label.check-row, .drill-form-grid label.check-row { display: flex; align-items: center; flex: 0 0 auto; min-width: 0; min-height: 34px; }
.interval-add-row label.check-row input, .drill-form-grid label.check-row input { width: auto; }
.interval-add-row label:has(> select[name="module_id"]) { flex: 0 1 260px; min-width: 220px; }

/* Sheets: spreadsheet-style logging grids (see /static/geode-sheet.js) ---------- */
.sheet-card > .card__head { margin-bottom: var(--s-3); flex-direction: column; align-items: stretch; gap: var(--s-3); }
.sheet-card > [data-finding] { margin: 2px 0 var(--s-1); font-size: var(--t-sm); }
.sheet-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.sheet-tools form { margin: 0; }
.sheet-scroll { max-height: 62vh; }
table.geode-sheet, table.geode-sheet.geode-grid { min-width: 0; border-collapse: separate; border-spacing: 0; }
.geode-sheet th, .geode-sheet td { padding: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); position: relative; }
.geode-sheet thead th { padding: 6px var(--s-2); position: sticky; top: 0; z-index: 3; }
.geode-sheet td > input, .geode-sheet td > select {
  display: block; width: 100%; min-width: 96px; min-height: 30px; margin: 0; padding: 4px var(--s-2);
  border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: var(--t-sm);
}
.geode-sheet td > input[inputmode="decimal"] { text-align: right; font-variant-numeric: tabular-nums; min-width: 80px; }
.geode-sheet td > input:focus, .geode-sheet td > select:focus { outline: 2px solid var(--accent); outline-offset: -2px; box-shadow: none; background: var(--surface); }
.geode-sheet td > input[data-defaulted="true"] { color: var(--ink-muted); }
.geode-sheet td > [aria-invalid="true"] { background: var(--danger-bg); outline: 2px solid var(--danger-ink); outline-offset: -2px; }
.geode-sheet tbody tr:hover { background: var(--surface-hover); }
.geode-sheet .sheet-depth { width: 92px; min-width: 92px; background: var(--surface-sunken); }
.geode-sheet td.sheet-depth, .geode-sheet thead th.sheet-depth { position: sticky; }
.geode-sheet td.sheet-depth { z-index: 1; }
.geode-sheet thead th.sheet-depth { z-index: 4; }
.geode-sheet .sheet-depth:nth-child(1) { left: 0; }
.geode-sheet .sheet-depth:nth-child(2) { left: 92px; }
.geode-sheet .sheet-depth:nth-child(3) { left: 184px; }
.geode-sheet.sample-sheet .sheet-depth:nth-child(1) { width: 56px; min-width: 56px; }
.geode-sheet.sample-sheet .sheet-depth:nth-child(2) { left: 56px; }
.geode-sheet.sample-sheet .sheet-depth:nth-child(3) { left: 148px; }
.geode-sheet.sample-sheet .sheet-depth:nth-child(4) { left: 240px; }
.geode-sheet td > input:disabled, .geode-sheet td > select:disabled { color: var(--ink-muted); background: var(--surface-sunken); opacity: 1; cursor: default; }
.geode-sheet tr[data-kind="control"] td > [data-col="code"], .geode-sheet tr[data-kind="duplicate"] td > [data-col="code"] { font-style: italic; }
.geode-sheet tr[data-locked] td { background: var(--surface-sunken); }
.geode-sheet.sample-sheet td > select[data-col="type"] { min-width: 120px; }
.geode-sheet.sample-sheet td > input[data-col="code"] { min-width: 124px; }
.geode-sheet.sample-sheet td > input[data-col="parent"] { min-width: 116px; }
.geode-sheet.sample-sheet td > select[data-col="duplicate_type"], .geode-sheet.sample-sheet td > select[data-col="reference"] { min-width: 104px; }
.geode-sheet.sample-sheet thead th { white-space: nowrap; }
.geode-sheet .sheet-lock { display: inline-flex; color: var(--ink-muted); }
.geode-sheet td[data-dispatch] { white-space: nowrap; font-size: var(--t-xs); }
.geode-sheet td.derived, .geode-sheet th.derived { padding: 4px var(--s-2); color: var(--ink-muted); background: var(--surface-sunken); font-variant-numeric: tabular-nums; }
.geode-sheet .sheet-row-actions { width: 34px; border-right: 0; text-align: center; }
/* 0.10.0.3: compact Structure rows. A derived reason never wraps (its full text is the cell's tooltip); a tick-box column is narrow with the box centred,
   instead of inheriting the 96 px / 30 px minimums of an editable text cell. */
.geode-sheet td.structure-why { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.geode-sheet .sheet-check { width: 48px; min-width: 48px; max-width: 48px; text-align: center; white-space: nowrap; }
.geode-sheet td.sheet-check > input[type="checkbox"] { display: block; width: 16px; height: 16px; min-width: 0; min-height: 0; margin: 7px auto; padding: 0; }
.geode-sheet .sheet-row-actions .icon-button { width: 28px; height: 28px; min-height: 28px; opacity: .45; }
.geode-sheet tr:hover .sheet-row-actions .icon-button, .geode-sheet .sheet-row-actions .icon-button:focus-visible { opacity: 1; color: var(--danger-ink); }
.geode-sheet tr[data-row-error] td { padding: 4px var(--s-2); background: var(--danger-bg); color: var(--danger-ink); font-size: var(--t-xs); }
.geode-sheet tr.sheet-fill-target td { background: var(--accent-soft); }
.sheet-fill-handle {
  position: absolute; right: -4px; bottom: -4px; z-index: 5; width: 9px; height: 9px; min-height: 0; padding: 0;
  background: var(--accent); border: 1px solid var(--surface); border-radius: 1px; cursor: crosshair; touch-action: none;
}
.sheet-fill-handle:hover { background: var(--accent-hover); }
.sheet-defining { color: var(--accent-ink); }
.sheet-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-top: var(--s-2); font-size: var(--t-xs); color: var(--ink-secondary); }
.sheet-foot [data-state="dirty"] { color: var(--warn-ink); font-weight: 600; }
.sheet-foot [data-state="error"] { color: var(--danger-ink); font-weight: 600; }
.sheet-foot [data-state="saving"] { color: var(--ink-secondary); }
.sheet-foot [data-state="saved"] { color: var(--ok-ink); }
.sheet-retry { min-height: 0; padding: 0 var(--s-2); font-size: var(--t-xs); vertical-align: baseline; }
.method-channel { padding: var(--s-3) 0; border-top: 1px solid var(--border); }
.method-channel:first-of-type { border-top: 0; padding-top: 0; }
.method-channel__head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3) var(--s-4); margin-bottom: var(--s-2); }
.method-channel__head label:first-child { display: grid; gap: var(--s-1); margin: 0; min-width: 220px; }
.method-channel__head .row-actions { margin-left: auto; }
.method-channel__status { margin: 0 0 var(--s-1); min-height: 1.4em; font-size: var(--t-xs); }   /* its own line: a status never moves the controls being clicked */
.method-channel__status[data-state="error"] { color: var(--danger-ink); font-weight: 600; }
.method-channel__status[data-state="saved"] { color: var(--ok-ink); }
.method-channel__status[data-state="dirty"] { color: var(--warn-ink); }
.method-channel fieldset { margin: 0; padding: var(--s-2) var(--s-3); border: 1px solid var(--border); border-radius: var(--r-sm); }
.method-channel legend { padding: 0 var(--s-1); font-size: var(--t-xs); font-weight: 600; color: var(--ink-secondary); }
.method-channel__fields { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }

/* == 13 Dashboard ========================================================= */

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-5); align-items: start; }
.dash > * { min-width: 0; }
.dash .card { margin-bottom: var(--s-4); }

.attention { margin: 0; padding: 0; list-style: none; }
.attention > li { border-top: 1px solid var(--border); }
.attention > li:first-child { border-top: 0; }
.attention a {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-5); color: inherit; text-decoration: none;
}
.attention a:hover { background: var(--surface-hover); color: inherit; }
.attention__icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn-ink); }
.attention__icon--danger { background: var(--danger-bg); color: var(--danger-ink); }
.attention__icon--info { background: var(--info-bg); color: var(--info-ink); }
.attention__icon .geode-icon { width: 17px; height: 17px; }
.attention__text { flex: 1; min-width: 0; }
.attention__text strong { display: block; font-weight: 550; }
.attention__text span { display: block; color: var(--ink-secondary); font-size: var(--t-sm); }
.attention__go { color: var(--ink-muted); display: inline-flex; }

.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; }
.pipeline a, .pipeline > div {
  position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: var(--s-4) var(--s-5); color: inherit; text-decoration: none;
  border-left: 1px solid var(--border);
}
.pipeline > :first-child { border-left: 0; }
.pipeline a:hover { background: var(--surface-hover); color: inherit; }
.pipeline__label { white-space: nowrap; display: flex; align-items: center; gap: var(--s-2); color: var(--ink-secondary); font-size: var(--t-sm); }
.pipeline__label .geode-icon { width: 15px; height: 15px; }
.pipeline__value { font-size: var(--t-xl); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pipeline__note { color: var(--ink-muted); font-size: var(--t-xs); }

.service-list { margin: 0; padding: 0; list-style: none; }
.service-list > li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-top: 1px solid var(--border); }
.service-list > li:first-child { border-top: 0; padding-top: 0; }
.service-list > li:last-child { padding-bottom: 0; }
.service-list__name { flex: 1; min-width: 0; }
.service-list__name a { color: var(--ink); font-weight: 550; text-decoration: none; }
.service-list__name a:hover { color: var(--accent-ink); }
.service-list__name small { display: block; }

.shortcut-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.shortcut {
  display: flex; align-items: center; gap: var(--s-2); min-height: 40px; padding: 0 var(--s-3);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--ink); font-weight: 500; font-size: var(--t-sm); text-decoration: none;
}
.shortcut:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--ink); }
.shortcut .geode-icon { width: 16px; height: 16px; color: var(--accent-ink); }

/* == 14 Dialogs & menus =================================================== */

dialog { max-width: min(560px, calc(100vw - 32px)); padding: var(--s-6); background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(19, 23, 34, .45); }
dialog h2 { margin-top: 0; }
dialog .button-group { justify-content: flex-end; margin-top: var(--s-5); }

.user-menu summary {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0;
  background: var(--surface); color: var(--ink-secondary);
  border: 1px solid var(--border-strong); border-radius: var(--r-pill);
}
.user-menu summary:hover { background: var(--surface-sunken); color: var(--ink); }
.user-menu summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-menu summary svg { width: 18px; height: 18px; }
.user-menu-panel {
  left: 0; right: auto; top: auto; bottom: calc(100% + var(--s-2));
  min-width: 240px; padding: var(--s-2); gap: 0;
  border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg);
}
.user-menu-panel > strong, .user-menu-panel > small { padding: 0 var(--s-3); }
.user-menu-panel > strong { padding-top: var(--s-2); }
.user-menu-panel > small:last-of-type { padding-bottom: var(--s-2); margin-bottom: var(--s-1); border-bottom: 1px solid var(--border); }
.user-menu-panel a { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 500; }
.user-menu-panel a:hover { background: var(--surface-sunken); }
.user-menu-panel a .geode-icon, .user-menu-panel button .geode-icon { width: 16px; height: 16px; color: var(--ink-secondary); }
.user-menu-panel form { margin-top: var(--s-1); padding-top: var(--s-1); border-top: 1px solid var(--border); }
.user-menu-panel button { --b: transparent; --bh: var(--surface-sunken); --i: var(--ink); justify-content: flex-start; padding: 0 var(--s-3); background: var(--b); color: var(--i); }
body.no-rail .user-menu-panel { bottom: auto; top: calc(100% + var(--s-2)); left: auto; right: 0; }

.password-entry .password-toggle { color: var(--ink-secondary); --bh: var(--surface-sunken); }
.password-toggle:hover { background: var(--surface-sunken); color: var(--ink); }
.password-toggle:focus-visible { outline: 2px solid var(--accent); }

/* == 15 Auth & error pages ================================================ */

.auth-card { max-width: 440px; margin: var(--s-9) auto; padding: var(--s-7); }
.auth-card h1 { font-size: var(--t-xl); }
.auth-card label { margin-top: var(--s-4); margin-bottom: var(--s-1); }
.auth-card form > button { width: 100%; margin-top: var(--s-5); }
.auth-card dl { display: grid; grid-template-columns: auto 1fr; gap: var(--s-1) var(--s-4); margin: 0 0 var(--s-4); }
.auth-card dt { color: var(--ink-secondary); }
.auth-card dd { margin: 0; }

.error-page { max-width: 560px; margin: var(--s-9) auto; text-align: center; }
.error-page__code { display: inline-flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); }
.error-page__icon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin: 0 auto var(--s-4); border-radius: var(--r-pill); background: var(--warn-bg); color: var(--warn-ink); }
.error-page__icon .geode-icon { width: 24px; height: 24px; }
.error-page__icon--danger { background: var(--danger-bg); color: var(--danger-ink); }
.error-page__icon--idle { background: var(--idle-bg); color: var(--idle-ink); }
.error-page p { color: var(--ink-secondary); }
.error-page .error-page__detail { padding: var(--s-3) var(--s-4); background: var(--surface-sunken); border-radius: var(--r); color: var(--ink); text-align: left; overflow-wrap: anywhere; }
.error-page .actions { justify-content: center; margin-top: var(--s-5); }

/* == 16 Quick navigation ================================================== */

.quicknav { width: min(560px, calc(100vw - 32px)); padding: 0; margin-top: 12vh; overflow: hidden; }
.quicknav__search { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); color: var(--ink-muted); }
.quicknav__search input { flex: 1; min-height: 32px; padding: 0; border: 0; box-shadow: none; font-size: var(--t-md); background: transparent; }
.quicknav__search input:focus { box-shadow: none; }
.quicknav__list { max-height: 50vh; margin: 0; padding: var(--s-2); overflow-y: auto; list-style: none; }
.quicknav__item {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 38px; padding: 0 var(--s-3);
  border-radius: var(--r-sm); color: var(--ink); text-decoration: none;
}
.quicknav__item small { margin-left: auto; color: var(--ink-muted); }
.quicknav__item[aria-selected="true"], .quicknav__item:hover { background: var(--accent-soft); color: var(--accent-ink); }
.quicknav__empty { padding: var(--s-5); color: var(--ink-muted); text-align: center; }
.quicknav__hint { display: flex; gap: var(--s-4); padding: var(--s-2) var(--s-4); border-top: 1px solid var(--border); background: var(--surface-sunken); color: var(--ink-muted); font-size: var(--t-xs); }

/* == 17 Responsive, motion, print ========================================= */

@media (max-width: 1240px) {
  :root { --page-gutter: var(--s-5); }
  .dash { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1100px) {
  /* Narrow desktop windows: the rail yields its width to the data. */
  body.has-rail { padding-left: var(--rail-w-collapsed); }
  header.app-rail { width: var(--rail-w-collapsed); }
  .rail-label, .rail-group, .rail-user, .rail-brand a, .rail-quick span, .rail-quick kbd, .rail-toggle { display: none; }
  .rail-head { justify-content: center; padding: 0; }
  header.app-rail .rail-brand { margin: 0; }
  header.app-rail .rail-nav a, .rail-quick { justify-content: center; padding: 0; }
  .rail-foot { justify-content: center; padding: var(--s-3) 0; }
  .dash, .split { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pipeline > :nth-child(4) { border-left: 0; }
  .pipeline > :nth-child(n+4) { border-top: 1px solid var(--border); }
}
@media (max-width: 860px) {
  .settings-layout, .cols-2, .cols-3, .inline-add-row, .epsg-add-row { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { --page-gutter: var(--s-4); }
  body.has-rail { padding-left: 0; }
  header.app-rail { position: static; width: auto; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--border); }
  .rail-head { border-bottom: 0; padding: 0 var(--s-3); min-height: 52px; }
  .rail-nav { display: flex; flex: 1; padding: 0; overflow-x: auto; overflow-y: hidden; }
  header.app-rail .rail-nav a { min-width: 40px; }
  .rail-quick { display: none; }
  .rail-foot { border-top: 0; padding: 0 var(--s-3); }
  .user-menu-panel { bottom: auto; top: calc(100% + var(--s-2)); left: auto; right: 0; }
  .pipeline { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
@media print {
  header.app-rail, footer, .rail-quick, .quicknav { display: none !important; }
  body.has-rail { padding-left: 0 !important; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---- 0.9.3.2: inline fields (static/geode-inline.js) ---- */
.inline-field { cursor: text; border-radius: var(--r-sm, 4px); padding: 2px 0; outline: 1px solid transparent; outline-offset: 4px; box-shadow: 0 0 0 4px transparent; transition: outline-color .12s, background .12s, box-shadow .12s; min-height: 26px; }
.inline-field:hover, .inline-field:focus-visible { outline-color: var(--border-strong); background: var(--surface-hover); box-shadow: 0 0 0 4px var(--surface-hover); }
.inline-field:hover::after { content: "✎"; margin-left: 8px; color: var(--ink-muted); font-size: var(--t-xs); }
.inline-field.is-editing { outline-color: transparent; background: transparent; box-shadow: none; cursor: default; }
.inline-field.is-editing::after { content: none; }
.inline-field.is-saving { opacity: .6; }
.inline-field.is-saved { outline-color: var(--ok-border, #86efac); }
.inline-field__editor { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: flex-start; }
.inline-field__editor input, .inline-field__editor select { min-height: 30px; padding: 3px var(--s-2); width: auto; min-width: 120px; max-width: 100%; }
.inline-field__editor textarea { width: 100%; min-width: 260px; }
.inline-field__error { flex-basis: 100%; color: var(--danger-ink); font-size: var(--t-sm); }
.inline-hint { margin-top: var(--s-3); font-size: var(--t-xs); }

/* ---- 0.9.3.2: tick / choice cells and swatch cells of the sheet ---- */
.geode-sheet td.sheet-tick, .geode-sheet th.sheet-tick { width: 1%; text-align: center; white-space: nowrap; }
.geode-sheet td.sheet-tick > input { display: inline-block; width: 16px; min-width: 0; min-height: 0; height: 16px; margin: 7px var(--s-2); padding: 0; accent-color: var(--accent); }
.geode-sheet td > input[type="color"] { min-width: 52px; width: 52px; height: 30px; padding: 2px 4px; cursor: pointer; }
.geode-sheet td > input[type="date"] { min-width: 132px; }
.geode-sheet.collar-sheet tr[data-effective] td { background: var(--ok-bg, #f0fdf4); }
.geode-sheet.collar-sheet td > select[data-col="crs"] { min-width: 112px; }
.geode-sheet.collar-sheet td > input[data-col="note"] { min-width: 180px; }
[data-sheet-status][data-state="saved"] { color: var(--ok-ink, #166534); }
[data-sheet-status][data-state="error"] { color: var(--danger-ink); }
.swatch-preview { display: inline-block; width: 56px; height: 28px; border: 1px solid var(--border); border-radius: 2px; vertical-align: middle; background-repeat: repeat; }

/* ---- 0.9.3.2: List value grid, visual pattern picker, Pattern Library ---- */
.list-add { padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); }
.list-add > summary { list-style: none; display: inline-flex; cursor: pointer; }
.list-add > summary::-webkit-details-marker { display: none; }
.list-add[open] > summary { margin-bottom: var(--s-4); }
.geode-sheet.list-sheet td > input.lookup-value-input { min-width: 220px; font-weight: 500; }
.geode-sheet.list-sheet td > input[data-col="description"] { min-width: 260px; }
.geode-sheet .list-drag { width: 30px; }
.geode-sheet .list-drag .drag-handle { display: inline-flex; cursor: grab; color: var(--ink-muted); padding: 5px 2px; }
.geode-sheet .list-actions { width: 68px; white-space: nowrap; }
.geode-sheet .lookup-row:not([data-id]) .drag-handle, .geode-sheet .lookup-row:not([data-id]) [data-archive-value] { visibility: hidden; }
.geode-sheet .lookup-row.dragging td { opacity: .45; }
.geode-sheet td.is-unused > input[type="color"] { opacity: .35; }
.geode-sheet td.pattern-cell { min-width: 190px; }
.pattern-pick { display: flex; align-items: center; justify-content: flex-start; gap: var(--s-2); width: 100%; min-height: 30px; padding: 1px var(--s-2); border: 0; border-radius: 0; background: transparent; color: inherit; font-size: var(--t-sm); font-weight: 400; text-align: left; cursor: pointer; box-shadow: none; }
.pattern-pick:hover { background: var(--surface-hover); }
.pattern-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pattern-pick .swatch-preview { flex: none; }
.pattern-pick__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-secondary); }
.pattern-picker { position: absolute; z-index: 200; width: 316px; max-height: 340px; overflow: auto; padding: var(--s-2); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md, 8px); box-shadow: 0 12px 32px rgba(15, 23, 42, .18); }
.pattern-picker__filter { width: 100%; min-height: 30px; margin-bottom: var(--s-2); padding: 3px var(--s-2); }
.pattern-picker__grid { display: grid; grid-template-columns: repeat(auto-fill, 44px); gap: 6px; }
.pattern-picker__tile { width: 44px; height: 44px; min-height: 0; padding: 0; border: 1px solid var(--border); border-radius: 3px; cursor: pointer; box-shadow: none; }
.pattern-picker__tile:hover, .pattern-picker__tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pattern-picker__tile[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; box-shadow: inset 0 0 0 2px var(--surface); }
.pattern-drop__zone { display: flex; flex-direction: column; align-items: center; gap: var(--s-1); padding: var(--s-6) var(--s-4); border: 2px dashed var(--border-strong); border-radius: var(--r-md, 8px); background: var(--surface-sunken); text-align: center; cursor: pointer; }
.pattern-drop__zone:hover, .pattern-drop__zone:focus-visible, .pattern-drop__zone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.swatch-preview--lg { width: 96px; height: 48px; }
.geode-sheet.pattern-sheet td.pattern-thumb-cell { width: 112px; padding: 4px var(--s-2); }
.geode-sheet.pattern-sheet td > input[data-col="name"] { min-width: 240px; }
.geode-sheet.pattern-sheet details > summary { cursor: pointer; }
.geode-sheet.pattern-sheet details form { margin-top: var(--s-2); flex-wrap: wrap; }

/* ---- 0.9.3.3: row menu of the sheet, Split Sample dialog, Locate ---- */
.sheet-row-menu { position: absolute; z-index: 300; min-width: 190px; padding: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md, 8px); box-shadow: 0 12px 32px rgba(15, 23, 42, .18); }
.sheet-row-menu__title { margin: 2px 8px 4px; font-size: var(--t-xs); color: var(--ink-muted); text-transform: uppercase; letter-spacing: .05em; }
.sheet-row-menu button { display: block; width: 100%; min-height: 30px; padding: 4px 10px; text-align: left; font-size: var(--t-sm); font-weight: 400; color: var(--ink); background: transparent; border: 0; border-radius: 4px; box-shadow: none; }
.sheet-row-menu button:hover:not(:disabled), .sheet-row-menu button:focus-visible { background: var(--surface-hover); }
.sheet-row-menu button:disabled { color: var(--ink-muted); cursor: not-allowed; }
.sample-split { max-width: 520px; padding: var(--s-5); border: 1px solid var(--border); border-radius: var(--r-md, 8px); }
.sample-split::backdrop { background: rgba(15, 23, 42, .45); }
.sample-split h2 { margin-top: 0; }
.sample-split fieldset { margin: var(--s-3) 0; padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-sm, 4px); }
.sample-split .check-row { align-items: flex-start; margin: var(--s-2) 0; font-weight: 400; }
.locate-row { flex-wrap: wrap; gap: var(--s-3); }

/* ---- 0.9.3.3: one aligned filter / action bar (Dispatch register, Sample picker, Lab Methods) ----
   Labels sit above their control, every control has the same height, and the button lines up with the controls, not the labels. */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s-3) var(--s-4); align-items: end; margin-bottom: var(--s-4); }
.filter-bar > label, .filter-bar .field { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: var(--t-sm); font-weight: 500; color: var(--ink-secondary); min-width: 0; }
.filter-bar > label.grow { grid-column: span 2; }
.filter-bar input, .filter-bar select { width: 100%; min-height: 38px; height: 38px; margin: 0; box-sizing: border-box; }
.filter-bar > button, .filter-bar > .btn { min-height: 38px; height: 38px; justify-self: start; align-self: end; margin: 0; white-space: nowrap; }
.card.filter-bar { padding: var(--s-4); }

/* ---- Drill structures (0.9.4): Core Orientation Runs, the convention drawing, the Structure sheet, symbols ---- */
.run-form { margin-top: var(--s-5); padding: var(--s-5); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-sunken); display: grid; gap: var(--s-3); }
.run-form h3 { margin: 0; }
.run-form .check-row { align-items: flex-start; }
.convention-summary { margin: 0; padding: var(--s-3) var(--s-4); border-left: 3px solid var(--accent); background: var(--surface); border-radius: var(--r-xs); }
.core-convention { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s-2); overflow-x: auto; }
.core-convention__svg { display: block; width: 100%; min-width: 560px; max-width: 900px; margin: 0 auto; height: auto; font-family: var(--font); }
.core-convention__svg text { fill: var(--ink-secondary); font-size: 11px; user-select: none; }
.core-convention__svg .core-title { fill: var(--ink); font-size: 13px; font-weight: 600; }
.core-convention__svg .core-label { fill: var(--ink); font-size: 12px; font-weight: 600; }
.core-convention__svg .core-greek { fill: var(--accent-ink); font-size: 15px; font-style: italic; font-weight: 600; }
.core-body { fill: #ece7dd; stroke: var(--border-strong); stroke-width: 1; }
.core-end { fill: #f6f2ea; stroke: var(--border-strong); stroke-width: 1; }
.core-axis { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 5 4; }
.core-axis-head, .core-sight-head, .core-pole-head, .core-angle-head, .core-beta-head, .core-turn-head { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.core-axis-head { stroke: var(--ink-muted); }
.core-plane { fill: rgba(79, 70, 229, .13); stroke: none; }
.core-plane--face { stroke: var(--accent); stroke-width: 1.4; }
.core-trace { fill: none; stroke: var(--accent); stroke-width: 2; }
.core-trace--back { stroke-dasharray: 4 3; opacity: .55; }
.core-long-axis { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 3; }
.core-angle { fill: none; stroke: var(--accent-ink); stroke-width: 1.4; }
.core-angle-head { stroke: var(--accent-ink); }
.core-pole { stroke: var(--ink-secondary); stroke-width: 1.4; }
.core-pole-head { stroke: var(--ink-secondary); }
.core-lineation { stroke: var(--danger-ink); stroke-width: 2.2; stroke-linecap: round; }
.core-beta { fill: none; stroke: var(--ok-ink); stroke-width: 2; }
.core-beta-head { stroke: var(--ok-ink); }
.core-section { fill: #f6f2ea; stroke: var(--border-strong); stroke-width: 1.2; }
.core-axis-mark { fill: var(--surface); stroke: var(--ink-muted); stroke-width: 1; }
.core-axis-cross { stroke: var(--ink-muted); stroke-width: 1.4; }
.core-axis-dot { fill: var(--ink-muted); }
.core-hit { fill: transparent; stroke: transparent; stroke-width: 18; }
.core-hit--path { fill: none; }
.core-refline { stroke: var(--ink-muted); stroke-width: 2; }
.core-dot { fill: var(--surface); stroke: var(--ink-muted); stroke-width: 1.6; }
.core-dot--back { stroke-dasharray: 2 2; }
.core-dot--end { fill: var(--ok-ink); stroke: var(--ok-ink); }
.core-turn { fill: none; stroke: var(--ink-muted); stroke-width: 2; }
.core-turn-head { stroke: var(--ink-muted); }
.core-eye { fill: var(--surface); stroke: var(--ink-muted); stroke-width: 1.4; }
.core-eye-pupil { fill: var(--ink-muted); }
.core-sight { stroke: var(--ink-muted); stroke-width: 1.4; }
.core-sight-head { stroke: var(--ink-muted); }
.core-pill rect { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; }
.core-hot { cursor: pointer; outline: none; }
.core-hot:hover .core-refline, .core-hot:hover .core-turn, .core-hot:hover .core-turn-head, .core-hot:hover .core-eye, .core-hot:hover .core-dot, .core-hot:hover .core-sight, .core-hot:hover .core-sight-head { stroke: var(--accent); }
.core-hot:hover rect { stroke: var(--accent); }
.core-hot:focus-visible .core-hit, .core-hot:focus-visible rect { stroke: var(--accent-ring); }
.core-hot:focus-visible rect { stroke-width: 3; }
.core-hot.is-on .core-refline { stroke: var(--danger-ink); stroke-width: 3.2; }
.core-hot.is-on .core-dot { fill: var(--danger-ink); stroke: var(--danger-ink); }
.core-hot.is-on .core-turn, .core-hot.is-on .core-turn-head { stroke: var(--ok-ink); stroke-width: 2.8; }
.core-hot.is-on .core-eye { stroke: var(--accent); fill: var(--accent-soft); } .core-hot.is-on .core-eye-pupil { fill: var(--accent); }
.core-hot.is-on .core-sight, .core-hot.is-on .core-sight-head { stroke: var(--accent); }
.core-hot.is-on text.core-label { fill: var(--danger-ink); }
.core-hot.is-on rect { fill: var(--accent); stroke: var(--accent); } .core-hot.is-on.core-pill text { fill: #fff; font-weight: 600; }
.core-hot.is-locked { cursor: default; }
.core-hot:not(.is-on) .core-eye, .core-hot:not(.is-on) .core-sight, .core-hot:not(.is-on) .core-sight-head, .core-hot:not(.is-on) .core-eye-pupil { opacity: .55; }
/* 0.9.6.1: a button that reads like a link (the log's "All shortcuts" toggle). */
button.linklike { background: none; border: 0; box-shadow: none; padding: 0 2px; min-height: 0; color: var(--accent-ink, var(--accent)); text-decoration: underline; cursor: pointer; font: inherit; }
button.linklike:hover { background: none; color: var(--accent); }
/* 0.9.6.1: a checkbox inside a filter bar is a checkbox, not a 38 px wide field. */
.filter-bar label.check-row { display: flex; flex-direction: row; align-items: center; gap: var(--s-2); align-self: end; min-height: 38px; }
.filter-bar label.check-row input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; flex: 0 0 16px; margin: 0; }
/* 0.9.6.1: the fixed part of the canonical convention is drawn and named, not offered. The one state in force is shown as such; the alternative stays faint. */
.core-fixed { cursor: default; }
.core-fixed.is-on .core-turn, .core-fixed.is-on .core-turn-head { stroke: var(--ok-ink); stroke-width: 2.8; }
.core-fixed.is-on .core-eye { stroke: var(--accent); fill: var(--accent-soft); } .core-fixed.is-on .core-eye-pupil { fill: var(--accent); }
.core-fixed.is-on .core-sight, .core-fixed.is-on .core-sight-head { stroke: var(--accent); }
.core-fixed:not(.is-on) { opacity: .28; }
.core-convention__svg .core-manual text.core-title { font-size: 12px; }
.convention-manual { display: grid; gap: 2px; padding: var(--s-2) var(--s-3); margin: 0 0 var(--s-2); border-left: 3px solid var(--accent); background: var(--surface-sunken); font-size: var(--t-xs); color: var(--ink-secondary); }
.convention-manual strong { color: var(--ink); font-size: var(--t-sm); }
.convention-manual ul { margin: 0; padding-left: 18px; } .convention-manual li { margin: 0; }
.convention-manual .notice { margin: var(--s-1) 0 0; }
.structure-sheet [data-derived="orientation"] { font-variant-numeric: tabular-nums; white-space: nowrap; }
.structure-sheet [data-unavailable] { color: var(--warn-ink); }
.structure-sheet .structure-why { max-width: 260px; font-size: var(--t-xs); white-space: normal; }
.structure-sheet input[data-col="gamma"]:disabled { background: var(--surface-sunken); }
.symbol-cell { white-space: nowrap; } .symbol-cell select { display: inline-block; width: calc(100% - 36px); min-width: 120px; vertical-align: middle; }
.symbol-thumb { display: inline-flex; vertical-align: middle; margin-right: 6px; width: 26px; height: 26px; flex: none; align-items: center; justify-content: center; color: var(--ink); }
.symbol-thumb svg { width: 100%; height: 100%; }
.symbol-thumb--lg { width: 44px; height: 44px; }

/* ---- Best (Preferred) assay values (0.9.5): derived, never a laboratory result ---- */
.best-col { background: #f5f3ff; }
th.best-col small { font-weight: normal; color: var(--ink-muted); }
.best-value { all: unset; cursor: pointer; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent-ink); }
.best-value:hover, .best-value:focus-visible { outline: 2px solid var(--accent-ring); border-radius: 3px; }
.best-strip { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: var(--s-3) 0; }
.best-strip__title { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); margin-right: var(--s-1); }
.best-chip { display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 10px; border: 1px solid var(--accent-border); border-radius: var(--r-pill); background: var(--accent-soft); font-variant-numeric: tabular-nums; }
.best-chip small { color: var(--ink-muted); }
.best-chip__why { all: unset; cursor: pointer; font-size: var(--t-xs); color: var(--accent-ink); text-decoration: underline dotted; margin-left: 2px; }
.best-chip__why:focus-visible { outline: 2px solid var(--accent-ring); border-radius: 3px; }
dialog.best-why { border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: var(--s-5); width: min(900px, 94vw); max-width: none; box-sizing: border-box; box-shadow: var(--shadow-lg); }
dialog.best-why::backdrop { background: rgba(19, 23, 34, .35); }
.best-why__head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); }
.best-why__head h2 { margin: 0; }
.best-why h3 { margin: var(--s-4) 0 var(--s-2); font-size: var(--t-base); }
.best-why__reasons { margin: 0; padding-left: 1.2em; }
.best-why__table tr.is-selected td { background: var(--ok-bg); font-weight: 600; }
.best-why__table tr.is-unclassified td { color: var(--warn-ink); }

/* ---- Assay Preference Profile builder (0.9.5) ---- */
.ap-steps { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-2); margin: 0 0 var(--s-5); }
.ap-steps a { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); color: var(--ink-secondary); text-decoration: none; font-size: var(--t-xs); }
.ap-steps a:hover { border-color: var(--accent); color: var(--accent-ink); }
.ap-steps a span, .ap-step { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-ink); font-size: var(--t-xs); font-weight: 600; }
.ap-step { margin-right: 6px; vertical-align: middle; }
.ap-static { margin: 6px 0 0; }
.ap-table-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 430px); gap: var(--s-5); align-items: start; }
@media (max-width: 1250px) { .ap-table-layout { grid-template-columns: 1fr; } }
.ap-groups { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); }
.ap-group { --group: var(--ink-muted); background: var(--surface); color: var(--ink); border: 2px solid var(--group); border-radius: var(--r-pill); padding: 2px 10px; font-size: var(--t-xs); cursor: pointer; }
.ap-group:hover, .ap-group:focus-visible { background: color-mix(in srgb, var(--group) 12%, white); }
.ap-ptable { display: grid; grid-template-columns: repeat(18, minmax(38px, 1fr)); grid-auto-rows: 52px; gap: 3px; overflow-x: auto; padding-bottom: var(--s-2); }
.ap-ptable::before { content: ""; grid-row: 8; grid-column: 1 / -1; height: 8px; }
.ap-tile { all: unset; box-sizing: border-box; position: relative; display: block; padding: 2px; border-radius: 6px; background: var(--ring, var(--border-strong)); cursor: pointer; min-width: 38px; }
.ap-tile:disabled { cursor: default; opacity: .38; }
.ap-tile.is-selected { padding: 4px; box-shadow: 0 0 0 2px var(--ink); z-index: 1; }
.ap-tile:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 1px; }
.ap-tile__face { position: relative; display: flex; flex-direction: column; justify-content: center; height: 100%; padding: 2px 4px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.ap-tile:hover:not(:disabled) .ap-tile__face { background: var(--surface-hover); }
.ap-tile.is-selected .ap-tile__face { background: var(--accent-soft); }
.ap-tile b { font-size: 14px; line-height: 1.1; }
.ap-tile small { font-size: 8.5px; line-height: 1.1; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-marker { display: inline-block; width: 9px; height: 9px; flex: none; }
.ap-marker--circle { border-radius: 50%; }
.ap-tile .ap-marker { position: absolute; right: 3px; }
.ap-tile .ap-marker--square { top: 3px; } .ap-tile .ap-marker--circle { bottom: 3px; }
.ap-tile__own { position: absolute; left: 5px; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.ap-legends { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6); margin-top: var(--s-3); font-size: var(--t-xs); color: var(--ink-secondary); }
.ap-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.ap-legend strong { color: var(--ink); }
.ap-legend span { display: inline-flex; align-items: center; gap: 4px; }
.ap-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border-strong); background: var(--surface); }
.ap-key--selected { border: 3px solid var(--ink); } .ap-key--own { position: relative; } .ap-key--own::after { content: ""; position: absolute; left: 2px; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }
.ap-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); position: sticky; top: var(--s-3); min-width: 0; }
.ap-detail, .ap-apply { border: 1px solid var(--border); border-radius: var(--r); padding: var(--s-4); background: var(--surface-sunken); }
.ap-detail h3, .ap-apply h3 { margin: 0 0 var(--s-2); font-size: var(--t-base); }
.ap-detail__list { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: var(--t-sm); }
.ap-detail__list dt { color: var(--ink-muted); } .ap-detail__list dd { margin: 0; } .ap-detail__list ol { margin: 0; padding-left: 1.2em; }
.ap-apply__lists { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); margin-bottom: var(--s-3); }
.ap-apply h4 { margin: 0 0 4px; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); }
.ap-rank { list-style: none; margin: 0 0 var(--s-2); padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; min-width: 0; }
.ap-rank--wide { max-width: 640px; }
.ap-rank__item { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); font-size: var(--t-sm); cursor: grab; }
.ap-rank__item[draggable="false"] { cursor: default; }
.ap-rank__item.is-dragging { opacity: .45; } .ap-rank__item.is-muted { color: var(--ink-muted); border-style: dashed; }
.ap-rank__n { min-width: 16px; color: var(--ink-muted); font-variant-numeric: tabular-nums; font-size: var(--t-xs); }
.ap-rank__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-rank__moves { display: inline-flex; gap: 2px; }
.ap-rank__move { all: unset; cursor: pointer; width: 18px; height: 18px; text-align: center; line-height: 18px; border-radius: 3px; color: var(--ink-muted); font-size: 12px; }
.ap-rank__move:hover:not(:disabled), .ap-rank__move:focus-visible { background: var(--accent-soft); color: var(--accent-ink); } .ap-rank__move:disabled { opacity: .3; cursor: default; }
.ap-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ap-chip { background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); border-radius: var(--r-pill); padding: 2px 10px; font-size: var(--t-sm); cursor: pointer; }
.ap-chip:hover { border-color: var(--accent); }
.ap-test { margin-top: var(--s-4); } .ap-test__selected { font-size: var(--t-md); margin: var(--s-3) 0 0; } .ap-test h4 { margin: var(--s-3) 0 4px; }
.ap-summary { margin-top: var(--s-4); border-top: 1px solid var(--border); padding-top: var(--s-4); } .ap-summary h3 { margin: 0 0 var(--s-3); font-size: var(--t-base); }

/* Structure v2 (0.9.5.1): logging sessions, the reinterpret warning, the representation resolver and its close-up boundary editor */
.session-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.session-bar label { display: flex; align-items: center; gap: var(--s-2); margin: 0; } .session-bar select { width: auto; max-width: 100%; }
.reinterpret { padding: var(--s-3) var(--s-4); border: 1px solid #f0c36d; border-left-width: 4px; background: #fff8e6; border-radius: var(--r-xs); display: grid; gap: var(--s-2); }
.reinterpret p { margin: 0; }
dialog.structure-resolver { width: min(560px, calc(100vw - 32px)); box-sizing: border-box; overflow: visible; }
.structure-resolver p { margin: 0 0 var(--s-3); overflow-wrap: anywhere; }
.resolver-options { display: grid; gap: var(--s-2); }
.resolver-option { display: flex; align-items: flex-start; gap: var(--s-3); margin: 0; padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; font-weight: 400; }
.resolver-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.resolver-option input { width: auto; margin-top: 3px; } .resolver-option span { display: grid; gap: 2px; min-width: 0; } .resolver-option small { white-space: normal; }
.resolver-custom { padding: 0 var(--s-2); }
.boundary-editor { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); }
.boundary-editor__drawing { max-width: 100%; height: auto; touch-action: none; cursor: ns-resize; user-select: none; flex: 0 1 400px; }
.boundary-editor__side { display: grid; gap: var(--s-2); flex: 1 1 150px; min-width: 0; }
.boundary-editor__field { display: grid; gap: 4px; margin: 0; } .boundary-editor__field input { width: 9ch; font-variant-numeric: tabular-nums; }
.boundary-editor__core { fill: none; stroke: #6b7280; stroke-width: 1.2; }
.boundary-editor__zone--upper { fill: #dbeafe; } .boundary-editor__zone--lower { fill: #fde7c7; }
.boundary-editor__measurement { stroke: #111827; stroke-width: 1.6; } .boundary-editor__point { fill: #111827; }
.boundary-editor__label { font-size: 11px; fill: #374151; }
.boundary-editor__boundary { stroke: var(--accent); stroke-width: 2.4; stroke-dasharray: 6 3; }
.boundary-editor__grip { fill: var(--accent); } .boundary-editor__tip { fill: #111827; } .boundary-editor__tiptext { fill: #fff; font-size: 12px; font-variant-numeric: tabular-nums; }
.boundary-editor__handle:focus-visible { outline: none; } .boundary-editor__handle:focus-visible .boundary-editor__grip { stroke: #111827; stroke-width: 2; }
/* Structure Types in List Setup: optional observations, stroke + mapping, live preview */
.list-sheet .caps-list { display: grid; gap: 1px; min-width: 150px; } .list-sheet .caps-list .check-row { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--t-xs); white-space: nowrap; }
.list-sheet .caps-list input { width: auto; } .list-sheet .stroke-cell select { min-width: 150px; margin-bottom: 4px; }
.list-sheet .type-preview-cell svg { display: block; background: #fff; border: 1px solid var(--border); border-radius: var(--r-xs); }
/* Structural Stroke Builder */
.stroke-builder { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: var(--s-5); align-items: start; }
@media (max-width: 900px) { .stroke-builder { grid-template-columns: minmax(0, 1fr); } }
.stroke-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 70vh; overflow-y: auto; }
.stroke-list li { display: grid; grid-template-columns: 120px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: var(--s-3); align-items: center; padding: 4px var(--s-2); border: 1px solid transparent; border-radius: var(--r); cursor: pointer; }
.stroke-list li svg { grid-row: 1 / span 2; background: #fff; border: 1px solid var(--border); border-radius: var(--r-xs); }
.stroke-list li:hover { background: var(--surface-sunken); } .stroke-list li[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.stroke-list__name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.stroke-preview { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; padding: var(--s-4); background: var(--surface-sunken); border-radius: var(--r); margin-bottom: var(--s-4); }
.stroke-preview svg { background: #fff; border: 1px solid var(--border); border-radius: var(--r-xs); max-width: 100%; height: auto; }
.stroke-preview__frame { flex: 1 1 220px; min-width: 0; font-size: var(--t-sm); } .stroke-preview__frame p { margin: 0 0 var(--s-2); } .stroke-preview__frame .check-row { display: flex; gap: 6px; align-items: center; margin: 0; } .stroke-preview__frame input { width: auto; }
.stroke-form { display: grid; gap: var(--s-3); } .stroke-form fieldset { border: 1px solid var(--border); border-radius: var(--r); padding: var(--s-3) var(--s-4); margin: 0; min-width: 0; } .stroke-form legend { font-weight: 600; padding: 0 var(--s-2); }
.stroke-form__wide { grid-column: span 2; } .stroke-colour { display: flex; align-items: center; gap: var(--s-3); } .stroke-colour input[type=color] { width: 48px; padding: 2px; }
.motif-grid { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.motif-grid li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: var(--s-2); padding: var(--s-2); border: 1px solid var(--border); border-radius: var(--r); overflow-wrap: anywhere; font-size: var(--t-sm); }
.motif-thumb { width: 36px; height: 36px; display: grid; place-items: center; color: #1f2937; background: #fff; border: 1px solid var(--border); border-radius: var(--r-xs); } .motif-thumb svg { width: 28px; height: 28px; overflow: visible; }
.geode-sheet.list-sheet .caps-list .check-row { justify-content: flex-start; width: auto; padding: 1px 6px; }
.geode-sheet.list-sheet .caps-list input[type=checkbox] { width: 14px; height: 14px; min-height: 0; flex: 0 0 14px; margin: 0; }
.geode-sheet.list-sheet .stroke-cell { min-width: 190px; } .geode-sheet.list-sheet .symbol-cell select { min-width: 120px; }
.geode-sheet.list-sheet .type-preview-cell { padding: 2px 4px; }
.stroke-builder__editor .stroke-preview { position: sticky; top: 8px; z-index: 3; box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.08)); }   /* the live preview stays in sight while the properties are edited */
.stroke-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stroke-form > .stroke-form__wide, .stroke-form > p, .stroke-form > .wizard-nav { grid-column: 1 / -1; }
@media (max-width: 1100px) { .stroke-form { grid-template-columns: minmax(0, 1fr); } }
/* Structure Types, template first (0.9.5.2) */
.type-templates { margin: var(--s-3) 0 var(--s-4); padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-sunken); } .type-templates h3 { margin: 0 0 var(--s-3); font-size: var(--t-base); }
.type-templates__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s-2); }
.type-template { display: grid; gap: 2px; justify-items: start; text-align: left; padding: var(--s-3); min-height: 0; background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: none; font-weight: 400; cursor: pointer; }
.type-template small { color: var(--ink-secondary); font-size: var(--t-xs); white-space: normal; } .type-template:hover { border-color: var(--accent); } .type-template[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.type-template--custom { border-style: dashed; }
.type-templates__name { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s-3); margin-top: var(--s-3); } .type-templates__name[hidden] { display: none; } .type-templates__name label { display: grid; gap: 4px; margin: 0; min-width: 260px; }
.geode-sheet.list-sheet .behaviour-cell { min-width: 230px; padding: 4px 8px; white-space: normal; } .type-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-right: var(--s-2); vertical-align: middle; }
.geode-sheet.list-sheet .behaviour-cell .btn--sm { min-height: 24px; padding: 1px 8px; font-size: var(--t-xs); }
.visually-hidden-select { position: absolute; width: 24px; height: 24px; opacity: 0; pointer-events: none; }
.geode-sheet.list-sheet .stroke-cell { position: relative; min-width: 210px; }
.stroke-pick { display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: 30px; padding: 2px 8px; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: var(--r-xs); box-shadow: none; font-weight: 400; font-size: var(--t-sm); cursor: pointer; text-align: left; }
.stroke-pick svg { flex: 0 0 96px; background: #fff; border-radius: 2px; } .stroke-pick:hover { border-color: var(--accent); }
.stroke-menu { position: fixed; z-index: 80; width: 290px; max-height: 360px; overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); } .stroke-menu[hidden] { display: none; }
.stroke-menu__item { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 34px; padding: 2px 8px; background: transparent; color: var(--ink); border: 0; box-shadow: none; border-radius: var(--r-sm); font-weight: 400; font-size: var(--t-sm); text-align: left; cursor: pointer; }
.stroke-menu__item svg { flex: 0 0 120px; background: #fff; border: 1px solid var(--border); border-radius: 2px; } .stroke-menu__item:hover, .stroke-menu__item:focus-visible { background: var(--surface-sunken); } .stroke-menu__item[aria-selected="true"] { background: var(--accent-soft); }
dialog.type-advanced { width: min(620px, calc(100vw - 32px)); max-width: none; box-sizing: border-box; } .type-advanced__grid { display: grid; gap: var(--s-3); }
.type-advanced fieldset { border: 1px solid var(--border); border-radius: var(--r); padding: var(--s-3) var(--s-4); margin: 0; display: grid; gap: var(--s-2); } .type-advanced fieldset[hidden], .type-advanced label[hidden], .type-advanced div[hidden] { display: none; } .type-advanced legend { font-weight: 600; padding: 0 var(--s-2); }
.type-advanced .check-row { display: flex; align-items: flex-start; gap: var(--s-2); margin: 0; font-weight: 400; } .type-advanced .check-row input { width: auto; margin-top: 3px; } .type-advanced .check-row small { display: block; }
.type-advanced .symbol-cell { display: flex; align-items: center; gap: var(--s-2); }
.list-sheet th.is-resizable { position: relative; } .col-grip { position: absolute; top: 0; right: -3px; bottom: 0; width: 7px; cursor: col-resize; z-index: 2; touch-action: none; } .col-grip:hover, .col-grip:focus-visible { background: var(--accent); opacity: .5; outline: none; }
.list-sheet th[data-col="description"] { width: 170px; }
/* QA/QC analyte selection: the shared periodic table as a plain selector (no profile markers), other analytes as a list */
.qa-periodic { margin: var(--s-3) 0; } .qa-periodic .ap-tile:disabled { opacity: .28; cursor: default; } .qa-periodic .ap-tile.is-selected { background: var(--accent); } .qa-periodic .ap-tile.is-selected .ap-tile__face { background: var(--accent-soft); }
.qa-element-boxes[hidden] { display: none; } .qa-others__title { margin: var(--s-4) 0 var(--s-2); font-size: var(--t-sm); }

/* == Drill Import (0.10.0.12, implementation 014) ======================== */
.drill-import__drop { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5); cursor: pointer; }
.drill-import .inline-form { margin-top: var(--s-3); }
.drill-import .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s-3); }
.drill-import .card__body { padding: var(--s-3) var(--s-5); }
.drill-import__reason { margin: var(--s-2) 0; }
.drill-import__reason ul { margin: var(--s-2) 0 0; font-size: var(--t-sm); }
.drill-import [data-import-rows] .validation-message { display: inline; }
.import-tools { display: inline-flex; flex-wrap: wrap; gap: var(--s-2); }
.drill-import__start { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s-3); }
.drill-import__tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-5); }
.drill-import__tiles--compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s-2); }
.drill-import__tile { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.drill-import__tile.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.drill-import__tile header { display: flex; flex-direction: column; gap: 2px; }
.drill-import__tile p { margin: 0; }
.drill-import__tiles--compact .drill-import__tile { padding: var(--s-2) var(--s-3); }
.drill-import__drop--tile { padding: var(--s-3); font-size: var(--t-sm); }
.drill-import__file { font-size: var(--t-sm); overflow-wrap: anywhere; }
.drill-import__progress { position: sticky; top: 0; z-index: 5; margin: 0 0 var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--accent-soft); color: var(--ink); font-weight: 550; }
.drill-import__merge { margin: var(--s-3) 0; padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-muted, var(--surface)); }
.drill-import__merge p, .drill-import__merge ul { margin: 0 0 var(--s-2); }

/* == Drill Export (implementation 015) ================================= */
.drill-export__row { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s-3); }
.drill-export__choice, .drill-export__representation, .drill-export__datasets, .drill-export__columns { border: 0; margin: 0 0 var(--s-3); padding: 0; min-width: 0; }
.drill-export__choice { display: flex; gap: var(--s-3); }
.drill-export__representation label { display: block; margin-bottom: var(--s-2); }
.drill-export__datasets legend, .drill-export__columns legend { font-weight: 600; margin-bottom: var(--s-2); }
.drill-export__datasets, .drill-export__column-list, .drill-export__hole-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-1) var(--s-3); }
.drill-export__datasets legend { grid-column: 1 / -1; }
.drill-export__column-group { margin-bottom: var(--s-3); }
.drill-export__column-group .export-field-toolbar { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-1); }
.drill-export .export-field-row { display: flex; align-items: center; gap: var(--s-2); padding: 2px var(--s-2); border-left: 3px solid transparent; border-radius: var(--r-sm, 4px); }
.drill-export__holes { margin-top: var(--s-3); }
.drill-export__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.drill-export__progress { margin: var(--s-3) 0 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--accent-soft); }
.drill-export__progress[data-state=error] { background: var(--danger-bg); color: var(--danger-ink); }
