.account-actions { margin-left:auto; display:flex; align-items:center; gap:7px; }
.header-button { padding:7px 11px; border:1px solid var(--primary); border-radius:5px; color:#fff; background:var(--primary); cursor:pointer; }
.header-button.secondary { color:var(--primary); background:#fff; }
.parameter-summary { margin-top:12px; padding:9px 10px; border:1px solid #d8e1e8; border-radius:5px; color:#52606d; background:#f8fafc; font-size:12px; }
.parameter-summary.high-cost { border-color:#d49b59; color:#7d4314; background:#fff8ef; }
.status-badge { display:inline-block; padding:2px 8px; border-radius:999px; color:#52606d; background:#e8edf1; font-size:11px; text-transform:capitalize; }
.status-badge.queued { color:#875500; background:#fff1c7; }
.status-badge.running { color:#125b8a; background:#ddecf8; }
.status-badge.completed { color:#17653a; background:#dff3e8; }
.status-badge.failed, .status-badge.cancelled { color:#9b2c2c; background:#fde7e7; }
.result-filters { display:grid; grid-template-columns:minmax(220px,2fr) repeat(3,minmax(130px,1fr)); gap:8px; margin-bottom:10px; }
.result-filters input, .result-filters select { min-width:0; padding:8px; border:1px solid var(--border); border-radius:5px; background:#fff; }
.geometry-header { position:sticky; top:0; z-index:5; }
.password-field { display:grid; grid-template-columns:1fr auto; }
.password-field input { border-radius:6px 0 0 6px !important; }
.password-field button { padding:0 11px; border:1px solid #ccd3da; border-left:0; border-radius:0 6px 6px 0; background:#f4f7f9; cursor:pointer; }
#auth-form small { color:var(--muted); font-size:11px; }
.dialog-panel { position:relative; padding:28px; }
.wide-dialog { width:min(720px,calc(100% - 32px)); }
.jobs-list { display:grid; gap:9px; max-height:60vh; overflow:auto; }
#jobs-dialog { width:min(570px,calc(100% - 24px)); }
#jobs-dialog .dialog-panel { padding:clamp(16px,3vw,24px); }
#jobs-title { margin:0 40px 8px 0; font-size:20px; line-height:1.25; }
#jobs-dialog .dialog-close { display:grid; place-items:center; width:32px; height:32px; padding:0; border-radius:6px; line-height:1; color:var(--muted); cursor:pointer; }
#jobs-dialog .dialog-close:hover { background:#eef3f7; }
.job-card { display:grid; gap:6px; padding:10px 12px; border:1px solid var(--border); border-radius:8px; }
.job-heading { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center; column-gap:6px; }
.job-identity { min-width:0; display:grid; gap:2px; overflow-wrap:anywhere; }
.job-heading .status-badge { justify-self:end; }
.job-actions { display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
.job-inputs { margin-top:6px; font-size:13px; }
.job-inputs summary { cursor:pointer; color:var(--primary); width:fit-content; }
.job-inputs dl { display:grid; grid-template-columns:minmax(0,3fr) minmax(0,2fr); gap:4px 12px; margin:7px 0 0; }
.job-inputs dd { margin:0; overflow-wrap:anywhere; }
.job-identity strong { font-size:14px; }
.job-identity small { color:var(--muted); font-size:11px; }
.job-heading .dimension-badge { margin:0; }
.job-card p { margin:0; color:var(--muted); overflow-wrap:anywhere; }
.job-actions > :is(button,a) { display:inline-flex; align-items:center; min-height:24px; box-sizing:border-box; padding:2px 7px; border:1px solid var(--border); border-radius:4px; background:white; color:var(--primary); font:inherit; font-size:12px; line-height:16px; font-weight:500; text-decoration:none; cursor:pointer; }
.job-actions > [data-open-job] { border-color:#b2c8da; background:#edf5fb; }
.job-actions > :is(button,a):hover { filter:brightness(.94); }
#jobs-dialog :is(button,a):focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.account-profile { display:grid; grid-template-columns:max-content 1fr; gap:9px 16px; }
.account-profile dt { color:var(--muted); }
.account-profile dd { margin:0; overflow-wrap:anywhere; }
@media (max-width:850px) {
  header { flex-wrap:wrap; }
  .account-actions { width:100%; margin-left:0; overflow-x:auto; }
  .result-filters { grid-template-columns:1fr 1fr; }
  .geometry-table { overflow-x:auto; }
  .geometry-header { position:static; }
}
@media (max-width:520px) {
  .header-links { display:none; }
  .result-filters { grid-template-columns:1fr; }
  .header-button { white-space:nowrap; }
}

.feature-disabled { display:none !important; }
header { min-height:54px; padding:0 20px; }
main { min-height:calc(100vh - 118px); }

/* Stable tooltip placement: avoid the viewport fallback at the top-left. */
.help::after {
  position:absolute;
  left:calc(100% + 8px);
  right:auto;
  top:-8px;
  width:260px;
  max-width:min(260px, calc(100vw - 24px));
}
.results .help::after {
  left:auto;
  right:calc(100% + 8px);
}

/* Independent desktop scrolling for parameters and results. */
@media (min-width:851px) {
  body { overflow:hidden; }
  main { height:calc(100vh - 118px); min-height:0; }
  aside { min-height:0; overflow-y:auto; overflow-x:visible; }
  .results { min-height:0; overflow:auto; }
  footer { height:64px; overflow:hidden; }
}

/* Results use normal page scrolling; only the parameter sidebar scrolls independently. */
@media (min-width:851px) {
  body { overflow-y:auto; overflow-x:hidden; }
  main { height:auto; min-height:calc(100vh - 118px); align-items:start; }
  aside {
    position:sticky;
    top:0;
    height:calc(100vh - 64px);
    min-height:0;
    overflow-y:auto;
    overflow-x:visible;
  }
  .results { min-height:calc(100vh - 118px); overflow-x:auto; overflow-y:visible; }
  footer { height:auto; min-height:64px; overflow:visible; }
}

.help::after { display:none !important; }
.help-tooltip-layer { position:fixed; z-index:1000; width:max-content; max-width:min(280px, calc(100vw - 24px)); padding:10px 12px; border-radius:8px; color:#fff; background:#171717; box-shadow:0 6px 20px rgba(0,0,0,.22); font:12px/1.45 Arial,sans-serif; overflow-wrap:anywhere; pointer-events:none; }

.geometry-header > span { text-align:center; }
.geometry-header > span:not(.properties-heading) { display:flex; align-items:center; justify-content:center; gap:4px; flex-wrap:wrap; }
.geometry-header .properties-heading { text-align:center; }
.geometry-header .property-labels > span { padding:0; border:0; text-align:center; }
.orientations th { text-align:center; }
.orientations td:nth-child(4) { text-align:center; }
.orientations td:nth-child(4) .property { display:block; min-width:0; text-align:center; }
.results-head #result-summary:empty { display:none; }

/* Compact group columns: keep long symbols inside their own cells. */
.geometry summary > .group-cell { overflow:hidden; }
.group-cell .symbol-viewport { display:block; width:100%; max-width:100%; overflow-x:auto; overflow-y:hidden; white-space:nowrap; padding:4px 0; }
.group-cell .group-number { display:inline; margin-left:.35em; color:#536576; font-family:Consolas,monospace; white-space:nowrap; }
.orientations td.group-cell { overflow:hidden; }
.orientations td:nth-child(4) { text-align:center; }
.orientations td:nth-child(4) .property { display:block; min-width:0; text-align:center; }
.international-symbol { display:inline-block; font-family: "Times New Roman", Georgia, serif; font-size:1.08em; white-space:nowrap; }
.international-symbol .symbol-ce { display:inline-block; margin-right:.03em; }
.international-symbol sup, .international-symbol sub { font-size:.72em; }
.international-symbol .symbol-frac { display:inline-flex; flex-direction:column; vertical-align:middle; font-size:.75em; line-height:1.05; text-align:center; }
.international-symbol .symbol-frac > span:first-child { border-bottom:1px solid currentColor; }

/* Keep the G0 subscript and help icon on one line. */
.geometry-header > .g0-header { flex-wrap:nowrap !important; gap:3px; }
.geometry-header .g0-title { display:inline; padding:0; border:0; white-space:nowrap; overflow-wrap:normal; }

/* Compact per-column result filters. */
.geometry-header > .g0-header, .geometry-header > .filterable-header { flex-wrap:nowrap !important; gap:2px !important; padding-left:4px; padding-right:4px; }
.geometry-header .property-labels > .property-filter-label, .orientations .property-labels > .property-filter-label { display:inline-flex; align-items:center; justify-content:center; gap:2px; white-space:nowrap; padding:0; border:0; }
.result-filter-button { display:inline-grid; flex:0 0 18px; place-items:center; box-sizing:border-box; width:18px; height:18px; padding:0; border:1px solid #a6b6c6; border-radius:4px; background:#fff; color:#365c80; font:10px/1 Arial,sans-serif; cursor:pointer; vertical-align:middle; }
.result-filter-button:hover, .result-filter-button:focus { border-color:#2a6092; background:#edf5ff; }
.result-filter-button.active { background:#2b6193; color:#fff; border-color:#2b6193; }
.result-filter-menu { position:fixed; z-index:1200; box-sizing:border-box; min-width:112px; max-height:min(300px,calc(100vh - 16px)); overflow-y:auto; padding:4px; border:1px solid #bdc9d5; border-radius:6px; background:#fff; box-shadow:0 8px 24px #0003; }
.result-filter-menu button { display:block; width:100%; padding:6px 9px; border:0; border-radius:4px; background:transparent; color:#243746; text-align:left; font:12px/1.25 Arial,sans-serif; cursor:pointer; }
.result-filter-menu button:hover, .result-filter-menu button.selected { background:#e8f2fc; }
.filter-empty { padding:12px; margin:0; color:#596b7c; text-align:center; border:1px solid #d9e1e8; border-top:0; }

#geometry-list > .geometry[hidden], .orientations tr.orientation[hidden] { display:none !important; }

.reset-filter-button { color:#2b6193; background:#fff; border-color:#8da9c0; border-radius:4px; font:12px Arial,sans-serif; }
.reset-filter-button:hover { background:#edf5ff; }

.institution-field { position:relative; }
.institution-combobox { position:relative; }
.institution-menu { position:absolute; z-index:1250; top:calc(100% + 5px); left:0; right:0; padding:6px; border:1px solid #ccd3da; border-radius:7px; background:#fff; box-shadow:0 10px 28px rgba(0,0,0,.18); }
.institution-menu.hidden { display:none; }
.institution-options { max-height:min(260px,38vh); overflow-y:auto; overscroll-behavior:contain; }
#auth-form .institution-option { display:block; width:100%; padding:8px 10px; border:0; border-radius:4px; color:var(--text); background:#fff; text-align:left; cursor:pointer; }
#auth-form .institution-option:hover, #auth-form .institution-option:focus { color:#fff; background:var(--primary); outline:none; }
#auth-form .institution-option strong, #auth-form .institution-option small { display:block; }
#auth-form .institution-option small { margin-top:2px; color:var(--muted); font-size:11px; }
#auth-form .institution-option:hover small, #auth-form .institution-option:focus small { color:#eaf4ff; }
#auth-form .institution-manual { border-top:1px solid #e1e6eb; margin-top:4px; }
.institution-message { margin:6px; color:var(--muted); font-size:12px; }
.country-field { position:relative; }
.country-combobox { position:relative; }
#auth-form .country-toggle { box-sizing:border-box; width:100%; padding:10px 36px 10px 10px; border:1px solid #ccd3da; border-radius:6px; color:#66727c; background:#fff; text-align:left; cursor:pointer; position:relative; }
#auth-form .country-toggle::after { content:""; position:absolute; right:13px; top:50%; width:8px; height:8px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:translateY(-70%) rotate(45deg); }
#auth-form .country-toggle[aria-expanded="true"]::after { transform:translateY(-25%) rotate(225deg); }
#auth-form .country-toggle.has-value { color:var(--text); }
.country-menu { position:absolute; z-index:1200; top:calc(100% + 5px); left:0; right:0; padding:8px; border:1px solid #ccd3da; border-radius:7px; background:#fff; box-shadow:0 10px 28px rgba(0,0,0,.18); }
.country-menu.hidden { display:none; }
#auth-form #auth-country-search { position:sticky; top:0; z-index:1; margin-bottom:6px; }
.country-options { max-height:min(260px, 38vh); overflow-y:auto; overscroll-behavior:contain; }
#auth-form .country-option { display:block; width:100%; padding:8px 10px; border:0; border-radius:4px; color:var(--text); background:#fff; text-align:left; cursor:pointer; }
#auth-form .country-option:hover, #auth-form .country-option:focus { color:#fff; background:var(--primary); outline:none; }
#auth-form .country-option[aria-selected="true"] { font-weight:700; background:#e7f1f8; color:var(--primary); }
.country-empty { margin:6px; color:var(--muted); font-size:12px; }
.country-native-select { position:absolute !important; width:1px !important; height:1px !important; padding:0 !important; margin:0 !important; opacity:0; pointer-events:none; }

.orientations { table-layout:fixed; }
.orientations td > .property-set { width:100%; min-width:0; }
.reset-filter-button:disabled { color:#8a969f; border-color:#c8d0d6; background:#f4f6f7; cursor:not-allowed; opacity:.8; }

.international-symbol .symbol-scripts { display:inline-grid; grid-template-rows:1fr 1fr; align-items:center; vertical-align:middle; margin-left:.01em; line-height:.72; }
.international-symbol .symbol-scripts > sup, .international-symbol .symbol-scripts > sub { position:static; grid-column:1; margin:0; padding:0; line-height:1; text-align:left; }
.international-symbol .symbol-scripts > sup { grid-row:1; align-self:end; }
.international-symbol .symbol-scripts > sub { grid-row:2; align-self:start; }

.jobs-retention-notice { margin:-4px 0 14px; color:var(--muted); font-size:12px; }
