:root {
  color-scheme: dark;
  --bg: #101016;
  --surface: #181820;
  --surface-raised: #20202a;
  --border: #30303c;
  --text: #f4f3f8;
  --muted: #a4a2b2;
  --accent: #b9a7ff;
  --accent-strong: #9a83f5;
  --danger: #ff9aab;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #07152d; color: var(--text); }
 /* Lightweight adaptation of iprofi_game's space background: nebula palette + stars only.
    No cloud elements, filters, frame loop, planets, galaxies or comet effects. */
.space-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background-color: #07152d;
  background-image:
    radial-gradient(ellipse 65% 72% at 12% 12%, rgba(0, 162, 255, .22), transparent 73%),
    radial-gradient(ellipse 63% 70% at 85% 14%, rgba(154, 44, 255, .24), transparent 72%),
    radial-gradient(ellipse 56% 74% at 78% 78%, rgba(246, 28, 236, .14), transparent 74%),
    radial-gradient(ellipse 63% 68% at 19% 87%, rgba(0, 240, 255, .13), transparent 73%),
    radial-gradient(ellipse 52% 61% at 52% 48%, rgba(72, 78, 255, .18), transparent 73%),
    linear-gradient(120deg, #07152d, #090e23 55%, #07152d);
}
.space-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 24%, rgba(4, 8, 22, .06) 62%, rgba(4, 8, 22, .34) 100%);
}
#starfield-canvas { display: block; width: 100%; height: 100%; }
.app-shell { position: relative; z-index: 1; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.app-shell { width: min(1160px, calc(100% - 48px)); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #ffffff0d; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 700; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #b9a7ff55; border-radius: 11px; background: #b9a7ff12; }
.brand-mark svg { width: 19px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.brand-muted { color: var(--muted); font-weight: 500; }
.auth-layout { flex: 1; display: grid; grid-template-columns: 1fr minmax(320px, 420px); gap: clamp(40px, 9vw, 120px); align-items: center; padding: 72px 0 100px; }
.intro { max-width: 550px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .15em; margin: 0 0 20px; }
h1 { font-size: clamp(36px, 5vw, 56px); line-height: 1.08; letter-spacing: -.055em; margin: 0 0 20px; }
.accent { color: var(--accent); }
.muted, .field-hint { color: var(--muted); line-height: 1.6; font-size: 14px; }
.panel { border: 1px solid var(--border); background: linear-gradient(145deg, #1d1d27, #17171e); border-radius: 20px; box-shadow: 0 24px 80px #0000001c; }
.login-panel { padding: 30px; display: flex; flex-direction: column; }
.panel-heading { margin-bottom: 26px; }
h2 { font-size: 19px; letter-spacing: -.025em; margin: 0 0 8px; }
.panel-heading p { margin: 0; }
label { font-size: 13px; font-weight: 600; margin: 0 0 9px; }
input { width: 100%; min-width: 0; color: var(--text); background: #111117; border: 1px solid var(--border); border-radius: 11px; padding: 13px 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px #9a83f522; }
.login-panel input { margin-bottom: 20px; }
.button { min-height: 43px; padding: 0 17px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-weight: 650; font-size: 13px; transition: background .15s, transform .15s; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--accent); color: #171321; }
.button-primary:hover { background: #c9bcff; }
.button-full { width: 100%; display: flex; align-items: center; justify-content: space-between; margin-top: 5px; }
.button-quiet { color: var(--muted); background: transparent; border-color: var(--border); }
.button-quiet:hover { background: var(--surface-raised); color: var(--text); }
.error-message { color: var(--danger); background: #ff9aab10; border: 1px solid #ff9aab30; border-radius: 9px; padding: 10px 12px; font-size: 13px; }
.workspace { flex: 1; padding: 52px 0 70px; }
.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 28px; }
.workspace-heading h1 { font-size: clamp(30px, 4vw, 42px); margin: 0; }
.user-pill { border: 1px solid var(--border); border-radius: 999px; padding: 8px 12px; color: var(--muted); font-size: 12px; }
.search-panel { padding: 24px; }
.search-panel label { display: block; }
.search-row { display: flex; gap: 10px; }
.search-row input { flex: 1; }
.field-hint { font-size: 12px; margin: 12px 0 0; }
.results { margin-top: 18px; min-height: 260px; display: grid; place-items: center; padding: 32px; }
.empty-state { max-width: 360px; text-align: center; }
.empty-state h2 { margin-top: 16px; }
.empty-state p { margin-bottom: 0; }
.empty-icon { width: 46px; height: 46px; margin: 0 auto; border: 1px solid var(--border); border-radius: 15px; display: grid; place-items: center; background: #ffffff04; }
.empty-icon svg { width: 22px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; }
.footer { border-top: 1px solid #ffffff0d; padding: 20px 0; display: flex; justify-content: space-between; gap: 12px; color: #777585; font-size: 11px; }
@media (max-width: 720px) {
  .app-shell { width: min(100% - 32px, 560px); }
  .topbar { height: 70px; }
  .auth-layout { grid-template-columns: 1fr; gap: 30px; padding: 46px 0 60px; }
  .intro h1 { font-size: clamp(34px, 10vw, 46px); }
  .intro .muted { margin-bottom: 0; }
  .login-panel { padding: 23px; }
  .workspace { padding: 36px 0 48px; }
  .search-panel { padding: 18px; }
  .search-row { flex-direction: column; }
  .search-row .button { width: 100%; }
  .results { min-height: 230px; padding: 24px; }
  .footer { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; } }

.import-panel { padding: 24px; margin-bottom: 18px; }
.import-panel .panel-heading { margin-bottom: 18px; }
.import-panel .panel-heading p { max-width: 760px; }
.import-panel input[type="file"] { flex: 1; }
.import-progress { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 18px; }
.progress-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font-size: 13px; }
.event-log { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }
.event-entry { border: 1px solid var(--border); background: #111117; padding: 9px 11px; border-radius: 9px; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.event-entry[data-level="error"] { border-color: #ff9aab50; color: var(--danger); }
@media (max-width: 720px) {
  .import-panel { padding: 18px; }
  .import-panel .search-row { flex-direction: column; }
  .import-panel .search-row .button { width: 100%; }
}


.result-summary { width: 100%; margin: 0 0 4px; color: var(--muted); font-size: 13px; }
.participant-list { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.participant-card { width: 100%; min-width: 0; border: 1px solid var(--border); background: #111117; border-radius: 14px; padding: 18px; }
.participant-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.participant-heading h2 { margin: 0; overflow-wrap: anywhere; }
.participant-facts, .history-fields { display: grid; grid-template-columns: minmax(100px, 180px) minmax(0, 1fr); gap: 7px 14px; margin: 16px 0; font-size: 13px; }
.participant-facts dt, .history-fields dt { color: var(--muted); overflow-wrap: anywhere; }
.participant-facts dd, .history-fields dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.history-details { border-top: 1px solid var(--border); padding-top: 13px; margin-top: 12px; }
.history-details summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 650; }
.history-item { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.history-item h3 { margin: 0; font-size: 14px; }
.history-fields { grid-template-columns: minmax(110px, 240px) minmax(0, 1fr); }
.results { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; }
.results > .empty-state { align-self: center; padding: 35px 0; }
@media (max-width: 720px) {
  .participant-card { padding: 14px; }
  .participant-facts, .history-fields { grid-template-columns: 1fr; gap: 3px; }
  .participant-facts dd, .history-fields dd { margin-bottom: 9px; }
}


/* Compact participant view with separate personal-data and participation histories. */
.current-source { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.participant-facts { margin: 12px 0 8px; }
.participant-facts dt, .participant-facts dd { padding: 2px 0; }
.history-details { margin-top: 12px; }
.change-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.change-item { min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #ffffff03; }
.change-item h3 { font-size: 13px; margin: 0 0 8px; }
.change-values { list-style: none; margin: 0; padding: 0; }
.change-values li { font-size: 12px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; padding: 4px 0; }
.compact-note { margin: 12px 0 0; }
.participation-item { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.participation-item > summary { cursor: pointer; color: var(--text); font-size: 13px; font-weight: 600; }
.participation-item .history-fields { margin-bottom: 4px; }
@media (max-width: 720px) {
  .change-list { grid-template-columns: 1fr; }
}


/* Canonical field groups used in participant and participation details. */
.history-field-groups { display: grid; gap: 12px; margin-top: 10px; }
.history-field-group { min-width: 0; }
.history-field-group h4 { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 700; }
.history-field-group .history-fields { margin: 0; }


/* Keep identity and education at participant level; history contains participation-only fields. */
.participant-data-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 16px 0; }
.participant-data-group { min-width: 0; }
.participant-data-group h3 { margin: 0 0 10px; font-size: 14px; color: var(--accent); }
.participant-data-group .participant-facts { margin: 0; }
@media (max-width: 720px) { .participant-data-groups { grid-template-columns: 1fr; } }


/* Copy controls and compact participation table. */
.participant-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.participant-title h2 { margin: 0; }
.copy-button { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--muted); padding: 3px 6px; font: inherit; font-size: 10px; line-height: 1.4; cursor: pointer; opacity: .72; }
.copy-button:hover, .copy-button:focus-visible { opacity: 1; border-color: var(--accent); color: var(--accent); }
.copy-button-compact { font-size: 11px; padding: 5px 8px; }
.copy-value { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.copy-value-text { overflow-wrap: anywhere; }
.copy-toast { position: fixed; z-index: 9999; left: 50%; bottom: 24px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; background: #262532; color: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 13px; box-shadow: 0 8px 30px #0005; transition: opacity .18s ease, transform .18s ease; }
.copy-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.participation-table-wrap { width: 100%; overflow-x: auto; margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; }
.participation-table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 12px; }
.participation-table th, .participation-table td { text-align: left; vertical-align: top; padding: 10px 11px; border-bottom: 1px solid var(--border); }
.participation-table th { color: var(--muted); background: #ffffff05; font-size: 11px; font-weight: 650; white-space: nowrap; }
.participation-table tbody tr:last-child td { border-bottom: 0; }
.participation-table tbody tr:hover { background: #ffffff04; }
.participation-table .copy-value { align-items: flex-start; }
.participation-table .copy-button { opacity: .55; }
.participation-table .copy-value:hover .copy-button, .participation-table .copy-button:focus-visible { opacity: 1; }
.status-badge { display: inline-block; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.status-gold { color: #f6d56b; background: #f6d56b1c; border-color: #f6d56b55; }
.status-silver { color: #d5dce8; background: #d5dce81a; border-color: #d5dce855; }
.status-bronze { color: #e7a071; background: #e7a0711c; border-color: #e7a07155; }
.status-prize { color: #c6a8ff; background: #c6a8ff1c; border-color: #c6a8ff55; }
@media (max-width: 720px) {
  .participant-title { align-items: flex-start; }
  .copy-button { opacity: .9; }
  .copy-toast { width: max-content; max-width: calc(100vw - 32px); text-align: center; }
}

.status-winner { color: #7ed6a5; background: #7ed6a51c; border-color: #7ed6a555; }
.user-pill { display: inline-flex; align-items: center; gap: 6px; }
.user-pill .copy-button { opacity: .85; }


/* Values themselves are click-to-copy; keep the interface free of per-field buttons. */
.copy-button { display: none !important; }
.copy-value.is-copyable, .copyable-heading, .user-pill.is-copyable, .status-badge.is-copyable { cursor: copy; }
.copy-value.is-copyable { border-radius: 4px; outline-offset: 3px; }
.copy-value.is-copyable:hover .copy-value-text, .copy-value.is-copyable:focus-visible .copy-value-text,
.copyable-heading:hover, .copyable-heading:focus-visible, .user-pill.is-copyable:hover, .user-pill.is-copyable:focus-visible {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}
.copy-value.is-copyable:focus-visible, .copyable-heading:focus-visible, .user-pill.is-copyable:focus-visible, .status-badge.is-copyable:focus-visible {
  outline: 2px solid var(--accent);
}


/* Minimum readable UI font size. */
*:not(svg):not(path) { font-size: max(14px, 1em); }

/* Participation-history controls and season grouping. */
.history-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin: 14px 0 8px; }
.history-filter-label { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-weight: 600; }
.history-season-filter { width: auto; min-width: 150px; padding: 9px 12px; font: inherit; }
.history-diploma-toggle { display: inline-flex; align-items: center; gap: 9px; margin: 0; cursor: pointer; }
.history-diploma-checkbox { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-strong); }
.history-filter-summary { color: var(--muted); margin: 8px 0; }
.participation-table tbody tr.season-band-0 { background: #ffffff03; }
.participation-table tbody tr.season-band-1 { background: #b9a7ff0b; }
.participation-table tbody tr[hidden] { display: none; }
.change-values .copy-value { display: inline-flex; }
.change-values li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px; }
@media (max-width: 720px) {
  .history-controls { align-items: flex-start; flex-direction: column; gap: 12px; }
  .history-season-filter { width: 100%; }
}


/* Workspace navigation and refined import controls. */
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-actions form { margin: 0; }
.workspace-heading .user-pill { display: none; }
.workspace-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 20px 0 18px; }
.workspace-tab { border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; background: transparent; color: var(--muted); padding: 12px 18px; font: inherit; font-weight: 650; cursor: pointer; }
.workspace-tab:hover { color: var(--text); background: #ffffff06; }
.workspace-tab.is-active { color: var(--text); background: var(--surface); border-color: var(--border); box-shadow: inset 0 -2px var(--accent); }
.workspace-tab-panel[hidden] { display: none !important; }
.workspace-tab-panel.is-active { display: block; }
.file-upload-row { align-items: center; }
.file-upload-row input[type="file"] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.file-picker { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; white-space: nowrap; }
.file-picker:focus-within, #season-file:focus-visible + .file-picker { outline: 2px solid var(--accent); outline-offset: 3px; }
.file-name { min-width: 0; flex: 1 1 180px; color: var(--muted); overflow-wrap: anywhere; }
.participant-facts dt, .history-field-group h4, .participant-data-group h3 { color: var(--accent); font-weight: 650; }
.participant-facts dd { color: var(--text); }
.change-item h3 { color: var(--accent); }
.change-values li { color: var(--text); }
.history-season-multiselect { display: flex; flex-wrap: wrap; gap: 7px; }
.season-option { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 7px 10px; cursor: pointer; }
.season-option:has(input:checked) { border-color: #b9a7ff88; background: #b9a7ff14; }
.season-option input { accent-color: var(--accent-strong); width: 15px; height: 15px; margin: 0; }
.season-option-all { font-weight: 650; }
.footer { justify-content: center; }
@media (max-width: 720px) {
  .topbar-actions { gap: 8px; }
  .topbar-actions .user-pill { max-width: 120px; overflow-wrap: anywhere; }
  .workspace-tab { flex: 1; padding: 11px 10px; }
  .file-upload-row { align-items: stretch; }
  .file-picker { width: 100%; }
}


/* Refined hierarchy: compact uppercase section labels and clearer values. */
.participant-data-group h3,
.history-field-group h4,
.change-item h3 {
  color: #9b8be0;
  text-transform: uppercase;
  letter-spacing: .075em;
  font-size: 11px;
  font-weight: 750;
}
.participant-facts dt,
.history-fields dt {
  color: #aaa0d4;
  font-weight: 600;
}
.participant-facts dd,
.history-fields dd {
  color: #f4f3f8;
  font-weight: 450;
}
.change-item {
  background: #171720;
  border-color: #353344;
}
.change-values li > span:first-child {
  color: #a99be0;
  font-weight: 650;
}
.change-values .copy-value,
.change-values .copy-value-text {
  color: #f4f3f8;
}
.history-diploma-toggle {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 10px;
  font-weight: 550;
}
.history-diploma-toggle:has(input:checked) {
  border-color: #b9a7ff88;
  background: #b9a7ff14;
}
.history-diploma-checkbox {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  accent-color: var(--accent-strong);
}
.workspace-tabs {
  display: flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid #ffffff0b;
  border-radius: 12px;
  background: #111117aa;
  margin: 20px 0 22px;
}
.workspace-tab {
  border: 0;
  border-radius: 8px;
  padding: 9px 15px;
  color: #9693a5;
  background: transparent;
  font-weight: 600;
  transition: color .15s ease, background .15s ease;
}
.workspace-tab:hover {
  background: #ffffff07;
  color: var(--text);
}
.workspace-tab.is-active {
  color: #e9e3ff;
  background: #b9a7ff18;
  box-shadow: none;
}
@media (max-width: 720px) {
  .workspace-tabs { width: 100%; }
  .workspace-tab { flex: 1; padding: 9px 10px; }
}


/* Align the diploma filter with the season checkbox row. */
.history-controls {
  align-items: center;
}
.history-diploma-toggle {
  align-self: center;
  min-height: 42px;
  box-sizing: border-box;
}
.season-option {
  min-height: 42px;
  box-sizing: border-box;
}
@media (max-width: 720px) {
  .history-controls {
    align-items: flex-start;
  }
  .history-diploma-toggle {
    align-self: flex-start;
  }
}


/* Keep diploma toggle at the top of the wrapped season selector, not vertically centered
   against the selector's full multi-row height. */
.history-controls .history-diploma-toggle {
  align-self: flex-start;
  margin-top: 0;
}


.export-options {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  animation: export-panel-in .2s ease-out;
}
.export-options[hidden], .export-progress[hidden] { display: none !important; }
.export-options-heading h3 { margin: 0 0 5px; }
.export-options-heading p { margin: 0 0 18px; }
.export-filter-group { margin: 16px 0; }
.export-filter-group h4 { margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-size: 12px; }
.export-checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.export-check { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; margin: 0; border: 1px solid var(--border); border-radius: 8px; background: #ffffff04; cursor: pointer; }
.export-check:has(input:checked) { border-color: #b9a7ff88; background: #b9a7ff12; }
.export-check input { accent-color: var(--accent-strong); width: 16px; height: 16px; margin: 0; flex: 0 0 auto; }
.export-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.export-progress { display: flex; align-items: center; gap: 13px; margin-top: 16px; padding: 14px; border-radius: 10px; background: #b9a7ff0d; }
.export-progress p { margin: 4px 0 0; }
.export-spinner { width: 22px; height: 22px; border: 3px solid #b9a7ff35; border-top-color: var(--accent-strong); border-radius: 50%; animation: export-spin .8s linear infinite; flex: 0 0 auto; }
.export-progress:not(.is-running) .export-spinner { display: none; }
@keyframes export-spin { to { transform: rotate(360deg); } }
@keyframes export-panel-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }


/* Give export checkbox controls a consistent gap between the box and its label. */
.export-check { gap: 10px; }
.export-check input { margin-right: 2px; }
.export-progress.is-success .export-spinner { display: none; }
.export-progress.is-success::before {
  content: "✓"; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%;
  background: #8fd6a51f; color: #8fd6a5; font-size: 18px; font-weight: 800;
}


/* Align export checkboxes and labels on the same visual center line. */
.export-check { display: inline-flex; align-items: center; line-height: 1.2; gap: 10px; }
.export-check input { display: block; align-self: center; margin: 0; flex: 0 0 16px; width: 16px; height: 16px; }
.export-check span { display: block; line-height: 1.2; }
.recent-queries { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.recent-queries[hidden] { display: none !important; }
.recent-queries-label { color: var(--muted); font-size: 12px; line-height: 28px; }
.recent-query-list { display: flex; flex-wrap: wrap; gap: 6px; }
.recent-query-chip { max-width: 100%; overflow-wrap: anywhere; border: 1px solid var(--border); border-radius: 999px; padding: 5px 10px; color: var(--muted); background: #ffffff05; font: inherit; font-size: 12px; cursor: pointer; }
.recent-query-chip:hover, .recent-query-chip:focus-visible { color: var(--text); border-color: #b9a7ff88; background: #b9a7ff12; }


/* Export chips: keep checkbox and caption side by side; override generic form-label layout. */
.export-options .export-check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  white-space: nowrap;
  line-height: 1.2;
}
.export-options .export-check input[type="checkbox"] {
  display: inline-block;
  position: static;
  align-self: center;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0;
  padding: 0;
  transform: none;
}
.export-options .export-check span {
  display: inline;
  align-self: center;
  margin: 0;
  padding: 0;
  line-height: 1.2;
}


/* Two-step CSV import destination selector. */
.import-target { margin-top: 22px; padding: 22px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel, #17171f); }
.import-target[hidden], .import-season-choice[hidden] { display: none !important; }
.import-target-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.import-mode-card { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.import-mode-card:has(input:checked) { border-color: #a995f7; background: #a995f710; }
.import-mode-card input { flex: 0 0 16px; width: 16px; height: 16px; margin: 3px 0 0; }
.import-mode-card span { display: grid; gap: 6px; }
.import-mode-card strong { color: var(--text); }
.import-mode-card small { color: var(--muted); font-size: 13px; line-height: 1.5; }
.import-season-choice { display: grid; gap: 8px; max-width: 520px; margin: 14px 0; }
.import-season-choice select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface, #111118); font: inherit; }
.import-warning { padding: 12px 14px; border: 1px solid #a995f755; border-radius: 10px; background: #a995f710; color: var(--text); }
#import-preflight-summary { margin: 16px 0; overflow-wrap: anywhere; }
@media (max-width: 680px) { .import-target { padding: 16px; } .import-target-modes { grid-template-columns: 1fr; } }

/* Aligned file selection controls */
.import-panel #import-form > label { display: block; margin-bottom: 10px; }
.file-upload-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.file-upload-row .file-picker { width: auto; min-height: 48px; margin: 0; padding: 0 20px; }
.file-upload-row .file-name { display: block; min-width: 0; font-size: 14px; line-height: 1.4; }
.file-upload-row > button[type="submit"] { min-height: 48px; margin: 0; padding-inline: 22px; }
@media (max-width: 720px) {
  .file-upload-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .file-upload-row .file-picker, .file-upload-row > button[type="submit"] { width: 100%; }
  .file-upload-row .file-name { padding: 0 2px; }
}

/* Initial CSV transfer: upload progress, speed and estimated remaining time. */
.upload-progress-details { margin-top: 14px; }
.upload-progress-details[hidden] { display: none !important; }
.upload-progress-track { width: 100%; height: 9px; border-radius: 999px; overflow: hidden; background: var(--border); }
.upload-progress-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .2s ease; }
.upload-progress-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.upload-progress-stats strong { color: var(--text); font-weight: 700; }
@media (max-width: 720px) { .upload-progress-stats { gap: 7px 12px; } }
@media (prefers-reduced-motion: reduce) { .upload-progress-fill { transition: none; } }
